void CPhysicsObject::OutputDebugInfo() const { Msg("-----------------\n"); if (m_pName) Msg("Object: %s\n", m_pName); Msg("Mass: %f (inv %f)\n", GetMass(), GetInvMass()); Vector pos; QAngle ang; GetPosition(&pos, &ang); Msg("Position: %f %f %f\nAngle: %f %f %f\n", pos.x, pos.y, pos.z, ang.x, ang.y, ang.z); Vector inertia = GetInertia(); Vector invinertia = GetInvInertia(); Msg("Inertia: %f %f %f (inv %f %f %f)\n", inertia.x, inertia.y, inertia.z, invinertia.x, invinertia.y, invinertia.z); Vector vel; AngularImpulse angvel; GetVelocity(&vel, &angvel); Msg("Velocity: %f, %f, %f\nAng Velocity: %f, %f, %f\n", vel.x, vel.y, vel.z, angvel.x, angvel.y, angvel.z); float dampspeed, damprot; GetDamping(&dampspeed, &damprot); Msg("Damping %f linear, %f angular\n", dampspeed, damprot); Vector dragBasis; Vector angDragBasis; ConvertPosToHL(m_dragBasis, dragBasis); ConvertDirectionToHL(m_angDragBasis, angDragBasis); Msg("Linear Drag: %f, %f, %f (factor %f)\n", dragBasis.x, dragBasis.y, dragBasis.z, m_dragCoefficient); Msg("Angular Drag: %f, %f, %f (factor %f)\n", angDragBasis.x, angDragBasis.y, angDragBasis.z, m_angDragCoefficient); // TODO: Attached to x controllers Msg("State: %s, Collision %s, Motion %s, Drag %s, Flags %04X (game %04x, index %d)\n", IsAsleep() ? "Asleep" : "Awake", IsCollisionEnabled() ? "Enabled" : "Disabled", IsStatic() ? "Static" : IsMotionEnabled() ? "Enabled" : "Disabled", IsDragEnabled() ? "Enabled" : "Disabled", m_pObject->getFlags(), GetGameFlags(), GetGameIndex() ); const char *pMaterialStr = g_SurfaceDatabase.GetPropName(m_materialIndex); surfacedata_t *surfaceData = g_SurfaceDatabase.GetSurfaceData(m_materialIndex); if (surfaceData) { Msg("Material: %s : density(%f), thickness(%f), friction(%f), elasticity(%f)\n", pMaterialStr, surfaceData->physics.density, surfaceData->physics.thickness, surfaceData->physics.friction, surfaceData->physics.elasticity); } Msg("-- COLLISION SHAPE INFO --\n"); g_PhysicsCollision.OutputDebugInfo((CPhysCollide *)m_pObject->getCollisionShape()->getUserPointer()); }
void CPhysicsObject::WriteToTemplate( vphysics_save_cphysicsobject_t &objectTemplate ) { if ( m_collideType == COLLIDE_BALL ) { objectTemplate.pCollide = NULL; objectTemplate.sphereRadius = GetSphereRadius(); } else { objectTemplate.pCollide = GetCollide(); objectTemplate.sphereRadius = 0; } objectTemplate.isStatic = IsStatic(); objectTemplate.collisionEnabled = IsCollisionEnabled(); objectTemplate.gravityEnabled = IsGravityEnabled(); objectTemplate.dragEnabled = IsDragEnabled(); objectTemplate.motionEnabled = IsMotionEnabled(); objectTemplate.isAsleep = IsAsleep(); objectTemplate.isTrigger = IsTrigger(); objectTemplate.materialIndex = m_materialIndex; objectTemplate.mass = GetMass(); objectTemplate.rotInertia = GetInertia(); GetDamping( &objectTemplate.speedDamping, &objectTemplate.rotSpeedDamping ); objectTemplate.massCenterOverride = m_massCenterOverride; objectTemplate.callbacks = m_callbacks; objectTemplate.gameFlags = m_gameFlags; objectTemplate.volume = GetVolume(); objectTemplate.dragCoefficient = m_dragCoefficient; objectTemplate.angDragCoefficient = m_angDragCoefficient; objectTemplate.pShadow = m_pShadow; objectTemplate.hasShadowController = (m_pShadow != NULL) ? true : false; //bool m_shadowTempGravityDisable; objectTemplate.collideType = m_collideType; objectTemplate.contentsMask = m_contentsMask; GetPosition( &objectTemplate.origin, &objectTemplate.angles ); GetVelocity( &objectTemplate.velocity, &objectTemplate.angVelocity ); }
/************************************************************************ * * * Tick regen/refresh/regain effects * * * ************************************************************************/ void CStatusEffectContainer::CheckRegen(uint32 tick) { DSP_DEBUG_BREAK_IF(m_POwner == NULL); if (!m_POwner->isDead()) { if ((tick - m_RegenCheckTime) < 3000 ) { return; } CCharEntity* PChar = NULL; if(m_POwner->objtype == TYPE_PC) { PChar = (CCharEntity*)m_POwner; } m_RegenCheckTime = tick; int8 regen = m_POwner->getMod(MOD_REGEN); int8 poison = m_POwner->getMod(MOD_REGEN_DOWN); int8 refresh = m_POwner->getMod(MOD_REFRESH) - m_POwner->getMod(MOD_REFRESH_DOWN); int16 regain = m_POwner->getMod(MOD_REGAIN) - m_POwner->getMod(MOD_REGAIN_DOWN); m_POwner->addHP(regen); if(poison) { int16 damage = battleutils::HandleStoneskin(m_POwner, poison); if(damage > 0) { DelStatusEffectSilent(EFFECT_HEALING); m_POwner->addHP(-damage); WakeUp(); } } if (m_POwner->getMod(MOD_AVATAR_PERPETUATION) > 0 && (m_POwner->objtype == TYPE_PC)) { int8 perpetuation = m_POwner->getMod(MOD_AVATAR_PERPETUATION); if (m_POwner->StatusEffectContainer->HasStatusEffect(EFFECT_ASTRAL_FLOW)) perpetuation = 0; else { if (m_POwner->PPet != NULL && PChar != NULL) { if(m_POwner->PPet->objtype == TYPE_PET) { CPetEntity* PPet = (CPetEntity*)m_POwner->PPet; CItem* hands = PChar->getEquip(SLOT_HANDS); // carbuncle mitts only work on carbuncle if (hands && hands->getID() == 14062 && PPet->name == "Carbuncle"){ perpetuation /= 2; } } perpetuation -= charutils::AvatarPerpetuationReduction(PChar); if( perpetuation < 1 ) perpetuation = 1; } } m_POwner->addMP(refresh - perpetuation); if( m_POwner->health.mp == 0 && m_POwner->PPet != NULL && m_POwner->PPet->objtype == TYPE_PET) { CPetEntity* PPet = (CPetEntity*)m_POwner->PPet; if (PPet->getPetType() == PETTYPE_AVATAR) { petutils::DespawnPet(m_POwner); } } } else { m_POwner->addMP(refresh); } if(PChar != NULL && IsAsleep()) { CItem* neck = PChar->getEquip(SLOT_NECK); // opo-opo necklace if(neck != NULL && neck->getID() == 13143) { // add tp regain += 2.5f; } } m_POwner->addTP(regain); if( m_POwner->status != STATUS_DISAPPEAR && (m_POwner->objtype == TYPE_PC)) { charutils::UpdateHealth((CCharEntity*)m_POwner); } } }