MCPcopy Create free account
hub / github.com/crossuo/crossuo / Load

Method Load

src/Managers/GumpManager.cpp:1156–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1154static const int VERSION = 3;
1155
1156void CGumpManager::Load(const fs_path &path)
1157{
1158 CMappedFile file;
1159
1160 bool paperdollRequested = false;
1161 bool menubarFound = false;
1162 bool bufficonWindowFound = false;
1163 bool minimizedConsoleType = false;
1164 bool showFullTextConsoleType = false;
1165 if (file.Load(path) && file.Size != 0)
1166 {
1167 const auto version = file.ReadUInt8();
1168 uint8_t *oldPtr = file.Ptr;
1169 uint16_t count = 0;
1170 uint16_t spellGroupsCount = 0;
1171 if (version != 0)
1172 {
1173 file.Ptr = (uint8_t *)file.Start + (file.Size - 8);
1174 spellGroupsCount = file.ReadInt16LE();
1175 count = file.ReadInt16LE();
1176 }
1177 else
1178 {
1179 file.Ptr = (uint8_t *)file.Start + (file.Size - 6);
1180 count = file.ReadInt16LE();
1181 }
1182 file.Ptr = oldPtr;
1183
1184 // custom static blob data
1185 if (version == 3)
1186 {
1187 const auto blobMarker = file.ReadUInt32LE();
1188 if (blobMarker == 0x33221100)
1189 {
1190 const auto blobType = file.ReadUInt8();
1191 if (blobType == 0x01) // some gump extra data
1192 {
1193 const auto gumpType = (GUMP_TYPE)file.ReadUInt8();
1194 switch (gumpType)
1195 {
1196 case GT_RESOURCETRACKER:
1197 {
1198 ResourceTracker_LoadStaticContents(file);
1199 }
1200 default:
1201 break;
1202 }
1203 }
1204 }
1205 }
1206
1207 bool menubarLoaded = false;
1208 for (int i = 0; i < count; i++)
1209 {
1210 CGump *gump = nullptr;
1211 uint8_t *next = file.Ptr;
1212 uint8_t size = file.ReadUInt8();
1213 next += size;

Callers 3

CIntlocMethod · 0.45
InitMethod · 0.45
LoadFontsMethod · 0.45

Calls 15

CContainerStackItemClass · 0.85
ReadUInt8Method · 0.80
ReadInt16LEMethod · 0.80
ReadUInt32LEMethod · 0.80
ReadUInt16LEMethod · 0.80
PaperdollReqMethod · 0.80
SetOpenedMethod · 0.80
AddSpellMethod · 0.80
FindLayerMethod · 0.80
SendMethod · 0.45

Tested by

no test coverage detected