⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chanimod.cpp

📁 Windows上的MUD客户端程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
												a file */
											// !!!!!!!!!!!!
	#if 0
	{
		ChImageMsg*					pMsg = (ChImageMsg*)&msg;
		string						strURL;
		ChAnimBackgroundHTTPReq*	pHTTPReq

		pMsg->GetParams( strURL );
		pHTTPReq = new ChAnimBackgroundHTTPReq ( pInfo->GetView(), strURL );

		//boolSuccess =
		// "http://www.chaco.com/pueblo/ChAnim/msw32/snow.bmp"

		pInfo->GetHTTPConn()->GetURL( strURL, (chparam)pHTTPReq );
		pInfo->SetLeafDependent( pHTTPReq );
	}
	#endif

	return 0;
}

CH_IMPLEMENT_MESSAGE_HANDLER( animatorLoadCastHandler )
{
	ChAnimMainInfo*	pInfo = (ChAnimMainInfo*)pMainInfo;
	// for now, assumes sprite URL is just a file
	// !!!!!!!!!!!!
	//ChArchive	archive( pMsg, modeRead );

	ChCastMsg *pMsg = (ChCastMsg *)&msg;

#if 0 // oblsoete forms
	if(pMsg->GetType() == ChCastMsg::direct)
	{
		ChAnimCastMember *pChar = new ChAnimCastMember;
  		CPhasedSprite* pSprite;

		pChar->InitFromMsg( pMsg );

		if(!pChar->GetScriptCells())
		{
			//boolSuccess = GetHTTPConn()->GetURL( pChar->GetScriptURL(), (chparam)pHTTPCharReq );
		}

		//ChGraphicHTTPReq *pHTTPReq = new ChGraphicHTTPReq ( ChGraphicHTTPReq::script, pChar );
		//boolSuccess =
		// "http://www.chaco.com/pueblo/ChText/msw32/ChText.dll"
		//pInfo->GetHTTPConn()->GetURL( pChar->GetSpriteURL(), (chparam)pHTTPReq );
												// following needs to get changed when we go asynch
		string strSpriteURL = pChar->GetSpriteURL();
		pSprite = pChar->GetSprite();
		int iNumSpriteRows = pSprite->GetNumCellRows();	   // retain the grid, it gets
		int iNumSpriteCols = pSprite->GetNumCellColumns();// wiped out by pSprite->Initialize
		pSprite->Load( (char *)(LPCTSTR(strSpriteURL)));
		pSprite->Initialize();
		pSprite->SetNumCellRows(iNumSpriteRows);		   // restore grid
		pSprite->SetNumCellColumns(iNumSpriteCols);
		pChar->SetSprite(pSprite);

		pInfo->GetView()->AddCharacter(pChar); // AddCharacter consumes pChar
	}
	else if(pMsg->GetType() == ChCastMsg::url)
	{
		string strURL;
		pMsg->GetParams( strURL );

		ChAnimCastHTTPReq *pHTTPReq = new ChAnimCastHTTPReq ( pInfo->GetView(), strURL );
		if (pInfo->GetRootDependent())
		{
			pInfo->GetRootDependent()->Add(pHTTPReq);
		}


		pInfo->GetHTTPConn()->GetURL( strURL, (chparam)pHTTPReq );
	}
	else
	#endif // obsolete forms

	if(pMsg->GetType() == ChCastMsg::remove)
	{
		chuint32 luId;
		pMsg->GetParams( luId );
		pInfo->GetView()->DeleteCharacter(luId);
	}

	return 0;
}

CH_IMPLEMENT_MESSAGE_HANDLER( animatorLoadAnchorHandler )
{
	ChAnimMainInfo*	pInfo = (ChAnimMainInfo*)pMainInfo;
	ChAnchorMsg*	pMsg = (ChAnchorMsg*)&msg;

	switch ( pMsg->GetType() )
	{
		case ChAnchorMsg::direct_rect:
		{
			ChAnimAnchor*	pAnchor = new ChAnimAnchor;

			pMsg->GetParams( pAnchor->m_id, pAnchor->m_rcHot,
								pAnchor->m_strCmdArg, pAnchor->m_strHint,
								pAnchor->m_cursor );
			pInfo->GetView()->AddAnchor( pAnchor );
			break;
		}

		case ChAnchorMsg::url:
		{
			string					strURL;
			ChAnimAnchorHTTPReq*	pHTTPReq;

			pMsg->GetParams( strURL );
			pHTTPReq = new ChAnimAnchorHTTPReq ( pInfo->GetView(), strURL );
			pInfo->GetCore()->GetURL( strURL, 0, pInfo->GetStream(), (chparam)pHTTPReq );
			break;
		}

		case ChAnchorMsg::direct_cast:
		{
			ChAnimAnchor*	pAnchor = new ChAnimAnchor;
			pMsg->GetParams( pAnchor->m_id, pAnchor->m_hotCastId,
								pAnchor->m_strCmdArg, pAnchor->m_strHint,
								pAnchor->m_cursor );
			pInfo->GetView()->AddAnchor( pAnchor );
			break;
		}

		case ChAnchorMsg::remove:
		{
			chuint32	id;

			pMsg->GetParams(id );
			if (id)
			{
				pInfo->GetView()->DeleteAnchor( id );
			}
			else
			{
				pInfo->GetView()->DeleteAnchors();
			}
			break;
		}

		default:
		{
			break;
		}
	}

	return 0;
}

CH_IMPLEMENT_MESSAGE_HANDLER( animatorLoadSceneHandler )
{
	ChAnimMainInfo*	pInfo = (ChAnimMainInfo*)pMainInfo;
	ChSceneMsg *pMsg = (ChSceneMsg *)&msg;

	string strURL;
	string strFilename;					// TODO ???????? !!!!!!!!! Replace this with pane version
	string strType;
	bool	boolNew;
	pMsg->GetParams(strURL, strFilename, strType, boolNew);
	//if(!strURL.IsEmpty() || !strFilename.IsEmpty())
	{

		#pragma message ("Animation scene loading not done")
		//ChAnimSceneHTTPReq *pHTTPReq = new ChAnimSceneHTTPReq ( pInfo->GetView(), strURL );


		// Need to switch on mime type, create appropriate httpreq, then load the file
		//typeText, typeHTML, typeGIF, typeMidi, typeWave, typeJPEG,
							//	typeVRML,	typeBMP
	 	ChHTTPConn::tagMimeTypes type = (ChHTTPConn::tagMimeTypes)ChHTTPConn::GetMimeType(strType);
		switch(type)
		{
			case ChHTTPConn::typeGIF :
			{
												// Load the background
	 			ChAnimBackgroundHTTPReq req(pInfo->GetView(), strURL);
				pInfo->SetLeafDependent(&req);
				pInfo->ShowModule(true);
				pInfo->GetView()->Invalidate(true);
				pInfo->GetView()->LoadBackgroundGIF(strFilename);
				pInfo->GetView()->UpdateWindow();
				pInfo->SetLeafDependent(0);
				break;
			}
			case ChHTTPConn::typeJPEG :
			{
												// Load the background
	 			ChAnimBackgroundHTTPReq req(pInfo->GetView(), strURL);
				pInfo->SetLeafDependent(&req);
				pInfo->ShowModule(true);
				pInfo->GetView()->Invalidate(true);
				pInfo->GetView()->LoadBackgroundJPEG(strFilename);
				pInfo->GetView()->UpdateWindow();
				pInfo->SetLeafDependent(0);
				break;
			}
			case ChHTTPConn::typeBMP :
			{
												// Load the background
	 			ChAnimBackgroundHTTPReq req(pInfo->GetView(), strURL);
				pInfo->SetLeafDependent(&req);
				pInfo->ShowModule(true);
				pInfo->GetView()->Invalidate(true);
				pInfo->GetView()->LoadBackground(strFilename);
				pInfo->GetView()->UpdateWindow();
				pInfo->SetLeafDependent(0);
				break;
			}
			case ChHTTPConn::typeText :
			{
				// assume it's an animation file??
				ChAnimSceneHTTPReq *pHTTPReq = new ChAnimSceneHTTPReq ( pInfo->GetView(), strURL );
				break;
			}
			default:
			{
				break;
			}
		}
		#if 0
		ChAnimSceneHTTPReq *pHTTPReq = new ChAnimSceneHTTPReq ( pInfo->GetView(), strURL );

		pInfo->GetHTTPConn()->GetURL( strURL, (chparam)pHTTPReq );
		//////////////
		if(boolNew)
		{
			pInfo->SetLeafDependent(pHTTPReq);
		}
		else
		{
			if (pInfo->GetRootDependent())
			{
				pInfo->GetRootDependent()->Add(pHTTPReq);
			}
		}
		#endif
	}
	return 0;
}


CH_IMPLEMENT_MESSAGE_HANDLER( animatorPlayGraphicHandler )
{
	ChAnimMainInfo*			pInfo = (ChAnimMainInfo*)pMainInfo;
	ChPlayGraphicMsg*		pMsg = (ChPlayGraphicMsg*)&msg;
	chuint32				luId = 0;
	bool					boolPlay = true;
	ChPlayGraphicMsg::type	when;

	pMsg->GetParams( luId, boolPlay, when );
	if (!luId)
	{
		switch( when )
		{
			case ChPlayGraphicMsg::immediate:
			{
				pInfo->GetView()->Animate( boolPlay );
				break;
			}
			case ChPlayGraphicMsg::on_load_complete:
			{
				pInfo->GetRootDependent()->SetStartAnimating( boolPlay );
				break;
			}
		}
	}
	else
	{
		pInfo->GetView()->AnimateCharacter( luId, boolPlay );
	}

	return 0;
}


CH_IMPLEMENT_MESSAGE_HANDLER( animatorShowCastHandler )
{
	ChAnimMainInfo*	pInfo = (ChAnimMainInfo*)pMainInfo;
	ChShowCastMsg*	pMsg = (ChShowCastMsg*)&msg;
	bool			boolShow = true;
	chuint32		luId;

	pMsg->GetParams( luId, boolShow );
	pInfo->GetView()->ShowCharacter( luId, boolShow );

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -