void GameBase::MakeTransitionable( ) { // Only want one per object ASSERT( m_pTransAgg == NULL ); // Create it and add it... m_pTransAgg = s_bankCTransAggs.New(); if( !m_pTransAgg ) { g_pLTServer->CPrint( "new TransAgg FAILED!!!" ); return; } AddAggregate( (LPAGGREGATE)m_pTransAgg ); }
void GameBase::DestroyTransitionAggregate( ) { if( !m_pTransAgg ) return; #ifndef _FINAL CTransitionAggregate *pIAgg = dynamic_cast<CTransitionAggregate*>(m_pTransAgg); if( !pIAgg ) { g_pLTServer->CPrint( "NOT a CTransitionAggregate!!!" ); return; } #endif RemoveAggregate( (LPAGGREGATE)m_pTransAgg ); s_bankCTransAggs.Delete( m_pTransAgg ); m_pTransAgg = NULL; }
CBaseFX* fxCreatePlayRandomSound() { return g_PlayRandomSoundFX_Bank.New(); }
CBaseFX* fxCreatePolyTube() { return g_PolyTubeFX_Bank.New(); }
CBaseFX* fxCreateNull() { return g_NullFX_Bank.New(); }
CBaseFX* fxCreateLTBBouncyChunk() { return g_LTBBouncyChunkFX_Bank.New(); }
CAnimationContext* CAnimationMgr::CreateAnimationContext(HOBJECT hObject) { CAnimationContext* pAnimationContext = s_bankCAnimationContext.New(); pAnimationContext->Init(m_cAnimations, m_cTransitions); pAnimationContext->m_pAnimationMgr = this; pAnimationContext->m_hObject = hObject; for ( uint32 iAnimation = 0 ; iAnimation < m_cAnimations ; iAnimation++ ) { pAnimationContext->m_aAnimationInstances[iAnimation].m_iIndex = iAnimation; HMODELANIM hAni = GetAnimationInstance(hObject, m_aAnimations[iAnimation].m_szName); pAnimationContext->m_aAnimationInstances[iAnimation].m_hAni = hAni; if ( INVALID_MODEL_ANIM == hAni ) { //g_pLTServer->CPrint("Could not find animation: %s", m_aAnimations[iAnimation].m_szName); } // Check for pitched pair of ani char szNamePitched[128]; HMODELANIM hAniPitchDown; sprintf(szNamePitched, "%s*d", m_aAnimations[iAnimation].m_szName); hAniPitchDown = GetAnimationInstance(hObject, szNamePitched); pAnimationContext->m_aAnimationInstances[iAnimation].m_hAniPitchDown = hAniPitchDown; HMODELANIM hAniPitchUp; sprintf(szNamePitched, "%s*u", m_aAnimations[iAnimation].m_szName); hAniPitchUp = GetAnimationInstance(hObject, szNamePitched); pAnimationContext->m_aAnimationInstances[iAnimation].m_hAniPitchUp = hAniPitchUp; pAnimationContext->m_aAnimationInstances[iAnimation].m_bPitched = (INVALID_MODEL_ANIM != hAniPitchDown && INVALID_MODEL_ANIM != hAniPitchUp); if ( pAnimationContext->m_aAnimationInstances[iAnimation].m_bPitched ) { // g_pLTServer->CPrint("animation ''%s'' is pitched", m_aAnimations[iAnimation].GetName()); } } for ( uint32 iTransition = 0 ; iTransition < m_cTransitions ; iTransition++ ) { pAnimationContext->m_aTransitionInstances[iTransition].m_iIndex = iTransition; HMODELANIM hAni = GetAnimationInstance(hObject, m_aTransitions[iTransition].m_szName); pAnimationContext->m_aTransitionInstances[iTransition].m_hAni = hAni; if ( INVALID_MODEL_ANIM == hAni ) { //g_pLTServer->CPrint("Could not find transition: %s", m_aTransitions[iTransition].m_szName); } } pAnimationContext->m_fPitchTarget = 0.5f; pAnimationContext->m_fPitch = 0.5f; if ( LT_OK != g_pModelLT->AddTracker(hObject, &pAnimationContext->m_trkPitchDown) ) _ASSERT(LTFALSE); if ( LT_OK != g_pModelLT->AddTracker(hObject, &pAnimationContext->m_trkPitchUp) ) _ASSERT(LTFALSE); for ( uint32 iPitchWeightset = 0 ; iPitchWeightset < CAnimationContext::kNumPitchWeightsets ; iPitchWeightset++ ) { char szPitchWeightset[512]; LTFLOAT fWeightsetAmount = 100.0f/(LTFLOAT)(CAnimationContext::kNumPitchWeightsets-1); sprintf(szPitchWeightset, "Morph%d", (int32)(iPitchWeightset*fWeightsetAmount)); if ( LT_OK != g_pModelLT->FindWeightSet(hObject, szPitchWeightset, pAnimationContext->m_ahPitchWeightsets[iPitchWeightset]) ) { // g_pLTServer->CPrint("could not find pitch weightset %s", szPitchWeightset); } } pAnimationContext->DisablePitch(); return pAnimationContext; }
CBaseFX* fxCreateFlareSpriteFX() { return g_FlareSpriteFX_Bank.New(); }
CBaseFX* fxCreateLTBModel() { return g_LTBModelFX_Bank.New(); }
CBaseFX* fxCreateSprite() { return g_SpriteFX_Bank.New(); }
CBaseFX* fxCreateParticleSystem() { return g_ParticleSystemFX_Bank.New(); }
__declspec(dllexport) void fxDelete(CBaseFX *pDeleteFX) { // Figure out what kind of FX we are deleting and make sure the propper bank handles it... switch( pDeleteFX->GetFXType() ) { case CBaseFX::eParticleSystemFX : { g_ParticleSystemFX_Bank.Delete( (CParticleSystemFX*)pDeleteFX ); } break; case CBaseFX::eSpriteFX : { g_SpriteFX_Bank.Delete( (CSpriteFX*)pDeleteFX ); } break; case CBaseFX::eLTBModelFX : { g_LTBModelFX_Bank.Delete( (CLTBModelFX*)pDeleteFX ); } break; case CBaseFX::eDynaLightFX : { g_DynaLightFX_Bank.Delete( (CDynaLightFX*)pDeleteFX ); } break; case CBaseFX::ePlaySoundFX : { g_PlaySoundFX_Bank.Delete( (CPlaySoundFX*)pDeleteFX ); } break; case CBaseFX::eCamJitterFX : { g_CamJitterFX_Bank.Delete( (CCamJitterFX*)pDeleteFX ); } break; case CBaseFX::eCamWobbleFX : { g_CamWobbleFX_Bank.Delete( (CCamWobbleFX*)pDeleteFX ); } break; case CBaseFX::eLTBBouncyChunkFX : { g_LTBBouncyChunkFX_Bank.Delete( (CLTBBouncyChunkFX*)pDeleteFX ); } break; case CBaseFX::eNullFX : { g_NullFX_Bank.Delete( (CNullFX*)pDeleteFX ); } break; case CBaseFX::ePolyTubeFX : { g_PolyTubeFX_Bank.Delete( (CPolyTubeFX*)pDeleteFX ); } break; case CBaseFX::ePlayRandomSoundFX : { g_PlayRandomSoundFX_Bank.Delete( (CPlayRandomSoundFX*)pDeleteFX ); } break; case CBaseFX::eSpriteSystem : { g_SpriteSystem_Bank.Delete( (CSpriteSystem*)pDeleteFX ); } break; case CBaseFX::eCreateFX : { g_CreateFX_Bank.Delete( (CCreateFX*)pDeleteFX ); } break; case CBaseFX::eFlareSpriteFX : { g_FlareSpriteFX_Bank.Delete( (CFlareSpriteFX*)pDeleteFX ); } break; case CBaseFX::eLightningFX : { g_LightningFX_Bank.Delete( (CLightningFX*)pDeleteFX ); } break; default: { // We should never be getting here! ASSERT( LTFALSE ); } break; } }
CSpecialFX* CSFXMgr::CreateSFX(uint8 nId, SFXCREATESTRUCT *psfxCreateStruct, ILTMessage_Read *pMsg, HOBJECT hServerObj) { CSpecialFX* pSFX = NULL; switch (nId) { case SFX_WEAPON_ID : { pSFX = &s_WeaponFX; } break; case SFX_PLAYERLURE_ID : { pSFX = debug_new( PlayerLureFX ); } break; case SFX_PLAYERSOUND_ID : { pSFX = g_SFXBank_PlayerSound.New(); } break; case SFX_PROJECTILE_ID : { pSFX = g_SFXBank_Projectile.New(); } break; case SFX_SEARCHLIGHT_ID : { pSFX = g_SFXBank_SearchLight.New(); } break; case SFX_MARK_ID : { pSFX = g_SFXBank_Mark.New(); } break; case SFX_SHELLCASING_ID : { pSFX = g_SFXBank_ShellCasing.New(); } break; case SFX_CAMERA_ID : { pSFX = g_SFXBank_Camera.New(); if (pSFX) { if (pSFX->Init(psfxCreateStruct)) { if (g_pLTClient->IsConnected()) { if (pSFX->CreateObject(g_pLTClient)) { m_cameraSFXList.Add(pSFX); } else { DeleteSFX(pSFX); pSFX = NULL; } } else { DeleteSFX(pSFX); pSFX = NULL; } } } return pSFX; } break; case SFX_POLYGRID_ID : { pSFX = g_SFXBank_PolyGrid.New(); } break; case SFX_RENDERTARGET_ID : { pSFX = g_SFXBank_RenderTarget.New(); } break; case SFX_RENDERTARGETGROUP_ID : { pSFX = g_SFXBank_RenderTargetGroup.New(); } break; case SFX_EXPLOSION_ID : { pSFX = g_SFXBank_Explosion.New(); } break; case SFX_VOLUMEBRUSH_ID : { pSFX = g_SFXBank_VolumeBrush.New(); } break; case SFX_PICKUPITEM_ID : { pSFX = g_SFXBank_PickupItem.New(); } break; case SFX_AIMMAGNET_ID : { pSFX = g_SFXBank_AimMagnet.New(); } break; case SFX_NAVMARKER_ID : { pSFX = g_SFXBank_NavMarker.New(); } break; case SFX_LADDER_ID : { pSFX = g_SFXBank_Ladder.New(); } break; case SFX_SPECIALMOVE_ID : { pSFX = g_SFXBank_SpecialMove.New(); } break; case SFX_FINISHINGMOVE_ID : { pSFX = g_SFXBank_FinishingMove.New(); } break; case SFX_CHARACTER_ID : { pSFX = g_SFXBank_Character.New(); } break; case SFX_DEBUGLINE_ID: { pSFX = g_SFXBank_DebugLine.New(); } break; case SFX_SNOW_ID: { pSFX = g_SFXBank_Snow.New(); } break; case SFX_JUMPVOLUME_ID: { pSFX = g_SFXBank_JumpVolume.New(); } break; case SFX_DYNAMIC_SECTOR_ID: { pSFX = g_SFXBank_DynamicSectorVolume.New(); } break; case SFX_SCATTER_ID: { pSFX = g_SFXBank_Scatter.New(); } break; case SFX_TRIGGER_ID: { pSFX = g_SFXBank_Trigger.New(); } break; case SFX_FORENSICOBJECT_ID : { pSFX = g_SFXBank_ForensicObject.New(); } break; case SFX_TURRET_ID: { pSFX = g_SFXBank_Turret.New( ); } break; case SFX_TEAMCLIENTFX_ID: { pSFX = g_SFXBank_TeamClientFx.New( ); } break; case SFX_CTFFLAGBASE_ID: { LT_MEM_TRACK_ALLOC(pSFX = new CTFFlagBaseSFX, LT_MEM_TYPE_GAMECODE); } break; case SFX_CTFFLAG_ID: { LT_MEM_TRACK_ALLOC(pSFX = new CTFFlagSFX, LT_MEM_TYPE_GAMECODE); } break; case SFX_CONTROLPOINT_ID: { LT_MEM_TRACK_ALLOC(pSFX = new ControlPointSFX, LT_MEM_TYPE_GAMECODE); } break; case SFX_SOUND_NONPOINT_ID : { pSFX = g_SFXBank_SoundNonPoint.New(); } break; case SFX_VOLUMETRICLIGHT_ID : { pSFX = g_SFXBank_VolumetricLight.New(); } break; case SFX_ENTRYTOOLLOCK_ID : { pSFX = g_SFXBank_EntryToolLock.New(); } break; case SFX_SCREENEFFECT_ID : { pSFX = g_SFXBank_ScreenEffect.New(); } break; case SFX_ACTIVATEOBJECT_ID: { pSFX = g_SFXBank_ActivateObject.New(); } break; case SFX_PHYSICS_CONSTRAINT_ID: { pSFX = g_SFXBank_PhysicsConstraintFX.New( ); } break; case SFX_PHYSICS_COLLISION_SYSTEM_ID: { pSFX = g_SFXBank_PhysicsCollisionSystemFX.New( ); } break; default : return NULL; break; } // Initialize the sfx, and add it to the appropriate array... if (!pSFX) return NULL; // First initialize with the create struct... if (psfxCreateStruct) { if (!pSFX->Init(psfxCreateStruct)) { DeleteSFX(pSFX); return NULL; } } else if (pMsg) // Initialize using the hMessage { if (!pSFX->Init(hServerObj, pMsg)) { DeleteSFX(pSFX); return NULL; } } else { DeleteSFX(pSFX); return NULL; } if (!pSFX->CreateObject(g_pLTClient)) { DeleteSFX(pSFX); return NULL; } if( !AddDynamicSpecialFX(pSFX, nId)) { DeleteSFX( pSFX ); return NULL; } return pSFX; }
void CSFXMgr::DeleteSFX(CSpecialFX* pFX) { // Make sure we've got a valid pointer if (!pFX) return; // Make sure we don't try to delete the static fx(s)... if (pFX == &s_WeaponFX) return; // Alrighty, get the ID from the effect... switch(pFX->GetSFXID()) { // Delete it from the right place... case SFX_PLAYERSOUND_ID : { g_SFXBank_PlayerSound.Delete((CPlayerSoundFX*)pFX); } break; case SFX_MARK_ID : { g_SFXBank_Mark.Delete((CMarkSFX*)pFX); } break; case SFX_SHELLCASING_ID : { g_SFXBank_ShellCasing.Delete((CShellCasingFX*)pFX); } break; case SFX_PROJECTILE_ID : { g_SFXBank_Projectile.Delete((CProjectileFX*)pFX); } break; case SFX_CAMERA_ID : { g_SFXBank_Camera.Delete((CCameraFX*)pFX); } break; case SFX_POLYGRID_ID : { g_SFXBank_PolyGrid.Delete((CPolyGridFX*)pFX); } break; case SFX_RENDERTARGET_ID : { g_SFXBank_RenderTarget.Delete((CRenderTargetFX*)pFX); } break; case SFX_RENDERTARGETGROUP_ID : { g_SFXBank_RenderTargetGroup.Delete((CRenderTargetGroupFX*)pFX); } break; case SFX_EXPLOSION_ID : { g_SFXBank_Explosion.Delete((CExplosionFX*)pFX); } break; case SFX_VOLUMEBRUSH_ID : { g_SFXBank_VolumeBrush.Delete((CVolumeBrushFX*)pFX); } break; case SFX_CHARACTER_ID : { g_SFXBank_Character.Delete((CCharacterFX*)pFX); } break; case SFX_SEARCHLIGHT_ID : { g_SFXBank_SearchLight.Delete((CSearchLightFX*)pFX); } break; case SFX_PICKUPITEM_ID : { g_SFXBank_PickupItem.Delete((CPickupItemFX*)pFX); } break; case SFX_AIMMAGNET_ID : { g_SFXBank_AimMagnet.Delete((CAimMagnetFX*)pFX); } break; case SFX_NAVMARKER_ID : { g_SFXBank_NavMarker.Delete((CNavMarkerFX*)pFX); } break; case SFX_LADDER_ID : { g_SFXBank_Ladder.Delete((CLadderFX*)pFX); } break; case SFX_SPECIALMOVE_ID : { g_SFXBank_SpecialMove.Delete((CSpecialMoveFX*)pFX); } break; case SFX_FINISHINGMOVE_ID : { g_SFXBank_FinishingMove.Delete((CFinishingMoveFX*)pFX); } break; case SFX_DEBUGLINE_ID : { g_SFXBank_DebugLine.Delete((CDebugLineFX*)pFX); } break; case SFX_SNOW_ID : { g_SFXBank_Snow.Delete((CSnowFX*)pFX); } break; case SFX_JUMPVOLUME_ID : { g_SFXBank_JumpVolume.Delete((CJumpVolumeFX*)pFX); } break; case SFX_DYNAMIC_SECTOR_ID : { g_SFXBank_DynamicSectorVolume.Delete((CDynamicSectorVolumeFX*)pFX); } break; case SFX_SCATTER_ID : { g_SFXBank_Scatter.Delete((CScatterFX*)pFX); } break; case SFX_TRIGGER_ID : { g_SFXBank_Trigger.Delete((CTriggerFX*)pFX); } break; case SFX_FORENSICOBJECT_ID : { g_SFXBank_ForensicObject.Delete((CForensicObjectFX*)pFX); } break; case SFX_TURRET_ID: { g_SFXBank_Turret.Delete( (CTurretFX*)pFX ); } break; case SFX_TEAMCLIENTFX_ID: { g_SFXBank_TeamClientFx.Delete( (TeamClientFXSFX*)pFX ); } break; case SFX_CTFFLAGBASE_ID: case SFX_CTFFLAG_ID: case SFX_CONTROLPOINT_ID: { delete pFX; } break; case SFX_SOUND_NONPOINT_ID: { g_SFXBank_SoundNonPoint.Delete( (CSoundNonPointFX*)pFX ); } break; case SFX_VOLUMETRICLIGHT_ID: { g_SFXBank_VolumetricLight.Delete( (CVolumetricLightFX*)pFX ); } break; case SFX_ENTRYTOOLLOCK_ID: { g_SFXBank_EntryToolLock.Delete( (CEntryToolLockFX*)pFX ); } break; case SFX_SCREENEFFECT_ID: { g_SFXBank_ScreenEffect.Delete( (CScreenEffectFX*)pFX ); } break; case SFX_ACTIVATEOBJECT_ID : { g_SFXBank_ActivateObject.Delete( (CActivateObjectFX*)pFX); } break; case SFX_PHYSICS_CONSTRAINT_ID: { g_SFXBank_PhysicsConstraintFX.Delete( (CPhysicsConstraintFX*)pFX ); } break; case SFX_PHYSICS_COLLISION_SYSTEM_ID: { g_SFXBank_PhysicsCollisionSystemFX.Delete( (CPhysicsCollisionSystemFX*)pFX ); } break; // Ok, it's not a banked effect default: { debug_delete(pFX); } break; } }
CBaseFX* fxCreateSpriteSystem() { return g_SpriteSystem_Bank.New(); }
CBaseFX* fxCreateCreateFX() { return g_CreateFX_Bank.New(); }
CBaseFX* fxCreateDynaLight() { return g_DynaLightFX_Bank.New(); }
CBaseFX* fxCreateLightningFX() { return g_LightningFX_Bank.New(); }
CBaseFX* fxCreateCamJitter() { return g_CamJitterFX_Bank.New(); }
void CAnimationMgr::DestroyAnimationContext(CAnimationContext* pAnimationContext) { pAnimationContext->Term(); s_bankCAnimationContext.Delete(pAnimationContext); }
CBaseFX* fxCreateCamWobble() { return g_CamWobbleFX_Bank.New(); }