Skip to content

Commit 11fe653

Browse files
committed
Used Hungarian notation for naming structs and enums
1 parent d38b4ec commit 11fe653

File tree

3 files changed

+125
-130
lines changed

3 files changed

+125
-130
lines changed

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ bool CClientIFP::LoadIFPFile ( const char * szFilePath )
6565

6666
void CClientIFP::ReadIFPVersion1 ( )
6767
{
68-
IFP_INFO Info;
68+
SInfo Info;
6969
ReadHeaderVersion1 ( Info );
7070

7171
m_pVecAnimations->resize ( Info.Entries );
7272
for ( auto it = m_pVecAnimations->begin(); it != m_pVecAnimations->end(); ++it )
7373
{
7474
ReadAnimationNameVersion1 ( *it );
7575

76-
IFP_DGAN Dgan;
76+
SDgan Dgan;
7777
ReadDgan ( Dgan );
7878

7979
std::unique_ptr < CAnimBlendHierarchy > pAnimationHierarchy = m_pAnimManager->GetCustomAnimBlendHierarchy ( &it->Hierarchy );
@@ -89,13 +89,13 @@ void CClientIFP::ReadIFPVersion1 ( )
8989

9090
void CClientIFP::ReadIFPVersion2 ( bool bAnp3 )
9191
{
92-
IFPHeaderV2 Header;
93-
ReadBuffer < IFPHeaderV2 > ( &Header );
92+
SIFPHeaderV2 Header;
93+
ReadBuffer < SIFPHeaderV2 > ( &Header );
9494

9595
m_pVecAnimations->resize ( Header.TotalAnimations );
9696
for ( auto it = m_pVecAnimations->begin(); it != m_pVecAnimations->end(); ++it )
9797
{
98-
Animation AnimationNode;
98+
SAnimationHeaderV2 AnimationNode;
9999
ReadAnimationHeaderVersion2 ( AnimationNode, bAnp3 );
100100

101101
it->Name = AnimationNode.Name;
@@ -140,7 +140,7 @@ WORD CClientIFP::ReadSequencesVersion1 ( std::unique_ptr < CAnimBlendHierarchy >
140140
WORD wUnknownSequences = 0;
141141
for (size_t SequenceIndex = 0; SequenceIndex < pAnimationHierarchy->GetNumSequences ( ); SequenceIndex++)
142142
{
143-
IFP_ANIM Anim;
143+
SAnim Anim;
144144
int32_t iBoneID = ReadSequenceVersion1 ( Anim );
145145
if ( Anim.Frames == 0 )
146146
{
@@ -161,7 +161,7 @@ WORD CClientIFP::ReadSequencesVersion1 ( std::unique_ptr < CAnimBlendHierarchy >
161161
std::unique_ptr < CAnimBlendSequence > pAnimationSequence = m_pAnimManager->GetCustomAnimBlendSequence ( pAnimationSequenceInterface );
162162
InitializeAnimationSequence ( pAnimationSequence, Anim.Name, iBoneID );
163163

164-
IFP_FrameType iFrameType = ReadKfrm ( );
164+
eFrameType iFrameType = ReadKfrm ( );
165165
if ( ( ReadSequenceKeyFrames ( pAnimationSequence, iFrameType, Anim.Frames ) ) && ( !bUnknownSequence ) )
166166
{
167167
MapOfSequences [ iBoneID ] = *pAnimationSequence->GetInterface();
@@ -175,7 +175,7 @@ WORD CClientIFP::ReadSequencesVersion2 ( std::unique_ptr < CAnimBlendHierarchy >
175175
WORD wUnknownSequences = 0;
176176
for (size_t SequenceIndex = 0; SequenceIndex < pAnimationHierarchy->GetNumSequences ( ); SequenceIndex++)
177177
{
178-
Object ObjectNode;
178+
SSequenceHeaderV2 ObjectNode;
179179
ReadSequenceVersion2 ( ObjectNode );
180180

181181
bool bUnknownSequence = ObjectNode.BoneID == -1;
@@ -192,7 +192,7 @@ WORD CClientIFP::ReadSequencesVersion2 ( std::unique_ptr < CAnimBlendHierarchy >
192192
std::unique_ptr < CAnimBlendSequence > pAnimationSequence = m_pAnimManager->GetCustomAnimBlendSequence ( pAnimationSequenceInterface );
193193
InitializeAnimationSequence ( pAnimationSequence, ObjectNode.Name, ObjectNode.BoneID );
194194

195-
IFP_FrameType iFrameType = static_cast < IFP_FrameType > ( ObjectNode.FrameType );
195+
eFrameType iFrameType = static_cast < eFrameType > ( ObjectNode.FrameType );
196196
if ( ( ReadSequenceKeyFrames ( pAnimationSequence, iFrameType, ObjectNode.TotalFrames ) ) && ( !bUnknownSequence ) )
197197
{
198198
MapOfSequences [ ObjectNode.BoneID ] = *pAnimationSequence->GetInterface();
@@ -201,12 +201,12 @@ WORD CClientIFP::ReadSequencesVersion2 ( std::unique_ptr < CAnimBlendHierarchy >
201201
return wUnknownSequences;
202202
}
203203

204-
int32_t CClientIFP::ReadSequenceVersion1 ( IFP_ANIM & Anim )
204+
int32_t CClientIFP::ReadSequenceVersion1 ( SAnim & Anim )
205205
{
206-
IFP_CPAN Cpan;
207-
ReadBuffer < IFP_CPAN > ( &Cpan );
206+
SCpan Cpan;
207+
ReadBuffer < SCpan > ( &Cpan );
208208
RoundSize ( Cpan.Base.Size );
209-
ReadBytes ( &Anim, sizeof ( IFP_BASE ) );
209+
ReadBytes ( &Anim, sizeof ( SBase ) );
210210
RoundSize ( Anim.Base.Size );
211211
ReadBytes ( &Anim.Name, Anim.Base.Size );
212212

@@ -224,9 +224,9 @@ int32_t CClientIFP::ReadSequenceVersion1 ( IFP_ANIM & Anim )
224224
return iBoneID;
225225
}
226226

227-
void CClientIFP::ReadSequenceVersion2 ( Object & ObjectNode )
227+
void CClientIFP::ReadSequenceVersion2 ( SSequenceHeaderV2 & ObjectNode )
228228
{
229-
ReadBuffer < Object > ( &ObjectNode );
229+
ReadBuffer < SSequenceHeaderV2 > ( &ObjectNode );
230230
std::string BoneName = ConvertStringToMapKey ( ObjectNode.Name );
231231
std::string strCorrectBoneName;
232232
if (ObjectNode.BoneID == -1)
@@ -246,7 +246,7 @@ void CClientIFP::ReadSequenceVersion2 ( Object & ObjectNode )
246246
strncpy ( ObjectNode.Name, strCorrectBoneName.c_str(), strCorrectBoneName.size() +1 );
247247
}
248248

249-
bool CClientIFP::ReadSequenceKeyFrames ( std::unique_ptr < CAnimBlendSequence > & pAnimationSequence, IFP_FrameType iFrameType, int32_t iFrames )
249+
bool CClientIFP::ReadSequenceKeyFrames ( std::unique_ptr < CAnimBlendSequence > & pAnimationSequence, eFrameType iFrameType, int32_t iFrames )
250250
{
251251
size_t iCompressedFrameSize = GetSizeOfCompressedFrame ( iFrameType );
252252
if ( iCompressedFrameSize )
@@ -259,20 +259,20 @@ bool CClientIFP::ReadSequenceKeyFrames ( std::unique_ptr < CAnimBlendSequence >
259259
return false;
260260
}
261261

262-
void CClientIFP::ReadHeaderVersion1 ( IFP_INFO & Info )
262+
void CClientIFP::ReadHeaderVersion1 ( SInfo & Info )
263263
{
264264
uint32_t OffsetEOF;
265265
ReadBuffer < uint32_t > ( &OffsetEOF );
266266
RoundSize ( OffsetEOF );
267-
ReadBytes ( &Info, sizeof ( IFP_BASE ) );
267+
ReadBytes ( &Info, sizeof ( SBase ) );
268268
RoundSize ( Info.Base.Size );
269269
ReadBytes ( &Info.Entries, Info.Base.Size );
270270
}
271271

272-
void CClientIFP::ReadAnimationNameVersion1 ( IFP_Animation & IfpAnimation )
272+
void CClientIFP::ReadAnimationNameVersion1 ( SAnimation & IfpAnimation )
273273
{
274-
IFP_NAME Name;
275-
ReadBuffer < IFP_NAME > ( &Name );
274+
SName Name;
275+
ReadBuffer < SName > ( &Name );
276276
RoundSize ( Name.Base.Size );
277277

278278
char szAnimationName [ 24 ];
@@ -281,24 +281,24 @@ void CClientIFP::ReadAnimationNameVersion1 ( IFP_Animation & IfpAnimation )
281281
IfpAnimation.u32NameHash = HashString ( IfpAnimation.Name.ToLower ( ) );
282282
}
283283

284-
void CClientIFP::ReadDgan ( IFP_DGAN & Dgan )
284+
void CClientIFP::ReadDgan ( SDgan & Dgan )
285285
{
286-
ReadBytes ( &Dgan, sizeof ( IFP_BASE ) * 2 );
286+
ReadBytes ( &Dgan, sizeof ( SBase ) * 2 );
287287
RoundSize ( Dgan.Base.Size );
288288
RoundSize ( Dgan.Info.Base.Size );
289289
ReadBytes ( &Dgan.Info.Entries, Dgan.Info.Base.Size );
290290
}
291291

292-
CClientIFP::IFP_FrameType CClientIFP::ReadKfrm ( void )
292+
CClientIFP::eFrameType CClientIFP::ReadKfrm ( void )
293293
{
294-
IFP_KFRM Kfrm;
295-
ReadBuffer < IFP_KFRM > ( &Kfrm );
294+
SKfrm Kfrm;
295+
ReadBuffer < SKfrm > ( &Kfrm );
296296
return GetFrameTypeFromFourCC ( Kfrm.Base.FourCC );
297297
}
298298

299-
void CClientIFP::ReadAnimationHeaderVersion2 ( Animation & AnimationNode, bool bAnp3 )
299+
void CClientIFP::ReadAnimationHeaderVersion2 ( SAnimationHeaderV2 & AnimationNode, bool bAnp3 )
300300
{
301-
ReadCString ( ( char * ) &AnimationNode.Name, sizeof ( Animation::Name ) );
301+
ReadCString ( ( char * ) &AnimationNode.Name, sizeof ( SAnimationHeaderV2::Name ) );
302302
ReadBuffer < int32_t > ( &AnimationNode.TotalObjects );
303303
if ( bAnp3 )
304304
{
@@ -307,33 +307,33 @@ void CClientIFP::ReadAnimationHeaderVersion2 ( Animation & AnimationNode, bool b
307307
}
308308
}
309309

310-
void CClientIFP::ReadKeyFramesAsCompressed ( std::unique_ptr < CAnimBlendSequence > & pAnimationSequence, IFP_FrameType iFrameType, int32_t iFrames )
310+
void CClientIFP::ReadKeyFramesAsCompressed ( std::unique_ptr < CAnimBlendSequence > & pAnimationSequence, eFrameType iFrameType, int32_t iFrames )
311311
{
312312
switch ( iFrameType )
313313
{
314-
case IFP_FrameType::KRTS:
314+
case eFrameType::KRTS:
315315
{
316316
ReadKrtsFramesAsCompressed ( pAnimationSequence, iFrames );
317317
break;
318318
}
319-
case IFP_FrameType::KRT0:
319+
case eFrameType::KRT0:
320320
{
321321
ReadKrt0FramesAsCompressed ( pAnimationSequence, iFrames );
322322
break;
323323
}
324-
case IFP_FrameType::KR00:
324+
case eFrameType::KR00:
325325
{
326326
ReadKr00FramesAsCompressed ( pAnimationSequence, iFrames );
327327
break;
328328
}
329-
case IFP_FrameType::KR00_COMPRESSED:
329+
case eFrameType::KR00_COMPRESSED:
330330
{
331-
ReadCompressedFrames < IFP_Compressed_KR00 > ( pAnimationSequence, iFrames );
331+
ReadCompressedFrames < SCompressed_KR00 > ( pAnimationSequence, iFrames );
332332
break;
333333
}
334-
case IFP_FrameType::KRT0_COMPRESSED:
334+
case eFrameType::KRT0_COMPRESSED:
335335
{
336-
ReadCompressedFrames < IFP_Compressed_KRT0 > ( pAnimationSequence, iFrames );
336+
ReadCompressedFrames < SCompressed_KRT0 > ( pAnimationSequence, iFrames );
337337
break;
338338
}
339339
}
@@ -343,9 +343,9 @@ void CClientIFP::ReadKrtsFramesAsCompressed ( std::unique_ptr < CAnimBlendSequen
343343
{
344344
for ( int32_t FrameIndex = 0; FrameIndex < TotalFrames; FrameIndex++ )
345345
{
346-
IFP_Compressed_KRT0 * CompressedKrt0 = static_cast < IFP_Compressed_KRT0 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( IFP_Compressed_KRT0 ) ) );
347-
IFP_KRTS Krts;
348-
ReadBuffer < IFP_KRTS > ( &Krts );
346+
SCompressed_KRT0 * CompressedKrt0 = static_cast < SCompressed_KRT0 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( SCompressed_KRT0 ) ) );
347+
SKrts Krts;
348+
ReadBuffer < SKrts > ( &Krts );
349349

350350
CompressedKrt0->Rotation.X = static_cast < int16_t > ( ( ( -Krts.Rotation.X ) * 4096.0f ) );
351351
CompressedKrt0->Rotation.Y = static_cast < int16_t > ( ( ( -Krts.Rotation.Y ) * 4096.0f ) );
@@ -364,9 +364,9 @@ void CClientIFP::ReadKrt0FramesAsCompressed ( std::unique_ptr < CAnimBlendSequen
364364
{
365365
for ( int32_t FrameIndex = 0; FrameIndex < TotalFrames; FrameIndex++ )
366366
{
367-
IFP_Compressed_KRT0 * CompressedKrt0 = static_cast < IFP_Compressed_KRT0 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( IFP_Compressed_KRT0 ) ) );
368-
IFP_KRT0 Krt0;
369-
ReadBuffer < IFP_KRT0 > ( &Krt0 );
367+
SCompressed_KRT0 * CompressedKrt0 = static_cast < SCompressed_KRT0 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( SCompressed_KRT0 ) ) );
368+
SKrt0 Krt0;
369+
ReadBuffer < SKrt0 > ( &Krt0 );
370370

371371
CompressedKrt0->Rotation.X = static_cast < int16_t > ( ( ( -Krt0.Rotation.X ) * 4096.0f ) );
372372
CompressedKrt0->Rotation.Y = static_cast < int16_t > ( ( ( -Krt0.Rotation.Y ) * 4096.0f ) );
@@ -385,9 +385,9 @@ void CClientIFP::ReadKr00FramesAsCompressed ( std::unique_ptr < CAnimBlendSequen
385385
{
386386
for ( int32_t FrameIndex = 0; FrameIndex < TotalFrames; FrameIndex++ )
387387
{
388-
IFP_Compressed_KR00 * CompressedKr00 = static_cast < IFP_Compressed_KR00 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( IFP_Compressed_KR00 ) ) );
389-
IFP_KR00 Kr00;
390-
ReadBuffer < IFP_KR00 > ( &Kr00 );
388+
SCompressed_KR00 * CompressedKr00 = static_cast < SCompressed_KR00 * > ( pAnimationSequence->GetKeyFrame ( FrameIndex, sizeof ( SCompressed_KR00 ) ) );
389+
SKr00 Kr00;
390+
ReadBuffer < SKr00 > ( &Kr00 );
391391

392392
CompressedKr00->Rotation.X = static_cast < int16_t > ( ( ( -Kr00.Rotation.X ) * 4096.0f ) );
393393
CompressedKr00->Rotation.Y = static_cast < int16_t > ( ( ( -Kr00.Rotation.Y ) * 4096.0f ) );
@@ -398,29 +398,29 @@ void CClientIFP::ReadKr00FramesAsCompressed ( std::unique_ptr < CAnimBlendSequen
398398
}
399399
}
400400

401-
size_t CClientIFP::GetSizeOfCompressedFrame ( IFP_FrameType iFrameType )
401+
size_t CClientIFP::GetSizeOfCompressedFrame ( eFrameType iFrameType )
402402
{
403403
switch ( iFrameType )
404404
{
405-
case IFP_FrameType::KRTS:
405+
case eFrameType::KRTS:
406406
{
407-
return sizeof ( IFP_Compressed_KRT0 );
407+
return sizeof ( SCompressed_KRT0 );
408408
}
409-
case IFP_FrameType::KRT0:
409+
case eFrameType::KRT0:
410410
{
411-
return sizeof ( IFP_Compressed_KRT0 );
411+
return sizeof ( SCompressed_KRT0 );
412412
}
413-
case IFP_FrameType::KR00:
413+
case eFrameType::KR00:
414414
{
415-
return sizeof ( IFP_Compressed_KR00 );
415+
return sizeof ( SCompressed_KR00 );
416416
}
417-
case IFP_FrameType::KR00_COMPRESSED:
417+
case eFrameType::KR00_COMPRESSED:
418418
{
419-
return sizeof ( IFP_Compressed_KR00 );
419+
return sizeof ( SCompressed_KR00 );
420420
}
421-
case IFP_FrameType::KRT0_COMPRESSED:
421+
case eFrameType::KRT0_COMPRESSED:
422422
{
423-
return sizeof ( IFP_Compressed_KRT0 );
423+
return sizeof ( SCompressed_KRT0 );
424424
}
425425
}
426426
return 0;
@@ -478,22 +478,22 @@ BYTE * CClientIFP::AllocateSequencesMemory ( std::unique_ptr < CAnimBlendHierarc
478478
return static_cast < BYTE * > ( operator new ( 12 * cMaxSequences + 4 ) );
479479
}
480480

481-
CClientIFP::IFP_FrameType CClientIFP::GetFrameTypeFromFourCC ( const char * szFourCC )
481+
CClientIFP::eFrameType CClientIFP::GetFrameTypeFromFourCC ( const char * szFourCC )
482482
{
483483
if ( strncmp ( szFourCC, "KRTS", 4 ) == 0)
484484
{
485-
return IFP_FrameType::KRTS;
485+
return eFrameType::KRTS;
486486
}
487487
else if ( strncmp ( szFourCC, "KRT0", 4 ) == 0)
488488
{
489-
return IFP_FrameType::KRT0;
489+
return eFrameType::KRT0;
490490
}
491491
else if ( strncmp ( szFourCC, "KR00", 4 ) == 0)
492492
{
493-
return IFP_FrameType::KR00;
493+
return eFrameType::KR00;
494494
}
495495

496-
return IFP_FrameType::UNKNOWN_FRAME;
496+
return eFrameType::UNKNOWN_FRAME;
497497
}
498498

499499

@@ -510,12 +510,12 @@ void CClientIFP::InsertAnimationDummySequence ( std::unique_ptr < CAnimBlendSequ
510510
// We only need 1 dummy key frame to make the animation work
511511
const size_t cKeyFrames = 1;
512512
// KR00 is child key frame and KRT0 is Root key frame
513-
size_t FrameSize = sizeof ( IFP_Compressed_KR00 );
513+
size_t FrameSize = sizeof ( SCompressed_KR00 );
514514

515515
if ( bRootBone )
516516
{
517517
// This key frame will have translation values.
518-
FrameSize = sizeof ( IFP_Compressed_KRT0 );
518+
FrameSize = sizeof ( SCompressed_KRT0 );
519519
bHasTranslationValues = true;
520520
}
521521

@@ -746,15 +746,15 @@ constexpr void CClientIFP::RoundSize ( uint32_t & u32Size )
746746
}
747747
}
748748

749-
constexpr bool CClientIFP::IsKeyFramesTypeRoot ( IFP_FrameType iFrameType )
749+
constexpr bool CClientIFP::IsKeyFramesTypeRoot ( eFrameType iFrameType )
750750
{
751751
switch ( iFrameType )
752752
{
753-
case IFP_FrameType::KR00:
753+
case eFrameType::KR00:
754754
{
755755
return false;
756756
}
757-
case IFP_FrameType::KR00_COMPRESSED:
757+
case eFrameType::KR00_COMPRESSED:
758758
{
759759
return false;
760760
}

0 commit comments

Comments
 (0)