diff --git a/TR5Main/Game/Box.h b/TR5Main/Game/Box.h index 9cc7a8881..8a76f44af 100644 --- a/TR5Main/Game/Box.h +++ b/TR5Main/Game/Box.h @@ -288,8 +288,8 @@ short AIGuard(CREATURE_INFO* creature); void AlertNearbyGuards(ITEM_INFO* item); void AlertAllGuards(short itemNumber); void CreatureKill(ITEM_INFO* item, int killAnim, int killState, short laraAnim); -short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, function func); -short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, function func); +short CreatureEffect2(ITEM_INFO* item, BITE_INFO* bite, short damage, short angle, std::function func); +short CreatureEffect(ITEM_INFO* item, BITE_INFO* bite, std::function func); void CreatureUnderwater(ITEM_INFO* item, int depth); void CreatureFloat(short itemNumber); void CreatureJoint(ITEM_INFO* item, short joint, short required); diff --git a/TR5Main/Game/debris.cpp b/TR5Main/Game/debris.cpp index ad27b90c5..cfb50ed94 100644 --- a/TR5Main/Game/debris.cpp +++ b/TR5Main/Game/debris.cpp @@ -4,7 +4,7 @@ #include "setup.h" #include "control.h" #include "trmath.h" - +using std::vector; ShatterImpactInfo ShatterImpactData; SHATTER_ITEM ShatterItem; short SmashedMeshCount; diff --git a/TR5Main/Game/debris.h b/TR5Main/Game/debris.h index 2025aa4c3..ba30eb052 100644 --- a/TR5Main/Game/debris.h +++ b/TR5Main/Game/debris.h @@ -40,7 +40,7 @@ typedef struct ShatterImpactInfo typedef struct DebrisMesh { RENDERER_BUCKETS bucket; - array vertices; + std::array vertices; }; typedef struct DebrisFragment @@ -85,7 +85,7 @@ typedef struct DEBRIS_STRUCT }; extern SHATTER_ITEM ShatterItem; -extern vector DebrisFragments; +extern std::vector DebrisFragments; extern ShatterImpactInfo ShatterImpactData; extern short SmashedMeshCount; extern MESH_INFO* SmashedMesh[32]; diff --git a/TR5Main/Game/effect.h b/TR5Main/Game/effect.h index bc4bd3177..9b643b7dc 100644 --- a/TR5Main/Game/effect.h +++ b/TR5Main/Game/effect.h @@ -20,7 +20,7 @@ struct FX_INFO short flag2; }; -extern function effect_routines[]; +extern std::function effect_routines[]; extern FX_INFO* Effects; bool ItemNearLara(PHD_3DPOS* pos, int radius); diff --git a/TR5Main/Game/inventory.h b/TR5Main/Game/inventory.h index 48b2091fe..f604f59d4 100644 --- a/TR5Main/Game/inventory.h +++ b/TR5Main/Game/inventory.h @@ -333,7 +333,7 @@ private: float m_deltaMovement; InventoryObjectDefinition m_objectsTable[INVENTORY_TABLE_SIZE]; int m_type; - vector m_combinations; + std::vector m_combinations; int m_activeGui; float m_cameraY; float m_cameraTilt; diff --git a/TR5Main/Game/lara.h b/TR5Main/Game/lara.h index 13778db62..28eebe5b4 100644 --- a/TR5Main/Game/lara.h +++ b/TR5Main/Game/lara.h @@ -24,8 +24,8 @@ extern byte LaraNodeUnderwater[NUM_LARA_MESHES]; #define INIT_LARA_MESHES(mesh, to, from) Lara.meshPtrs[mesh] = LARA_MESHES(to, mesh) = LARA_MESHES(from, mesh) #define LaraRoutineFunction void(ITEM_INFO* item, COLL_INFO* coll) -extern function lara_control_routines[NUM_LARA_STATES + 1]; -extern function lara_collision_routines[NUM_LARA_STATES + 1]; +extern std::function lara_control_routines[NUM_LARA_STATES + 1]; +extern std::function lara_collision_routines[NUM_LARA_STATES + 1]; ///extern function lara_camera_routines[NUM_LARA_STATES + 1]; void lara_as_pbleapoff(ITEM_INFO* item, COLL_INFO* coll); diff --git a/TR5Main/Game/savegame.h b/TR5Main/Game/savegame.h index b679364d6..8f77d7fc9 100644 --- a/TR5Main/Game/savegame.h +++ b/TR5Main/Game/savegame.h @@ -47,7 +47,7 @@ typedef struct SAVEGAME_INFO typedef struct SaveGameHeader { - string LevelName; + std::string LevelName; int Days; int Hours; int Minutes; diff --git a/TR5Main/Libs/lua/lauxlib.h b/TR5Main/Libs/lua/lauxlib.h index 9a2e66aa0..81b6c5b00 100644 --- a/TR5Main/Libs/lua/lauxlib.h +++ b/TR5Main/Libs/lua/lauxlib.h @@ -218,7 +218,7 @@ LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, ** =================================================================== */ -/* print a string */ +/* print a std::string */ #if !defined(lua_writestring) #define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) #endif diff --git a/TR5Main/Libs/lua/luaconf.h b/TR5Main/Libs/lua/luaconf.h index 66c622530..2448b0d23 100644 --- a/TR5Main/Libs/lua/luaconf.h +++ b/TR5Main/Libs/lua/luaconf.h @@ -160,7 +160,7 @@ /* ** LUA_PATH_SEP is the character that separates templates in a path. -** LUA_PATH_MARK is the string that marks the substitution points in a +** LUA_PATH_MARK is the std::string that marks the substitution points in a ** template. ** LUA_EXEC_DIR in a Windows path is replaced by the executable's ** directory. @@ -427,7 +427,7 @@ @@ lua_number2str converts a float to a string. @@ l_mathop allows the addition of an 'l' or 'f' to all math operations. @@ l_floor takes the floor of a float. -@@ lua_str2number converts a decimal numeric string to a number. +@@ lua_str2number converts a decimal numeric std::string to a number. */ @@ -612,7 +612,7 @@ /* -@@ lua_strx2number converts an hexadecimal numeric string to a number. +@@ lua_strx2number converts an hexadecimal numeric std::string to a number. ** In C99, 'strtod' does that conversion. Otherwise, you can ** leave 'lua_strx2number' undefined and Lua will provide its own ** implementation. diff --git a/TR5Main/Libs/zlib/unzip.h b/TR5Main/Libs/zlib/unzip.h index 20ee2d55e..618e3a0ca 100644 --- a/TR5Main/Libs/zlib/unzip.h +++ b/TR5Main/Libs/zlib/unzip.h @@ -168,7 +168,7 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file, char *szComment, uLong uSizeBuf)); /* - Get the global comment string of the ZipFile, in the szComment buffer. + Get the global comment std::string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. return the number of byte copied or an error code <0 */ @@ -215,12 +215,12 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain somes info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filemane std::string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment + if szComment!=NULL, the comment std::string of the file will be copied in szComment (commentBufferSize is the size of the buffer) */ diff --git a/TR5Main/Libs/zlib/zlib.h b/TR5Main/Libs/zlib/zlib.h index 52cb529f6..2f3e8ea1b 100644 --- a/TR5Main/Libs/zlib/zlib.h +++ b/TR5Main/Libs/zlib/zlib.h @@ -285,7 +285,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be + msg may be set but then points to a static std::string (which must not be deallocated). */ @@ -388,7 +388,7 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). + static std::string (which must not be deallocated). */ /* Advanced functions */ @@ -427,10 +427,10 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a + std::string match). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate + Huffman coding and less std::string matching; it is somewhat intermediate between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. @@ -718,7 +718,7 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding + Writes the given null-terminated std::string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ @@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null + condition is encountered. The std::string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. */ diff --git a/TR5Main/Objects/TR4/Entity/tr4_baboon.cpp b/TR5Main/Objects/TR4/Entity/tr4_baboon.cpp index 6c30b2ceb..1cbfc3110 100644 --- a/TR5Main/Objects/TR4/Entity/tr4_baboon.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_baboon.cpp @@ -8,7 +8,7 @@ #include "Lara.h" #include "switch.h" #include "tomb4fx.h" - +using std::vector; BaboonRespawnClass BaboonRespawn; static BITE_INFO baboonBite = { 10, 10, 11, 4 }; diff --git a/TR5Main/Objects/TR4/Entity/tr4_baboon.h b/TR5Main/Objects/TR4/Entity/tr4_baboon.h index b9002f83c..7c325809c 100644 --- a/TR5Main/Objects/TR4/Entity/tr4_baboon.h +++ b/TR5Main/Objects/TR4/Entity/tr4_baboon.h @@ -13,7 +13,7 @@ struct BaboonRespawnStruct class BaboonRespawnClass { private: - vector baboonRespawnArray; + std::vector baboonRespawnArray; public: void Free(void); void Add(ITEM_INFO* item, int max_count); diff --git a/TR5Main/Renderer/Renderer11.h b/TR5Main/Renderer/Renderer11.h index 8223b9e9c..25b670697 100644 --- a/TR5Main/Renderer/Renderer11.h +++ b/TR5Main/Renderer/Renderer11.h @@ -8,7 +8,6 @@ #include "ShadowLightBuffer.h" #include "RoomBuffer.h" #include "ItemBuffer.h" -#include "CameraMatrixBuffer.h" #include "Frustum.h" #include "items.h" @@ -16,6 +15,7 @@ #include #include "VertexBuffer.h" #include "RenderTarget2D.h" +#include class RenderTarget2D; @@ -42,17 +42,17 @@ struct RendererDisplayMode }; struct RendererVideoAdapter { - string Name; + std::string Name; int Index; - vector DisplayModes; + std::vector DisplayModes; }; struct RendererVertex { - Vector3 Position; - Vector3 Normal; - Vector2 UV; - Vector4 Color; + DirectX::SimpleMath::Vector3 Position; + DirectX::SimpleMath::Vector3 Normal; + DirectX::SimpleMath::Vector2 UV; + DirectX::SimpleMath::Vector4 Color; float Bone; }; @@ -151,7 +151,7 @@ struct RendererHUDBar | | | 6-----------7-----------8 */ - RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, array colors); + RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, std::array colors); }; struct RendererStringToDraw @@ -159,8 +159,8 @@ struct RendererStringToDraw float X; float Y; int Flags; - wstring String; - Vector3 Color; + std::wstring String; + DirectX::SimpleMath::Vector3 Color; }; struct RendererPolygon @@ -174,32 +174,32 @@ struct RendererPolygon struct RendererBone { - Vector3 Translation; - Matrix GlobalTransform; - Matrix Transform; - Vector3 GlobalTranslation; - vector Children; + DirectX::SimpleMath::Vector3 Translation; + DirectX::SimpleMath::Matrix GlobalTransform; + DirectX::SimpleMath::Matrix Transform; + DirectX::SimpleMath::Vector3 GlobalTranslation; + std::vector Children; RendererBone* Parent; int Index; - Vector3 ExtraRotation; + DirectX::SimpleMath::Vector3 ExtraRotation; byte ExtraRotationFlags; RendererBone(int index) { Index = index; ExtraRotationFlags = 0; - Translation = Vector3(0, 0, 0); - ExtraRotation = Vector3(0, 0, 0); + Translation = DirectX::SimpleMath::Vector3(0, 0, 0); + ExtraRotation = DirectX::SimpleMath::Vector3(0, 0, 0); } }; struct RendererLight { - Vector3 Position; + DirectX::SimpleMath::Vector3 Position; float Type; - Vector3 Color; + DirectX::SimpleMath::Vector3 Color; bool Dynamic; - Vector4 Direction; + DirectX::SimpleMath::Vector4 Direction; float Intensity; float In; float Out; @@ -213,21 +213,21 @@ struct RendererLight struct RendererAnimatedTexture { int Id; - Vector2 UV[4]; + DirectX::SimpleMath::Vector2 UV[4]; }; struct RendererAnimatedTextureSet { int NumTextures; - vector Textures; + std::vector Textures; }; struct RendererBucket { - vector Vertices; - vector Indices; - vector Polygons; - vector AnimatedPolygons; + std::vector Vertices; + std::vector Indices; + std::vector Polygons; + std::vector AnimatedPolygons; int StartVertex; int StartIndex; int NumTriangles; @@ -240,41 +240,41 @@ struct RendererStatic int Id; short RoomIndex; MESH_INFO* Mesh; - Matrix World; + DirectX::SimpleMath::Matrix World; }; struct RendererRoom { ROOM_INFO* Room; - Vector4 AmbientLight; + DirectX::SimpleMath::Vector4 AmbientLight; RendererBucket Buckets[NUM_BUCKETS]; RendererBucket AnimatedBuckets[NUM_BUCKETS]; - vector Lights; - vector Statics; + std::vector Lights; + std::vector Statics; bool Visited; float Distance; int RoomNumber; - vector LightsToDraw; + std::vector LightsToDraw; }; struct RendererRoomNode { short From; short To; - Vector4 ClipPort; + DirectX::SimpleMath::Vector4 ClipPort; }; struct RendererItem { int Id; ITEM_INFO* Item; - Matrix World; - Matrix Translation; - Matrix Rotation; - Matrix Scale; - Matrix AnimationTransforms[32]; + DirectX::SimpleMath::Matrix World; + DirectX::SimpleMath::Matrix Translation; + DirectX::SimpleMath::Matrix Rotation; + DirectX::SimpleMath::Matrix Scale; + DirectX::SimpleMath::Matrix AnimationTransforms[32]; int NumMeshes; - vector Lights; + std::vector Lights; bool DoneAnimations; }; @@ -283,26 +283,26 @@ struct RendererMesh BoundingSphere Sphere; RendererBucket Buckets[NUM_BUCKETS]; RendererBucket AnimatedBuckets[NUM_BUCKETS]; - vector Positions; + std::vector Positions; }; struct RendererEffect { int Id; FX_INFO* Effect; - Matrix World; + DirectX::SimpleMath::Matrix World; RendererMesh* Mesh; - vector Lights; + std::vector Lights; }; struct RendererObject { int Id; - vector ObjectMeshes; + std::vector ObjectMeshes; RendererBone* Skeleton; - vector AnimationTransforms; - vector BindPoseTransforms; - vector LinearizedBones; + std::vector AnimationTransforms; + std::vector BindPoseTransforms; + std::vector LinearizedBones; bool DoNotDraw; bool HasDataInBucket[NUM_BUCKETS]; bool HasDataInAnimatedBucket[NUM_BUCKETS]; @@ -320,13 +320,13 @@ struct RendererSprite { int Width; int Height; - Vector2 UV[4]; + DirectX::SimpleMath::Vector2 UV[4]; }; struct RendererSpriteSequence { int Id; - vector SpritesList; + std::vector SpritesList; int NumSprites; RendererSpriteSequence() @@ -339,7 +339,7 @@ struct RendererSpriteSequence { Id = id; NumSprites = num; - SpritesList = vector(NumSprites); + SpritesList = std::vector(NumSprites); } RendererSpriteSequence(const RendererSpriteSequence& rhs) @@ -355,7 +355,7 @@ struct RendererSpriteSequence { Id = other.Id; NumSprites = other.NumSprites; - SpritesList = vector(NumSprites); + SpritesList = std::vector(NumSprites); std::copy(other.SpritesList.begin(), other.SpritesList.end(),back_inserter(SpritesList)); } return *this; @@ -368,24 +368,24 @@ struct RendererSpriteToDraw RendererSprite* Sprite; float Distance; float Scale; - Vector3 pos; - Vector3 vtx1; - Vector3 vtx2; - Vector3 vtx3; - Vector3 vtx4; - Vector4 color; + DirectX::SimpleMath::Vector3 pos; + DirectX::SimpleMath::Vector3 vtx1; + DirectX::SimpleMath::Vector3 vtx2; + DirectX::SimpleMath::Vector3 vtx3; + DirectX::SimpleMath::Vector3 vtx4; + DirectX::SimpleMath::Vector4 color; float Rotation; float Width; float Height; BLEND_MODES BlendMode; - Vector3 ConstrainAxis; + DirectX::SimpleMath::Vector3 ConstrainAxis; }; struct RendererLine3D { - Vector3 start; - Vector3 end; - Vector4 color; + DirectX::SimpleMath::Vector3 start; + DirectX::SimpleMath::Vector3 end; + DirectX::SimpleMath::Vector4 color; }; struct RendererWeatherParticle @@ -409,8 +409,8 @@ struct RendererUnderwaterDustParticle struct RendererLine2D { - Vector2 Vertices[2]; - Vector4 Color; + DirectX::SimpleMath::Vector2 Vertices[2]; + DirectX::SimpleMath::Vector4 Color; }; class Renderer11 @@ -428,7 +428,7 @@ private: D3D11_VIEWPORT m_viewport; D3D11_VIEWPORT m_shadowMapViewport; Viewport* m_viewportToolkit; - vector m_adapters; + std::vector m_adapters; // Main back buffer ID3D11RenderTargetView* m_backBufferRTV; @@ -496,7 +496,7 @@ private: // Text and sprites SpriteFont* m_gameFont; SpriteBatch* m_spriteBatch; - vector m_strings; + std::vector m_strings; int m_blinkColorValue; int m_blinkColorDirection; PrimitiveBatch* m_primitiveBatch; @@ -519,22 +519,22 @@ private: IndexBuffer m_moveablesIndexBuffer; VertexBuffer m_staticsVertexBuffer; IndexBuffer m_staticsIndexBuffer; - vector m_rooms; - Matrix m_hairsMatrices[12]; + std::vector m_rooms; + DirectX::SimpleMath::Matrix m_hairsMatrices[12]; short m_numHairVertices; short m_numHairIndices; - vector m_hairVertices; - vector m_hairIndices; - vector m_roomsToDraw; - vector m_itemsToDraw; - vector m_effectsToDraw; - vector m_staticsToDraw; - vector m_lightsToDraw; - vector m_dynamicLights; - vector m_spritesToDraw; - vector m_lines3DToDraw; - vector m_lines2DToDraw; - vector m_tempItemLights; + std::vector m_hairVertices; + std::vector m_hairIndices; + std::vector m_roomsToDraw; + std::vector m_itemsToDraw; + std::vector m_effectsToDraw; + std::vector m_staticsToDraw; + std::vector m_lightsToDraw; + std::vector m_dynamicLights; + std::vector m_spritesToDraw; + std::vector m_lines3DToDraw; + std::vector m_lines2DToDraw; + std::vector m_tempItemLights; RendererSpriteToDraw* m_spritesBuffer; int m_nextSprite; RendererLine3D* m_lines3DBuffer; @@ -549,15 +549,15 @@ private: int m_numStatics; int m_numSprites; int m_numSpritesSequences; - vector m_spriteSequences; - unordered_map m_meshPointersToMesh; - Matrix m_LaraWorldMatrix; - vector m_animatedTextureSets; + std::vector m_spriteSequences; + std::unordered_map m_meshPointersToMesh; + DirectX::SimpleMath::Matrix m_LaraWorldMatrix; + std::vector m_animatedTextureSets; int m_numAnimatedTextureSets; int m_currentCausticsFrame; RendererUnderwaterDustParticle m_underwaterDustParticles[NUM_UNDERWATER_DUST_PARTICLES]; bool m_firstUnderwaterDustParticles = true; - vector m_meshes; + std::vector m_meshes; // Debug variables int m_numDrawCalls = 0; @@ -597,13 +597,13 @@ private: int getAnimatedTextureInfo(short textureId); void initialiseHairRemaps(); RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, short* meshPtr, short boneIndex, int isJoints, int isHairs); - void fromTrAngle(Matrix* matrix, short* frameptr, int index); + void fromTrAngle(DirectX::SimpleMath::Matrix* matrix, short* frameptr, int index); void buildHierarchy(RendererObject* obj); void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode); void updateAnimation(RendererItem* item, RendererObject* obj, short** frmptr, short frac, short rate, int mask,bool useObjectWorldRotation = false); bool printDebugMessage(int x, int y, int alpha, byte r, byte g, byte b, LPCSTR Message); - bool checkPortal(short roomIndex, short* portal, Vector4* viewPort, Vector4* clipPort); - void getVisibleRooms(int from, int to, Vector4* viewPort, bool water, int count); + bool checkPortal(short roomIndex, short* portal, DirectX::SimpleMath::Vector4* viewPort, DirectX::SimpleMath::Vector4* clipPort); + void getVisibleRooms(int from, int to, DirectX::SimpleMath::Vector4* viewPort, bool water, int count); void collectRooms(); void collectItems(short roomNumber); void collectStatics(short roomNumber); @@ -618,7 +618,7 @@ private: void updateEffects(); int getFrame(short animation, short frame, short** framePtr, int* rate); bool drawAmbientCubeMap(short roomNumber); - bool sphereBoxIntersection(Vector3 boxMin, Vector3 boxMax, Vector3 sphereCentre, float sphereRadius); + bool sphereBoxIntersection(DirectX::SimpleMath::Vector3 boxMin, DirectX::SimpleMath::Vector3 boxMax, DirectX::SimpleMath::Vector3 sphereCentre, float sphereRadius); bool drawHorizonAndSky(); bool drawRooms(bool transparent, bool animated); bool drawStatics(bool transparent); @@ -655,17 +655,17 @@ private: int drawInventoryScene(); int drawFinalPass(); void updateAnimatedTextures(); - void createBillboardMatrix(Matrix* out, Vector3* particlePos, Vector3* cameraPos, float rotation); + void createBillboardMatrix(DirectX::SimpleMath::Matrix* out, DirectX::SimpleMath::Vector3* particlePos, DirectX::SimpleMath::Vector3* cameraPos, float rotation); void drawShockwaves(); void drawRipples(); void drawUnderwaterDust(); bool doRain(); bool doSnow(); - bool drawFullScreenQuad(ID3D11ShaderResourceView* texture, Vector3 color, bool cinematicBars); + bool drawFullScreenQuad(ID3D11ShaderResourceView* texture, DirectX::SimpleMath::Vector3 color, bool cinematicBars); bool drawFullScreenImage(ID3D11ShaderResourceView* texture, float fade); bool isRoomUnderwater(short roomNumber); bool isInRoom(int x, int y, int z, short roomNumber); - bool drawColoredQuad(int x, int y, int w, int h, Vector4 color); + bool drawColoredQuad(int x, int y, int w, int h, DirectX::SimpleMath::Vector4 color); bool initialiseScreen(int w, int h, int refreshRate, bool windowed, HWND handle, bool reset); bool initialiseBars(); bool drawSmokeParticles(); @@ -673,9 +673,9 @@ private: bool drawDripParticles(); bool drawExplosionParticles(); public: - Matrix View; - Matrix Projection; - Matrix ViewProjection; + DirectX::SimpleMath::Matrix View; + DirectX::SimpleMath::Matrix Projection; + DirectX::SimpleMath::Matrix ViewProjection; float FieldOfView; int ScreenWidth; int ScreenHeight; @@ -705,26 +705,26 @@ public: void DrawLoadingScreen(char* fileName); void UpdateProgress(float value); bool IsFading(); - void GetLaraBonePosition(Vector3* pos, int bone); + void GetLaraBonePosition(DirectX::SimpleMath::Vector3* pos, int bone); bool ToggleFullScreen(); bool IsFullsScreen(); - vector* GetAdapters(); + std::vector* GetAdapters(); bool DoTitleImage(); void AddLine2D(int x1, int y1, int x2, int y2, byte r, byte g, byte b, byte a); - void AddSpriteBillboard(RendererSprite* sprite, Vector3 pos,Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); - void AddSpriteBillboardConstrained(RendererSprite* sprite, Vector3 pos, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode, Vector3 constrainAxis); - void AddSprite3D(RendererSprite* sprite, Vector3 vtx1, Vector3 vtx2, Vector3 vtx3, Vector3 vtx4, Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); - void AddLine3D(Vector3 start, Vector3 end, Vector4 color); + void AddSpriteBillboard(RendererSprite* sprite, DirectX::SimpleMath::Vector3 pos,DirectX::SimpleMath::Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); + void AddSpriteBillboardConstrained(RendererSprite* sprite, DirectX::SimpleMath::Vector3 pos, DirectX::SimpleMath::Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode, DirectX::SimpleMath::Vector3 constrainAxis); + void AddSprite3D(RendererSprite* sprite, DirectX::SimpleMath::Vector3 vtx1, DirectX::SimpleMath::Vector3 vtx2, DirectX::SimpleMath::Vector3 vtx3, DirectX::SimpleMath::Vector3 vtx4, DirectX::SimpleMath::Vector4 color, float rotation, float scale, float width, float height, BLEND_MODES blendMode); + void AddLine3D(DirectX::SimpleMath::Vector3 start, DirectX::SimpleMath::Vector3 end, DirectX::SimpleMath::Vector4 color); bool ChangeScreenResolution(int width, int height, int frequency, bool windowed); bool DrawBar(float percent, const RendererHUDBar* const bar); void FlipRooms(short roomNumber1, short roomNumber2); void ResetAnimations(); void UpdateLaraAnimations(bool force); void UpdateItemAnimations(int itemNumber, bool force); - void GetLaraAbsBonePosition(Vector3* pos, int joint); - void GetItemAbsBonePosition(int itemNumber, Vector3* pos, int joint); - int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, Matrix local); - void GetBoneMatrix(short itemNumber, int joint, Matrix* outMatrix); + void GetLaraAbsBonePosition(DirectX::SimpleMath::Vector3* pos, int joint); + void GetItemAbsBonePosition(int itemNumber, DirectX::SimpleMath::Vector3* pos, int joint); + int GetSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, DirectX::SimpleMath::Matrix local); + void GetBoneMatrix(short itemNumber, int joint, DirectX::SimpleMath::Matrix* outMatrix); RendererMesh* getMeshFromMeshPtr(unsigned int meshp); private: diff --git a/TR5Main/Renderer/Renderer11Draw2D.cpp b/TR5Main/Renderer/Renderer11Draw2D.cpp index c67c33846..062a2fb97 100644 --- a/TR5Main/Renderer/Renderer11Draw2D.cpp +++ b/TR5Main/Renderer/Renderer11Draw2D.cpp @@ -11,7 +11,7 @@ RendererHUDBar* g_SFXVolumeBar; bool Renderer11::initialiseBars() { - array healthColors = { + std::array healthColors = { //top Vector4(82 / 255.0f,0,0,1), Vector4(36 / 255.0f,46 / 255.0f,0,1), @@ -26,7 +26,7 @@ bool Renderer11::initialiseBars() Vector4(0,82 / 255.0f,0,1), }; - array airColors = { + std::array airColors = { //top Vector4(0 ,0,90 / 255.0f,1), Vector4(0 / 255.0f,28 / 255.0f,84 / 255.0f,1), @@ -41,7 +41,7 @@ bool Renderer11::initialiseBars() Vector4(0 ,47 / 255.0f,96 / 255.0f,1), }; - array dashColors = { + std::array dashColors = { //top Vector4(78 / 255.0f,4 / 255.0f,0,1), Vector4(161 / 255.0f,25 / 255.0f,84 / 255.0f,1), @@ -55,7 +55,7 @@ bool Renderer11::initialiseBars() Vector4(161 / 255.0f,25 / 255.0f,84 / 255.0f,1), Vector4(136 / 255.0f,117 / 255.0f,5 / 255.0f,1), }; - array soundSettingColors = { + std::array soundSettingColors = { //top Vector4(0.18f,0.3f,0.72f,1), Vector4(0.18f,0.3f,0.72f,1), diff --git a/TR5Main/Scripting/GameFlowScript.h b/TR5Main/Scripting/GameFlowScript.h index ff40170c4..e99bb2a21 100644 --- a/TR5Main/Scripting/GameFlowScript.h +++ b/TR5Main/Scripting/GameFlowScript.h @@ -35,7 +35,7 @@ struct GameScriptSettings bool EnableDynamicShadows; bool EnableWaterCaustics; bool Windowed; - string WindowTitle; + std::string WindowTitle; int DrawingDistance; bool ShowRendererSteps; bool ShowDebugInfo; @@ -111,10 +111,10 @@ struct GameScriptMirror struct GameScriptLevel { int NameStringIndex; - string FileName; - string ScriptFileName; - string LoadScreenFileName; - string Background; + std::string FileName; + std::string ScriptFileName; + std::string LoadScreenFileName; + std::string Background; int Name; int Soundtrack; GameScriptSkyLayer Layer1; diff --git a/TR5Main/Scripting/GameLogicScript.h b/TR5Main/Scripting/GameLogicScript.h index a6e2fa786..424154e37 100644 --- a/TR5Main/Scripting/GameLogicScript.h +++ b/TR5Main/Scripting/GameLogicScript.h @@ -24,8 +24,8 @@ #define LUA_VARIABLE_TYPE_STRING 3 typedef struct LuaFunction { - string Name; - string Code; + std::string Name; + std::string Code; bool Executed; }; @@ -106,18 +106,18 @@ class LuaVariables public: map variables; - sol::object GetVariable(string key); - void SetVariable(string key, sol::object value); + sol::object GetVariable(std::string key); + void SetVariable(std::string key, sol::object value); }; typedef struct LuaVariable { bool IsGlobal; - string Name; + std::string Name; int Type; float FloatValue; int IntValue; - string StringValue; + std::string StringValue; bool BoolValue; }; @@ -139,7 +139,7 @@ public: void FreeLevelScripts(); void AddTrigger(LuaFunction* function); void AddLuaId(int luaId, short itemNumber); - void AddLuaName(string luaName, short itemNumber); + void AddLuaName(std::string luaName, short itemNumber); void AssignItemsAndLara(); void ResetVariables(); @@ -156,7 +156,7 @@ public: void AddOneSecret(); void MakeItemInvisible(short id); unique_ptr GetItemById(int id); - unique_ptr GetItemByName(string name); + unique_ptr GetItemByName(std::string name); void PlaySoundEffectAtPosition(short id, int x, int y, int z, int flags); void PlaySoundEffect(short id, int flags); GameScriptPosition CreatePosition(float x, float y, float z); diff --git a/TR5Main/Scripting/LanguageScript.cpp b/TR5Main/Scripting/LanguageScript.cpp index 1f60e1a4c..721c8a8d6 100644 --- a/TR5Main/Scripting/LanguageScript.cpp +++ b/TR5Main/Scripting/LanguageScript.cpp @@ -1,6 +1,6 @@ #include "framework.h" #include "LanguageScript.h" - +using std::string; LanguageScript::LanguageScript(char* name) { Name = string(name); diff --git a/TR5Main/Scripting/LanguageScript.h b/TR5Main/Scripting/LanguageScript.h index 931b24572..c48a140cf 100644 --- a/TR5Main/Scripting/LanguageScript.h +++ b/TR5Main/Scripting/LanguageScript.h @@ -1,6 +1,6 @@ #pragma once -// Define string ids +// Define std::string ids #define STRING_PASSPORT 1 #define STRING_LARA_HOME 2 #define STRING_CONTROLS 3 @@ -104,8 +104,8 @@ class LanguageScript { public: - string Name; - vector Strings; + std::string Name; + std::vector Strings; LanguageScript(char* name); ~LanguageScript(); diff --git a/TR5Main/Specific/level.h b/TR5Main/Specific/level.h index 00459e77e..bd6567586 100644 --- a/TR5Main/Specific/level.h +++ b/TR5Main/Specific/level.h @@ -102,8 +102,8 @@ extern int NumMeshPointers; extern int* MeshTrees; extern int NumObjects; extern int NumStaticObjects; -extern vector MoveablesIds; -extern vector StaticObjectsIds; +extern std::vector MoveablesIds; +extern std::vector StaticObjectsIds; extern int* RawMeshPointers; extern short* RawMeshData; extern int NumObjectTextures; diff --git a/TR5Main/Specific/levelloader.h b/TR5Main/Specific/levelloader.h index 8e24e3d0a..2cfe82b3e 100644 --- a/TR5Main/Specific/levelloader.h +++ b/TR5Main/Specific/levelloader.h @@ -59,7 +59,7 @@ private: ChunkId* m_chunkFloorData = ChunkId::FromString("T5MFloorData"); int m_magicNumber = 0x4D355254; - string m_filename; + std::string m_filename; ChunkReader* m_reader; FileStream* m_stream; int m_numSamples = 0; @@ -94,7 +94,7 @@ private: bool readSample(); public: - LevelLoader(string filename); + LevelLoader(std::string filename); ~LevelLoader(); bool Load(); bool FillLegacyData(); diff --git a/TR5Main/Specific/newtypes.h b/TR5Main/Specific/newtypes.h index 918121ea3..daebcac7a 100644 --- a/TR5Main/Specific/newtypes.h +++ b/TR5Main/Specific/newtypes.h @@ -13,7 +13,7 @@ struct TrTexturePage struct TrPolygon { - vector indices; + std::vector indices; int animatedSequence; int frame; }; @@ -28,13 +28,13 @@ struct TrMaterial struct TrBucket { TrMaterial material; - vector positions; - vector colors; - vector textureCoords; - vector normals; - vector verticesEffects; - vector bones; - vector polygons; + std::vector positions; + std::vector colors; + std::vector textureCoords; + std::vector normals; + std::vector verticesEffects; + std::vector bones; + std::vector polygons; }; struct TrVolume @@ -44,7 +44,7 @@ struct TrVolume Quaternion rotation; BoundingBox box; BoundingSphere sphere; - string script; + std::string script; }; struct TrClimbVolume : TrVolume @@ -68,7 +68,7 @@ struct TrSector int roomAbove; int floor; int ceiling; - vector floorData; + std::vector floorData; }; struct TrLight @@ -88,7 +88,7 @@ struct TrLight struct TrRoomStatic { - string name; + std::string name; Vector3 position; Quaternion rotation; Vector3 scale; @@ -97,14 +97,14 @@ struct TrRoomStatic bool receiveShadows; bool castShadows; int flags; - string script; + std::string script; }; struct TrPortal { int adjoiningRoom; Vector3 normal; - vector vertices; + std::vector vertices; }; struct TrRoom @@ -123,13 +123,13 @@ struct TrRoom int alternatGroup; int flags; Vector3 ambient; - vector buckets; - vector lights; - vector statics; - vector sectors; - vector portals; - vector triggers; - vector climbVolumes; + std::vector buckets; + std::vector lights; + std::vector statics; + std::vector sectors; + std::vector portals; + std::vector triggers; + std::vector climbVolumes; int itemNumber; int fxNumber; }; @@ -137,7 +137,7 @@ struct TrRoom struct TrMesh { BoundingSphere sphere; - vector buckets; + std::vector buckets; }; struct TrBone @@ -150,14 +150,14 @@ struct TrKeyFrame { Vector3 origin; BoundingBox boundingBox; - vector angles; + std::vector angles; }; struct TrAnimCommand { int type; int frame; - vector params; + std::vector params; }; struct TrAnimDispatch @@ -173,7 +173,7 @@ struct TrStateChange int state; int dispatchIndex; int dispatchCount; - vector dispatches; + std::vector dispatches; }; struct TrAnimation @@ -194,9 +194,9 @@ struct TrAnimation int changesCount; int commandsIndex; int commandsCount; - vector keyframes; - vector changes; - vector commands; + std::vector keyframes; + std::vector changes; + std::vector commands; }; struct TrMoveable @@ -208,9 +208,9 @@ struct TrMoveable int meshCount; int bonesIndex; int bonesCount; - vector meshes; - vector bones; - vector animations; + std::vector meshes; + std::vector bones; + std::vector animations; }; struct TrStatic @@ -220,13 +220,13 @@ struct TrStatic BoundingBox collisionBox; int meshNumber; int meshCount; - vector meshes; + std::vector meshes; }; struct TrAnimatedTexturesFrame { int texture; - vector textureCoords; + std::vector textureCoords; }; struct TrAnimatedTexturesSequence @@ -234,12 +234,12 @@ struct TrAnimatedTexturesSequence byte animationType; float fps; int uvRotate; - vector frames; + std::vector frames; }; struct TrItem { - string name; + std::string name; Vector3 position; Quaternion rotation; float angle; @@ -247,22 +247,22 @@ struct TrItem Vector3 color; int roomNumber; int objectNumber; - string script; + std::string script; }; struct TrCamera { - string name; + std::string name; Vector3 position; int roomNumber; int type; int flags; - string script; + std::string script; }; struct TrSoundSource { - string name; + std::string name; Vector3 position; int roomNumber; float volume; @@ -272,7 +272,7 @@ struct TrSoundSource struct TrSink { - string name; + std::string name; Vector3 position; int roomNumber; float strength; @@ -293,7 +293,7 @@ struct TrBox int flags; int overlapsIndex; int overlapsCount; - vector overlaps; + std::vector overlaps; }; struct TrSample @@ -313,12 +313,12 @@ struct TrSoundDetails bool randomizeGain; bool noPanoramic; byte loop; - vector samples; + std::vector samples; }; struct TrFlybyCamera { - string name; + std::string name; int sequence; int number; Vector3 position; @@ -329,13 +329,13 @@ struct TrFlybyCamera int timer; int roomNumber; int flags; - string script; + std::string script; }; struct TrSprite { int texture; - vector textureCoords; + std::vector textureCoords; }; struct TrSpriteSequence @@ -343,36 +343,36 @@ struct TrSpriteSequence int id; int spritesIndex; int spritesCount; - vector sprites; + std::vector sprites; }; struct TrLevel { - vector textures; - vector rooms; - vector floorData; - vector meshes; - vector animations; - vector bones; - vector changes; - vector dispatches; - vector frames; - vector commands; - vector animatedTextures; - vector sprites; - vector spriteSequences; - vector soundMap; - vector soundDetails; - vector samples; - vector items; - vector aiItems; - vector moveables; - vector statics; - vector boxes; - vector overlaps; - vector zones[5][2]; - vector sinks; - vector cameras; - vector soundSources; - vector flybyCameras; + std::vector textures; + std::vector rooms; + std::vector floorData; + std::vector meshes; + std::vector animations; + std::vector bones; + std::vector changes; + std::vector dispatches; + std::vector frames; + std::vector commands; + std::vector animatedTextures; + std::vector sprites; + std::vector spriteSequences; + std::vector soundMap; + std::vector soundDetails; + std::vector samples; + std::vector items; + std::vector aiItems; + std::vector moveables; + std::vector statics; + std::vector boxes; + std::vector overlaps; + std::vector zones[5][2]; + std::vector sinks; + std::vector cameras; + std::vector soundSources; + std::vector flybyCameras; }; \ No newline at end of file diff --git a/TR5Main/Specific/setup.h b/TR5Main/Specific/setup.h index bc05f4371..e553c8384 100644 --- a/TR5Main/Specific/setup.h +++ b/TR5Main/Specific/setup.h @@ -18,13 +18,13 @@ typedef struct ObjectInfo short meshIndex; int boneIndex; short* frameBase; - function initialise; - function control; - function floor; - function ceiling; - function drawRoutine; - function drawRoutineExtra; - function collision; + std::function initialise; + std::function control; + std::function floor; + std::function ceiling; + std::function drawRoutine; + std::function drawRoutineExtra; + std::function collision; ZoneType zoneType; short animIndex; short hitPoints; diff --git a/TR5Main/Specific/winmain.h b/TR5Main/Specific/winmain.h index 78fbd910e..d51375ae1 100644 --- a/TR5Main/Specific/winmain.h +++ b/TR5Main/Specific/winmain.h @@ -27,7 +27,7 @@ extern HWND WindowsHandle; #define BeginThread(function, threadid) _beginthreadex(0, 0, &function, 0, 0, &threadid) #define EndThread() _endthreadex(1) -int lua_exception_handler(lua_State* L, sol::optional maybe_exception, sol::string_view description); +int lua_exception_handler(lua_State* L, sol::optional maybe_exception, sol::string_view description); void WinProcMsg(); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd); void WinClose(); diff --git a/TR5Main/framework.h b/TR5Main/framework.h index 9fd8fdc2e..789335a2f 100644 --- a/TR5Main/framework.h +++ b/TR5Main/framework.h @@ -44,7 +44,6 @@ #include "bass_fx.h" #include "sol.hpp" -using namespace std; using namespace DirectX; using namespace DirectX::SimpleMath;