Code:
datum_index GetParentObject(datum_index obj)
{
object_header_datum* object_header_datums = Objects::ObjectHeader()->datums;
object_data* current_obj = (object_data*)object_header_datums[obj.index].address;
while( current_obj->GetParentObjectIndex()->index != NONE )
{
obj = *current_obj->GetParentObjectIndex();
current_obj = (object_data*)object_header_datums[obj.index].address;
}
return obj;
}
Wouldn't it be a GetRootObject function, since it's while loops up the hierarchy?
looks like coding is the easy part
Code:
bool ToggleMultiTeamVehicles()
{
FUNC_PTR(UNIT_CAN_ENTER_SEAT_MOD, 0x56A261, 0x56A3B1, 0x518D41);
// mov bl, 1
// jmp
static byte enable_code[] = {0xB3, 0x01, 0xEB};
// test al, al
// jz
static byte disable_code[] = {0x84, 0xC0, 0x74};
static bool enabled = false;
Memory::WriteMemory(GET_FUNC_VPTR(UNIT_CAN_ENTER_SEAT_MOD), (enabled ? disable_code : enable_code), sizeof(enable_code));
return enabled = !enabled;
}
finding the CONSTANTS, on the other hand...
Bookmarks