mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 06:42:09 +00:00
3af9232fca
- Changed the glass shards so that they do not have to override FloorBounceMissile. It was the only place where this was virtually overridden and provided little usefulness. - made 'out' variables work. - fixed virtual call handling for HandlePickup.
20 lines
821 B
C
20 lines
821 B
C
inline unsigned GetVirtualIndex(PClass *cls, const char *funcname)
|
|
{
|
|
// Look up the virtual function index in the defining class because this may have gotten overloaded in subclasses with something different than a virtual override.
|
|
auto sym = dyn_cast<PFunction>(cls->Symbols.FindSymbol(funcname, false));
|
|
assert(sym != nullptr);
|
|
auto VIndex = sym->Variants[0].Implementation->VirtualIndex;
|
|
return VIndex;
|
|
}
|
|
|
|
#define IFVIRTUALPTR(self, cls, funcname) \
|
|
static unsigned VIndex = ~0u; \
|
|
if (VIndex == ~0u) { \
|
|
VIndex = GetVirtualIndex(RUNTIME_CLASS(cls), #funcname); \
|
|
assert(VIndex != ~0u); \
|
|
} \
|
|
auto clss = self->GetClass(); \
|
|
VMFunction *func = clss->Virtuals.Size() > VIndex? clss->Virtuals[VIndex] : nullptr; \
|
|
if (func != nullptr)
|
|
|
|
#define IFVIRTUAL(cls, funcname) IFVIRTUALPTR(this, cls, funcname)
|