Ejemplo n.º 1
0
void LoadPlugins() {
	char vdub[MAX_PATH], drv[MAX_PATH], dir[MAX_PATH], find[MAX_PATH], path[MAX_PATH];

	GetModuleFileName(NULL, vdub, MAX_PATH);

	_splitpath(vdub, drv, dir, NULL, NULL);
	wsprintf(find, "%s%s%s%s", drv, dir, "plugins\\", "*.auo");

	HANDLE hFind;
	WIN32_FIND_DATA fd;

	if ((hFind = FindFirstFile(find, &fd)) == INVALID_HANDLE_VALUE)
		return;

	g_menuList.clear();

	do {
		sprintf(path, "%s%s%s%s", drv, dir, "plugins\\", fd.cFileName);
		AviUtlPlugin *auo = new AviUtlPlugin(path);

		if (auo->Init()) {
			MenuItem *item = new MenuItem;

			item->path = std::string(path);
			item->name = std::string(auo->opt->tbl->name);

			g_menuList.push_back(item);
		}
		delete auo;

	} while (FindNextFile(hFind, &fd));

	FindClose(hFind);
}
Ejemplo n.º 2
0
void ObjectController::handleObjectMenuRequest(Message* message)
{
    //for ever item where we request a radial the client starts by displaying a radial on his own and additionally sends a
    //objectMenuRequest to the server
    //The server then either just resends the radial as send by the client or adds / modifies options on his own
    //this is why sometimes when lag is involved it takes some time for all options to display


    PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);

    message->getUint32(); // unknown
    uint64 requestedObjectId = message->getUint64();
    message->getUint64(); // player id again ?

    Object* requestedObject = gWorldManager->getObjectById(requestedObjectId);

    uint32 itemCount = message->getUint32();

    BString extendedDescription;
    MenuItemList menuItemList;

    MenuItem* menuItem;
    for(uint32 i = 0; i < itemCount; i++)
    {
        menuItem = new(MenuItem);

        menuItem->sItem			= message->getUint8();   // item nr
        menuItem->sSubMenu		= message->getUint8();   // submenu flag
        menuItem->sIdentifier	= message->getUint8();   // item identifier
        menuItem->sOption		= message->getUint8();   // extended option
        message->getStringUnicode16(extendedDescription);
        menuItemList.push_back(menuItem);
    }

    uint8 responseNr = message->getUint8();

    if(!requestedObject)
    {
        if(playerObject->isConnected())
            gMessageLib->sendEmptyObjectMenuResponse(requestedObjectId,playerObject,responseNr,menuItemList);

        //the list is cleared and items are destroyed in the message lib
        //for the default response
        return;
    }

    requestedObject->setMenuList(&menuItemList);



    //are we an item dropped in a structure awaiting to be moved or picked u`p?
    //just implement this virtual function for items as we need just one central point instead
    //of the same code over and over for all items

    CellObject* itemCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(requestedObject->getParentId()));

    Item* item = dynamic_cast<Item*>(requestedObject);
    ResourceContainer* rC = dynamic_cast<ResourceContainer*>(requestedObject);
    TangibleObject* tO = dynamic_cast<TangibleObject*>(requestedObject);

    //only display that menu when *we* and the item are in the same structure
    if((rC || item) && itemCell && (!tO->getStatic()))
    {
        CellObject* playerCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(playerObject->getParentId()));
        if(playerCell && (playerCell->getParentId() == itemCell->getParentId()))
        {
            PlayerStructure* pS = dynamic_cast<PlayerStructure*>(gWorldManager->getObjectById(playerCell->getParentId()));
            if(pS)
                requestedObject->prepareCustomRadialMenuInCell(playerObject,static_cast<uint8>(itemCount));
        }
    }
    /*
    if(rc && requestedObject->getParentId())
    {
        if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(requestedObject->getParentId())))
        {
            requestedObject->prepareCustomRadialMenuInCell(playerObject,static_cast<uint8>(itemCount));
        }
    }
    */
    //delete the radials after every use or provide every object with set rules when to delete it ?

    if(!requestedObject->getRadialMenu())
        requestedObject->prepareCustomRadialMenu(playerObject,static_cast<uint8>(itemCount));

    if (requestedObject->getRadialMenu())
    {
        if(playerObject->isConnected())
        {
            gMessageLib->sendObjectMenuResponse(requestedObject,playerObject,responseNr);
        }
        //they only reset if the objects virtual function does it
        //by default it stays
        requestedObject->ResetRadialMenu();
        //the radial menu is supposed to be an intelligent pointer deleting itself when no reference is left
        //however during runtime the item always references the radialmenu that was generated for it on the first call.
        //when the circumstances of the item change we need to delete the pointer and thus force it to generate a new radial
    }
    else
    {
        // putting this for static objects/objects that are not known by the server yet
        // send a default menu,so client stops flooding us with requests

        //empty might just mean that the clients radial is sufficient

        if(playerObject->isConnected())
            gMessageLib->sendEmptyObjectMenuResponse(requestedObjectId,playerObject,responseNr,menuItemList);

        //the list is cleared and items are destroyes in the message lib
        //for the default response
    }


    //we need to clear that if the messagelib wont clear it
    //still want to use it for the player radials at some point
    for(MenuItemList::iterator it=menuItemList.begin(); it != menuItemList.end(); it++)
        delete (*it);

    menuItemList.clear();

}