예제 #1
0
void KG3DScenePvsEditor::OnCommand(enumCommandType eCommandType)
{
    switch(eCommandType)
    {		
    case ctInc: //放大缩小当前的笔刷一格			
        ExecAction(EXEACTION_INNER_CIRCLE, 1, 0, MAKELPARAM(g_nMouseMoveX+1, g_nMouseMoveY+1));
        break;
    case ctDec:
        ExecAction(EXEACTION_INNER_CIRCLE, 1, 0, MAKELPARAM(g_nMouseMoveX-1, g_nMouseMoveY-1));
        break;
    case ctHideObject: //隐藏物件
        g_cEngineManager.GetRenderOption( RENDER_ENTITY ) ? g_cEngineManager.SetRenderOption( RENDER_ENTITY ,FALSE) : g_cEngineManager.SetRenderOption( RENDER_ENTITY ,TRUE);
        break;
    case ctHideTerrain://隐藏地表
        g_cEngineManager.GetRenderOption( RENDER_TERRAIN ) ? g_cEngineManager.SetRenderOption( RENDER_TERRAIN ,FALSE) : g_cEngineManager.SetRenderOption( RENDER_TERRAIN ,TRUE);
        break;
    case ctHideGrass:  //隐藏草
        g_cEngineManager.GetRenderOption( RENDER_GRASS ) ? g_cEngineManager.SetRenderOption( RENDER_GRASS ,FALSE) : g_cEngineManager.SetRenderOption( RENDER_GRASS ,TRUE);
		break;
    case ctHideTree:  //隐藏树叶
        g_cEngineManager.GetRenderOption( RENDER_TREE ) ? g_cEngineManager.SetRenderOption( RENDER_TREE ,FALSE) : g_cEngineManager.SetRenderOption( RENDER_TREE ,TRUE);
        break;
    case ctHideNPCAttackRange://隐藏NPC攻击范围
        {
			TypeEntityAccessProxy& proxy = this->GetSelectionTool().GetSelectionAccessProxy();


            //KG3DSceneEntityList::iterator i = m_listSelectedEntity.begin();
            //while(i!=m_listSelectedEntity.end())

			for(proxy.Begin(); ! proxy.IsEnd(); proxy.StepForward())
            {
                //KG3DSceneEntity Entity = *i;
				KG3DSceneEntity Entity = proxy.GetCur();

                if(Entity.GetType() == SCENEENTITY_OBJECT)
                {
                    KG3DRepresentObject* pObject = (KG3DRepresentObject* ) Entity.m_pPointer;
                    if(pObject->GetType() == REPRESENTOBJECT_NPC)
                    {
                        FireEvent2(EVENTEDITORNPCHIDEATTACKRANGE,0,0,pObject);
                    }
                }
                //i++;
            }
        }
        break;
    case ctEnd:    //P模式时,复位摄像机到后面
        break;
    default:
        KG3DSceneEditorBase::OnCommand(eCommandType);
        break;
    }
}
/* Method is called for every feedback that is received by feedback_Struct Pin;
 *   Implements the general structure and calls necessary functions for processing */
tResult StateControlManagementSlim::ProcessData(TFeedbackStruct::Data feedback)
{
	/* HANDLING OF SPONTANEOUS INTERRUPTIONS BY JURY -> action_STOP signal sent! has to be treated in every mode */
	if(feedback.ui32_status == FB_JURY_COMMAND_RECEIVED_STOP){
		LOG_WARNING(cString::Format("SCM: Interrupted via action_STOP signal from jury! System will be set to startup mode."));
		#ifdef WRITE_DEBUG_OUTPUT_TO_FILE
		scm_logfile << std::endl << "### --- " << std::endl << "SCM: Interrupted via action_STOP signal from jury! System will be set to startup mode." << std::endl;
		#endif
		/* set SCM to startup maneuver, as it can be started again from this position via action_START from jury */
		JumpToManeuver(0);
		ChangeCurrentActivityLvlMode(ACTIVE);
		if(m_bDebugModeEnabled) LOG_WARNING(cString::Format("SCM: Set to current ScmManeuverID %d, step %d, actLvl %d",i16CurrentScmManeuverID,i16CurrentScmStepID,CheckCurrentActivityLvlMode()));
		#ifdef WRITE_DEBUG_OUTPUT_TO_FILE
		scm_logfile << "SCM: Set to current ScmManeuverID: " << i16CurrentScmManeuverID << ", step: "<< i16CurrentScmStepID << ", actLvl: ACTIVE"<< std::endl <<"### --- " << std::endl;
		#endif
		ExecAction();
		/* all filters will be disabled in this way, except of JCom, which sends alive-signal;
		 *  afterwards, system is reset to beginning of current sector, is in CarState startup mode and
		 *  waiting for new Start-Signal from jury */
		RETURN_NOERROR;
	}

	/* regular, normal behaviour without interruptions by action_STOP */

	// check if current activity level is passive, so feedback is requested
	if(CheckCurrentActivityLvlMode() == ACTIVE){
		LOG_WARNING(cString::Format("SCM: System is in ACTIVE mode, but input registered: ID %d, status %d. Input will not be processed.",feedback.ui32_filterID,feedback.ui32_status));
	}else if(CheckCurrentActivityLvlMode() == PASSIVE){
		if(m_bDebugModeEnabled) LOG_WARNING(cString::Format("SCM: In PASSIVE mode, Input registered: ID %d, status %d. Input will be checked for relevance.",feedback.ui32_filterID,feedback.ui32_status));

		// check if input status is relevant to current SCM-State, return command that should be executed
		tUInt32 scmStep_command = CheckRequestRelevance(feedback);
		// check if command was relevant and successfully decoded
		if (scmStep_command == 0){
			if(m_bDebugModeEnabled) LOG_WARNING(cString::Format("SCM: Feedback status was not in list, thus will be ignored!"));
			#ifdef WRITE_DEBUG_OUTPUT_TO_FILE
			scm_logfile << "SCM: Feedback status was not in list, thus will be ignored!" << std::endl;
			#endif
		}else{
			// corresponding command will be executed
			if(m_bDebugModeEnabled) LOG_WARNING(cString::Format("SCM: Feedback relevant, status will be processed."));
			#ifdef WRITE_DEBUG_OUTPUT_TO_FILE
			scm_logfile << "SCM: Feedback relevant, status will be processed." << std::endl << "---" << std::endl;
			#endif
			tResult tmpReturn = ExecRequest(scmStep_command);
			// check if ExecRequest was successful
			if(tmpReturn < 0){
				#ifdef WRITE_DEBUG_OUTPUT_TO_FILE
				scm_logfile << std::endl << "### --- " << std::endl << "SCM ERROR: ERROR occurred in ExecRequest!" << std::endl;
				#endif
				RETURN_AND_LOG_ERROR_STR(ERR_INVALID_ADDRESS,cString::Format("SCM: ERROR occurred in ExecRequest!"));
			}else{
				/* Change current activity level mode to ACTIVE, as passive command has been successfully executed*/
				ChangeCurrentActivityLvlMode(ACTIVE);
				ExecAction();
			}
		}

	}else{ // NOT_INITIALIZED or error occurred

		RETURN_AND_LOG_ERROR_STR(ERR_INVALID_STATE, cString::Format("SCM: ERROR occurred!"));
	}

	RETURN_NOERROR;
}
예제 #3
0
파일: main.cpp 프로젝트: leiqunni/v2iewx
// ---------------------------------------------------------------------------
//
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) {
	String code;
	code = code.sprintf(L"%1x%02x", Shift.ToInt(), Key);
	ExecAction(KeyConf->ReadString(L"key", code, NULL).LowerCase());
	// Key = NULL;
}