RotatingWorldModel::RotatingWorldModel() : GameBase(OT_WORLDMODEL) { AddAggregate(&m_damage); m_hstrSpinUpSound = LTNULL; m_hstrBusySound = LTNULL; m_hstrSpinDownSound = LTNULL; m_fSoundRadius = 1000.0f; m_sndLastSound = LTNULL; m_bBoxPhysics = LTTRUE; VEC_INIT(m_vVelocity); VEC_INIT(m_vSaveVelocity); VEC_INIT(m_vSpinUpTime); VEC_INIT(m_vSpinDownTime); VEC_INIT(m_vSpinTimeLeft); VEC_SET(m_vSign, 1.0f, 1.0f, 1.0f); m_fLastTime = 0.0f; m_fStartTime = 0.0f; m_eState = RWM_NORMAL; m_fPitch = 0.0f; m_fYaw = 0.0f; m_fRoll = 0.0f; m_hShadowLightsString = NULL; m_nLightAnims = 0; m_nShadowAxis = 0; m_bFirstUpdate = LTTRUE; }
LightFX::LightFX() : BaseClass(OT_LIGHT) { AddAggregate(&m_damage); m_bOn = DTRUE; m_nNumColorCycles = 0; // Number of times to cycle through VEC_INIT(m_vCurrentColor); VEC_INIT(m_vColor1); VEC_INIT(m_vColor2); VEC_INIT(m_vColor3); m_fRedValue = 1.0f; m_fGreenValue = 1.0f; m_fBlueValue = 1.0f; m_nNumIntensityCycles = 0; // Number of times to cycle through m_fIntensityMin = 0.5f; m_fIntensityMax = 1.0f; m_fIntensityMinTime = 0.0f; m_fIntensityMaxTime = 0.0f; m_fIntensityRampUpTime = 0.0f; m_fIntensityRampDownTime = 0.0f; m_nNumRadiusCycles = 0; // Number of times to cycle through m_fRadiusMin = 500.0f; // default Radius m_fRadiusMax = 0.0f; m_fRadiusMinTime = 0.0f; m_fRadiusMaxTime = 0.0f; m_fRadiusRampUpTime = 0.0f; m_fRadiusRampDownTime = 0.0f; m_fLifeTime = -1.0f; m_vColor1.x = m_vColor1.y = m_vColor1.z = 255.0f; m_vColor2.x = m_vColor2.y = m_vColor2.z = 255.0f; m_vColor3.x = m_vColor3.y = m_vColor3.z = 255.0f; m_fCurrentRadius = 0.0f; m_fIntensityTime = 0.0f; m_fRadiusTime = 0.0f; m_fColorTime = 0.0f; m_nCurIntensityState = 0; m_nCurRadiusState = 0; m_nCurColorUsed = 0; m_fStartTime = 0.0f; m_bDynamic = DTRUE; m_hstrRampUpSound = DNULL; m_hstrRampDownSound = DNULL; m_fHitPts = 1.0f; }
Rotating::Rotating() : Aggregate() { m_hObject = DNULL; m_hstrSpinUpSound = DNULL; m_hstrBusySound = DNULL; m_hstrSpinDownSound = DNULL; m_fSoundRadius = 1000.0f; m_sndLastSound = DNULL; VEC_INIT(m_vVelocity); VEC_INIT(m_vSaveVelocity); VEC_INIT(m_vSpinUpTime); VEC_INIT(m_vSpinDownTime); VEC_INIT(m_vSpinTimeLeft); VEC_SET(m_vSign, 1.0f, 1.0f, 1.0f); m_fLastTime = 0.0f; m_fStartTime = 0.0f; m_eState = RWM_OFF; m_fPitch = 0.0f; m_fYaw = 0.0f; m_fRoll = 0.0f; }
CDestructable::CDestructable() : Aggregate() { m_hObject = DNULL; // pOwner = DNULL; m_bDead = DFALSE; m_bApplyDamagePhysics = DTRUE; m_fMass = 1.0; m_fHitPoints = 1; m_fDeathHitPoints = 1; m_fMaxHitPoints = 1; m_fMaxMegaHitPoints = 1; m_fArmorPoints = 0.0; m_fMaxArmorPoints = 1.0; m_fMaxNecroArmorPoints = 1.0; m_fResistance = 1.0; m_nLastDamageType = DAMAGE_TYPE_NORMAL; m_fLastDamagePercent = 0.0f; m_fLastDamageAmount = 0.0f; VEC_INIT(m_vLastDamageDirection); m_hstrDamageTriggerTarget = DNULL; m_hstrDamageTriggerMessage = DNULL; m_hstrDeathTriggerTarget = DNULL; m_hstrDeathTriggerMessage = DNULL; m_hstrSpawnObject = DNULL; VEC_INIT(m_vSpawnObjectVel); m_bGodMode = DFALSE; m_bNighInvulnerable = DFALSE; m_hWhoKilledMeLast = DNULL; m_bTriggerOnly = DFALSE; m_fDeathDelay = 0.0f; m_Link.m_pData = DNULL; if( m_dwNumDestructables == 0 ) { dl_TieOff( &m_DestructableHead ); } m_hLastDamager = DNULL; m_nNodeHit = 0; m_nSideHit = 0; // Init these [gk] m_pInventoryMgr = DNULL; m_pAnim_Sound = DNULL; m_bAddVelocity = DFALSE; VEC_INIT(m_vAddVelocity); m_bDestructable = DTRUE; }
DBOOL UpdateMovingObject(PhysicsState *pUserState, MovingObject *pObject, DVector *pNewPos) { if (!pObject || !pNewPos) return DFALSE; PhysicsState* pState = pUserState ? pUserState : GetCurPhysicsState(pObject); if (!pState) return DFALSE; DVector vTemp, velocityDelta, posDelta; if(pObject->m_PhysicsFlags & MO_RESTING) return DFALSE; // Prevent tiny movements. if(VEC_MAGSQR(pObject->m_Acceleration) < 0.01f) { VEC_INIT(pObject->m_Acceleration); } if(VEC_MAGSQR(pObject->m_Velocity) < 0.01f) { VEC_INIT(pObject->m_Velocity); } // velocityDelta = ( acceleration + accelDelta * 0.5 ) * dt; VEC_INIT(vTemp); if (!(pObject->m_PhysicsFlags & MO_NOGRAVITY)) { DFLOAT fScale = 0.5f; if (pObject->m_PhysicsFlags & MO_HALFGRAVITY) { fScale = 0.20f; } VEC_MULSCALAR(vTemp, pState->m_GravityAccel, fScale); } VEC_ADD(vTemp, vTemp, pObject->m_Acceleration); VEC_MULSCALAR(velocityDelta, vTemp, pState->m_TimeStep); // Apply the velocity to the position (p = p + vt + 0.5a(t^2)). VEC_MULSCALAR(posDelta, pObject->m_Acceleration, pState->m_TimeStepIntegral); VEC_ADDSCALED(posDelta, posDelta, pObject->m_Velocity, pState->m_TimeStep); // Add the final velocity to the new velocity. VEC_ADD(pObject->m_Velocity, pObject->m_Velocity, velocityDelta); if(!pNewPos) pNewPos = &pObject->m_Pos; VEC_ADD(*pNewPos, pObject->m_Pos, posDelta); // Zero out the acceleration. VEC_INIT(pObject->m_Acceleration); return DTRUE; }
CParticleSystemFX::CParticleSystemFX() : CBaseParticleSystemFX() { m_bFirstUpdate = LTTRUE; m_fLastTime = 0.0f; m_fNextUpdate = 0.01f; VEC_INIT(m_vMinOffset); VEC_INIT(m_vMaxOffset); VEC_INIT(m_vMinVel); VEC_INIT(m_vMaxVel); m_dwLastFrameUserFlags = USRFLG_VISIBLE; }
DBOOL CameraObj::Update() { if (!g_pServerDE) return DFALSE; g_pServerDE->SetNextUpdate(m_hObject, 0.01f); // Need to check if Camera has Moved... // If so, we need to change the Line... // and Send new camera position // // Might have to send a pan up, pan down, pan direction, because of client/server slow down. // That way all the updates are done on the client. // if (g_pServerDE->GetVarValueFloat(g_pServerDE->GetGameConVar("DebugCutScene")) == 1.0f) // { // DisplayRay(); // } // If we are linked then check to make sure the Link has not moved... if (m_hLinkObject) { DVector vPos, vMyPos; VEC_INIT(vPos); VEC_INIT(vMyPos); // From this Point g_pServerDE->GetObjectPos(m_hObject, &vMyPos); // To this Point g_pServerDE->GetObjectPos(m_hLinkObject, &vPos); DVector vF, vU; VEC_SUB(vF, vPos, vMyPos); VEC_SET(vU, 0, 1, 0); DRotation rMyNewRot; g_pServerDE->AlignRotation(&rMyNewRot, &vF, &vU); g_pServerDE->SetObjectRotation(m_hObject, &rMyNewRot); } // Deactivate if the active time has expired. if (m_fActiveTime > 0 && g_pServerDE->GetTime() > m_fDeactivateTime) SetActive(DFALSE); return DTRUE; }
Rain::Rain() : CClientSFX() { m_dwFlags = 0; m_fDensity = 0.0f; VEC_INIT(m_vDims); m_fLifetime = 1.0f; m_bGravity = DTRUE; m_fParticleScale = 1.0f; m_bTriggered = DFALSE; VEC_INIT(m_vDirection); VEC_SET(m_vColor1, 200.0f, 255.0f, 255.0f); VEC_SET(m_vColor2, 40.0f, 50.0f, 50.0f); m_fTimeLimit = 0.0f; m_fPulse = 0.0f; }
CSnowFX::CSnowFX() : CSpecialFX() { VEC_INIT( m_vDims ); m_fDensity = 512.0f; m_fParticleRadius = 1.0f * 2.0f; m_fFallRate = 80.0f; m_fTumbleRate = 180.0f / 360.0f; m_fTumbleRadius = 5.0f; m_fMaxDrawDist = 1024.0f; m_fMaxDrawDistSq = 1024.0f * 1024.0f; m_nAmbientColor = 0x00ffffff; m_bUseLighting = false; m_bUseSaturate = true; m_hstrTextureName = LTNULL; m_nInternalTime = 0; m_nNumAirspaces = 0; m_pAirspaces = NULL; m_bEnabled = true; m_fDensityScale = 1.0f; m_fParticleSizeScale = 1.0f; // allocate a few particles now just to initialize the table so we don't get a possible framerate hitch later CSnowFXParticle* tmpParticles; if( m_ParticleMgr.AllocateParticles( 10, tmpParticles ) ) m_ParticleMgr.FreeParticles( tmpParticles ); }
PathListData::PathListData() { VEC_INIT(m_vPos); m_hstrName = DNULL; m_hstrActionTarget = DNULL; m_hstrActionMessage = DNULL; }
Explosion::Explosion() : B2BaseClass() { m_hstrSkinName = DNULL; m_hstrModelName = DNULL; m_hstrSound = DNULL; m_fSoundRadius = 1000.0f; m_fDamageRadius = 200.0f; m_fMaxDamage = 50.0f; m_fMinScale = 0.1f; m_fMaxScale = 1.0f; m_fDuration = 1.5f; m_bCreateSmoke = DTRUE; m_hModel = DNULL; m_fLastDamageTime = 0.0f; m_bCreateLight = DTRUE; m_hLight = DNULL; m_hShockwave = DNULL; m_fMinLightRadius = 100.0f; m_fMaxLightRadius = 300.0f; VEC_SET(m_vLightColor, 1.0f, 0.5f, 0.0f); m_bCreateShockwave = DTRUE; m_hstrShockwaveSprite = DNULL; VEC_SET(m_vShockwaveScaleMin, 0.1f, 0.1f, 1.0f); VEC_SET(m_vShockwaveScaleMax, 1.0f, 1.0f, 1.0f); m_fShockwaveDuration = 0.0f; m_bCreateMark = DFALSE; m_bAddSparks = DFALSE; m_fStartTime = 0.0f; m_fDelay = 0.0f; m_bFirstUpdate = DFALSE; VEC_INIT(m_vRotation); }
Body::Body() : Prop() { VEC_INIT(m_vColor); VEC_SET(m_vDeathDir, 0.0f, -1.0f, 0.0f); m_eDeathType = CD_NORMAL; m_bFirstUpdate = LTTRUE; m_fStartTime = 0.0f; m_eDamageType = DT_UNSPECIFIED; m_eBodyStatePrevious= eBodyStateNormal; m_eModelNodeLastHit = eModelNodeInvalid; m_pAttachments = LTNULL; m_hHitBox = LTNULL; m_eBodyState = eBodyStateNormal; m_pState = LTNULL; m_bMoveToFloor = LTFALSE; m_fLifetime = -1.0f; m_hWeaponItem = LTNULL; m_hChecker = LTNULL; m_cSpears = 0; memset(m_ahSpears, 0, sizeof(HOBJECT)*kMaxSpears); }
void Trigger::AttachToObject() { CServerDE* pServerDE = GetServerDE(); if (!pServerDE || !m_hstrAttachToObject) return; char* pObjName = pServerDE->GetStringData(m_hstrAttachToObject); if (!pObjName) return; // Find object to attach to... HOBJECT hObj = DNULL; ObjectList* pList = pServerDE->FindNamedObjects(pObjName); if (!pList) return; if (pList->m_pFirstLink) { hObj = pList->m_pFirstLink->m_hObject; } if (!hObj) return; DVector vOffset; VEC_INIT(vOffset); DRotation rOffset; ROT_INIT(rOffset); HATTACHMENT hAttachment; pServerDE->CreateAttachment(hObj, m_hObject, DNULL, &vOffset, &rOffset, &hAttachment); }
CPlayerObj* CTO2GameServerShell::CreatePlayer(HCLIENT hClient, ModelId ePlayerModelId ) { ObjectCreateStruct theStruct; INIT_OBJECTCREATESTRUCT(theStruct); theStruct.m_Rotation.Init(); VEC_INIT(theStruct.m_Pos); theStruct.m_Flags = 0; HCLASS hClass = g_pLTServer->GetClass("CPlayerObj"); GameStartPoint* pStartPoint = FindStartPoint(LTNULL); if (pStartPoint) { g_pLTServer->GetObjectPos(pStartPoint->m_hObject, &(theStruct.m_Pos)); } CPlayerObj* pPlayer = NULL; if (hClass) { theStruct.m_UserData = ePlayerModelId; //pStartPoint->GetPlayerModelId(); pPlayer = (CPlayerObj*) g_pLTServer->CreateObject(hClass, &theStruct); } return pPlayer; }
bool test_vector() { Vector init; bool test_result = true; // true == passed init.v[0] = 0.0f; VEC_INIT(init); CHECK(init.v[0] == 0.0f, "test_vector: INIT failed\n"); CHECK(init.v[1] == 0.0f, "test_vector: INIT failed\n"); CHECK(init.v[2] == 0.0f, "test_vector: INIT failed\n"); CHECK(init.v[3] == 0.0f, "test_vector: INIT failed\n"); CHECK(init.vec.x == 0.0f, "test_vector: INIT failed\n"); CHECK(init.vec.y == 0.0f, "test_vector: INIT failed\n"); CHECK(init.vec.z == 0.0f, "test_vector: INIT failed\n"); CHECK(init.vec.w == 0.0f, "test_vector: INIT failed\n"); CHECK(init.col.r == 0.0f, "test_vector: INIT failed\n"); CHECK(init.col.g == 0.0f, "test_vector: INIT failed\n"); CHECK(init.col.b == 0.0f, "test_vector: INIT failed\n"); CHECK(init.col.a == 0.0f, "test_vector: INIT failed\n"); init.v[0] = 1.0f; init.v[1] = 2.0f; init.v[2] = 3.0f; init.v[3] = 4.0f; CHECK(init.vec.x == 1.0f, "test_vector: union test failed\n"); CHECK(init.vec.y == 2.0f, "test_vector: union test failed\n"); CHECK(init.vec.z == 3.0f, "test_vector: union test failed\n"); CHECK(init.vec.w == 4.0f, "test_vector: union test failed\n"); CHECK(init.col.r == 1.0f, "test_vector: union test failed\n"); CHECK(init.col.g == 2.0f, "test_vector: union test failed\n"); CHECK(init.col.b == 3.0f, "test_vector: union test failed\n"); CHECK(init.col.a == 4.0f, "test_vector: union test failed\n"); VEC_ASSIGN(init, 5.0f, 6.0f, 7.0f, 8.0f); CHECK(init.v[0] == 5.0f, "test_vector: VEC_ASSIGN failed\n"); CHECK(init.v[1] == 6.0f, "test_vector: VEC_ASSIGN failed\n"); CHECK(init.v[2] == 7.0f, "test_vector: VEC_ASSIGN failed\n"); CHECK(init.v[3] == 8.0f, "test_vector: VEC_ASSIGN failed\n"); Vector second; VEC_ASSIGN(second, 9.0f, 10.0f, 11.0f, 12.0f); Vector result; VEC_ADD(result, init, second); CHECK(result.v[0] == 14.0f, "test_vector: VEC_ADD failed\n"); CHECK(result.v[1] == 16.0f, "test_vector: VEC_ADD failed\n"); CHECK(result.v[2] == 18.0f, "test_vector: VEC_ADD failed\n"); CHECK(result.v[3] == 20.0f, "test_vector: VEC_ADD failed\n"); return test_result; }
VolumeBrush::VolumeBrush() : GameBase(OT_CONTAINER) { m_nSfxMsgId = SFX_VOLUMEBRUSH_ID; m_dwSaveFlags = 0; m_eContainerCode = CC_VOLUME; m_fDamage = 0.0f; m_eDamageType = DT_UNSPECIFIED; m_bShowSurface = LTTRUE; m_fSurfaceHeight = 5.0f; m_fViscosity = 0.0f; m_fFriction = 1.0f; m_hSurfaceObj = LTNULL; m_bHidden = LTFALSE; m_fGravity = LIQUID_GRAVITY; m_nSoundFilterId = 0; m_bCanPlayMoveSnds = LTTRUE; VEC_INIT(m_vLastPos); VEC_INIT(m_vCurrent); VEC_SET(m_vTintColor, 255.0f, 255.0f, 255.0f); VEC_INIT(m_vLightAdd); m_bFogEnable = LTFALSE; m_fFogFarZ = 300.0f; m_fFogNearZ = -100.0f; VEC_INIT(m_vFogColor); // Surface related stuff... m_fXScaleMin = 15.0f; m_fXScaleMax = 25.0f; m_fYScaleMin = 15.0f; m_fYScaleMax = 25.0f; m_fXScaleDuration = 10.0f; m_fYScaleDuration = 10.0f; m_hstrSurfaceSprite = LTNULL; m_dwNumSurfPolies = 160; m_fSurfAlpha = 0.7f; m_bAdditive = LTFALSE; m_bMultiply = LTFALSE; VEC_SET(m_vSurfaceColor1, 255.0f, 255.0f, 255.0f); VEC_SET(m_vSurfaceColor2, 255.0f, 255.0f, 255.0f); m_dwFlags = FLAG_CONTAINER | FLAG_TOUCH_NOTIFY | FLAG_GOTHRUWORLD | FLAG_FORCECLIENTUPDATE; }
LTBOOL CBaseParticleSystemFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!CSpecialFX::Init(psfxCreateStruct)) return LTFALSE; m_basecs = *((BPSCREATESTRUCT*)psfxCreateStruct); m_fGravity = PSFX_DEFAULT_GRAVITY; m_fRadius = PSFX_DEFAULT_RADIUS; m_dwFlags = 0; m_pTextureName = "SFX\\Particle\\particle.dtx"; VEC_INIT(m_vPos); VEC_INIT(m_vPosOffset); VEC_INIT(m_vVel); m_rRot.Init(); return LTTRUE; }
GameStartPoint::GameStartPoint() : StartPoint() { m_bMultiplayer = DFALSE; m_hstrName = DNULL; VEC_INIT(m_vPitchYawRoll); m_hstrTriggerTarget = DNULL; m_hstrTriggerMessage = DNULL; m_nTeamID = 0; }
void UndeadGideon::MC_Jump() { DFLOAT fHeight = (DFLOAT)fabs(m_vTargetPos.y - m_MoveObj.GetPos().y); DBOOL bAbove = (m_vTargetPos.y - m_MoveObj.GetPos().y) > 0; if (m_bAnimating == DFALSE || m_nCurMetacmd != MC_JUMP) { SetAnimation(m_pAnim_Sound->m_nAnim_JUMP[TYPE_MELEE]); m_pServerDE->SetModelLooping(m_hObject, DFALSE); DVector vVel; vVel.y = m_MoveObj.GetUpVector().y * m_fJumpSpeed; vVel.x = m_MoveObj.GetForwardVector().x * m_fRunSpeed * 3; vVel.z = m_MoveObj.GetForwardVector().z * m_fRunSpeed * 3; Move(vVel, MATH_EPSILON); m_nCurMetacmd = MC_JUMP; m_bAnimating = DTRUE; } else { CollisionInfo collisionInfo; DVector vVel; m_pServerDE->GetVelocity(m_hObject,&vVel); vVel.x = m_MoveObj.GetForwardVector().x * m_fRunSpeed * 3; vVel.z = m_MoveObj.GetForwardVector().z * m_fRunSpeed * 3; Move(vVel, MATH_EPSILON); m_pServerDE->GetStandingOn(m_hObject, &collisionInfo); if (collisionInfo.m_hObject) { DVector vVel; VEC_INIT(vVel); Move(vVel, MATH_EPSILON); HCLASS hClass = m_pServerDE->GetObjectClass(m_hObject); if (!m_pServerDE->IsKindOf(hClass,m_pServerDE->GetClass("CBaseCharacter"))) { m_bAnimating = DFALSE; Metacmd++; } else { m_nCurMetacmd = 999; } } } return; }
VolumeBrush::VolumeBrush() : B2BaseClass(OT_CONTAINER) { m_hPlayerClass = DNULL; m_dwSaveFlags = 0; m_eContainerCode = CC_NOTHING; m_fDamage = 0.0f; m_nDamageType = DAMAGE_TYPE_NORMAL; m_bShowSurface = DTRUE; m_fSurfaceHeight = 2.0f; m_fSurfaceAlpha = 0.7f; m_fViscosity = 0.0f; m_hSurfaceObj = DNULL; m_bHidden = DFALSE; m_fGravity = LIQUID_GRAVITY; m_fLastDamageTime = 0.0f; VEC_INIT(m_vLastPos); VEC_INIT(m_vCurrent); m_bFogEnable = DFALSE; m_fFogFarZ = 300.0f; m_fFogNearZ = -100.0f; VEC_INIT(m_vFogColor); // Surface related stuff... m_fXScaleMin = 15.0f; m_fXScaleMax = 25.0f; m_fYScaleMin = 15.0f; m_fYScaleMax = 25.0f; m_fXScaleDuration = 10.0f; m_fYScaleDuration = 10.0f; m_hstrSurfaceSprite = DNULL; m_dwNumSurfacePolies = 160; VEC_SET(m_vSurfaceColor1, 255.0f, 255.0f, 255.0f); VEC_SET(m_vSurfaceColor2, 255.0f, 255.0f, 255.0f); m_dwFlags = FLAG_TOUCH_NOTIFY | FLAG_FULLPOSITIONRES | FLAG_GOTHRUWORLD | FLAG_FORCECLIENTUPDATE; m_bLocked = DFALSE; m_bUnlockKeyRemove = DFALSE; m_hstrKeyName = DNULL; }
///<summary> /// Sets up the upgrade attack button based on the data specified ... ///</summary> static void setupUpgradeAttackButton(GameMenuInfo &gameMenu, LevelInfo *levelInfo) { std::stringstream attackCost; attackCost << gAttackCost; GameButton upAttackButton; upAttackButton.ID = ATTACK_BUTTON; GameMenuMethodsSetupButton(VEC_INIT(1.1f, -0.4f, 4.9f), levelInfo, &upAttackButton, 1.2f, DEFAULT_TEXT_HEIGHT, attackCost.str()); gameMenu.ButtonList.erase(ATTACK_BUTTON); gameMenu.ButtonList[ATTACK_BUTTON] = upAttackButton; }
ParticleSystem::ParticleSystem() : CClientSFX() { m_dwFlags = 0; m_fBurstWait = 0.0f; m_fParticlesPerSecond = 0.0f; m_fEmissionRadius = 0.0f; m_fMinimumVelocity = 0.0f; m_fMaximumVelocity = 0.0f; m_fVelocityOffset = 0.0f; m_fParticleLifetime = 0.0f; m_fRadius = 1000.0f; m_fGravity = -500.0f; m_fRotationVelocity = 0.0f; m_hstrTextureName = DNULL; m_bStatic = DTRUE; VEC_INIT(m_vColor1); VEC_INIT(m_vColor2); }
///<summary> /// Sets up the upgrade weapon button based on the data specified ... ///</summary> static void setupUpgradeWeaponButton(GameMenuInfo &gameMenu, LevelInfo *levelInfo) { std::stringstream projectileCost; projectileCost << gProjectileCost; GameButton upWeaponButton; upWeaponButton.ID = PROJECTILE_BUTTON; GameMenuMethodsSetupButton(VEC_INIT(1.1f, -0.9f, 4.9f), levelInfo, &upWeaponButton, 1.2f, DEFAULT_TEXT_HEIGHT, projectileCost.str()); gameMenu.ButtonList.erase(PROJECTILE_BUTTON); gameMenu.ButtonList[PROJECTILE_BUTTON] = upWeaponButton; }
CShellCasingFX::CShellCasingFX() { ROT_INIT(m_rRot); VEC_INIT(m_vStartPos); m_fExpireTime = 0.0f; m_bInVisible = DTRUE; m_bResting = DFALSE; m_nBounceCount = 2; // Set maximum bounces m_bLeftHanded = DFALSE; }
DVector CMovement::FindTurn(DVector vStart, DVector vTestDir, DVector vMoveDir, DFLOAT fMoveLen, DFLOAT fTestLen) { DVector vFinal,vCurPos; DBOOL bStop = DTRUE; DFLOAT fMaxDist = 0.0f; VEC_INIT(vFinal); VEC_COPY(vCurPos, vStart); CServerDE* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) return vFinal; IntersectQuery IQuery; IntersectInfo IInfo; IQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID; IQuery.m_FilterFn = DNULL; VEC_COPY(IQuery.m_From,vStart); VEC_COPY(IQuery.m_Direction,vMoveDir); //find maximum searchable distance in vMoveDir if(pServerDE->CastRay(&IQuery,&IInfo)) { fMaxDist = VEC_DIST(vStart,IInfo.m_Point); } //loop til we find a spot to turn for(float fDist = 0.0f; !((fDist + fMoveLen) >= fMaxDist); fDist += fMoveLen) { VEC_ADDSCALED(vCurPos, vCurPos, vMoveDir, fMoveLen); VEC_COPY(IQuery.m_From,vCurPos); VEC_ADDSCALED(IQuery.m_To,vCurPos, vTestDir, fTestLen); if(!pServerDE->IntersectSegment(&IQuery, &IInfo)) { VEC_ADDSCALED(vFinal, vCurPos, vMoveDir, fMoveLen); return vFinal; } } if(m_nNumPoints >= 10 || (VEC_DIST(vCurPos,vStart) <= 0.0)) return vCurPos; //we can't turn here so we add to list and keep searching in new direction AddPosToPathList(vCurPos); DVector vNewMoveDir; VEC_MULSCALAR(vNewMoveDir, vTestDir, -1.0f); return FindTurn(vCurPos, vMoveDir, vNewMoveDir, fMoveLen, (fMaxDist - fDist) + 1.0f); }
CRainFX::CRainFX() : CBaseParticleSystemFX() { m_bFirstUpdate = DTRUE; m_nParticlesAdded = 0; m_fTimeLen = 0.0f; m_fLastTime = 0.0f; m_fNextUpdate = 0.01f; m_dwFlags = 0; m_fLifetime = 1.0f; m_fAreaDensity = 0.0f; m_bGravity = DTRUE; m_fSpread = 0.0f; m_fTimeLimit = 0.0f; VEC_SET(m_vColor1, 200, 255, 255); VEC_SET(m_vColor2, 40, 50, 50); /* VEC_SET(m_vColor[0], 255, 255, 255); VEC_SET(m_vColor[1], 200, 200, 200); VEC_SET(m_vColor[2], 150, 150, 150); VEC_SET(m_vColor[3], 100, 100, 100); VEC_SET(m_vColor[4], 50, 50, 50); VEC_SET(m_vColor[5], 50, 50, 50); */ VEC_INIT(m_vMinOffset); VEC_INIT(m_vMaxOffset); VEC_INIT(m_vMinVel); VEC_INIT(m_vMaxVel); VEC_INIT(m_vDims); VEC_INIT(m_vDirection); }
int main(int argc, char * argv[]){ riff_result_t res; int argi = 1; VEC_INIT(skipv); VEC_INIT(readv); VEC_INIT(stopv); while(argc > argi) { if(0 == strcmp(argv[argi], "-h") || 0 == strcmp(argv[argi], "--help")) { printf( "USAGE: %s [FLAGS]\n" "Reads RIFF file from standard input\n" "FLAGS:\n" " -h (--help) Print this message\n" " -s (--skip) fourcc Skip chunk with this fourcc\n" " -r (--read) fourcc Read chunk with this fourcc\n" " -p (--stop) fourcc Stop on chunk with this fourcc\n" , argv[0]); return 0; } else if(0 == strcmp(argv[argi], "-s") || 0 == strcmp(argv[argi], "--skip")) { argi++; VEC_PUSH(skipv, FOURCC(argv[argi])); argi++; } else if(0 == strcmp(argv[argi], "-r") || 0 == strcmp(argv[argi], "--read")) { argi++; VEC_PUSH(readv, FOURCC(argv[argi])); argi++; } else if(0 == strcmp(argv[argi], "-p") || 0 == strcmp(argv[argi], "--stop")) { argi++; VEC_PUSH(stopv, FOURCC(argv[argi])); argi++; } } res = riff_readfile(stdin, chunk_cb, err_cb, NULL); printf("%d\n", res); return 0; }
DBOOL CBaseParticleSystemFX::Init(SFXCREATESTRUCT* psfxCreateStruct) { if (!CSpecialFX::Init(psfxCreateStruct)) return DFALSE; m_fGravity = PSFX_DEFAULT_GRAVITY; m_fRadius = PSFX_DEFAULT_RADIUS; m_dwFlags = 0; m_pTextureName = "SpecialFX\\ParticleTextures\\particle.dtx"; VEC_INIT(m_vPos); ROT_INIT(m_rRot); return DTRUE; }
SoccerBall::SoccerBall() : B2BaseClass( OT_MODEL ) { m_bOnGround = DFALSE; m_fLastTimeOnGround = 0.0f; m_fLastBounceTime = 0.0f; m_bBounced = DFALSE; VEC_INIT( m_vLastPos ); VEC_SET( m_vLastNormal, 0.0f, 1.0f, 0.0f ); m_hLastPlayer = DNULL; // m_hLight = DNULL; // m_hLightAttachment = DNULL; m_bMadeGoal = DFALSE; m_fRespawnTime = g_pServerDE->GetTime( ) + BALLRESPAWNTIME; }
CScatterFX::CScatterFX() : CSpecialFX() { VEC_INIT( m_vDims ); m_nBlindDataIndex = 0xffffffff; m_fHeight = 64.0f; m_fWidth = 64.0f; m_fMaxScale = 1.0f; m_fTilt = 30.0f; m_fWaveRate = 90.0f; m_fWaveDist = 10.0f; m_fMaxDrawDist = 1024.0f; m_fMaxDrawDistSq = 1024.0f * 1024.0f; m_hstrTextureName = LTNULL; m_bUseSaturate = true; VEC_INIT( m_vCamPos ); m_nInternalTime = 0; m_nNumSubVolumes = 0; m_pSubVolumes = NULL; m_bEnabled = true; }