Пример #1
0
bool Game::LoadContent()
{
    ///TEXTURES

    handSurf = IMG_Load("./Resources/Images/cursor.png");
    if(handSurf == NULL)
        return false;

    hand = SDL_CreateColorCursor(handSurf, 0, 0);

    if(hand == NULL)
        return false;

    SDL_SetCursor(hand);


    empty_layer.Tileset_Image = OnLoad(Renderer, TILESET);

    empty_layer.Hover_Image = OnLoad(Renderer, TILESET);

    Character.Image = OnLoad(Renderer, "./Resources/Images/ogre.png");

    if(empty_layer.Hover_Image == NULL)
    {
        return false;
    }

    if(empty_layer.Tileset_Image == NULL)
    {
        return false;
    }

    if(Character.Image == NULL)
    {
        return false;
    }

    SDL_SetTextureAlphaMod(empty_layer.Hover_Image, 100);

    ///MAPS

    empty_layer.loadMap.open("./Resources/empty_layer100x100.layer");

    if(empty_layer.LoadTileSet() == false)
    {
        cout<<"Map not loaded"<<endl;
        Sleep(1000);
        return false;
    }


    return true;
}
Пример #2
0
void ResourceBase::Unload()
{
    if (InterlockedCompareExchange(&mState, RES_UNLOADING, RES_LOADED) == RES_LOADED)
    {
        //destination status changed during task waiting
        if (mDestState == RES_LOADED)
        {
            SetState(RES_LOADED);
            return;
        }

        for (;;)
        {
            OnUnload();
            if (mDestState != RES_LOADED)
            {
                SetState(RES_UNLOADED);
                return;
            }

            //destination status changed during resource loading - load resource back
            SetState(RES_LOADING);
            bool result = OnLoad();

            if (mDestState == RES_LOADED)
            {
                SetState(result ? RES_LOADED : RES_FAILED);
                return;
            }
        }
    }
}
Пример #3
0
void Module::Load() {
	if (IsActive())
		return;

	// Hook up all the events
	
	__hook(&ModuleManager::OnDraw, BH::moduleManager, &Module::OnDraw, this);
	__hook(&ModuleManager::OnAutomapDraw, BH::moduleManager, &Module::OnAutomapDraw, this);
	__hook(&ModuleManager::OnOOGDraw, BH::moduleManager, &Module::OnOOGDraw, this);

	__hook(&ModuleManager::OnGameJoin, BH::moduleManager, &Module::OnGameJoin, this);
	__hook(&ModuleManager::OnGameExit, BH::moduleManager, &Module::OnGameExit, this);

	__hook(&ModuleManager::OnLoop, BH::moduleManager, &Module::OnLoop, this);

	__hook(&ModuleManager::OnLeftClick, BH::moduleManager, &Module::OnLeftClick, this);
	__hook(&ModuleManager::OnRightClick, BH::moduleManager, &Module::OnRightClick, this);
	__hook(&ModuleManager::OnKey, BH::moduleManager, &Module::OnKey, this);

	__hook(&ModuleManager::OnChatPacketRecv, BH::moduleManager, &Module::OnChatPacketRecv, this);
	__hook(&ModuleManager::OnRealmPacketRecv, BH::moduleManager, &Module::OnRealmPacketRecv, this);
	__hook(&ModuleManager::OnGamePacketRecv, BH::moduleManager, &Module::OnGamePacketRecv, this);

	__hook(&ModuleManager::OnChatMsg, BH::moduleManager, &Module::OnChatMsg, this);
	__hook(&Module::UserInput, this, &Module::OnUserInput, this);

	active = true;
	OnLoad();
}
Пример #4
0
	void Resource::_removeDependence(ResourceDependence * pDependence)
	{
		LINKER_REMOVE(mDependenceLinker, pDependence);
		delete pDependence;

		if (mLoadState == LOADING && _getDependences() == NULL)
			OnLoad();
	}
Пример #5
0
void qtDLGOption::OnReload()
{
	m_pSettings->WriteDefaultSettings();
	m_pSettings->LoadDebuggerSettings();
	m_pSettings->LoadDisassemblerColor();
	m_pSettings->LoadDefaultJITDebugger(m_originalJIT,m_originalJITWOW64);

	OnLoad();
}
Пример #6
0
OP_STATUS HEListElm::SendImageFinishedLoadingEvent(FramesDocument* doc)
{
	OP_ASSERT(doc);
	OP_ASSERT(!GetEventSent());

	if (inline_type == IMAGE_INLINE && HElm()->GetInserted() == HE_INSERTED_BY_PARSE_AHEAD)
	{
		HElm()->SetSpecialBoolAttr(ATTR_JS_DELAYED_ONLOAD, TRUE, SpecialNs::NS_LOGDOC);
		return OpStatus::OK;
	}

	// Since this requires decoding the image, skip it if there are no event listeners
	if (inline_type == IMAGE_INLINE &&
		(GetElm()->HasEventHandler(doc, ONLOAD) || GetElm()->HasEventHandler(doc, ONERROR)))
	{
		LoadInlineElm* lie = GetLoadInlineElm();
		OP_ASSERT(lie);
		URLStatus url_status = lie->GetUrl()->Status(TRUE);
		if (url_status == URL_LOADED)
		{
#ifdef SVG_SUPPORT
			// If it is an svg image wait with sending onerror or
			// onload until it has been parsed.
			if (lie->GetUrl()->ContentType() == URL_SVG_CONTENT)
				return OpStatus::OK;
#endif // SVG_SUPPORT

			Image img = GetImage();
			// IsAnimated() implies that the first frame is decoded which is good enough for us.
			if (img.ImageDecoded() || img.IsAnimated())
				return OnLoad();

			if (GetUrlContentProvider() && !GetImageVisible())
			{
				/* Force image decoding, so that we can send onload or onerror as appropriate. */
				OP_STATUS status = img.IncVisible(this);
				if (OpStatus::IsSuccess(status))
				{
					// Scripts might load image in a hidden place and move
					// on load, in which case we don't want image to be
					// re-decoded.
					ImageManager::GraceTimeLock lock(imgManager);

					// This will send onload or onerror through the ImageListener callbacks (OnError and OnPortionDecoded).
					// except for animated images since only the first frame will be decoded.
					status = img.OnLoadAll(GetUrlContentProvider());
					img.DecVisible(this);
					OP_ASSERT(GetEventSent());
				}
				return status;
			}
		}
		else if (url_status == URL_LOADING_FAILURE)
			SendOnError();
	}
	return OpStatus::OK;
}
	void CTestPluginsLoader::Load( SPluginsConfig && config )
	{
		_config._mySql = std::move( config._mySql );
		_config._sqlite = std::move( config._sqlite );
		_config._odbcMySql = std::move( config._odbcMySql );
		_config._odbcMsSql = std::move( config._odbcMsSql );
		_config._postgreSql = std::move( config._postgreSql );
		OnLoad();
	}
Пример #8
0
/** OnReload
  *
  * Called when the user wants to reload the last file.
  */
void ComplxFrame::OnReload(wxCommandEvent& event)
{
    if (Running()) return;
    if (reload_options.file.empty())
    {
        OnLoad(event);
        return;
    }

    DoLoadFile(reload_options);
}
Пример #9
0
/** OnReload
  *
  * Called when the user wants to reload the last file.
  */
void ComplxFrame::OnReload(wxCommandEvent& event)
{
    if (Running()) return;
    if (currentFile.GetFullName().IsEmpty())
    {
        OnLoad(event);
        return;
    }

    OnInit();
    DoLoadFile(currentFile);
}
Пример #10
0
	void Resource::Load()
	{
		if (mLoadState != Resource::UNLOADED)
			return ;

		mLoadState = LOADING;

		if (CanLoad())
			ResourceManager::Instance()->GetResourceLoader()->Load(this);
		else
			OnLoad();
	}
Пример #11
0
void CORBA::jni::Object::fromJObject (CORBA::Object_var& out, JNIEnv* env, jobject obj)
{
    OnLoad(env);
    if (obj == NULL) {
        out = CORBA::Object::_nil();
    } else if (omnijni::ObjectImpl::isInstance(env, obj)) {
        CORBA::Object_ptr ref = omnijni::ObjectImpl::getObjectRef(env, obj);
        out = CORBA::Object::_duplicate(ref);
    } else {
        out = omnijni::ORB::object_to_native(env, obj);
    }
}
Пример #12
0
	FBOXAPI void Event::OnUpdate()
	{
		if (Input::Key[KEY_SPACE])
		{
			OnUnload();
			OnLoad();
			OnStart();
		}

		if (Stage::CurrentScene != 0)
		{
			Stage::CurrentScene->update();
		}
	}
Пример #13
0
	void MainMenu::OnMenuCtrlAccept(MyGUI::MenuControl* _sender, MyGUI::MenuItem* _item)
	{
		const std::string& id = _item->getItemId();

		if (id == "CTRL_Menu_Load")
			OnLoad();
		else if (id == "CTRL_Menu_Save")
			OnSave();
		else if (id == "CTRL_Menu_Import")
			OnImport();
		else if (id == "CTRL_Menu_Export")
			OnExport();
		else if (id == "CTRL_Menu_New")
			OnNew();
	}
Пример #14
0
MainWindow::MainWindow()
	: QWidget()
{
	setMinimumSize( 512, 384 );

	menu_bar_= new QMenuBar( this );
	setContentsMargins( 0, menu_bar_->height(), 0, 0 );

	file_menu_= new QMenu( "File" );
	file_menu_->addAction( "Open", this, SLOT(OnLoad()) );
	file_menu_->addAction( "Save", this, SLOT(OnSave()) );
	file_menu_->addAction( "Quit", this, SLOT(close()) );
	menu_bar_->addMenu( file_menu_ );

	layout_= new QBoxLayout( QBoxLayout::TopToBottom, this );
	setLayout( layout_ );

	help_menu_= new QMenu( "Help" );
	help_menu_->addAction( "About", this, SLOT(OnAbout()) );
	menu_bar_->addMenu( help_menu_ );

	tool_bar_= new QToolBar("tools", this);
	layout_->addWidget( tool_bar_ );

	tool_bar_->addAction( "save", this, SLOT(OnSave()) );
	tool_bar_->addAction( "load", this, SLOT(OnLoad()) );
	tool_bar_->addAction( "build", this, SLOT(OnBuild()) );

	editor_= new QTextEdit( this );
	layout_->addWidget( editor_ );


	output_= new QTextEdit( this );
	output_->setEnabled( false );
	layout_->addWidget( output_ );
}
Пример #15
0
void View::UpdateControls()
{
	for (ClstPtr c = _cl.begin(); c != _cl.end(); c++)
	{
		ControlPtr p = *c;

		int index = p->GetParamIndex();
		double value = _listener->GetParamValue(index);
		p->SetNormalValue(value);
	}

	OnLoad();

	if (_hWnd)
		InvalidateRect(_hWnd, NULL, FALSE);
}
Пример #16
0
void qtDLGOption::OnReload()
{
    qtDLGNanomite* myMainWindow = qtDLGNanomite::GetInstance();

    myMainWindow->coreDebugger->dbgSettings.dwBreakOnEPMode = 0;
    myMainWindow->coreDebugger->dbgSettings.bAutoLoadSymbols = true;
    myMainWindow->coreDebugger->dbgSettings.bDebugChilds = true;
    myMainWindow->coreDebugger->dbgSettings.dwSuspendType = 0;
    myMainWindow->coreDebugger->dbgSettings.dwDefaultExceptionMode = 0;

    myMainWindow->coreDebugger->CustomExceptionRemoveAll();
    myMainWindow->coreDebugger->CustomExceptionAdd(EXCEPTION_ACCESS_VIOLATION,1,NULL);
    myMainWindow->coreDebugger->CustomExceptionAdd(EXCEPTION_PRIV_INSTRUCTION,1,NULL);
    myMainWindow->coreDebugger->CustomExceptionAdd(EXCEPTION_ILLEGAL_INSTRUCTION,1,NULL);
    myMainWindow->coreDebugger->CustomExceptionAdd(EXCEPTION_INT_DIVIDE_BY_ZERO,1,NULL);

    rbModuleEP->setChecked(true);
    cbLoadSym->setChecked(true);
    cbDebugChild->setChecked(true);
    cbSuspendThread->setChecked(false);
    cbIgEx->setChecked(false);

    cbIG_AVIOL->setChecked(true);
    cbInvPriv->setChecked(true);
    cbDivZero->setChecked(true);

    myMainWindow->qtNanomiteDisAsColor->colorBP = "Red";
    myMainWindow->qtNanomiteDisAsColor->colorCall = "Green";
    myMainWindow->qtNanomiteDisAsColor->colorStack = "Dark green";
    myMainWindow->qtNanomiteDisAsColor->colorJump = "Blue";
    myMainWindow->qtNanomiteDisAsColor->colorMove = "Gray";
    myMainWindow->qtNanomiteDisAsColor->colorMath = "Magenta";

    comboBP->setCurrentIndex(2);
    comboCall->setCurrentIndex(3);
    comboJump->setCurrentIndex(5);
    comboMove->setCurrentIndex(13);
    comboStack->setCurrentIndex(4);
    comboMath->setCurrentIndex(9);

    clsHelperClass::WriteToSettingsFile(myMainWindow->coreDebugger,myMainWindow->qtNanomiteDisAsColor);

    OnLoad();
}
Пример #17
0
uint32 PlayerNodeGoto::EngineMessageFn( uint32 dwMsgId, void *pData, float fData )
{
	switch( dwMsgId )
	{
		case MID_PRECREATE:
		{
			// Let the GameBase handle the message first...
			uint32 dwRet = GameBase::EngineMessageFn( dwMsgId, pData, fData );

			ObjectCreateStruct	*pOCS = (ObjectCreateStruct*)pData;

			if( pOCS && (PRECREATE_SAVEGAME != fData) )
			{
				ReadProps( &pOCS->m_cProperties );
			}

			// Important!! - We already sent the message to the GameBase so DONT do it again.
			return dwRet;
		}
		break;

		case MID_OBJECTCREATED:
		{
			// Make sure the object is sent to the clients but never update on the server...
			g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, FLAG_FORCECLIENTUPDATE, FLAG_FORCECLIENTUPDATE );
			SetNextUpdate( UPDATE_NEVER );
		}
		break;

		case MID_SAVEOBJECT:
		{
			OnSave( (ILTMessage_Write*)pData, (uint32)fData );
		}
		break;

		case MID_LOADOBJECT:
		{
			OnLoad( (ILTMessage_Read*)pData, (uint32)fData );
		}
		break;
	}

	return GameBase::EngineMessageFn( dwMsgId, pData, fData );
}
Пример #18
0
// From the ImageListener interface
void HEListElm::OnPortionDecoded()
{
	if (OpStatus::IsMemoryError(OnLoad()))
		if (doc->GetWindow())
			doc->GetWindow()->RaiseCondition(OpStatus::ERR_NO_MEMORY);
		else
			g_memory_manager->RaiseCondition(OpStatus::ERR_NO_MEMORY);

	if (GetImageVisible())
	{
		if (url_imagecontent_provider)
		{
			Image image = url_imagecontent_provider->GetImage();
			if (image.IsAnimated() && !animation_handler)
				animation_handler = ImageAnimationHandler::GetImageAnimationHandler(this, doc, syncronize_animation);

			// If image.IsAnimated is TRUE we know that the second frame
			// is being decoded. We don't want to make unnecessary updates
			// when the following frames are decoded.
			if (!image.IsAnimated() ||
				image_last_decoded_height != image.GetLastDecodedLine())
				Update(image);
		}
		if (animation_handler)
			animation_handler->OnPortionDecoded(this);
	}
#ifdef REMOVE_IRRELEVANT_IMAGES
	if (!signaled_irrelevant && url_imagecontent_provider &&
		// We can't let this signal to layout if we are traversing or reflowing.
		!doc->IsReflowing() &&
		!doc->GetVisualDevice()->IsPainting())
	{
		Image image = url_imagecontent_provider->GetImage();
		if (!image.IsContentRelevant() && GetElm()->GetLayoutBox())
		{
			signaled_irrelevant = TRUE;
			if (GetElm()->GetLayoutBox())
				GetElm()->GetLayoutBox()->SignalChange(doc);
		}
	}
#endif
}
Пример #19
0
qtDLGOption::qtDLGOption(QWidget *parent, Qt::WFlags flags)
    : QDialog(parent, flags)
{
    setupUi(this);
    this->setFixedSize(this->width(),this->height());
    this->setStyleSheet("background: rgb(230, 235, 230)");
    //this->setAttribute(Qt::WA_DeleteOnClose,true);

    tblCustomExceptions->insertRow(tblCustomExceptions->rowCount());
    tblCustomExceptions->setItem(tblCustomExceptions->rowCount() - 1,0,new QTableWidgetItem(""));
    tblCustomExceptions->setItem(tblCustomExceptions->rowCount() - 1,1,new QTableWidgetItem(""));

    OnLoad();

    // Events for the GUI
    connect(tblCustomExceptions,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(OnRightClickCustomException(const QPoint &)));
    connect(btnClose,SIGNAL(clicked()),this,SLOT(OnClose()));
    connect(btnReload,SIGNAL(clicked()),this,SLOT(OnReload()));
    connect(btnSave,SIGNAL(clicked()),this,SLOT(OnSave()));
}
Пример #20
0
qtDLGOption::qtDLGOption(QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	setupUi(this);
	this->setFixedSize(this->width(),this->height());
	tblCustomExceptions->horizontalHeader()->setFixedHeight(21);

	m_pMainWindow = qtDLGNanomite::GetInstance();
	m_pSettings = clsAppSettings::SharedInstance();

#ifdef _AMD64_
	lblCurrentJIT->setText("x64");
	lblCurrentJITWOW64->setText("x86");
	lblDefaultJIT->setText("x64");
	lblDefaultJITWOW64->setText("x86");

#else
	lblCurrentJIT->setText("x86");
	lblCurrentJITWOW64->setText("x86");
	lblDefaultJIT->setText("x86");
	lblDefaultJITWOW64->setText("x86");

	lineCurrentWOW64->setEnabled(false);
	lineOrgWOW64->setEnabled(false);
#endif

	OnLoad();

	// Events for the GUI
	connect(cbLoadSym, SIGNAL(stateChanged(int)), this, SLOT(SetUseSym(int)));
	connect(cbMSSym, SIGNAL(stateChanged(int)), this, SLOT(OnMSSymWarning(int)));
	connect(tblCustomExceptions,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(OnRightClickCustomException(const QPoint &)));
	connect(btnClose,SIGNAL(clicked()),this,SLOT(OnClose()));
	connect(btnReload,SIGNAL(clicked()),this,SLOT(OnReload()));
	connect(btnSave,SIGNAL(clicked()),this,SLOT(OnSave()));
	connect(pbSetNanomite,SIGNAL(clicked()),this,SLOT(OnSetNanomiteDefault()));
	connect(pbRestoreOrg,SIGNAL(clicked()),this,SLOT(OnRestoreOrg()));
	connect(bpRegisterNDB,SIGNAL(clicked()),this,SLOT(EnableNDBExtension()));
	connect(bpUnregisterNDB,SIGNAL(clicked()),this,SLOT(DisableNDBExtension()));
	connect(new QShortcut(QKeySequence(QKeySequence::Delete),this),SIGNAL(activated()),this,SLOT(OnExceptionRemove()));
}
Пример #21
0
	HWND OutputWindow::GetHandle()
	{
		if (!_hWindow)
		{
			HINSTANCE hInst = ::GetModuleHandle(NULL);

			WNDCLASSEX wc;
			memset(&wc, 0, sizeof(wc));
			wc.cbSize = sizeof(wc);
			wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
			wc.lpfnWndProc = OutputWindowProc;
			wc.hInstance = hInst;
			wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
			wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
			wc.lpszClassName = OW_CLASS_NAME;

			if (!::RegisterClassEx(&wc))
			{
				throw gcnew NppException(String::Format("Failed to register output window class: {0}", GetLastErrorClrString()));
				return NULL;
			}

			_hWindow = ::CreateWindowEx(WS_EX_CLIENTEDGE, OW_CLASS_NAME, OW_TITLE,
				WS_CHILD | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
				_hNpp, NULL, hInst, NULL);
			if (!_hWindow)
			{
				throw gcnew NppException(String::Format("Failed to create output window: {0}", GetLastErrorClrString()));
				return NULL;
			}

			::SetWindowLongPtr(_hWindow, GWLP_USERDATA, (LONG_PTR)this);

			OnLoad();
		}

		return _hWindow;
	}
Пример #22
0
bool Game::LoadContent()
{
    ///TEXTURES

    Map1.Tileset_Image = OnLoad(Renderer, "./Resources/Images/iso64x64.png");

    Map1.Hover_Image = OnLoad(Renderer, "./Resources/Images/HoverImage.png");

    Map2.Tileset_Image = OnLoad(Renderer, "./Resources/Images/iso64x64.png");

    Map2.Hover_Image = OnLoad(Renderer, "./Resources/Images/HoverImage.png");

    Map3.Tileset_Image = OnLoad(Renderer, "./Resources/Images/iso64x64.png");

    Map3.Hover_Image = OnLoad(Renderer, "./Resources/Images/HoverImage.png");

    Character.Image = OnLoad(Renderer, "./Resources/Images/SIdle1.png");

    if(!Idle[0].Load(Renderer, "./Resources/Images/SIdle1.png", 50, 100, 80)) return false;
    if(!Idle[1].Load(Renderer, "./Resources/Images/SIdle2.png", 50, 100, 80)) return false;
    if(!Idle[2].Load(Renderer, "./Resources/Images/SIdle3.png", 50, 100, 80)) return false;
    if(!Idle[3].Load(Renderer, "./Resources/Images/SIdle4.png", 50, 100, 80)) return false;
    if(!Idle[4].Load(Renderer, "./Resources/Images/SIdle5.png", 50, 100, 80)) return false;
    if(!Idle[5].Load(Renderer, "./Resources/Images/SIdle6.png", 50, 100, 80)) return false;
    if(!Idle[6].Load(Renderer, "./Resources/Images/SIdle7.png", 50, 100, 80)) return false;
    if(!Idle[7].Load(Renderer, "./Resources/Images/SIdle8.png", 50, 100, 80)) return false;

    if(Map1.Hover_Image == NULL)
    {
        return false;
    }

    if(Map1.Tileset_Image == NULL)
    {
        return false;
    }

    if(Map2.Hover_Image == NULL)
    {
        return false;
    }

    if(Map2.Tileset_Image == NULL)
    {
        return false;
    }

    if(Map3.Hover_Image == NULL)
    {
        return false;
    }

    if(Map3.Tileset_Image == NULL)
    {
        return false;
    }



    if(Character.Image == NULL)
    {
        return false;
    }

    SDL_SetTextureAlphaMod(Map1.Hover_Image, 100);

    ///MAPS

    Map1.loadMap.open("./Resources/Maps/layer1.map");

    if(Map1.LoadTileSet(0) == false)
    {
        cout<<"Map not loaded"<<endl;
        Sleep(1000);
        return false;
    }

    Map2.loadMap.open("./Resources/Maps/layer2.map");

    if(Map2.LoadTileSet(1) == false)
    {
        cout<<"Map not loaded"<<endl;
        Sleep(1000);
        return false;
    }

    Map3.loadMap.open("./Resources/Maps/layer3.map");

    if(Map3.LoadTileSet(2) == false)
    {
        cout<<"Map not loaded"<<endl;
        Sleep(1000);
        return false;
    }

    return true;
}
Пример #23
0
void View::SetWindowHandle(HWND hWnd)
{
	_hWnd = hWnd;
	OnLoad();
}
Пример #24
0
uint32 SpecialFX::EngineMessageFn(uint32 messageID, void *pData, float fData)
{
	switch (messageID)
	{
		case MID_PRECREATE :
		{
			uint32 dwRet = GameBase::EngineMessageFn(messageID, pData, fData);

			ObjectCreateStruct *pOcs = (ObjectCreateStruct *)pData;

			if ((uint32)fData == PRECREATE_WORLDFILE || (uint32)fData == PRECREATE_STRINGPROP)
			{
				// Read in object properties

				ReadProps(pOcs);
			}
			
			return dwRet;
		}
		break;
		
		case MID_INITIALUPDATE :
		{
			m_bFromSavedGame = ((uint32)fData == INITIALUPDATE_SAVEGAME);
			if ( !m_bFromSavedGame )
			{
				SetNextUpdate(UPDATE_NEVER);
			}
		}
		break;

		case MID_ALLOBJECTSCREATED :
		{
			if( !m_bFromSavedGame )
			{

				// See if we have a Target object...

				if( m_hstrTargetName )
				{
					ObjArray<HOBJECT, 1> objArray;
					g_pLTServer->FindNamedObjects( g_pLTServer->GetStringData( m_hstrTargetName ), objArray );

					if( objArray.NumObjects() > 0 )
					{
						m_hTargetObj = objArray.GetObject( 0 );
					}

					FREE_HSTRING( m_hstrTargetName );
				}

				if (m_bStartOn)
				{
					TurnON();
				}
			}
		}
		break;

		case MID_SAVEOBJECT :
		{			
			// Handle saving

			GameBase::EngineMessageFn(messageID, pData, fData);	
			OnSave((ILTMessage_Write*)pData, (uint32)fData);
			return LT_OK;
		}
		break;

		case MID_LOADOBJECT :
		{
			// Handle loading
			
			GameBase::EngineMessageFn(messageID, pData, fData);
			OnLoad((ILTMessage_Read*)pData, (uint32)fData);
			return LT_OK;
		}
		break;
	}

	return GameBase::EngineMessageFn(messageID, pData, fData);
}
Пример #25
0
	void AIUpdate()
	{
		if(_unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
			OnLoad();
	}
Пример #26
0
uint32 WorldModel::EngineMessageFn( uint32 messageID, void *pData, LTFLOAT fData )
{
	switch( messageID )
	{
		case MID_PRECREATE:
		{
			// Let the GameBase handle the message first

			uint32 dwRet = GameBase::EngineMessageFn( messageID, pData, fData );

			ObjectCreateStruct	*pOCS = (ObjectCreateStruct*)pData;

			if( pOCS )
			{
				if( PRECREATE_WORLDFILE == fData )
				{
// tagRP: HACK - Save off the rotation then get rid of it to deal with the double rotation problem
					m_hackInitialRot = pOCS->m_Rotation;
					pOCS->m_Rotation.Identity();
// end HACK
					ReadProps( pOCS );
				}

				if( PRECREATE_SAVEGAME != fData )
				{
					// Init some data if it's not a saved game

					PostReadProp( pOCS );
				}
	
			}

			// Important!! - We already sent the message to the GameBase so DONT do it again.

			return dwRet;
		}
		break;

		case MID_OBJECTCREATED:
		{
			if( OBJECTCREATED_SAVEGAME != fData )
			{
				OnObjectCreated();
			}
		}
		break;

		case MID_ALLOBJECTSCREATED:
		{
			OnEveryObjectCreated();
		}
		break;

		case MID_UPDATE:
		{
			OnUpdate( g_pLTServer->GetTime() );
		}
		break;

		case MID_SAVEOBJECT:
		{
			OnSave( (ILTMessage_Write*)pData, (uint32)fData );
		}
		break;

		case MID_LOADOBJECT:
		{
			OnLoad( (ILTMessage_Read*)pData, (uint32)fData );
		}
		break;
	}

	return GameBase::EngineMessageFn( messageID, pData, fData );
}
Пример #27
0
 void AIUpdate() override
 {
     if(getCreature()->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
         OnLoad();
 }
Пример #28
0
jobject CORBA::jni::Object::toJObject (CORBA::Object_ptr in, JNIEnv* env)
{
    OnLoad(env);
    jlong ref = reinterpret_cast<jlong>(CORBA::Object::_duplicate(in));
    return env->NewObject(cls_, ctor_, ref);
}
Пример #29
0
// loads the plugin ( pluginPath ) in the bot state ( bot ).
int BotLoadPlugin( botState *bot, char* pluginName ) {
    
	int	pluginId = -1;
	for ( int i = 0; i < MAX_PLUGINS; i++ ) {
		if ( bot->pluginStates[i] == NULL ) {
			pluginId = i;
			break;
		}
	}

	if ( pluginId == -1 ) {
		printf( "can't load any more plugins\n" );
		return 0;
	}

	printf( "pluginID: %i\n", pluginId );

    lua_State *L = bot->pluginStates[pluginId] = lua_open();
   

   	assert( L != NULL );

    // create relative path for plugin
    char *pluginPath = alloca( strlen( PLUGIN_PATH ) + strlen( pluginName ) );
    sprintf( pluginPath, "%s%s", PLUGIN_PATH, pluginName );

    // copy plugin name to mem
    bot->pluginNames[pluginId] = malloc( strlen( pluginName ) + 1 );
    strcpy( bot->pluginNames[pluginId], pluginName );
    
    // load a new lua state
    luaL_openlibs( L );
    int loadStatus = luaL_loadfile( L, pluginPath );

    // some error checking
    switch( loadStatus ) {
        case LUA_ERRFILE:
            printf( "couldn't open %s.", pluginPath );
            return 0;
        case LUA_ERRMEM:
            printf( "memory error in %s.", pluginPath );
            return 0;
        case LUA_ERRSYNTAX:
            printf( "syntax error in %s.", pluginPath );
            lua_error( L );
            return 0;
        case 0: // success
            printf( "successfully loaded %s", pluginPath );
            break;
        default:
            printf( "unknown error %i in %s", loadStatus, pluginPath );
    }

    // this is the plugins ptr to the bot in which it sits in.
    lua_pushlightuserdata( L, bot );
    lua_setglobal( L, "botptr" );

    // let lua know about some functions
    BotGiveEvents( bot, pluginId );

    lua_pcall( L, 0, 0, 0 );
   
    OnLoad( bot, pluginId ); // let plugin know it's been loaded!
    
    bot->pluginCount++;

    return 1;
}
Пример #30
0
 static bool isInstance (JNIEnv* env, jobject obj) {
     OnLoad(env);
     return env->IsInstanceOf(obj, cls_);
 }