| 58 | IMPLEMENT_CLASS(DLevelPostProcessor, true, false); |
| 59 | |
| 60 | void PostProcessLevel(const uint8_t* md4, const FString& mapname, SpawnSpriteDef& sprites) |
| 61 | { |
| 62 | hw_ClearSplitSector(); |
| 63 | auto lc = Create<DLevelPostProcessor>(); |
| 64 | lc->sprites = &sprites; |
| 65 | |
| 66 | char md4string[33]; |
| 67 | for (int i = 0; i < 16; i++) mysnprintf(md4string + 2 * i, 3, "%02x", md4[i]); |
| 68 | FName checksum(md4string, true); |
| 69 | if (checksum == NAME_None) return; // we do not have anything so save the work. |
| 70 | |
| 71 | for(auto cls : PClass::AllClasses) |
| 72 | { |
| 73 | if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor))) |
| 74 | { |
| 75 | PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false)); |
| 76 | if (func == nullptr) |
| 77 | { |
| 78 | Printf("Missing 'Apply' method in class '%s', level compatibility object ignored\n", cls->TypeName.GetChars()); |
| 79 | continue; |
| 80 | } |
| 81 | |
| 82 | auto argTypes = func->Variants[0].Proto->ArgumentTypes; |
| 83 | if (argTypes.Size() != 3 || argTypes[1] != TypeName || argTypes[2] != TypeString) |
| 84 | { |
| 85 | Printf("Wrong signature of 'Apply' method in class '%s', level compatibility object ignored\n", cls->TypeName.GetChars()); |
| 86 | continue; |
| 87 | } |
| 88 | |
| 89 | VMValue param[] = { lc, checksum.GetIndex(), &mapname }; |
| 90 | VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SetSpriteLotag) |
| 96 | { |
no test coverage detected