MCPcopy Create free account
hub / github.com/ZDoom/Raze / CreateOptionMenuItemCommand

Function CreateOptionMenuItemCommand

source/common/menu/menu.cpp:1130–1141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1128}
1129
1130DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered)
1131{
1132 auto c = PClass::FindClass("OptionMenuItemCommand");
1133 auto p = c->CreateNew();
1134 FString namestr = label;
1135 VMValue params[] = { p, &namestr, cmd.GetIndex(), centered, false };
1136 auto f = dyn_cast<PFunction>(c->FindSymbol("Init", false));
1137 VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0);
1138 auto unsafe = dyn_cast<PField>(c->FindSymbol("mUnsafe", false));
1139 unsafe->Type->SetValue(reinterpret_cast<uint8_t*>(p) + unsafe->Offset, 0);
1140 return (DMenuItemBase*)p;
1141}
1142
1143DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param)
1144{

Callers 1

InitMusicMenusFunction · 0.85

Calls 5

VMCallFunction · 0.85
CreateNewMethod · 0.80
GetIndexMethod · 0.45
FindSymbolMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected