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

Function LoadAnimationFile

RSDKv3/Animation.cpp:16–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14int hitboxCount = 0;
15
16void LoadAnimationFile(const 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 // Read & load each spritesheet
29 for (int s = 0; s < sheetCount; ++s) {
30 FileRead(&fileBuffer, 1);
31 if (fileBuffer) {
32 int i = 0;
33 for (; i < fileBuffer; ++i) FileRead(&strBuf[i], 1);
34 strBuf[i] = 0;
35 GetFileInfo(&info);
36 CloseFile();
37 sheetIDs[s] = AddGraphicsFile(strBuf);
38 SetFileInfo(&info);
39 }
40 }
41
42 byte animCount = 0;
43 FileRead(&animCount, 1);
44 AnimationFile *animFile = &animationFileList[animationFileCount];
45 animFile->animCount = animCount;
46 animFile->aniListOffset = animationCount;
47
48 // Read animations
49 for (int a = 0; a < animCount; ++a) {
50 SpriteAnimation *anim = &animationList[animationCount++];
51 anim->frameListOffset = animFrameCount;
52 FileRead(&fileBuffer, 1);
53 FileRead(anim->name, fileBuffer);
54 anim->name[fileBuffer] = 0;
55 FileRead(&anim->frameCount, 1);
56 FileRead(&anim->speed, 1);
57 FileRead(&anim->loopPoint, 1);
58 FileRead(&anim->rotationStyle, 1);
59
60 for (int j = 0; j < anim->frameCount; ++j) {
61 SpriteFrame *frame = &animFrames[animFrameCount++];
62 FileRead(&frame->sheetID, 1);
63 frame->sheetID = sheetIDs[frame->sheetID];
64 FileRead(&frame->hitboxID, 1);
65 FileRead(&fileBuffer, 1);
66 frame->sprX = fileBuffer;
67 FileRead(&fileBuffer, 1);
68 frame->sprY = fileBuffer;
69 FileRead(&fileBuffer, 1);
70 frame->width = fileBuffer;
71 FileRead(&fileBuffer, 1);
72 frame->height = fileBuffer;
73

Callers 1

AddAnimationFileFunction · 0.85

Calls 6

LoadFileFunction · 0.85
FileReadFunction · 0.85
GetFileInfoFunction · 0.85
CloseFileFunction · 0.85
AddGraphicsFileFunction · 0.85
SetFileInfoFunction · 0.85

Tested by

no test coverage detected