Skip to content

Commit 3114067

Browse files
committed
Added copyright comment, and added #pragma once to header files
1 parent cd5b1cd commit 3114067

File tree

8 files changed

+105
-24
lines changed

8 files changed

+105
-24
lines changed

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CClientIFP.cpp
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#include <StdInc.h>
212
#include "game/CAnimBlendSequence.h"
313
#include "game/CAnimBlendHierarchy.h"
@@ -31,34 +41,41 @@ bool CClientIFP::LoadIFPFile(const SString& strFilePath)
3141
{
3242
if (LoadFileToMemory(strFilePath))
3343
{
34-
char Version[4];
35-
ReadBytes(Version, sizeof(Version));
36-
37-
bool bAnp3 = strncmp(Version, "ANP3", sizeof(Version)) == 0;
38-
bool bAnp2 = strncmp(Version, "ANP2", sizeof(Version)) == 0;
39-
if (bAnp2 || bAnp3)
40-
{
41-
m_bVersion1 = false;
42-
ReadIFPVersion2(bAnp3);
43-
}
44-
else
44+
if (ReadIFPByVersion())
4545
{
46-
m_bVersion1 = true;
47-
ReadIFPVersion1();
46+
// We are freeing the file reader memory because we don't need to read it anymore.
47+
// This function does not unload IFP, to unload ifp, use destroyElement from Lua
48+
FreeFileReaderMemory();
49+
return true;
4850
}
51+
}
52+
return false;
53+
}
4954

50-
// We are freeing the file reader memory because we don't need to read it anymore.
51-
// This function does not unload IFP, to unload ifp, use destroyElement from Lua
52-
FreeFileReaderMemory();
55+
bool CClientIFP::ReadIFPByVersion(void)
56+
{
57+
char Version[4];
58+
ReadBytes(Version, sizeof(Version));
59+
60+
bool bAnp3 = strncmp(Version, "ANP3", sizeof(Version)) == 0;
61+
bool bAnp2 = strncmp(Version, "ANP2", sizeof(Version)) == 0;
62+
bool bAnpk = strncmp(Version, "ANPK", sizeof(Version)) == 0;
63+
64+
if (bAnp2 || bAnp3)
65+
{
66+
ReadIFPVersion2(bAnp3);
67+
return true;
5368
}
54-
else
69+
else if (bAnpk)
5570
{
56-
return false;
71+
m_bVersion1 = true;
72+
ReadIFPVersion1();
73+
return true;
5774
}
58-
return true;
75+
return false;
5976
}
6077

61-
void CClientIFP::ReadIFPVersion1()
78+
void CClientIFP::ReadIFPVersion1(void)
6279
{
6380
SInfo Info;
6481
ReadHeaderVersion1(Info);

Client/mods/deathmatch/logic/CClientIFP.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CClientIFP.h
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#ifndef __CCLIENTIFP_H
212
#define __CCLIENTIFP_H
13+
#pragma once
314

415
#include "CClientEntity.h"
516
#include "CFileReader.h"
@@ -129,9 +140,9 @@ class CClientIFP : public CClientEntity, CFileReader
129140

130141
struct SIFPHeaderV2
131142
{
132-
std::int32_t OffsetEOF;
133-
char InternalFileName[24];
134-
std::int32_t TotalAnimations;
143+
std::uint32_t OffsetEOF;
144+
char InternalFileName[24];
145+
std::int32_t TotalAnimations;
135146
};
136147

137148
struct SAnimationHeaderV2
@@ -209,6 +220,7 @@ class CClientIFP : public CClientEntity, CFileReader
209220

210221
private:
211222
bool LoadIFPFile(const SString& strFilePath);
223+
bool ReadIFPByVersion(void);
212224
void ReadIFPVersion1(void);
213225
void ReadIFPVersion2(bool bAnp3);
214226

Client/mods/deathmatch/logic/CIFPAnimations.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CIFPAnimations.cpp
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#include <StdInc.h>
212
#include "game/CAnimBlendSequence.h"
313
#include "game/CAnimBlendHierarchy.h"

Client/mods/deathmatch/logic/CIFPAnimations.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CIFPAnimations.h
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#ifndef __CIFPANIMATIONS_H
212
#define __CIFPANIMATIONS_H
13+
#pragma once
14+
315
#include "CClientIFP.h"
416

517
class CIFPAnimations

Client/mods/deathmatch/logic/CIFPEngine.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CIFPEngine.cpp
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#include <StdInc.h>
212

313
std::shared_ptr<CClientIFP> CIFPEngine::EngineLoadIFP(CResource* pResource, CClientManager* pManager, const SString& strPath, const SString& strBlockName)

Client/mods/deathmatch/logic/CIFPEngine.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/mods/deathmatch/logic/CIFPEngine.h
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#ifndef __CIFPENGINE_H
212
#define __CIFPENGINE_H
13+
#pragma once
314

415
class CIFPEngine
516
{

Client/multiplayer_sa/CMultiplayerSA_CustomAnimations.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*****************************************************************************
2+
*
3+
* PROJECT: Multi Theft Auto
4+
* LICENSE: See LICENSE in the top level directory
5+
* FILE: Client/multiplayer_sa/CMultiplayerSA_CustomAnimations.cpp
6+
*
7+
* Multi Theft Auto is available from http://www.multitheftauto.com/
8+
*
9+
*****************************************************************************/
10+
111
#include "StdInc.h"
212

313
#include <../game_sa/CAnimBlendHierarchySA.h>

Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,5 @@ void _declspec(naked) HOOK_GetAnimHierarchyFromSkinClump()
119119
//////////////////////////////////////////////////////////////////////////////////////////
120120
void CMultiplayerSA::InitHooks_FixBadAnimId(void)
121121
{
122-
// EZHookInstall ( CAnimBlendAssocGroupCopyAnimation );
123122
EZHookInstall(GetAnimHierarchyFromSkinClump);
124123
}

0 commit comments

Comments
 (0)