@@ -1061,6 +1061,7 @@ bool StyleData::InitGameObjectsList()
10611061 {
10621062 GameObjectStyle& currObject = mGameObjects [icurr];
10631063 currObject.mGameObjectIndex = icurr;
1064+ currObject.mLifeDuration = 0 ;
10641065
10651066 ObjectRawData& objectRaw = mObjectsRaw [icurr];
10661067
@@ -1080,25 +1081,29 @@ bool StyleData::InitGameObjectsList()
10801081 int frameCount = 0 ;
10811082 cxx::json_get_attribute (currObjectNode, " frameCount" , frameCount);
10821083
1083- if (frameCount > 0 )
1084- {
1085- int startSpriteIndex = GetSpriteIndex (eSpriteType_Object, objectRaw.mBaseSprite );
1086- currObject.mAnimationData .Setup (startSpriteIndex, frameCount);
1087- }
1088-
10891084 ParseObjectFlags (currObjectNode, " flags" , currObject.mFlags );
10901085
1091- // convert object dimensions pixels to meters
1092-
1093- // todo:
1086+ int startSpriteIndex = GetSpriteIndex (eSpriteType_Object, objectRaw.mBaseSprite );
1087+
10941088 // as cds says,
10951089 // Animated objects are a special case. They cannot be involved in collisions and are there for graphical
10961090 // effect only. The same data structure is used, with the following differences :
10971091 // * height - stores the number of game cycles per frame
10981092 // * width - stores the number of frames
10991093 // * depth - stores a life descriptor ( 0 for infinite, non-zero n for n animation cycles )
1100- if (currObject. mClassID != eGameObjectClass_Decoration )
1094+ if (objectRaw. mStatus == 5 )
11011095 {
1096+ float fps = (GTA_CYCLES_PER_FRAME * 1 .0f ) / objectRaw.mHeight ;
1097+ currObject.mAnimationData .Setup (startSpriteIndex, objectRaw.mWidth , fps);
1098+ currObject.mLifeDuration = objectRaw.mDepth ;
1099+ }
1100+ else
1101+ {
1102+ if (frameCount > 0 )
1103+ {
1104+ currObject.mAnimationData .Setup (startSpriteIndex, frameCount);
1105+ }
1106+ // convert object dimensions pixels to meters
11021107 currObject.mHeight = Convert::PixelsToMeters (objectRaw.mHeight );
11031108 currObject.mWidth = Convert::PixelsToMeters (objectRaw.mWidth );
11041109 currObject.mDepth = Convert::PixelsToMeters (objectRaw.mDepth );
0 commit comments