MCPcopy Create free account
hub / github.com/RSDKModding/RSDKv4-Decompilation / LoadAnimationFile

Function LoadAnimationFile

RSDKv4/Animation.cpp:16–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14int hitboxCount = 0;
15
16void LoadAnimationFile(char *filePath)
17{
18 FileInfo info;
19 if (LoadFile(filePath, &info)) {
20 byte fileBuffer = 0;
21 char strBuf[0x21];
22 byte sheetIDs[0x18];
23 sheetIDs[0] = 0;
24
25 byte sheetCount = 0;
26 FileRead(&sheetCount, 1);
27
28 for (int s = 0; s < sheetCount; ++s) {
29 FileRead(&fileBuffer, 1);
30 if (fileBuffer) {
31 int i = 0;
32 for (; i < fileBuffer; ++i) FileRead(&strBuf[i], 1);
33 strBuf[i] = 0;
34 GetFileInfo(&info);
35 CloseFile();
36 sheetIDs[s] = AddGraphicsFile(strBuf);
37 SetFileInfo(&info);
38 }
39 }
40
41 byte animCount = 0;
42 FileRead(&animCount, 1);
43 AnimationFile *animFile = &animationFileList[animationFileCount];
44 animFile->animCount = animCount;
45 animFile->aniListOffset = animationCount;
46
47 for (int a = 0; a < animCount; ++a) {
48 SpriteAnimation *anim = &animationList[animationCount++];
49 anim->frameListOffset = animFrameCount;
50 FileRead(&fileBuffer, 1);
51 FileRead(anim->name, fileBuffer);
52 anim->name[fileBuffer] = 0;
53 FileRead(&anim->frameCount, 1);
54 FileRead(&anim->speed, 1);
55 FileRead(&anim->loopPoint, 1);
56 FileRead(&anim->rotationStyle, 1);
57
58 for (int j = 0; j < anim->frameCount; ++j) {
59 SpriteFrame *frame = &animFrames[animFrameCount++];
60 FileRead(&frame->sheetID, 1);
61 frame->sheetID = sheetIDs[frame->sheetID];
62 FileRead(&frame->hitboxID, 1);
63 FileRead(&fileBuffer, 1);
64 frame->sprX = fileBuffer;
65 FileRead(&fileBuffer, 1);
66 frame->sprY = fileBuffer;
67 FileRead(&fileBuffer, 1);
68 frame->width = fileBuffer;
69 FileRead(&fileBuffer, 1);
70 frame->height = fileBuffer;
71
72 sbyte buffer = 0;
73 FileRead(&buffer, 1);

Callers 1

AddAnimationFileFunction · 0.85

Calls 4

FileReadFunction · 0.85
GetFileInfoFunction · 0.85
CloseFileFunction · 0.85
AddGraphicsFileFunction · 0.85

Tested by

no test coverage detected