예제 #1
0
bool WeaponItem::PostPropRead(ObjectCreateStruct *pStruct)
{
	WEAPON const *pWeapon = g_pWeaponMgr->GetWeapon(m_nWeaponId);
	if( !pWeapon )
		return false;

	if( !pStruct )
		return false;

	SAFE_STRCPY(pStruct->m_Filename, pWeapon->szHHModel);

	pWeapon->blrHHSkins.CopyList(0, pStruct->m_SkinNames[0], MAX_CS_FILENAME_LEN+1);
	pWeapon->blrHHRenderStyles.CopyList(0, pStruct->m_RenderStyleNames[0], MAX_CS_FILENAME_LEN+1);

	// See if our default model was changed...

	CheckForOverrideModel(pStruct);

	// Set up the appropriate pick up and respawn sounds...

	FREE_HSTRING(m_hstrSoundFile);
    m_hstrSoundFile = g_pLTServer->CreateString( WEAPONITEM_PICKUP_SOUND );

	FREE_HSTRING( m_hstrRespawnSoundFile );
	m_hstrRespawnSoundFile = g_pLTServer->CreateString( WEAPONITEM_RESPAWN_SOUND );

	m_vScale = pWeapon->vHHScale;
	m_sClientFX = pWeapon->szPowerupFX;

    m_bBounce = LTFALSE;
    m_bRotate = LTFALSE;

	return true;
}
void GearItem::PostPropRead(ObjectCreateStruct *pStruct)
{
	GEAR* pGear = g_pWeaponMgr->GetGear(m_nGearId);
	if (!pGear) return;

	if (pStruct)
	{
		SAFE_STRCPY(pStruct->m_Filename, pGear->szModel);
		SAFE_STRCPY(pStruct->m_SkinName, pGear->szSkin);

		// Set up the appropriate sounds...

		if (pGear->szPickUpSound[0])
		{
			FREE_HSTRING(m_hstrSoundFile);
			m_hstrSoundFile = g_pLTServer->CreateString(pGear->szPickUpSound);
		}

		if (pGear->szRespawnSound[0])
		{
			FREE_HSTRING(m_hstrRespawnSoundFile);
			m_hstrRespawnSoundFile = g_pLTServer->CreateString(pGear->szRespawnSound);
		}

        m_bRotate = LTFALSE;
	}
}
예제 #3
0
AI_Helicopter::~AI_Helicopter()
{
	FREE_HSTRING(m_hstrDeathMessage);
	FREE_HSTRING(m_hstrDeath0_3rdMessage);
	FREE_HSTRING(m_hstrDeath1_3rdMessage);
	FREE_HSTRING(m_hstrDeath2_3rdMessage);

	if ( m_pHelicopterState )
	{
		FACTORY_DELETE(m_pHelicopterState);
        m_pHelicopterState = LTNULL;
        m_pVehicleState = LTNULL;
        m_pState = LTNULL;
	}

	if ( -1 != m_iObjectGunner && m_apObjects[m_iObjectGunner] )
	{
		HOBJECT hGunner = m_apObjects[m_iObjectGunner]->m_hObject;
		if ( hGunner )
		{
			CCharacter* pGunner = (CCharacter*)g_pLTServer->HandleToObject(hGunner);
			if ( pGunner )
			{
				Unlink(hGunner);
				pGunner->RemoveObject();
			}
		}
	}
}
예제 #4
0
파일: AIState.cpp 프로젝트: Arc0re/lithtech
void CAIState::HandleNameValuePair(char *szName, char *szValue)
{
	_ASSERT(szName && szValue);
	if ( !szName || !szValue ) return;

	if ( !_stricmp(szName, "RETURN") )
	{
		FREE_HSTRING(m_hstrReturn);
        m_hstrReturn = g_pLTServer->CreateString(szValue);
	}
	else if ( !_stricmp(szName, "NEXT") )
	{
		if ( m_cNexts >= kMaxNexts )
		{
			_ASSERT(!"NEXT= buffer overflow");
			return;
		}

        m_ahstrNexts[m_cNexts++] = g_pLTServer->CreateString(szValue);
	}
	else if ( !_stricmp(szName, "FIRST") )
	{
        FREE_HSTRING(m_hstrFirst);
        m_hstrFirst = g_pLTServer->CreateString(szValue);
	}
	else if ( !_stricmp(szName, "FIRSTSOUND") )
	{
		m_bPlayFirstSound = IsTrueChar(*szValue);
	}
	else if ( !_stricmp(szName, "NOCINEMATICS") )
	{
		m_bNoCinematics = IsTrueChar(*szValue);
	}
}
예제 #5
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	PickupItem::~PickupItem()
//
//	PURPOSE:	Deallocate object
//
// ----------------------------------------------------------------------- //
PickupItem::~PickupItem()
{
	FREE_HSTRING(m_hstrPickupCommand);
	FREE_HSTRING(m_hstrSoundFile);
	FREE_HSTRING(m_hstrRespawnSoundFile);
	FREE_HSTRING(m_hstrModelOverride);
}
예제 #6
0
파일: Scanner.cpp 프로젝트: Arc0re/lithtech
CScanner::~CScanner()
{
	FREE_HSTRING(m_hstrDestroyedFilename);
	FREE_HSTRING(m_hstrDestroyedSkin);
	FREE_HSTRING(m_hstrSpotMessage);
	FREE_HSTRING(m_hstrSpotTarget);
}
예제 #7
0
AIRegion::~AIRegion()
{
	FREE_HSTRING(m_hstrName);

	for ( uint32 iPostSearchMsg = 0 ; iPostSearchMsg < kMaxPostSearchMsgs ; iPostSearchMsg++ )
	{
		FREE_HSTRING(m_ahstrPostSearchMsgs[iPostSearchMsg]);
	}
}
Breakable::~Breakable()
{
	FREE_HSTRING(m_hstrBreakSound);
	FREE_HSTRING(m_hstrImpactSound);

	if (m_hBreakObj)
	{
        g_pLTServer->BreakInterObjectLink(m_hObject, m_hBreakObj);
	}
}
예제 #9
0
CDestructibleModel::~CDestructibleModel()
{
	FREE_HSTRING(m_hstrSpawn);
	FREE_HSTRING(m_hstrSurfaceOverride);

	// Remove disturbance stimulus.
	if(m_eStimID != kStimID_Unset)
	{
		g_pAIStimulusMgr->RemoveStimulus(m_eStimID);
		m_eStimID = kStimID_Unset;
	}
}
예제 #10
0
파일: AIState.cpp 프로젝트: Arc0re/lithtech
void CAIState::Destructor()
{
	m_pAI->GetSenseMgr()->Clear();

	FREE_HSTRING(m_hstrReturn);
	FREE_HSTRING(m_hstrFirst);

	for ( int iNext = 0 ; iNext < kMaxNexts ; iNext++ )
	{
		FREE_HSTRING(m_ahstrNexts[iNext]);
	}
}
예제 #11
0
파일: Alarm.cpp 프로젝트: emoose/lithtech
Alarm::~Alarm()
{
    if( !g_pLTServer ) return;

	m_eState = eStateOff;
    m_bPlayerUsable = LTFALSE;

	FREE_HSTRING(m_hstrPlayerActivateCommand);

	FREE_HSTRING(m_hstrAlertRegions);
	FREE_HSTRING(m_hstrRespondRegions);
	FREE_HSTRING(m_hstrSearchRegions);
}
예제 #12
0
파일: Alarm.cpp 프로젝트: emoose/lithtech
void Alarm::CreateRegionList(HSTRING& hstrRegions, AIREGION_LIST* pList)
{
	// Create a list of regions.
	// Named object may be a region, a list of regions separated by semicolons.

	if( hstrRegions )
	{
		char szRegions[REGION_STRING_LEN + 1];		
		
		const char* pszRegions = g_pLTServer->GetStringData( hstrRegions );
		AIASSERT( strlen( pszRegions ) <= REGION_STRING_LEN, m_hObject, "Alarm::CreateRegionList: RegionList is longer than 256 chars." );
		strncpy( szRegions, pszRegions, REGION_STRING_LEN );
		
		char* tok = strtok( szRegions, "; " );
		while( tok )
		{
			HOBJECT hObject;
			if( ( LT_OK == FindNamedObject( tok, hObject ) ) &&
				( IsAIRegion( hObject ) ) )
			{
				pList->push_back( hObject );
			}
			else {
				char szError[128];
				sprintf( szError, "Alarm::CreateRegionList: '%s' is not a region.", tok ); 
				AIASSERT( 0, m_hObject, szError );
			}

			tok = strtok( LTNULL, "; " );
		}
	}

	FREE_HSTRING( hstrRegions );
}
예제 #13
0
파일: AIState.cpp 프로젝트: Arc0re/lithtech
void CAIState::NextOr(const char *szState)
{
	if ( m_cNexts > 0 )
	{
		char szBuffer[4096] = "";

		for ( int iNext = 0 ; iNext < m_cNexts ; iNext++ )
		{
            strcat(szBuffer, g_pLTServer->GetStringData(m_ahstrNexts[iNext]));
			strcat(szBuffer, ";");

			FREE_HSTRING(m_ahstrNexts[iNext]);
		}

		m_cNexts = 0;

		szBuffer[strlen(szBuffer)-1] = 0;

		m_pAI->ChangeState(szBuffer);
	}
	else
	{
		m_pAI->ChangeState(szState);
	}
}
예제 #14
0
void AINodeGuard::Init()
{
	super::Init();

	// Get the guarded nodes.
	// Guarded nodes will be owned by this guard node.  Nodes that are
	// owned may only be used by the AI assigned to this guard node.

	HSTRING hstrNodeName;
	HSTRING_LIST::iterator it;
	for ( it = m_lstGuardedNodeNames.begin(); it != m_lstGuardedNodeNames.end(); ++it )
	{
		hstrNodeName = *it;
		AINode* pNode = g_pAINodeMgr->GetNode( hstrNodeName );

		if ( pNode )
		{
			m_lstGuardedNodes.push_back( pNode->m_hObject );
			pNode->SetNodeOwner( m_hObject );
		}
		else
		{
			AIASSERT1( 0, m_hObject, "AINodeGuard::Init: Cannot find guarded node \"%s\"", ::ToString( hstrNodeName ));
		}

		FREE_HSTRING( hstrNodeName );
	}
	
	m_lstGuardedNodeNames.clear();
}
예제 #15
0
파일: AICmd.cpp 프로젝트: Arc0re/lithtech
AICmdTail::~AICmdTail()
{
	for ( uint32 iNode = 0 ; iNode < kMaxNodes ; iNode++ )
	{
		FREE_HSTRING(m_ahstrNodes[iNode]);
	}
}
예제 #16
0
void CMusicMgr::DoEvent(Event eEvent)
{
	if ( !m_bEnabled ) return;

	if ( m_bLockedEvent ) return;

	if ( m_acEvents[eEvent] != 0 && (m_afEventChances[eEvent] > GetRandom(0.0, 1.0f)) )
	{
		char szMusic[128];
		uint32 iEvent = GetRandom(0, m_acEvents[eEvent]-1);
		sprintf(szMusic, "MUSIC PM %s %s Beat", m_szTheme, m_aaszEvents[eEvent][iEvent]);

#ifndef _FINAL
		if ( g_ShowMusicTrack.GetFloat() > 0 )
		{
			g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
		}
#endif

		HSTRING hMusic = g_pLTServer->CreateString(szMusic);
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_MUSIC);
		cMsg.WriteHString(hMusic);
		g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
		FREE_HSTRING(hMusic);
	}
}
AIVolume::~AIVolume()
{
	for ( uint32 iViewNode = 0 ; iViewNode < kMaxViewNodes ; iViewNode++ )
	{
		FREE_HSTRING(m_ahstrViewNodes[iViewNode]);
	}
}
예제 #18
0
파일: AIState.cpp 프로젝트: Arc0re/lithtech
CAIState::~CAIState()
{
///	m_pAI->GetSenseMgr()->Clear();

	// It is very strange to destruct a state without an AI.
	// Any constructed State should have Init called to set the pointer.

	AIASSERT( m_pAI, LTNULL, "CAIState::~CAIState: State has NULL m_pAI" );

	FREE_HSTRING(m_hstrReturn);
	FREE_HSTRING(m_hstrFirst);

	for ( int iNext = 0 ; iNext < kMaxNexts ; iNext++ )
	{
		FREE_HSTRING(m_ahstrNexts[iNext]);
	}
}
예제 #19
0
void CAIGoalTalk::HandleStateTalk()
{
	if( m_hstrGesture )
	{
		CAIHumanStateTalk* pTalkState = (CAIHumanStateTalk*)(m_pAI->GetState());
		pTalkState->SetGesture( m_hstrGesture );
		FREE_HSTRING( m_hstrGesture );
	}
}
예제 #20
0
LTBOOL CAIGoalTalk::HandleNameValuePair(const char *szName, const char *szValue)
{
	ASSERT(szName && szValue);

	if( super::HandleNameValuePair(szName, szValue) )
	{
		return LTTRUE;
	}

	if ( !_stricmp(szName, "MOOD") )
	{
		m_eMood = CAnimationMgrList::GetPropFromName( szValue );
		return LTTRUE;
	}

	else if ( !_stricmp(szName, "FACETIME") )
	{
		m_fFaceTime = (LTFLOAT)atof(szValue);
		return LTTRUE;
	}

	// Retrigger tells the AI to retrigger the dialogue object
	// once he is in the radius.

	else if ( !_stricmp(szName, "RETRIGGER") )
	{
		AITRACE( AIShowGoals, ( m_pAI->m_hObject, "CAIGoalTalk: RETRIGGER=1" ) );
		m_bRetriggerDialogue = IsTrueChar(*szValue);
		return LTTRUE;
	}

	// Disposable tells the AI to remove the Talk goal
	// once he is out of the radius.

	else if ( !_stricmp(szName, "DISPOSABLE") )
	{
		AITRACE( AIShowGoals, ( m_pAI->m_hObject, "CAIGoalTalk: DISPOSABLE=1" ) );
		m_bDisposableDialogue = IsTrueChar(*szValue);
		return LTTRUE;
	}

	else if ( !_stricmp(szName, "GESTURE") )
	{
		FREE_HSTRING( m_hstrGesture );
		m_hstrGesture = g_pLTServer->CreateString( szValue );
		return LTTRUE;
	}

	else if ( !_stricmp(szName, "MOVEMENT") )
	{
		m_eMovement = CAnimationMgrList::GetPropFromName( szValue );
		return LTTRUE;
	}

	return LTFALSE;
}
예제 #21
0
파일: Prop.cpp 프로젝트: Arc0re/lithtech
Prop::~Prop()
{
	FREE_HSTRING(m_hstrTouchSound);

	if (m_hTouchSnd)
	{
        g_pLTServer->KillSound(m_hTouchSnd);
        m_hTouchSnd = LTNULL;
	}
}
예제 #22
0
CommandObject::~CommandObject()
{
	EVENT_CMD_LIST::iterator iter;
	EVENT_CMD_STRUCT	*pEvntCmdStruct = LTNULL;

	// Free the allocated list of Event commands...

	for( iter = m_lstEventCmds.begin(); iter != m_lstEventCmds.end(); ++iter )
	{
		pEvntCmdStruct = *iter;

		FREE_HSTRING( pEvntCmdStruct->m_hstrCommand );
		debug_delete( pEvntCmdStruct );
	}

	m_lstEventCmds.clear();

	FREE_HSTRING( m_hstrFinishedCmd );
}
예제 #23
0
void RelationTraits::CIDValue::Load(ILTMessage_Read *pMsg)
{
    const char* szValue;
    HSTRING hValue;

    LOAD_HSTRING( hValue );
    szValue = g_pLTServer->GetStringData(hValue);
    SetValue( szValue );
    FREE_HSTRING( hValue );
}
예제 #24
0
AINodeGuard::~AINodeGuard()
{
	HSTRING hstrNodeName;
	HSTRING_LIST::iterator it;
	for ( it = m_lstGuardedNodeNames.begin(); it != m_lstGuardedNodeNames.end(); ++it )
	{
		hstrNodeName = *it;
		FREE_HSTRING( hstrNodeName );
	}
}
예제 #25
0
void AI_Helicopter::HandleDamage(const DamageStruct& damage)
{
	if ( !m_bExploded )
	{
		CAIVehicle::HandleDamage(damage);

		if ( m_hstrDeath0_3rdMessage && (m_damage.GetHitPoints()/m_damage.GetMaxHitPoints() < 1.0f) )
		{
			g_pCmdMgr->Process(g_pLTServer->GetStringData(m_hstrDeath0_3rdMessage));
			FREE_HSTRING(m_hstrDeath0_3rdMessage);
		}

		if ( m_hstrDeath1_3rdMessage && (m_damage.GetHitPoints()/m_damage.GetMaxHitPoints() < 0.666f) )
		{
			g_pCmdMgr->Process(g_pLTServer->GetStringData(m_hstrDeath1_3rdMessage));
			FREE_HSTRING(m_hstrDeath1_3rdMessage);
		}

		if ( m_hstrDeath2_3rdMessage && (m_damage.GetHitPoints()/m_damage.GetMaxHitPoints() < 0.333f) )
		{
			g_pCmdMgr->Process(g_pLTServer->GetStringData(m_hstrDeath2_3rdMessage));
			FREE_HSTRING(m_hstrDeath2_3rdMessage);
		}

		if ( m_damage.GetHitPoints() <= 0.0f )
		{
			if ( m_hstrDeathMessage )
			{
				g_pCmdMgr->Process(g_pLTServer->GetStringData(m_hstrDeathMessage));
				FREE_HSTRING(m_hstrDeathMessage);
			}

			m_fDeathDelay += g_pLTServer->GetTime();
			m_bExploded = LTTRUE;

			if ( g_pLTServer->GetTime() >= m_fDeathDelay )
			{
				RemoveObject();
			}
		}
	}
}
예제 #26
0
void RelationTraits::CIDValue::Save(ILTMessage_Write *pMsg)
{
    char szValue[256];
    UBER_ASSERT( m_Value.length() < sizeof(szValue)-1, "Attempted to save CIDValue with a length greater than 255" );

    // Convert the std::string to an HSTRING, and save it
    strcpy( szValue, m_Value.c_str() );
    HSTRING hValue = g_pLTServer->CreateString( szValue );
    SAVE_HSTRING( hValue );
    FREE_HSTRING( hValue );
}
GameBase::~GameBase()
{
	RemoveBoundingBox();

	if (m_pMarkList)
	{
        g_pLTServer->RelinquishList(m_pMarkList);
	}

	FREE_HSTRING(m_hstrSave);
}
예제 #28
0
bool ModItem::PostPropRead(ObjectCreateStruct *pStruct)
{
    MOD const *pMod = g_pWeaponMgr->GetMod(m_nModId);
    if( !pMod )
        return false;

    if (pStruct)
    {
        SAFE_STRCPY(pStruct->m_Filename, pMod->szPowerupModel);

        pMod->blrPowerupSkins.CopyList(0, pStruct->m_SkinNames[0], MAX_CS_FILENAME_LEN+1);
        pMod->blrPowerupRenderStyles.CopyList(0, pStruct->m_RenderStyleNames[0], MAX_CS_FILENAME_LEN+1);

        // See if our default model was changed...

        CheckForOverrideModel(pStruct);

        // Set up the appropriate sounds...

        if (pMod->szPickUpSound[0])
        {
            FREE_HSTRING(m_hstrSoundFile);
            m_hstrSoundFile = g_pLTServer->CreateString(pMod->szPickUpSound);
        }

        if (pMod->szRespawnSound[0])
        {
            FREE_HSTRING(m_hstrSoundFile);
            m_hstrSoundFile = g_pLTServer->CreateString(pMod->szRespawnSound);
        }

        m_vScale.Init(pMod->fPowerupScale, pMod->fPowerupScale, pMod->fPowerupScale);

        m_sClientFX = pMod->szPowerupFX;

        m_bRotate = LTFALSE;
    }

    return true;
}
예제 #29
0
void CMusicMgr::Update()
{
	if ( !m_bEnabled ) return;

	if ( m_bLockedMood )
	{
		if ( m_bRestoreMusicIntensity )
		{
			char szMusic[128];
			sprintf(szMusic, "MUSIC I %d measure", m_iRestoreMusicIntensity);

#ifndef _FINAL
			if ( g_ShowMusicTrack.GetFloat() > 0 )
			{
				g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
			}
#endif

			HSTRING hMusic = g_pLTServer->CreateString(szMusic);
			CAutoMessage cMsg;
			cMsg.Writeuint8(MID_MUSIC);
			cMsg.WriteHString(hMusic);
			g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
			FREE_HSTRING(hMusic);

			m_eLastMood = eMoodInvalid;
			m_bRestoreMusicIntensity = LTFALSE;
		}

		return;
	}

	LTBOOL bChoseMood = LTFALSE;

	for ( int32 iMood = kNumMoods-1 ; iMood >= 0 ; --iMood )
	{
		if ( !bChoseMood && (m_afMoods[iMood] != 0.0f || (iMood == eMoodNone)) )
		{
			if ( m_eLastMood == iMood )
			{
				bChoseMood = LTTRUE;
			}
			else
			{
				SetMood(( Mood )iMood );
				bChoseMood = LTTRUE;
			}
		}

		m_afMoods[iMood] = Max<LTFLOAT>(m_afMoods[iMood] - g_pLTServer->GetFrameTime(), 0.0f);
	}
}
예제 #30
0
bool GearItem::PostPropRead(ObjectCreateStruct *pStruct)
{
	GEAR const *pGear = g_pWeaponMgr->GetGear(m_nGearId);
	if( !pGear || pGear->bServerRestricted )
		return false;

	if (pStruct)
	{
		SAFE_STRCPY(pStruct->m_Filename, pGear->szModel);

		pGear->blrSkins.CopyList(0, pStruct->m_SkinNames[0], MAX_CS_FILENAME_LEN+1);
		pGear->blrRenderStyles.CopyList(0, pStruct->m_RenderStyleNames[0], MAX_CS_FILENAME_LEN+1);

		// See if our default model was changed...

		CheckForOverrideModel(pStruct);

		// Set up the appropriate sounds...

		if (pGear->szPickUpSound[0])
		{
			FREE_HSTRING(m_hstrSoundFile);
			m_hstrSoundFile = g_pLTServer->CreateString(pGear->szPickUpSound);
		}

		if (pGear->szRespawnSound[0])
		{
			FREE_HSTRING(m_hstrRespawnSoundFile);
			m_hstrRespawnSoundFile = g_pLTServer->CreateString(pGear->szRespawnSound);
		}

		m_sClientFX = pGear->szPowerupFX;

        m_bRotate = LTFALSE;
	}

	return true;
}