コード例 #1
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLTDialogueWnd::ShowDecisions
//
//	PURPOSE:	Shows the decisions
//
// ----------------------------------------------------------------------- //
BOOL CLTDialogueWnd::ShowDecisions()
{
	// If we have decisions to make, do them now
	m_bDecisions = FALSE;
	if(!m_csDecisions.IsEmpty())
	{
        ILTCommon* pCommon = g_pLTClient->Common();
		if (!pCommon)
		{
			return FALSE;
		}

		ConParse parse;
		parse.Init((char *)(LPCSTR)m_csDecisions);

		m_collDialogueIDs.RemoveAll();
		CStringArray collDecisions;
		DWORD dwID;
		while (pCommon->Parse(&parse) == LT_OK)
		{
			if (parse.m_nArgs > 0 && parse.m_Args[0])
			{
				dwID = atoi(parse.m_Args[0]);
				DWORD dwTranslatedID = dwID;
                HSTRING hString=g_pLTClient->FormatString(dwTranslatedID);
				if(!hString)
				{
					return FALSE;
				}
				m_collDialogueIDs.Add(dwID);
                collDecisions.Add(g_pLTClient->GetStringData(hString));
                g_pLTClient->FreeString(hString);
			}
		}

		if(collDecisions.GetSize() <= 0)
		{
			return FALSE;
		}

		if(m_DecisionWnd.DisplayText(&collDecisions,this,TRUE))
		{
			// If we immediatelly displayed the decisions, let the server
			// finish talking...

			if (!m_bImmediateDecisions)
			{
				// Tell the server to stop speaking
				HMESSAGEWRITE hMessage;
                hMessage = g_pLTClient->StartMessage(CSM_DIALOGUE_STOP);
                g_pLTClient->EndMessage(hMessage);
			}

			m_bEnabled = FALSE;
			m_bDecisions = TRUE;
			return TRUE;
		}
	}
	return FALSE;
}
コード例 #2
0
void RotatingWorldModel::FirstUpdate()
{
	ConParse cParse;
	LAInfo info;

	if (!m_bFirstUpdate) return;
	    m_bFirstUpdate = LTFALSE;

	// Init our light animations.
	if(m_hShadowLightsString)
	{
		char *pShadowLights = g_pLTServer->GetStringData(m_hShadowLightsString);
		if (!pShadowLights)
			return;

		const char *pObjectName = g_pLTServer->GetObjectName(m_hObject);

		char animName[256];

		ConParse cParse;

		cParse.Init(pShadowLights);
        while(g_pLTServer->Common()->Parse(&cParse) == LT_OK)
		{
			SetupRWMLightAnimName(animName, pObjectName, m_nLightAnims);

			m_hLightAnims[m_nLightAnims] = INVALID_LIGHT_ANIM;
            g_pLTServer->GetLightAnimLT()->FindLightAnim(animName, m_hLightAnims[m_nLightAnims]);
			m_nLightAnims++;

			if(m_nLightAnims >= MAX_RWM_LIGHT_ANIMS)
				break;
		}
	}
}
コード例 #3
0
void CinematicTrigger::SendReplyMessage(int nReply)
{
	if (m_nCurMessage >= MAX_CT_MESSAGES) return;

    ILTCommon* pCommon = g_pLTServer->Common();
	if (!pCommon) return;

	CString	csTarget;
	CString csMsg;
	ConParse parse;

    char* pMsg = g_pLTServer->GetStringData(m_hstrRepliesTarget[m_nCurMessage]);
	if(!pMsg) return;

	parse.Init(pMsg);

    int i;
    for(i=0;i<nReply;i++)
	{
		if(pCommon->Parse(&parse) == LT_OK)
		{
			if(i == (nReply - 1))
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					csTarget = parse.m_Args[0];
				}
				break;
			}
		}
	}

    pMsg = g_pLTServer->GetStringData(m_hstrRepliesMsg[m_nCurMessage]);
	if(!pMsg) return;

	parse.Init(pMsg);

	for(i=0;i<nReply;i++)
	{
		if(pCommon->Parse(&parse) == LT_OK)
		{
			if(i == (nReply - 1))
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					csMsg = parse.m_Args[0];
				}
				break;
			}
		}
	}

	if (!csTarget.IsEmpty() && !csMsg.IsEmpty())
	{
		SendTriggerMsgToObjects(this, (char *)(LPCSTR)csTarget, (char *)(LPCSTR)csMsg);
	}
}
コード例 #4
0
ファイル: DisplayMeter.cpp プロジェクト: Arc0re/lithtech
void DisplayMeter::TriggerMsg(HOBJECT hSender, const char *szMsg)
{
    ILTCommon* pCommon = g_pLTServer->Common();
	if (!pCommon) return;

	// ConParse does not destroy szMsg, so this is safe
	ConParse parse;
	parse.Init((char*)szMsg);

	while (pCommon->Parse(&parse) == LT_OK)
	{
		if (parse.m_nArgs > 0 && parse.m_Args[0])
		{
			if ((_stricmp(parse.m_Args[0], "show") == 0))
			{
				if (parse.m_nArgs > 1)
				{
                    HandleShow((uint8)atoi(parse.m_Args[1]));
				}
				else
					HandleShow(100);
			}
			else if (_stricmp(parse.m_Args[0], "plus") == 0)
			{
				if (parse.m_nArgs > 1)
				{
                    HandlePlus((uint8)atoi(parse.m_Args[1]));
				}
			}
			else if (_stricmp(parse.m_Args[0], "minus") == 0)
			{
				if (parse.m_nArgs > 1)
				{
                    HandleMinus((uint8)atoi(parse.m_Args[1]));
				}
			}
			else if (_stricmp(parse.m_Args[0], "set") == 0)
			{
				if (parse.m_nArgs > 1)
				{
                    HandleSet((uint8)atoi(parse.m_Args[1]));
				}
			}
			else if (_stricmp(parse.m_Args[0], "hide") == 0)
			{
				HandleEnd();
			}
		}
	}
}
コード例 #5
0
ファイル: LightGroup.cpp プロジェクト: emoose/lithtech
void LightGroup::HandleTrigger( HOBJECT hSender, ILTMessage_Read *pMsg )
{
	// MW-TODO Previously Readuint32
	const char* szMsg = (const char*)pMsg->Readuintptr();

	ConParse	cParse;
	cParse.Init(szMsg);
	while (g_pCommonLT->Parse(&cParse) == LT_OK)
	{
		if (_stricmp(cParse.m_Args[0], "TOGGLE") == 0)
		{
			// Toggle the flag
			m_bOn = !m_bOn;
		}
		else if (_stricmp(cParse.m_Args[0], "ON") == 0)
		{
			m_bOn = true;
		}
		else if (_stricmp(cParse.m_Args[0], "OFF") == 0)
		{
			m_bOn = false;
		}
		else if ((_stricmp(cParse.m_Args[0], "COLOR") == 0) && ((cParse.m_nArgs == 2) || (cParse.m_nArgs == 4)))
		{
			if (cParse.m_nArgs == 2)
			{
				float fValue = (float)atof(cParse.m_Args[1]) / 255.0f;
				m_vColor.Init(fValue, fValue, fValue);
			}
			else if (cParse.m_nArgs == 4)
			{
				float fValueR = (float)atof(cParse.m_Args[1]) / 255.0f;
				float fValueG = (float)atof(cParse.m_Args[2]) / 255.0f;
				float fValueB = (float)atof(cParse.m_Args[3]) / 255.0f;
				if (fValueR < 0.0f)
					fValueR = m_vColor.x;
				if (fValueG < 0.0f)
					fValueG = m_vColor.y;
				if (fValueB < 0.0f)
					fValueB = m_vColor.z;
				m_vColor.Init(fValueR, fValueG, fValueB);
			}
		}
	}

	// Tell the clients about the change
	UpdateClients();
}
コード例 #6
0
HOBJECT CinematicTrigger::FindWhoPlaysDecision(uint8 byDecision)
{
	char* pCharName = DEFAULT_PLAYERNAME;

	if (byDecision > 0)
	{
		char* pMsg = g_pLTServer->GetStringData(m_hstrWhoPlaysDecisions[m_nCurMessage]);
		if (pMsg)
		{
	 		ConParse parse;
			parse.Init(pMsg);

			// Since the names will be seperated by semi-colons we need
			// to parse until we get to the correct name...

			LTBOOL bFound = LTTRUE;
			for (int i=1; i <= byDecision; i++)
			{
				if (g_pLTServer->Common()->Parse(&parse) != LT_OK)
				{
					bFound = LTFALSE;
					break;
				}
			}

			// Parse should be on the correct name now...

			if (bFound && parse.m_nArgs > 0)
			{
				if (parse.m_Args[0])
				{
					pCharName = parse.m_Args[0];
				}
			}
		}
	}

	ObjArray <HOBJECT, MAX_OBJECT_ARRAY_SIZE> objArray;
    g_pLTServer->FindNamedObjects(pCharName, objArray);

	if (objArray.NumObjects())
	{
		return objArray.GetObject(0);
	}

	return LTNULL;
}
コード例 #7
0
uint32 Intelligence::ObjectMessageFn(HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead)
{
    if (!g_pLTServer) return 0;

	switch(messageID)
	{
		case MID_TRIGGER:
		{
			const char* szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead);

			// ConParse does not destroy szMsg, so this is safe
			ConParse parse;
			parse.Init((char*)szMsg);

            while (g_pLTServer->Common()->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					if (_stricmp(parse.m_Args[0], s_szActivate) == 0)
					{
						if (!m_bPhotoOnly)
						{
							DoActivate(hSender);
						}
					}
					else if (_stricmp(parse.m_Args[0], s_szGadget) == 0)
					{
						if (m_bPhotoOnly)
						{
							HandleGadgetMsg(hSender, parse);
						}
					}
					else if (_stricmp(parse.m_Args[0], s_szRespawn) == 0)
					{
						SetNextUpdate( m_fRespawnDelay / g_IntelRespawnScale.GetFloat(1.0f));
					}
				}
			}
		}
		break;

		default : break;
	}

	return Prop::ObjectMessageFn(hSender, messageID, hRead);
}
コード例 #8
0
uint32 CDestructibleModel::ObjectMessageFn(LPBASECLASS pObject, HOBJECT hSender, ILTMessage_Read *pMsg)
{
	uint32 dwRet = CDestructible::ObjectMessageFn(pObject, hSender, pMsg);

	pMsg->SeekTo(0);
	uint32 messageID = pMsg->Readuint32();
	switch(messageID)
	{
		case MID_DAMAGE:
		{
			if (IsDead() && !m_bCreatedDebris)
			{
                ILTServer* pServerDE = BaseClass::GetServerDE();
				if (!pServerDE) break;

				SpawnItem();
				CreateDebris();
				CreateWorldModelDebris();

				if (m_bCreateExplosion)
				{
					DoExplosion();
				}

				RegisterDestroyedStimulus();

				m_bCreatedDebris = LTTRUE;

				if (m_bRemoveOnDeath)
				{
					pServerDE->RemoveObject(m_hObject);
				}
			}
		}
		break;

		case MID_TRIGGER:
		{
			const char* szMsg = (const char*)pMsg->Readuint32();

			// ConParse does not destroy szMsg, so this is safe
			ConParse parse;
			parse.Init((char*)szMsg);

			while (g_pCommonLT->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					if (!IsDead())
					{
						if (_stricmp(parse.m_Args[0], "FIRE") == 0)
						{
							char* pTargetName = parse.m_nArgs > 1 ? parse.m_Args[1] : LTNULL;
							DoExplosion(pTargetName);
						}
						else if (_stricmp(parse.m_Args[0], "HIDDEN") == 0)
						{
							// Game Base will take care of the solid and visible flags for us...

							if (parse.m_nArgs > 1 && parse.m_Args[1])
							{
								if ((_stricmp(parse.m_Args[1], "1") == 0) ||
									(_stricmp(parse.m_Args[1], "TRUE") == 0))
								{
									m_bSaveCanDamage = GetCanDamage();
									m_bSaveNeverDestroy = GetNeverDestroy();

									SetCanDamage(LTFALSE);
									SetNeverDestroy(LTTRUE);
								}
								else
								{
									if ((_stricmp(parse.m_Args[1], "0") == 0) ||
										(_stricmp(parse.m_Args[1], "FALSE") == 0))
									{
										SetCanDamage(m_bSaveCanDamage);
										SetNeverDestroy(m_bSaveNeverDestroy);
									}
								}
							}
						}

					}
				}
			}
		}
		break;

		default : break;
	}

	return dwRet;
}
コード例 #9
0
ファイル: concommand.cpp プロジェクト: Joincheng/lithtech
void cc_HandleCommand3(ConsoleState *pState, const char *pCommand, uint32 flags, uint32 varFlags)
{
	int bNew, bChanged, bFound;
	LTCommandVar *pVar;
	LTLink *pCur;
	LTExtraCommandStruct *pExtraCommand;
	char tempNumString[50];
	int tempNum;
	char *pVarName, *pString;
	LTBOOL bForceNoSave;
	uint32 newFlags;
	ConParse parse;


	parse.Init(pCommand);
	while(parse.Parse())
	{
		if(parse.m_nArgs > 0)
		{
			// Forward the command to command structs.
			bFound = 0;

			if(!(flags & CC_NOCOMMANDS))
			{
				if(!bFound)
				{
					pCur = pState->m_ExtraCommands.m_pNext;
					while(pCur != &pState->m_ExtraCommands)
					{
						pExtraCommand = (LTExtraCommandStruct*)pCur->m_pData;

						if(cc_UpperStrcmp(pExtraCommand->pCmdName, parse.m_Args[0]))
						{
							pExtraCommand->fn(parse.m_nArgs-1, &parse.m_Args[1]);
							bFound = 1;
							break;
						}

						pCur = pCur->m_pNext;
					}
				}
			}

			// Check if it was a command...
			if( bFound )
				continue;

			// Treat it like a variable.
			if(parse.m_nArgs == 2 && !(flags & CC_NOVARS))
			{
				bChanged = 0;
				bNew = 0;

				newFlags = varFlags;
				pVarName = parse.m_Args[0];
				bForceNoSave = LTFALSE;
				if(pVarName[0] == '+')
				{
					newFlags |= VARFLAG_SAVE;
					++pVarName;
				}
				else if(pVarName[0] == '-')
				{
					bForceNoSave = LTTRUE;
					++pVarName;
				}


				// Add the variable if not already there.
				pVar = cc_FindConsoleVar(pState, pVarName);
				if(!pVar)
				{
					bNew = bChanged = 1;
					pVar = cc_AddConsoleVar(pState, pVarName);
				}

				pVar->m_VarFlags |= newFlags;
				if(bForceNoSave)
					pVar->m_VarFlags &= ~VARFLAG_SAVE;

				// Check the negation syntax.
				if(parse.m_Args[1][0] == '!' && parse.m_Args[1][1] == 0)
				{
					if(pVar->pStringVal)
					{
						if(isdigit(pVar->pStringVal[0]) || pVar->pStringVal[0] == '-')
						{
							tempNum = !((int)pVar->floatVal);
							LTSNPrintF(tempNumString, sizeof(tempNumString), "%d", tempNum);
							parse.m_Args[1] = tempNumString;
						}
					}
					else
					{
						parse.m_Args[1] = "1";
					}
				}

				// Check if it changed..
				if(pVar->pStringVal && strcmp(pVar->pStringVal, parse.m_Args[1])==0)
				{
				}
				else
				{
					if(strlen(parse.m_Args[1]) < VARBUF_LEN)
					{
						// Put it in its own buffer so we don't have to allocate or search.
						LTStrCpy(pVar->m_Buffer, parse.m_Args[1], sizeof(pVar->m_Buffer));
						pString = pVar->m_Buffer;
					}
					else
					{
						pString = cc_AddString(pState, parse.m_Args[1]);
					}

					pVar->pStringVal = pString;
					pVar->floatVal = (float)atof(parse.m_Args[1]);
					bChanged = 1;
				}

				cc_SetEngineVar(pState, pVar);

				// Call the appropriate callback.
				if(bChanged)
				{
					if(bNew)
					{
						if(pState->NewVar)
							pState->NewVar(pState, pVar);
					}
					else
					{
						if(pState->VarChange)
							pState->VarChange(pState, pVar);
					}
				}
			}
			else if(parse.m_nArgs == 1)
			{
				pVar = cc_FindConsoleVar(pState, parse.m_Args[0]);
				if(pVar)
					cc_PrintVarDescription(pState, pVar);
			}
		}
	}
}
コード例 #10
0
ファイル: render.cpp プロジェクト: Joincheng/lithtech
// Loads the texture and installs it.
LTRESULT r_LoadSystemTexture(SharedTexture *pSharedTexture)
{
	LTRESULT dResult;
	FileRef ref;

	FileIdentifier *pIdent = pSharedTexture->m_pFile;

	if (!pIdent) 
		return LT_NOTINITIALIZED;

	uint32 nBaseWidth;
	uint32 nBaseHeight;

	//the texture data that is associated with the texture
	TextureData* pTextureData = NULL;

	ILTStream *pStream = client_file_mgr->OpenFileIdentifier(pIdent);
	if (pStream) 
	{
		dResult = dtx_Create(pStream, &pTextureData, nBaseWidth, nBaseHeight);
		pStream->Release();

		if (dResult != LT_OK) 
			return dResult; 
	}
	else 
	{
		RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_MISSINGFILE, pIdent->m_Filename); 
	}

	//make sure to setup the texture information
	pSharedTexture->SetTextureInfo(nBaseWidth, nBaseHeight, pTextureData->m_PFormat);

	// Add the new texture to the MRU list.
	dl_AddHead(&g_SysCache.m_List, &pTextureData->m_Link, pTextureData);
	g_SysCache.m_CurMem += pTextureData->m_AllocSize;

	// Store its pointer in the SharedTexture.
	pSharedTexture->m_pEngineData = pTextureData;
	pTextureData->m_pSharedTexture = pSharedTexture;

	// Load in any linked textures depending upon what the user entered in the command string. Note
	//that these are exclusive

	ConParse parse;

	//Normal detail texturing
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("DetailTex", LTFALSE, 1)) 
	{

        //validate the argument count
        if(parse.m_nArgs < 2)
        {
		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "DetailTex : parse.m_Args[1]"); 
        }

		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_Detail, g_pClientMgr->AddSharedTexture(&ref));
		pSharedTexture->m_eTexType = eSharedTexType_Detail; 
		return LT_OK;
	}

	//Normal environment mapping
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("EnvMap", LTFALSE, 1)) 
	{

        //validate the argument count
        if(parse.m_nArgs < 2)
        {
		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvMap : parse.m_Args[1]"); 
        }

		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_EnvMap, g_pClientMgr->AddSharedTexture(&ref));
		pSharedTexture->m_eTexType = eSharedTexType_EnvMap; 
		return LT_OK;
	}

	//Environment mapping blended with the alpha of the base texture
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("EnvMapAlpha", LTFALSE, 1)) 
	{

        //validate the argument count
        if(parse.m_nArgs < 2)
        {
		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvMapAlpha : parse.m_Args[1]"); 
        }

		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_EnvMap, g_pClientMgr->AddSharedTexture(&ref));
		pSharedTexture->m_eTexType = eSharedTexType_EnvMapAlpha; 
		return LT_OK;
	}

	//Environment mapping with a bumpmap texture
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("EnvBumpMap", LTFALSE, 2)) 
	{
        //validate the argument count
        if(parse.m_nArgs < 3)
        {
            if(parse.m_nArgs < 2)
            {
		        RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvBumpMap : parse.m_Args[1]"); 
            }

		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvBumpMap : parse.m_Args[2]"); 
        }

		//handle loading up the environment map first
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_EnvMap, g_pClientMgr->AddSharedTexture(&ref));

		//now handle loading up the bumpmap
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[2];
		pSharedTexture->SetLinkedTexture(eLinkedTex_BumpMap, g_pClientMgr->AddSharedTexture(&ref));

		//setup the shader type
		pSharedTexture->m_eTexType = eSharedTexType_EnvBumpMap; 
		return LT_OK;
	}

	//Environment mapping with a bumpmap texture but no fallback
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("EnvBumpMapNoFallback", LTFALSE, 2)) 
	{

        //validate the argument count
        if(parse.m_nArgs < 3)
        {
            if(parse.m_nArgs < 2)
            {
		        RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvBumpMapNoFallback : parse.m_Args[1]"); 
            }

		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "EnvBumpMapNoFallback : parse.m_Args[2]"); 
        }

		//handle loading up the environment map first
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_EnvMap, g_pClientMgr->AddSharedTexture(&ref));

		//now handle loading up the bumpmap
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[2];
		pSharedTexture->SetLinkedTexture(eLinkedTex_BumpMap, g_pClientMgr->AddSharedTexture(&ref));

		//setup the shader type
		pSharedTexture->m_eTexType = eSharedTexType_EnvBumpMap_NoFallback; 
		return LT_OK;
	}


	//DOT3 bumpmap texture
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("DOT3BumpMap", LTFALSE, 1)) 
	{

		//validate the argument count
		if(parse.m_nArgs < 2)
		{
			RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "DOT3BumpMap : parse.m_Args[1]"); 
		}


		//now handle loading up the bumpmap
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_BumpMap, g_pClientMgr->AddSharedTexture(&ref));

		//setup the shader type
		pSharedTexture->m_eTexType = eSharedTexType_DOT3BumpMap; 
		return LT_OK;
	}



	//Environment mapping with a DOT3 bumpmap texture but no fallback
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("DOT3EnvBumpMap", LTFALSE, 2)) 
	{

        //validate the argument count
        if(parse.m_nArgs < 3)
        {
            if(parse.m_nArgs < 2)
            {
		        RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "DOT3EnvBumpMap : parse.m_Args[1]"); 
            }

		    RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "DOT3EnvBumpMap : parse.m_Args[2]"); 
        }

		//handle loading up the environment map first
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[1];
		pSharedTexture->SetLinkedTexture(eLinkedTex_EnvMap, g_pClientMgr->AddSharedTexture(&ref));

		//now handle loading up the bumpmap
		ref.m_FileType = FILE_CLIENTFILE;
		ref.m_pFilename = parse.m_Args[2];
		pSharedTexture->SetLinkedTexture(eLinkedTex_BumpMap, g_pClientMgr->AddSharedTexture(&ref));

		//setup the shader type
		pSharedTexture->m_eTexType = eSharedTexType_DOT3EnvBumpMap; 
		return LT_OK;
	}


	//Effect File Support
	parse.Init(pTextureData->m_Header.m_CommandString);
	if (parse.ParseFind("Effect", LTFALSE, 1)) 
	{
		//validate the argument count
		if(parse.m_nArgs < 2)
		{
			RETURN_ERROR_PARAM(1, r_LoadSystemTexture, LT_INVALIDDATA, "Effect : parse.m_Args[1]"); 
		}

		// Set up our shader ID
		pSharedTexture->m_nShaderID = (int)atoi(parse.m_Args[1]);
		pSharedTexture->m_eTexType = eSharedTexType_Effect;

		if(parse.m_nArgs > 2)
		{
			ref.m_FileType = FILE_CLIENTFILE;
			ref.m_pFilename = parse.m_Args[2];
			pSharedTexture->SetLinkedTexture(eLinkedTex_EffectTexture1, g_pClientMgr->AddSharedTexture(&ref));
			pSharedTexture->m_eTexType = eSharedTexType_Effect;
		}

		if(parse.m_nArgs > 3)
		{
			ref.m_FileType = FILE_CLIENTFILE;
			ref.m_pFilename = parse.m_Args[3];
			pSharedTexture->SetLinkedTexture(eLinkedTex_EffectTexture2, g_pClientMgr->AddSharedTexture(&ref));
			pSharedTexture->m_eTexType = eSharedTexType_Effect;
		}

		if(parse.m_nArgs > 4)
		{
			ref.m_FileType = FILE_CLIENTFILE;
			ref.m_pFilename = parse.m_Args[4];
			pSharedTexture->SetLinkedTexture(eLinkedTex_EffectTexture3, g_pClientMgr->AddSharedTexture(&ref));
			pSharedTexture->m_eTexType = eSharedTexType_Effect;
		}

		if(parse.m_nArgs > 5)
		{
			ref.m_FileType = FILE_CLIENTFILE;
			ref.m_pFilename = parse.m_Args[5];
			pSharedTexture->SetLinkedTexture(eLinkedTex_EffectTexture4, g_pClientMgr->AddSharedTexture(&ref));
			pSharedTexture->m_eTexType = eSharedTexType_Effect;
		}

		return LT_OK;
	}

	//just a normal texture...
	return LT_OK;
}
コード例 #11
0
LTRESULT CRotatingWorldModelPlugin::PreHook_Light(
    ILTPreLight *pInterface,
	HPREOBJECT hObject)
{
	GenericProp gProp;
	char shadowLights[256];
	char className[64];
	char rwmName[64];
	char animName[128];
	HPREOBJECT hShadowLight;
	ConParse cParse;
	KLProps theProps;
	DWORD iStep;
	float fPercent;
	int iAxis;
    uint32 iRwmLight;
	PreLightAnimFrameInfo *pFrame;
	PreLightInfo *pLightInfo;
	PreWorldModelInfo *pWorldModelInfo;
	PreLightAnimFrameInfo frames[MAX_RWM_LIGHT_STEPS+1];
	PreLightInfo lightInfos[MAX_RWM_LIGHT_STEPS+1];
	PreWorldModelInfo worldModelInfos[MAX_RWM_LIGHT_STEPS+1];
    uint32 uLightFrames;

	iAxis = 0;
	iRwmLight = 0;

	pInterface->GetPropGeneric(hObject, "ShadowAxis", &gProp);
	if (gProp.m_Vec.x) iAxis = 1;
	else if (gProp.m_Vec.y) iAxis = 2;
	else if (gProp.m_Vec.z) iAxis = 3;

	pInterface->GetPropGeneric(hObject, "Name", &gProp);

	if (!iAxis) {
		pInterface->CPrint("No shadow axis set for RotatingWorldModel %s, won't light",
			gProp.m_String);
		return LT_OK;
	} else {
		switch(iAxis)
		{
			case 1:
				pInterface->CPrint("Lighting for %s rotated on x axis.", gProp.m_String);
				break;
			case 2:
				pInterface->CPrint("Lighting for %s rotated on y axis.", gProp.m_String);
				break;
			case 3:
				pInterface->CPrint("Lighting for %s rotated on z axis.", gProp.m_String);
				break;
		}
	}

	if (pInterface->GetPropGeneric(hObject, "LightFrames", &gProp) == LT_OK)
		uLightFrames = gProp.m_Long;
	else
		uLightFrames = 1;

	// Go through the ShadowLights.
	iRwmLight = 0;
	pInterface->GetPropGeneric(hObject, "ShadowLights", &gProp);
	SAFE_STRCPY(shadowLights, gProp.m_String);
	cParse.Init(shadowLights);
	while(pInterface->Parse(&cParse) == LT_OK)
	{
		if(cParse.m_nArgs == 0)
			continue;

		// Look for the object and make sure it's a keyframer light.
		if(pInterface->FindObject(cParse.m_Args[0], hShadowLight) != LT_OK ||
			pInterface->GetClassName(hShadowLight, className, sizeof(className)) != LT_OK ||
			stricmp(className, KEYFRAMERLIGHT_CLASSNAME) != 0)
		{
			continue;
		}

		// Read in all the light properties.
		ReadKLProps(pInterface, hShadowLight, &theProps);

		// Get some of the door properties.
		pInterface->GetPropGeneric(hObject, "Name", &gProp);
		SAFE_STRCPY(rwmName, gProp.m_String);

		// Hinged doors don't look good unless they have an odd number of frames.
		if((uLightFrames & 1) == 0)
			++uLightFrames;

        uLightFrames = LTCLAMP(uLightFrames, 2, MAX_RWM_LIGHT_STEPS);
		for(iStep=0; iStep < (uLightFrames+1); iStep++)
		{
			pFrame = &frames[iStep];
			pLightInfo = &lightInfos[iStep];
			pWorldModelInfo = &worldModelInfos[iStep];
			fPercent = (float)iStep / (uLightFrames - 1);

            pFrame->m_bSunLight = LTFALSE;

			pFrame->m_Lights = pLightInfo;
			pFrame->m_nLights = 1;

			pFrame->m_WorldModels = pWorldModelInfo;
			pFrame->m_nWorldModels = 1;

			pLightInfo->m_bDirectional = theProps.m_bDirLight;
			pLightInfo->m_FOV = theProps.m_fFOV;
			pLightInfo->m_Radius = theProps.m_fRadius;
			pLightInfo->m_vInnerColor = theProps.m_vInnerColor;
			pLightInfo->m_vOuterColor = theProps.m_vOuterColor;
			pLightInfo->m_vDirection = theProps.m_vForwardVec;
			pLightInfo->m_vPos = theProps.m_vPos;

			SAFE_STRCPY(pWorldModelInfo->m_WorldModelName, rwmName);

			if(iStep == uLightFrames)
			{
				// The last frame is without the world model for when it's destroyed.
                pWorldModelInfo->m_bInvisible = LTTRUE;
			}
			else
			{
				pInterface->GetWorldModelRuntimePos(hObject, pWorldModelInfo->m_Pos);

				switch (iAxis)
				{
					case 1:
						pInterface->GetMathLT()->SetupEuler(pWorldModelInfo->m_Rot,
							MATH_CIRCLE * fPercent, 0.0f, 0.0f);
						break;
					case 2:
						pInterface->GetMathLT()->SetupEuler(pWorldModelInfo->m_Rot,
							0.0f, MATH_CIRCLE * fPercent, 0.0f);
						break;
					case 3:
						pInterface->GetMathLT()->SetupEuler(pWorldModelInfo->m_Rot,
							0.0f, 0.0f, MATH_CIRCLE * fPercent);
						break;
				}
			}
		}

		SetupRWMLightAnimName(animName, rwmName, iRwmLight);

		pInterface->CreateLightAnim(
			animName,
			frames,
			uLightFrames+1,
			theProps.m_bUseShadowMaps);

		++iRwmLight;
	}

	return LT_OK;
}
コード例 #12
0
ファイル: DestructibleModel.cpp プロジェクト: Arc0re/lithtech
uint32 CDestructibleModel::ObjectMessageFn(LPBASECLASS pObject, HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead)
{
	uint32 dwRet = CDestructible::ObjectMessageFn(pObject, hSender, messageID, hRead);

	switch(messageID)
	{
		case MID_DAMAGE:
		{
			if (IsDead() && !m_bCreatedDebris)
			{
                ILTServer* pServerDE = BaseClass::GetServerDE();
				if (!pServerDE) break;

				SpawnItem();
				CreateDebris();
				CreateWorldModelDebris();

				if (m_bCreateExplosion)
				{
					DoExplosion();
				}

				m_bCreatedDebris = LTTRUE;

				if (m_bRemoveOnDeath)
				{
					pServerDE->RemoveObject(m_hObject);
				}
			}
		}
		break;

		case MID_TRIGGER:
		{
			const char* szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead);

			// ConParse does not destroy szMsg, so this is safe
			ConParse parse;
			parse.Init((char*)szMsg);

			while (g_pLTServer->Common()->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					if (!IsDead())
					{
						if (_stricmp(parse.m_Args[0], "FIRE") == 0)
						{
							char* pTargetName = parse.m_nArgs > 1 ? parse.m_Args[1] : LTNULL;
							DoExplosion(pTargetName);
						}
						else if (_stricmp(parse.m_Args[0], "HIDDEN") == 0)
						{
							uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject);

							if (parse.m_nArgs > 1 && parse.m_Args[1])
							{
								if ((_stricmp(parse.m_Args[1], "1") == 0) ||
									(_stricmp(parse.m_Args[1], "TRUE") == 0))
								{
									dwFlags = 0;

									m_bSaveCanDamage = GetCanDamage();
									m_bSaveNeverDestroy = GetNeverDestroy();

									SetCanDamage(LTFALSE);
									SetNeverDestroy(LTTRUE);
								}
								else
								{
									if ((_stricmp(parse.m_Args[1], "0") == 0) ||
										(_stricmp(parse.m_Args[1], "FALSE") == 0))
									{
										dwFlags = m_dwOriginalFlags;
										dwFlags |= FLAG_VISIBLE;

										SetCanDamage(m_bSaveCanDamage);
										SetNeverDestroy(m_bSaveNeverDestroy);
									}
								}

								g_pLTServer->SetObjectFlags(m_hObject, dwFlags);
							}
						}
					}
				}
			}
		}
		break;

		default : break;
	}

	return dwRet;
}
コード例 #13
0
ファイル: Lock.cpp プロジェクト: Arc0re/lithtech
uint32 Lock::ObjectMessageFn(HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead)
{
    if (!g_pLTServer) return 0;

	switch(messageID)
	{
		case MID_TRIGGER:
		{
            ILTCommon* pCommon = g_pLTServer->Common();
			if (!pCommon) return 0;

			const char *szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead);

			// ConParse does not destroy szMsg, so this is safe
			ConParse parse;
			parse.Init((char*)szMsg);

			while (pCommon->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					if (_stricmp(parse.m_Args[0], s_szGadget) == 0)
					{
						HandleGadgetMsg(hSender, parse);
					}
				}
			}
		}
		break;

		case MID_DAMAGE:
		{
			if (m_bUnlocked) break;

            uint32 dwRet = 0;

			DamageStruct damage;
			damage.InitFromMessage(hRead);

            LTBOOL bProcessDamage = m_bShootable;

			if (!bProcessDamage)
			{
				if (m_bWeldable)
				{
					bProcessDamage = (damage.eType == DT_GADGET_WELDER);
				}
				else if (m_bLightable)
				{
					bProcessDamage = (damage.eType == DT_GADGET_LIGHTER);
				}
				else
				{
					bProcessDamage = (damage.eType == DT_GADGET_LOCK_PICK);
				}
			}

			if (bProcessDamage)
			{
				dwRet = Prop::ObjectMessageFn(hSender, messageID, hRead);

				if (m_damage.IsDead())
				{
					SetupUnlockState();
				}
			}

			return dwRet;
		}
		break;

		default : break;
	}

	return Prop::ObjectMessageFn(hSender, messageID, hRead);
}
コード例 #14
0
void GameBase::TriggerMsg(HOBJECT hSender, const char* szMsg)
{
	if (!szMsg) return;

    ILTCommon* pCommon = g_pLTServer->Common();
	if (!pCommon) return;

	// ConParse does not destroy szMsg, so this is safe
	ConParse parse;
	parse.Init((char*)szMsg);

	while (pCommon->Parse(&parse) == LT_OK)
	{
		if (parse.m_nArgs > 0 && parse.m_Args[0])
		{
            uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject);
			if (!m_dwOriginalFlags)
			{
				m_dwOriginalFlags = dwFlags;
			}

			if (_stricmp(parse.m_Args[0], "VISIBLE") == 0)
			{
				if (parse.m_nArgs > 1 && parse.m_Args[1])
				{
					if ((_stricmp(parse.m_Args[1], "1") == 0) ||
						(_stricmp(parse.m_Args[1], "TRUE") == 0))
					{
						dwFlags |= FLAG_VISIBLE;
					}
					else
					{
						if ((_stricmp(parse.m_Args[1], "0") == 0) ||
							(_stricmp(parse.m_Args[1], "FALSE") == 0))
						{
							dwFlags &= ~FLAG_VISIBLE;
						}
					}
				}
			}
			else if (_stricmp(parse.m_Args[0], "SOLID") == 0)
			{
				if (parse.m_nArgs > 1 && parse.m_Args[1])
				{
					if ((_stricmp(parse.m_Args[1], "1") == 0) ||
						(_stricmp(parse.m_Args[1], "TRUE") == 0))
					{
						dwFlags |= FLAG_SOLID;

						if (m_dwOriginalFlags & FLAG_RAYHIT)
						{
							dwFlags |= FLAG_RAYHIT;
						}
					}
					else
					{
						if ((_stricmp(parse.m_Args[1], "0") == 0) ||
							(_stricmp(parse.m_Args[1], "FALSE") == 0))
						{
							dwFlags &= ~FLAG_SOLID;
							dwFlags &= ~FLAG_RAYHIT;
						}
					}
				}
			}

            g_pLTServer->SetObjectFlags(m_hObject, dwFlags);
		}
	}
}
コード例 #15
0
ファイル: SecurityCamera.cpp プロジェクト: Arc0re/lithtech
uint32 SecurityCamera::ObjectMessageFn(HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead)
{
    if (!g_pLTServer) return 0;

	switch(messageID)
	{
		case MID_TRIGGER:
		{
            ILTCommon* pCommon = g_pLTServer->Common();
			if (!pCommon) return 0;

			const char *szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead);

			// ConParse does not destroy szMsg, so this is safe
			ConParse parse;
			parse.Init((char*)szMsg);

			while (pCommon->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					if (_stricmp(parse.m_Args[0], s_szOff) == 0)
					{
						SetState(eStateOff);
					}
					else if (_stricmp(parse.m_Args[0], s_szReset) == 0)
					{
						SetState(eStateReset);
					}
					else if (_stricmp(parse.m_Args[0], s_szGadget) == 0)
					{
						HandleGadgetMsg(parse);
					}
					else if (_stricmp(parse.m_Args[0], s_szTripped) == 0)
					{
						m_bTripped = LTTRUE;

						// Make sure the camera is set to use the red light...

						char buf[128];
						g_pServerButeMgr->GetSecurityCameraString(
							"RedLight", buf, ARRAY_LEN(buf));

						g_pLTServer->SetObjectFilenames(m_hLight, buf, "");

						SetState(eStateOff);
					}
				}
			}
		}
		break;

		case MID_DAMAGE:
		{
			// Let our damage aggregate process the message first...

            uint32 dwRet = CScanner::ObjectMessageFn(hSender, messageID, hRead);

			// Check to see if we have been destroyed

			if (m_damage.IsDead())
			{
				SetState(eStateDestroyed);
			}
			return dwRet;
		}
		break;

		default : break;
	}

	return CScanner::ObjectMessageFn(hSender, messageID, hRead);
}
コード例 #16
0
LTBOOL CinematicTrigger::StartDialogue(int nDecision)
{
	if(m_nCurMessage >= MAX_CT_MESSAGES)
        return LTFALSE;

	CString csDialogue;
	CString	csTarget;
	CString csChar;
    uint8 byMood = 0;

	if(nDecision)
	{
        char* pMsg = g_pLTServer->GetStringData(m_hstrReplies[m_nCurMessage]);
		if(!pMsg) return FALSE;

        ILTCommon* pCommon = g_pLTServer->Common();
		if (!pCommon) return FALSE;

		ConParse parse;
		parse.Init(pMsg);

		for(int i=0;i<nDecision;i++)
		{
			if(pCommon->Parse(&parse) == LT_OK)
			{
				if (parse.m_nArgs < 2)
				{
					if (parse.m_nArgs < 1 || stricmp(parse.m_Args[0], "NONE") != 0)
					{
                        g_pLTServer->CPrint("Cinematic Trigger - ERROR - Not enough replies for the amount of decisions!");
						TRACE("Cinematic Trigger - ERROR - Not enough replies for the amount of decisions!\n");
						return FALSE;
					}
				}
				else if(i == (nDecision - 1))
				{
					csTarget = parse.m_Args[0];
					if(csTarget.Compare("Cinematic") == 0)
					{
						//HandleOff(); - Should be done by reply message?

						// Force the dialogue to be done...
						m_nCurMessage = MAX_CT_MESSAGES;

						// We have another cinematic to play, turn it on...
						SendTriggerMsgToObjects(this, parse.m_Args[1], "ON");
						return FALSE;
					}
					else
					{
						// Look at the second argument to determine if we have a
						// character override
						if((parse.m_Args[1][0] < '0') && (parse.m_Args[1][0] > '9'))
						{
							// We have a character override
							csChar = parse.m_Args[1];
							csDialogue = parse.m_Args[2];
							// Check for a mood
							if(parse.m_nArgs == 4)
							{
								// char charoverride id mood
								byMood = atoi(parse.m_Args[3]);
							}
						}
						else
						{
							// We don't have a character override
							csDialogue = parse.m_Args[1];
							// check for a mood
							if(parse.m_nArgs == 3)
							{
								// char id mood
								byMood = atoi(parse.m_Args[2]);
							}
						}
					}
				}
			}
		}
	}
	else
	{
		// Send the message here

		SendMessage();

		// Check for an initial message

		if (m_nCurMessage == 0)
		{
			if (m_hstrDialogueStartTarget && m_hstrDialogueStartMsg)
			{
                SendTriggerMsgToObjects(this, g_pLTServer->GetStringData(m_hstrDialogueStartTarget), g_pLTServer->GetStringData(m_hstrDialogueStartMsg));
			}
		}

        csDialogue = g_pLTServer->GetStringData(m_hstrDialogue[m_nCurMessage]);
        csTarget = g_pLTServer->GetStringData(m_hstrWhoPlaysDialogue[m_nCurMessage]);
	}

	if (csDialogue.IsEmpty())
	{
		// Make sure the reply messages are sent, even if we aren't going to
		// do any dialogue...

		if (nDecision)
		{
			SendReplyMessage(nDecision);
		}

        return LTFALSE;
	}

	const char *szCharOverride = NULL;
	if(csChar.IsEmpty())
	{
		int nSpace = csTarget.Find(' ');
		if(nSpace != -1)
		{
			// There is a space in the name, therefore we have a character override
			csChar = csTarget.Right(csTarget.GetLength()-nSpace-1);
			csTarget = csTarget.Left(nSpace);
			if(!csChar.IsEmpty())
				szCharOverride = csChar;
		}
	}
	else
	{
		szCharOverride = csChar;
	}


    HOBJECT hObj = !csTarget.IsEmpty() ? PlayedBy((char *)(LPCSTR)csTarget) : LTNULL;
	if (hObj)
	{
        CCharacter* pChar = (CCharacter*)g_pLTServer->HandleToObject(hObj);
		if (pChar)
		{
			char *szDecisions = NULL;
			if (!nDecision && m_hstrDecisions[m_nCurMessage])
            {
				szDecisions = g_pLTServer->GetStringData(m_hstrDecisions[m_nCurMessage]);
			}

			// See if there's a windowed message next
			int nNext = m_nCurMessage + 1;
			//BOOL bStayOpen = (szDecisions || ((nNext < MAX_CT_MESSAGES) && m_hstrDialogue[nNext] && m_bWindow[nNext] && (m_fDelay[nNext] == 0.0f)));
			//BOOL bWindow = m_bWindow[m_nCurMessage];

            BOOL bStayOpen = LTFALSE;
			BOOL bWindow = (BOOL)szDecisions;

			pChar->PlayDialogue((char *)(LPCSTR)csDialogue,this,bWindow,bStayOpen,szCharOverride,szDecisions,byMood);

			SetupLinks(hObj);

            return LTTRUE;
		}
	}
    return LTFALSE;
}
コード例 #17
0
void CMusic::ProcessMusicMessage(char* pMessage)
{
	// Make sure mgrs are initialized
	if (!pMessage || !pMessage[0]) return;
	if (!IsInitialized()) return;
	if (!IsLevelInitialized()) return;
	if (m_pMusicMgr == NULL) return;

    ILTCommon* pCommon = g_pLTClient->Common();
	ConParse parse;
	parse.Init(pMessage);

	while (pCommon->Parse(&parse) == LT_OK)
	{
		if (parse.m_nArgs > 1)
		{
			if (parse.m_Args[1] != NULL)
			{
				// change intensity command
				if ((_stricmp(parse.m_Args[1], "intensity") == 0) ||
					(_stricmp(parse.m_Args[1], "i") == 0))
				{
					if (parse.m_nArgs > 2)
					{
						if (parse.m_Args[2] != NULL)
						{
							// convert intensity value to an int
							int nIntensity = atoi(parse.m_Args[2]);

							// figure out the enact time (optional parameter)
							LTDMEnactTypes nEnact = LTDMEnactDefault;
							if (parse.m_nArgs > 3) nEnact = StringToEnactType(parse.m_Args[3]);

							// change the music intensity
							ChangeIntensity(nIntensity, nEnact);
						}
					}
				}
				// play secondary segment command
				if ((_stricmp(parse.m_Args[1], "secondary") == 0) ||
					(_stricmp(parse.m_Args[1], "ps") == 0))

				{
					if (parse.m_nArgs > 2)
					{
						if (parse.m_Args[2] != NULL)
						{
							strcpy(m_State.szSecondary, parse.m_Args[2]);

							// figure out the enact time (optional parameter)
							m_State.nSecondaryEnact = LTDMEnactDefault;
							if (parse.m_nArgs > 3) m_State.nSecondaryEnact = StringToEnactType(parse.m_Args[3]);

							// play a secondary segment
							m_pMusicMgr->PlaySecondary(m_State.szSecondary, m_State.nSecondaryEnact);
						}
					}
				}
				// play motif command
				if ((_stricmp(parse.m_Args[1], "motif") == 0) ||
					(_stricmp(parse.m_Args[1], "pm") == 0))
				{
					if (parse.m_nArgs > 3)
					{
						if ((parse.m_Args[2] != NULL) && (parse.m_Args[3] != NULL))
						{
							strcpy(m_State.szMotifStyle, parse.m_Args[2]);
							strcpy(m_State.szMotifName, parse.m_Args[3]);

							// figure out the enact time (optional parameter)
							m_State.nMotifEnact = LTDMEnactDefault;
							if (parse.m_nArgs > 4)
							{
								m_State.nMotifEnact = StringToEnactType(parse.m_Args[4]);
							}

							// play a motif
							if ((stricmp(m_State.szMotifStyle,"*") == 0))
							{
								m_pMusicMgr->PlayMotif(NULL, m_State.szMotifName, m_State.nMotifEnact);
							}
							else
							{
								m_pMusicMgr->PlayMotif(m_State.szMotifStyle, m_State.szMotifName, m_State.nMotifEnact);
							}
						}
					}
				}
				// set volume command
				if ((_stricmp(parse.m_Args[1], "volume") == 0) ||
					(_stricmp(parse.m_Args[1], "v") == 0))
				{
					if (parse.m_nArgs > 2)
					{
						if (parse.m_Args[2] != NULL)
						{
							// set the new volume
							SetTriggerVolume(atol(parse.m_Args[2]));
						}
					}
				}
				// stop secondary segment command
				if ((_stricmp(parse.m_Args[1], "stopsecondary") == 0) ||
					(_stricmp(parse.m_Args[1], "ss") == 0))

				{
					if (parse.m_nArgs > 2)
					{
						if (parse.m_Args[2] != NULL)
						{
							// No secondary...
							m_State.szSecondary[0] = '\0';

							// figure out the enact time (optional parameter)
							LTDMEnactTypes nEnact = LTDMEnactDefault;
							if (parse.m_nArgs > 3) nEnact = StringToEnactType(parse.m_Args[3]);

							// stop a secondary segment if name is * stop all
							if ((stricmp(parse.m_Args[2],"*") == 0)) m_pMusicMgr->StopSecondary(NULL, nEnact);
							else m_pMusicMgr->StopSecondary(parse.m_Args[2], nEnact);
						}
					}
				}
				// stop motif command
				if ((_stricmp(parse.m_Args[1], "stopmotif") == 0) ||
					(_stricmp(parse.m_Args[1], "sm") == 0))
				{
					if (parse.m_nArgs > 3)
					{
						if ((parse.m_Args[2] != NULL) && (parse.m_Args[3] != NULL))
						{
							// No motifs...
							m_State.szMotifStyle[0] = '\0';
							m_State.szMotifName[0]  = '\0';

							// figure out the enact time (optional parameter)
							LTDMEnactTypes nEnact = LTDMEnactDefault;
							if (parse.m_nArgs > 4) nEnact = StringToEnactType(parse.m_Args[4]);

							// if name or style are * pass in NULL for all/any
							if ((stricmp(parse.m_Args[2],"*") == 0))
							{
								if ((stricmp(parse.m_Args[3],"*") == 0)) m_pMusicMgr->StopMotif(NULL, NULL, nEnact);
								else m_pMusicMgr->StopMotif(NULL, parse.m_Args[3], nEnact);
							}
							else
							{
								if ((stricmp(parse.m_Args[3],"*") == 0)) m_pMusicMgr->StopMotif(parse.m_Args[2], NULL, nEnact);
								else m_pMusicMgr->StopMotif(parse.m_Args[2], parse.m_Args[3], nEnact);
							}
						}
					}
				}
				// play command
				if ((_stricmp(parse.m_Args[1], "play") == 0) ||
					(_stricmp(parse.m_Args[1], "p") == 0))

				{
					// begin playing music
					Play();
				}
				// stop command
				if ((_stricmp(parse.m_Args[1], "stop") == 0) ||
					(_stricmp(parse.m_Args[1], "s") == 0))

				{
					// enact time to stop at
					LTDMEnactTypes nEnact = LTDMEnactDefault;

					// see if there is another parameter for the enact time
					if (parse.m_nArgs > 2)
					{
						if (parse.m_Args[2] != NULL)
						{
							// figure out the enact time (optional parameter)
							if (parse.m_nArgs > 3) nEnact = StringToEnactType(parse.m_Args[3]);
						}
					}

					// stop music from playing
					Stop(nEnact);
				}
			}
		}
	}

}
コード例 #18
0
void CinematicTrigger::TriggerMsg(HOBJECT hSender, const char *pMsg)
{
	if (!pMsg) return;

    ILTCommon* pCommon = g_pLTServer->Common();
	if (!pCommon) return;

	// ConParse does not destroy szMsg, so this is safe
	ConParse parse;
	parse.Init((char*)pMsg);

	while (pCommon->Parse(&parse) == LT_OK)
	{
		if (parse.m_nArgs > 0 && parse.m_Args[0])
		{
			if (_stricmp(parse.m_Args[0], "ON") == 0)
			{
				HandleOn();
			}
			else if (_stricmp(parse.m_Args[0], "OFF") == 0)
			{
				HandleOff();
			}
			else if (_stricmp(parse.m_Args[0], "SKIP") == 0)
			{
				if (m_bCanSkip)
				{
					HandleOff();
				}
			}
			else if (_stricmp(parse.m_Args[0], "CAMERA") == 0)
			{
				if (m_hCamera && parse.m_nArgs > 1 && parse.m_Args[1])
				{
					// Copy all arguments to g_tokenspace...

					sprintf(g_tokenSpace, "%s", parse.m_Args[1]);
					for (int i=2; i < parse.m_nArgs && parse.m_Args[i]; i++)
					{
						strcat(g_tokenSpace, " ");
						strcat(g_tokenSpace, parse.m_Args[i]);
					}

					// Send camera the message...

					SendTriggerMsgToObject(this, m_hCamera, FALSE, g_tokenSpace);
				}
			}
			else if (_stricmp(parse.m_Args[0], "KEYFRAMER") == 0)
			{
				if (m_hKeyFramer && parse.m_nArgs > 1 && parse.m_Args[1])
				{
					// Copy all arguments to g_tokenspace...

					sprintf(g_tokenSpace, "%s", parse.m_Args[1]);
					for (int i=2; i < parse.m_nArgs && parse.m_Args[i]; i++)
					{
						strcat(g_tokenSpace, " ");
						strcat(g_tokenSpace, parse.m_Args[i]);
					}

					// Send keyframer the message...

					SendTriggerMsgToObject(this, m_hKeyFramer, FALSE, g_tokenSpace);
				}
			}
		}
	}
}
コード例 #19
0
void Intelligence::ReadProp(ObjectCreateStruct *pInfo)
{
	if (!pInfo) return;

	GenericProp genProp;

    if (g_pLTServer->GetPropGeneric("PhotoOnly", &genProp) == LT_OK)
	{
		m_bPhotoOnly = genProp.m_Bool;
	}

    if (g_pLTServer->GetPropGeneric("StartHidden", &genProp) == LT_OK)
	{
		m_bStartHidden = genProp.m_Bool;
	}

    if (g_pLTServer->GetPropGeneric("ShowPopup", &genProp) == LT_OK)
	{
		m_bShowPopup = genProp.m_Bool;
	}

    if (g_pLTServer->GetPropGeneric("PickedUpCommand", &genProp) == LT_OK)
	{
		if (genProp.m_String[0])
		{
            m_hstrPickedUpCmd = g_pLTServer->CreateString(genProp.m_String);
		}
	}

    if (g_pLTServer->GetPropGeneric("PlayerTeamFilter", &genProp) == LT_OK)
	{
		m_nPlayerTeamFilter = (uint8) genProp.m_Long;
	}

    if (g_pLTServer->GetPropGeneric("InfoId", &genProp) == LT_OK)
	{
		m_nInfoId = genProp.m_Long;
	}

	if (g_pLTServer->GetPropGeneric("RespawnTime", &genProp) == LT_OK)
	{
		m_fRespawnDelay = genProp.m_Float;
	}


   INTEL* pIntel = LTNULL;

    if (g_pLTServer->GetPropGeneric("Type", &genProp) == LT_OK)
	{
		if (genProp.m_String[0])
		{
			pIntel = g_pIntelMgr->GetIntel(genProp.m_String);
		}
	}

	if (pIntel)
	{
		if (!pIntel || !pIntel->szFilename[0]) return;

		SAFE_STRCPY(pInfo->m_Filename, pIntel->szFilename);

		uint32 iSkin = 0;
		ConParse conParse;
		conParse.Init(pIntel->szSkin);
		while (g_pLTServer->Common()->Parse(&conParse) == LT_OK)
		{
			if (conParse.m_nArgs > 0)
			{
				SAFE_STRCPY(pInfo->m_SkinNames[iSkin], conParse.m_Args[0]);
				iSkin++;
			}

			if (iSkin >= MAX_MODEL_TEXTURES)
				break;
		}
		pInfo->m_SkinName[MAX_CS_FILENAME_LEN] = '\0';

		m_nIntelId = pIntel->nId;

		if (pIntel->bChromakey)
		{
			m_dwFlags2 |= FLAG2_CHROMAKEY;
		}	

		m_dwFlags = (pIntel->bChrome ? (m_dwFlags | FLAG_ENVIRONMENTMAP) : (m_dwFlags & ~FLAG_ENVIRONMENTMAP));
	}
}