From e020651e4b20f6064f6b3cc7619991d85825690d Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 21 Jan 2012 02:03:37 -0500 Subject: [PATCH] Eliminate hsScalar and hsFixed Modern CPUs support floats just fine... hsFixed was crazy. --- Sources/Plasma/Apps/plClient/plClient.cpp | 14 +- Sources/Plasma/Apps/plClient/plClient.h | 6 +- Sources/Plasma/CoreLib/CMakeLists.txt | 2 - Sources/Plasma/CoreLib/HS_POINT2.inc | 61 --- Sources/Plasma/CoreLib/HeadSpin.cpp | 1 + Sources/Plasma/CoreLib/hsBounds.cpp | 414 +++++++++--------- Sources/Plasma/CoreLib/hsBounds.h | 26 +- Sources/Plasma/CoreLib/hsColorRGBA.h | 27 +- Sources/Plasma/CoreLib/hsConfig.h | 10 - Sources/Plasma/CoreLib/hsFastMath.cpp | 19 +- Sources/Plasma/CoreLib/hsFastMath.h | 52 +-- Sources/Plasma/CoreLib/hsFixedTypes.h | 120 ----- Sources/Plasma/CoreLib/hsGeometry3.cpp | 34 +- Sources/Plasma/CoreLib/hsGeometry3.h | 164 ++++--- Sources/Plasma/CoreLib/hsMatrix33.h | 2 +- Sources/Plasma/CoreLib/hsMatrix44.cpp | 215 +++------ Sources/Plasma/CoreLib/hsMatrix44.h | 50 +-- Sources/Plasma/CoreLib/hsPoint2.h | 162 +++---- Sources/Plasma/CoreLib/hsQuat.cpp | 82 ++-- Sources/Plasma/CoreLib/hsQuat.h | 32 +- Sources/Plasma/CoreLib/hsScalar.h | 200 --------- Sources/Plasma/CoreLib/hsStream.cpp | 120 +++-- Sources/Plasma/CoreLib/hsStream.h | 28 -- Sources/Plasma/CoreLib/hsTypes.h | 20 +- Sources/Plasma/CoreLib/hsUtils.cpp | 17 +- Sources/Plasma/CoreLib/hsUtils.h | 12 +- Sources/Plasma/CoreLib/hsWide.cpp | 8 +- Sources/Plasma/CoreLib/hsWide.h | 29 +- Sources/Plasma/CoreLib/plViewTransform.cpp | 30 +- Sources/Plasma/CoreLib/plViewTransform.h | 54 +-- .../pfAnimation/pfObjectFlocker.cpp | 8 +- .../FeatureLib/pfAnimation/pfObjectFlocker.h | 2 +- .../FeatureLib/pfAnimation/plBlower.cpp | 46 +- .../Plasma/FeatureLib/pfAnimation/plBlower.h | 54 +-- .../pfAnimation/plFilterCoordInterface.cpp | 2 +- .../FeatureLib/pfAnimation/plFollowMod.cpp | 2 +- .../FeatureLib/pfAnimation/plFollowMod.h | 2 +- .../pfAnimation/plLightModifier.cpp | 18 +- .../FeatureLib/pfAnimation/plLightModifier.h | 8 +- .../pfAnimation/plLineFollowMod.cpp | 38 +- .../FeatureLib/pfAnimation/plLineFollowMod.h | 34 +- .../pfAnimation/plRandomCommandMod.cpp | 12 +- .../pfAnimation/plRandomCommandMod.h | 18 +- .../FeatureLib/pfAnimation/plStereizer.cpp | 14 +- .../FeatureLib/pfAnimation/plStereizer.h | 34 +- .../pfAnimation/plViewFaceModifier.cpp | 8 +- .../pfAnimation/plViewFaceModifier.h | 2 +- .../Plasma/FeatureLib/pfAudio/plListener.cpp | 2 +- .../Plasma/FeatureLib/pfAudio/plListener.h | 4 +- .../FeatureLib/pfAudio/plRandomSoundMod.cpp | 10 +- .../FeatureLib/pfAudio/plRandomSoundMod.h | 2 +- .../FeatureLib/pfCamera/plCameraBrain.cpp | 104 ++--- .../FeatureLib/pfCamera/plCameraBrain.h | 134 +++--- .../FeatureLib/pfCamera/plCameraModifier.cpp | 18 +- .../FeatureLib/pfCamera/plCameraModifier.h | 26 +- .../pfCamera/plInterestingModifier.cpp | 6 +- .../pfCamera/plInterestingModifier.h | 16 +- .../FeatureLib/pfCamera/plVirtualCamNeu.cpp | 62 +-- .../FeatureLib/pfCamera/plVirtualCamNeu.h | 46 +- .../FeatureLib/pfCharacter/pfMarkerMgr.cpp | 2 +- .../pfCharacter/plPlayerModifier.cpp | 50 +-- .../FeatureLib/pfCharacter/plPlayerModifier.h | 28 +- .../plAnimationEventConditionalObject.cpp | 2 +- .../plAnimationEventConditionalObject.h | 2 +- .../plFacingConditionalObject.cpp | 4 +- .../pfConditional/plFacingConditionalObject.h | 4 +- .../pfConsole/pfAvatarConsoleCommands.cpp | 2 +- .../pfConsole/pfConsoleCommands.cpp | 68 +-- .../FeatureLib/pfConsole/pfDispatchLog.cpp | 4 +- .../pfGameGUIMgr/pfGUIButtonMod.cpp | 2 +- .../FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h | 2 +- .../pfGameGUIMgr/pfGUICheckBoxCtrl.cpp | 2 +- .../pfGameGUIMgr/pfGUICheckBoxCtrl.h | 2 +- .../pfGameGUIMgr/pfGUIClickMapCtrl.cpp | 2 +- .../pfGameGUIMgr/pfGUIClickMapCtrl.h | 2 +- .../pfGameGUIMgr/pfGUIControlMod.cpp | 22 +- .../FeatureLib/pfGameGUIMgr/pfGUIControlMod.h | 8 +- .../pfGameGUIMgr/pfGUICtrlGenerator.cpp | 4 +- .../pfGameGUIMgr/pfGUIDialogMod.cpp | 12 +- .../FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h | 8 +- .../pfGameGUIMgr/pfGUIDragBarCtrl.cpp | 2 +- .../pfGameGUIMgr/pfGUIDragBarCtrl.h | 2 +- .../pfGameGUIMgr/pfGUIDraggableMod.cpp | 2 +- .../pfGameGUIMgr/pfGUIDraggableMod.h | 2 +- .../pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp | 2 +- .../pfGameGUIMgr/pfGUIDynDisplayCtrl.h | 2 +- .../pfGameGUIMgr/pfGUIEditBoxMod.cpp | 2 +- .../FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h | 2 +- .../FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp | 22 +- .../FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h | 10 +- .../pfGameGUIMgr/pfGUIListBoxMod.cpp | 12 +- .../FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h | 2 +- .../pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp | 10 +- .../pfGameGUIMgr/pfGUIMultiLineEditCtrl.h | 2 +- .../pfGameGUIMgr/pfGUIPopUpMenu.cpp | 10 +- .../FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h | 8 +- .../pfGameGUIMgr/pfGUIProgressCtrl.cpp | 22 +- .../pfGameGUIMgr/pfGUIProgressCtrl.h | 8 +- .../pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp | 2 +- .../pfGameGUIMgr/pfGUIRadioGroupCtrl.h | 2 +- .../pfGameGUIMgr/pfGUITextBoxMod.cpp | 2 +- .../FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h | 2 +- .../pfGameGUIMgr/pfGUIUpDownPairMod.cpp | 6 +- .../pfGameGUIMgr/pfGUIUpDownPairMod.h | 6 +- .../pfGameGUIMgr/pfGUIValueCtrl.cpp | 4 +- .../FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h | 16 +- .../FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp | 12 +- .../FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h | 14 +- .../pfJournalBook/pfJournalBook.cpp | 30 +- .../FeatureLib/pfJournalBook/pfJournalBook.h | 10 +- Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h | 6 +- .../pfMessage/plArmatureEffectMsg.h | 2 +- .../FeatureLib/pfMessage/plClothingMsg.h | 2 +- .../FeatureLib/pfPython/cyAnimation.cpp | 14 +- .../Plasma/FeatureLib/pfPython/cyAnimation.h | 14 +- .../Plasma/FeatureLib/pfPython/cyAvatar.cpp | 10 +- Sources/Plasma/FeatureLib/pfPython/cyAvatar.h | 10 +- .../Plasma/FeatureLib/pfPython/cyCamera.cpp | 4 +- Sources/Plasma/FeatureLib/pfPython/cyCamera.h | 4 +- Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp | 16 +- Sources/Plasma/FeatureLib/pfPython/cyMisc.h | 16 +- .../FeatureLib/pfPython/cyParticleSys.cpp | 26 +- .../FeatureLib/pfPython/cyParticleSys.h | 26 +- .../Plasma/FeatureLib/pfPython/cyPhysics.cpp | 6 +- .../Plasma/FeatureLib/pfPython/cyPhysics.h | 6 +- .../FeatureLib/pfPython/plPythonFileMod.cpp | 2 +- .../FeatureLib/pfPython/plPythonFileMod.h | 2 +- .../FeatureLib/pfPython/plPythonParameter.h | 4 +- .../FeatureLib/pfPython/pyAudioControl.cpp | 30 +- .../FeatureLib/pfPython/pyAudioControl.h | 30 +- .../Plasma/FeatureLib/pfPython/pyColor.cpp | 2 +- Sources/Plasma/FeatureLib/pfPython/pyColor.h | 20 +- .../FeatureLib/pfPython/pyColorGlue.cpp | 2 +- .../FeatureLib/pfPython/pyCritterBrain.cpp | 16 +- .../FeatureLib/pfPython/pyCritterBrain.h | 18 +- .../FeatureLib/pfPython/pyDrawControl.cpp | 6 +- .../FeatureLib/pfPython/pyDrawControl.h | 6 +- .../FeatureLib/pfPython/pyGUIControl.cpp | 8 +- .../Plasma/FeatureLib/pfPython/pyGUIControl.h | 8 +- .../FeatureLib/pfPython/pyGUIControlValue.cpp | 14 +- .../FeatureLib/pfPython/pyGUIControlValue.h | 14 +- .../FeatureLib/pfPython/pyGUIDialog.cpp | 8 +- .../Plasma/FeatureLib/pfPython/pyGUIDialog.h | 8 +- .../FeatureLib/pfPython/pyGUIPopUpMenu.cpp | 16 +- .../FeatureLib/pfPython/pyGUIPopUpMenu.h | 20 +- .../pfPython/pyGUIPopUpMenuGlue.cpp | 4 +- .../Plasma/FeatureLib/pfPython/pyGeometry3.h | 40 +- .../FeatureLib/pfPython/pyGrassShader.cpp | 16 +- .../FeatureLib/pfPython/pyGrassShader.h | 12 +- .../FeatureLib/pfPython/pyGrassShaderGlue.cpp | 12 +- .../FeatureLib/pfPython/pyJournalBook.cpp | 2 +- .../FeatureLib/pfPython/pyJournalBook.h | 2 +- .../Plasma/FeatureLib/pfPython/pyMatrix44.cpp | 6 +- .../Plasma/FeatureLib/pfPython/pyMatrix44.h | 10 +- .../FeatureLib/pfPython/pyMatrix44Glue.cpp | 4 +- .../FeatureLib/pfPython/pyMoviePlayer.cpp | 8 +- .../FeatureLib/pfPython/pyMoviePlayer.h | 8 +- .../Plasma/FeatureLib/pfPython/pyNotify.cpp | 6 +- Sources/Plasma/FeatureLib/pfPython/pyNotify.h | 6 +- .../Plasma/FeatureLib/pfPython/pyPlayer.cpp | 6 +- Sources/Plasma/FeatureLib/pfPython/pyPlayer.h | 14 +- .../FeatureLib/pfPython/pyPlayerGlue.cpp | 8 +- .../pfPython/pySwimCurrentInterface.cpp | 20 +- .../pfPython/pySwimCurrentInterface.h | 20 +- .../Plasma/FeatureLib/pfPython/pyWaveSet.cpp | 112 ++--- .../Plasma/FeatureLib/pfPython/pyWaveSet.h | 112 ++--- .../pfSecurePreloader/pfSecurePreloader.cpp | 6 +- .../FeatureLib/pfSurface/plDistOpacityMod.cpp | 10 +- .../FeatureLib/pfSurface/plDistOpacityMod.h | 18 +- .../FeatureLib/pfSurface/plFadeOpacityLay.cpp | 2 +- .../FeatureLib/pfSurface/plFadeOpacityLay.h | 6 +- .../FeatureLib/pfSurface/plFadeOpacityMod.cpp | 10 +- .../FeatureLib/pfSurface/plFadeOpacityMod.h | 16 +- .../FeatureLib/pfSurface/plLayerAVI.cpp | 4 +- .../Plasma/FeatureLib/pfSurface/plLayerAVI.h | 2 +- .../FeatureLib/pfSurface/plLayerMovie.cpp | 4 +- .../FeatureLib/pfSurface/plLayerMovie.h | 8 +- Sources/Plasma/NucleusLib/inc/hsTimer.h | 45 +- Sources/Plasma/NucleusLib/inc/plAudible.h | 8 +- Sources/Plasma/NucleusLib/inc/plDrawable.h | 2 +- Sources/Plasma/NucleusLib/inc/plPhysical.h | 2 +- Sources/Plasma/NucleusLib/inc/plPipeline.h | 28 +- .../pnInputCore/plControlDefinition.h | 2 +- .../Plasma/NucleusLib/pnMessage/plCameraMsg.h | 14 +- .../NucleusLib/pnMessage/plEventCallbackMsg.h | 4 +- .../NucleusLib/pnMessage/plNotifyMsg.cpp | 6 +- .../Plasma/NucleusLib/pnMessage/plNotifyMsg.h | 16 +- .../Plasma/NucleusLib/pnMessage/plSoundMsg.h | 4 +- .../Plasma/NucleusLib/pnMessage/plTimeMsg.cpp | 6 +- .../Plasma/NucleusLib/pnMessage/plTimeMsg.h | 14 +- .../NucleusLib/pnModifier/plLogicModBase.h | 4 +- .../Plasma/NucleusLib/pnModifier/plModifier.h | 2 +- .../NucleusLib/pnModifier/plMultiModifier.h | 2 +- .../NucleusLib/pnModifier/plSingleModifier.h | 2 +- .../NucleusLib/pnNetCommon/plSynchedValue.cpp | 2 +- .../NucleusLib/pnNetCommon/plSynchedValue.h | 2 +- .../pnSceneObject/plSceneObject.cpp | 2 +- .../NucleusLib/pnSceneObject/plSceneObject.h | 2 +- Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp | 16 +- .../Plasma/NucleusLib/pnTimer/plTimedValue.h | 12 +- .../pnTimer/plTimerCallbackManager.cpp | 6 +- .../pnTimer/plTimerCallbackManager.h | 6 +- .../PubUtilLib/plAgeLoader/plResPatcher.cpp | 4 +- .../PubUtilLib/plAudible/plAudibleNull.h | 8 +- .../PubUtilLib/plAudible/plWinAudible.cpp | 12 +- .../PubUtilLib/plAudible/plWinAudible.h | 8 +- .../PubUtilLib/plAudio/plAudioSystem.cpp | 30 +- .../Plasma/PubUtilLib/plAudio/plAudioSystem.h | 30 +- .../PubUtilLib/plAudio/plDSoundBuffer.cpp | 8 +- .../PubUtilLib/plAudio/plDSoundBuffer.h | 6 +- .../PubUtilLib/plAudio/plEAXEffects.cpp | 20 +- .../Plasma/PubUtilLib/plAudio/plEAXEffects.h | 32 +- .../PubUtilLib/plAudio/plEAXListenerMod.cpp | 2 +- .../PubUtilLib/plAudio/plEAXListenerMod.h | 2 +- Sources/Plasma/PubUtilLib/plAudio/plSound.cpp | 70 +-- Sources/Plasma/PubUtilLib/plAudio/plSound.h | 50 +-- .../Plasma/PubUtilLib/plAudio/plVoiceChat.cpp | 2 +- .../Plasma/PubUtilLib/plAudio/plVoiceChat.h | 4 +- .../plAudio/plWin32GroupedSound.cpp | 6 +- .../PubUtilLib/plAudio/plWin32GroupedSound.h | 6 +- .../PubUtilLib/plAudio/plWin32Sound.cpp | 2 +- .../Plasma/PubUtilLib/plAudio/plWin32Sound.h | 2 +- .../PubUtilLib/plAudio/plWin32StaticSound.cpp | 2 +- .../plAudio/plWin32StreamingSound.cpp | 2 +- .../plAudio/plWin32StreamingSound.h | 6 +- .../PubUtilLib/plAudio/plWinMicLevel.cpp | 6 +- .../Plasma/PubUtilLib/plAudio/plWinMicLevel.h | 4 +- .../PubUtilLib/plAudioCore/plSoundBuffer.cpp | 4 +- .../PubUtilLib/plAudioCore/plSoundBuffer.h | 2 +- .../Plasma/PubUtilLib/plAvatar/plAGAnim.cpp | 14 +- Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h | 84 ++-- .../PubUtilLib/plAvatar/plAGAnimInstance.cpp | 40 +- .../PubUtilLib/plAvatar/plAGAnimInstance.h | 34 +- .../PubUtilLib/plAvatar/plAGMasterMod.cpp | 10 +- .../PubUtilLib/plAvatar/plAGMasterMod.h | 10 +- .../plAvatar/plAGMasterSDLModifier.cpp | 2 +- .../PubUtilLib/plAvatar/plAGModifier.cpp | 2 +- .../Plasma/PubUtilLib/plAvatar/plAGModifier.h | 2 +- .../PubUtilLib/plAvatar/plAntiGravAction.cpp | 8 +- .../PubUtilLib/plAvatar/plAntiGravAction.h | 8 +- .../PubUtilLib/plAvatar/plArmatureMod.cpp | 20 +- .../PubUtilLib/plAvatar/plArmatureMod.h | 24 +- .../PubUtilLib/plAvatar/plAvBehaviors.cpp | 8 +- .../PubUtilLib/plAvatar/plAvBehaviors.h | 6 +- .../Plasma/PubUtilLib/plAvatar/plAvBrain.cpp | 4 +- .../Plasma/PubUtilLib/plAvatar/plAvBrain.h | 4 +- .../PubUtilLib/plAvatar/plAvBrainClimb.cpp | 2 +- .../PubUtilLib/plAvatar/plAvBrainClimb.h | 2 +- .../PubUtilLib/plAvatar/plAvBrainCritter.cpp | 22 +- .../PubUtilLib/plAvatar/plAvBrainCritter.h | 46 +- .../PubUtilLib/plAvatar/plAvBrainDrive.cpp | 12 +- .../PubUtilLib/plAvatar/plAvBrainDrive.h | 8 +- .../PubUtilLib/plAvatar/plAvBrainGeneric.cpp | 8 +- .../PubUtilLib/plAvatar/plAvBrainGeneric.h | 10 +- .../PubUtilLib/plAvatar/plAvBrainHuman.cpp | 24 +- .../PubUtilLib/plAvatar/plAvBrainHuman.h | 10 +- .../plAvBrainRideAnimatedPhysical.cpp | 2 +- .../plAvatar/plAvBrainRideAnimatedPhysical.h | 2 +- .../PubUtilLib/plAvatar/plAvBrainSwim.cpp | 10 +- .../PubUtilLib/plAvatar/plAvBrainSwim.h | 6 +- .../plAvatar/plAvCallbackAction.cpp | 34 +- .../PubUtilLib/plAvatar/plAvCallbackAction.h | 30 +- .../plAvatar/plAvLadderModifier.cpp | 8 +- .../PubUtilLib/plAvatar/plAvLadderModifier.h | 2 +- Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h | 6 +- .../PubUtilLib/plAvatar/plAvTaskBrain.cpp | 4 +- .../PubUtilLib/plAvatar/plAvTaskBrain.h | 4 +- .../PubUtilLib/plAvatar/plAvTaskSeek.cpp | 26 +- .../Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h | 36 +- .../PubUtilLib/plAvatar/plAvatarClothing.cpp | 28 +- .../PubUtilLib/plAvatar/plAvatarClothing.h | 18 +- .../PubUtilLib/plAvatar/plAvatarMgr.cpp | 10 +- .../Plasma/PubUtilLib/plAvatar/plAvatarMgr.h | 4 +- .../plAvatar/plAvatarSDLModifier.cpp | 4 +- .../PubUtilLib/plAvatar/plAvatarTasks.cpp | 34 +- .../PubUtilLib/plAvatar/plAvatarTasks.h | 32 +- .../plAvatar/plClothingSDLModifier.cpp | 4 +- .../PubUtilLib/plAvatar/plMatrixChannel.cpp | 14 +- .../PubUtilLib/plAvatar/plMatrixChannel.h | 2 +- .../PubUtilLib/plAvatar/plMultistageBehMod.h | 2 +- .../PubUtilLib/plAvatar/plNPCSpawnMod.cpp | 2 +- .../PubUtilLib/plAvatar/plNPCSpawnMod.h | 2 +- .../Plasma/PubUtilLib/plAvatar/plOneShotMod.h | 2 +- .../plAvatar/plPhysicalControllerCore.cpp | 86 ++-- .../plAvatar/plPhysicalControllerCore.h | 80 ++-- .../PubUtilLib/plAvatar/plPointChannel.cpp | 6 +- .../PubUtilLib/plAvatar/plQuatChannel.cpp | 2 +- .../PubUtilLib/plAvatar/plScalarChannel.cpp | 40 +- .../PubUtilLib/plAvatar/plScalarChannel.h | 30 +- .../PubUtilLib/plAvatar/plSeekPointMod.h | 2 +- .../PubUtilLib/plAvatar/plSittingModifier.cpp | 6 +- .../PubUtilLib/plAvatar/plSittingModifier.h | 2 +- .../PubUtilLib/plAvatar/plSwimRegion.cpp | 18 +- .../Plasma/PubUtilLib/plAvatar/plSwimRegion.h | 30 +- .../PubUtilLib/plDrawable/plAccMeshSmooth.cpp | 14 +- .../PubUtilLib/plDrawable/plAccMeshSmooth.h | 12 +- .../plDrawable/plAccessGeometry.cpp | 4 +- .../plDrawable/plAccessSnapShot.cpp | 2 +- .../PubUtilLib/plDrawable/plAccessSpan.h | 4 +- .../PubUtilLib/plDrawable/plAccessVtxSpan.h | 18 +- .../PubUtilLib/plDrawable/plAvMeshSmooth.cpp | 20 +- .../PubUtilLib/plDrawable/plAvMeshSmooth.h | 12 +- .../PubUtilLib/plDrawable/plCluster.cpp | 16 +- .../PubUtilLib/plDrawable/plClusterGroup.h | 8 +- .../Plasma/PubUtilLib/plDrawable/plCutter.cpp | 38 +- .../Plasma/PubUtilLib/plDrawable/plCutter.h | 22 +- .../plDrawable/plDrawableGenerator.cpp | 18 +- .../plDrawable/plDrawableGenerator.h | 10 +- .../PubUtilLib/plDrawable/plDrawableSpans.cpp | 16 +- .../PubUtilLib/plDrawable/plDrawableSpans.h | 2 +- .../PubUtilLib/plDrawable/plDynaDecal.cpp | 48 +- .../PubUtilLib/plDrawable/plDynaDecal.h | 32 +- .../PubUtilLib/plDrawable/plDynaDecalMgr.cpp | 52 +-- .../PubUtilLib/plDrawable/plDynaDecalMgr.h | 58 +-- .../PubUtilLib/plDrawable/plDynaFootMgr.cpp | 2 +- .../PubUtilLib/plDrawable/plDynaRippleMgr.cpp | 16 +- .../plDrawable/plDynaRippleMgrVS.cpp | 16 +- .../plDrawable/plDynaTorpedoMgr.cpp | 20 +- .../PubUtilLib/plDrawable/plDynaWakeMgr.cpp | 18 +- .../PubUtilLib/plDrawable/plDynaWakeMgr.h | 12 +- .../plDrawable/plFixedWaterState7.cpp | 4 +- .../plDrawable/plFixedWaterState7.h | 32 +- .../PubUtilLib/plDrawable/plGeoSpanDice.cpp | 6 +- .../PubUtilLib/plDrawable/plGeometrySpan.cpp | 2 +- .../PubUtilLib/plDrawable/plGeometrySpan.h | 6 +- .../plDrawable/plInterMeshSmooth.cpp | 8 +- .../PubUtilLib/plDrawable/plInterMeshSmooth.h | 6 +- .../PubUtilLib/plDrawable/plMorphArray.cpp | 2 +- .../PubUtilLib/plDrawable/plMorphArray.h | 6 +- .../PubUtilLib/plDrawable/plMorphDelta.cpp | 16 +- .../PubUtilLib/plDrawable/plMorphDelta.h | 8 +- .../PubUtilLib/plDrawable/plMorphSequence.cpp | 12 +- .../PubUtilLib/plDrawable/plMorphSequence.h | 8 +- .../plDrawable/plMorphSequenceSDLMod.cpp | 4 +- .../plDrawable/plParticleFiller.cpp | 16 +- .../PubUtilLib/plDrawable/plPrintShape.h | 18 +- .../PubUtilLib/plDrawable/plProxyGen.cpp | 4 +- .../Plasma/PubUtilLib/plDrawable/plProxyGen.h | 2 +- .../PubUtilLib/plDrawable/plRipVSConsts.h | 16 +- .../plDrawable/plSpaceTreeMaker.cpp | 22 +- .../PubUtilLib/plDrawable/plSpaceTreeMaker.h | 6 +- .../PubUtilLib/plDrawable/plSpanInstance.cpp | 4 +- .../PubUtilLib/plDrawable/plSpanInstance.h | 8 +- .../PubUtilLib/plDrawable/plSpanTemplate.cpp | 2 +- .../PubUtilLib/plDrawable/plSpanTemplate.h | 16 +- .../PubUtilLib/plDrawable/plSpanTypes.cpp | 12 +- .../PubUtilLib/plDrawable/plSpanTypes.h | 28 +- .../PubUtilLib/plDrawable/plTimedInterp.h | 8 +- .../PubUtilLib/plDrawable/plVisLOSMgr.cpp | 38 +- .../PubUtilLib/plDrawable/plVisLOSMgr.h | 6 +- .../PubUtilLib/plDrawable/plWaveSet7.cpp | 412 ++++++++--------- .../Plasma/PubUtilLib/plDrawable/plWaveSet7.h | 220 +++++----- .../PubUtilLib/plDrawable/plWaveSetBase.h | 4 +- .../Plasma/PubUtilLib/plGImage/CMakeLists.txt | 1 - .../Plasma/PubUtilLib/plGImage/HS_RECT.inc | 235 ---------- .../PubUtilLib/plGImage/hsCodecManager.cpp | 2 +- .../PubUtilLib/plGImage/hsCodecManager.h | 6 +- Sources/Plasma/PubUtilLib/plGImage/hsRect.h | 147 ------- .../PubUtilLib/plGImage/plAVIWriter.cpp | 2 +- .../PubUtilLib/plGImage/plBumpMapGen.cpp | 14 +- .../Plasma/PubUtilLib/plGImage/plBumpMapGen.h | 2 +- Sources/Plasma/PubUtilLib/plGImage/plFont.cpp | 10 +- Sources/Plasma/PubUtilLib/plGImage/plFont.h | 10 +- .../Plasma/PubUtilLib/plGImage/plMipmap.cpp | 67 +-- Sources/Plasma/PubUtilLib/plGImage/plMipmap.h | 34 +- .../PubUtilLib/plGLight/plLightInfo.cpp | 62 +-- .../Plasma/PubUtilLib/plGLight/plLightInfo.h | 76 ++-- .../Plasma/PubUtilLib/plGLight/plLightSpace.h | 2 +- .../PubUtilLib/plGLight/plPerspDirSlave.cpp | 32 +- .../PubUtilLib/plGLight/plPerspDirSlave.h | 2 +- .../plGLight/plPointShadowMaster.cpp | 20 +- .../PubUtilLib/plGLight/plShadowCaster.h | 24 +- .../PubUtilLib/plGLight/plShadowMaster.cpp | 86 ++-- .../PubUtilLib/plGLight/plShadowMaster.h | 38 +- .../PubUtilLib/plGLight/plShadowSlave.cpp | 42 +- .../PubUtilLib/plGLight/plShadowSlave.h | 8 +- .../plInputCore/plAvatarInputInterface.cpp | 8 +- .../plInputCore/plAvatarInputInterface.h | 10 +- .../PubUtilLib/plInputCore/plDInputDevice.h | 2 +- .../plInputCore/plDebugInputInterface.cpp | 6 +- .../plInputCore/plDebugInputInterface.h | 2 +- .../PubUtilLib/plInputCore/plInputDevice.cpp | 12 +- .../PubUtilLib/plInputCore/plInputDevice.h | 22 +- .../PubUtilLib/plInputCore/plInputInterface.h | 4 +- .../plInputCore/plInputInterfaceMgr.cpp | 2 +- .../plInputCore/plInputInterfaceMgr.h | 6 +- .../PubUtilLib/plInputCore/plInputManager.cpp | 2 +- .../PubUtilLib/plInputCore/plInputManager.h | 6 +- .../plInputCore/plSceneInputInterface.cpp | 8 +- .../plInputCore/plSceneInputInterface.h | 4 +- .../plInputCore/plTelescopeInputInterface.cpp | 2 +- .../plInputCore/plTelescopeInputInterface.h | 4 +- .../Plasma/PubUtilLib/plInterp/hsInterp.cpp | 52 +-- Sources/Plasma/PubUtilLib/plInterp/hsInterp.h | 32 +- Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp | 31 +- Sources/Plasma/PubUtilLib/plInterp/hsKeys.h | 18 +- .../Plasma/PubUtilLib/plInterp/hsTimedValue.h | 42 +- .../PubUtilLib/plInterp/plATCEaseCurves.cpp | 94 ++-- .../Plasma/PubUtilLib/plInterp/plAnimPath.cpp | 96 ++-- .../Plasma/PubUtilLib/plInterp/plAnimPath.h | 62 +-- .../PubUtilLib/plInterp/plAnimTimeConvert.cpp | 82 ++-- .../PubUtilLib/plInterp/plAnimTimeConvert.h | 150 +++---- .../PubUtilLib/plInterp/plController.cpp | 64 +-- .../Plasma/PubUtilLib/plInterp/plController.h | 52 +-- .../PubUtilLib/plInterp/plModulator.cpp | 8 +- .../Plasma/PubUtilLib/plInterp/plModulator.h | 10 +- .../PubUtilLib/plIntersect/plClosest.cpp | 56 +-- .../Plasma/PubUtilLib/plIntersect/plClosest.h | 4 +- .../plIntersect/plHardRegionPlanes.cpp | 6 +- .../plIntersect/plHardRegionPlanes.h | 2 +- .../PubUtilLib/plIntersect/plSoftVolume.cpp | 10 +- .../PubUtilLib/plIntersect/plSoftVolume.h | 24 +- .../plIntersect/plSoftVolumeTypes.cpp | 34 +- .../plIntersect/plSoftVolumeTypes.h | 20 +- .../PubUtilLib/plIntersect/plVolumeIsect.cpp | 110 ++--- .../PubUtilLib/plIntersect/plVolumeIsect.h | 62 +-- .../Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp | 34 +- .../Plasma/PubUtilLib/plMath/hsNoiseFunc.h | 16 +- .../Plasma/PubUtilLib/plMath/plTriUtils.cpp | 53 +-- Sources/Plasma/PubUtilLib/plMath/plTriUtils.h | 6 +- .../PubUtilLib/plMessage/plAnimCmdMsg.h | 28 +- .../PubUtilLib/plMessage/plAvatarMsg.cpp | 6 +- .../Plasma/PubUtilLib/plMessage/plAvatarMsg.h | 14 +- .../PubUtilLib/plMessage/plBulletMsg.cpp | 8 +- .../Plasma/PubUtilLib/plMessage/plBulletMsg.h | 16 +- .../plMessage/plDynaDecalEnableMsg.cpp | 2 +- .../plMessage/plDynaDecalEnableMsg.h | 8 +- .../PubUtilLib/plMessage/plDynamicEnvMapMsg.h | 8 +- .../PubUtilLib/plMessage/plInputEventMsg.h | 6 +- .../PubUtilLib/plMessage/plInterestingPing.h | 6 +- .../Plasma/PubUtilLib/plMessage/plMovieMsg.h | 46 +- .../plMessage/plParticleUpdateMsg.h | 16 +- .../PubUtilLib/plMessage/plTimerCallbackMsg.h | 2 +- .../PubUtilLib/plMessage/plTransitionMsg.h | 6 +- .../plModifier/plAnimEventModifier.h | 2 +- .../plAnimTimeConvertSDLModifier.cpp | 2 +- .../plModifier/plAxisAnimModifier.cpp | 4 +- .../plModifier/plAxisAnimModifier.h | 6 +- .../plModifier/plCloneSpawnModifier.h | 2 +- .../PubUtilLib/plModifier/plDecalEnableMod.h | 8 +- .../plModifier/plExcludeRegionModifier.h | 6 +- .../plModifier/plGameMarkerModifier.h | 2 +- .../PubUtilLib/plModifier/plImageLibMod.h | 2 +- .../plModifier/plInterfaceInfoModifier.h | 2 +- .../plModifier/plMaintainersMarkerModifier.h | 2 +- .../plModifier/plResponderModifier.h | 2 +- .../PubUtilLib/plModifier/plSDLModifier.h | 2 +- .../plModifier/plSimpleModifier.cpp | 6 +- .../PubUtilLib/plModifier/plSimpleModifier.h | 6 +- .../plModifier/plSoundSDLModifier.cpp | 2 +- .../PubUtilLib/plModifier/plSpawnModifier.h | 2 +- .../plNetClient/plLinkEffectsMgr.cpp | 6 +- .../PubUtilLib/plNetClient/plLinkEffectsMgr.h | 4 +- .../plNetClient/plNetClientMgrShow.cpp | 2 +- .../plNetClient/plNetClientMgrVoice.cpp | 2 +- .../plNetTransport/plNetTransport.cpp | 4 +- .../plParticleSystem/plConvexVolume.cpp | 10 +- .../plParticleSystem/plConvexVolume.h | 4 +- .../plParticleSystem/plEffectTargetInfo.h | 2 +- .../PubUtilLib/plParticleSystem/plParticle.h | 12 +- .../plParticleSystem/plParticleApplicator.cpp | 2 +- .../plParticleSystem/plParticleEffect.cpp | 54 +-- .../plParticleSystem/plParticleEffect.h | 94 ++-- .../plParticleSystem/plParticleEmitter.cpp | 32 +- .../plParticleSystem/plParticleEmitter.h | 22 +- .../plParticleSystem/plParticleGenerator.cpp | 108 ++--- .../plParticleSystem/plParticleGenerator.h | 50 +-- .../plParticleSystem/plParticleSystem.cpp | 34 +- .../plParticleSystem/plParticleSystem.h | 32 +- .../PubUtilLib/plPhysX/plLOSDispatch.cpp | 8 +- .../PubUtilLib/plPhysX/plPXPhysical.cpp | 4 +- .../Plasma/PubUtilLib/plPhysX/plPXPhysical.h | 12 +- .../plPhysX/plPXPhysicalControllerCore.cpp | 50 +-- .../plPhysX/plPXPhysicalControllerCore.h | 18 +- .../PubUtilLib/plPhysX/plSimulationMgr.cpp | 4 +- .../PubUtilLib/plPhysX/plSimulationMgr.h | 2 +- .../plPhysical/plCollisionDetector.cpp | 6 +- .../plPhysical/plCollisionDetector.h | 4 +- .../plPhysical/plDetectorModifier.h | 2 +- .../PubUtilLib/plPhysical/plPhysicalProxy.cpp | 2 +- .../PubUtilLib/plPhysical/plPhysicalProxy.h | 2 +- .../plPhysical/plPhysicalSndGroup.cpp | 2 +- .../plPhysical/plPhysicalSndGroup.h | 2 +- .../plPhysical/plPhysicsSoundMgr.cpp | 10 +- .../PubUtilLib/plPhysical/plPhysicsSoundMgr.h | 2 +- .../PubUtilLib/plPipeline/hsFogControl.h | 12 +- .../plPipeline/hsG3DDeviceSelector.cpp | 20 +- .../PubUtilLib/plPipeline/plCaptureRender.cpp | 2 +- .../plCubicRenderTargetModifier.cpp | 4 +- .../plPipeline/plCubicRenderTargetModifier.h | 2 +- .../PubUtilLib/plPipeline/plCullTree.cpp | 46 +- .../Plasma/PubUtilLib/plPipeline/plCullTree.h | 22 +- .../PubUtilLib/plPipeline/plDTProgressMgr.cpp | 2 +- .../PubUtilLib/plPipeline/plDXDeviceRefs.cpp | 2 +- .../PubUtilLib/plPipeline/plDXLightRef.h | 2 +- .../PubUtilLib/plPipeline/plDXPipeline.cpp | 158 +++---- .../PubUtilLib/plPipeline/plDXPipeline.h | 32 +- .../PubUtilLib/plPipeline/plDynamicEnvMap.cpp | 10 +- .../PubUtilLib/plPipeline/plDynamicEnvMap.h | 34 +- .../plPipeline/plFogEnvironment.cpp | 15 +- .../PubUtilLib/plPipeline/plFogEnvironment.h | 18 +- .../Plasma/PubUtilLib/plPipeline/plPlates.cpp | 12 +- .../Plasma/PubUtilLib/plPipeline/plPlates.h | 14 +- .../PubUtilLib/plPipeline/plRenderTarget.cpp | 4 +- .../PubUtilLib/plPipeline/plRenderTarget.h | 14 +- .../PubUtilLib/plPipeline/plTransitionMgr.cpp | 12 +- .../PubUtilLib/plPipeline/plTransitionMgr.h | 8 +- .../PubUtilLib/plPipeline/plVertCoder.cpp | 48 +- .../PubUtilLib/plPipeline/plVertCoder.h | 4 +- .../plProgressMgr/plProgressMgr.cpp | 18 +- .../PubUtilLib/plProgressMgr/plProgressMgr.h | 24 +- .../PubUtilLib/plSDL/plStateVariable.cpp | 4 - .../Plasma/PubUtilLib/plScene/plCullPoly.cpp | 12 +- .../Plasma/PubUtilLib/plScene/plCullPoly.h | 10 +- .../Plasma/PubUtilLib/plScene/plOccluder.cpp | 4 +- .../Plasma/PubUtilLib/plScene/plOccluder.h | 6 +- .../PubUtilLib/plScene/plPageTreeMgr.cpp | 6 +- .../PubUtilLib/plScene/plPostEffectMod.cpp | 6 +- .../PubUtilLib/plScene/plPostEffectMod.h | 26 +- .../PubUtilLib/plScene/plRenderRequest.h | 42 +- .../Plasma/PubUtilLib/plSurface/hsGMaterial.h | 8 +- .../PubUtilLib/plSurface/plGrassShaderMod.cpp | 4 +- .../PubUtilLib/plSurface/plGrassShaderMod.h | 14 +- .../Plasma/PubUtilLib/plSurface/plLayer.cpp | 6 +- Sources/Plasma/PubUtilLib/plSurface/plLayer.h | 6 +- .../PubUtilLib/plSurface/plLayerAnimation.cpp | 22 +- .../PubUtilLib/plSurface/plLayerAnimation.h | 10 +- .../PubUtilLib/plSurface/plLayerInterface.h | 12 +- .../PubUtilLib/plSurface/plLayerMultiply.cpp | 4 +- .../PubUtilLib/plSurface/plLayerMultiply.h | 4 +- .../Plasma/PubUtilLib/plSurface/plShader.cpp | 6 +- .../Plasma/PubUtilLib/plSurface/plShader.h | 8 +- .../PubUtilLib/plTransform/hsAffineParts.cpp | 8 +- .../Plasma/PubUtilLib/plTransform/hsEuler.cpp | 7 +- .../Plasma/PubUtilLib/plTransform/hsEuler.h | 4 +- .../plUnifiedTime/plClientUnifiedTime.cpp | 4 - .../plUnifiedTime/plUnifiedTime.cpp | 2 - Sources/Tools/MaxComponent/plAGComponents.cpp | 4 +- .../Tools/MaxComponent/plAnimComponent.cpp | 10 +- .../Tools/MaxComponent/plAudioComponents.cpp | 12 +- .../Tools/MaxComponent/plAudioComponents.h | 2 +- Sources/Tools/MaxComponent/plAutoUIBase.cpp | 2 +- Sources/Tools/MaxComponent/plAutoUIBase.h | 2 +- Sources/Tools/MaxComponent/plAutoUIComp.cpp | 2 +- Sources/Tools/MaxComponent/plAutoUIComp.h | 2 +- Sources/Tools/MaxComponent/plBipedKiller.cpp | 2 +- .../Tools/MaxComponent/plCameraComponents.cpp | 28 +- .../MaxComponent/plClickDragComponent.cpp | 4 +- .../MaxComponent/plClickableComponent.cpp | 4 +- .../MaxComponent/plFootPrintComponent.cpp | 2 +- .../Tools/MaxComponent/plGUIComponents.cpp | 12 +- .../Tools/MaxComponent/plLineFollowComp.cpp | 4 +- .../Tools/MaxComponent/plMiscComponents.cpp | 8 +- .../MaxComponent/plParticleComponents.cpp | 76 ++-- .../Tools/MaxComponent/plParticleComponents.h | 32 +- Sources/Tools/MaxComponent/plResponderMtl.cpp | 4 +- .../Tools/MaxComponent/plWaterComponent.cpp | 34 +- Sources/Tools/MaxComponent/plWaterComponent.h | 4 +- .../Tools/MaxConvert/hsControlConverter.cpp | 38 +- Sources/Tools/MaxConvert/hsControlConverter.h | 26 +- .../Tools/MaxConvert/hsMaterialConverter.cpp | 82 ++-- .../Tools/MaxConvert/hsMaterialConverter.h | 8 +- Sources/Tools/MaxConvert/plBitmapCreator.h | 8 +- Sources/Tools/MaxConvert/plClusterUtil.cpp | 44 +- Sources/Tools/MaxConvert/plClusterUtil.h | 2 +- Sources/Tools/MaxConvert/plDistributor.cpp | 40 +- Sources/Tools/MaxConvert/plDistributor.h | 6 +- Sources/Tools/MaxConvert/plLightMapGen.cpp | 34 +- Sources/Tools/MaxConvert/plMeshConverter.cpp | 36 +- Sources/Tools/MaxConvert/plRenderInstance.cpp | 2 +- Sources/Tools/MaxExport/SimpleExport.h | 2 +- Sources/Tools/MaxExport/plProgressBar.h | 12 +- Sources/Tools/MaxMain/plMaxNode.cpp | 70 +-- Sources/Tools/MaxMain/plMaxNode.h | 2 +- Sources/Tools/MaxMain/plMaxNodeBase.cpp | 12 +- Sources/Tools/MaxMain/plMaxNodeBase.h | 12 +- Sources/Tools/MaxMain/plMaxNodeData.h | 12 +- Sources/Tools/MaxMain/plPhysXCooking.cpp | 28 +- Sources/Tools/MaxMain/plPhysXCooking.h | 2 +- .../Materials/plAnimStealthConvert.cpp | 12 +- .../Materials/plAnimStealthNode.cpp | 16 +- .../Materials/plAnimStealthNode.h | 26 +- .../MaxPlasmaMtls/Materials/plPassMtlBase.cpp | 12 +- .../Tools/plFontConverter/plFontFreeType.cpp | 4 +- 584 files changed, 5414 insertions(+), 6412 deletions(-) delete mode 100644 Sources/Plasma/CoreLib/HS_POINT2.inc delete mode 100644 Sources/Plasma/CoreLib/hsFixedTypes.h delete mode 100644 Sources/Plasma/CoreLib/hsScalar.h delete mode 100644 Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc delete mode 100644 Sources/Plasma/PubUtilLib/plGImage/hsRect.h diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 8c8ca2ee..a963bd12 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -164,7 +164,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define MSG_LOADING_BAR -// static hsVector3 gAbsDown(0,0,-hsScalar1); +// static hsVector3 gAbsDown(0,0,-1.f); static plDispatchBase* gDisp = nil; static plTimerCallbackManager* gTimerMgr = nil; @@ -571,7 +571,7 @@ hsBool plClient::InitPipeline() float yon = 500.0f; - pipe->SetFOV( 60.f, hsIntToScalar( 60.f * pipe->Height() / pipe->Width() ) ); + pipe->SetFOV( 60.f, int32_t( 60.f * pipe->Height() / pipe->Width() ) ); pipe->SetDepth( 0.3f, yon ); hsMatrix44 id; @@ -1296,7 +1296,7 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress) } //============================================================================ -void plClient::IIncProgress (hsScalar byHowMuch, const char * text) +void plClient::IIncProgress (float byHowMuch, const char * text) { if (fProgressBar) { #ifndef PLASMA_EXTERNAL_RELEASE @@ -1307,7 +1307,7 @@ void plClient::IIncProgress (hsScalar byHowMuch, const char * text) } //============================================================================ -void plClient::IStartProgress( const char *title, hsScalar len ) +void plClient::IStartProgress( const char *title, float len ) { if (fProgressBar) { @@ -1519,7 +1519,7 @@ hsBool plClient::StartInit() plgAudioSys::Activate(true); - plConst(hsScalar) delay(2.f); + plConst(float) delay(2.f); //commenting out publisher splash for MORE //IPlayIntroBink("avi/intro0.bik", delay, 0.f, 0.f, 1.f, 1.f, 0.75); //if( GetDone() ) return false; @@ -1731,7 +1731,7 @@ hsBool plClient::IUpdate() // Time may have been clamped in IncSysSeconds, depending on hsTimer's current mode. double currTime = hsTimer::GetSysSeconds(); - hsScalar delSecs = hsTimer::GetDelSysSeconds(); + float delSecs = hsTimer::GetDelSysSeconds(); // do not change this ordering @@ -1971,7 +1971,7 @@ void plClient::IKillMovies() fMovies.Reset(); } -hsBool plClient::IPlayIntroBink(const char* movieName, hsScalar endDelay, hsScalar posX, hsScalar posY, hsScalar scaleX, hsScalar scaleY, hsScalar volume /* = 1.0 */) +hsBool plClient::IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume /* = 1.0 */) { SetQuitIntro(false); plBinkPlayer player; diff --git a/Sources/Plasma/Apps/plClient/plClient.h b/Sources/Plasma/Apps/plClient/plClient.h index bc7f64a4..0b36c821 100644 --- a/Sources/Plasma/Apps/plClient/plClient.h +++ b/Sources/Plasma/Apps/plClient/plClient.h @@ -189,13 +189,13 @@ protected: void IProcessRenderRequests(hsTArray& reqs); void IAddRenderRequest(plRenderRequest* req); - hsBool IPlayIntroBink(const char* movieName, hsScalar endDelay, hsScalar posX, hsScalar posY, hsScalar scaleX, hsScalar scaleY, hsScalar volume = 1.0); + hsBool IPlayIntroBink(const char* movieName, float endDelay, float posX, float posY, float scaleX, float scaleY, float volume = 1.0); hsBool IHandleMovieMsg(plMovieMsg* mov); void IKillMovies(); void IServiceMovies(); - void IStartProgress( const char *title, hsScalar len ); - void IIncProgress( hsScalar byHowMuch, const char *text ); + void IStartProgress( const char *title, float len ); + void IIncProgress( float byHowMuch, const char *text ); void IStopProgress( void ); static void IDispatchMsgReceiveCallback(); diff --git a/Sources/Plasma/CoreLib/CMakeLists.txt b/Sources/Plasma/CoreLib/CMakeLists.txt index 2196d9a6..1cc1201a 100644 --- a/Sources/Plasma/CoreLib/CMakeLists.txt +++ b/Sources/Plasma/CoreLib/CMakeLists.txt @@ -51,7 +51,6 @@ set(CoreLib_HEADERS hsCritSect.h hsExceptions.h hsFastMath.h - hsFixedTypes.h hsGeometry3.h hsHashTable.h hsMalloc.h @@ -63,7 +62,6 @@ set(CoreLib_HEADERS hsQueue.h hsRefCnt.h hsSafeRefCnt.h - hsScalar.h hsStlSortUtils.h hsSTLStream.h hsStlUtils.h diff --git a/Sources/Plasma/CoreLib/HS_POINT2.inc b/Sources/Plasma/CoreLib/HS_POINT2.inc deleted file mode 100644 index 30d95867..00000000 --- a/Sources/Plasma/CoreLib/HS_POINT2.inc +++ /dev/null @@ -1,61 +0,0 @@ -struct HS_POINT2_NAME { - HS_POINT2_TYPE fX, fY; - - HS_POINT2_NAME& Set(HS_POINT2_TYPE x, HS_POINT2_TYPE y) - { - fX = x; - fY = y; - return *this; - } - HS_POINT2_NAME& operator+=(const HS_POINT2_NAME& s) - { - this->fX += s.fX; - this->fY += s.fY; - return *this; - } - HS_POINT2_NAME& operator-=(const HS_POINT2_NAME& s) - { - this->fX -= s.fX; - this->fY -= s.fY; - return *this; - } - -#if 0 // Havok reeks - friend int operator==(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - return (s.fX == t.fX && s.fY == t.fY); - } - friend int operator!=(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - return !(s == t); - } -#else // Havok reeks - int operator==(const HS_POINT2_NAME& ss) const - { - return (ss.fX == fX && ss.fY == fY); - } - int operator!=(const HS_POINT2_NAME& ss) - { - return !(ss == *this); - } -#endif // Havok reeks - friend HS_POINT2_NAME operator+(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - HS_POINT2_NAME result; - result.Set(s.fX + t.fX, s.fY + t.fY); - return result; - } - friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s, const HS_POINT2_NAME& t) - { - HS_POINT2_NAME result; - result.Set(s.fX - t.fX, s.fY - t.fY); - return result; - } - friend HS_POINT2_NAME operator-(const HS_POINT2_NAME& s) - { - HS_POINT2_NAME result = { -s.fX, -s.fY }; - return result; - } - -#undef HS_POINT2_NAME -#undef HS_POINT2_TYPE diff --git a/Sources/Plasma/CoreLib/HeadSpin.cpp b/Sources/Plasma/CoreLib/HeadSpin.cpp index 2dd1ef1d..afbf2e72 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.cpp +++ b/Sources/Plasma/CoreLib/HeadSpin.cpp @@ -44,6 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsUtils.h" #include "hsStlUtils.h" #include "hsExceptions.h" +#include #if HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/CoreLib/hsBounds.cpp b/Sources/Plasma/CoreLib/hsBounds.cpp index fbb148c2..ca8d7fad 100644 --- a/Sources/Plasma/CoreLib/hsBounds.cpp +++ b/Sources/Plasma/CoreLib/hsBounds.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsFastMath.h" -const hsScalar hsBounds::kRealSmall = 1.0e-5f; +const float hsBounds::kRealSmall = 1.0e-5f; /////////////////////////////////////////////////////////////////////////////////////// // @@ -186,18 +186,18 @@ void hsBounds3::MakeSymmetric(const hsPoint3* p) if( fType != kBoundsNormal ) return; - hsScalar delMax = 0; + float delMax = 0; int i; for( i = 0; i < 3; i++ ) { - hsScalar delUp; + float delUp; delUp = fMaxs[i] - (*p)[i]; delMax = hsMaximum(delMax, delUp); delUp = (*p)[i] - fMins[i]; delMax = hsMaximum(delMax, delUp); } - const hsScalar sqrtTwo = 1.41421f; + const float sqrtTwo = 1.41421f; delMax *= sqrtTwo; hsAssert((delMax > -1.e6f)&&(delMax < 1.e6f), "MakeSymmetric going out to sea"); fCenter = *p; @@ -213,8 +213,8 @@ void hsBounds3::InscribeSphere() if( fType != kBoundsNormal ) return; - const hsScalar ooSix = hsScalarInvert(2.f * 3.f); - hsScalar a = GetMaxDim() * ooSix; + const float ooSix = hsInvert(2.f * 3.f); + float a = GetMaxDim() * ooSix; hsPoint3 p = GetCenter(); p.fX += a; p.fY += a; @@ -264,7 +264,7 @@ hsBool hsBounds3::IsInside(const hsPoint3* pos) const void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const { hsPoint3 center = (*GetMaxs() + *GetMins()) * 0.5f; - hsScalar radius = GetMaxDim() * 0.5f; + float radius = GetMaxDim() * 0.5f; const int nLong = 9; const int nLati = 5; @@ -290,13 +290,13 @@ void hsBounds3::MakeTriMeshSphere(hsGTriMesh* tMesh, hsPoint3* cornersIn) const { for( j = 0; j < nLati; j++ ) { - hsScalar theta = (hsScalar(i) / nLong) * 2.f * hsScalarPI; - hsScalar cosTheta = hsCosine(theta); - hsScalar sinTheta = hsSine(theta); + float theta = (float(i) / nLong) * 2.f * M_PI; + float cosTheta = cos(theta); + float sinTheta = sin(theta); - hsScalar phi = (hsScalar(j+1) / (nLati+1)) * hsScalarPI; - hsScalar cosPhi = hsCosine(phi); - hsScalar sinPhi = hsSine(phi); + float phi = (float(j+1) / (nLati+1)) * M_PI; + float cosPhi = cos(phi); + float sinPhi = sin(phi); pt.fX = center.fX + radius * sinPhi * cosTheta; pt.fY = center.fY + radius * sinPhi * sinTheta; @@ -412,13 +412,13 @@ void hsBounds3::TestPlane(const hsVector3 &n, hsPoint2 &depth) const { hsAssert(fType == kBoundsNormal, "TestPlane only valid for kBoundsNormal filled bounds"); - hsScalar dmax = fMins.InnerProduct(n); - hsScalar dmin = dmax; + float dmax = fMins.InnerProduct(n); + float dmin = dmax; int i; for( i = 0; i < 3; i++ ) { - hsScalar dd; + float dd; dd = fMaxs[i] - fMins[i]; dd *= n[i]; @@ -432,19 +432,19 @@ void hsBounds3::TestPlane(const hsVector3 &n, hsPoint2 &depth) const depth.fY = dmax; } -hsScalar hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out) +float hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out) { hsVector3 del(v1, v0); - hsScalar magSq = del.MagnitudeSquared(); - hsScalar t = 0.f; + float magSq = del.MagnitudeSquared(); + float t = 0.f; if( magSq < hsBounds::kRealSmall ) { *out = *v0; } else { - t = del.InnerProduct(hsVector3(p, v0)) * hsScalarInvert(magSq); - if( t >= hsScalar1 ) + t = del.InnerProduct(hsVector3(p, v0)) * hsInvert(magSq); + if( t >= 1.f ) *out = *v1; else if( t <= 0 ) *out = *v0; @@ -454,10 +454,10 @@ hsScalar hsBounds3::ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, co return t; } -hsScalar hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out) +float hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out) { - hsScalar magSq = v->MagnitudeSquared(); - hsScalar t = 0.f; + float magSq = v->MagnitudeSquared(); + float t = 0.f; hsPoint3 origin(0,0,0); if( magSq < hsBounds::kRealSmall ) { @@ -465,7 +465,7 @@ hsScalar hsBounds3::ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector } else { - t = v->InnerProduct(hsVector3(*p)) * hsScalarInvert(magSq); + t = v->InnerProduct(hsVector3(*p)) * hsInvert(magSq); *out = hsPoint3(*v * t); } return t; @@ -542,7 +542,7 @@ hsBool hsBoundsOriented::IsInside(const hsPoint3* pos) const int i; for( i = 0; i < fNumPlanes; i++ ) { - hsScalar dis = fPlanes[i].fN.InnerProduct(pos); + float dis = fPlanes[i].fN.InnerProduct(pos); dis += fPlanes[i].fD; if( dis > 0.f ) return false; @@ -690,7 +690,7 @@ void hsBounds3Ext::IMakeDists() const fDists[i].fY = fDists[i].fX + fAxes[i].InnerProduct(fAxes[i]); if( fDists[i].fX > fDists[i].fY ) { - hsScalar t = fDists[i].fX; + float t = fDists[i].fX; fDists[i].fX = fDists[i].fY; fDists[i].fY = t; } @@ -713,7 +713,7 @@ void hsBounds3Ext::IMakeSphere() const int i; for( i = 1; i < 3; i++ ) { - hsScalar dist = fMaxs[i] - fMins[i]; + float dist = fMaxs[i] - fMins[i]; if( dist < fRadius ) fRadius = dist; } @@ -721,21 +721,21 @@ void hsBounds3Ext::IMakeSphere() const } else { - fRadius = hsSquareRoot(hsVector3(&fMaxs, &fCenter).MagnitudeSquared()); + fRadius = sqrt(hsVector3(&fMaxs, &fCenter).MagnitudeSquared()); } } else { if( fBounds3Flags & kIsSphere ) { - hsScalar minMagSq = fAxes[0].MagnitudeSquared(); - hsScalar magSq = fAxes[1].MagnitudeSquared(); + float minMagSq = fAxes[0].MagnitudeSquared(); + float magSq = fAxes[1].MagnitudeSquared(); if( magSq < minMagSq ) magSq = minMagSq; magSq = fAxes[2].MagnitudeSquared(); if( magSq < minMagSq ) magSq = minMagSq; - fRadius = hsSquareRoot(magSq); + fRadius = sqrt(magSq); } else { @@ -747,7 +747,7 @@ void hsBounds3Ext::IMakeSphere() const if( !IAxisIsZero(i) ) accum += fAxes[i]; } - fRadius = hsSquareRoot((accum * 0.5f).MagnitudeSquared()); + fRadius = sqrt((accum * 0.5f).MagnitudeSquared()); } } fExtFlags |= kSphereSet; @@ -850,7 +850,7 @@ void hsBounds3Ext::Union(const hsVector3 *v) int i; for( i = 0; i < 3; i++ ) { - hsScalar dot = fAxes[i].InnerProduct(v); + float dot = fAxes[i].InnerProduct(v); dot /= fAxes[i].MagnitudeSquared(); if( dot > 0 ) { @@ -911,9 +911,9 @@ void hsBounds3Ext::InscribeSphere() return; } - const hsScalar oneThird = hsScalarInvert(3.f); -// hsScalar a = GetMaxDim() * hsScalarInvert(6.f); - hsScalar a = GetRadius() * oneThird; + const float oneThird = hsInvert(3.f); +// float a = GetMaxDim() * hsInvert(6.f); + float a = GetRadius() * oneThird; hsPoint3 p = GetCenter(); p.fX += a; p.fY += a; @@ -941,12 +941,12 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) fCorner = *m * fMins; hsVector3 v; - hsScalar span; + float span; span = fMaxs.fX - fMins.fX; if( span < kRealSmall ) { fExtFlags |= kAxisZeroZero; - span = hsScalar1; + span = 1.f; } v.Set(span, 0, 0); fAxes[0] = *m * v; @@ -954,7 +954,7 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) if( span < kRealSmall ) { fExtFlags |= kAxisOneZero; - span = hsScalar1; + span = 1.f; } v.Set(0, span, 0); fAxes[1] = *m * v; @@ -962,7 +962,7 @@ void hsBounds3Ext::Transform(const hsMatrix44 *m) if( span < kRealSmall ) { fExtFlags |= kAxisTwoZero; - span = hsScalar1; + span = 1.f; } v.Set(0, 0, span); fAxes[2] = *m * v; @@ -1001,7 +1001,7 @@ void hsBounds3Ext::Translate(const hsVector3 &v) int i; for( i = 0; i < 3; i++ ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(v); fDists[i].fX += d; fDists[i].fY += d; @@ -1020,7 +1020,7 @@ hsBool hsBounds3Ext::IsInside(const hsPoint3 *p) const int i; for( i = 0; i < 3; i++ ) { - hsScalar diss = p->InnerProduct(fAxes[i]); + float diss = p->InnerProduct(fAxes[i]); if( (diss < fDists[i].fX) ||(diss > fDists[i].fY) ) return false; @@ -1068,15 +1068,15 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, hsPoint2 &depth) const } else { - hsScalar dmax = fCorner.InnerProduct(n); - hsScalar dmin = dmax; + float dmax = fCorner.InnerProduct(n); + float dmin = dmax; int i; for( i = 0; i < 3; i++ ) { if( !IAxisIsZero(i) ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(n); if( d < 0 ) dmin += d; @@ -1098,9 +1098,9 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint { if( fExtFlags & kAxisAligned ) { - hsScalar dmax = fMins.InnerProduct(n); - hsScalar dmin = dmax; - hsScalar dvel = myVel.InnerProduct(n); + float dmax = fMins.InnerProduct(n); + float dmin = dmax; + float dvel = myVel.InnerProduct(n); if( dvel < 0 ) dmin += dvel; else @@ -1109,7 +1109,7 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint int i; for( i = 0; i < 3; i++ ) { - hsScalar dd; + float dd; dd = fMaxs[i] - fMins[i]; dd *= n[i]; @@ -1124,9 +1124,9 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint } else { - hsScalar dmax = fCorner.InnerProduct(n); - hsScalar dmin = dmax; - hsScalar dvel = myVel.InnerProduct(n); + float dmax = fCorner.InnerProduct(n); + float dmin = dmax; + float dvel = myVel.InnerProduct(n); if( dvel < 0 ) dmin += dvel; else @@ -1137,7 +1137,7 @@ void hsBounds3Ext::TestPlane(const hsVector3 &n, const hsVector3 &myVel, hsPoint { if( !IAxisIsZero(i) ) { - hsScalar d; + float d; d = fAxes[i].InnerProduct(n); if( d < 0 ) dmin += d; @@ -1159,8 +1159,8 @@ int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 & int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( ptVel[i] < 0 ) effMax -= ptVel[i]; else @@ -1191,15 +1191,15 @@ int32_t hsBounds3Ext::TestPoints(int n, const hsPoint3 *pList, const hsVector3 & int i; for( i = 0; i < 3; i++ ) { - hsScalar diff = fAxes[i].InnerProduct(ptVel); + float diff = fAxes[i].InnerProduct(ptVel); hsBool someLow = false; hsBool someHi = false; hsBool someIn = false; int j; for( j = 0; j < n; j++ ) { - hsScalar d = fAxes[i].InnerProduct(pList[j]); - hsScalar ddiff = d + diff; + float d = fAxes[i].InnerProduct(pList[j]); + float ddiff = d + diff; if( d < fDists[i].fX ) someLow = true; else if( d > fDists[i].fY ) @@ -1260,7 +1260,7 @@ hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& int i; for( i = 0; i < 3; i++ ) { - hsScalar dist = fAxes[i].InnerProduct(p); + float dist = fAxes[i].InnerProduct(p); if( dist < fDists[i].fX ) { outer += fAxes[i]; @@ -1271,7 +1271,7 @@ hsBool hsBounds3Ext::ClosestPoint(const hsPoint3& p, hsPoint3& inner, hsPoint3& } else { - hsScalar t = (dist - fDists[i].fX) / (fDists[i].fY - fDists[i].fX); + float t = (dist - fDists[i].fX) / (fDists[i].fY - fDists[i].fX); inner += t * fAxes[i]; if( t > 0.5f ) outer += fAxes[i]; @@ -1309,8 +1309,8 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) if( other.fExtFlags & kAxisAligned ) { - hsScalar myMin = fMins[i]; - hsScalar myMax = fMaxs[i]; + float myMin = fMins[i]; + float myMax = fMaxs[i]; if( myVel[i] < 0 ) myMin += myVel[i]; else @@ -1329,11 +1329,11 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel) // still leaves the 3 axes of origAxis.Cross(myVel) hsVector3 ax = fAxes[i] % myVel; - hsScalar dmax = fCorner.InnerProduct(ax); - hsScalar dmin = dmax; + float dmax = fCorner.InnerProduct(ax); + float dmin = dmax; int j = i+1; if( 3 == j )j = 0; - hsScalar d; + float d; d = fAxes[j].InnerProduct(ax); if( d < 0 ) dmin += d; @@ -1368,10 +1368,10 @@ static hsBool ISectInterval(const hsPoint2& other, const hsPoint2& mine) static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine, const hsVector3& inAx, - hsVector3 &outAx, hsScalar& depth) + hsVector3 &outAx, float& depth) { depth = 0; - hsScalar d0, d1; + float d0, d1; d0 = other.fY - mine.fX; if( d0 <= 0 ) return false; @@ -1398,19 +1398,19 @@ static hsBool ITestDepth(const hsPoint2& other, const hsPoint2& mine, } int32_t hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, - hsScalar* tClose, hsScalar* tImpact) const + float* tClose, float* tImpact) const { // Should assert both have their spheres set. hsVector3 meToOt(&other.GetCenter(), &GetCenter()); // cTerm = (myCenter - otCenter)^2 - (myRad + otRad)^2 - hsScalar cTerm; + float cTerm; cTerm = GetRadius() + other.GetRadius(); cTerm *= -cTerm; - hsScalar meToOtLen = meToOt.MagnitudeSquared(); + float meToOtLen = meToOt.MagnitudeSquared(); cTerm += meToOtLen; if( cTerm <= 0 ) { @@ -1418,27 +1418,27 @@ int32_t hsBounds3Ext::IClosestISect(const hsBounds3Ext& other, const hsVector3& return -1; // started off in contact } - hsScalar ooATerm = myVel.InnerProduct(myVel); + float ooATerm = myVel.InnerProduct(myVel); if( ooATerm < hsBounds::kRealSmall ) { *tClose = *tImpact = 0; return 0; } - ooATerm = hsScalarInvert(ooATerm); + ooATerm = hsInvert(ooATerm); - hsScalar bTerm = myVel.InnerProduct(meToOt); + float bTerm = myVel.InnerProduct(meToOt); bTerm *= ooATerm; - hsScalar bSqTerm = bTerm * bTerm; + float bSqTerm = bTerm * bTerm; // bTerm is t for closest point to line - hsScalar det = bSqTerm - ooATerm * cTerm; + float det = bSqTerm - ooATerm * cTerm; if( det < 0 ) { *tClose = *tImpact = bTerm; return 0; } - det = hsSquareRoot(det); + det = sqrt(det); *tClose = bTerm; *tImpact = bTerm - det; @@ -1451,26 +1451,26 @@ void hsBounds3Ext::Unalign() fCorner = fMins; hsVector3 v; - hsScalar span; + float span; span = fMaxs.fX - fMins.fX; if( span < kRealSmall ) { fExtFlags |= kAxisZeroZero; - span = hsScalar1; + span = 1.f; } fAxes[0].Set(span, 0, 0); span = fMaxs.fY - fMins.fY; if( span < kRealSmall ) { fExtFlags |= kAxisOneZero; - span = hsScalar1; + span = 1.f; } fAxes[1].Set(0, span, 0); span = fMaxs.fZ - fMins.fZ; if( span < kRealSmall ) { fExtFlags |= kAxisTwoZero; - span = hsScalar1; + span = 1.f; } fAxes[2].Set(0, 0, span); } @@ -1491,15 +1491,15 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, if( !(other.fExtFlags & (kDistsSet|kAxisAligned)) ) other.IMakeDists(); - const hsScalar kRealBig = 1.e30f; - hsScalar tstDepths[9]; + const float kRealBig = 1.e30f; + float tstDepths[9]; hsVector3 tstAxes[9]; - hsScalar totDepth = 0; + float totDepth = 0; int nDeep = 0; int i; for( i = 0; i < 3; i++ ) { - const hsScalar kFavorConstant = 0.01f; // smaller is favored + const float kFavorConstant = 0.01f; // smaller is favored other.TestPlane(fAxes[i], -myVel, depth); @@ -1527,9 +1527,9 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, depth.fY = other.fMaxs[i]; hsVector3 ax; - ax.Set( 0 == i ? hsScalar1 : 0, - 1 == i ? hsScalar1 : 0, - 2 == i ? hsScalar1 : 0); + ax.Set( 0 == i ? 1.f : 0, + 1 == i ? 1.f : 0, + 2 == i ? 1.f : 0); if( !ITestDepth(depth, mine, ax, tstAxes[i+3], tstDepths[i+3]) ) return false; @@ -1571,7 +1571,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, { hsPoint2 myDepth; myDepth.fX = myDepth.fY = fCorner.InnerProduct(ax); - hsScalar d; + float d; int j = i == 2 ? 0 : i+1; if( !IAxisIsZero(j) ) { @@ -1604,7 +1604,7 @@ hsBool hsBounds3Ext::ISectBB(const hsBounds3Ext &other, const hsVector3 &myVel, hsVector3 norm; if( totDepth <= 0 ) { - hsScalar t, tIgnore; + float t, tIgnore; IClosestISect(other, myVel, &tIgnore, &t); if( t < 0 ) t = 0; @@ -1648,8 +1648,8 @@ hsBool hsBounds3Ext::ISectABB(const hsBounds3Ext &other, const hsVector3 &myVel) int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( myVel[i] > 0 ) effMax += myVel[i]; else @@ -1675,17 +1675,17 @@ hsBool hsBounds3Ext::ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) // such uglies... if( myVel.MagnitudeSquared() > 0 ) { - hsScalar parm = hsVector3(&other.GetCenter(), &fCenter).InnerProduct(myVel) + float parm = hsVector3(&other.GetCenter(), &fCenter).InnerProduct(myVel) / myVel.InnerProduct(myVel); if( parm > 0 ) { - if( parm > hsScalar1 ) - parm = hsScalar1; + if( parm > 1.f ) + parm = 1.f; closestPt += myVel * parm; } } - hsScalar combRad = fRadius + other.fRadius; + float combRad = fRadius + other.fRadius; return hsVector3(&closestPt, &other.GetCenter()).MagnitudeSquared() < combRad*combRad; } @@ -1696,8 +1696,8 @@ hsBool hsBounds3Ext::ISectTriABB(hsBounds3Tri &tri, const hsVector3 &myVel) cons int i; for( i = 0; i < 3; i++ ) { - hsScalar effMax = fMaxs[i]; - hsScalar effMin = fMins[i]; + float effMax = fMaxs[i]; + float effMin = fMins[i]; if( myVel[i] < 0 ) effMin += myVel[i]; else @@ -1730,8 +1730,8 @@ hsBool hsBounds3Ext::TriBSHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsVector3 repel; repel.Set(&myPt, &closePt); - hsScalar myDepth; - hsScalar repelMagSq = repel.MagnitudeSquared(); + float myDepth; + float repelMagSq = repel.MagnitudeSquared(); if( repelMagSq < hsBounds::kRealSmall ) { repel = tri.fNormal; @@ -1767,11 +1767,11 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsPoint3 myPt = fCorner; myPt += myVel; - const hsScalar kMinDist = 1.f; // Huge min dist because world is really big right now. mf horse + const float kMinDist = 1.f; // Huge min dist because world is really big right now. mf horse int i; for( i = 0; i < 3; i++ ) { - hsScalar axDot = fAxes[i].InnerProduct(tri.fNormal); + float axDot = fAxes[i].InnerProduct(tri.fNormal); if( axDot < -kMinDist ) { // moving towards @@ -1796,7 +1796,7 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH repel.Set(&myPt, &closePt); repel += (-2.f * repel.InnerProduct(tri.fNormal)) * tri.fNormal; - hsScalar repelMag = hsFastMath::InvSqrt(repel.MagnitudeSquared()); + float repelMag = hsFastMath::InvSqrt(repel.MagnitudeSquared()); if( repelMag < hsBounds::kRealSmall ) { @@ -1826,18 +1826,18 @@ hsBool hsBounds3Ext::TriBBHitInfo(hsBounds3Tri& tri, const hsVector3& myVel, hsH hsVector3 repel; repel.Set(&myPt, &closePt); - hsScalar repelDotNorm = repel.InnerProduct(tri.fNormal); + float repelDotNorm = repel.InnerProduct(tri.fNormal); if( repelDotNorm < 0 ) { repel += (-2.f * repelDotNorm) * tri.fNormal; } - hsScalar repelMagSq = repel.MagnitudeSquared(); + float repelMagSq = repel.MagnitudeSquared(); if( repelMagSq < hsBounds::kRealSmall ) repel = tri.fNormal; else { - hsScalar repelMag = hsFastMath::InvSqrt(repelMagSq); + float repelMag = hsFastMath::InvSqrt(repelMagSq); repel *= repelMag; } @@ -1872,7 +1872,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const if( !(tri.fTriFlags & hsBounds3Tri::kAxesSet) ) tri.SetAxes(); - hsScalar depth = tri.fDist - faceDepth.fX; + float depth = tri.fDist - faceDepth.fX; hsVector3 norm = tri.fNormal; // that only leaves the planes of triEdge.Cross(vel) @@ -1886,7 +1886,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const return false; #if 0 - hsScalar testDepth = tri.fPerpDists[i].fY - depths.fX; + float testDepth = tri.fPerpDists[i].fY - depths.fX; if( testDepth < depth ) { depth = testDepth; @@ -1894,7 +1894,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel) const } #endif } - hsScalar vDotN = myVel.InnerProduct(tri.fNormal); + float vDotN = myVel.InnerProduct(tri.fNormal); if( vDotN > 0 ) depth -= vDotN; @@ -1914,7 +1914,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit ||(tri.fDist < faceDepth.fX) ) return false; - hsScalar centDist = tri.fNormal.InnerProduct(hit->fRootCenter); + float centDist = tri.fNormal.InnerProduct(hit->fRootCenter); if( centDist < tri.fDist ) return false; @@ -1925,7 +1925,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit if( !(tri.fTriFlags & hsBounds3Tri::kAxesSet) ) tri.SetAxes(); - hsScalar depth = tri.fDist - faceDepth.fX; + float depth = tri.fDist - faceDepth.fX; hsVector3 norm = tri.fNormal; // that only leaves the planes of triEdge.Cross(vel) @@ -1939,7 +1939,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit return false; #if 0 - hsScalar testDepth = tri.fPerpDists[i].fY - depths.fX; + float testDepth = tri.fPerpDists[i].fY - depths.fX; if( testDepth < depth ) { depth = testDepth; @@ -1947,7 +1947,7 @@ hsBool hsBounds3Ext::ISectTriBB(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit } #endif } - hsScalar vDotN = myVel.InnerProduct(tri.fNormal); + float vDotN = myVel.InnerProduct(tri.fNormal); if( vDotN > 0 ) depth -= vDotN; @@ -1978,11 +1978,11 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const IMakeSphere(); hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (TriBS)"); - hsScalar radScaled = fRadius * tri.fNormal.Magnitude(); - hsScalar centerDist = tri.fNormal.InnerProduct(fCenter); - hsScalar velDist = tri.fNormal.InnerProduct(myVel); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; + float radScaled = fRadius * tri.fNormal.Magnitude(); + float centerDist = tri.fNormal.InnerProduct(fCenter); + float velDist = tri.fNormal.InnerProduct(myVel); + float effMin = centerDist; + float effMax = centerDist; if( velDist > 0 ) effMax += velDist; @@ -1997,7 +1997,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const return false; // mf horse - hsScalar normDepth = tri.fDist - (centerDist - radScaled + velDist); + float normDepth = tri.fDist - (centerDist - radScaled + velDist); if( normDepth <= 0 ) { // we'll report a depth of zero to (hopefully) neutralize any effects @@ -2034,7 +2034,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel) const else effMin += velDist; - hsScalar radScale = fRadius * tri.fPerpAxes[i].Magnitude(); + float radScale = fRadius * tri.fPerpAxes[i].Magnitude(); effMax += radScale; effMin -= radScale; if( tri.fPerpDists[i].fY <= effMin ) @@ -2053,11 +2053,11 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit IMakeSphere(); hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (TriBS)"); - hsScalar radScaled = fRadius * tri.fNormal.Magnitude(); - hsScalar centerDist = tri.fNormal.InnerProduct(fCenter); - hsScalar velDist = tri.fNormal.InnerProduct(myVel); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; + float radScaled = fRadius * tri.fNormal.Magnitude(); + float centerDist = tri.fNormal.InnerProduct(fCenter); + float velDist = tri.fNormal.InnerProduct(myVel); + float effMin = centerDist; + float effMax = centerDist; if( velDist > 0 ) effMax += velDist; @@ -2072,7 +2072,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit return false; // mf horse - hsScalar normDepth = tri.fDist - (centerDist - radScaled + velDist); + float normDepth = tri.fDist - (centerDist - radScaled + velDist); if( normDepth <= 0 ) { #if 0 // need to report the collision even if the object is leaving the tri @@ -2120,7 +2120,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit else effMin += velDist; - hsScalar radScale = fRadius * tri.fPerpAxes[i].Magnitude(); + float radScale = fRadius * tri.fPerpAxes[i].Magnitude(); effMax += radScale; effMin -= radScale; if( tri.fPerpDists[i].fY <= effMin ) @@ -2130,7 +2130,7 @@ hsBool hsBounds3Ext::ISectTriBS(hsBounds3Tri &tri, const hsVector3 &myVel, hsHit } - hsScalar invLen = hsScalarInvert(tri.fNormal.Magnitude()); + float invLen = hsInvert(tri.fNormal.Magnitude()); hit->Set(this, &tri, &tri.fNormal, normDepth); // mf horse - move this into Set()? @@ -2149,7 +2149,7 @@ hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel if(!(other.fExtFlags & kSphereSet) ) other.IMakeSphere(); - hsScalar tClose, tImpact; + float tClose, tImpact; if( !IClosestISect(other, myVel, &tClose, &tImpact) ) return false; if( (tImpact < 0) || (tImpact > 1.f) ) @@ -2163,8 +2163,8 @@ hsBool hsBounds3Ext::ISectBSBS(const hsBounds3Ext& other, const hsVector3& myVel hsVector3 del; del.Set(&closePt, &other.GetCenter()); - hsScalar mag = del.Magnitude(); - hsScalar depth = GetRadius() + other.GetRadius() - mag; + float mag = del.Magnitude(); + float depth = GetRadius() + other.GetRadius() - mag; if( depth <= 0 ) return false; @@ -2201,10 +2201,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe hsAssert(fBounds3Flags & kCenterValid, "Sphere set but not center (BoxBS(vel))"); hsVector3 minAxis; - hsScalar minDepth; + float minDepth; hsBool haveAxis = false; hsVector3 tstAxis; - hsScalar tstDepth; + float tstDepth; int i; for( i = 0; i < 3; i++ ) { @@ -2212,9 +2212,9 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe if( other.fExtFlags & kAxisAligned ) { // first try the other box axes - hsScalar effMin = fCenter[i]; - hsScalar effMax = effMin; - hsScalar velDist = myVel[i]; + float effMin = fCenter[i]; + float effMax = effMin; + float velDist = myVel[i]; if( velDist > 0 ) effMax += velDist; else @@ -2232,7 +2232,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe { tstDepth = other.fMaxs[i] - effMin; hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis"); - tstAxis.Set(i == 0 ? hsScalar1 : 0, i & 1 ? hsScalar1 : 0, i & 2 ? hsScalar1 : 0); + tstAxis.Set(i == 0 ? 1.f : 0, i & 1 ? 1.f : 0, i & 2 ? 1.f : 0); tryAxis = true; } else @@ -2241,7 +2241,7 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe { tstDepth = effMax - other.fMins[i]; hsAssert(tstDepth > -kRealSmall, "Late to be finding sep axis"); - tstAxis.Set(i == 0 ? -hsScalar1 : 0, i & 1 ? -hsScalar1 : 0, i & 2 ? -hsScalar1 : 0); + tstAxis.Set(i == 0 ? -1.f : 0, i & 1 ? -1.f : 0, i & 2 ? -1.f : 0); tryAxis = true; } else @@ -2250,11 +2250,11 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe else { // first try the other box axes - hsScalar radScaled = fRadius * other.fAxes[i].Magnitude(); - hsScalar centerDist = other.fAxes[i].InnerProduct(fCenter); - hsScalar effMin = centerDist; - hsScalar effMax = centerDist; - hsScalar velDist = other.fAxes[i].InnerProduct(myVel); + float radScaled = fRadius * other.fAxes[i].Magnitude(); + float centerDist = other.fAxes[i].InnerProduct(fCenter); + float effMin = centerDist; + float effMax = centerDist; + float velDist = other.fAxes[i].InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else @@ -2289,10 +2289,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe } if( tryAxis ) { - hsScalar magSq = tstAxis.MagnitudeSquared(); + float magSq = tstAxis.MagnitudeSquared(); if( magSq > kRealSmall ) { - tstDepth *= tstDepth * hsScalarInvert(magSq); + tstDepth *= tstDepth * hsInvert(magSq); if( !haveAxis||(tstDepth < minDepth) ) { minDepth = tstDepth; @@ -2307,14 +2307,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe hsVector3 diag(&fCenter, &other.GetCenter()); if( !haveAxis && (diag.MagnitudeSquared() < kRealSmall) ) diag.Set(1.f, 0, 0); - hsScalar effMin = diag.InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = diag.InnerProduct(myVel); + float effMin = diag.InnerProduct(fCenter); + float effMax = effMin; + float velDist = diag.InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radDist = fRadius * diag.Magnitude(); + float radDist = fRadius * diag.Magnitude(); effMax += radDist; effMin -= radDist; hsPoint2 otherDepth; @@ -2326,10 +2326,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe tstAxis = diag; tstDepth = otherDepth.fY - effMin; - hsScalar magSq = tstAxis.MagnitudeSquared(); + float magSq = tstAxis.MagnitudeSquared(); if( magSq > 0 ) { - tstDepth *= tstDepth * hsScalarInvert(magSq); + tstDepth *= tstDepth * hsInvert(magSq); if( !haveAxis ||(tstDepth < minDepth) ) { minDepth = tstDepth; @@ -2337,10 +2337,10 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe } } - hsScalar invMag = hsScalarInvert(minAxis.Magnitude()); + float invMag = hsInvert(minAxis.Magnitude()); minAxis *= invMag; hsAssert(minDepth >= 0, "Late to find sep plane"); - minDepth = hsSquareRoot(minDepth); + minDepth = sqrt(minDepth); hit->Set(this, &other, minAxis, minDepth); return true; @@ -2358,9 +2358,9 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe int i; for( i = 0; i < 3; i++ ) { - hsScalar effMin = fCenter[i]; - hsScalar effMax = effMin; - hsScalar velDist = myVel[i]; + float effMin = fCenter[i]; + float effMax = effMin; + float velDist = myVel[i]; if( velDist > 0 ) effMax += velDist; else @@ -2383,14 +2383,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe int i; for( i = 0; i < 3; i++ ) { - hsScalar effMin = other.fAxes[i].InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = other.fAxes[i].InnerProduct(myVel); + float effMin = other.fAxes[i].InnerProduct(fCenter); + float effMax = effMin; + float velDist = other.fAxes[i].InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radScaled = fRadius * other.fAxes[i].Magnitude(); + float radScaled = fRadius * other.fAxes[i].Magnitude(); effMax += radScaled; effMin -= radScaled; @@ -2403,14 +2403,14 @@ hsBool hsBounds3Ext::ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVe // now try the axis between the center of sphere and center of other box hsVector3 diag(&fCenter, &other.GetCenter()); - hsScalar effMin = diag.InnerProduct(fCenter); - hsScalar effMax = effMin; - hsScalar velDist = diag.InnerProduct(myVel); + float effMin = diag.InnerProduct(fCenter); + float effMax = effMin; + float velDist = diag.InnerProduct(myVel); if( velDist > 0 ) effMax += velDist; else effMin += velDist; - hsScalar radDist = fRadius * diag.Magnitude(); + float radDist = fRadius * diag.Magnitude(); effMax += radDist; effMin -= radDist; hsPoint2 otherDepth; @@ -2429,9 +2429,9 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const IMakeSphere(); hsPoint3 onLine; - hsScalar z = ClosestPointToLine(&fCenter, from, at, &onLine); + float z = ClosestPointToLine(&fCenter, from, at, &onLine); - hsScalar distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); + float distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); if( distSq >= fRadius*fRadius ) return false; @@ -2454,8 +2454,8 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const int i; for( i = 0; i < 3; i++ ) { - hsScalar d0 = fAxes[i].InnerProduct(from); - hsScalar d1 = fAxes[i].InnerProduct(at); + float d0 = fAxes[i].InnerProduct(from); + float d1 = fAxes[i].InnerProduct(at); if( d0 < d1 ) { if( d1 < fDists[i].fX ) @@ -2475,7 +2475,7 @@ hsBool hsBounds3Ext::ISectLine(const hsPoint3* from, const hsPoint3* at) const return true; } -hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, hsScalar radius) const +hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, float radius) const { if( !(fExtFlags & kSphereSet) ) IMakeSphere(); @@ -2484,14 +2484,14 @@ hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, hsScala hsPoint3 onLine; ClosestPointToLine(&fCenter, from, at, &onLine); - hsScalar distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); - hsScalar radiusSq = fRadius * fRadius; + float distSq = hsVector3(&onLine, &fCenter).MagnitudeSquared(); + float radiusSq = fRadius * fRadius; if (distSq - radius*radius >= radiusSq) return false; - hsScalar dist = hsVector3(from, &onLine).Magnitude(); - hsScalar len = hsVector3(from, at).Magnitude(); - hsScalar partRadius = radius/len * dist; + float dist = hsVector3(from, &onLine).Magnitude(); + float len = hsVector3(from, at).Magnitude(); + float partRadius = radius/len * dist; if (distSq - fRadius*fRadius - partRadius*partRadius >= 0) { hsVector3 rayToCenter(&fCenter,&onLine); @@ -2531,8 +2531,8 @@ hsBool hsBounds3Ext::ISectCone(const hsPoint3* from, const hsPoint3* at, hsScala atLine.Normalize(); hsPoint3 atEdge = *at + atLine * radius; - hsScalar d0 = fAxes[i].InnerProduct(*from); - hsScalar d1 = fAxes[i].InnerProduct(atEdge); + float d0 = fAxes[i].InnerProduct(*from); + float d1 = fAxes[i].InnerProduct(atEdge); if( d0 < d1 ) { if( d1 < fDists[i].fX ) @@ -2557,18 +2557,18 @@ hsBool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoin { hsVector3 c2f(&from,&GetCenter()); hsVector3 f2t(&to,&from); - hsScalar a = f2t.MagnitudeSquared(); - hsScalar b = 2 * (c2f.InnerProduct(f2t)); - hsScalar c = c2f.MagnitudeSquared() - GetRadius()*GetRadius(); + float a = f2t.MagnitudeSquared(); + float b = 2 * (c2f.InnerProduct(f2t)); + float c = c2f.MagnitudeSquared() - GetRadius()*GetRadius(); - hsScalar disc = b*b - 4*a*c; + float disc = b*b - 4*a*c; if (disc < 0) return false; else { - hsScalar discSqrt = hsSquareRoot(disc); - hsScalar denom = 1.f/(2*a); - hsScalar t = (-b - discSqrt) * denom; + float discSqrt = sqrt(disc); + float denom = 1.f/(2*a); + float t = (-b - discSqrt) * denom; if (t<1 && t>0) at = from + (f2t * t); @@ -2640,7 +2640,7 @@ void hsBounds3Tri::TestPlane(const hsVector3 &n, hsPoint2 &depth) const { depth.fX = depth.fY = n.InnerProduct(fVerts[0]); - hsScalar d1, d2; + float d1, d2; d1 = n.InnerProduct(fVerts[1]); d2 = n.InnerProduct(fVerts[2]); @@ -2666,10 +2666,10 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV hsPoint3 pPln; if( ax ) { - hsScalar t; + float t; t = fNormal.InnerProduct(fVerts[0] - *p); - hsScalar s = fNormal.InnerProduct(ax); + float s = fNormal.InnerProduct(ax); if( (s > hsBounds::kRealSmall)||(s < -hsBounds::kRealSmall) ) { t /= s; @@ -2684,7 +2684,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV } else { - hsScalar t; + float t; t = fNormal.InnerProduct(fVerts[0] - *p); t /= fNormal.MagnitudeSquared(); @@ -2701,7 +2701,7 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV int i; for( i = 0; i < 3; i++ ) { - hsScalar tst = fPerpAxes[i].InnerProduct(pPln); + float tst = fPerpAxes[i].InnerProduct(pPln); hsBool in = false; if( fOnIsMax & (1 << i) ) { @@ -2733,9 +2733,9 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV kPlus = k == 2 ? 0 : k+1; hsPoint3 pTmp; - hsScalar z; + float z; z = hsBounds3::ClosestPointToLine(&pPln, fVerts+k, fVerts+kPlus, &pTmp); - if( z <= hsScalar1 ) + if( z <= 1.f ) *out = pTmp; else { @@ -2768,13 +2768,13 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV if( 0 ) { hsVector3 ndeb = hsVector3(fVerts+1, fVerts) % hsVector3(fVerts+2, fVerts); - hsScalar dis; + float dis; dis = fNormal.InnerProduct(pPln) - fDist; if( (fDist > hsBounds::kRealSmall)||(fDist < -hsBounds::kRealSmall) ) dis /= fDist; hsAssert((dis < hsBounds::kRealSmall)&&(dis > -hsBounds::kRealSmall), "Non-planar pPln"); dis = hsVector3(&pPln, out).MagnitudeSquared(); - hsScalar vDis; + float vDis; vDis = hsVector3(&pPln, fVerts+0).MagnitudeSquared(); hsAssert( vDis - dis > -hsBounds::kRealSmall, "Bad closest point"); vDis = hsVector3(&pPln, fVerts+1).MagnitudeSquared(); @@ -2784,9 +2784,9 @@ hsBool hsBounds3Tri::ClosestTriPoint(const hsPoint3 *p, hsPoint3 *out, const hsV hsBool dork = false; if( dork ) { - hsScalar zn[3]; - hsScalar zf[3]; - hsScalar z[3]; + float zn[3]; + float zf[3]; + float z[3]; int i; for( i = 0; i < 3; i++ ) { @@ -2829,7 +2829,7 @@ void hsBounds3Tri::SetAxes() const if( fPerpDists[i].fX > fPerpDists[i].fY ) { fOnIsMax |= 1 << i; - hsScalar d = fPerpDists[i].fX; + float d = fPerpDists[i].fX; fPerpDists[i].fX = fPerpDists[i].fY; fPerpDists[i].fY = d; } @@ -2878,7 +2878,7 @@ hsBounds3Tri* hsBounds3Tri::Translate(const hsVector3& v) int j = i == 2 ? 0 : i+1; int k = j == 2 ? 0 : j+1; - hsScalar del = fPerpAxes[i].InnerProduct(v); + float del = fPerpAxes[i].InnerProduct(v); fPerpDists[i].fX += del; fPerpDists[i].fY += del; } @@ -2977,11 +2977,11 @@ hsBounds3Tri::~hsBounds3Tri() // Finds closest intersection vertex or triangle/center-line intersection -hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScalar cosThetaSq, hsBool ignoreFacing, hsPoint3& at, hsBool& backSide) const +hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, float cosThetaSq, hsBool ignoreFacing, hsPoint3& at, hsBool& backSide) const { - hsScalar d0 = from.InnerProduct(fNormal); - hsScalar d1 = at.InnerProduct(fNormal); - hsScalar dt = fNormal.InnerProduct(fVerts[0]); + float d0 = from.InnerProduct(fNormal); + float d1 = at.InnerProduct(fNormal); + float dt = fNormal.InnerProduct(fVerts[0]); backSide = d0 < dt; if( !ignoreFacing && backSide ) return false; @@ -2991,16 +2991,16 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScala return true; hsVector3 av(&to,&from); - hsScalar distASq = av.MagnitudeSquared(); - hsScalar radiusSq = distASq * (1-cosThetaSq)/cosThetaSq; + float distASq = av.MagnitudeSquared(); + float radiusSq = distASq * (1-cosThetaSq)/cosThetaSq; - hsScalar minDistSq = 0; + float minDistSq = 0; int32_t minVert = 0; hsBool sect = false; for (int32_t i=0; i<3; i++) { hsPoint3 onLine; - hsScalar t = hsBounds3::ClosestPointToLine(&fVerts[i], &from, &to, &onLine); + float t = hsBounds3::ClosestPointToLine(&fVerts[i], &from, &to, &onLine); // outside the cap of the cylinder if (t<0 || t>1) @@ -3012,9 +3012,9 @@ hsBool hsBounds3Tri::ISectCone(const hsPoint3& from, const hsPoint3& to, hsScala hsVector3 bv(&fVerts[i],&from); - hsScalar distBSq = bv.MagnitudeSquared(); + float distBSq = bv.MagnitudeSquared(); - hsScalar cosMuSquared = (av * bv) / (distASq * distBSq); + float cosMuSquared = (av * bv) / (distASq * distBSq); // outside the angle of the cone if (cosMuSquared > cosThetaSq) diff --git a/Sources/Plasma/CoreLib/hsBounds.h b/Sources/Plasma/CoreLib/hsBounds.h index 0f9ee268..d582f970 100644 --- a/Sources/Plasma/CoreLib/hsBounds.h +++ b/Sources/Plasma/CoreLib/hsBounds.h @@ -68,7 +68,7 @@ class hsBounds protected: hsBoundsType fType; public: - static const hsScalar kRealSmall; + static const float kRealSmall; hsBounds() : fType(kBoundsUninitialized) { }; @@ -130,7 +130,7 @@ public: virtual void GetCorners(hsPoint3 *b) const; const hsPoint3& GetMins() const; const hsPoint3& GetMaxs() const; - hsScalar GetMaxDim() const; // Computes the answer + float GetMaxDim() const; // Computes the answer const hsPoint3& GetCenter() const; // Computes the answer if not already there virtual hsBool IsInside(const hsPoint3* pos) const; // ok for full/empty virtual void TestPlane(const hsVector3 &n, hsPoint2 &depth) const; @@ -141,8 +141,8 @@ public: // neg, pos, zero == disjoint, I contain other, overlap virtual int32_t TestBound(const hsBounds3& other) const; - static hsScalar ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out); - static hsScalar ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out); + static float ClosestPointToLine(const hsPoint3 *p, const hsPoint3 *v0, const hsPoint3 *v1, hsPoint3 *out); + static float ClosestPointToInfiniteLine(const hsPoint3* p, const hsVector3* v, hsPoint3* out); virtual void Read(hsStream*); virtual void Write(hsStream*); @@ -183,7 +183,7 @@ inline const hsPoint3& hsBounds3::GetCenter() const return fCenter; } -inline hsScalar hsBounds3::GetMaxDim() const +inline float hsBounds3::GetMaxDim() const { hsAssert(kBoundsNormal == fType, "Invalid type for GetMaxDim"); return hsMaximum(hsMaximum(fMaxs.fX-fMins.fX, fMaxs.fY-fMins.fY), fMaxs.fZ-fMins.fZ); @@ -245,7 +245,7 @@ protected: hsPoint3 fCorner; hsVector3 fAxes[3]; mutable hsPoint2 fDists[3]; - mutable hsScalar fRadius; + mutable float fRadius; hsBool IAxisIsZero(uint32_t i) const { return (fExtFlags & (1 << (20+i))) != 0; }; void IMakeSphere() const; @@ -276,7 +276,7 @@ public: virtual void Transform(const hsMatrix44 *m); virtual void Translate(const hsVector3 &v); - virtual hsScalar GetRadius() const; + virtual float GetRadius() const; virtual void GetAxes(hsVector3 *fAxis0, hsVector3 *fAxis1, hsVector3 *fAxis2) const; virtual hsPoint3 *GetCorner(hsPoint3 *c) const { *c = (fExtFlags & kAxisAligned ? fMins : fCorner); return c; } virtual void GetCorners(hsPoint3 *b) const; @@ -300,21 +300,21 @@ public: virtual hsBool ISectBS(const hsBounds3Ext &other, const hsVector3 &myVel) const; virtual int32_t IClosestISect(const hsBounds3Ext& other, const hsVector3& myVel, - hsScalar* tClose, hsScalar* tImpact) const; + float* tClose, float* tImpact) const; virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBSBox(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectBoxBS(const hsBounds3Ext &other, const hsVector3 &myVel) const; virtual hsBool ISectBSBS(const hsBounds3Ext &other, const hsVector3 &myVel, hsHitInfoExt *hit) const; virtual hsBool ISectLine(const hsPoint3* from, const hsPoint3* to) const; - virtual hsBool ISectCone(const hsPoint3* from, const hsPoint3* to, hsScalar radius) const; + virtual hsBool ISectCone(const hsPoint3* from, const hsPoint3* to, float radius) const; virtual hsBool ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoint3& at) const; virtual void Read(hsStream *s); virtual void Write(hsStream *s); }; -inline hsScalar hsBounds3Ext::GetRadius() const +inline float hsBounds3Ext::GetRadius() const { if( !(fExtFlags & kSphereSet) ) IMakeSphere(); @@ -323,7 +323,7 @@ inline hsScalar hsBounds3Ext::GetRadius() const class hsHitInfoExt { public: - hsScalar fDepth; + float fDepth; hsVector3 fNormal; hsVector3 fDelPos; @@ -333,9 +333,9 @@ public: hsHitInfoExt(const hsPoint3 *ctr, const hsVector3& offset) { fRootCenter=ctr; fDelPos=offset; }; - void Set(const hsBounds3Ext *m, const hsVector3* n, hsScalar d) + void Set(const hsBounds3Ext *m, const hsVector3* n, float d) { fDepth = d; fBoxBnd = m; fNormal = *n; fOtherBoxBnd = nil; } - void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, hsScalar d) + void Set(const hsBounds3Ext *m, const hsBounds3Ext *o, const hsVector3 &norm, float d) { fDepth = d; fBoxBnd = m, fOtherBoxBnd = o; fNormal = norm; } }; #endif // hsBounds_inc diff --git a/Sources/Plasma/CoreLib/hsColorRGBA.h b/Sources/Plasma/CoreLib/hsColorRGBA.h index bbc76f90..a0c06a65 100644 --- a/Sources/Plasma/CoreLib/hsColorRGBA.h +++ b/Sources/Plasma/CoreLib/hsColorRGBA.h @@ -43,15 +43,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsColorRGBA_inc #define hsColorRGBA_inc -#include "hsScalar.h" #include "hsStream.h" struct hsColorRGBA { - hsScalar r,g,b,a; + float r,g,b,a; hsRGBAColor32 ToRGBA32() const; - hsColorRGBA& Set(hsScalar red, hsScalar grn, hsScalar blu, hsScalar alp) { r = red; g = grn; b = blu; a = alp; return *this; } + hsColorRGBA& Set(float red, float grn, float blu, float alp) { r = red; g = grn; b = blu; a = alp; return *this; } hsBool operator==(const hsColorRGBA&c) const { return (r==c.r)&&(g==c.g)&&(b==c.b)&&(a==c.a); } hsBool operator!=(const hsColorRGBA&c) const { return !(c == *this); } @@ -65,9 +64,9 @@ struct hsColorRGBA { friend inline hsColorRGBA operator-(const hsColorRGBA& s, const hsColorRGBA& t); hsColorRGBA& operator-=(const hsColorRGBA& s); - friend inline hsColorRGBA operator*(const hsColorRGBA& c, const hsScalar s); - friend inline hsColorRGBA operator*(const hsScalar s, const hsColorRGBA& c); - hsColorRGBA& operator*=(const hsScalar s); + friend inline hsColorRGBA operator*(const hsColorRGBA& c, const float s); + friend inline hsColorRGBA operator*(const float s, const hsColorRGBA& c); + hsColorRGBA& operator*=(const float s); hsColorRGBA& FromARGB32(uint32_t c); uint32_t ToARGB32() const; @@ -93,11 +92,11 @@ inline void hsColorRGBA::Write(hsStream *s) const inline hsColorRGBA& hsColorRGBA::FromARGB32(uint32_t c) { - const hsScalar oo255 = 1.f / 255.f; - a = hsScalar((c >> 24) & 0xff) * oo255; - r = hsScalar((c >> 16) & 0xff) * oo255; - g = hsScalar((c >> 8) & 0xff) * oo255; - b = hsScalar((c >> 0) & 0xff) * oo255; + const float oo255 = 1.f / 255.f; + a = float((c >> 24) & 0xff) * oo255; + r = float((c >> 16) & 0xff) * oo255; + g = float((c >> 8) & 0xff) * oo255; + b = float((c >> 0) & 0xff) * oo255; return *this; } @@ -151,16 +150,16 @@ inline hsColorRGBA& hsColorRGBA::operator-=(const hsColorRGBA& s) return *this; } -inline hsColorRGBA operator*(const hsColorRGBA& t, const hsScalar s) +inline hsColorRGBA operator*(const hsColorRGBA& t, const float s) { hsColorRGBA res; return res.Set(s * t.r, s * t.g, s * t.b, s * t.a); } -inline hsColorRGBA operator*(const hsScalar s, const hsColorRGBA&t) +inline hsColorRGBA operator*(const float s, const hsColorRGBA&t) { return t * s; } -inline hsColorRGBA& hsColorRGBA::operator*=(const hsScalar s) +inline hsColorRGBA& hsColorRGBA::operator*=(const float s) { r *= s; g *= s; diff --git a/Sources/Plasma/CoreLib/hsConfig.h b/Sources/Plasma/CoreLib/hsConfig.h index 10878ae5..ecdc3712 100644 --- a/Sources/Plasma/CoreLib/hsConfig.h +++ b/Sources/Plasma/CoreLib/hsConfig.h @@ -52,9 +52,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //////////////////// Change the 1s and 0s ////////////////////// -#define HS_CAN_USE_FLOAT 1 -#define HS_SCALAR_IS_FLOAT 1 - #define HS_PIN_MATH_OVERFLOW 0 // This forces hsWide versions of FixMath routines #define HS_DEBUG_MATH_OVERFLOW 0 // This calls hsDebugMessage on k[Pos,Neg]Infinity @@ -68,13 +65,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define HS_BUILD_FOR_UNIX 1 #endif -#define HS_SCALAR_IS_FIXED !(HS_SCALAR_IS_FLOAT) -#define HS_NEVER_USE_FLOAT !(HS_CAN_USE_FLOAT) - -#if HS_DEBUG_MATH_OVERFLOW && !(HS_PIN_MATH_OVERFLOW) - #error "Can't debug overflow unless HS_PIN_MATH_OVERFLOW is ON" -#endif - ///////////////////////Windows Specific Defines ///////////////////////////// diff --git a/Sources/Plasma/CoreLib/hsFastMath.cpp b/Sources/Plasma/CoreLib/hsFastMath.cpp index d6e679b4..d18ec618 100644 --- a/Sources/Plasma/CoreLib/hsFastMath.cpp +++ b/Sources/Plasma/CoreLib/hsFastMath.cpp @@ -41,13 +41,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsTypes.h" -#include "hsScalar.h" #include "hsGeometry3.h" #include "hsFastMath.h" -const hsScalar hsFastMath::kSqrtTwo = hsSquareRoot(2.f); -const hsScalar hsFastMath::kInvSqrtTwo = hsScalarInvert(hsFastMath::kSqrtTwo); -const hsScalar hsFastMath::kTwoPI = hsScalarPI * 2.f; +const float hsFastMath::kSqrtTwo = sqrt(2.f); +const float hsFastMath::kInvSqrtTwo = hsInvert(hsFastMath::kSqrtTwo); +const float hsFastMath::kTwoPI = M_PI * 2.f; hsPoint2 statCosSinTable[9] = // must match length in inline { @@ -579,11 +578,11 @@ unsigned char statSeedTable[] = { 0x6a }; -hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x) +float hsFastMath::IATan2OverTwoPi(float y, float x) { const int tabSize = 16; // pad with one extra because hi can go hi const int tabMax = tabSize-1; - static hsScalar tab[tabSize+1] = { + static float tab[tabSize+1] = { 0.f, 0.0105947f, 0.0210962f, @@ -609,14 +608,14 @@ hsScalar hsFastMath::IATan2OverTwoPi(hsScalar y, hsScalar x) if((yNeg = (y < 0)))y = -y; if((xNeg = (x < 0)))x = -x; hsBool yBigger = y >= x; - hsScalar div = yBigger ? x / y : y / x; + float div = yBigger ? x / y : y / x; - hsScalar fInd = div * tabMax; + float fInd = div * tabMax; int lo = int(fInd); int hi = lo+1; - hsScalar frac = fInd - lo; + float frac = fInd - lo; - hsScalar res = tab[lo]; + float res = tab[lo]; res += frac * (tab[hi] - res); // now move to proper half quadrant diff --git a/Sources/Plasma/CoreLib/hsFastMath.h b/Sources/Plasma/CoreLib/hsFastMath.h index 58beffd5..b9ade03b 100644 --- a/Sources/Plasma/CoreLib/hsFastMath.h +++ b/Sources/Plasma/CoreLib/hsFastMath.h @@ -51,27 +51,27 @@ protected: static const hsPoint2* fCosSinTable; public: - static const hsScalar kSqrtTwo; - static const hsScalar kInvSqrtTwo; - static const hsScalar kTwoPI; + static const float kSqrtTwo; + static const float kInvSqrtTwo; + static const float kTwoPI; - static hsScalar IATan2OverTwoPi(hsScalar y, hsScalar x); + static float IATan2OverTwoPi(float y, float x); - static inline hsScalar InvSqrtAppr(hsScalar x); - static inline hsScalar InvSqrt(hsScalar x); + static inline float InvSqrtAppr(float x); + static inline float InvSqrt(float x); static inline hsVector3& Normalize(hsVector3& v) { return (v *= InvSqrt(v.MagnitudeSquared())); } static inline hsVector3& NormalizeAppr(hsVector3& v) { return (v *= InvSqrtAppr(v.MagnitudeSquared())); } - static inline void SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); - static inline void SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); + static inline void SinCosAppr(float rads, float& sinRads, float& cosRads); + static inline void SinCosInRangeAppr(float rads, float& sinRads, float& cosRads); - static inline void SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads); - static inline void SinCosInRange(hsScalar ang, hsScalar& sinRads, hsScalar& cosRads); + static inline void SinCos(float rads, float& sinRads, float& cosRads); + static inline void SinCosInRange(float ang, float& sinRads, float& cosRads); - static inline hsScalar Sin(hsScalar rads); - static inline hsScalar Cos(hsScalar rads); - static inline hsScalar SinInRange(hsScalar rads); - static inline hsScalar CosInRange(hsScalar rads); + static inline float Sin(float rads); + static inline float Cos(float rads); + static inline float SinInRange(float rads); + static inline float CosInRange(float rads); }; @@ -104,7 +104,7 @@ public: #define SET_MANTSEED(a) (((unsigned long) (a)) << SEED_POS) -inline hsScalar hsFastMath::InvSqrtAppr(hsScalar x) +inline float hsFastMath::InvSqrtAppr(float x) { register unsigned long a = *(long*)&x; register float arg = x; @@ -131,7 +131,7 @@ inline hsScalar hsFastMath::InvSqrtAppr(hsScalar x) return r; } -inline hsScalar hsFastMath::InvSqrt(hsScalar x) +inline float hsFastMath::InvSqrt(float x) { register unsigned long a = *(long*)&x; register float arg = x; @@ -155,7 +155,7 @@ inline hsScalar hsFastMath::InvSqrt(hsScalar x) } -inline void hsFastMath::SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosAppr(float rads, float& sinRads, float& cosRads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -163,11 +163,11 @@ inline void hsFastMath::SinCosAppr(hsScalar rads, hsScalar& sinRads, hsScalar& c SinCosInRangeAppr(rads, sinRads, cosRads); } -inline void hsFastMath::SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosInRangeAppr(float rads, float& sinRads, float& cosRads) { const int kNumSinCosEntries = 8; - const hsScalar kNumEntriesOverTwoPI = kNumSinCosEntries * 0.5f / hsScalarPI; - hsScalar t = rads * kNumEntriesOverTwoPI; + const float kNumEntriesOverTwoPI = kNumSinCosEntries * 0.5f / M_PI; + float t = rads * kNumEntriesOverTwoPI; int iLo = (int)t; t -= iLo; @@ -184,7 +184,7 @@ inline void hsFastMath::SinCosInRangeAppr(hsScalar rads, hsScalar& sinRads, hsSc } -inline hsScalar hsFastMath::Sin(hsScalar rads) +inline float hsFastMath::Sin(float rads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -193,7 +193,7 @@ inline hsScalar hsFastMath::Sin(hsScalar rads) return SinInRange(rads); } -inline hsScalar hsFastMath::Cos(hsScalar rads) +inline float hsFastMath::Cos(float rads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -202,7 +202,7 @@ inline hsScalar hsFastMath::Cos(hsScalar rads) return CosInRange(rads); } -inline hsScalar hsFastMath::SinInRange(hsScalar ang) +inline float hsFastMath::SinInRange(float ang) { float sgn = 1.f; @@ -217,7 +217,7 @@ inline hsScalar hsFastMath::SinInRange(hsScalar ang) return (ang - (ang*ang*ang) * (1.0f/6.0f) + (ang*ang*ang*ang*ang) / 120.0f) * sgn; } -inline hsScalar hsFastMath::CosInRange(hsScalar ang) +inline float hsFastMath::CosInRange(float ang) { float sgn = 1.f; @@ -232,7 +232,7 @@ inline hsScalar hsFastMath::CosInRange(hsScalar ang) return (1.0f - (ang*ang / 2.0f) + (ang*ang*ang*ang) / 24.0f) *sgn; } -inline void hsFastMath::SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCos(float rads, float& sinRads, float& cosRads) { rads = fmodf(rads, kTwoPI); if( rads < 0 ) @@ -240,7 +240,7 @@ inline void hsFastMath::SinCos(hsScalar rads, hsScalar& sinRads, hsScalar& cosRa SinCosInRange(rads, sinRads, cosRads); } -inline void hsFastMath::SinCosInRange(hsScalar ang, hsScalar& sinRads, hsScalar& cosRads) +inline void hsFastMath::SinCosInRange(float ang, float& sinRads, float& cosRads) { float sgn = 1.f; diff --git a/Sources/Plasma/CoreLib/hsFixedTypes.h b/Sources/Plasma/CoreLib/hsFixedTypes.h deleted file mode 100644 index b7d9b34e..00000000 --- a/Sources/Plasma/CoreLib/hsFixedTypes.h +++ /dev/null @@ -1,120 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsFixedTypesDefined -#define hsFixedTypesDefined - -#include "hsTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define hsIntToFixed(x) ((hsFixed)(x) << 16) -#define hsFixedToInt(x) ((x) >> 16) -#define hsFixedRound(x) (((x) + 0x8000) >> 16) -#define hsFixed1 hsIntToFixed(1) -#define hsFixedPI (0x3243F) -#define hsFixedPiOver2 (0x1921F) - -#define hsFixedToFract(x) ((hsFract)(x) << 14) -#define hsFractToFixed(x) ((hsFixed)(x) >> 14) -#define hsFract1 hsFixedToFract(hsFixed1) -#define hsFractPiOver2 (0x6487ED34) /* needs some work */ - -#define hsFixFloor(x) \ - (hsFixed)((x) < 0 ? -(hsFixed)((-(x) + 0xFFFF) & 0xFFFF0000) : (x) & 0xFFFF0000) - -#define hsFixedToFloorInt(x) \ - (int)((x) < 0 ? -(int)((-(x) + 0xFFFF) >> 16) : ((x) >> 16)) - -#define hsFixCeiling(x) \ - (hsFixed)((x) < 0 ? -(hsFixed)(-(x) & 0xFFFF0000) : ((x) + 0xFFFF) & 0xFFFF0000) - -#define hsFixedToCeilingInt(x) \ - (int)((x) < 0 ? -(int)(-(x) >> 16) : (((x) + 0xFFFF) >> 16)) - - -#if HS_CAN_USE_FLOAT - #define hsFixedToFloat(x) ((x) / float(hsFixed1)) - #define hsFloatToFixed(x) hsFixed((x) * hsFixed1) - - #define hsFractToFloat(x) ((x) / float(hsFract1)) - #define hsFloatToFract(x) hsFract((x) * hsFract1) -#endif - - -hsFixed hsFixMul(hsFixed a, hsFixed b); - -hsFract hsFixDiv(hsFixed a, hsFixed b); -hsFract hsFracMul(hsFract a, hsFract b); -hsFract hsFracDiv(hsFract a, hsFract b); - -hsFract hsFracSqrt(hsFract value); -#define hsFixSqrt(value) (hsFracSqrt(value) >> 7) -hsFract hsFracCubeRoot(hsFract value); -hsFixed hsFixedSin(hsFixed s); -hsFixed hsFixedCos(hsFixed s); -hsFixed hsFixedASin(hsFixed s); -hsFixed hsFixedACos(hsFixed s); - -uint16_t hsSqrt32(uint32_t value); -uint16_t hsCubeRoot32(uint32_t value); -int32_t hsMulDiv32(int32_t numer1, int32_t numer2, int32_t denom); -int32_t hsMagnitude32(int32_t x, int32_t y); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus - struct hsFixedPlane { - hsFixed fA, fB, fC; - - void Set(hsFixed a, hsFixed b, hsFixed c) { fA = a; fB = b; fC = c; } - - hsFixed FixEval(hsFixed x, hsFixed y) const { return hsFixMul(fA, x) + hsFixMul(fB, y) + fC; } - int32_t IntEval(int32_t x, int32_t y) const { return fA * x + fB * y + fC; } - void ShiftDown(uint32_t i) { fA >>= i; fB >>= i; fC >>= i;} - }; -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsGeometry3.cpp b/Sources/Plasma/CoreLib/hsGeometry3.cpp index f83c6359..c9cbeb17 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.cpp +++ b/Sources/Plasma/CoreLib/hsGeometry3.cpp @@ -41,14 +41,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsGeometry3.h" #include "hsStream.h" +#include hsVector3 operator%(const hsVector3& t, const hsVector3& s) { hsVector3 result; - return *result.Set( hsScalarMul(t.fY, s.fZ) - hsScalarMul(s.fY, t.fZ), - -hsScalarMul(t.fX, s.fZ) + hsScalarMul(s.fX, t.fZ), - hsScalarMul(t.fX, s.fY) - hsScalarMul(s.fX, t.fY)); + return *result.Set((t.fY * s.fZ) - (s.fY * t.fZ), + -(t.fX * s.fZ) + (s.fX * t.fZ), + (t.fX * s.fY) - (s.fX * t.fY)); } @@ -56,33 +57,10 @@ hsVector3 operator%(const hsVector3& t, const hsVector3& s) ////////////////////////////////// ///////////////////////////////// -#if HS_SCALAR_IS_FIXED -hsScalar hsScalarTriple::Magnitude() const +float hsScalarTriple::Magnitude() const { - hsWide result, temp; - - result.Mul(fCoord[0], fCoord[0]); - temp.Mul(fCoord[1], fCoord[1]); - result.Add(&temp); - temp.Mul(fCoord[2], fCoord[2]); - result.Add(&temp); - - return result.Sqrt(); -} - -hsScalar hsScalarTriple::MagnitudeSquared() const -{ - hsWide result, temp; - - result.Mul(fCoord[0], fCoord[0]); - temp.Mul(fCoord[1], fCoord[1]); - result.Add(&temp); - temp.Mul(fCoord[2], fCoord[2]); - result.Add(&temp); - - return result.AsFixed(); + return sqrt(MagnitudeSquared()); } -#endif void hsScalarTriple::Read(hsStream *stream) { diff --git a/Sources/Plasma/CoreLib/hsGeometry3.h b/Sources/Plasma/CoreLib/hsGeometry3.h index a77025e7..ed3b9e5e 100644 --- a/Sources/Plasma/CoreLib/hsGeometry3.h +++ b/Sources/Plasma/CoreLib/hsGeometry3.h @@ -42,26 +42,27 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsGGeometry3Defined #define hsGGeometry3Defined -#include "hsTypes.h" +#include "HeadSpin.h" +#include "hsUtils.h" struct hsVector3; struct hsPoint3; struct hsScalarTriple; class hsStream; /* - If value is already close to hsScalar1, then this is a good approx. of 1/sqrt(value) + If value is already close to 1.f, then this is a good approx. of 1/sqrt(value) */ -static inline hsScalar hsInvSqrt(hsScalar value) +static inline float hsInvSqrt(float value) { - hsScalar guess; - hsScalar threeOverTwo = hsScalar1 + hsScalarHalf; + float guess; + float threeOverTwo = 1.5f; - value = hsScalarDiv2(value); + value /= 2.f; guess = threeOverTwo - value; // with initial guess = 1.0 // repeat this line for better approx - guess = hsScalarMul(guess, threeOverTwo - hsScalarMul(hsScalarMul(value, guess), guess)); - guess = hsScalarMul(guess, threeOverTwo - hsScalarMul(hsScalarMul(value, guess), guess)); + guess = (guess * threeOverTwo - ((value * guess) * guess)); + guess = (guess * threeOverTwo - ((value * guess) * guess)); return guess; } @@ -71,12 +72,12 @@ struct hsScalarTriple { //protected: // hsScalarTriple() : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) {} -// hsScalarTriple(hsScalar x, hsScalar y, hsScalar z) +// hsScalarTriple(float x, float y, float z) // : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) { fX = x, fY = y, fZ = z; } // // union { // u_long128 privateTemp; -// hsScalar privateData[4]; +// float privateData[4]; // }; //public: // @@ -84,34 +85,29 @@ struct hsScalarTriple // hsScalarTriple(const hsScalarTriple& o) : fX(privateData[0]), fY(privateData[1]), fZ(privateData[2]) // { *this = o; } // -// hsScalar& fX; -// hsScalar& fY; -// hsScalar& fZ; +// float& fX; +// float& fY; +// float& fZ; protected: hsScalarTriple() {} - hsScalarTriple(hsScalar x, hsScalar y, hsScalar z) : fX(x), fY(y), fZ(z) {} + hsScalarTriple(float x, float y, float z) : fX(x), fY(y), fZ(z) {} public: - hsScalar fX, fY, fZ; + float fX, fY, fZ; - hsScalarTriple* Set(hsScalar x, hsScalar y, hsScalar z) { fX= x; fY = y; fZ = z; return this;} + hsScalarTriple* Set(float x, float y, float z) { fX= x; fY = y; fZ = z; return this;} hsScalarTriple* Set(const hsScalarTriple *p) { fX = p->fX; fY = p->fY; fZ = p->fZ; return this;} - hsScalar InnerProduct(const hsScalarTriple &p) const; - hsScalar InnerProduct(const hsScalarTriple *p) const; - -// hsScalarTriple LERP(hsScalarTriple &other, hsScalar t); -#if HS_SCALAR_IS_FIXED - hsScalar Magnitude() const; - hsScalar MagnitudeSquared() const; -#else - hsScalar Magnitude() const { return hsSquareRoot(MagnitudeSquared()); } - hsScalar MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } -#endif + float InnerProduct(const hsScalarTriple &p) const; + float InnerProduct(const hsScalarTriple *p) const; + +// hsScalarTriple LERP(hsScalarTriple &other, float t); + float Magnitude() const; + float MagnitudeSquared() const { return (fX * fX + fY * fY + fZ * fZ); } hsBool IsEmpty() const { return fX == 0 && fY == 0 && fZ == 0; } - hsScalar operator[](int i) const; - hsScalar& operator[](int i); + float operator[](int i) const; + float& operator[](int i); void Read(hsStream *stream); void Write(hsStream *stream) const; @@ -120,32 +116,32 @@ public: /////////////////////////////////////////////////////////////////////////// -inline hsScalar& hsScalarTriple::operator[] (int i) +inline float& hsScalarTriple::operator[] (int i) { hsAssert(i >=0 && i <3, "Bad index for hsScalarTriple::operator[]"); return *(&fX + i); } -inline hsScalar hsScalarTriple::operator[] (int i) const +inline float hsScalarTriple::operator[] (int i) const { hsAssert(i >=0 && i <3, "Bad index for hsScalarTriple::operator[]"); return *(&fX + i); } -inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple &p) const +inline float hsScalarTriple::InnerProduct(const hsScalarTriple &p) const { - hsScalar tmp = fX*p.fX; + float tmp = fX*p.fX; tmp += fY*p.fY; tmp += fZ*p.fZ; return tmp; } -inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple *p) const +inline float hsScalarTriple::InnerProduct(const hsScalarTriple *p) const { - hsScalar tmp = fX*p->fX; + float tmp = fX*p->fX; tmp += fY*p->fY; tmp += fZ*p->fZ; return tmp; } -//inline hsScalarTriple hsScalarTriple::LERP(hsScalarTriple &other, hsScalar t) +//inline hsScalarTriple hsScalarTriple::LERP(hsScalarTriple &other, float t) //{ // hsScalarTriple p = other - this; // p = p / t; @@ -157,26 +153,26 @@ inline hsScalar hsScalarTriple::InnerProduct(const hsScalarTriple *p) const ///////////////////////////////////////////////////////////////////////////////////////////// struct hsPoint3 : public hsScalarTriple { hsPoint3() {}; - hsPoint3(hsScalar x, hsScalar y, hsScalar z) : hsScalarTriple(x,y,z) {} + hsPoint3(float x, float y, float z) : hsScalarTriple(x,y,z) {} explicit hsPoint3(const hsScalarTriple& p) : hsScalarTriple(p) {} - hsPoint3* Set(hsScalar x, hsScalar y, hsScalar z) { return (hsPoint3*)this->hsScalarTriple::Set(x,y,z);} + hsPoint3* Set(float x, float y, float z) { return (hsPoint3*)this->hsScalarTriple::Set(x,y,z);} hsPoint3* Set(const hsScalarTriple* p) { return (hsPoint3*)this->hsScalarTriple::Set(p) ;} friend inline hsPoint3 operator+(const hsPoint3& s, const hsPoint3& t); friend inline hsPoint3 operator+(const hsPoint3& s, const hsVector3& t); friend inline hsPoint3 operator-(const hsPoint3& s, const hsPoint3& t); friend inline hsPoint3 operator-(const hsPoint3& s); - friend inline hsPoint3 operator*(const hsScalar& s, const hsPoint3& t); - friend inline hsPoint3 operator*(const hsPoint3& t, const hsScalar& s); - friend inline hsPoint3 operator/(const hsPoint3& t, const hsScalar& s); + friend inline hsPoint3 operator*(const float& s, const hsPoint3& t); + friend inline hsPoint3 operator*(const hsPoint3& t, const float& s); + friend inline hsPoint3 operator/(const hsPoint3& t, const float& s); hsBool operator==(const hsPoint3& ss) const { return (ss.fX == fX && ss.fY == fY && ss.fZ == fZ); } hsBool operator!=(const hsPoint3& ss) const { return !(*this == ss); } hsPoint3 &operator+=(const hsScalarTriple &s) { fX += s.fX; fY += s.fY; fZ += s.fZ; return *this; } - hsPoint3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } + hsPoint3 &operator*=(const float s) { fX *= s; fY *= s; fZ *= s; return *this; } }; @@ -185,38 +181,38 @@ struct hsPoint3 : public hsScalarTriple { struct hsVector3 : public hsScalarTriple { hsVector3() {}; - hsVector3(hsScalar x, hsScalar y, hsScalar z) : hsScalarTriple(x,y,z) {} + hsVector3(float x, float y, float z) : hsScalarTriple(x,y,z) {} explicit hsVector3(const hsScalarTriple& p) : hsScalarTriple(p) { } hsVector3(const hsPoint3 *p1, const hsPoint3 *p2) { fX = p1->fX - p2->fX, fY= p1->fY - p2->fY, fZ = p1->fZ - p2->fZ; } - hsVector3* Set(hsScalar x, hsScalar y, hsScalar z) { return (hsVector3*)hsScalarTriple::Set(x,y,z); } + hsVector3* Set(float x, float y, float z) { return (hsVector3*)hsScalarTriple::Set(x,y,z); } hsVector3* Set(const hsScalarTriple* p) { return (hsVector3*)hsScalarTriple::Set(p) ;} hsVector3* Set(const hsScalarTriple* p1, const hsScalarTriple* p2) { return Set(p1->fX-p2->fX,p1->fY-p2->fY,p1->fZ-p2->fZ);} void Normalize() { - hsScalar length = this->Magnitude(); + float length = this->Magnitude(); // hsIfDebugMessage(length == 0, "Err: Normalizing hsVector3 of length 0", 0); if (length == 0) return; - hsScalar invMag = hsScalarInvert(length); + float invMag = hsInvert(length); - fX = hsScalarMul(fX, invMag); - fY = hsScalarMul(fY, invMag); - fZ = hsScalarMul(fZ, invMag); + fX = (fX * invMag); + fY = (fY * invMag); + fZ = (fZ * invMag); } inline void Renormalize() // if the vector is already close to unit length { - hsScalar mag2 = *this * *this; + float mag2 = *this * *this; hsIfDebugMessage(mag2 == 0, "Err: Renormalizing hsVector3 of length 0", 0); if (mag2 == 0) return; - hsScalar invMag = hsInvSqrt(mag2); + float invMag = hsInvSqrt(mag2); - fX = hsScalarMul(fX, invMag); - fY = hsScalarMul(fY, invMag); - fZ = hsScalarMul(fZ, invMag); + fX = (fX * invMag); + fY = (fY * invMag); + fZ = (fZ * invMag); } // hsVector3 &Sub(const hsPoint3& s, const hsPoint3& t) @@ -225,10 +221,10 @@ struct hsVector3 : public hsScalarTriple { friend inline hsVector3 operator+(const hsVector3& s, const hsVector3& t); friend inline hsVector3 operator-(const hsVector3& s, const hsVector3& t); friend inline hsVector3 operator-(const hsVector3& s); - friend inline hsVector3 operator*(const hsScalar& s, const hsVector3& t); - friend inline hsVector3 operator*(const hsVector3& t, const hsScalar& s); - friend inline hsVector3 operator/(const hsVector3& t, const hsScalar& s); - friend inline hsScalar operator*(const hsVector3& t, const hsVector3& s); + friend inline hsVector3 operator*(const float& s, const hsVector3& t); + friend inline hsVector3 operator*(const hsVector3& t, const float& s); + friend inline hsVector3 operator/(const hsVector3& t, const float& s); + friend inline float operator*(const hsVector3& t, const hsVector3& s); friend hsVector3 operator%(const hsVector3& t, const hsVector3& s); #if 0 // Havok reeks friend hsBool32 operator==(const hsVector3& s, const hsVector3& t) @@ -243,20 +239,20 @@ struct hsVector3 : public hsScalarTriple { #endif // Havok reeks hsVector3 &operator+=(const hsScalarTriple &s) { fX += s.fX; fY += s.fY; fZ += s.fZ; return *this; } hsVector3 &operator-=(const hsScalarTriple &s) { fX -= s.fX; fY -= s.fY; fZ -= s.fZ; return *this; } - hsVector3 &operator*=(const hsScalar s) { fX *= s; fY *= s; fZ *= s; return *this; } - hsVector3 &operator/=(const hsScalar s) { fX /= s; fY /= s; fZ /= s; return *this; } + hsVector3 &operator*=(const float s) { fX *= s; fY *= s; fZ *= s; return *this; } + hsVector3 &operator/=(const float s) { fX /= s; fY /= s; fZ /= s; return *this; } }; struct hsPoint4 { - hsScalar fX, fY, fZ, fW; + float fX, fY, fZ, fW; hsPoint4() {} - hsPoint4(hsScalar x, hsScalar y, hsScalar z, hsScalar w) : fX(x), fY(y), fZ(z), fW(w) {} - hsScalar& operator[](int i); - hsScalar operator[](int i) const; + hsPoint4(float x, float y, float z, float w) : fX(x), fY(y), fZ(z), fW(w) {} + float& operator[](int i); + float operator[](int i) const; - hsPoint4& operator=(const hsPoint3&p) { Set(p.fX, p.fY, p.fZ, hsScalar1); return *this; } + hsPoint4& operator=(const hsPoint3&p) { Set(p.fX, p.fY, p.fZ, 1.f); return *this; } - hsPoint4* Set(hsScalar x, hsScalar y, hsScalar z, hsScalar w) + hsPoint4* Set(float x, float y, float z, float w) { fX = x; fY = y; fZ = z; fW = w; return this; } }; @@ -282,28 +278,28 @@ inline hsVector3 operator-(const hsVector3& s) return *result.Set(-s.fX, -s.fY, -s.fZ); } -inline hsVector3 operator*(const hsVector3& s, const hsScalar& t) +inline hsVector3 operator*(const hsVector3& s, const float& t) { hsVector3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set(s.fX * t, s.fY * t, s.fZ * t); } -inline hsVector3 operator/(const hsVector3& s, const hsScalar& t) +inline hsVector3 operator/(const hsVector3& s, const float& t) { hsVector3 result; - return *result.Set(hsScalarDiv(s.fX, t), hsScalarDiv(s.fY, t), hsScalarDiv(s.fZ, t)); + return *result.Set(s.fX / t, s.fY / t, s.fZ / t); } -inline hsVector3 operator*(const hsScalar& t, const hsVector3& s) +inline hsVector3 operator*(const float& t, const hsVector3& s) { hsVector3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set(s.fX * t, s.fY * t, s.fZ * t); } -inline hsScalar operator*(const hsVector3& t, const hsVector3& s) +inline float operator*(const hsVector3& t, const hsVector3& s) { - return hsScalarMul(t.fX, s.fX) + hsScalarMul(t.fY, s.fY) + hsScalarMul(t.fZ, s.fZ); + return (t.fX * s.fX) + (t.fY * s.fY) + (t.fZ * s.fZ); } //////////////////////////////////////////////////////////////////////////// @@ -343,32 +339,32 @@ inline hsPoint3 operator-(const hsPoint3& s, const hsVector3& t) return *result.Set(s.fX - t.fX, s.fY - t.fY, s.fZ - t.fZ); } -inline hsPoint3 operator*(const hsPoint3& s, const hsScalar& t) +inline hsPoint3 operator*(const hsPoint3& s, const float& t) { hsPoint3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set((s.fX * t), (s.fY * t), (s.fZ * t)); } -inline hsPoint3 operator/(const hsPoint3& s, const hsScalar& t) +inline hsPoint3 operator/(const hsPoint3& s, const float& t) { hsPoint3 result; - return *result.Set(hsScalarDiv(s.fX, t), hsScalarDiv(s.fY, t), hsScalarDiv(s.fZ, t)); + return *result.Set((s.fX / t), (s.fY / t), (s.fZ / t)); } -inline hsPoint3 operator*(const hsScalar& t, const hsPoint3& s) +inline hsPoint3 operator*(const float& t, const hsPoint3& s) { hsPoint3 result; - return *result.Set(hsScalarMul(s.fX, t), hsScalarMul(s.fY, t), hsScalarMul(s.fZ, t)); + return *result.Set((s.fX * t), (s.fY * t), (s.fZ * t)); } -inline hsScalar hsPoint4::operator[] (int i) const +inline float hsPoint4::operator[] (int i) const { hsAssert(i >=0 && i <4, "Bad index for hsPoint4::operator[]"); return *(&fX + i); } -inline hsScalar& hsPoint4::operator[] (int i) +inline float& hsPoint4::operator[] (int i) { hsAssert(i >=0 && i <4, "Bad index for hsPoint4::operator[]"); return *(&fX + i); @@ -389,10 +385,10 @@ struct hsPointNorm { struct hsPlane3 { hsVector3 fN; - hsScalar fD; + float fD; hsPlane3() { } - hsPlane3(const hsVector3* nrml, hsScalar d) + hsPlane3(const hsVector3* nrml, float d) { fN = *nrml; fD=d; } hsPlane3(const hsPoint3* pt, const hsVector3* nrml) { fN = *nrml; fD = -pt->InnerProduct(nrml); } diff --git a/Sources/Plasma/CoreLib/hsMatrix33.h b/Sources/Plasma/CoreLib/hsMatrix33.h index 857bc584..499365aa 100644 --- a/Sources/Plasma/CoreLib/hsMatrix33.h +++ b/Sources/Plasma/CoreLib/hsMatrix33.h @@ -47,7 +47,7 @@ class hsStream; struct hsMatrix33 { - hsScalar fMap[3][3]; + float fMap[3][3]; hsMatrix33* Reset(); diff --git a/Sources/Plasma/CoreLib/hsMatrix44.cpp b/Sources/Plasma/CoreLib/hsMatrix44.cpp index 7af5a0ef..81eba463 100644 --- a/Sources/Plasma/CoreLib/hsMatrix44.cpp +++ b/Sources/Plasma/CoreLib/hsMatrix44.cpp @@ -34,7 +34,8 @@ work. You can contact Cyan Worlds, Inc. by email legal@cyan.com or by snail mail at: - Cyan Worlds, Inc. + Cyan Worlds, I + nc. 14617 N Newport Hwy Mead, WA 99021 @@ -44,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsQuat.h" #include "hsMatrix44.h" #include "hsStream.h" +#include static hsMatrix44 myIdent = hsMatrix44().Reset(); const hsMatrix44& hsMatrix44::IdentityMatrix() { return myIdent; } @@ -91,75 +93,6 @@ void hsMatrix44::DecompRigid(hsScalarTriple &translate, hsQuat &rotate) const } - -#if 0 - -hsMatrix44& hsMatrix44::Reset() -{ - for(int i = 0; i < 4; i++) - { - for(int j = 0; j < 4; j++) - { - fMap[i][j] = (i==j) ? hsScalar1 : 0; - } - } - return *this; -} -#endif - -#if 0 // Havok reeks -hsMatrix44 operator*(const hsMatrix44& a, const hsMatrix44& b) -{ - hsMatrix44 c; - - if( a.fFlags & b.fFlags & hsMatrix44::kIsIdent ) - { - c.Reset(); - return c; - } - - if( a.fFlags & hsMatrix44::kIsIdent ) - return b; - if( b.fFlags & hsMatrix44::kIsIdent ) - return a; - - c.fMap[0][0] = hsScalarMul(a.fMap[0][0], b.fMap[0][0]) + hsScalarMul(a.fMap[0][1], b.fMap[1][0]) + hsScalarMul(a.fMap[0][2], b.fMap[2][0]) + hsScalarMul(a.fMap[0][3], b.fMap[3][0]); - c.fMap[0][1] = hsScalarMul(a.fMap[0][0], b.fMap[0][1]) + hsScalarMul(a.fMap[0][1], b.fMap[1][1]) + hsScalarMul(a.fMap[0][2], b.fMap[2][1]) + hsScalarMul(a.fMap[0][3], b.fMap[3][1]); - c.fMap[0][2] = hsScalarMul(a.fMap[0][0], b.fMap[0][2]) + hsScalarMul(a.fMap[0][1], b.fMap[1][2]) + hsScalarMul(a.fMap[0][2], b.fMap[2][2]) + hsScalarMul(a.fMap[0][3], b.fMap[3][2]); - c.fMap[0][3] = hsScalarMul(a.fMap[0][0], b.fMap[0][3]) + hsScalarMul(a.fMap[0][1], b.fMap[1][3]) + hsScalarMul(a.fMap[0][2], b.fMap[2][3]) + hsScalarMul(a.fMap[0][3], b.fMap[3][3]); - - c.fMap[1][0] = hsScalarMul(a.fMap[1][0], b.fMap[0][0]) + hsScalarMul(a.fMap[1][1], b.fMap[1][0]) + hsScalarMul(a.fMap[1][2], b.fMap[2][0]) + hsScalarMul(a.fMap[1][3], b.fMap[3][0]); - c.fMap[1][1] = hsScalarMul(a.fMap[1][0], b.fMap[0][1]) + hsScalarMul(a.fMap[1][1], b.fMap[1][1]) + hsScalarMul(a.fMap[1][2], b.fMap[2][1]) + hsScalarMul(a.fMap[1][3], b.fMap[3][1]); - c.fMap[1][2] = hsScalarMul(a.fMap[1][0], b.fMap[0][2]) + hsScalarMul(a.fMap[1][1], b.fMap[1][2]) + hsScalarMul(a.fMap[1][2], b.fMap[2][2]) + hsScalarMul(a.fMap[1][3], b.fMap[3][2]); - c.fMap[1][3] = hsScalarMul(a.fMap[1][0], b.fMap[0][3]) + hsScalarMul(a.fMap[1][1], b.fMap[1][3]) + hsScalarMul(a.fMap[1][2], b.fMap[2][3]) + hsScalarMul(a.fMap[1][3], b.fMap[3][3]); - - c.fMap[2][0] = hsScalarMul(a.fMap[2][0], b.fMap[0][0]) + hsScalarMul(a.fMap[2][1], b.fMap[1][0]) + hsScalarMul(a.fMap[2][2], b.fMap[2][0]) + hsScalarMul(a.fMap[2][3], b.fMap[3][0]); - c.fMap[2][1] = hsScalarMul(a.fMap[2][0], b.fMap[0][1]) + hsScalarMul(a.fMap[2][1], b.fMap[1][1]) + hsScalarMul(a.fMap[2][2], b.fMap[2][1]) + hsScalarMul(a.fMap[2][3], b.fMap[3][1]); - c.fMap[2][2] = hsScalarMul(a.fMap[2][0], b.fMap[0][2]) + hsScalarMul(a.fMap[2][1], b.fMap[1][2]) + hsScalarMul(a.fMap[2][2], b.fMap[2][2]) + hsScalarMul(a.fMap[2][3], b.fMap[3][2]); - c.fMap[2][3] = hsScalarMul(a.fMap[2][0], b.fMap[0][3]) + hsScalarMul(a.fMap[2][1], b.fMap[1][3]) + hsScalarMul(a.fMap[2][2], b.fMap[2][3]) + hsScalarMul(a.fMap[2][3], b.fMap[3][3]); - - c.fMap[3][0] = hsScalarMul(a.fMap[3][0], b.fMap[0][0]) + hsScalarMul(a.fMap[3][1], b.fMap[1][0]) + hsScalarMul(a.fMap[3][2], b.fMap[2][0]) + hsScalarMul(a.fMap[3][3], b.fMap[3][0]); - c.fMap[3][1] = hsScalarMul(a.fMap[3][0], b.fMap[0][1]) + hsScalarMul(a.fMap[3][1], b.fMap[1][1]) + hsScalarMul(a.fMap[3][2], b.fMap[2][1]) + hsScalarMul(a.fMap[3][3], b.fMap[3][1]); - c.fMap[3][2] = hsScalarMul(a.fMap[3][0], b.fMap[0][2]) + hsScalarMul(a.fMap[3][1], b.fMap[1][2]) + hsScalarMul(a.fMap[3][2], b.fMap[2][2]) + hsScalarMul(a.fMap[3][3], b.fMap[3][2]); - c.fMap[3][3] = hsScalarMul(a.fMap[3][0], b.fMap[0][3]) + hsScalarMul(a.fMap[3][1], b.fMap[1][3]) + hsScalarMul(a.fMap[3][2], b.fMap[2][3]) + hsScalarMul(a.fMap[3][3], b.fMap[3][3]); - - return c; -} - -hsVector3 operator*(const hsMatrix44& m, const hsVector3& p) -{ - if( m.fFlags & hsMatrix44::kIsIdent ) - return p; - - hsVector3 rVal; - - rVal.fX = hsScalarMul(p.fX, m.fMap[0][0]) + hsScalarMul(p.fY, m.fMap[0][1]) + hsScalarMul(p.fZ, m.fMap[0][2]); - rVal.fY = hsScalarMul(p.fX, m.fMap[1][0]) + hsScalarMul(p.fY, m.fMap[1][1]) + hsScalarMul(p.fZ, m.fMap[1][2]); - rVal.fZ = hsScalarMul(p.fX, m.fMap[2][0]) + hsScalarMul(p.fY, m.fMap[2][1]) + hsScalarMul(p.fZ, m.fMap[2][2]); - - return rVal; -} -#else // Havok reeks hsMatrix44 hsMatrix44::operator*(const hsMatrix44& b) const { hsMatrix44 c; @@ -175,25 +108,25 @@ hsMatrix44 hsMatrix44::operator*(const hsMatrix44& b) const if( b.fFlags & hsMatrix44::kIsIdent ) return *this; - c.fMap[0][0] = hsScalarMul(fMap[0][0], b.fMap[0][0]) + hsScalarMul(fMap[0][1], b.fMap[1][0]) + hsScalarMul(fMap[0][2], b.fMap[2][0]) + hsScalarMul(fMap[0][3], b.fMap[3][0]); - c.fMap[0][1] = hsScalarMul(fMap[0][0], b.fMap[0][1]) + hsScalarMul(fMap[0][1], b.fMap[1][1]) + hsScalarMul(fMap[0][2], b.fMap[2][1]) + hsScalarMul(fMap[0][3], b.fMap[3][1]); - c.fMap[0][2] = hsScalarMul(fMap[0][0], b.fMap[0][2]) + hsScalarMul(fMap[0][1], b.fMap[1][2]) + hsScalarMul(fMap[0][2], b.fMap[2][2]) + hsScalarMul(fMap[0][3], b.fMap[3][2]); - c.fMap[0][3] = hsScalarMul(fMap[0][0], b.fMap[0][3]) + hsScalarMul(fMap[0][1], b.fMap[1][3]) + hsScalarMul(fMap[0][2], b.fMap[2][3]) + hsScalarMul(fMap[0][3], b.fMap[3][3]); + c.fMap[0][0] = (fMap[0][0] * b.fMap[0][0]) + (fMap[0][1] * b.fMap[1][0]) + (fMap[0][2] * b.fMap[2][0]) + (fMap[0][3] * b.fMap[3][0]); + c.fMap[0][1] = (fMap[0][0] * b.fMap[0][1]) + (fMap[0][1] * b.fMap[1][1]) + (fMap[0][2] * b.fMap[2][1]) + (fMap[0][3] * b.fMap[3][1]); + c.fMap[0][2] = (fMap[0][0] * b.fMap[0][2]) + (fMap[0][1] * b.fMap[1][2]) + (fMap[0][2] * b.fMap[2][2]) + (fMap[0][3] * b.fMap[3][2]); + c.fMap[0][3] = (fMap[0][0] * b.fMap[0][3]) + (fMap[0][1] * b.fMap[1][3]) + (fMap[0][2] * b.fMap[2][3]) + (fMap[0][3] * b.fMap[3][3]); - c.fMap[1][0] = hsScalarMul(fMap[1][0], b.fMap[0][0]) + hsScalarMul(fMap[1][1], b.fMap[1][0]) + hsScalarMul(fMap[1][2], b.fMap[2][0]) + hsScalarMul(fMap[1][3], b.fMap[3][0]); - c.fMap[1][1] = hsScalarMul(fMap[1][0], b.fMap[0][1]) + hsScalarMul(fMap[1][1], b.fMap[1][1]) + hsScalarMul(fMap[1][2], b.fMap[2][1]) + hsScalarMul(fMap[1][3], b.fMap[3][1]); - c.fMap[1][2] = hsScalarMul(fMap[1][0], b.fMap[0][2]) + hsScalarMul(fMap[1][1], b.fMap[1][2]) + hsScalarMul(fMap[1][2], b.fMap[2][2]) + hsScalarMul(fMap[1][3], b.fMap[3][2]); - c.fMap[1][3] = hsScalarMul(fMap[1][0], b.fMap[0][3]) + hsScalarMul(fMap[1][1], b.fMap[1][3]) + hsScalarMul(fMap[1][2], b.fMap[2][3]) + hsScalarMul(fMap[1][3], b.fMap[3][3]); + c.fMap[1][0] = (fMap[1][0] * b.fMap[0][0]) + (fMap[1][1] * b.fMap[1][0]) + (fMap[1][2] * b.fMap[2][0]) + (fMap[1][3] * b.fMap[3][0]); + c.fMap[1][1] = (fMap[1][0] * b.fMap[0][1]) + (fMap[1][1] * b.fMap[1][1]) + (fMap[1][2] * b.fMap[2][1]) + (fMap[1][3] * b.fMap[3][1]); + c.fMap[1][2] = (fMap[1][0] * b.fMap[0][2]) + (fMap[1][1] * b.fMap[1][2]) + (fMap[1][2] * b.fMap[2][2]) + (fMap[1][3] * b.fMap[3][2]); + c.fMap[1][3] = (fMap[1][0] * b.fMap[0][3]) + (fMap[1][1] * b.fMap[1][3]) + (fMap[1][2] * b.fMap[2][3]) + (fMap[1][3] * b.fMap[3][3]); - c.fMap[2][0] = hsScalarMul(fMap[2][0], b.fMap[0][0]) + hsScalarMul(fMap[2][1], b.fMap[1][0]) + hsScalarMul(fMap[2][2], b.fMap[2][0]) + hsScalarMul(fMap[2][3], b.fMap[3][0]); - c.fMap[2][1] = hsScalarMul(fMap[2][0], b.fMap[0][1]) + hsScalarMul(fMap[2][1], b.fMap[1][1]) + hsScalarMul(fMap[2][2], b.fMap[2][1]) + hsScalarMul(fMap[2][3], b.fMap[3][1]); - c.fMap[2][2] = hsScalarMul(fMap[2][0], b.fMap[0][2]) + hsScalarMul(fMap[2][1], b.fMap[1][2]) + hsScalarMul(fMap[2][2], b.fMap[2][2]) + hsScalarMul(fMap[2][3], b.fMap[3][2]); - c.fMap[2][3] = hsScalarMul(fMap[2][0], b.fMap[0][3]) + hsScalarMul(fMap[2][1], b.fMap[1][3]) + hsScalarMul(fMap[2][2], b.fMap[2][3]) + hsScalarMul(fMap[2][3], b.fMap[3][3]); + c.fMap[2][0] = (fMap[2][0] * b.fMap[0][0]) + (fMap[2][1] * b.fMap[1][0]) + (fMap[2][2] * b.fMap[2][0]) + (fMap[2][3] * b.fMap[3][0]); + c.fMap[2][1] = (fMap[2][0] * b.fMap[0][1]) + (fMap[2][1] * b.fMap[1][1]) + (fMap[2][2] * b.fMap[2][1]) + (fMap[2][3] * b.fMap[3][1]); + c.fMap[2][2] = (fMap[2][0] * b.fMap[0][2]) + (fMap[2][1] * b.fMap[1][2]) + (fMap[2][2] * b.fMap[2][2]) + (fMap[2][3] * b.fMap[3][2]); + c.fMap[2][3] = (fMap[2][0] * b.fMap[0][3]) + (fMap[2][1] * b.fMap[1][3]) + (fMap[2][2] * b.fMap[2][3]) + (fMap[2][3] * b.fMap[3][3]); - c.fMap[3][0] = hsScalarMul(fMap[3][0], b.fMap[0][0]) + hsScalarMul(fMap[3][1], b.fMap[1][0]) + hsScalarMul(fMap[3][2], b.fMap[2][0]) + hsScalarMul(fMap[3][3], b.fMap[3][0]); - c.fMap[3][1] = hsScalarMul(fMap[3][0], b.fMap[0][1]) + hsScalarMul(fMap[3][1], b.fMap[1][1]) + hsScalarMul(fMap[3][2], b.fMap[2][1]) + hsScalarMul(fMap[3][3], b.fMap[3][1]); - c.fMap[3][2] = hsScalarMul(fMap[3][0], b.fMap[0][2]) + hsScalarMul(fMap[3][1], b.fMap[1][2]) + hsScalarMul(fMap[3][2], b.fMap[2][2]) + hsScalarMul(fMap[3][3], b.fMap[3][2]); - c.fMap[3][3] = hsScalarMul(fMap[3][0], b.fMap[0][3]) + hsScalarMul(fMap[3][1], b.fMap[1][3]) + hsScalarMul(fMap[3][2], b.fMap[2][3]) + hsScalarMul(fMap[3][3], b.fMap[3][3]); + c.fMap[3][0] = (fMap[3][0] * b.fMap[0][0]) + (fMap[3][1] * b.fMap[1][0]) + (fMap[3][2] * b.fMap[2][0]) + (fMap[3][3] * b.fMap[3][0]); + c.fMap[3][1] = (fMap[3][0] * b.fMap[0][1]) + (fMap[3][1] * b.fMap[1][1]) + (fMap[3][2] * b.fMap[2][1]) + (fMap[3][3] * b.fMap[3][1]); + c.fMap[3][2] = (fMap[3][0] * b.fMap[0][2]) + (fMap[3][1] * b.fMap[1][2]) + (fMap[3][2] * b.fMap[2][2]) + (fMap[3][3] * b.fMap[3][2]); + c.fMap[3][3] = (fMap[3][0] * b.fMap[0][3]) + (fMap[3][1] * b.fMap[1][3]) + (fMap[3][2] * b.fMap[2][3]) + (fMap[3][3] * b.fMap[3][3]); return c; } @@ -205,34 +138,13 @@ hsVector3 hsMatrix44::operator*(const hsVector3& p) const hsVector3 rVal; - rVal.fX = hsScalarMul(p.fX, fMap[0][0]) + hsScalarMul(p.fY, fMap[0][1]) + hsScalarMul(p.fZ, fMap[0][2]); - rVal.fY = hsScalarMul(p.fX, fMap[1][0]) + hsScalarMul(p.fY, fMap[1][1]) + hsScalarMul(p.fZ, fMap[1][2]); - rVal.fZ = hsScalarMul(p.fX, fMap[2][0]) + hsScalarMul(p.fY, fMap[2][1]) + hsScalarMul(p.fZ, fMap[2][2]); + rVal.fX = (p.fX * fMap[0][0]) + (p.fY * fMap[0][1]) + (p.fZ * fMap[0][2]); + rVal.fY = (p.fX * fMap[1][0]) + (p.fY * fMap[1][1]) + (p.fZ * fMap[1][2]); + rVal.fZ = (p.fX * fMap[2][0]) + (p.fY * fMap[2][1]) + (p.fZ * fMap[2][2]); return rVal; } -#endif // Havok reeks - -#if 0 // Havok reeks -int operator==(const hsMatrix44& s, const hsMatrix44& t) -{ - if( s.fFlags & t.fFlags & hsMatrix44::kIsIdent ) - { - return true; - } - for(int i = 0; i < 4; i++) - { - for(int j = 0; j < 4; j++) - { - if (s.fMap[i][j] != t.fMap[i][j]) - return false; - } - } - - return true; -} -#else // Havok reeks int hsMatrix44::operator==(const hsMatrix44& ss) const { if( ss.fFlags & fFlags & hsMatrix44::kIsIdent ) @@ -251,7 +163,6 @@ int hsMatrix44::operator==(const hsMatrix44& ss) const return true; } -#endif // Havok reeks hsMatrix44& hsMatrix44::Scale(const hsVector3* scale) { @@ -315,7 +226,7 @@ hsMatrix44& hsMatrix44::SetTranslate(const hsScalarTriple* pt) NotIdentity(); return *this; } -hsMatrix44& hsMatrix44::MakeRotateMat(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::MakeRotateMat(int axis, float radians) { Reset(); SetRotate(axis, radians); @@ -323,7 +234,7 @@ hsMatrix44& hsMatrix44::MakeRotateMat(int axis, hsScalar radians) return *this; } -hsMatrix44& hsMatrix44::Rotate(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::Rotate(int axis, float radians) { hsMatrix44 rMat; rMat.MakeRotateMat(axis, radians); @@ -331,10 +242,10 @@ hsMatrix44& hsMatrix44::Rotate(int axis, hsScalar radians) return *this; } -hsMatrix44& hsMatrix44::SetRotate(int axis, hsScalar radians) +hsMatrix44& hsMatrix44::SetRotate(int axis, float radians) { - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); int c1,c2; switch (axis) { @@ -361,11 +272,11 @@ hsMatrix44& hsMatrix44::SetRotate(int axis, hsScalar radians) return *this; } -void hsMatrix44::MakeXRotation(hsScalar radians) +void hsMatrix44::MakeXRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[1][1] = c; fMap[2][2] = c; @@ -374,11 +285,11 @@ void hsMatrix44::MakeXRotation(hsScalar radians) NotIdentity(); } -void hsMatrix44::MakeYRotation(hsScalar radians) +void hsMatrix44::MakeYRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[0][0] = c; fMap[2][2] = c; fMap[0][2] = -s; @@ -386,11 +297,11 @@ void hsMatrix44::MakeYRotation(hsScalar radians) NotIdentity(); } -void hsMatrix44::MakeZRotation(hsScalar radians) +void hsMatrix44::MakeZRotation(float radians) { Reset(); - hsScalar s = hsSine(radians); - hsScalar c = hsCosine(radians); + float s = sin(radians); + float c = cos(radians); fMap[0][0] = c; fMap[1][1] = c; fMap[0][1] = s; @@ -630,14 +541,14 @@ hsMatrix44& hsMatrix44::MakeCameraUpPreserving(const hsPoint3* from, const hsPoi /////////////////////////////////////////////////////// -static hsScalar GetDeterminant33(const hsMatrix44* mat) +static float GetDeterminant33(const hsMatrix44* mat) { - return hsScalarMul(hsScalarMul(mat->fMap[0][0], mat->fMap[1][1]), mat->fMap[2][2]) + - hsScalarMul(hsScalarMul(mat->fMap[0][1], mat->fMap[1][2]), mat->fMap[2][0]) + - hsScalarMul(hsScalarMul(mat->fMap[0][2], mat->fMap[1][0]), mat->fMap[2][1]) - - hsScalarMul(hsScalarMul(mat->fMap[0][2], mat->fMap[1][1]), mat->fMap[2][0]) - - hsScalarMul(hsScalarMul(mat->fMap[0][1], mat->fMap[1][0]), mat->fMap[2][2]) - - hsScalarMul(hsScalarMul(mat->fMap[0][0], mat->fMap[1][2]), mat->fMap[2][1]); + return ((mat->fMap[0][0] * mat->fMap[1][1]) * mat->fMap[2][2]) + + ((mat->fMap[0][1] * mat->fMap[1][2]) * mat->fMap[2][0]) + + ((mat->fMap[0][2] * mat->fMap[1][0]) * mat->fMap[2][1]) - + ((mat->fMap[0][2] * mat->fMap[1][1]) * mat->fMap[2][0]) - + ((mat->fMap[0][1] * mat->fMap[1][0]) * mat->fMap[2][2]) - + ((mat->fMap[0][0] * mat->fMap[1][2]) * mat->fMap[2][1]); } hsMatrix44* hsMatrix44::GetTranspose(hsMatrix44* transp) const @@ -649,21 +560,21 @@ hsMatrix44* hsMatrix44::GetTranspose(hsMatrix44* transp) const } -static inline hsScalar Determinant2(hsScalar a, hsScalar b,hsScalar c, hsScalar d) +static inline float Determinant2(float a, float b,float c, float d) { - return hsScalarMul(a,d) - hsScalarMul(c,b); + return (a * d) - (c * b); } -static inline hsScalar Determinant3(hsScalar a, hsScalar b, hsScalar c, - hsScalar d, hsScalar e, hsScalar f, - hsScalar g, hsScalar h, hsScalar i) +static inline float Determinant3(float a, float b, float c, + float d, float e, float f, + float g, float h, float i) { - return hsScalarMul(a, Determinant2(e, f, h, i)) - - hsScalarMul(b, Determinant2(d, f, g, i)) - + hsScalarMul(c, Determinant2(d, e, g, h)); + return (a * Determinant2(e, f, h, i)) + - (b * Determinant2(d, f, g, i)) + + (c * Determinant2(d, e, g, h)); } -hsScalar hsMatrix44::GetDeterminant() const +float hsMatrix44::GetDeterminant() const { return (fMap[0][0]*Determinant3(fMap[1][1], fMap[2][1], fMap[3][1], fMap[1][2], fMap[2][2], fMap[3][2], @@ -753,7 +664,7 @@ hsMatrix44 *hsMatrix44::GetAdjoint(hsMatrix44 *adj) const hsMatrix44* hsMatrix44::GetInverse(hsMatrix44* inverse) const { - hsScalar det = GetDeterminant(); + float det = GetDeterminant(); int i,j; if (det == 0.0f) @@ -762,7 +673,7 @@ hsMatrix44* hsMatrix44::GetInverse(hsMatrix44* inverse) const return inverse; } - det = hsScalarInvert(det); + det = hsInvert(det); GetAdjoint(inverse); for (i=0; i<4; i++) @@ -840,7 +751,7 @@ hsBool hsMatrix44::IsIdentity(void) #if 0 // IDENTITY_CRISIS if( i == j) { - if (fMap[i][j] != hsScalar1) + if (fMap[i][j] != 1.f) { NotIdentity(); retVal = false; @@ -855,17 +766,17 @@ hsBool hsMatrix44::IsIdentity(void) } } #else // IDENTITY_CRISIS - const hsScalar kEPS = 1.e-5f; + const float kEPS = 1.e-5f; if( i == j) { - if( (fMap[i][j] < hsScalar1-kEPS) || (fMap[i][j] > hsScalar1+kEPS) ) + if( (fMap[i][j] < 1.f-kEPS) || (fMap[i][j] > 1.f+kEPS) ) { NotIdentity(); retVal = false; } else { - fMap[i][j] = hsScalar1; + fMap[i][j] = 1.f; } } else @@ -909,12 +820,7 @@ void hsMatrix44::Read(hsStream *stream) int i,j; for(i=0; i<4; i++) for(j=0; j<4; j++) -#if HS_SCALAR_IS_FIXED - fMap[i][j] = stream->ReadLE32(); -#endif -#if HS_SCALAR_IS_FLOAT fMap[i][j] = stream->ReadLEFloat(); -#endif IsIdentity(); } else @@ -930,11 +836,6 @@ void hsMatrix44::Write(hsStream *stream) int i,j; for(i=0; i<4; i++) for(j=0; j<4; j++) -#if HS_SCALAR_IS_FIXED - stream->WriteLE32(fMap[i][j]); -#endif -#if HS_SCALAR_IS_FLOAT stream->WriteLEFloat(fMap[i][j]); -#endif } } diff --git a/Sources/Plasma/CoreLib/hsMatrix44.h b/Sources/Plasma/CoreLib/hsMatrix44.h index d3786c30..1892fa3f 100644 --- a/Sources/Plasma/CoreLib/hsMatrix44.h +++ b/Sources/Plasma/CoreLib/hsMatrix44.h @@ -59,7 +59,7 @@ struct hsMatrix44 { kUp, kView }; - hsScalar fMap[4][4]; + float fMap[4][4]; uint32_t fFlags; hsMatrix44() : fFlags(0) {} @@ -76,7 +76,7 @@ struct hsMatrix44 { // Concat transform hsMatrix44& Translate(const hsVector3 *); hsMatrix44& Scale(const hsVector3 *); - hsMatrix44& Rotate(int axis, hsScalar radians); + hsMatrix44& Rotate(int axis, float radians); hsMatrix44& Reset(hsBool asIdent=true) { @@ -92,7 +92,7 @@ struct hsMatrix44 { // Create matrix from scratch hsMatrix44& MakeTranslateMat(const hsVector3 *trans); hsMatrix44& MakeScaleMat(const hsVector3 *scale); - hsMatrix44& MakeRotateMat(int axis, hsScalar radians); + hsMatrix44& MakeRotateMat(int axis, float radians); hsMatrix44& Make(const hsPoint3* from, const hsPoint3* at, const hsVector3* up); // Not a camera matrix hsMatrix44& MakeUpPreserving(const hsPoint3* from, const hsPoint3* at, @@ -104,7 +104,7 @@ struct hsMatrix44 { const hsVector3* up); hsBool GetParity() const; - hsScalar GetDeterminant() const; + float GetDeterminant() const; hsMatrix44* GetInverse(hsMatrix44* inverse) const; hsMatrix44* GetTranspose(hsMatrix44* inverse) const; hsMatrix44* GetAdjoint(hsMatrix44* adjoint) const; @@ -120,67 +120,39 @@ struct hsMatrix44 { // Change component of matrix hsMatrix44& SetTranslate(const hsScalarTriple *); hsMatrix44& SetScale(const hsVector3 *); - hsMatrix44& SetRotate(int axis, hsScalar radians); + hsMatrix44& SetRotate(int axis, float radians); hsVector3 RemoveScale(); // returns old scale - void MakeXRotation(hsScalar radians); - void MakeYRotation(hsScalar radians); - void MakeZRotation(hsScalar radians); + void MakeXRotation(float radians); + void MakeYRotation(float radians); + void MakeZRotation(float radians); -#if 0 // Havok reeks - friend hsPoint3 operator*(const hsMatrix44& m, const hsPoint3& p) - { - if( m.fFlags & hsMatrix44::kIsIdent ) - return p; - - hsPoint3 rVal; - rVal.fX = hsScalarMul(p.fX, m.fMap[0][0]) + hsScalarMul(p.fY, m.fMap[0][1]) + hsScalarMul(p.fZ, m.fMap[0][2]) + m.fMap[0][3]; - rVal.fY = hsScalarMul(p.fX, m.fMap[1][0]) + hsScalarMul(p.fY, m.fMap[1][1]) + hsScalarMul(p.fZ, m.fMap[1][2]) + m.fMap[1][3]; - rVal.fZ = hsScalarMul(p.fX, m.fMap[2][0]) + hsScalarMul(p.fY, m.fMap[2][1]) + hsScalarMul(p.fZ, m.fMap[2][2]) + m.fMap[2][3]; - return rVal; - } - friend hsVector3 operator*(const hsMatrix44& m, const hsVector3& p); - friend hsMatrix44 operator*(const hsMatrix44& a, const hsMatrix44& b); -#else // Havok reeks hsPoint3 operator*(const hsPoint3& p) const { if( fFlags & hsMatrix44::kIsIdent ) return p; hsPoint3 rVal; - rVal.fX = hsScalarMul(p.fX, fMap[0][0]) + hsScalarMul(p.fY, fMap[0][1]) + hsScalarMul(p.fZ, fMap[0][2]) + fMap[0][3]; - rVal.fY = hsScalarMul(p.fX, fMap[1][0]) + hsScalarMul(p.fY, fMap[1][1]) + hsScalarMul(p.fZ, fMap[1][2]) + fMap[1][3]; - rVal.fZ = hsScalarMul(p.fX, fMap[2][0]) + hsScalarMul(p.fY, fMap[2][1]) + hsScalarMul(p.fZ, fMap[2][2]) + fMap[2][3]; + rVal.fX = (p.fX * fMap[0][0]) + (p.fY * fMap[0][1]) + (p.fZ * fMap[0][2]) + fMap[0][3]; + rVal.fY = (p.fX * fMap[1][0]) + (p.fY * fMap[1][1]) + (p.fZ * fMap[1][2]) + fMap[1][3]; + rVal.fZ = (p.fX * fMap[2][0]) + (p.fY * fMap[2][1]) + (p.fZ * fMap[2][2]) + fMap[2][3]; return rVal; } hsVector3 operator*(const hsVector3& p) const; hsMatrix44 operator*(const hsMatrix44& b) const; -#endif // Havok reeks hsPoint3* MapPoints(long count, hsPoint3 points[]) const; hsBool IsIdentity(void); void NotIdentity() { fFlags &= ~kIsIdent; } -#if 0 // Havok reeks - friend int operator==(const hsMatrix44& s, const hsMatrix44& t); - friend int operator!=(const hsMatrix44& s, const hsMatrix44& t); -#else // Havok reeks hsBool operator==(const hsMatrix44& ss) const; hsBool operator!=(const hsMatrix44& ss) const { return !(ss == *this); } -#endif // Havok reeks void Read(hsStream *stream); void Write(hsStream *stream); }; -#if 0 // Havok reeks -inline int operator!=(const hsMatrix44& s, const hsMatrix44& t) -{ - return (!(s==t)); -} -#endif // Havok reeks - //////////////////////////////////////////////////////////////////////////// #endif diff --git a/Sources/Plasma/CoreLib/hsPoint2.h b/Sources/Plasma/CoreLib/hsPoint2.h index 35fea6a7..91c34d59 100644 --- a/Sources/Plasma/CoreLib/hsPoint2.h +++ b/Sources/Plasma/CoreLib/hsPoint2.h @@ -42,90 +42,92 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsPoint2_Defined #define hsPoint2_Defined -#include "hsScalar.h" +#include -#define HS_POINT2_NAME hsIntPoint2 -#define HS_POINT2_TYPE int32_t -#include "HS_POINT2.inc" +struct hsPolar { + float fRadius; + float fAngle; }; -#define HS_POINT2_NAME hsFixedPoint2 -#define HS_POINT2_TYPE hsFixed -#include "HS_POINT2.inc" - - hsFixedPoint2& operator=(const hsIntPoint2& src) - { - this->fX = hsIntToFixed(src.fX); - this->fY = hsIntToFixed(src.fY); - return *this; - } - - hsFixed Magnitude() const { return hsMagnitude32(fX, fY); } - - static hsFixed Magnitude(hsFixed x, hsFixed y) - { - return hsMagnitude32(x, y); - } - static hsFixed Distance(const hsFixedPoint2& p1, const hsFixedPoint2& p2) - { - return hsMagnitude32(p2.fX - p1.fX, p2.fY - p1.fY); - } +struct hsPoint2 { + float fX, fY; + + hsPoint2& Set(float x, float y) + { + fX = x; + fY = y; + return *this; + } + hsPoint2& operator+=(const hsPoint2& s) + { + this->fX += s.fX; + this->fY += s.fY; + return *this; + } + hsPoint2& operator-=(const hsPoint2& s) + { + this->fX -= s.fX; + this->fY -= s.fY; + return *this; + } + + int operator==(const hsPoint2& ss) const + { + return (ss.fX == fX && ss.fY == fY); + } + int operator!=(const hsPoint2& ss) + { + return !(ss == *this); + } + + friend hsPoint2 operator+(const hsPoint2& s, const hsPoint2& t) + { + hsPoint2 result; + result.Set(s.fX + t.fX, s.fY + t.fY); + return result; + } + friend hsPoint2 operator-(const hsPoint2& s, const hsPoint2& t) + { + hsPoint2 result; + result.Set(s.fX - t.fX, s.fY - t.fY); + return result; + } + friend hsPoint2 operator-(const hsPoint2& s) + { + hsPoint2 result = { -s.fX, -s.fY }; + return result; + } + + friend hsPoint2 operator*(const hsPoint2& s, float t) + { + hsPoint2 result; + result.Set(s.fX * t, s.fY * t); + return result; + } + friend hsPoint2 operator*(float t, const hsPoint2& s) + { + hsPoint2 result; + result.Set(s.fX * t, s.fY * t); + return result; + } + + hsPoint2* Grid(float period); + hsBool CloseEnough(const hsPoint2* p, float tolerance) const; + + float MagnitudeSquared() const { return fX * fX + fY * fY; } + float Magnitude() const { return Magnitude(fX, fY); } + hsPolar* ToPolar(hsPolar* polar) const; + + static float Magnitude(float x, float y) { return sqrt(x * x + y * y); } + static float Distance(const hsPoint2& p1, const hsPoint2& p2); + static hsPoint2 Average(const hsPoint2& a, const hsPoint2& b) + { + hsPoint2 result; + result.Set((a.fX + b.fX) * float(0.5), (a.fY + b.fY) * float(0.5)); + return result; + } + static float ComputeAngle(const hsPoint2& a, const hsPoint2& b, const hsPoint2& c); }; -#if HS_CAN_USE_FLOAT - struct hsPolar { - float fRadius; - float fAngle; - }; - - #define HS_POINT2_NAME hsFloatPoint2 - #define HS_POINT2_TYPE float - #include "HS_POINT2.inc" - - hsFloatPoint2& operator=(const hsIntPoint2& src) - { - this->fX = float(src.fX); - this->fY = float(src.fY); - return *this; - } - - friend hsFloatPoint2 operator*(const hsFloatPoint2& s, float t) - { - hsFloatPoint2 result; - result.Set(s.fX * t, s.fY * t); - return result; - } - friend hsFloatPoint2 operator*(float t, const hsFloatPoint2& s) - { - hsFloatPoint2 result; - result.Set(s.fX * t, s.fY * t); - return result; - } - - hsFloatPoint2* Grid(float period); - hsBool CloseEnough(const hsFloatPoint2* p, float tolerance) const; - - float Magnitude() const { return hsFloatPoint2::Magnitude(fX, fY); } - float MagnitudeSquared() const { return fX * fX + fY * fY; } - hsPolar* ToPolar(hsPolar* polar) const; - - static float Magnitude(float x, float y) { return hsSquareRoot(x * x + y * y); } - static hsScalar Distance(const hsFloatPoint2& p1, const hsFloatPoint2& p2); - static hsFloatPoint2 Average(const hsFloatPoint2& a, const hsFloatPoint2& b) - { - hsFloatPoint2 result; - result.Set((a.fX + b.fX) * float(0.5), (a.fY + b.fY) * float(0.5)); - return result; - } - static hsScalar ComputeAngle(const hsFloatPoint2& a, const hsFloatPoint2& b, const hsFloatPoint2& c); - }; -#endif - -#if HS_SCALAR_IS_FIXED - typedef hsFixedPoint2 hsPoint2; -#else - typedef hsFloatPoint2 hsPoint2; -#endif - #endif // hsPoint2_Defined diff --git a/Sources/Plasma/CoreLib/hsQuat.cpp b/Sources/Plasma/CoreLib/hsQuat.cpp index a1436235..da9c1667 100644 --- a/Sources/Plasma/CoreLib/hsQuat.cpp +++ b/Sources/Plasma/CoreLib/hsQuat.cpp @@ -53,13 +53,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // Construct quat from angle (in radians) and axis of rotation // -hsQuat::hsQuat(hsScalar rad, const hsVector3* axis) +hsQuat::hsQuat(float rad, const hsVector3* axis) { - // hsAssert(rad >= -hsScalarPI && rad <= hsScalarPI, "Quat: Angle should be between -PI and PI"); + // hsAssert(rad >= -M_PI && rad <= M_PI, "Quat: Angle should be between -PI and PI"); - fW = hsCosine(rad*0.5f); + fW = cos(rad*0.5f); - hsScalar s = hsSine(rad*0.5f); + float s = sin(rad*0.5f); fX = axis->fX*s; fY = axis->fY*s; fZ = axis->fZ*s; @@ -68,7 +68,7 @@ hsQuat::hsQuat(hsScalar rad, const hsVector3* axis) hsQuat hsQuat::Inverse() { hsQuat q2 = Conjugate(); - hsScalar msInv = 1.0f/q2.MagnitudeSquared(); + float msInv = 1.0f/q2.MagnitudeSquared(); return (q2 * msInv); } @@ -82,11 +82,11 @@ hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) return hsPoint3(res.fX, res.fY, res.fZ); } -void hsQuat::SetAngleAxis(const hsScalar rad, const hsVector3 &axis) +void hsQuat::SetAngleAxis(const float rad, const hsVector3 &axis) { - fW = hsCosine(rad*0.5f); + fW = cos(rad*0.5f); - hsScalar s = hsSine(rad*0.5f); + float s = sin(rad*0.5f); fX = axis.fX*s; fY = axis.fY*s; fZ = axis.fZ*s; @@ -95,16 +95,16 @@ void hsQuat::SetAngleAxis(const hsScalar rad, const hsVector3 &axis) // // Might want to Normalize before calling this // -void hsQuat::GetAngleAxis(hsScalar *rad, hsVector3 *axis) const +void hsQuat::GetAngleAxis(float *rad, hsVector3 *axis) const { hsAssert((fW >= -1) && (fW <= 1), "Invalid acos argument"); - hsScalar ac = hsACosine(fW); + float ac = acos(fW); *rad = 2.0f * ac; - hsScalar s = hsSine(ac); + float s = sin(ac); if (s != 0.0f) { - hsScalar invS = 1.0f/s; + float invS = 1.0f/s; axis->Set(fX*invS, fY*invS, fZ*invS); } else @@ -114,7 +114,7 @@ void hsQuat::GetAngleAxis(hsScalar *rad, hsVector3 *axis) const // // // -hsScalar hsQuat::MagnitudeSquared() +float hsQuat::MagnitudeSquared() { return (fX*fX + fY*fY + fZ*fZ + fW*fW); } @@ -122,9 +122,9 @@ hsScalar hsQuat::MagnitudeSquared() // // // -hsScalar hsQuat::Magnitude() +float hsQuat::Magnitude() { - return hsSquareRoot(MagnitudeSquared()); + return sqrt(MagnitudeSquared()); } // @@ -132,7 +132,7 @@ hsScalar hsQuat::Magnitude() // void hsQuat::Normalize() { - hsScalar invMag = 1.0f/Magnitude(); + float invMag = 1.0f/Magnitude(); fX *= invMag; fY *= invMag; fZ *= invMag; @@ -145,11 +145,11 @@ void hsQuat::Normalize() void hsQuat::NormalizeIfNeeded() { - hsScalar magSquared = MagnitudeSquared(); + float magSquared = MagnitudeSquared(); if (magSquared == 1.0f) return; - hsScalar invMag = 1.0f/hsSquareRoot(magSquared); + float invMag = 1.0f/sqrt(magSquared); fX *= invMag; fY *= invMag; fZ *= invMag; @@ -259,17 +259,17 @@ void hsQuat::Write(hsStream *stream) // // Interpolate on a sphere. // -void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, hsScalar t) +void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, float t) { hsAssert(t>=0.0 && t<= 1.0, "Quat slerp param must be between 0 an 1"); - hsScalar theta = hsACosine(q1->Dot(*q2)); + float theta = acos(q1->Dot(*q2)); - hsScalar st = hsSine(theta); + float st = sin(theta); assert(st != 0.0); - hsScalar s1 = hsSine(1.0-t)*theta / st; + float s1 = sin(1.0-t)*theta / st; - hsScalar s2 = hsSine(t)*theta / st; + float s2 = sin(t)*theta / st; *this = (*q1) * s1 + (*q2) * s2; } @@ -280,15 +280,15 @@ void hsQuat::SetFromSlerp(hsQuat *q1, hsQuat *q2, hsScalar t) #define EPSILON 1.0E-6 /* a tiny number */ -void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int spin) +void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, float alpha, int spin) // double alpha; /* interpolation parameter (0 to 1) */ // Quaternion *a, *b; /* start and end unit quaternions */ // int spin; /* number of extra spin rotations */ { - hsScalar beta; /* complementary interp parameter */ - hsScalar theta; /* angle between A and B */ - hsScalar sin_t, cos_t; /* sine, cosine of theta */ - hsScalar phi; /* theta plus spins */ + float beta; /* complementary interp parameter */ + float theta; /* angle between A and B */ + float sin_t, cos_t; /* sine, cosine of theta */ + float phi; /* theta plus spins */ int bflip; /* use negation of B? */ /* cosine theta = dot product of A and B */ @@ -313,12 +313,12 @@ void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int } else { /* normal case */ // hsAssert((cos_t >= -1) && (cos_t <= 1), "Invalid acos argument"); - theta = hsACosine(cos_t); - phi = theta + spin * hsScalarPI; - sin_t = hsSine(theta); + theta = acos(cos_t); + phi = theta + spin * M_PI; + sin_t = sin(theta); hsAssert(sin_t != 0.0, "Invalid sin value in quat slerp"); - beta = hsSine(theta - alpha*phi) / sin_t; - alpha = hsSine(alpha*phi) / sin_t; + beta = sin(theta - alpha*phi) / sin_t; + alpha = sin(alpha*phi) / sin_t; } if (bflip) @@ -337,11 +337,11 @@ void hsQuat::SetFromSlerp(const hsQuat &a, const hsQuat &b, hsScalar alpha, int // void hsQuat::SetFromMatrix(const hsMatrix44* mat) { - hsScalar wSq = 0.25f*(1 + mat->fMap[0][0] + mat->fMap[1][1] + mat->fMap[2][2]); + float wSq = 0.25f*(1 + mat->fMap[0][0] + mat->fMap[1][1] + mat->fMap[2][2]); if (wSq > EPSILON) { - fW = hsSquareRoot(wSq); - hsScalar iw4 = 1.0f/(4.0f*fW); + fW = sqrt(wSq); + float iw4 = 1.0f/(4.0f*fW); fX = (mat->fMap[2][1] - mat->fMap[1][2]) * iw4; fY = (mat->fMap[0][2] - mat->fMap[2][0]) * iw4; fZ = (mat->fMap[1][0] - mat->fMap[0][1]) * iw4; @@ -349,21 +349,21 @@ void hsQuat::SetFromMatrix(const hsMatrix44* mat) } fW = 0; - hsScalar xSq = -0.5f*(mat->fMap[1][1] + mat->fMap[2][2]); + float xSq = -0.5f*(mat->fMap[1][1] + mat->fMap[2][2]); if (xSq > EPSILON) { - fX = hsSquareRoot(xSq); - hsScalar ix2 = 1.0f/(2.0f*fX); + fX = sqrt(xSq); + float ix2 = 1.0f/(2.0f*fX); fY = mat->fMap[1][0] * ix2; fZ = mat->fMap[2][0] * ix2; return; } fX = 0; - hsScalar ySq = 0.5f * (1 - mat->fMap[2][2]); + float ySq = 0.5f * (1 - mat->fMap[2][2]); if (ySq > EPSILON) { - fY = hsSquareRoot(ySq); + fY = sqrt(ySq); fZ = mat->fMap[2][1] / (2.0f*fY); return; } diff --git a/Sources/Plasma/CoreLib/hsQuat.h b/Sources/Plasma/CoreLib/hsQuat.h index 4f1a3003..a61f484e 100644 --- a/Sources/Plasma/CoreLib/hsQuat.h +++ b/Sources/Plasma/CoreLib/hsQuat.h @@ -53,29 +53,29 @@ struct hsMatrix44; class hsQuat { public: - hsScalar fX,fY,fZ,fW; + float fX,fY,fZ,fW; // Constructors hsQuat(){} - hsQuat(hsScalar X, hsScalar Y, hsScalar Z, hsScalar W) : + hsQuat(float X, float Y, float Z, float W) : fX(X), fY(Y), fZ(Z), fW(W) {} hsQuat(const hsQuat& a) { fX = a.fX; fY = a.fY; fZ = a.fZ; fW = a.fW; } - hsQuat(hsScalar af[4]) { fX = af[0]; fY = af[1]; fZ = af[2]; fW = af[3]; } - hsQuat(hsScalar rad, const hsVector3* axis); + hsQuat(float af[4]) { fX = af[0]; fY = af[1]; fZ = af[2]; fW = af[3]; } + hsQuat(float rad, const hsVector3* axis); static hsQuat QuatFromMatrix44(const hsMatrix44& mat); hsQuat& SetFromMatrix44(const hsMatrix44& mat); void SetFromMatrix(const hsMatrix44 *mat); - void SetFromSlerp(const hsQuat &q1, const hsQuat &q2, hsScalar t, int spin=0); - void Set(hsScalar X, hsScalar Y, hsScalar Z, hsScalar W) + void SetFromSlerp(const hsQuat &q1, const hsQuat &q2, float t, int spin=0); + void Set(float X, float Y, float Z, float W) { fX = X; fY = Y; fZ = Z; fW = W; } - void GetAngleAxis(hsScalar *rad, hsVector3 *axis) const; - void SetAngleAxis(const hsScalar rad, const hsVector3 &axis); + void GetAngleAxis(float *rad, hsVector3 *axis) const; + void SetAngleAxis(const float rad, const hsVector3 &axis); hsPoint3 Rotate(const hsScalarTriple* v); // Access operators - hsScalar& operator[](int i) { return (&fX)[i]; } - const hsScalar& operator[](int i) const { return (&fX)[i]; } + float& operator[](int i) { return (&fX)[i]; } + const float& operator[](int i) const { return (&fX)[i]; } // Unary operators hsQuat operator-() const { return(hsQuat(-fX,-fY,-fZ,-fW)); } @@ -84,14 +84,14 @@ public: // Comparison int operator==(const hsQuat& a) const { return (fX==a.fX && fY==a.fY && fZ==a.fZ && fW==a.fW); } - void Identity() { fX = fY = fZ = (hsScalar)0.0; fW = (hsScalar) 1.0; } + void Identity() { fX = fY = fZ = (float)0.0; fW = (float) 1.0; } int IsIdentity() const { return (fX==0.0 && fY==0.0 && fZ==0.0 && fW==1.0); } void Normalize(); void NormalizeIfNeeded(); void MakeMatrix(hsMatrix44 *mat) const; - hsScalar Magnitude(); - hsScalar MagnitudeSquared(); + float Magnitude(); + float MagnitudeSquared(); hsQuat Conjugate() const { return hsQuat(-fX,-fY,-fZ,fW); } hsQuat Inverse(); @@ -99,13 +99,13 @@ public: hsQuat operator-(const hsQuat&) const; hsQuat operator+(const hsQuat&) const; hsQuat operator*(const hsQuat&) const; - hsQuat operator*(hsScalar f) const + hsQuat operator*(float f) const { return hsQuat(fX*f,fY*f,fZ*f,fW*f); } - hsQuat operator/(hsScalar f) const + hsQuat operator/(float f) const { return hsQuat(fX/f,fY/f,fZ/f,fW/f); } hsQuat operator/(const hsQuat&) const; - hsScalar Dot(const hsQuat &q2) const + float Dot(const hsQuat &q2) const { return (fX*q2.fX + fY*q2.fY + fZ*q2.fZ + fW*q2.fW); } // I/O diff --git a/Sources/Plasma/CoreLib/hsScalar.h b/Sources/Plasma/CoreLib/hsScalar.h deleted file mode 100644 index 897ae083..00000000 --- a/Sources/Plasma/CoreLib/hsScalar.h +++ /dev/null @@ -1,200 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsScalarMacrosDefined -#define hsScalarMacrosDefined - -#include "hsFixedTypes.h" - -#ifndef HS_SCALAR_IS_FLOAT - #define HS_SCALAR_IS_FIXED 0 - #define HS_SCALAR_IS_FLOAT 1 - #define HS_NEVER_USE_FLOAT 0 -#endif - -#if HS_SCALAR_IS_FLOAT && HS_NEVER_USE_FLOAT - #error "can't define HS_SCALAR_IS_FLOAT and HS_NEVER_USE_FLOAT" -#endif - -#if HS_SCALAR_IS_FLOAT - #include -#endif - -#define hsScalarDegToRad(deg) hsScalarMul(deg, hsScalarPI / 180) -#define hsScalarRadToDeg(rad) hsScalarMul(rad, 180 / hsScalarPI) - -#if HS_SCALAR_IS_FIXED - typedef hsFixed hsScalar; - - #define hsScalar1 hsFixed1 - #define hsScalarHalf (hsFixed1 >> 1) - #define hsScalarPI (hsFixedPI) - #define hsScalarMax (0x7fffffff) - - #if HS_CAN_USE_FLOAT - #define hsFloatToScalar(x) hsFixed((x) * float(hsFixed1)) - #define hsScalarToFloat(x) ((x) / float(hsFixed1)) - #endif - - #define hsIntToScalar(x) hsIntToFixed(x) - #define hsScalarToInt(x) hsFixedToInt(x) - #define hsScalarRound(x) hsFixedRound(x) - - #define hsFixedToScalar(x) (x) - #define hsScalarToFixed(x) (x) - - #define hsFractToScalar(x) hsFractToFixed(x) - #define hsScalarToFract(x) hsFixedToFract(x) - - #define hsScalarMul(a, b) hsFixMul(a, b) - #define hsScalarMul2(a) ((a) << 1) - #define hsScalarDiv(a, b) hsFixDiv(a, b) - #define hsScalarDiv2(a) ((a) >> 1) - #define hsScalarInvert(a) hsFixDiv(hsFixed1, a) - #define hsScalarMod(a,b) ((a) % (b)) - #define hsScalarMulDiv(n1, n2, d) hsMulDiv32(n1, n2, d) - #define hsScalarMulAdd(a, b, c) (hsFixMul(a, b) + (c)) - - #define hsSquareRoot(scalar) hsFixSqrt(scalar) - #define hsSine(angle) hsFixedSin(angle) - #define hsCosine(angle) hsFixedCos(angle) - #define hsTan(angle) (hsSine(angle)/hsCosine(angle)) - #define hsASine(value) hsFixedASin(value) - #define hsACosine(value) hsFixedACos(value) - -#ifdef __cplusplus - inline hsScalar hsScalarAverage(hsScalar a, hsScalar b) { return a + b >> 1; } - inline hsScalar hsScalarAverage(hsScalar a, hsScalar b, hsScalar t) - { - return a + hsFixMul(t, b - a); - } - - #if HS_CAN_USE_FLOAT - inline hsScalar hsPow(hsScalar base, hsScalar exponent) - { - return hsFloatToScalar(powf(hsScalarToFloat(base), hsScalarToFloat(exponent))); - } - inline hsScalar hsATan2(hsScalar y, hsScalar x) - { - return hsFloatToScalar(atan2f(hsScalarToFloat(y), hsScalarToFloat(x))); - } - #endif - inline hsScalar hsCeil(hsScalar x) { return (x + 0xFFFF) & 0xFFFF0000; } - inline hsScalar hsFloor(hsScalar x) { return x & 0xFFFF0000; } -#endif -#endif -#if HS_SCALAR_IS_FLOAT - typedef float hsScalar; - - #define hsScalar1 float(1) - #define hsScalarHalf float(0.5) - #define hsScalarPI float(HS_PI) - #define hsScalarMax float(3.402823466e+38F) - - #define hsFloatToScalar(x) float(x) - #define hsScalarToFloat(x) float(x) - - #define hsIntToScalar(x) float(x) - #define hsScalarToInt(x) int32_t(x) - - - #define hsFixedToScalar(x) ((hsScalar)(x) / float(hsFixed1)) - #define hsScalarToFixed(x) hsFixed((x) * float(hsFixed1)) - - #define hsFractToScalar(x) ((x) / float(hsFract1)) - #define hsScalarToFract(x) hsFract((x) * float(hsFract1)) -#ifdef __cplusplus - - #define hsScalarMod(a,b) fmodf(a, b) - #define hsScalarMulAdd(a, b, c) ((a) * (b) + (c)) - #define hsScalarMul(a,b) ((a) * (b)) - #define hsScalarMul2(a) ((a) * 2) - #define hsScalarDiv(a,b) ((a) / (b)) - #define hsScalarDiv2(a) ((a) * float(0.5)) - #define hsScalarInvert(a) (float(1) / (a)) - #define hsScalarMulDiv(n1,n2,d) ((n1) * (n2) / (d)) - -#ifndef HS_DEBUGGING /* mf horse testing defines vs inlines for VC++5.0 performance */ - - #define hsScalarRound(x) int32_t((x) + ((x) < 0 ? -hsScalarHalf : hsScalarHalf)) - -#else /* HS_DEBUGGING - use inlines for type-checking etc...and all */ - inline int32_t hsScalarRound(float x) - { - float half = hsScalarHalf; - if (x < 0) - half = -half; - return int32_t(x + half); - } -#endif /* HS_DEBUGGING - use inlines for type-checking etc...and all */ - - inline float hsScalarAverage(float a, float b) { return (a + b) * float(0.5); } - inline float hsScalarAverage(float a, float b, float t) { return a + t * (b - a); } - - inline hsScalar hsSquareRoot(hsScalar scalar) { return sqrtf(scalar); } - inline hsScalar hsSine(hsScalar angle) { return sinf(angle); } - inline hsScalar hsCosine(hsScalar angle) { return cosf(angle); } - inline hsScalar hsTan(hsScalar rads) { return tanf(rads); } - inline hsScalar hsASine(hsScalar value) { return asinf(value); } - inline hsScalar hsACosine(hsScalar value) { return acosf(value); } - inline hsScalar hsPow(hsScalar base, hsScalar exponent) { return powf(base, exponent); } - inline hsScalar hsATan2(hsScalar y, hsScalar x) { return atan2f(y, x); } - inline hsScalar hsCeil(hsScalar x) { return ceilf(x); } - inline hsScalar hsFloor(hsScalar x) { return floorf(x); } -#endif /* HS_SCALAR_IS_FLOAT */ -#endif /* __CPLUSPLUS */ - -// -// Macros for enabling double precision math ops -// require #include -// -#if HS_BUILD_FOR_WIN32 -#define hsDoublePrecBegin \ - unsigned int fpc=_controlfp( 0, 0); \ - _controlfp( _PC_64, MCW_PC ); -#define hsDoublePrecEnd \ - _controlfp( fpc, 0xfffff ); -#else -#define hsDoublePrecBegin -#define hsDoublePrecEnd -#endif - -#endif diff --git a/Sources/Plasma/CoreLib/hsStream.cpp b/Sources/Plasma/CoreLib/hsStream.cpp index 75afdbd3..e7d69b43 100644 --- a/Sources/Plasma/CoreLib/hsStream.cpp +++ b/Sources/Plasma/CoreLib/hsStream.cpp @@ -526,46 +526,44 @@ uint32_t hsStream::ReadBE32() return value; } -#if HS_CAN_USE_FLOAT - double hsStream::ReadLEDouble() - { - double value; - Read8Bytes(&value); - value = hsToLEDouble(value); - return value; - } +double hsStream::ReadLEDouble() +{ + double value; + Read8Bytes(&value); + value = hsToLEDouble(value); + return value; +} - void hsStream::ReadLEDouble(int count, double values[]) - { - this->Read(count * sizeof(double), values); - for (int i = 0; i < count; i++) - values[i] = hsToLEDouble(values[i]); - } +void hsStream::ReadLEDouble(int count, double values[]) +{ + this->Read(count * sizeof(double), values); + for (int i = 0; i < count; i++) + values[i] = hsToLEDouble(values[i]); +} - float hsStream::ReadLEFloat() - { - float value; - Read4Bytes(&value); - value = hsToLEFloat(value); - return value; - } +float hsStream::ReadLEFloat() +{ + float value; + Read4Bytes(&value); + value = hsToLEFloat(value); + return value; +} - void hsStream::ReadLEFloat(int count, float values[]) - { - this->Read(count * sizeof(float), values); - for (int i = 0; i < count; i++) - values[i] = hsToLEFloat(values[i]); - } +void hsStream::ReadLEFloat(int count, float values[]) +{ + this->Read(count * sizeof(float), values); + for (int i = 0; i < count; i++) + values[i] = hsToLEFloat(values[i]); +} - float hsStream::ReadBEFloat() - { - float value; - this->Read(sizeof(float), &value); - value = hsToBEFloat(value); - return value; - } -#endif +float hsStream::ReadBEFloat() +{ + float value; + this->Read(sizeof(float), &value); + value = hsToBEFloat(value); + return value; +} void hsStream::WriteBool(hsBool value) @@ -631,37 +629,35 @@ void hsStream::WriteBE32(uint32_t value) this->Write(sizeof(int32_t), &value); } -#if HS_CAN_USE_FLOAT - void hsStream::WriteLEDouble(double value) - { - value = hsToLEDouble(value); - this->Write(sizeof(double), &value); - } +void hsStream::WriteLEDouble(double value) +{ + value = hsToLEDouble(value); + this->Write(sizeof(double), &value); +} - void hsStream::WriteLEDouble(int count, const double values[]) - { - for (int i = 0; i < count; i++) - this->WriteLEDouble(values[i]); - } +void hsStream::WriteLEDouble(int count, const double values[]) +{ + for (int i = 0; i < count; i++) + this->WriteLEDouble(values[i]); +} - void hsStream::WriteLEFloat(float value) - { - value = hsToLEFloat(value); - this->Write(sizeof(float), &value); - } +void hsStream::WriteLEFloat(float value) +{ + value = hsToLEFloat(value); + this->Write(sizeof(float), &value); +} - void hsStream::WriteLEFloat(int count, const float values[]) - { - for (int i = 0; i < count; i++) - this->WriteLEFloat(values[i]); - } +void hsStream::WriteLEFloat(int count, const float values[]) +{ + for (int i = 0; i < count; i++) + this->WriteLEFloat(values[i]); +} - void hsStream::WriteBEFloat(float value) - { - value = hsToBEFloat(value); - this->Write(sizeof(float), &value); - } -#endif +void hsStream::WriteBEFloat(float value) +{ + value = hsToBEFloat(value); + this->Write(sizeof(float), &value); +} void hsStream::WriteLEAtom(uint32_t tag, uint32_t size) { diff --git a/Sources/Plasma/CoreLib/hsStream.h b/Sources/Plasma/CoreLib/hsStream.h index dafabb89..55396f3d 100644 --- a/Sources/Plasma/CoreLib/hsStream.h +++ b/Sources/Plasma/CoreLib/hsStream.h @@ -225,7 +225,6 @@ public: /* Overloaded End */ -#if HS_CAN_USE_FLOAT float ReadLEFloat(); void ReadLEFloat(int count, float values[]); double ReadLEDouble(); @@ -256,33 +255,7 @@ public: void WriteLE(double value) { WriteLEDouble(value); } void WriteLE(int count, const double values[]) { WriteLEDouble(count, values); } /* Overloaded End */ -#endif - -#if HS_SCALAR_IS_FIXED - hsFixed ReadLEScalar() { return (hsFixed)this->ReadLE32(); } - void ReadLEScalar(int count, hsFixed values[]) - { - this->ReadLE32(count, (uint32_t*)values); - } - hsFixed ReadBEScalar() { return (hsFixed)this->ReadBE32(); } - - - void WriteLEScalar(hsFixed value) { this->WriteLE32(value); } - void WriteLEScalar(int count, const hsFixed values[]) - { - this->WriteLE32(count, (uint32_t*)values); - } - void WriteBEScalar(hsFixed value) { this->WriteBE32(value); } - - /* Overloaded Begin (Scalar) */ - void ReadLE(hsFixed* value) { this->ReadLE((uint32_t*)value); } - void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (uint32_t*)values); } - void WriteLE(hsFixed value) { this->WriteLE((uint32_t)value); } - void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (uint32_t*)values); } - /* Overloaded End */ - -#else float ReadLEScalar() { return (float)this->ReadLEFloat(); } void ReadLEScalar(int count, float values[]) { @@ -295,7 +268,6 @@ public: this->WriteLEFloat(count, (float*)values); } void WriteBEScalar(float value) { this->WriteBEFloat(value); } -#endif void WriteLEAtom(uint32_t tag, uint32_t size); uint32_t ReadLEAtom(uint32_t* size); diff --git a/Sources/Plasma/CoreLib/hsTypes.h b/Sources/Plasma/CoreLib/hsTypes.h index 3558cfc8..9089d369 100644 --- a/Sources/Plasma/CoreLib/hsTypes.h +++ b/Sources/Plasma/CoreLib/hsTypes.h @@ -48,10 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /************************** Other Includes *****************************/ #include #include - -#if HS_CAN_USE_FLOAT - #include -#endif /************************** Basic Macros *****************************/ @@ -83,9 +79,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define kPosInfinity32 (0x7fffffff) #define kNegInfinity32 (0x80000000) - -typedef int32_t hsFixed; -typedef int32_t hsFract; +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif #ifdef __cplusplus @@ -93,12 +89,6 @@ typedef int hsBool; #endif -#include "hsScalar.h" - -#if HS_CAN_USE_FLOAT - #define HS_PI 3.1415927 -#endif - #ifndef nil #define nil (0) #endif @@ -148,7 +138,6 @@ typedef uint32_t hsGSeedValue; ((value & 0x00ff000000000000) >> 40) | ((value) >> 56); } - #if HS_CAN_USE_FLOAT inline float hsSwapEndianFloat(float fvalue) { uint32_t value = *(uint32_t*)&fvalue; @@ -161,7 +150,6 @@ typedef uint32_t hsGSeedValue; value = hsSwapEndian64(value); return *(double*)&value; } - #endif #if LITTLE_ENDIAN #define hsToBE16(n) hsSwapEndian16(n) @@ -201,14 +189,12 @@ typedef uint32_t hsGSeedValue; b = c; } - #if HS_CAN_USE_FLOAT inline void hsSwap(float& a, float& b) { float c = a; a = b; b = c; } - #endif #endif /************************** Color32 Type *****************************/ diff --git a/Sources/Plasma/CoreLib/hsUtils.cpp b/Sources/Plasma/CoreLib/hsUtils.cpp index 35d3f722..5c083eca 100644 --- a/Sources/Plasma/CoreLib/hsUtils.cpp +++ b/Sources/Plasma/CoreLib/hsUtils.cpp @@ -55,6 +55,7 @@ extern "C" { #endif #include "hsStlUtils.h" #include "hsTemplates.h" +#include char * hsFormatStr(const char * fmt, ...) @@ -75,16 +76,9 @@ char * hsFormatStrV(const char * fmt, va_list args) static char hsStrBuf[100]; -char *hsScalarToStr(hsScalar s) +char *hsScalarToStr(float s) { - if (s == hsIntToScalar(hsScalarToInt(s))) - sprintf(hsStrBuf, "%d", hsScalarToInt(s)); - else - #if HS_CAN_USE_FLOAT - sprintf(hsStrBuf, "%f", hsScalarToFloat(s)); - #else - sprintf(hsStrBuf, "%d:%lu", hsFixedToInt(s), (uint16_t)s); - #endif + sprintf(hsStrBuf, "%f", s); return hsStrBuf; } @@ -216,6 +210,11 @@ int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int #endif } +inline hsBool hsCompare(float a, float b, float delta) +{ + return (fabs(a - b) < delta); +} + /* Generic psuedo RNG used in ANSI C. */ static unsigned long SEED = 1; diff --git a/Sources/Plasma/CoreLib/hsUtils.h b/Sources/Plasma/CoreLib/hsUtils.h index db260b56..e7595324 100644 --- a/Sources/Plasma/CoreLib/hsUtils.h +++ b/Sources/Plasma/CoreLib/hsUtils.h @@ -53,7 +53,7 @@ char* hsStrcpy(char dstOrNil[], const char src[]); void hsStrcat(char dst[], const char src[]); hsBool hsStrEQ(const char s1[], const char s2[]); hsBool hsStrCaseEQ(const char* s1, const char* s2); -char* hsScalarToStr(hsScalar); +char* hsScalarToStr(float); int hsRemove(const char* filename); void hsCPathToMacPath(char* dst, char* fname); void hsStrLower(char *s); @@ -127,10 +127,7 @@ int hsMessageBox(const wchar_t message[], const wchar_t caption[], int kind, int int hsMessageBoxWithOwner(void* owner, const char message[], const char caption[], int kind, int icon=hsMessageBoxIconAsterisk); int hsMessageBoxWithOwner(void* owner, const wchar_t message[], const wchar_t caption[], int kind, int icon=hsMessageBoxIconAsterisk); -inline hsBool hsCompare(hsScalar a, hsScalar b, hsScalar delta=0.0001) -{ - return (fabs(a - b) < delta); -} +inline hsBool hsCompare(float a, float b, float delta=0.0001); // flag testing / clearing #define hsCheckBits(f,c) ((f & c)==c) @@ -167,6 +164,11 @@ inline hsBool hsCompare(hsScalar a, hsScalar b, hsScalar delta=0.0001) # define hsWFopen(name, mode) fopen(hsWStringToString(name), hsWStringToString(mode)) #endif +// Useful floating point utilities +inline float hsDegreesToRadians(float deg) { return float(deg * (M_PI / 180)); } +inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); } +#define hsInvert(a) (1 / (a)) + ///////////////////////////// // Physical memory functions diff --git a/Sources/Plasma/CoreLib/hsWide.cpp b/Sources/Plasma/CoreLib/hsWide.cpp index 1cf6fcf7..f27e0110 100644 --- a/Sources/Plasma/CoreLib/hsWide.cpp +++ b/Sources/Plasma/CoreLib/hsWide.cpp @@ -240,7 +240,7 @@ inline int MaxLeftShift(const hsWide* w) } } -hsFixed hsWide::FixDiv(const hsWide* denom) const +int32_t hsWide::FixDiv(const hsWide* denom) const { hsWide num = *this; hsWide den = *denom; @@ -256,7 +256,7 @@ hsFixed hsWide::FixDiv(const hsWide* denom) const return num.Div(&den)->AsLong(); } -hsFract hsWide::FracDiv(const hsWide* denom) const +int32_t hsWide::FracDiv(const hsWide* denom) const { hsWide num = *this; hsWide den = *denom; @@ -297,10 +297,6 @@ int32_t hsWide::Sqrt() const } } while (--bits); -#if HS_PIN_MATH_OVERFLOW - if ((int32_t)root < 0) - return kPosInfinity32; -#endif return (int32_t)root; } diff --git a/Sources/Plasma/CoreLib/hsWide.h b/Sources/Plasma/CoreLib/hsWide.h index 261e2f65..6df13dff 100644 --- a/Sources/Plasma/CoreLib/hsWide.h +++ b/Sources/Plasma/CoreLib/hsWide.h @@ -73,21 +73,20 @@ struct hsWide { inline hsWide* RoundRight(unsigned shift); inline int32_t AsLong() const; // return bits 31-0, checking for over/under flow - inline hsFixed AsFixed() const; // return bits 47-16, checking for over/under flow - inline hsFract AsFract() const; // return bits 61-30, checking for over/under flow + inline int32_t AsFixed() const; // return bits 47-16, checking for over/under flow + inline int32_t AsFract() const; // return bits 61-30, checking for over/under flow hsWide* Mul(int32_t a); // this updates the wide hsWide* Mul(int32_t a, int32_t b); // this sets the wide hsWide* Div(int32_t denom); // this updates the wide hsWide* Div(const hsWide* denom); // this updates the wide - hsFixed FixDiv(const hsWide* denom) const; - hsFract FracDiv(const hsWide* denom) const; + int32_t FixDiv(const hsWide* denom) const; + int32_t FracDiv(const hsWide* denom) const; int32_t Sqrt() const; int32_t CubeRoot() const; -#if HS_CAN_USE_FLOAT double AsDouble() const { return fHi * double(65536) * double(65536) + fLo; } hsWide* Set(double d) { @@ -95,7 +94,6 @@ struct hsWide { int32_t lo = int32_t(d - double(hi)); return Set(hi, lo); } -#endif }; @@ -107,13 +105,8 @@ const hsWide kNegInfinity64 = { kNegInfinity32, 0 }; #define TOP2BITS(n) (uint32_t(n) >> 30) #define TOP3BITS(n) (uint32_t(n) >> 29) -#if HS_PIN_MATH_OVERFLOW && HS_DEBUG_MATH_OVERFLOW - #define hsSignalMathOverflow() hsDebugMessage("Math overflow", 0) - #define hsSignalMathUnderflow() hsDebugMessage("Math underflow", 0) -#else #define hsSignalMathOverflow() #define hsSignalMathUnderflow() -#endif #define WIDE_ISNEG(hi, lo) (int32_t(hi) < 0) #define WIDE_LESSTHAN(hi, lo, hi2, lo2) ((hi) < (hi2) || (hi) == (hi2) && (lo) < (lo2)) @@ -186,16 +179,6 @@ inline hsWide* hsWide::RoundRight(unsigned shift) inline int32_t hsWide::AsLong() const { -#if HS_PIN_MATH_OVERFLOW - if (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0)) - { hsSignalMathOverflow(); - return kPosInfinity32; - } - if (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0)) - { hsSignalMathOverflow(); - return kNegInfinity32; - } -#endif return (int32_t)fLo; } @@ -204,14 +187,14 @@ inline hsBool hsWide::IsWide() const return (fHi > 0 || (fHi == 0 && (int32_t)fLo < 0)) || (fHi < -1L || (fHi == -1L && (int32_t)fLo >= 0)); } -inline hsFixed hsWide::AsFixed() const +inline int32_t hsWide::AsFixed() const { hsWide tmp = *this; return tmp.RoundRight(16)->AsLong(); } -inline hsFract hsWide::AsFract() const +inline int32_t hsWide::AsFract() const { hsWide tmp = *this; diff --git a/Sources/Plasma/CoreLib/plViewTransform.cpp b/Sources/Plasma/CoreLib/plViewTransform.cpp index 6b911418..8375e593 100644 --- a/Sources/Plasma/CoreLib/plViewTransform.cpp +++ b/Sources/Plasma/CoreLib/plViewTransform.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "plViewTransform.h" -const hsScalar plViewTransform::kMinHither = 0.25f; +const float plViewTransform::kMinHither = 0.25f; plViewTransform::plViewTransform() : fFlags(kViewPortRelative), @@ -81,15 +81,15 @@ void plViewTransform::ISetCameraToNDC() const { hsPoint3 worldSizeInv; - worldSizeInv.fX = hsScalarInvert( fMax.fX - fMin.fX ) * 2.f; - worldSizeInv.fY = hsScalarInvert( fMax.fY - fMin.fY ) * 2.f; - worldSizeInv.fZ = hsScalarInvert( fMax.fZ - fMin.fZ ); + worldSizeInv.fX = hsInvert( fMax.fX - fMin.fX ) * 2.f; + worldSizeInv.fY = hsInvert( fMax.fY - fMin.fY ) * 2.f; + worldSizeInv.fZ = hsInvert( fMax.fZ - fMin.fZ ); fCameraToNDC.fMap[0][0] = worldSizeInv.fX; - fCameraToNDC.fMap[0][3] = -fMin.fX * worldSizeInv.fX - hsScalar1; + fCameraToNDC.fMap[0][3] = -fMin.fX * worldSizeInv.fX - 1.f; fCameraToNDC.fMap[1][1] = worldSizeInv.fY; - fCameraToNDC.fMap[1][3] = -fMin.fY * worldSizeInv.fY - hsScalar1; + fCameraToNDC.fMap[1][3] = -fMin.fY * worldSizeInv.fY - 1.f; // Map Screen Z to range 0 (at hither) to 1 (at yon) fCameraToNDC.fMap[2][2] = worldSizeInv.fZ; @@ -152,7 +152,7 @@ hsScalarTriple plViewTransform::NDCToScreen(const hsScalarTriple& ndc) const hsScalarTriple plViewTransform::NDCToCamera(const hsScalarTriple& ndc) const { hsPoint3 camP; - hsScalar w = ndc.fZ; + float w = ndc.fZ; const hsMatrix44& c2NDC = GetCameraToNDC(); @@ -188,7 +188,7 @@ hsScalarTriple plViewTransform::CameraToNDC(const hsScalarTriple& camP) const } else { - hsScalar invW = 1.f / camP.fZ; + float invW = 1.f / camP.fZ; ndc.fX = c2NDC.fMap[0][0] * camP.fX * invW + c2NDC.fMap[0][2]; @@ -203,7 +203,7 @@ hsScalarTriple plViewTransform::CameraToNDC(const hsScalarTriple& camP) const hsPoint3 ndc = c2NDC * hsPoint3(camP); if( !GetOrthogonal() ) { - hsScalar invW = 1.f / camP.fZ; + float invW = 1.f / camP.fZ; ndc *= invW; } #endif // MF_FLIP_SPARSE @@ -299,18 +299,18 @@ hsBool plViewTransform::Union(const plViewTransform& view) return true; } -hsScalar plViewTransform::GetFovX() const +float plViewTransform::GetFovX() const { - hsScalar minAng = hsATan2(fMin.fX, 1.f); - hsScalar maxAng = hsATan2(fMax.fX, 1.f); + float minAng = atan2(fMin.fX, 1.f); + float maxAng = atan2(fMax.fX, 1.f); return maxAng - minAng; } -hsScalar plViewTransform::GetFovY() const +float plViewTransform::GetFovY() const { - hsScalar minAng = hsATan2(fMin.fY, 1.f); - hsScalar maxAng = hsATan2(fMax.fY, 1.f); + float minAng = atan2(fMin.fY, 1.f); + float maxAng = atan2(fMax.fY, 1.f); return maxAng - minAng; } diff --git a/Sources/Plasma/CoreLib/plViewTransform.h b/Sources/Plasma/CoreLib/plViewTransform.h index 4675eab3..0853df7a 100644 --- a/Sources/Plasma/CoreLib/plViewTransform.h +++ b/Sources/Plasma/CoreLib/plViewTransform.h @@ -130,15 +130,15 @@ public: hsPoint3 GetMapMax() const { return fMapMax; } void GetMapping(hsPoint3& mapMin, hsPoint3& mapMax) const { mapMin = fMapMin; mapMax = fMapMax; } - hsScalar GetFovX() const; - hsScalar GetFovY() const; - hsScalar GetFovXDeg() const { return hsScalarRadToDeg(GetFovX()); } - hsScalar GetFovYDeg() const { return hsScalarRadToDeg(GetFovY()); } - hsScalar GetOrthoWidth() const { return fMax.fX - fMin.fX; } - hsScalar GetOrthoHeight() const { return fMax.fY - fMin.fY; } - hsScalar GetHither() const { return fMin.fZ; } - hsScalar GetYon() const { return fMax.fZ; } - void GetDepth(hsScalar& hither, hsScalar& yon) const { hither = GetHither(); yon = GetYon(); } + float GetFovX() const; + float GetFovY() const; + float GetFovXDeg() const { return hsRadiansToDegrees(GetFovX()); } + float GetFovYDeg() const { return hsRadiansToDegrees(GetFovY()); } + float GetOrthoWidth() const { return fMax.fX - fMin.fX; } + float GetOrthoHeight() const { return fMax.fY - fMin.fY; } + float GetHither() const { return fMin.fZ; } + float GetYon() const { return fMax.fZ; } + void GetDepth(float& hither, float& yon) const { hither = GetHither(); yon = GetYon(); } // Setup. // First, our world to camera and back again. @@ -158,7 +158,7 @@ public: // Defaults to 0,0,width,height (i.e. the whole screen). void SetViewPort(const hsPoint2& mins, const hsPoint2& maxs, hsBool relative=true); void SetViewPort(float loX, float loY, float hiX, float hiY, hsBool relative=true) { SetViewPort(hsPoint2().Set(loX, loY), hsPoint2().Set(hiX, hiY), relative); } - void SetViewPort(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) { SetViewPort(hsScalar(left), hsScalar(top), hsScalar(right), hsScalar(bottom), false); } + void SetViewPort(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) { SetViewPort(float(left), float(top), float(right), float(bottom), false); } void SetMapping(const hsPoint3& mins, const hsPoint3& maxs) { SetMapMin(mins); SetMapMax(maxs); } void SetMapMin(const hsPoint3& mins) { fMapMin = mins; } @@ -166,35 +166,35 @@ public: // Next, variants on setting up our projection matrix. // Depth is pretty uniform. - void SetDepth(hsScalar hither, hsScalar yon) { fMin.fZ = hither; fMax.fZ = yon; InvalidateTransforms(); } + void SetDepth(float hither, float yon) { fMin.fZ = hither; fMax.fZ = yon; InvalidateTransforms(); } void SetDepth(const hsPoint2& d) { SetDepth(d.fX, d.fY); } - void SetHither(hsScalar hither) { fMin.fZ = hither; InvalidateTransforms(); } - void SetYon(hsScalar yon) { fMax.fZ = yon; InvalidateTransforms(); } + void SetHither(float hither) { fMin.fZ = hither; InvalidateTransforms(); } + void SetYon(float yon) { fMax.fZ = yon; InvalidateTransforms(); } // Garden variety symmetric fov uses either of this first batch. Unless you're doing some funky projection, you don't even // need to look through the rest. // Degrees - all are full angles, < 180 degrees void SetFovDeg(const hsPoint2& deg) { SetFovDeg(deg.fX, deg.fY); } - void SetFovDeg(hsScalar degX, hsScalar degY) { SetFovXDeg(degX); SetFovYDeg(degY); } - void SetFovXDeg(hsScalar deg) { SetFovX(hsScalarDegToRad(deg)); } - void SetFovYDeg(hsScalar deg) { SetFovY(hsScalarDegToRad(deg)); } + void SetFovDeg(float degX, float degY) { SetFovXDeg(degX); SetFovYDeg(degY); } + void SetFovXDeg(float deg) { SetFovX(hsDegreesToRadians(deg)); } + void SetFovYDeg(float deg) { SetFovY(hsDegreesToRadians(deg)); } // Radians - all are full angles, < PI void SetFov(const hsPoint2& rad) { SetFov(rad.fX, rad.fY); } - void SetFov(hsScalar radX, hsScalar radY) { SetFovX(radX); SetFovY(radY); } - void SetFovX(hsScalar rad) { SetHalfWidth(hsTan(rad * 0.5f)); } - void SetFovY(hsScalar rad) { SetHalfHeight(hsTan(rad * 0.5f)); } + void SetFov(float radX, float radY) { SetFovX(radX); SetFovY(radY); } + void SetFovX(float rad) { SetHalfWidth(tan(rad * 0.5f)); } + void SetFovY(float rad) { SetHalfHeight(tan(rad * 0.5f)); } - // For orthogonal projection, don't call SetWidth(hsTan(fovRads)), because hsTan(f)/2 != hsTan(f/2) + // For orthogonal projection, don't call SetWidth(tan(fovRads)), because tan(f)/2 != tan(f/2) // For non-centered, call SetWidths/Heights() directly. - void SetWidth(hsScalar w) { SetHalfWidth(w * 0.5f); } - void SetHeight(hsScalar h) { SetHalfHeight(h * 0.5f); } + void SetWidth(float w) { SetHalfWidth(w * 0.5f); } + void SetHeight(float h) { SetHalfHeight(h * 0.5f); } // The rest do no interpretation, just stuff the values passed in. - void SetHalfWidth(hsScalar hw) { SetWidths(-hw, hw); } - void SetHalfHeight(hsScalar hh) { SetHeights(-hh, hh); } - void SetWidths(hsScalar minW, hsScalar maxW) { fMin.fX = minW; fMax.fX = maxW; InvalidateTransforms(); } - void SetHeights(hsScalar minH, hsScalar maxH) { fMin.fY = minH; fMax.fY = maxH; InvalidateTransforms(); } + void SetHalfWidth(float hw) { SetWidths(-hw, hw); } + void SetHalfHeight(float hh) { SetHeights(-hh, hh); } + void SetWidths(float minW, float maxW) { fMin.fX = minW; fMax.fX = maxW; InvalidateTransforms(); } + void SetHeights(float minH, float maxH) { fMin.fY = minH; fMax.fY = maxH; InvalidateTransforms(); } void SetWidths(const hsPoint2& w) { SetWidths(w.fX, w.fY); } void SetHeights(const hsPoint2& h) { SetHeights(h.fX, h.fY); } void SetView(const hsPoint3& mins, const hsPoint3& maxs) { fMax = maxs; fMin = mins; InvalidateTransforms(); } @@ -319,7 +319,7 @@ protected: mutable hsMatrix44 fWorldToNDC; // Have to set a limit here on the smallest the hither plane can be. - static const hsScalar kMinHither; + static const float kMinHither; void ISetCameraToNDC() const; hsBool ICameraToNDCSet() const { return IHasFlag(kCameraToNDCSet); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp index 1fa11867..2fb5fffb 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp @@ -949,9 +949,9 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) plKey newKey = cloneMsg->GetCloneKey(); cloneMsg->Send(); - hsScalar xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1 - hsScalar yAdjust = (2 * RAND()) - 1; - hsScalar zAdjust = (2 * RAND()) - 1; + float xAdjust = (2 * RAND()) - 1; // produces a random number between -1 and 1 + float yAdjust = (2 * RAND()) - 1; + float zAdjust = (2 * RAND()) - 1; hsPoint3 boidPos(pos.fX + xAdjust, pos.fY + yAdjust, pos.fZ + zAdjust); fFlock.AddBoid(this, newKey, boidPos); } @@ -979,7 +979,7 @@ hsBool pfObjectFlocker::MsgReceive(plMessage* msg) return plSingleModifier::MsgReceive(msg); } -hsBool pfObjectFlocker::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool pfObjectFlocker::IEval(double secs, float del, uint32_t dirty) { fFlock.Update(fTarget, del); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h index 1f0297ea..e6403c43 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.h @@ -448,7 +448,7 @@ protected: hsBool fUseTargetRotation; hsBool fRandomizeAnimationStart; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); }; #endif diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp index f4f8c61f..440c2bdf 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp @@ -51,13 +51,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plRandom plBlower::fRandom; -static const hsScalar kDefaultMasterPower = 20.f; -static const hsScalar kDefaultMasterFrequency = 2.f; -static const hsScalar kDefaultDirectRate = 1.f; -static const hsScalar kDefaultImpulseRate = 1.e2f; -static const hsScalar kDefaultSpringKonst = 20.f; -static const hsScalar kDefaultBias = 0.25f; -static const hsScalar kInitialMaxOffDist = 1.f; +static const float kDefaultMasterPower = 20.f; +static const float kDefaultMasterFrequency = 2.f; +static const float kDefaultDirectRate = 1.f; +static const float kDefaultImpulseRate = 1.e2f; +static const float kDefaultSpringKonst = 20.f; +static const float kDefaultBias = 0.25f; +static const float kInitialMaxOffDist = 1.f; plBlower::plBlower() : @@ -82,7 +82,7 @@ plBlower::~plBlower() { } -void plBlower::IBlow(double secs, hsScalar delSecs) +void plBlower::IBlow(double secs, float delSecs) { hsPoint3 worldPos = fTarget->GetLocalToWorld().GetTranslate(); hsPoint3 localPos = fTarget->GetLocalToParent().GetTranslate(); @@ -93,13 +93,13 @@ void plBlower::IBlow(double secs, hsScalar delSecs) // Strength = Strength + rnd01 * (MaxStrength - Strength) - hsScalar t = (fAccumTime += delSecs); + float t = (fAccumTime += delSecs); - hsScalar strength = 0; + float strength = 0; int i; for( i = 0; i < fOscillators.GetCount(); i++ ) { - hsScalar c, s; + float c, s; t *= fOscillators[i].fFrequency * fMasterFrequency; t += fOscillators[i].fPhase; hsFastMath::SinCosAppr(t, s, c); @@ -116,25 +116,25 @@ void plBlower::IBlow(double secs, hsScalar delSecs) hsFastMath::NormalizeAppr(fDirection); - hsScalar offDist = hsVector3(&fRestPos, &worldPos).Magnitude(); + float offDist = hsVector3(&fRestPos, &worldPos).Magnitude(); if( offDist > fMaxOffsetDist ) fMaxOffsetDist = offDist; hsVector3 force = fDirection * strength; - static hsScalar kOffsetDistFrac = 0.5f; // make me const + static float kOffsetDistFrac = 0.5f; // make me const if( offDist > fMaxOffsetDist * kOffsetDistFrac ) { offDist /= fMaxOffsetDist; offDist *= fMasterPower; - hsScalar impulse = offDist * delSecs * fImpulseRate; + float impulse = offDist * delSecs * fImpulseRate; force.fX += impulse * fRandom.RandMinusOneToOne(); force.fY += impulse * fRandom.RandMinusOneToOne(); force.fZ += impulse * fRandom.RandMinusOneToOne(); } - const hsScalar kOffsetDistDecay = 0.999f; + const float kOffsetDistDecay = 0.999f; fMaxOffsetDist *= kOffsetDistDecay; hsVector3 accel = force; @@ -145,9 +145,9 @@ void plBlower::IBlow(double secs, hsScalar delSecs) fCurrDel = del; } -hsBool plBlower::IEval(double secs, hsScalar delSecs, uint32_t dirty) +hsBool plBlower::IEval(double secs, float delSecs, uint32_t dirty) { - const hsScalar kMaxDelSecs = 0.1f; + const float kMaxDelSecs = 0.1f; if( delSecs > kMaxDelSecs ) delSecs = kMaxDelSecs; IBlow(secs, delSecs); @@ -212,20 +212,20 @@ void plBlower::Write(hsStream* s, hsResMgr* mgr) void plBlower::IInitOscillators() { - const hsScalar kBasePower = 5.f; + const float kBasePower = 5.f; fOscillators.SetCount(5); int i; for( i = 0; i < fOscillators.GetCount(); i++ ) { - hsScalar fi = hsScalar(i+1); - fOscillators[i].fFrequency = fi / hsScalarPI * fRandom.RandRangeF(0.75f, 1.25f); -// fOscillators[i].fFrequency = 1.f / hsScalarPI * fRandom.RandRangeF(0.5f, 1.5f); + float fi = float(i+1); + fOscillators[i].fFrequency = fi / M_PI * fRandom.RandRangeF(0.75f, 1.25f); +// fOscillators[i].fFrequency = 1.f / M_PI * fRandom.RandRangeF(0.5f, 1.5f); fOscillators[i].fPhase = fRandom.RandZeroToOne(); fOscillators[i].fPower = kBasePower * fRandom.RandRangeF(0.75f, 1.25f); } } -void plBlower::SetConstancy(hsScalar f) +void plBlower::SetConstancy(float f) { if( f < 0 ) f = 0; @@ -235,7 +235,7 @@ void plBlower::SetConstancy(hsScalar f) fBias = f; } -hsScalar plBlower::GetConstancy() const +float plBlower::GetConstancy() const { return fBias; } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h index 27c5684a..e8318e0b 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plBlower.h @@ -58,21 +58,21 @@ protected: class Oscillator { public: - hsScalar fFrequency; - hsScalar fPhase; - hsScalar fPower; + float fFrequency; + float fPhase; + float fPower; }; static plRandom fRandom; // Parameters - hsScalar fMasterPower; - hsScalar fMasterFrequency; - hsScalar fDirectRate; - hsScalar fImpulseRate; - hsScalar fSpringKonst; - hsScalar fBias; - - hsScalar fAccumTime; + float fMasterPower; + float fMasterFrequency; + float fDirectRate; + float fImpulseRate; + float fSpringKonst; + float fBias; + + float fAccumTime; hsTArray fOscillators; // CurrentState @@ -80,13 +80,13 @@ protected: hsPoint3 fRestPos; hsPoint3 fLocalRestPos; hsVector3 fCurrDel; - hsScalar fMaxOffsetDist; + float fMaxOffsetDist; void IInitOscillators(); void ISetTargetTransform(); - void IBlow(double secs, hsScalar delSecs); + void IBlow(double secs, float delSecs); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: ~plBlower(); plBlower(); @@ -99,19 +99,19 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetMasterPower(hsScalar f) { fMasterPower = f; } - void SetMasterFrequency(hsScalar f) { fMasterFrequency = f; } - void SetDirectRate(hsScalar f) { fDirectRate = f; } - void SetImpulseRate(hsScalar f) { fImpulseRate = f; } - void SetSpringKonst(hsScalar f) { fSpringKonst = f; } - void SetConstancy(hsScalar f); - - hsScalar GetMasterPower() const { return fMasterPower; } - hsScalar GetMasterFrequency() const { return fMasterFrequency; } - hsScalar GetDirectRate() const { return fDirectRate; } - hsScalar GetImpulseRate() const { return fImpulseRate; } - hsScalar GetSpringKonst() const { return fSpringKonst; } - hsScalar GetConstancy() const; + void SetMasterPower(float f) { fMasterPower = f; } + void SetMasterFrequency(float f) { fMasterFrequency = f; } + void SetDirectRate(float f) { fDirectRate = f; } + void SetImpulseRate(float f) { fImpulseRate = f; } + void SetSpringKonst(float f) { fSpringKonst = f; } + void SetConstancy(float f); + + float GetMasterPower() const { return fMasterPower; } + float GetMasterFrequency() const { return fMasterFrequency; } + float GetDirectRate() const { return fDirectRate; } + float GetImpulseRate() const { return fImpulseRate; } + float GetSpringKonst() const { return fSpringKonst; } + float GetConstancy() const; }; #endif // plBlower_inc diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp index 1ec19ed5..0dabd2cd 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp @@ -50,7 +50,7 @@ static hsMatrix44* InvTRS(const hsMatrix44& trs, hsMatrix44& inv) { inv.NotIdentity(); - hsScalar invSSq[3]; + float invSSq[3]; invSSq[0] = 1.f / (trs.fMap[0][0] * trs.fMap[0][0] + trs.fMap[1][0] * trs.fMap[1][0] + trs.fMap[2][0] * trs.fMap[2][0]); invSSq[1] = 1.f / (trs.fMap[0][1] * trs.fMap[0][1] + trs.fMap[1][1] * trs.fMap[1][1] + trs.fMap[2][1] * trs.fMap[2][1]); invSSq[2] = 1.f / (trs.fMap[0][2] * trs.fMap[0][2] + trs.fMap[1][2] * trs.fMap[1][2] + trs.fMap[2][2] * trs.fMap[2][2]); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp index 9493d2c1..2648fcfe 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp @@ -218,7 +218,7 @@ void plFollowMod::IMoveTarget() GetTarget()->SetTransform(l2w, w2l); } -hsBool plFollowMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plFollowMod::IEval(double secs, float del, uint32_t dirty) { if( ICheckLeader() ) IMoveTarget(); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h index 18b79231..fb24e08e 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.h @@ -87,7 +87,7 @@ protected: hsBool ICheckLeader(); void IMoveTarget(); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plFollowMod(); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp index 0690a665..daa0a4b6 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.cpp @@ -141,7 +141,7 @@ void plLightModifier::IApplyDynamic() void plLightModifier::DefaultAnimation() { - hsScalar len = MaxAnimLength(0); + float len = MaxAnimLength(0); fTimeConvert.SetBegin(0); fTimeConvert.SetEnd(len); fTimeConvert.SetLoopPoints(0, len); @@ -149,7 +149,7 @@ void plLightModifier::DefaultAnimation() fTimeConvert.Start(); } -hsScalar plLightModifier::MaxAnimLength(hsScalar len) const +float plLightModifier::MaxAnimLength(float len) const { if( fColorCtl && (fColorCtl->GetLength() > len) ) len = fColorCtl->GetLength(); @@ -229,7 +229,7 @@ void plOmniModifier::IApplyDynamic() } } -hsScalar plOmniModifier::MaxAnimLength(hsScalar len) const +float plOmniModifier::MaxAnimLength(float len) const { len = plLightModifier::MaxAnimLength(len); if( fAttenCtl && (fAttenCtl->GetLength() > len) ) @@ -302,20 +302,20 @@ void plSpotModifier::IApplyDynamic() { plOmniModifier::IApplyDynamic(); - hsScalar f; + float f; if( fInnerCtl ) { fInnerCtl->Interp(fCurrentTime, &f); - fSpot->SetSpotInner(hsScalarDegToRad(f)*0.5f); + fSpot->SetSpotInner(hsDegreesToRadians(f)*0.5f); } if( fOuterCtl ) { fOuterCtl->Interp(fCurrentTime, &f); - fSpot->SetSpotOuter(hsScalarDegToRad(f)*0.5f); + fSpot->SetSpotOuter(hsDegreesToRadians(f)*0.5f); } } -hsScalar plSpotModifier::MaxAnimLength(hsScalar len) const +float plSpotModifier::MaxAnimLength(float len) const { len = plOmniModifier::MaxAnimLength(len); if( fInnerCtl && (fInnerCtl->GetLength() > len) ) @@ -397,7 +397,7 @@ void plLtdDirModifier::IApplyDynamic() { plLightModifier::IApplyDynamic(); - hsScalar f; + float f; if( fWidthCtl ) { fWidthCtl->Interp(fCurrentTime, &f); @@ -415,7 +415,7 @@ void plLtdDirModifier::IApplyDynamic() } } -hsScalar plLtdDirModifier::MaxAnimLength(hsScalar len) const +float plLtdDirModifier::MaxAnimLength(float len) const { len = plLightModifier::MaxAnimLength(len); if( fWidthCtl && (fWidthCtl->GetLength() > len) ) diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h index 80d3edcd..540d8e7b 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLightModifier.h @@ -87,7 +87,7 @@ public: void SetSpecularCtl(plController* ctl) { fSpecularCtl = ctl; } virtual void DefaultAnimation(); - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plOmniModifier : public plLightModifier @@ -121,7 +121,7 @@ public: void SetAttenCtl(plController* ctl) { fAttenCtl = ctl; } void SetInitAtten(const hsPoint3& p) { fInitAtten = p; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plSpotModifier : public plOmniModifier @@ -155,7 +155,7 @@ public: void SetInnerCtl(plController* ctl) { fInnerCtl = ctl; } void SetOuterCtl(plController* ctl) { fOuterCtl = ctl; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; class plLtdDirModifier : public plLightModifier @@ -191,7 +191,7 @@ public: void SetHeightCtl(plController* ctl) { fHeightCtl = ctl; } void SetDepthCtl(plController* ctl) { fDepthCtl = ctl; } - virtual hsScalar MaxAnimLength(hsScalar len) const; + virtual float MaxAnimLength(float len) const; }; #endif // plLightModifier_inc diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp index 799e77f8..e8175982 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp @@ -79,7 +79,7 @@ plLineFollowMod::~plLineFollowMod() delete fPath; } -void plLineFollowMod::SetSpeedClamp(hsScalar fps) +void plLineFollowMod::SetSpeedClamp(float fps) { fSpeedClamp = fps; if( fSpeedClamp > 0 ) @@ -93,7 +93,7 @@ void plLineFollowMod::SetSpeedClamp(hsScalar fps) } -void plLineFollowMod::SetOffsetFeet(hsScalar f) +void plLineFollowMod::SetOffsetFeet(float f) { fOffset = f; if( fOffset != 0 ) @@ -115,9 +115,9 @@ void plLineFollowMod::SetForceToLine(hsBool on) fFollowFlags &= ~kForceToLine; } -void plLineFollowMod::SetOffsetDegrees(hsScalar f) +void plLineFollowMod::SetOffsetDegrees(float f) { - fOffset = hsScalarDegToRad(f); + fOffset = hsDegreesToRadians(f); if( fOffset != 0 ) { fFollowFlags &= ~kOffsetFeet; @@ -130,7 +130,7 @@ void plLineFollowMod::SetOffsetDegrees(hsScalar f) } } -void plLineFollowMod::SetOffsetClamp(hsScalar f) +void plLineFollowMod::SetOffsetClamp(float f) { fOffsetClamp = f; if( fOffsetClamp > 0 ) @@ -337,7 +337,7 @@ void plLineFollowMod::IRegister() } } -hsBool plLineFollowMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plLineFollowMod::IEval(double secs, float del, uint32_t dirty) { if( !fPath ) return false; @@ -366,7 +366,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) hsPoint3 tgtPos = tgtXfm.GetTranslate(); hsVector3 tgt2src(&fSearchPos, &tgtPos); - hsScalar t2sLen = tgt2src.Magnitude(); + float t2sLen = tgt2src.Magnitude(); hsFastMath::NormalizeAppr(tgt2src); hsVector3 out; @@ -374,7 +374,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) if( fFollowFlags & kOffsetAng ) { - hsScalar del = t2sLen * fTanOffset; + float del = t2sLen * fTanOffset; if( fFollowFlags & kOffsetClamp ) { if( del > fOffsetClamp ) @@ -409,7 +409,7 @@ hsBool plLineFollowMod::IOffsetTargetTransform(hsMatrix44& tgtXfm) hsBool plLineFollowMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm) { - hsScalar t = fPath->GetExtremePoint(searchPos); + float t = fPath->GetExtremePoint(searchPos); if( fFollowFlags & kFullMatrix ) { fPath->SetCurTime(t, plAnimPath::kNone); @@ -441,12 +441,12 @@ void plLineFollowMod::ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPo { hsVector3 del(&oldPos, &newPos); - hsScalar elapsed = hsTimer::GetDelSysSeconds(); - hsScalar speedSq = 0.f; + float elapsed = hsTimer::GetDelSysSeconds(); + float speedSq = 0.f; if (elapsed > 0.f) speedSq = del.MagnitudeSquared() / elapsed; - const hsScalar kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2 + const float kMaxSpeedSq = 30.f * 30.f; // (feet per sec)^2 if( speedSq > kMaxSpeedSq ) fFollowFlags |= kSearchPosPop; else @@ -497,7 +497,7 @@ hsBool plLineFollowMod::IGetSearchPos() return true; } -hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm) +hsMatrix44 plLineFollowMod::IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm) { hsMatrix44 retVal; int i, j; @@ -524,14 +524,14 @@ hsMatrix44 plLineFollowMod::ISpeedClamp(plCoordinateInterface* ci, const hsMatri const hsPoint3 oldPos = currL2W.GetTranslate(); const hsPoint3 newPos = unclTgtXfm.GetTranslate(); const hsVector3 del(&newPos, &oldPos); - hsScalar elapsed = hsTimer::GetDelSysSeconds(); - hsScalar speed = 0.f; + float elapsed = hsTimer::GetDelSysSeconds(); + float speed = 0.f; if (elapsed > 0.f) speed = del.Magnitude() / elapsed; if( speed > fSpeedClamp ) { - hsScalar parm = fSpeedClamp / speed; + float parm = fSpeedClamp / speed; hsMatrix44 clTgtXfm = IInterpMatrices(currL2W, unclTgtXfm, parm); @@ -658,9 +658,9 @@ hsBool plRailCameraMod::IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tg return true; } -hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed) +hsPoint3 plRailCameraMod::GetGoal(double secs, float speed) { - hsScalar delTime; + float delTime; int dir; if (fTargetTime == fCurrentTime) return fGoal; @@ -681,7 +681,7 @@ hsPoint3 plRailCameraMod::GetGoal(double secs, hsScalar speed) if (delTime <= (secs * speed)) fCurrentTime = fTargetTime; else - fCurrentTime += (hsScalar)((secs * speed) * dir); + fCurrentTime += (float)((secs * speed) * dir); if (fPath->GetWrap()) { diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h index 4d39bd5a..e907d5e4 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.h @@ -92,12 +92,12 @@ protected: hsTArray fStereizers; - hsScalar fTanOffset; - hsScalar fOffset; - hsScalar fOffsetClamp; - hsScalar fSpeedClamp; + float fTanOffset; + float fOffset; + float fOffsetClamp; + float fSpeedClamp; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IGetSearchPos(); virtual void ISetTargetTransform(int iTarg, const hsMatrix44& tgtXfm); @@ -106,7 +106,7 @@ protected: virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm); virtual hsBool IOffsetTargetTransform(hsMatrix44& tgtXfm); virtual hsMatrix44 ISpeedClamp(plCoordinateInterface* ci, const hsMatrix44& unclTgtXfm); - hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, hsScalar parm); + hsMatrix44 IInterpMatrices(const hsMatrix44& m0, const hsMatrix44& m1, float parm); void ICheckForPop(const hsPoint3& oldPos, const hsPoint3& newPos); void ISetupStereizers(const plListenerMsg* listMsg); @@ -138,20 +138,20 @@ public: hsBool HasOffsetClamp() const { return 0 != (fFollowFlags & kOffsetClamp); } hsBool HasSpeedClamp() const { return 0 != (fFollowFlags & kSpeedClamp); } - void SetOffsetFeet(hsScalar f); - hsScalar GetOffsetFeet() const { return fOffset; } + void SetOffsetFeet(float f); + float GetOffsetFeet() const { return fOffset; } - void SetOffsetDegrees(hsScalar f); - hsScalar GetOffsetDegrees() const { return hsScalarRadToDeg(fOffset); } + void SetOffsetDegrees(float f); + float GetOffsetDegrees() const { return hsRadiansToDegrees(fOffset); } - void SetOffsetClamp(hsScalar f); - hsScalar GetOffsetClamp() const { return fOffsetClamp; } + void SetOffsetClamp(float f); + float GetOffsetClamp() const { return fOffsetClamp; } void SetForceToLine(hsBool on); hsBool GetForceToLine() const { return 0 != (fFollowFlags & kForceToLine); } - void SetSpeedClamp(hsScalar feetPerSec); - hsScalar GetSpeedClamp() const { return fSpeedClamp; } + void SetSpeedClamp(float feetPerSec); + float GetSpeedClamp() const { return fSpeedClamp; } hsBool MsgReceive(plMessage* msg); @@ -175,7 +175,7 @@ public: GETINTERFACE_ANY( plRailCameraMod, plLineFollowMod ); void Init() { fCurrentTime = -1; } // twiddle ourselves so we get ready to go... - hsPoint3 GetGoal(double secs, hsScalar speed); + hsPoint3 GetGoal(double secs, float speed); protected: @@ -183,8 +183,8 @@ protected: virtual hsBool IGetTargetTransform(hsPoint3& searchPos, hsMatrix44& tgtXfm); hsMatrix44 fDesiredMatrix; - hsScalar fCurrentTime; - hsScalar fTargetTime; + float fCurrentTime; + float fTargetTime; hsPoint3 fGoal; hsBool fFarthest; }; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp index 4ca722b2..fbd177d0 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTimer.h" #include "hsUtils.h" -static const hsScalar kRandNormalize = 1.f / 32767.f; +static const float kRandNormalize = 1.f / 32767.f; plRandomCommandMod::plRandomCommandMod() { @@ -126,11 +126,11 @@ int plRandomCommandMod::IExcludeSelections(int ncmds) return ncmds; } -hsScalar plRandomCommandMod::IGetDelay(hsScalar len) const +float plRandomCommandMod::IGetDelay(float len) const { - hsScalar r = float(hsRand() * kRandNormalize); + float r = float(hsRand() * kRandNormalize); - hsScalar delay = fMinDelay + (fMaxDelay - fMinDelay) * r; + float delay = fMinDelay + (fMaxDelay - fMinDelay) * r; if( fMode & kDelayFromEnd ) delay += len; @@ -156,7 +156,7 @@ hsBool plRandomCommandMod::ISelectNext(int ncmds) } return true; } - hsScalar r = float(hsRand() * kRandNormalize); + float r = float(hsRand() * kRandNormalize); int nSelect = ncmds; @@ -294,7 +294,7 @@ void plRandomCommandMod::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fMaxDelay); } -void plRandomCommandMod::IRetry(hsScalar secs) +void plRandomCommandMod::IRetry(float secs) { IStop(); diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h index 0ddb8e12..9d2301c7 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.h @@ -73,18 +73,18 @@ protected: uint8_t fMode; // static, if it becomes dynamic, move to SynchedValue hsTArray fEndTimes; - hsScalar fMinDelay; - hsScalar fMaxDelay; + float fMinDelay; + float fMaxDelay; void IStart(); virtual void IStop(); hsBool IStopped() const; - void IRetry(hsScalar secs); + void IRetry(float secs); virtual void IPlayNextIfMaster(); void IReset(); - hsScalar IGetDelay(hsScalar len) const; + float IGetDelay(float len) const; int IExcludeSelections(int ncmds); hsBool ISelectNext(int nAnim); // return false if we should stop, else set fCurrent to next index @@ -94,7 +94,7 @@ protected: virtual void IPlayNext() = 0; // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plRandomCommandMod(); @@ -115,11 +115,11 @@ public: void SetState(uint8_t s) { fState = s; } uint8_t GetState() const { return fState; } - void SetMinDelay(hsScalar f) { fMinDelay = f; } - hsScalar GetMinDelay() const { return fMinDelay; } + void SetMinDelay(float f) { fMinDelay = f; } + float GetMinDelay() const { return fMinDelay; } - void SetMaxDelay(hsScalar f) { fMaxDelay = f; } - hsScalar GetMaxDelay() const { return fMaxDelay; } + void SetMaxDelay(float f) { fMaxDelay = f; } + float GetMaxDelay() const { return fMaxDelay; } }; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp index d5d39630..071b182d 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp @@ -119,7 +119,7 @@ hsBool plStereizer::MsgReceive(plMessage* msg) return plSingleModifier::MsgReceive(msg); } -hsBool plStereizer::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plStereizer::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -135,7 +135,7 @@ hsBool plStereizer::Stereize() // Find distance to listener hsPoint3 pos = IGetUnStereoPos(); hsVector3 posToList(&fListPos, &pos); - hsScalar dist = posToList.Magnitude(); + float dist = posToList.Magnitude(); // If distance less than ambient distance // setup as pure ambient @@ -210,14 +210,14 @@ hsPoint3 plStereizer::IGetAmbientPos() const return pos; } -hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const +hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, float distToList) const { hsPoint3 pos = IGetUnStereoPos(); hsVector3 axOut(-posToList.fY, posToList.fX, 0); hsFastMath::NormalizeAppr(axOut); - hsScalar distOut = distToList * fTanAng; + float distOut = distToList * fTanAng; if( distOut > fMaxSepDist ) distOut = fMaxSepDist; else if( distOut < fMinSepDist ) @@ -232,12 +232,12 @@ hsPoint3 plStereizer::IGetLocalizedPos(const hsVector3& posToList, hsScalar dist return pos; } -void plStereizer::SetSepAngle(hsScalar rads) +void plStereizer::SetSepAngle(float rads) { - fTanAng = hsScalar(tan(rads)); + fTanAng = float(tan(rads)); } -hsScalar plStereizer::GetSepAngle() const +float plStereizer::GetSepAngle() const { return atan(fTanAng); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h index da933acb..63081a1c 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plStereizer.h @@ -67,13 +67,13 @@ protected: }; // Static properties - hsScalar fAmbientDist; - hsScalar fTransition; + float fAmbientDist; + float fTransition; - hsScalar fMaxSepDist; - hsScalar fMinSepDist; + float fMaxSepDist; + float fMinSepDist; - hsScalar fTanAng; + float fTanAng; hsPoint3 fInitPos; @@ -82,9 +82,9 @@ protected: hsVector3 fListDirection; hsVector3 fListUp; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); - hsPoint3 IGetLocalizedPos(const hsVector3& posToList, hsScalar distToList) const; + hsPoint3 IGetLocalizedPos(const hsVector3& posToList, float distToList) const; hsPoint3 IGetAmbientPos() const; void ISetNewPos(const hsPoint3& newPos); @@ -109,20 +109,20 @@ public: hsBool Stereize(); void SetFromListenerMsg(const plListenerMsg* listMsg); - void SetAmbientDist(hsScalar d) { fAmbientDist = d; } - hsScalar GetAmbientDist() const { return fAmbientDist; } + void SetAmbientDist(float d) { fAmbientDist = d; } + float GetAmbientDist() const { return fAmbientDist; } - void SetTransition(hsScalar d) { fTransition = d; } - hsScalar GetTransition() const { return fTransition; } + void SetTransition(float d) { fTransition = d; } + float GetTransition() const { return fTransition; } - void SetMaxSepDist(hsScalar d) { fMaxSepDist = d; } - hsScalar GetMaxSepDist() const { return fMaxSepDist; } + void SetMaxSepDist(float d) { fMaxSepDist = d; } + float GetMaxSepDist() const { return fMaxSepDist; } - void SetMinSepDist(hsScalar d) { fMinSepDist = d; } - hsScalar GetMinSepDist() const { return fMinSepDist; } + void SetMinSepDist(float d) { fMinSepDist = d; } + float GetMinSepDist() const { return fMinSepDist; } - void SetSepAngle(hsScalar rads); - hsScalar GetSepAngle() const; + void SetSepAngle(float rads); + float GetSepAngle() const; void SetAsLeftChannel(hsBool on) { if(on)SetFlag(kLeftChannel); else ClearFlag(kLeftChannel); } hsBool IsLeftChannel() const { return HasFlag(kLeftChannel); } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp index e50faa55..92f83aa8 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp @@ -129,7 +129,7 @@ void plViewFaceModifier::SetTarget(plSceneObject* so) plgDispatch::Dispatch()->RegisterForExactType(plArmatureUpdateMsg::Index(), GetKey()); } -hsBool plViewFaceModifier::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plViewFaceModifier::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -157,7 +157,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) } hsPoint3 localAt = worldToLocal * at; - hsScalar len = localAt.MagnitudeSquared(); + float len = localAt.MagnitudeSquared(); if( len <= 0 ) return false; len = -hsFastMath::InvSqrtAppr(len); @@ -220,7 +220,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) x.fMap[3][0] = x.fMap[3][1] = x.fMap[3][2] = 0; xInv.fMap[0][3] = xInv.fMap[1][3] = xInv.fMap[2][3] = 0; - xInv.fMap[3][3] = x.fMap[3][3] = hsScalar1; + xInv.fMap[3][3] = x.fMap[3][3] = 1.f; x.NotIdentity(); xInv.NotIdentity(); @@ -239,7 +239,7 @@ hsBool plViewFaceModifier::IFacePoint(plPipeline* pipe, const hsPoint3& at) x.fMap[2][1] *= fScale.fZ; x.fMap[2][2] *= fScale.fZ; - hsScalar inv = 1.f / fScale.fX; + float inv = 1.f / fScale.fX; xInv.fMap[0][0] *= inv; xInv.fMap[1][0] *= inv; xInv.fMap[2][0] *= inv; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h index 6e47d087..276cbf6a 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h +++ b/Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.h @@ -84,7 +84,7 @@ protected: hsBounds3Ext fMaxBounds; virtual hsBool IFacePoint(plPipeline* pipe, const hsPoint3& at); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); enum RefType { diff --git a/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp b/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp index 8d9015c8..65e121c8 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp +++ b/Sources/Plasma/FeatureLib/pfAudio/plListener.cpp @@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsBool plListener::fPrintDbgInfo = false; -hsBool plListener::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plListener::IEval(double secs, float del, uint32_t dirty) { // if (!plgAudioSys::Active()) // return true; diff --git a/Sources/Plasma/FeatureLib/pfAudio/plListener.h b/Sources/Plasma/FeatureLib/pfAudio/plListener.h index f9d63d45..131fec5a 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plListener.h +++ b/Sources/Plasma/FeatureLib/pfAudio/plListener.h @@ -83,12 +83,12 @@ protected: plVirtualCam1* fVCam; - hsScalar fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject + float fPosRatio, fFacingRatio, fVelRatio; // 0 is vCam, 1 is refObject hsBool fInitMe; static hsBool fPrintDbgInfo; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); void ISetRef( const plKey &ref, hsBool binding, int type ); void ICheckAudio( void ) const; diff --git a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp index 773ad9b9..dbca5224 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp @@ -185,7 +185,7 @@ void plRandomSoundMod::IPlayNext() fFirstTimePlay = false; if( !(fMode & kOneCmd) ) { - hsScalar delay = IGetDelay(0); + float delay = IGetDelay(0); double t = hsTimer::GetSysSeconds() + delay; plAnimCmdMsg* anim = TRACKED_NEW plAnimCmdMsg(GetKey(), GetKey(), &t); @@ -203,7 +203,7 @@ void plRandomSoundMod::IPlayNext() // We don't want random sounds to synch, since we don't synch the randomness. So force this next // sound to not synch - hsScalar currLen; + float currLen; if( fGroups != nil && fGroups[ fCurrentGroup ].fGroupedIdx != -1 ) { currentSndIdx = fGroups[ fCurrentGroup ].fIndices[ fCurrent ]; @@ -245,7 +245,7 @@ void plRandomSoundMod::IPlayNext() } if (ai->GetSound(currentSndIdx)) - currLen = (hsScalar)(ai->GetSound(currentSndIdx)->GetLength()); + currLen = (float)(ai->GetSound(currentSndIdx)->GetLength()); else currLen = 0; } @@ -262,7 +262,7 @@ void plRandomSoundMod::IPlayNext() if( !(fMode & kOneCmd) ) { - hsScalar delay = IGetDelay(currLen); + float delay = IGetDelay(currLen); double t = hsTimer::GetSysSeconds() + delay; @@ -386,7 +386,7 @@ hsBool plRandomSoundMod::MsgReceive(plMessage* msg) return plRandomCommandMod::MsgReceive(msg); } -void plRandomSoundMod::ISetVolume(hsScalar volume) +void plRandomSoundMod::ISetVolume(float volume) { plSound *pSound = nil; diff --git a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h index 1fb6c6a4..3611c75f 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h +++ b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.h @@ -77,7 +77,7 @@ protected: virtual void IPlayNext(); virtual void IPlayNextIfMaster(); virtual void IStop(); - void ISetVolume(hsScalar volume); + void ISetVolume(float volume); void ISetPosition(hsPoint3); plSound *IGetSoundPtr(); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp index 50cf05f4..1fdf3eb8 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp @@ -73,12 +73,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetClient/plNetClientMgr.h" hsBool plCameraBrain1_FirstPerson::fDontFade = false; -hsScalar plCameraBrain1::fFallAccel = 20.0f; -hsScalar plCameraBrain1::fFallDecel = 5.0f; -hsScalar plCameraBrain1::fFallVelocity = 50.0f; -hsScalar plCameraBrain1::fFallPOAAccel = 10.0f; -hsScalar plCameraBrain1::fFallPOADecel = 10.0f; -hsScalar plCameraBrain1::fFallPOAVelocity = 50.0f; +float plCameraBrain1::fFallAccel = 20.0f; +float plCameraBrain1::fFallDecel = 5.0f; +float plCameraBrain1::fFallVelocity = 50.0f; +float plCameraBrain1::fFallPOAAccel = 10.0f; +float plCameraBrain1::fFallPOADecel = 10.0f; +float plCameraBrain1::fFallPOAVelocity = 50.0f; // basic camera brain now is a fixed brain by default. // if it doesn't have a subject (an object) it will just look straight ahead. @@ -176,13 +176,13 @@ void plCameraBrain1::Pop() } // set the goal to which we want to animate the fov -void plCameraBrain1::SetFOVGoal(hsScalar h, double t) +void plCameraBrain1::SetFOVGoal(float h, double t) { if (fFOVGoal == h || h == fCamera->GetFOVh()) return; - hsScalar dif = h - fCamera->GetFOVh(); - fFOVAnimRate = dif / ((hsScalar)t); + float dif = h - fCamera->GetFOVh(); + fFOVAnimRate = dif / ((float)t); fFOVGoal = h; fFOVStartTime = hsTimer::GetSysSeconds(); @@ -192,7 +192,7 @@ void plCameraBrain1::SetFOVGoal(hsScalar h, double t) } // set parameters for how this camera zooms FOV based on user input (mostly for telescopes) -void plCameraBrain1::SetZoomParams(hsScalar max, hsScalar min, hsScalar rate) +void plCameraBrain1::SetZoomParams(float max, float min, float rate) { fZoomRate = rate; fZoomMax = max; @@ -240,7 +240,7 @@ void plCameraBrain1::Update(hsBool forced) // adjust FOV based on elapsed time void plCameraBrain1::IAnimateFOV(double time) { - hsScalar dH = fFOVAnimRate * hsTimer::GetDelSysSeconds(); + float dH = fFOVAnimRate * hsTimer::GetDelSysSeconds(); dH += fCamera->GetFOVh(); @@ -251,7 +251,7 @@ void plCameraBrain1::IAnimateFOV(double time) dH = fFOVGoal; } - fCamera->SetFOVw( (hsScalar)(dH * plVirtualCam1::Instance()->GetAspectRatio()) ); + fCamera->SetFOVw( (float)(dH * plVirtualCam1::Instance()->GetAspectRatio()) ); fCamera->SetFOVh( dH ); } @@ -274,13 +274,13 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime) return; } hsVector3 dir(fGoal - fCamera->GetTargetPos()); - hsScalar distToGoal=dir.Magnitude(); + float distToGoal=dir.Magnitude(); //smooth out stoppage... - hsScalar adjMaxVel = fVelocity; + float adjMaxVel = fVelocity; if (distToGoal <= 5.0f && distToGoal > 0.1f) { - hsScalar mult = (distToGoal - 5.0f)*0.1f; + float mult = (distToGoal - 5.0f)*0.1f; adjMaxVel = fVelocity - hsABS(fVelocity*mult); } @@ -306,7 +306,7 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime) fCurCamSpeed = vel.Magnitude(); - hsScalar distMoved; + float distMoved; if (fFlags.IsBitSet(kPanicVelocity)) distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime); else @@ -350,16 +350,16 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) hsVector3 dir(fPOAGoal - fCamera->GetTargetPOA()); - hsScalar distToGoal=dir.Magnitude(); + float distToGoal=dir.Magnitude(); if (distToGoal > 0.0f) dir.Normalize(); // smooth out stoppage - hsScalar adjMaxVel = fPOAVelocity; + float adjMaxVel = fPOAVelocity; if (distToGoal <= 5.0f && distToGoal > 0.1f) { - hsScalar mult = (distToGoal - 5.0f)*0.1f; + float mult = (distToGoal - 5.0f)*0.1f; adjMaxVel = fPOAVelocity - hsABS(fPOAVelocity*mult); } @@ -382,7 +382,7 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) fCurViewSpeed = vel.Magnitude(); - hsScalar distMoved; + float distMoved; if (fFlags.IsBitSet(kPanicVelocity)) distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime); else @@ -402,15 +402,15 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime) } -void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate, - hsVector3* dir, hsVector3* vel, hsScalar maxSpeed, - hsScalar distToGoal, double elapsedTime) +void plCameraBrain1::IAdjustVelocity(float adjAccelRate, float adjDecelRate, + hsVector3* dir, hsVector3* vel, float maxSpeed, + float distToGoal, double elapsedTime) { - hsScalar speed = vel->Magnitude(); // save current speed + float speed = vel->Magnitude(); // save current speed *vel = *dir * speed; // change vel to correct dir // compute accel/decel - hsScalar finalAccelRate; + float finalAccelRate; if (IShouldDecelerate(adjDecelRate, speed, distToGoal)) { @@ -425,7 +425,7 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat { // compute accel vector in the direction of the goal hsVector3 accelVec = *dir * finalAccelRate; - accelVec = accelVec * (hsScalar)elapsedTime; + accelVec = accelVec * (float)elapsedTime; // add acceleration to velocity *vel = *vel + accelVec; @@ -436,13 +436,13 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat } } -hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime) +float plCameraBrain1::IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime) { - *vel = *vel * (hsScalar)elapsedTime; - maxSpeed *= (hsScalar)elapsedTime; + *vel = *vel * (float)elapsedTime; + maxSpeed *= (float)elapsedTime; // clamp speed (clamp if going negative?) - hsScalar distMoved = vel->Magnitude(); + float distMoved = vel->Magnitude(); if (distMoved > maxSpeed) { vel->Normalize(); @@ -452,16 +452,16 @@ hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, doubl return distMoved; } -hsBool plCameraBrain1::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal) +hsBool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal) { if (decelSpeed == 0) // no deceleration return false; // compute distance required to stop, given decel speed (in units/sec sq) - hsScalar stopTime = curSpeed / decelSpeed; - hsScalar avgSpeed = curSpeed * .5f; - hsScalar stopDist = avgSpeed * stopTime; + float stopTime = curSpeed / decelSpeed; + float avgSpeed = curSpeed * .5f; + float stopDist = avgSpeed * stopTime; return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed? } @@ -476,7 +476,7 @@ void plCameraBrain1::AdjustForInput(double secs) if (fOffsetPct < 1.0f) { hsVector3 v(fPOAGoal - fGoal); - hsScalar len = v.Magnitude(); + float len = v.Magnitude(); len = len - (len * fOffsetPct); v.Normalize(); fGoal = fGoal + (v * len); @@ -710,10 +710,10 @@ void plCameraBrain1::SetSubject(plSceneObject* sub) // -hsScalar plCameraBrain1_Drive::fTurnRate = 100.0f; -hsScalar plCameraBrain1_Drive::fAcceleration = 200.0f; -hsScalar plCameraBrain1_Drive::fDeceleration = 200.0f; -hsScalar plCameraBrain1_Drive::fMaxVelocity = 100.0f; +float plCameraBrain1_Drive::fTurnRate = 100.0f; +float plCameraBrain1_Drive::fAcceleration = 200.0f; +float plCameraBrain1_Drive::fDeceleration = 200.0f; +float plCameraBrain1_Drive::fMaxVelocity = 100.0f; // constructor @@ -764,7 +764,7 @@ void plCameraBrain1_Drive::Update(hsBool forced) // update our desired position: double time = hsTimer::GetSeconds(); - hsScalar eTime = (hsScalar)(time-fLastTime); + float eTime = (float)(time-fLastTime); if(eTime > 0.01f) eTime = 0.01f; fLastTime = time; @@ -772,7 +772,7 @@ void plCameraBrain1_Drive::Update(hsBool forced) hsVector3 view, up, right; fTargetMatrix.GetAxis(&view,&up,&right); - hsScalar delta = 5.0f * eTime; + float delta = 5.0f * eTime; // adjust speed if (HasMovementFlag(B_CAMERA_DRIVE_SPEED_UP)) @@ -805,8 +805,8 @@ void plCameraBrain1_Drive::Update(hsBool forced) fMaxVelocity = plVirtualCam1::Instance()->fVel; } - hsScalar speed = fMaxVelocity; - hsScalar turn = 1.0f; + float speed = fMaxVelocity; + float turn = 1.0f; if (HasMovementFlag(B_CONTROL_MODIFIER_FAST)) { @@ -1583,7 +1583,7 @@ hsBool plCameraBrain1_Fixed::MsgReceive(plMessage* msg) // // // circle camera crap -static const hsScalar kTwoPI = 2.0f*hsScalarPI; +static const float kTwoPI = 2.0f*M_PI; plCameraBrain1_Circle::plCameraBrain1_Circle() : plCameraBrain1_Fixed() { @@ -1656,17 +1656,17 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do if (fCurRad != fGoalRad) { - hsScalar dist = hsABS(fGoalRad-fCurRad); + float dist = hsABS(fGoalRad-fCurRad); hsAssert(dist>=0 && dist<=kTwoPI, "illegal radian diff"); - hsBool mustWrap = (dist > hsScalarPI); // go opposite direction for shortcut and wrap + hsBool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap // compute speed - hsScalar speed; + float speed; if (warp) - speed = (hsScalar)(kTwoPI * 100 * secs); + speed = (float)(kTwoPI * 100 * secs); else - speed = (hsScalar)(kTwoPI * fCirPerSec * secs); + speed = (float)(kTwoPI * fCirPerSec * secs); // move towards goalRad hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value"); @@ -1717,7 +1717,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value"); hsPoint3 x; - x = GetCenterPoint() + hsVector3((hsScalar)hsCosine(fCurRad)*fRadius, (hsScalar)hsSine(fCurRad)*fRadius, 0.0f); + x = GetCenterPoint() + hsVector3((float)cos(fCurRad)*fRadius, (float)sin(fCurRad)*fRadius, 0.0f); x.fZ = fCamera->GetTargetPos().fZ; return x; } @@ -1737,8 +1737,8 @@ hsPoint3 plCameraBrain1_Circle::IGetClosestPointOnCircle(const hsPoint3* toThis) v = hsVector3(¢er, &p); } v.Normalize(); - fGoalRad = (hsScalar)atan2(v.fY, v.fX); // -pi to pi - hsAssert(fGoalRad>=-hsScalarPI && fGoalRad<=hsScalarPI, "Illegal atan2 val"); + fGoalRad = (float)atan2(v.fY, v.fX); // -pi to pi + hsAssert(fGoalRad>=-M_PI && fGoalRad<=M_PI, "Illegal atan2 val"); if (fGoalRad<0) fGoalRad = kTwoPI + fGoalRad; // 0 to 2pi hsAssert(fGoalRad>=0 && fGoalRad<=kTwoPI, "Illegal atan2 val"); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h index 7802d047..dd26a85e 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.h @@ -94,12 +94,12 @@ public: void SetCamera(plCameraModifier1* pMod) { fCamera = pMod; } - void SetAccel (hsScalar f) { fAccel = f; } - void SetDecel (hsScalar f) { fDecel = f; } - void SetVelocity (hsScalar f) { fVelocity = f; } - void SetPOAAccel (hsScalar f) { fPOAAccel = f; } - void SetPOADecel (hsScalar f) { fPOADecel = f; } - void SetPOAVelocity (hsScalar f) { fPOAVelocity = f; } + void SetAccel (float f) { fAccel = f; } + void SetDecel (float f) { fDecel = f; } + void SetVelocity (float f) { fVelocity = f; } + void SetPOAAccel (float f) { fPOAAccel = f; } + void SetPOADecel (float f) { fPOADecel = f; } + void SetPOAVelocity (float f) { fPOAVelocity = f; } const plCameraModifier1* GetCamera() { return fCamera; } @@ -128,13 +128,13 @@ public: void SetGoal(hsPoint3 pt) { fGoal = pt; } void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; } - void SetFOVGoal(hsScalar h, double t); - void SetZoomParams(hsScalar max, hsScalar min, hsScalar rate); + void SetFOVGoal(float h, double t); + void SetZoomParams(float max, float min, float rate); - void SetXPanLimit(hsScalar x) {fXPanLimit = x;} - void SetZPanLimit(hsScalar y) {fZPanLimit = y;} - hsScalar GetXPanLimit() {return fXPanLimit;} - hsScalar GetZPanLimit() {return fZPanLimit;} + void SetXPanLimit(float x) {fXPanLimit = x;} + void SetZPanLimit(float y) {fZPanLimit = y;} + float GetXPanLimit() {return fXPanLimit;} + float GetZPanLimit() {return fZPanLimit;} void SetRail(plRailCameraMod* m) { fRail = m; } @@ -144,28 +144,28 @@ public: virtual void Push(hsBool recenter = true); virtual void Pop(); - hsScalar GetVelocity() { return fVelocity; } - hsScalar GetAccel() { return fAccel; } - hsScalar GetDecel() { return fDecel; } - hsScalar GetPOAAccel() { return fPOAAccel; } - hsScalar GetPOAVelocity() { return fPOAVelocity; } - hsScalar GetPOADecel() { return fPOADecel; } - - hsScalar GetCurrentCamSpeed() { return fCurCamSpeed; } - hsScalar GetCurrentViewSpeed() { return fCurViewSpeed; } - - void SetCurrentCamSpeed(hsScalar s) { fCurCamSpeed = s; } - void SetCurrentViewSpeed(hsScalar s) { fCurViewSpeed = s; } + float GetVelocity() { return fVelocity; } + float GetAccel() { return fAccel; } + float GetDecel() { return fDecel; } + float GetPOAAccel() { return fPOAAccel; } + float GetPOAVelocity() { return fPOAVelocity; } + float GetPOADecel() { return fPOADecel; } + + float GetCurrentCamSpeed() { return fCurCamSpeed; } + float GetCurrentViewSpeed() { return fCurViewSpeed; } + + void SetCurrentCamSpeed(float s) { fCurCamSpeed = s; } + void SetCurrentViewSpeed(float s) { fCurViewSpeed = s; } hsMatrix44 GetTargetMatrix() { return fTargetMatrix; } - static hsScalar fFallVelocity; - static hsScalar fFallAccel; - static hsScalar fFallDecel; + static float fFallVelocity; + static float fFallAccel; + static float fFallDecel; - static hsScalar fFallPOAVelocity; - static hsScalar fFallPOAAccel; - static hsScalar fFallPOADecel; + static float fFallPOAVelocity; + static float fFallPOAAccel; + static float fFallPOADecel; protected: @@ -173,48 +173,48 @@ protected: void IMoveTowardGoal(double time); void IPointTowardGoal(double time); void IAnimateFOV(double time); - void IAdjustVelocity(hsScalar adjAccelRate, - hsScalar adjDecelRate, + void IAdjustVelocity(float adjAccelRate, + float adjDecelRate, hsVector3* dir, hsVector3* vel, - hsScalar maxSpeed, - hsScalar distToGoal, + float maxSpeed, + float distToGoal, double elapsedTime); - hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime); - hsBool IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal); + float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime); + hsBool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal); plCameraModifier1* fCamera; plKey fSubjectKey; plRailCameraMod* fRail; - hsScalar fCurCamSpeed; - hsScalar fCurViewSpeed; + float fCurCamSpeed; + float fCurViewSpeed; double fLastTime; - hsScalar fVelocity; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fPOAVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; + float fVelocity; + float fAccel; + float fDecel; + float fPOAVelocity; + float fPOAAccel; + float fPOADecel; hsVector3 fPOAOffset; hsPoint3 fGoal; hsPoint3 fPOAGoal; - hsScalar fXPanLimit; - hsScalar fZPanLimit; - hsScalar fPanSpeed; - hsScalar fFOVGoal; + float fXPanLimit; + float fZPanLimit; + float fPanSpeed; + float fFOVGoal; double fFOVStartTime; double fFOVEndTime; - hsScalar fFOVAnimRate; - hsScalar fZoomRate; - hsScalar fZoomMax; - hsScalar fZoomMin; + float fFOVAnimRate; + float fZoomRate; + float fZoomMax; + float fZoomMin; hsBitVector fMoveFlags; hsBitVector fFlags; hsMatrix44 fTargetMatrix; - hsScalar fOffsetLength; - hsScalar fOffsetPct; + float fOffsetLength; + float fOffsetPct; double fFallTimer; }; @@ -226,8 +226,8 @@ protected: hsPoint3 fDesiredPosition; hsPoint3 fFacingTarget; hsBool bUseDesiredFacing; - hsScalar deltaX; - hsScalar deltaY; + float deltaX; + float deltaY; hsBool bDisregardY; // these are here to prevent hsBool bDisregardX; // the camera from jumping when the mouse cursor recenters / wraps around. hsVector3 fUp; @@ -238,7 +238,7 @@ public: plCameraBrain1_Drive(plCameraModifier1* pMod); ~plCameraBrain1_Drive(); - static void SetSensitivity(hsScalar f) { fTurnRate = f; } + static void SetSensitivity(float f) { fTurnRate = f; } CLASSNAME_REGISTER( plCameraBrain1_Drive ); GETINTERFACE_ANY( plCameraBrain1_Drive, plCameraBrain1 ); @@ -248,10 +248,10 @@ public: virtual void Push(hsBool recenter = true); virtual void Pop(); - static hsScalar fAcceleration; - static hsScalar fDeceleration; - static hsScalar fMaxVelocity; - static hsScalar fTurnRate; + static float fAcceleration; + static float fDeceleration; + static float fMaxVelocity; + static float fTurnRate; }; @@ -365,10 +365,10 @@ protected: uint32_t fCircleFlags; hsPoint3 fCenter; plSceneObject* fCenterObject; // optional, use instead of fCenter - hsScalar fRadius; - hsScalar fCurRad, fGoalRad; // Radians + float fRadius; + float fCurRad, fGoalRad; // Radians plSceneObject* fPOAObj; // in this case the subject is who we stay close to/away from - hsScalar fCirPerSec; + float fCirPerSec; hsPoint3 IGetClosestPointOnCircle(const hsPoint3* toThisPt); public: @@ -389,13 +389,13 @@ public: uint32_t GetCircleFlags() { return fCircleFlags; } hsPoint3* GetCenter() { return &fCenter; } // use GetCenterPoint hsPoint3 GetCenterPoint(); - hsScalar GetRadius() { return fRadius; } + float GetRadius() { return fRadius; } plSceneObject* GetCenterObject() { return fCenterObject; } - void SetCircumferencePerSec(hsScalar h) { fCirPerSec = h; } + void SetCircumferencePerSec(float h) { fCirPerSec = h; } void SetCircleFlags(uint32_t f) { fCircleFlags|=f; } void SetCenter(hsPoint3* ctr) { fCenter = *ctr; } // Circle lies in the plane z = ctr->z - void SetRadius(hsScalar radius) { fRadius = radius; } + void SetRadius(float radius) { fRadius = radius; } void SetFarCircleCam(hsBool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; } void SetCenterObjectKey(plKey k); void SetPOAObject(plSceneObject* pObj) { fPOAObj = pObj; } diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp index 62563795..ed1d9982 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp @@ -137,14 +137,14 @@ plSceneObject* plCameraModifier1::GetSubject() return fSubObj; } -void plCameraModifier1::SetFOVw(hsScalar f, hsBool fUpdateVCam) +void plCameraModifier1::SetFOVw(float f, hsBool fUpdateVCam) { fFOVw = f; if (plVirtualCam1::Instance() && fUpdateVCam) plVirtualCam1::SetFOV(fFOVw, fFOVh, this); } -void plCameraModifier1::SetFOVh(hsScalar f, hsBool fUpdateVCam) +void plCameraModifier1::SetFOVh(float f, hsBool fUpdateVCam) { fFOVh = f; if (plVirtualCam1::Instance() && fUpdateVCam) @@ -191,7 +191,7 @@ hsBool plCameraModifier1::MsgReceive(plMessage* msg) double time = (double)fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fAccel; double time2 = (double)pEventMsg->fEventTime; time = hsABS(time - time2); - hsScalar h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh; + float h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh; if (GetBrain()) GetBrain()->SetFOVGoal(h, time); } @@ -333,12 +333,12 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr) hsBool cutpos = stream->ReadBool(); hsBool cutpoa = stream->ReadBool(); hsBool ignore = stream->ReadBool(); - hsScalar v = stream->ReadLEScalar(); - hsScalar a = stream->ReadLEScalar(); - hsScalar d = stream->ReadLEScalar(); - hsScalar pV = stream->ReadLEScalar(); - hsScalar pA = stream->ReadLEScalar(); - hsScalar pD = stream->ReadLEScalar(); + float v = stream->ReadLEScalar(); + float a = stream->ReadLEScalar(); + float d = stream->ReadLEScalar(); + float pV = stream->ReadLEScalar(); + float pA = stream->ReadLEScalar(); + float pD = stream->ReadLEScalar(); CamTrans* camTrans = TRACKED_NEW CamTrans(key); camTrans->fAccel = a; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h index af1c9b35..267e8468 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.h @@ -75,12 +75,12 @@ struct CamTrans hsBool fCutPos; hsBool fCutPOA; hsBool fIgnore; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; - hsScalar fPOAVelocity; + float fAccel; + float fDecel; + float fVelocity; + float fPOAAccel; + float fPOADecel; + float fPOAVelocity; }; @@ -96,7 +96,7 @@ class plCameraModifier1 : public plSingleModifier protected: void Output(); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: @@ -128,10 +128,10 @@ public: void SetTargetPOA(hsPoint3 pos) { fAt = pos; } void SetSubworldPos(hsPoint3 pos) { fLastSubPos = pos; } void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; } - hsScalar GetFOVw() { return fFOVw; } - hsScalar GetFOVh() { return fFOVh; } - void SetFOVw(hsScalar f, hsBool fUpdateVCam = true); - void SetFOVh(hsScalar f, hsBool fUpdateVCam = true); + float GetFOVw() { return fFOVw; } + float GetFOVh() { return fFOVh; } + void SetFOVw(float f, hsBool fUpdateVCam = true); + void SetFOVh(float f, hsBool fUpdateVCam = true); hsBool GetInSubworld() { return fInSubLastUpdate; } void InSubworld(hsBool b) { fInSubLastUpdate = b; } virtual void Read(hsStream* stream, hsResMgr* mgr); @@ -157,8 +157,8 @@ private: plCameraBrain1* fBrain; // the 'logic' portion of the camera hsTArray fTrans; plSceneObject* fSubObj; - hsScalar fFOVw; - hsScalar fFOVh; + float fFOVw; + float fFOVh; hsTArray fMessageQueue; hsTArray fFOVInstructions; hsBool fAnimated, fStartAnimOnPush, fStopAnimOnPop, fResetAnimOnPop; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp index d8348dd0..232a6791 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.cpp @@ -52,11 +52,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKey.h" -hsScalar plInterestingModifier::fInterestRadius = 100.0f; -hsScalar plInterestingModifier::fInterestWeight = 1.0f; +float plInterestingModifier::fInterestRadius = 100.0f; +float plInterestingModifier::fInterestWeight = 1.0f; -hsBool plInterestingModifier::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plInterestingModifier::IEval(double secs, float del, uint32_t dirty) { for (int i=0; i < GetNumTargets(); i++) { diff --git a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h index 481e26a5..1d9c1a1f 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plInterestingModifier.h @@ -62,12 +62,12 @@ protected: }; uint8_t fType; - hsScalar fView; + float fView; - static hsScalar fInterestRadius; - static hsScalar fInterestWeight; + static float fInterestRadius; + static float fInterestWeight; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plInterestingModifier(){ fType = kTypeInteresting;} @@ -78,11 +78,11 @@ public: CLASSNAME_REGISTER( plInterestingModifier ); GETINTERFACE_ANY( plInterestingModifier, plSingleModifier ); - hsScalar GetInterestWeight() { return fInterestWeight; } - hsScalar GetInterestRadius() { return fInterestRadius; } + float GetInterestWeight() { return fInterestWeight; } + float GetInterestRadius() { return fInterestRadius; } - void SetInterestWeight(hsScalar _InterestRadius) { fInterestWeight =_InterestRadius; } - void SetInterestRadius(hsScalar _InterestWeight) { fInterestRadius =_InterestWeight; } + void SetInterestWeight(float _InterestRadius) { fInterestWeight =_InterestRadius; } + void SetInterestRadius(float _InterestWeight) { fInterestRadius =_InterestWeight; } virtual void AddTarget(plSceneObject* so); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp index 253223a0..6721ac36 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp @@ -86,21 +86,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsConfig.h" #include "hsQuat.h" -hsScalar plVirtualCam1::fFOVw = 45.0f; -hsScalar plVirtualCam1::fFOVh = 33.75f; -hsScalar plVirtualCam1::fHither = 0.3f; -hsScalar plVirtualCam1::fYon = 500.0f; +float plVirtualCam1::fFOVw = 45.0f; +float plVirtualCam1::fFOVh = 33.75f; +float plVirtualCam1::fHither = 0.3f; +float plVirtualCam1::fYon = 500.0f; hsBool plVirtualCam1::printFOV = false; hsBool plVirtualCam1::fUseAccelOverride = 1; hsBool plVirtualCam1::freeze = 0; -//hsScalar plVirtualCam1::fAccel = 5.0f; -//hsScalar plVirtualCam1::fDecel = 5.0f; -//hsScalar plVirtualCam1::fVel = 10.0f; -hsScalar plVirtualCam1::fAccel = 50.0f; -hsScalar plVirtualCam1::fDecel = 50.0f; -hsScalar plVirtualCam1::fVel = 100.0f; -hsScalar plVirtualCam1::fPanResponseTime = 3.0f; -hsScalar plVirtualCam1::fFallTimerDelay = 0.25f; +//float plVirtualCam1::fAccel = 5.0f; +//float plVirtualCam1::fDecel = 5.0f; +//float plVirtualCam1::fVel = 10.0f; +float plVirtualCam1::fAccel = 50.0f; +float plVirtualCam1::fDecel = 50.0f; +float plVirtualCam1::fVel = 100.0f; +float plVirtualCam1::fPanResponseTime = 3.0f; +float plVirtualCam1::fFallTimerDelay = 0.25f; hsBool plVirtualCam1::alwaysCutForColin = false; hsBool plVirtualCam1::WalkPan3rdPerson = false; hsBool plVirtualCam1::StayInFirstPersonForever = false; @@ -287,7 +287,7 @@ void plVirtualCam1::SetOffset(float x, float y, float z) } // static function -void plVirtualCam1::SetFOV(hsScalar x, hsScalar y) +void plVirtualCam1::SetFOV(float x, float y) { float fovW = y * fAspectRatio; @@ -307,12 +307,12 @@ if (printFOV) } // static function -void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam) +void plVirtualCam1::SetFOV(float x, float y, plCameraModifier1* pCam) { if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam) return; - hsScalar diff = hsABS(fFOVw - x); + float diff = hsABS(fFOVw - x); if (diff > 10.0f) { #ifdef STATUS_LOG @@ -339,7 +339,7 @@ void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam) // static function -void plVirtualCam1::SetDepth(hsScalar h, hsScalar y) +void plVirtualCam1::SetDepth(float h, float y) { return; fHither = h; @@ -684,17 +684,17 @@ void plVirtualCam1::AdjustForInput() UnPanIfNeeded(); - hsScalar panSpeed = 0.5f; + float panSpeed = 0.5f; double secs = hsTimer::GetDelSysSeconds(); if (HasMovementFlag(B_CAMERA_PAN_UP)) - fY -= (hsScalar)(panSpeed * secs); + fY -= (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_DOWN)) - fY += (hsScalar)(panSpeed * secs); + fY += (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_LEFT)) - fX -= (hsScalar)(panSpeed * secs); + fX -= (float)(panSpeed * secs); if (HasMovementFlag(B_CAMERA_PAN_RIGHT)) - fX += (hsScalar)(panSpeed * secs); + fX += (float)(panSpeed * secs); } if ((fY == 0.5f && fX == 0.5f) && fFirstPersonOverride == nil) @@ -725,17 +725,17 @@ void plVirtualCam1::AdjustForInput() // scale maximum angle by % mouse input - hsScalar scaledX; + float scaledX; if (fFirstPersonOverride) scaledX = 3.14159; else - scaledX = (hsScalar)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f))); + scaledX = (float)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f))); - hsScalar scaledZ; + float scaledZ; if (fFirstPersonOverride) - scaledZ = (hsScalar)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f))); + scaledZ = (float)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f))); else - scaledZ = (hsScalar)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f))); + scaledZ = (float)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f))); hsMatrix44 mX; hsMatrix44 mZ; @@ -1068,8 +1068,8 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) { if (!HasFlags(kFalling)) { - hsScalar dX = pMouseMsg->GetDX(); - hsScalar dY = pMouseMsg->GetDY(); + float dX = pMouseMsg->GetDX(); + float dY = pMouseMsg->GetDY(); if (plMouseDevice::GetInverted()) { dX *= -1.f; @@ -1906,7 +1906,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) curVec.fZ = transVec.fZ = 0; transVec.Normalize(); curVec.Normalize(); - hsScalar dot = curVec * transVec; + float dot = curVec * transVec; if (dot <= 0.5f || transVec.MagnitudeSquared() != 0.0f) { pBrain->SetPOAAccel(100); @@ -1973,7 +1973,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition) pBrain->SetCamera(fTransitionCamera); // deal with FOV - - hsScalar diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh()); + float diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh()); if ( diffH ) { double time = 0; @@ -2029,7 +2029,7 @@ void plVirtualCam1::RunTransition() plCameraBrain1_Avatar* pAvBr = plCameraBrain1_Avatar::ConvertNoRef(pBrain); if (pAvBr) { - hsScalar off = pAvBr->GetOffset().MagnitudeSquared(); + float off = pAvBr->GetOffset().MagnitudeSquared(); hsVector3 dist(pToCam->GetTargetPos() - fTransitionCamera->GetTargetPos()); if (dist.MagnitudeSquared() > off) fTransitionCamera->GetBrain()->SetFlags(plCameraBrain1::kPanicVelocity); diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h index b615b902..a04ee30b 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h @@ -120,13 +120,13 @@ public: void Init(); virtual hsBool MsgReceive(plMessage* msg); - static void SetFOV(hsScalar w, hsScalar h); - static void SetFOV(hsScalar w, hsScalar h, plCameraModifier1* pCam); - static void SetDepth(hsScalar h, hsScalar y); - static hsScalar GetFOVw() { return fFOVw; } - static hsScalar GetFOVh() { return fFOVh; } - static hsScalar GetHither() { return fHither; } - static hsScalar GetYon() { return fYon; } + static void SetFOV(float w, float h); + static void SetFOV(float w, float h, plCameraModifier1* pCam); + static void SetDepth(float h, float y); + static float GetFOVw() { return fFOVw; } + static float GetFOVh() { return fFOVh; } + static float GetHither() { return fHither; } + static float GetYon() { return fYon; } static void SetOffset(float x, float y, float z); static void SetAspectRatio(float aspect) { fAspectRatio = aspect; } static float GetAspectRatio() { return fAspectRatio; } @@ -174,8 +174,8 @@ public: void StartUnPan(); // these are for console access static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever; - static hsScalar fDecel, fAccel, fVel; - static hsScalar fFallTimerDelay; + static float fDecel, fAccel, fVel; + static float fFallTimerDelay; private: @@ -215,19 +215,19 @@ private: hsBitVector fFlags; hsTArray fCamerasLoaded; hsBitVector fMoveFlags; - hsScalar fX; - hsScalar fY; - hsScalar fXPanLimit; - hsScalar fZPanLimit; - hsScalar fXPanLimitGoal; - hsScalar fZPanLimitGoal; - hsScalar fXUnPanRate; - hsScalar fZUnPanRate; - hsScalar fXPanInterpRate; - hsScalar fZPanInterpRate; + float fX; + float fY; + float fXPanLimit; + float fZPanLimit; + float fXPanLimitGoal; + float fZPanLimitGoal; + float fXUnPanRate; + float fZUnPanRate; + float fXPanInterpRate; + float fZPanInterpRate; double fUnPanEndTime; double fInterpPanLimitTime; - hsScalar fRetainedFY; + float fRetainedFY; // built-in cameras plCameraModifier1* fDriveCamera; // for driving around @@ -237,11 +237,11 @@ private: plCameraModifier1* fPrevCam; // the last camera we were displaying plCameraModifier1* fThirdPersonCam; // built in third person cam for ccr's when they jump about - static hsScalar fFOVh, fFOVw; - static hsScalar fHither, fYon; + static float fFOVh, fFOVw; + static float fHither, fYon; static plVirtualCam1* fInstance; static hsBool printFOV; - static hsScalar fPanResponseTime; + static float fPanResponseTime; static float fAspectRatio; hsBool fForceCutOnce; diff --git a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp index ea439bd3..021194d1 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerMgr.cpp @@ -168,7 +168,7 @@ void pfMarkerMgr::AddMarker(double x, double y, double z, uint32_t id, bool just DEL(fMarkers[id]); } - hsPoint3 pos((hsScalar)x, (hsScalar)y, (hsScalar)z); + hsPoint3 pos((float)x, (float)y, (float)z); fMarkers[id] = TRACKED_NEW pfMarkerInfo(pos, justCreated); fMarkers[id]->Spawn(pfMarkerInfo::kMarkerOpen); } diff --git a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp index e6ebba01..39af0854 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.cpp @@ -77,10 +77,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // //#include "../plHavok1/plHKPhysical.h" // -//hsScalar plPlayerModifier::fTurnRate = 1.0f; -//hsScalar plPlayerModifier::fAcceleration = 80.0f; -//hsScalar plPlayerModifier::fDeceleration = 80.0f; -//hsScalar plPlayerModifier::fMaxVelocity = 200.0f; +//float plPlayerModifier::fTurnRate = 1.0f; +//float plPlayerModifier::fAcceleration = 80.0f; +//float plPlayerModifier::fDeceleration = 80.0f; +//float plPlayerModifier::fMaxVelocity = 200.0f; // //plPlayerModifier::plPlayerModifier() : //bUseDesiredFacing(false), @@ -277,7 +277,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //hsPoint3 forceRight(-200,0,0); //hsPoint3 forceUp(0,0,15); // -//hsBool plPlayerModifier::IEval(double secs, hsScalar del, uint32_t dirty) +//hsBool plPlayerModifier::IEval(double secs, float del, uint32_t dirty) //{ // // setup for local player if necessary // if (HasFlag(kNeedsLocalSetup)) @@ -371,8 +371,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // return true; // // // update our desired position: -//// hsScalar eTime = secs - fLastTime; -// hsScalar eTime = hsTimer::GetDelSysSeconds(); +//// float eTime = secs - fLastTime; +// float eTime = hsTimer::GetDelSysSeconds(); // // hsPoint3 newLinearForce(0,0,0); // @@ -385,8 +385,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // hsVector3 view, up, right; // targetMatrix.GetAxis(&view, &up, &right); // -// hsScalar speed = fMaxVelocity; -// hsScalar turn = fTurnRate; +// float speed = fMaxVelocity; +// float turn = fTurnRate; // // if (HasMovementFlag(B_CONTROL_MODIFIER_FAST)) // { @@ -437,7 +437,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // hsPoint3 newPos; // // hsVector3 dir(fDesiredPosition - curPos); -// hsScalar distToGoal=dir.Magnitude(); +// float distToGoal=dir.Magnitude(); // // if (dir.MagnitudeSquared() > 0.0f) // dir.Normalize(); @@ -447,7 +447,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // IAdjustVelocity(fAcceleration, fDeceleration, &dir, &vel, fMaxVelocity, distToGoal, eTime); // fCurSpeed = vel.Magnitude(); // -// hsScalar distMoved = IClampVelocity(&vel, fMaxVelocity, eTime); +// float distMoved = IClampVelocity(&vel, fMaxVelocity, eTime); // // // compute final pos // if (distMoved > distToGoal) @@ -471,8 +471,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // // compute degrees needed to turn left/right // hsVector3 cross = fPlayerViewGoal % view; -// hsScalar dot = fPlayerViewGoal * view; -// hsScalar rad = hsACosine(dot); +// float dot = fPlayerViewGoal * view; +// float rad = acos(dot); // fRotationScalar = 1.0f; // // if (cross.fZ<0) @@ -491,7 +491,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // } // } // -// hsScalar angle = 0; +// float angle = 0; // // if ( HasMovementFlag( B_CONTROL_ROTATE_RIGHT ) ) // { @@ -561,15 +561,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// //// vector version. dir vector should be normalized //// -//void plPlayerModifier::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate, -// hsVector3* dir, hsVector3* vel, hsScalar maxSpeed, -// hsScalar distToGoal, double elapsedTime) +//void plPlayerModifier::IAdjustVelocity(float adjAccelRate, float adjDecelRate, +// hsVector3* dir, hsVector3* vel, float maxSpeed, +// float distToGoal, double elapsedTime) //{ -// hsScalar speed = vel->Magnitude(); // save current speed +// float speed = vel->Magnitude(); // save current speed // *vel = *dir * speed; // change vel to correct dir // // // compute accel/decel -// hsScalar finalAccelRate; +// float finalAccelRate; // if (IShouldDecelerate(adjDecelRate, speed, distToGoal)) // { // finalAccelRate = -adjDecelRate; @@ -594,13 +594,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // } //} // -//hsScalar plPlayerModifier::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime) +//float plPlayerModifier::IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime) //{ // *vel = *vel * elapsedTime; // maxSpeed *= elapsedTime; // // // clamp speed (clamp if going negative?) -// hsScalar distMoved = vel->Magnitude(); +// float distMoved = vel->Magnitude(); // if (distMoved > maxSpeed) // { // vel->Normalize(); @@ -610,16 +610,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // return distMoved; //} // -//hsBool32 plPlayerModifier::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal) +//hsBool32 plPlayerModifier::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal) //{ // if (decelSpeed == 0) // // no deceleration // return false; // // // compute distance required to stop, given decel speed (in units/sec sq) -// hsScalar stopTime = curSpeed / decelSpeed; -// hsScalar avgSpeed = curSpeed * .5f; -// hsScalar stopDist = avgSpeed * stopTime; +// float stopTime = curSpeed / decelSpeed; +// float avgSpeed = curSpeed * .5f; +// float stopDist = avgSpeed * stopTime; // // return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed? //} diff --git a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h index 8981e6cb..a86e2e49 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h +++ b/Sources/Plasma/FeatureLib/pfCharacter/plPlayerModifier.h @@ -68,15 +68,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // struct spawnPt // { // hsPoint3 pt; -// hsScalar dist; +// float dist; // }; // -// static hsScalar fTurnRate; +// static float fTurnRate; // -// static hsScalar fAcceleration; -// static hsScalar fDeceleration; -// static hsScalar fMaxVelocity; -// hsScalar fCurSpeed; +// static float fAcceleration; +// static float fDeceleration; +// static float fMaxVelocity; +// float fCurSpeed; // // // double fLastTime; @@ -88,19 +88,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // bool bUseDesiredMatrix; // bool bIgnoreDesiredMatrix; // -// hsScalar fRotationScalar; +// float fRotationScalar; // hsTArray fSpawnPoints; // -// void IAdjustVelocity(hsScalar adjAccelRate, -// hsScalar adjDecelRate, +// void IAdjustVelocity(float adjAccelRate, +// float adjDecelRate, // hsVector3* dir, // hsVector3* vel, -// hsScalar maxSpeed, -// hsScalar distToGoal, +// float maxSpeed, +// float distToGoal, // double elapsedTime); // -// hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime); -// hsBool32 IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal); +// float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime); +// hsBool32 IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal); // // hsBool HasMovementFlag(int f) const { return fMoveFlags.IsBitSet(f); } // void SetMovementFlag(int f) { fMoveFlags.SetBit(f); } @@ -129,7 +129,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // virtual void RemoveTarget(plSceneObject* so); // // hsBool HandleControlInput(plControlEventMsg* pMsg); -// virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); +// virtual hsBool IEval(double secs, float del, uint32_t dirty); // // void SetMoving(hsBool b); // hsBool IsMoving() { return bMoving; } diff --git a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp index f2113109..5420221b 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp @@ -67,7 +67,7 @@ hsBool plAnimationEventConditionalObject::MsgReceive(plMessage* msg) } -void plAnimationEventConditionalObject::SetEvent(const CallbackEvent b, hsScalar time) +void plAnimationEventConditionalObject::SetEvent(const CallbackEvent b, float time) { plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg; pMsg->AddReceiver(fTarget); diff --git a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h index e55256a2..a8be7ced 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h +++ b/Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.h @@ -71,7 +71,7 @@ public: void Evaluate(){;} void Reset() { SetSatisfied(false); } - void SetEvent(const CallbackEvent b, hsScalar time = 0.0f); + void SetEvent(const CallbackEvent b, float time = 0.0f); }; diff --git a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp index 2c11b1a5..5f98a9c7 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp +++ b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp @@ -96,7 +96,7 @@ hsBool plFacingConditionalObject::Verify(plMessage* msg) ourView = v; ourView.Normalize(); } - hsScalar dot = playerView * ourView; + float dot = playerView * ourView; if (dot >= fTolerance) { fLogicMod->GetNotify()->AddFacingEvent( pActivateMsg->fHitterObj, fLogicMod->GetTarget()->GetKey(), dot, true); @@ -129,7 +129,7 @@ hsBool plFacingConditionalObject::Verify(plMessage* msg) ourView.fZ = playerView.fZ; ourView.Normalize(); } - hsScalar dot = playerView * ourView; + float dot = playerView * ourView; if (dot >= fTolerance) { return true; diff --git a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h index 30a7a697..97380e6c 100644 --- a/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h +++ b/Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.h @@ -50,7 +50,7 @@ class plSceneObject; class plFacingConditionalObject : public plConditionalObject { protected: - hsScalar fTolerance; + float fTolerance; hsBool fDirectional; public: @@ -63,7 +63,7 @@ public: hsBool MsgReceive(plMessage* msg); - void SetTolerance(hsScalar d) { fTolerance = d; } + void SetTolerance(float d) { fTolerance = d; } void SetDirectional(hsBool d) { fDirectional = d; } virtual hsBool Verify(plMessage* msg); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp index 618a0f02..33099156 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp @@ -502,7 +502,7 @@ PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpo plKey targetKey = seekTarget->GetKey(); plKey avKey = avatar->GetKey(); - hsScalar unused = 0.0f; + float unused = 0.0f; plAvSeekMsg *msg = TRACKED_NEW plAvSeekMsg(nil, avKey, targetKey, unused, false); plgDispatch::MsgSend(msg); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index fe11b968..90c884a0 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -1237,10 +1237,10 @@ PF_CONSOLE_CMD( Graphics_Shadow, "...", "Max shadowmap blur size." ) { - extern hsScalar blurScale; + extern float blurScale; if( numParams > 0 ) { - blurScale = (hsScalar)atof( params[ 0 ] ); + blurScale = (float)atof( params[ 0 ] ); } else { @@ -1317,7 +1317,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma, "float g, ...", "Set gamma value (g or { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar g = params[0]; + float g = params[0]; if( numParams == 1 ) { @@ -1329,9 +1329,9 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma, "float g, ...", "Set gamma value (g or } else { - hsScalar eR = g; - hsScalar eG = g; - hsScalar eB = g; + float eR = g; + float eG = g; + float eB = g; if( numParams > 2 ) eB = params[2]; @@ -1352,21 +1352,21 @@ PF_CONSOLE_CMD( Graphics_Renderer, Gamma2, "float g", "Set gamma value (alternat hsTArray ramp; ramp.SetCount(256); - hsScalar g = params[0]; + float g = params[0]; int i; for( i = 0; i < 256; i++ ) { - hsScalar t = hsScalar(i) / 255.f; - hsScalar sinT = sin(t * hsScalarPI / 2.f); + float t = float(i) / 255.f; + float sinT = sin(t * M_PI / 2.f); - hsScalar remap = t + (sinT - t) * g; + float remap = t + (sinT - t) * g; if( remap < 0 ) remap = 0; else if( remap > 1.f ) remap = 1.f; - ramp[i] = uint16_t(remap * hsScalar(uint16_t(-1)) + 0.5f); + ramp[i] = uint16_t(remap * float(uint16_t(-1)) + 0.5f); } pfConsole::GetPipeline()->SetGamma(ramp.AcquireArray()); @@ -1405,7 +1405,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, SetYon, "float yon, ...", "Sets the view yon" { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar hither, yon; + float hither, yon; pfConsole::GetPipeline()->GetDepth( hither, yon ); @@ -1424,7 +1424,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, TweakZBiasScale, "float deltaScale", "Adjusts { hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" ); - hsScalar scale; + float scale; scale = pfConsole::GetPipeline()->GetZBiasScale(); scale += (float)params[ 0 ]; @@ -2862,7 +2862,7 @@ PF_CONSOLE_CMD( Camera, AvatarVisible1stPerson, "bool b", "turn avatar visibilit PF_CONSOLE_CMD( Camera, FallTimerDelay, "float b", "fall timer delay") { - hsScalar f = params[0]; + float f = params[0]; plVirtualCam1::fFallTimerDelay = f; } @@ -3380,7 +3380,7 @@ PF_CONSOLE_CMD( Audio, SetAllChannelVolumes, "float soundFX, float music, float for( i = 0; i < 5; i++ ) { - hsScalar vol = (hsScalar)(float)params[ i ]; + float vol = (float)(float)params[ i ]; if( vol > 1.f ) vol = 1.f; else if( vol < 0.f ) @@ -3414,7 +3414,7 @@ Valid channels are: SoundFX, BgndMusic, Voice, GUI, NPCVoice and Ambience.") return; } - hsScalar vol = (hsScalar)(float)params[ 1 ]; + float vol = (float)(float)params[ 1 ]; if( vol > 1.f ) vol = 1.f; else if( vol < 0.f ) @@ -3438,7 +3438,7 @@ Valid channels are: SoundFX, BgndMusic, Voice, GUI, NPCVoice and Ambience.") PF_CONSOLE_CMD( Audio, Set2D3DBias, "float bias", "Sets the 2D/3D bias when not using hardware acceleration.") { - hsScalar bias = (hsScalar)(float)params[ 0 ]; + float bias = (float)(float)params[ 0 ]; plgAudioSys::Set2D3DBias( bias ); } @@ -4735,8 +4735,8 @@ PF_CONSOLE_CMD( Access, #include "plMessage/plBulletMsg.h" plSceneObject* gunObj = nil; -hsScalar gunRadius = 1.f; -hsScalar gunRange = 5000.f; +float gunRadius = 1.f; +float gunRange = 5000.f; PF_CONSOLE_CMD( Access, Gun, @@ -4778,9 +4778,9 @@ PF_CONSOLE_CMD( Access, dir.Normalize(); hsPoint3 pos = l2w.GetTranslate(); - hsScalar radius = gunRadius; + float radius = gunRadius; - hsScalar range = gunRange; + float range = gunRange; plBulletMsg* bull = TRACKED_NEW plBulletMsg(nil, nil, nil); bull->FireShot(pos, dir, radius, range); @@ -4807,9 +4807,9 @@ PF_CONSOLE_CMD( Access, dir.Normalize(); hsPoint3 pos = l2w.GetTranslate(); - hsScalar radius = gunRadius; + float radius = gunRadius; - hsScalar range = gunRange; + float range = gunRange; plBulletMsg* bull = TRACKED_NEW plBulletMsg(nil, nil, nil); bull->FireShot(pos, dir, radius, range); @@ -4898,11 +4898,11 @@ namespace plWaveCmd { typedef void PrintFunk(const char* str); -static inline hsScalar FracToPercent(hsScalar f) { return (hsScalar)(1.e2 * f); } -static inline hsScalar PercentToFrac(hsScalar f) { return (hsScalar)(1.e-2 * f); } +static inline float FracToPercent(float f) { return (float)(1.e2 * f); } +static inline float PercentToFrac(float f) { return (float)(1.e-2 * f); } -static inline hsScalar RadToDeg(hsScalar r) { return r * 180.f / hsScalarPI; } -static inline hsScalar DegToRad(hsScalar d) { return d * hsScalarPI / 180.f; } +static inline float RadToDeg(float r) { return r * 180.f / M_PI; } +static inline float DegToRad(float d) { return d * M_PI / 180.f; } static void IDisplayWaveVal(PrintFunk PrintString, plWaveSet7* wave, plWaveCmd::Cmd cmd) { @@ -5062,7 +5062,7 @@ static plWaveSet7* ICheckWaveParams(PrintFunk PrintString, const char* name, int return waveSet; } -static hsScalar LimitVal(hsScalar val, hsScalar lo, hsScalar hi, PrintFunk PrintString) +static float LimitVal(float val, float lo, float hi, PrintFunk PrintString) { if( val < lo ) { @@ -5091,7 +5091,7 @@ static bool ISendWaveCmd1f(PrintFunk PrintString, pfConsoleCmdParam* params, int float val = params[1]; - hsScalar secs = ( numParams > 2 ) ? params[2] : 0.f; + float secs = ( numParams > 2 ) ? params[2] : 0.f; switch( cmd ) { @@ -5168,7 +5168,7 @@ static bool ISendWaveCmd2f(PrintFunk PrintString, pfConsoleCmdParam* params, int using namespace plWaveCmd; - hsScalar secs = ( numParams > 3 ) ? params[3] : 0.f; + float secs = ( numParams > 3 ) ? params[3] : 0.f; hsVector3 vec; plFixedWaterState7 state = wave->State(); @@ -5217,7 +5217,7 @@ static bool ISendWaveCmd3f(PrintFunk PrintString, pfConsoleCmdParam* params, int hsVector3 vec(x, y, z); hsPoint3 pos(x, y, z); - hsScalar secs = ( numParams > 4 ) ? params[4] : 0.f; + float secs = ( numParams > 4 ) ? params[4] : 0.f; switch( cmd ) { @@ -5253,7 +5253,7 @@ static bool ISendWaveCmd4c(PrintFunk PrintString, pfConsoleCmdParam* params, int float g = params[2]; float b = params[3]; - hsScalar secs = ( numParams > 4 ) ? params[4] : 0.f; + float secs = ( numParams > 4 ) ? params[4] : 0.f; hsColorRGBA col; col.Set(r / 255.f, g / 255.f, b / 255.f, 1.f); @@ -6034,7 +6034,7 @@ PF_CONSOLE_CMD( Mouse, UnInvert, nil, "un-invert the mouse") PF_CONSOLE_CMD( Mouse, SetDeadZone, "float zone", "Sets the dead zone for the mouse - range is from 0.0 to 1.0") { - hsScalar f = params[0]; + float f = params[0]; } PF_CONSOLE_CMD( Mouse, Enable, nil, "Enable mouse input") @@ -6238,7 +6238,7 @@ PF_CONSOLE_CMD( Age, SetSDLBool, "string varName, bool value, int index", "Set t PF_CONSOLE_GROUP( ParticleSystem ) // Defines a main command group -void UpdateParticleParam(char *objName, int32_t paramID, hsScalar value, void (*PrintString)(const char *)) +void UpdateParticleParam(char *objName, int32_t paramID, float value, void (*PrintString)(const char *)) { char str[256]; plKey key = FindSceneObjectByName(objName, nil, str); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp index 7332fbcd..f09be4f3 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp @@ -119,8 +119,8 @@ void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, in // it's an include list and we didn't find it return; - static hsScalar lastTime=0; - hsScalar curTime = (hsScalar)hsTimer::GetSysSeconds(); + static float lastTime=0; + float curTime = (float)hsTimer::GetSysSeconds(); if (lastTime!=curTime) { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp index 7b845719..d10ace2c 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp @@ -169,7 +169,7 @@ pfGUIButtonMod::~pfGUIButtonMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIButtonMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIButtonMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h index 6ed86cca..faed9a1e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h @@ -76,7 +76,7 @@ class pfGUIButtonMod : public pfGUIControlMod int32_t fNotifyType; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp index 529185dc..f7613f27 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp @@ -79,7 +79,7 @@ pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUICheckBoxCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUICheckBoxCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h index 022f6f01..c4c3e38e 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h @@ -65,7 +65,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod hsBool fChecked; hsBool fPlaySound; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp index d4741947..f4433fc1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.cpp @@ -72,7 +72,7 @@ pfGUIClickMapCtrl::~pfGUIClickMapCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIClickMapCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIClickMapCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h index 3a71630a..d18d0dcb 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIClickMapCtrl.h @@ -60,7 +60,7 @@ class pfGUIClickMapCtrl : public pfGUIControlMod hsBool fTracking; int32_t fCustomCursor; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp index 590ae944..b4754b86 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp @@ -180,7 +180,7 @@ pfGUIControlMod::~pfGUIControlMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIControlMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIControlMod::IEval( double secs, float del, uint32_t dirty ) { // UpdateBounds(); return false; @@ -205,13 +205,13 @@ void pfGUIControlMod::SetTransform( const hsMatrix44 &l2w, const hsMatrix44 & //// GetVectorAngle ////////////////////////////////////////////////////////// -static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB ) +static float GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, const hsPoint3 &pointB ) { hsVector3 vectorA( &pointA, &basePt ), vectorB( &pointB, &basePt ); - hsScalar dot = vectorA * vectorB; + float dot = vectorA * vectorB; hsVector3 cross = vectorA % vectorB; - hsScalar crossLen = cross.fZ; + float crossLen = cross.fZ; return atan2( crossLen, dot ); } @@ -225,7 +225,7 @@ static hsScalar GetVectorAngle( const hsPoint3 &basePt, const hsPoint3 &pointA, static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) { int i, j, pointA, pointB, pointC; - hsScalar *angles; + float *angles; if( numPoints < 3 ) return false; @@ -246,7 +246,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) // Step 2: Sort all the in points by the angle to the X axis (vector <1,0>). // Step A: Calculate all the angles - angles = TRACKED_NEW hsScalar[ numPoints ]; + angles = TRACKED_NEW float[ numPoints ]; hsPoint3 xAxisPoint( avgPoint.fX + 1, avgPoint.fY, avgPoint.fZ ); for( i = 0; i < numPoints; i++ ) angles[ i ] = GetVectorAngle( avgPoint, inPoints[ i ], xAxisPoint ); @@ -258,7 +258,7 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) { if( angles[ j ] < angles[ i ] ) { - hsScalar tempAngle = angles[ j ]; + float tempAngle = angles[ j ]; angles[ j ] = angles[ i ]; angles[ i ] = tempAngle; @@ -283,12 +283,12 @@ static hsBool CreateConvexHull( hsPoint3 *inPoints, int &numPoints ) pointB += numPoints; // For points A, B, and C, find the interior angle between them - hsScalar angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] ); + float angle = GetVectorAngle( inPoints[ pointB ], inPoints[ pointA ], inPoints[ pointC ] ); // If the angle is < 180, then it's a good angle and we can advance all our points by 1... // Note: we have a tolerance so that we don't get points that form edges that are pretty darned close... - const hsScalar tolerance = hsScalarPI / 90.f; - if( angle > tolerance && angle < hsScalarPI - tolerance ) + const float tolerance = M_PI / 90.f; + if( angle > tolerance && angle < M_PI - tolerance ) { pointA++; pointB++; @@ -526,7 +526,7 @@ void pfGUIControlMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force // Given the x/y coordinates in 0..1 space, recalcs the sceneObject position // and moves the object to match, retaining the stored fCenterZ coordinate -void pfGUIControlMod::SetObjectCenter( hsScalar x, hsScalar y ) +void pfGUIControlMod::SetObjectCenter( float x, float y ) { hsMatrix44 xformMatrix, l2p, p2l; hsPoint3 center, corners[ 8 ]; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h index 0a8c0c7c..2a7f257d 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.h @@ -119,7 +119,7 @@ class pfGUIControlMod : public plSingleModifier pfGUIDialogMod *fDialog; hsBounds3 fBounds, fInitialBounds; // Z component is 0-1 - hsScalar fScreenMinZ; // Closest Z coordinate in screen space + float fScreenMinZ; // Closest Z coordinate in screen space hsPoint3 fScreenCenter; hsBool fBoundsValid, fCenterValid; hsMatrix44 fXformMatrix; // Only used for doing drag work, etc. @@ -144,7 +144,7 @@ class pfGUIControlMod : public plSingleModifier virtual void IPostSetUpDynTextMap( void ) {} virtual void IGrowDTMDimsToDesiredSize( uint16_t &width, uint16_t &height ) { } - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() void ISetDialog( pfGUIDialogMod *mod ) { fDialog = mod; } void IScreenToLocalPt( hsPoint3 &pt ); @@ -190,9 +190,9 @@ class pfGUIControlMod : public plSingleModifier virtual void Refresh( void ); virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - void SetObjectCenter( hsScalar x, hsScalar y ); + void SetObjectCenter( float x, float y ); virtual hsPoint3 GetObjectCenter() { return fScreenCenter; } - hsScalar GetScreenMinZ( void ) { return fScreenMinZ; } + float GetScreenMinZ( void ) { return fScreenMinZ; } void CalcInitialBounds( void ); const hsBounds3 &GetBounds( void ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp index 198c2835..269210bf 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp @@ -466,8 +466,8 @@ pfGUIDialogMod *pfGUICtrlGenerator::IGenerateDialog( const char *name, float sc fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); // Create the sceneNode to go with it node = TRACKED_NEW plSceneNode; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp index 4a6cc5c2..8c727338 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp @@ -117,7 +117,7 @@ pfGUIDialogMod::~pfGUIDialogMod() // Sometimes it just sucks not having access to the pipeline at just the // right time. -void pfGUIDialogMod::ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt ) +void pfGUIDialogMod::ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt ) { plViewTransform view = fRenderMod->GetViewTransform(); view.SetScreenSize( 1, 1 ); @@ -141,7 +141,7 @@ hsPoint3 pfGUIDialogMod::WorldToScreenPoint( const hsPoint3 &inPt ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDialogMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIDialogMod::IEval( double secs, float del, uint32_t dirty ) { return false; } @@ -364,7 +364,7 @@ plKey pfGUIDialogMod::GetSceneNodeKey( void ) // Really. We go through and make sure every control marked as interesting // still has the mouse inside it and vice versa. -void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, uint8_t modifiers, hsBool modalPreset ) +void pfGUIDialogMod::UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset ) { int i; hsPoint3 mousePoint; @@ -405,14 +405,14 @@ void pfGUIDialogMod::UpdateInterestingThings( hsScalar mouseX, hsScalar mouse #include "plPipeline/plDebugText.h" #endif -hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, +hsBool pfGUIDialogMod::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ) { hsPoint3 mousePoint; uint32_t i; pfGUIControlMod *oldInterestingCtrl = nil; - hsScalar smallestZ; + float smallestZ; #ifdef HS_DEBUGGING // Debugging bounds rects static bool showBounds = false; @@ -787,7 +787,7 @@ void pfGUIDialogMod::EnterDragMode( pfGUIControlMod *source ) void pfGUIDialogMod::IHandleDrag( hsPoint3 &mousePoint, pfGameGUIMgr::EventType event, uint8_t modifiers ) { int i; - hsScalar smallestZ; + float smallestZ; // First, see if our target control has changed diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h index 72a9a8c8..6fcf67ee 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.h @@ -91,7 +91,7 @@ class pfGUIDialogMod : public plSingleModifier plKey fSceneNodeKey; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, uint8_t modifiers ); @@ -130,13 +130,13 @@ class pfGUIDialogMod : public plSingleModifier const char *GetName( void ) { return fName; } - void ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt ); + void ScreenToWorldPoint( float x, float y, float z, hsPoint3 &outPt ); hsPoint3 WorldToScreenPoint( const hsPoint3 &inPt ); - virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, uint8_t modifiers ); + virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ); hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, uint8_t modifiers ); hsBool HandleKeyPress( wchar_t key, uint8_t modifiers ); - void UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, uint8_t modifiers, hsBool modalPreset ); + void UpdateInterestingThings( float mouseX, float mouseY, uint8_t modifiers, hsBool modalPreset ); void SetControlOfInterest( pfGUIControlMod *c ); pfGUIControlMod *GetControlOfInterest( void ) const { return fControlOfInterest; } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp index 829f569e..0366426c 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.cpp @@ -78,7 +78,7 @@ pfGUIDragBarCtrl::~pfGUIDragBarCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDragBarCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIDragBarCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h index eecb66c7..31df6fb2 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDragBarCtrl.h @@ -60,7 +60,7 @@ class pfGUIDragBarCtrl : public pfGUIControlMod hsBool fDragging; hsBool fAnchored; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp index ee08e426..3ded1b09 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.cpp @@ -72,7 +72,7 @@ pfGUIDraggableMod::~pfGUIDraggableMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDraggableMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIDraggableMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h index 1d2517e2..d113db1b 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDraggableMod.h @@ -61,7 +61,7 @@ class pfGUIDraggableMod : public pfGUIControlMod hsBool fDragging; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp index b1e9096a..9eee04f1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp @@ -72,7 +72,7 @@ pfGUIDynDisplayCtrl::~pfGUIDynDisplayCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIDynDisplayCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIDynDisplayCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h index ccb60981..931875c1 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.h @@ -79,7 +79,7 @@ class pfGUIDynDisplayCtrl : public pfGUIControlMod hsTArray fMaterials; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() public: diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp index fc426e55..7212a48b 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp @@ -86,7 +86,7 @@ pfGUIEditBoxMod::~pfGUIEditBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIEditBoxMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIEditBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h index 17c60da1..d0f1e609 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.h @@ -74,7 +74,7 @@ class pfGUIEditBoxMod : public pfGUIControlMod plKeyDef fSavedKey; uint8_t fSavedModifiers; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IPostSetUpDynTextMap( void ); virtual void IUpdate( void ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp index 9ea93518..e4315518 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp @@ -90,7 +90,7 @@ pfGUIKnobCtrl::~pfGUIKnobCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIKnobCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIKnobCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -210,7 +210,7 @@ void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, uint8_t modifiers ) void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) { - hsScalar oldValue = fValue, newValue = fDragValue; + float oldValue = fValue, newValue = fDragValue; if( fDragRangeMin != -1 ) { @@ -242,7 +242,7 @@ void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers ) } else { - hsScalar diff; + float diff; if( HasFlag( kLeftRightOrientation ) ) diff = ( mousePt.fX - fDragStart.fX ) * 20.f; else @@ -284,7 +284,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) if( fAnimTimesCalced ) return true; - hsScalar tBegin = 1e30, tEnd = -1e30; + float tBegin = 1e30, tEnd = -1e30; bool foundOne = false; for( int i = 0; i < fAnimationKeys.GetCount(); i++ ) @@ -295,8 +295,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) { for( int j = 0; j < mod->GetNumAnimations(); j++ ) { - hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); - hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); + float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); + float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -308,8 +308,8 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() ); if( layer != nil ) { - hsScalar begin = layer->GetTimeConvert().GetBegin(); - hsScalar end = layer->GetTimeConvert().GetEnd(); + float begin = layer->GetTimeConvert().GetBegin(); + float end = layer->GetTimeConvert().GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -331,7 +331,7 @@ hsBool pfGUIKnobCtrl::ICalcAnimTimes( void ) //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) +void pfGUIKnobCtrl::SetCurrValue( float v ) { int old = (int)fValue; pfGUIValueCtrl::SetCurrValue( v ); @@ -343,8 +343,8 @@ void pfGUIKnobCtrl::SetCurrValue( hsScalar v ) { ICalcAnimTimes(); - hsScalar tLength = fAnimEnd - fAnimBegin; - hsScalar newTime = fMin; + float tLength = fAnimEnd - fAnimBegin; + float newTime = fMin; if (fMin != fMax) // Protect against div by zero { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h index b8b4ac07..c58753c6 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h @@ -61,17 +61,17 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl char *fAnimName; hsPoint3 fDragStart; - hsScalar fDragValue; + float fDragValue; hsBool fDragging; hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange - hsScalar fDragRangeMin, fDragRangeMax; + float fDragRangeMin, fDragRangeMax; // Computed once, once an anim is loaded that we can compute this with - hsScalar fAnimBegin, fAnimEnd; + float fAnimBegin, fAnimEnd; hsBool fAnimTimesCalced; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual uint32_t IGetDesiredCursor( void ) const; // As specified in plInputInterface.h @@ -106,7 +106,7 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - virtual void SetCurrValue( hsScalar v ); + virtual void SetCurrValue( float v ); // Export only void SetAnimationKeys( hsTArray &keys, const char *name ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp index 5fde984c..a8a689cb 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp @@ -140,7 +140,7 @@ pfGUIListBoxMod::~pfGUIListBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIListBoxMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIListBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -242,7 +242,7 @@ void pfGUIListBoxMod::IUpdate( void ) { // Shit. Move the scrollPos up to this item at the very least fScrollPos = j; - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); fCheckScroll = false; break; } @@ -345,7 +345,7 @@ void pfGUIListBoxMod::IUpdate( void ) if( anySelected ) { fScrollPos = j; - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); IUpdate(); // Gotta update again, since we just changed the scrollPos after the fact return; } @@ -495,9 +495,9 @@ void pfGUIListBoxMod::ICalcScrollRange( void ) // Smaller than the viewing area, so we don't scroll at all fScrollControl->SetRange( 0.f, 0.f ); else - fScrollControl->SetRange( 0.f, (hsScalar)( i + 1 ) ); + fScrollControl->SetRange( 0.f, (float)( i + 1 ) ); - fScrollControl->SetCurrValue( (hsScalar)( (int)fScrollControl->GetMax() - fScrollPos ) ); + fScrollControl->SetCurrValue( (float)( (int)fScrollControl->GetMax() - fScrollPos ) ); } } @@ -1044,7 +1044,7 @@ void pfGUIListBoxMod::SetScrollPos( int32_t pos ) { if ( pos >= (int)fScrollControl->GetMin() && pos <= (int)fScrollControl->GetMax() ) { - fScrollControl->SetCurrValue( (hsScalar)pos ); + fScrollControl->SetCurrValue( (float)pos ); fScrollPos = (int)fScrollControl->GetMax() - pos; } IUpdate(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h index 6e6eeae6..8b448ca8 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.h @@ -89,7 +89,7 @@ class pfGUIListBoxMod : public pfGUIControlMod hsTArray fWrapStartIdxs; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() void ICalcScrollRange( void ); void ICalcWrapStarts( void ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp index 542b59e2..02934c1a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp @@ -189,7 +189,7 @@ pfGUIMultiLineEditCtrl::~pfGUIMultiLineEditCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIMultiLineEditCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIMultiLineEditCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } @@ -240,7 +240,7 @@ void pfGUIMultiLineEditCtrl::SetScrollPosition( int32_t topLine ) if( fScrollControl != nil ) // Scroll control values are reversed - fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos ); + fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos ); HandleExtendedEvent( pfGUIMultiLineEditCtrl::kScrollPosChanged ); @@ -267,16 +267,16 @@ void pfGUIMultiLineEditCtrl::IUpdateScrollRange( void ) { // +1 here because the last visible line is only a partial, but we want to be able to view // full lines all the way to the end. - hsScalar newMax = (hsScalar)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ); + float newMax = (float)( fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ); if( newMax != fScrollControl->GetMax() ) { - fScrollControl->SetRange( 0, (hsScalar)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) ); + fScrollControl->SetRange( 0, (float)(fLineStarts.GetCount() - ICalcNumVisibleLines() + 1) ); fScrollControl->SetEnabled( true ); if( fScrollPos > fLineStarts.GetCount() - ICalcNumVisibleLines() + 1 ) { fScrollPos = fLineStarts.GetCount() - ICalcNumVisibleLines() + 1; - fScrollControl->SetCurrValue( fScrollControl->GetMax() - (hsScalar)fScrollPos ); + fScrollControl->SetCurrValue( fScrollControl->GetMax() - (float)fScrollPos ); } // All bets are off on scrolling, so refresh the whole area diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h index 9aa695b1..c73f5f85 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.h @@ -111,7 +111,7 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod static wchar_t fColorCodeChar, fStyleCodeChar; static uint32_t fColorCodeSize, fStyleCodeSize; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IPostSetUpDynTextMap( void ); virtual void IUpdate( void ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp index d452431e..dec76bfb 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp @@ -336,7 +336,7 @@ void pfGUIPopUpMenu::SetEnabled( hsBool e ) pfGUIDialogMod::SetEnabled( e ); } -void pfGUIPopUpMenu::Show( hsScalar x, hsScalar y ) +void pfGUIPopUpMenu::Show( float x, float y ) { fOriginX = x; fOriginY = y; @@ -622,7 +622,7 @@ void pfGUIPopUpMenu::ITearDownMenu( void ) //// HandleMouseEvent //////////////////////////////////////////////////////// -hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, +hsBool pfGUIPopUpMenu::HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ) { hsBool r = pfGUIDialogMod::HandleMouseEvent( event, mouseX, mouseY, modifiers ); @@ -733,7 +733,7 @@ hsGMaterial *pfGUIPopUpMenu::ICreateDynMaterial( void ) #include "plJPEG/plJPEG.h" -pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc ) +pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc ) { float fovX, fovY; @@ -778,8 +778,8 @@ pfGUIPopUpMenu *pfGUIPopUpMenu::Build( const char *name, pfGUIDialogMod *parent fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); // Create the sceneNode to go with it menu->fParentNode= TRACKED_NEW plSceneNode; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h index c8f660be..7328806a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.h @@ -100,7 +100,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod // Array of info to rebuild our menu from. Note that this is ONLY used when rebuilding hsBool fNeedsRebuilding, fWaitingForSkin; - hsScalar fOriginX, fOriginY; + float fOriginX, fOriginY; uint16_t fMargin; hsTArray fMenuItems; int32_t fSubMenuOpen; @@ -153,9 +153,9 @@ class pfGUIPopUpMenu : public pfGUIDialogMod virtual void Write( hsStream* s, hsResMgr* mgr ); virtual void SetEnabled( hsBool e ); - virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, uint8_t modifiers ); + virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, float mouseX, float mouseY, uint8_t modifiers ); - void Show( hsScalar x, hsScalar y ); + void Show( float x, float y ); void SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context ); void SetAlignment( Alignment a ) { fAlignment = a; } @@ -164,7 +164,7 @@ class pfGUIPopUpMenu : public pfGUIDialogMod void AddItem( const wchar_t *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil ); void SetSkin( pfGUISkin *skin ); - static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); + static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, float x, float y, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); }; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp index 90a0fcac..6dc04837 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp @@ -83,7 +83,7 @@ pfGUIProgressCtrl::~pfGUIProgressCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIProgressCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIProgressCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -163,7 +163,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) if( fAnimTimesCalced ) return true; - hsScalar tBegin = 1e30, tEnd = -1e30; + float tBegin = 1e30, tEnd = -1e30; bool foundOne = false; for( int i = 0; i < fAnimationKeys.GetCount(); i++ ) @@ -174,8 +174,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) { for( int j = 0; j < mod->GetNumAnimations(); j++ ) { - hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); - hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); + float begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin(); + float end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -187,8 +187,8 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() ); if( layer != nil ) { - hsScalar begin = layer->GetTimeConvert().GetBegin(); - hsScalar end = layer->GetTimeConvert().GetEnd(); + float begin = layer->GetTimeConvert().GetBegin(); + float end = layer->GetTimeConvert().GetEnd(); if( begin < tBegin ) tBegin = begin; if( end > tEnd ) @@ -210,7 +210,7 @@ hsBool pfGUIProgressCtrl::ICalcAnimTimes( void ) //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) +void pfGUIProgressCtrl::SetCurrValue( float v ) { int old = (int)fValue; @@ -223,8 +223,8 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) { ICalcAnimTimes(); - hsScalar tLength = fAnimEnd - fAnimBegin; - hsScalar newTime; + float tLength = fAnimEnd - fAnimBegin; + float newTime; if( HasFlag( kReverseValues ) ) newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin; @@ -240,7 +240,7 @@ void pfGUIProgressCtrl::SetCurrValue( hsScalar v ) } } -void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent ) +void pfGUIProgressCtrl::AnimateToPercentage( float percent ) { // percent should be a value in range 0.0 to 1.0 if (percent >= 0.0f && percent <= 1.0f) @@ -262,7 +262,7 @@ void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent ) PlaySound(kAnimateSound, true); // setup a timer to call back when we finish animating - hsScalar elapsedTime = (fAnimEnd - fAnimBegin) * percent; + float elapsedTime = (fAnimEnd - fAnimBegin) * percent; plTimerCallbackMsg *timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), fStopSoundTimer); plgTimerCallbackMgr::NewTimer(elapsedTime, timerMsg); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h index f1c09a90..18c7c50a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h @@ -61,11 +61,11 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl char *fAnimName; // Computed once, once an anim is loaded that we can compute this with - hsScalar fAnimBegin, fAnimEnd; + float fAnimBegin, fAnimEnd; hsBool fAnimTimesCalced; hsBool fPlaySound; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() hsBool ICalcAnimTimes( void ); @@ -92,8 +92,8 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false ); - virtual void SetCurrValue( hsScalar v ); - virtual void AnimateToPercentage( hsScalar percent ); + virtual void SetCurrValue( float v ); + virtual void AnimateToPercentage( float percent ); enum SoundEvents { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp index eb5159be..f562f989 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp @@ -137,7 +137,7 @@ pfGUIRadioGroupCtrl::~pfGUIRadioGroupCtrl() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIRadioGroupCtrl::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIRadioGroupCtrl::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h index ab7a8320..e30439d7 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.h @@ -72,7 +72,7 @@ class pfGUIRadioGroupCtrl : public pfGUIControlMod int32_t fValue, fDefaultValue; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() public: diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp index 32b84076..822708a9 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp @@ -80,7 +80,7 @@ pfGUITextBoxMod::~pfGUITextBoxMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUITextBoxMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUITextBoxMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIControlMod::IEval( secs, del, dirty ); } diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h index 134cd25b..109bc514 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h @@ -63,7 +63,7 @@ class pfGUITextBoxMod : public pfGUIControlMod bool fUseLocalizationPath; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IUpdate( void ); virtual void IPostSetUpDynTextMap( void ); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp index be34f705..cbd070c6 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp @@ -119,7 +119,7 @@ pfGUIUpDownPairMod::~pfGUIUpDownPairMod() //// IEval /////////////////////////////////////////////////////////////////// -hsBool pfGUIUpDownPairMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool pfGUIUpDownPairMod::IEval( double secs, float del, uint32_t dirty ) { return pfGUIValueCtrl::IEval( secs, del, dirty ); } @@ -228,13 +228,13 @@ void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr ) } -void pfGUIUpDownPairMod::SetRange( hsScalar min, hsScalar max ) +void pfGUIUpDownPairMod::SetRange( float min, float max ) { pfGUIValueCtrl::SetRange( min, max ); IUpdate(); } -void pfGUIUpDownPairMod::SetCurrValue( hsScalar v ) +void pfGUIUpDownPairMod::SetCurrValue( float v ) { pfGUIValueCtrl::SetCurrValue( v ); IUpdate(); diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h index 37a58f84..5374cbff 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.h @@ -70,7 +70,7 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl pfUpDownBtnProc *fButtonProc; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual void IUpdate( void ); public: @@ -89,8 +89,8 @@ class pfGUIUpDownPairMod : public pfGUIValueCtrl virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetCurrValue( hsScalar v ); + virtual void SetRange( float min, float max ); + virtual void SetCurrValue( float v ); /// Export ONLY diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp index 186ba4b7..991e06b9 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp @@ -66,7 +66,7 @@ pfGUIValueCtrl::~pfGUIValueCtrl() //// SetCurrValue //////////////////////////////////////////////////////////// -void pfGUIValueCtrl::SetCurrValue( hsScalar v ) +void pfGUIValueCtrl::SetCurrValue( float v ) { fValue = v; if( fValue < fMin ) @@ -77,7 +77,7 @@ void pfGUIValueCtrl::SetCurrValue( hsScalar v ) //// SetRange //////////////////////////////////////////////////////////////// -void pfGUIValueCtrl::SetRange( hsScalar min, hsScalar max ) +void pfGUIValueCtrl::SetRange( float min, float max ) { fMin = min; fMax = max; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h index 9c3b296d..4d49e2c5 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.h @@ -55,7 +55,7 @@ class pfGUIValueCtrl : public pfGUIControlMod { protected: - hsScalar fValue, fMin, fMax, fStep; + float fValue, fMin, fMax, fStep; public: @@ -69,15 +69,15 @@ class pfGUIValueCtrl : public pfGUIControlMod virtual void Read( hsStream* s, hsResMgr* mgr ); virtual void Write( hsStream* s, hsResMgr* mgr ); - virtual hsScalar GetCurrValue( void ) { return fValue; } - virtual void SetCurrValue( hsScalar v ); + virtual float GetCurrValue( void ) { return fValue; } + virtual void SetCurrValue( float v ); - virtual hsScalar GetMin( void ) { return fMin; } - virtual hsScalar GetMax( void ) { return fMax; } - virtual hsScalar GetStep( void ) { return fStep; } + virtual float GetMin( void ) { return fMin; } + virtual float GetMax( void ) { return fMax; } + virtual float GetStep( void ) { return fStep; } - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetStep( hsScalar step ) { fStep = step; } + virtual void SetRange( float min, float max ); + virtual void SetStep( float step ) { fStep = step; } }; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp index 771aaf55..9a4f409c 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.cpp @@ -102,7 +102,7 @@ class pfGameUIInputInterface : public plInputInterface virtual uint32_t GetPriorityLevel( void ) const { return kGUISystemPriority; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); virtual uint32_t GetCurrentCursorID( void ) const; - virtual hsScalar GetCurrentCursorOpacity( void ) const; + virtual float GetCurrentCursorOpacity( void ) const; virtual hsBool HasInterestingCursorID( void ) const { return fHaveInterestingCursor; } virtual hsBool SwitchInterpretOrder( void ) const { return true; } @@ -561,7 +561,7 @@ void pfGameGUIMgr::IActivateGUI( hsBool activate ) //// IHandleMouse //////////////////////////////////////////////////////////// // Distributes mouse events to the dialogs currently active -hsBool pfGameGUIMgr::IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, uint8_t modifiers, uint32_t *desiredCursor ) +hsBool pfGameGUIMgr::IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor ) { pfGUIDialogMod *dlg; @@ -850,7 +850,7 @@ uint32_t pfGameUIInputInterface::GetCurrentCursorID( void ) const return fCurrentCursor; } -hsScalar pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const +float pfGameUIInputInterface::GetCurrentCursorOpacity( void ) const { if ( pfGameGUIMgr::GetInstance() ) return pfGameGUIMgr::GetInstance()->GetCursorOpacity(); @@ -942,12 +942,12 @@ uint32_t pfGameGUIMgr::GetHighestTag( void ) } -void pfGameGUIMgr::SetAspectRatio(hsScalar aspectratio) +void pfGameGUIMgr::SetAspectRatio(float aspectratio) { - hsScalar oldAspectRatio = fAspectRatio; + float oldAspectRatio = fAspectRatio; // don't allow the aspectratio below 4:3 - hsScalar fourThree = 4.0f/3.0f; + float fourThree = 4.0f/3.0f; fAspectRatio = aspectratio < fourThree ? fourThree : aspectratio; if (fAspectRatio != oldAspectRatio) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h index 09d61251..0f3b4e25 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGameGUIMgr.h @@ -148,8 +148,8 @@ class pfGameGUIMgr : public hsKeyedObject uint32_t fInputCtlIndex; uint32_t fDefaultCursor; - hsScalar fCursorOpacity; - hsScalar fAspectRatio; + float fCursorOpacity; + float fAspectRatio; // This is an array of the dialogs (by name) that need their // receiver key set once they are loaded. @@ -167,7 +167,7 @@ class pfGameGUIMgr : public hsKeyedObject void IActivateGUI( hsBool activate ); - hsBool IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, uint8_t modifiers, uint32_t *desiredCursor ); + hsBool IHandleMouse( EventType event, float mouseX, float mouseY, uint8_t modifiers, uint32_t *desiredCursor ); hsBool IHandleKeyEvt( EventType event, plKeyDef key, uint8_t modifiers ); hsBool IHandleKeyPress( wchar_t key, uint8_t modifiers ); @@ -212,8 +212,8 @@ class pfGameGUIMgr : public hsKeyedObject void SetDefaultCursor(uint32_t defaultCursor) { fDefaultCursor = defaultCursor; } uint32_t GetDefaultCursor() { return fDefaultCursor; } - void SetCursorOpacity(hsScalar opacity) { fCursorOpacity = opacity; } - hsScalar GetCursorOpacity() { return fCursorOpacity; } + void SetCursorOpacity(float opacity) { fCursorOpacity = opacity; } + float GetCursorOpacity() { return fCursorOpacity; } pfGUIPopUpMenu *FindPopUpMenu( const char *name ); @@ -227,8 +227,8 @@ class pfGameGUIMgr : public hsKeyedObject static uint32_t GetNumTags( void ); static pfGUITag *GetTag( uint32_t tagIndex ); static uint32_t GetHighestTag( void ); - void SetAspectRatio(hsScalar aspectratio); - hsScalar GetAspectRatio() { return fAspectRatio; } + void SetAspectRatio(float aspectratio); + float GetAspectRatio() { return fAspectRatio; } static pfGameGUIMgr *GetInstance( void ) { return fInstance; } }; diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp index e8fefa04..0f908219 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp @@ -123,9 +123,9 @@ class pfEsHTMLChunk uint16_t fAbsoluteX, fAbsoluteY; - hsScalar fCurrOpacity; // For SFX images - hsScalar fSFXTime; // For SFX images - hsScalar fMinOpacity, fMaxOpacity; + float fCurrOpacity; // For SFX images + float fSFXTime; // For SFX images + float fMinOpacity, fMaxOpacity; hsColorRGBA fCurrColor; hsColorRGBA fOffColor, fOnColor; @@ -563,7 +563,7 @@ hsBool pfBookData::MsgReceive(plMessage *pMsg) plTimeMsg *time = plTimeMsg::ConvertNoRef( pMsg ); if( time != nil && fCurrSFXPages != kNoSides && !fCurrentlyTurning && fCurrentlyOpen ) { - IHandleSFX( (hsScalar)time->DSeconds() ); + IHandleSFX( (float)time->DSeconds() ); return true; } @@ -714,7 +714,7 @@ void pfBookData::RegisterForSFX(WhichSide whichPages) // calced, pointers bad, etc) just bail, since the SFX are just for visual // flair and not really needed. -void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides*/) +void pfBookData::IHandleSFX(float currTime, WhichSide whichSide /*= kNoSides*/) { if(fCurrBook == nil) return; @@ -737,7 +737,7 @@ void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides* } // Update all SFX images for this page first - hsScalar deltaT = currTime - fBaseSFXTime; + float deltaT = currTime - fBaseSFXTime; uint32_t idx, inc = (whichSide == kLeftSide) ? 0 : 1; if(fCurrBook->fPageStarts.GetCount() <= fCurrBook->fCurrentPage + inc + 1) @@ -752,7 +752,7 @@ void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides* { // Glow SFX: animate opacity based on time offset uint8_t isOdd = 0; - hsScalar newDelta = deltaT; + float newDelta = deltaT; while(newDelta > chunk->fSFXTime) { isOdd = ~isOdd; @@ -1080,7 +1080,7 @@ void pfBookData::UpdatePageCorners(WhichSide which) //// SetCurrSize //////////////////////////////////////////////////////////// // Seeks the width and height animations to set the desired book size. Sizes are in % across the animation -void pfBookData::SetCurrSize(hsScalar w, hsScalar h) +void pfBookData::SetCurrSize(float w, float h) { fWidthCtrl->SetCurrValue(w); fHeightCtrl->SetCurrValue(h); @@ -1647,8 +1647,8 @@ int32_t pfJournalBook::IFindCurrVisibleLink( hsBool rightNotLeft, hsBool hover // This should be 0-1 in the context of the control, so scale to our DTMap size plDynamicTextMap *dtMap = fBookGUIs[fCurBookGUI]->GetDTMap( rightNotLeft ? pfJournalDlgProc::kTagRightDTMap : pfJournalDlgProc::kTagLeftDTMap ); - pt.fX *= (hsScalar)dtMap->GetWidth(); - pt.fY *= (hsScalar)dtMap->GetHeight(); + pt.fX *= (float)dtMap->GetWidth(); + pt.fY *= (float)dtMap->GetHeight(); if( rightNotLeft ) { // Clicks on the right side are offsetted in x by the left side's width @@ -1937,20 +1937,20 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation & char *comma2 = strchr( comma + 1, ',' ); if( comma2 != nil ) { - chunk->fMaxOpacity = (hsScalar)atof( comma2 + 1 ); + chunk->fMaxOpacity = (float)atof( comma2 + 1 ); *comma2 = 0; } - chunk->fMinOpacity = (hsScalar)atof( comma + 1 ); + chunk->fMinOpacity = (float)atof( comma + 1 ); *comma = 0; } - chunk->fSFXTime = (hsScalar)atof( cOption ); + chunk->fSFXTime = (float)atof( cOption ); delete [] cOption; } else if( wcsicmp( name, L"opacity" ) == 0 ) { chunk->fFlags |= pfEsHTMLChunk::kTranslucent; char *cOption = hsWStringToString(option); - chunk->fCurrOpacity = (hsScalar)atof( cOption ); + chunk->fCurrOpacity = (float)atof( cOption ); delete [] cOption; } else if( wcsicmp( name, L"check" ) == 0 ) @@ -3491,7 +3491,7 @@ void pfJournalBook::ISendNotify( uint32_t type, uint32_t linkID ) // Note: internally we store these as the seek positions on our animations, // so the incoming parameters are actually inverse of what we finally want -void pfJournalBook::SetBookSize( hsScalar width, hsScalar height ) +void pfJournalBook::SetBookSize( float width, float height ) { fWidthScale = 1.f - width; fHeightScale = 1.f - height; diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h index b22138b5..5c71d0a9 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h @@ -252,7 +252,7 @@ public: pfGUIMultiLineEditCtrl *GetEditCtrl(uint32_t which); // Seeks the width and height animations to set the desired book size. Sizes are in % across the animation - void SetCurrSize(hsScalar w, hsScalar h); + void SetCurrSize(float w, float h); // Enables or disables the left and right page corners, to indicate current turnage state void UpdatePageCorners(WhichSide which); @@ -317,7 +317,7 @@ protected: WhichSide fCurrSFXPages; // Base time to calc SFX anim positions from - hsScalar fBaseSFXTime; + float fBaseSFXTime; hsBool fResetSFXFlag; hsBool fSFXUpdateFlip; // So we only update alternating pages every frame, to save processor time @@ -331,7 +331,7 @@ protected: void IInitTemplate(pfGUIDialogMod *templateDlg); // Process SFX for this frame - void IHandleSFX(hsScalar currTime, WhichSide whichSide = kNoSides); + void IHandleSFX(float currTime, WhichSide whichSide = kNoSides); // Yet another step in the page flip, to make SURE we're already showing the turning page before we fill in the page behind it void IFillUncoveringPage(hsBool rightSide); @@ -424,7 +424,7 @@ class pfJournalBook : public hsKeyedObject void CloseAndHide( void ); // Sets the book size scaling. 1,1 would be full size, 0,0 is the smallest size possible - void SetBookSize( hsScalar width, hsScalar height ); + void SetBookSize( float width, float height ); // What page are we on? uint32_t GetCurrentPage( void ) const { return fCurrentPage; } @@ -494,7 +494,7 @@ class pfJournalBook : public hsKeyedObject uint32_t fLastPage; // Per book size - hsScalar fWidthScale, fHeightScale; + float fWidthScale, fHeightScale; // Per book margin around the edge (defaults to 16 pixels) uint32_t fPageTMargin, fPageLMargin, fPageBMargin, fPageRMargin; diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h index e6c7ab48..e53c1d2e 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h @@ -70,7 +70,7 @@ class pfKIMsg : public plMessage std::wstring fString; // for the SetChatFadeDelay - hsScalar fDelay; + float fDelay; // other values int32_t fValue; @@ -231,8 +231,8 @@ class pfKIMsg : public plMessage void SetFlags( uint32_t flags ) { fFlags = flags; } uint32_t GetFlags( void ) const { return fFlags; } - void SetDelay( hsScalar delay ) { fDelay = delay; } - hsScalar GetDelay( void ) { return fDelay; } + void SetDelay( float delay ) { fDelay = delay; } + float GetDelay( void ) { return fDelay; } void SetIntValue( int32_t value ) { fValue = value; } int32_t GetIntValue( void ) { return fValue; } diff --git a/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h b/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h index a1ad98cf..b3017136 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/plArmatureEffectMsg.h @@ -48,7 +48,7 @@ class plArmatureEffectMsg : public plEventCallbackMsg { public: plArmatureEffectMsg() : plEventCallbackMsg(), fTriggerIdx(-1) {} - plArmatureEffectMsg(const plKey &receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plArmatureEffectMsg(const plKey &receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fTriggerIdx(-1) {} CLASSNAME_REGISTER( plArmatureEffectMsg ); diff --git a/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h b/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h index 991665e3..e71a2428 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.h @@ -58,7 +58,7 @@ public: hsColorRGBA fColor; uint8_t fLayer; uint8_t fDelta; - hsScalar fWeight; + float fWeight; plClothingMsg() : fCommands(0), fItemKey(nil), fLayer(0), fDelta(0), fWeight(0) { fColor.Set(1.f, 1.f, 1.f, 1.f); } ~plClothingMsg() {} diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp index a21eb29f..cf55702d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.cpp @@ -245,7 +245,7 @@ void cyAnimation::Resume() // // PURPOSE : Play an animation only from specific time start to end // -void cyAnimation::PlayRange(hsScalar start, hsScalar end) +void cyAnimation::PlayRange(float start, float end) { SkipToTime(start); PlayToTime(end); @@ -258,7 +258,7 @@ void cyAnimation::PlayRange(hsScalar start, hsScalar end) // // PURPOSE : Play (continue) an animation until the specified time is reached // -void cyAnimation::PlayToTime(hsScalar time) +void cyAnimation::PlayToTime(float time) { // must have a receiver! if ( fRecvr.Count() > 0 ) @@ -297,7 +297,7 @@ void cyAnimation::PlayToTime(hsScalar time) // // PURPOSE : Play (continue) an animation until the specified point is reached // -void cyAnimation::PlayToPercentage(hsScalar zeroToOne) +void cyAnimation::PlayToPercentage(float zeroToOne) { // must have a receiver! if ( fRecvr.Count() > 0 ) @@ -337,7 +337,7 @@ void cyAnimation::PlayToPercentage(hsScalar zeroToOne) // PURPOSE : Jump the animation to the specified time // : Doesn't start or stop playing of animation // -void cyAnimation::SkipToTime(hsScalar time) +void cyAnimation::SkipToTime(float time) { // must have a receiver! if ( fRecvr.Count() > 0 ) @@ -458,7 +458,7 @@ void cyAnimation::Backwards(hsBool backwards) // Function : SetLoopStart and SetLoopEnd // PARAMETERS : value - sets the start or the end of the animation // -void cyAnimation::SetLoopStart(hsScalar start) +void cyAnimation::SetLoopStart(float start) { // must have a receiver! if ( fRecvr.Count() > 0 ) @@ -490,7 +490,7 @@ void cyAnimation::SetLoopStart(hsScalar start) } } -void cyAnimation::SetLoopEnd(hsScalar end) +void cyAnimation::SetLoopEnd(float end) { // must have a receiver! if ( fRecvr.Count() > 0 ) @@ -532,7 +532,7 @@ void cyAnimation::SetLoopEnd(hsScalar end) // PURPOSE : Sets the speed of the animation // : Doesn't start or stop playing animation // -void cyAnimation::Speed(hsScalar speed) +void cyAnimation::Speed(float speed) { // must have a receiver! if ( fRecvr.Count() > 0 ) diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h index ed9e9e7e..9734c39c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyAnimation.h @@ -109,20 +109,20 @@ public: // Play an animation only from specific time start to end // - virtual void PlayRange(hsScalar start, hsScalar end); + virtual void PlayRange(float start, float end); // Play (continue) an animation until the specified time is reached // - virtual void PlayToTime(hsScalar time); + virtual void PlayToTime(float time); // Play (continue) an animation until the specified point is reached // - virtual void PlayToPercentage(hsScalar zeroToOne); + virtual void PlayToPercentage(float zeroToOne); // Jump the animation to the specified time // Doesn't start or stop playing of animation // - virtual void SkipToTime(hsScalar time); + virtual void SkipToTime(float time); // Set whether the animation is to be looped or not // @@ -135,13 +135,13 @@ public: // Sets the start and end of the looping points in the animation // - virtual void SetLoopStart(hsScalar start); - virtual void SetLoopEnd(hsScalar end); + virtual void SetLoopStart(float start); + virtual void SetLoopEnd(float end); // Sets the speed of the animation // Doesn't start or stop playing animation // - virtual void Speed(hsScalar speed); + virtual void Speed(float speed); // Jump the animation to the specified time diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp index 26dd7d93..6739b536 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp @@ -372,7 +372,7 @@ void cyAvatar::RunBehaviorAndReply(pyKey& behKey, pyKey& replyKey, hsBool netFor // // NOTE: only works with multi-stage behaviors // -void cyAvatar::NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::NextStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -411,7 +411,7 @@ void cyAvatar::NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsSc // // NOTE: only works with multi-stage behaviors // -void cyAvatar::PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::PreviousStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -451,7 +451,7 @@ void cyAvatar::PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, // // NOTE: only works with multi-stage behaviors // -void cyAvatar::GoToStage(pyKey &behKey, int32_t stage, hsScalar transTime, hsBool setTime, hsScalar newTime, +void cyAvatar::GoToStage(pyKey &behKey, int32_t stage, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce) { // first there is someone to send to and make sure that we an avatar to send this to @@ -1847,12 +1847,12 @@ bool cyAvatar::LocalAvatarIsMoving() return false; } -void cyAvatar::SetMouseTurnSensitivity(hsScalar val) +void cyAvatar::SetMouseTurnSensitivity(float val) { plArmatureMod::SetMouseTurnSensitivity(val); } -hsScalar cyAvatar::GetMouseTurnSensitivity() +float cyAvatar::GetMouseTurnSensitivity() { return plArmatureMod::GetMouseTurnSensitivity(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h index 622dbf71..ded3c41e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.h @@ -110,11 +110,11 @@ public: virtual void RunBehaviorAndReply(pyKey& behKey, pyKey& replyKey, hsBool netForce, hsBool netProp); // for the multistage behaviors - virtual void NextStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void NextStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); - virtual void PreviousStage(pyKey &behKey, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void PreviousStage(pyKey &behKey, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); - virtual void GoToStage(pyKey &behKey, int32_t stage, hsScalar transTime, hsBool setTime, hsScalar newTime, + virtual void GoToStage(pyKey &behKey, int32_t stage, float transTime, hsBool setTime, float newTime, hsBool setDirection, bool isForward, hsBool netForce); // static behavior functions: @@ -542,8 +542,8 @@ public: static bool LocalAvatarRunKeyDown(); static bool LocalAvatarIsMoving(); - static void SetMouseTurnSensitivity(hsScalar val); - static hsScalar GetMouseTurnSensitivity(); + static void SetMouseTurnSensitivity(float val); + static float GetMouseTurnSensitivity(); static void SpawnNext(); ///////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp b/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp index 4ccc345c..0468594a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyCamera.cpp @@ -233,7 +233,7 @@ void cyCamera::UndoFirstPerson() } -hsScalar cyCamera::GetFOV() +float cyCamera::GetFOV() { if ( fTheCam ) { @@ -250,7 +250,7 @@ hsScalar cyCamera::GetFOV() return 0.0; } -void cyCamera::SetFOV(hsScalar fov, double t) +void cyCamera::SetFOV(float fov, double t) { if ( fTheCam ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/cyCamera.h b/Sources/Plasma/FeatureLib/pfPython/cyCamera.h index b8fbdfe2..924eaeb3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyCamera.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyCamera.h @@ -102,8 +102,8 @@ public: virtual void UndoFirstPerson(); - virtual hsScalar GetFOV(); - virtual void SetFOV(hsScalar fov, double t); + virtual float GetFOV(); + virtual void SetFOV(float fov, double t); virtual void SetSmootherCam(hsBool state); virtual hsBool IsSmootherCam(); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 96e0cd7d..a2cf7cd8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -272,7 +272,7 @@ void cyMisc::PopUpConsole(const char* command) // // PURPOSE : Execute a console command from a python script // -void cyMisc::TimerCallback(pyKey& selfkey, hsScalar time, uint32_t id) +void cyMisc::TimerCallback(pyKey& selfkey, float time, uint32_t id) { // setup the message to come back to whoever the pyKey is pointing to plTimerCallbackMsg* pTimerMsg = TRACKED_NEW plTimerCallbackMsg(selfkey.getKey(),id); @@ -757,7 +757,7 @@ double cyMisc::GetSysSeconds() // // PURPOSE : Return the frame delta seconds // -hsScalar cyMisc::GetDelSysSeconds() +float cyMisc::GetDelSysSeconds() { return hsTimer::GetDelSysSeconds(); } @@ -1061,7 +1061,7 @@ uint32_t cyMisc::GetMaxListenListSize() return plNetListenList::kMaxListenListSize; } -hsScalar cyMisc::GetMaxListenDistSq() +float cyMisc::GetMaxListenDistSq() { return plNetListenList::kMaxListenDistSq; } @@ -1157,7 +1157,7 @@ uint32_t cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolis // // RETURNS : nothing // -void cyMisc::SendKIMessage(uint32_t command, hsScalar value) +void cyMisc::SendKIMessage(uint32_t command, float value) { // create the mesage to send pfKIMsg *msg = TRACKED_NEW pfKIMsg( (uint8_t)command ); @@ -1911,7 +1911,7 @@ int cyMisc::GetNumParticles(pyKey& host) } -void cyMisc::SetLightColorValue(pyKey& light, std::string lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a) +void cyMisc::SetLightColorValue(pyKey& light, std::string lightName, float r, float g, float b, float a) { // lightName is the name of the light object attached to the light that we want to talk to // for the bug lights, this would be "RTOmni-BugLightTest" @@ -2052,7 +2052,7 @@ void cyMisc::RegisterForControlEventMessages(hsBool on, pyKey& k) // PURPOSE : To request an LOS from a point on the screen // #include "plMessage/plLOSRequestMsg.h" -bool cyMisc::RequestLOSScreen(pyKey &selfkey, int32_t ID, hsScalar xPos, hsScalar yPos, hsScalar distance, int what, int reportType) +bool cyMisc::RequestLOSScreen(pyKey &selfkey, int32_t ID, float xPos, float yPos, float distance, int what, int reportType) { plPipeline* pipe = selfkey.GetPipeline(); if (pipe) @@ -2203,7 +2203,7 @@ bool cyMisc::IsEnterChatModeKeyBound() // PURPOSE : Shoots from screen coordinates, a bullet and makes a mark on objects that know about bullet holes // #include "plMessage/plBulletMsg.h" -void cyMisc::ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, hsScalar radius, hsScalar range) +void cyMisc::ShootBulletFromScreen(pyKey &selfkey, float xPos, float yPos, float radius, float range) { plPipeline* pipe = selfkey.GetPipeline(); if (pipe) @@ -2234,7 +2234,7 @@ void cyMisc::ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, // // PURPOSE : Shoots from an object, a bullet and makes a mark on objects that know about bullet holes // -void cyMisc::ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, hsScalar radius, hsScalar range) +void cyMisc::ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, float radius, float range) { plSceneObject* so = plSceneObject::ConvertNoRef(sobj->getObjKey()->ObjectIsLoaded()); if( so ) diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h index a56e6f91..48ae2b23 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.h @@ -161,7 +161,7 @@ public: // // PURPOSE : Execute a console command from a python script // - static void TimerCallback(pyKey& selfkey, hsScalar time, uint32_t id); + static void TimerCallback(pyKey& selfkey, float time, uint32_t id); ///////////////////////////////////////////////////////////////////////////// // @@ -335,7 +335,7 @@ public: // // PURPOSE : Return the frame delta seconds // - static hsScalar GetDelSysSeconds(); + static float GetDelSysSeconds(); ///////////////////////////////////////////////////////////////////////////// @@ -424,7 +424,7 @@ public: static std::vector GetPlayerListDistanceSorted(); // list of pyPlayer static uint32_t GetMaxListenListSize(); - static hsScalar GetMaxListenDistSq(); + static float GetMaxListenDistSq(); ///////////////////////////////////////////////////////////////////////////// // @@ -452,7 +452,7 @@ public: // // RETURNS : nothing // - static void SendKIMessage(uint32_t command, hsScalar value); + static void SendKIMessage(uint32_t command, float value); ///////////////////////////////////////////////////////////////////////////// // @@ -676,7 +676,7 @@ public: // // PURPOSE : To request an LOS from a point on the screen // - static bool RequestLOSScreen(pyKey &selfkey, int32_t ID, hsScalar xPos, hsScalar yPos, hsScalar distance, int what, int reportType); + static bool RequestLOSScreen(pyKey &selfkey, int32_t ID, float xPos, float yPos, float distance, int what, int reportType); ////////////////////////////////////////////////////////////////////////////// // @@ -697,7 +697,7 @@ public: static void SetParticleOffset(float x, float y, float z, pyKey& particles); static void KillParticles(float time, float pct, pyKey& particles); static int GetNumParticles(pyKey& host); - static void SetLightColorValue(pyKey& light, std::string lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a); + static void SetLightColorValue(pyKey& light, std::string lightName, float r, float g, float b, float a); static void SetLightAnimationOn(pyKey& light, std::string lightName, hsBool start); ////////////////////////////////////////////////////////////////////////////// // @@ -745,7 +745,7 @@ public: // // PURPOSE : Shoots from screen coordinates, a bullet and makes a mark on objects that know about bullet holes // - static void ShootBulletFromScreen(pyKey &selfkey, hsScalar xPos, hsScalar yPos, hsScalar radius, hsScalar range); + static void ShootBulletFromScreen(pyKey &selfkey, float xPos, float yPos, float radius, float range); ////////////////////////////////////////////////////////////////////////////// // @@ -754,7 +754,7 @@ public: // // PURPOSE : Shoots from an object, a bullet and makes a mark on objects that know about bullet holes // - static void ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, hsScalar radius, hsScalar range); + static void ShootBulletFromObject(pyKey &selfkey, pySceneObject* sobj, float radius, float range); ////////////////////////////////////////////////////////////////////////////// // diff --git a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp index e8dea962..b6e4c075 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.cpp @@ -79,7 +79,7 @@ void cyParticleSys::SetNetForce(hsBool state) // // PURPOSE : send the message to the Particle System // -void cyParticleSys::ISendParticleSysMsg(uint32_t param, hsScalar value) +void cyParticleSys::ISendParticleSysMsg(uint32_t param, float value) { plParticleUpdateMsg* pMsg = TRACKED_NEW plParticleUpdateMsg(fSender, nil, nil, param, value); // check if this needs to be network forced to all clients @@ -103,62 +103,62 @@ void cyParticleSys::ISendParticleSysMsg(uint32_t param, hsScalar value) // // All these methods just call the IsendParticleSysMsg to do the real work // -void cyParticleSys::SetParticlesPerSecond(hsScalar value) +void cyParticleSys::SetParticlesPerSecond(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamParticlesPerSecond,value); } -void cyParticleSys::SetInitPitchRange(hsScalar value) +void cyParticleSys::SetInitPitchRange(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamInitPitchRange,value); } -void cyParticleSys::SetInitYawRange(hsScalar value) +void cyParticleSys::SetInitYawRange(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamInitYawRange,value); } -void cyParticleSys::SetVelMin(hsScalar value) +void cyParticleSys::SetVelMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamVelMin,value); } -void cyParticleSys::SetVelMax(hsScalar value) +void cyParticleSys::SetVelMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamVelMax,value); } -void cyParticleSys::SetXSize(hsScalar value) +void cyParticleSys::SetXSize(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamXSize,value); } -void cyParticleSys::SetYSize(hsScalar value) +void cyParticleSys::SetYSize(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamYSize,value); } -void cyParticleSys::SetScaleMin(hsScalar value) +void cyParticleSys::SetScaleMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamScaleMin,value); } -void cyParticleSys::SetScaleMax(hsScalar value) +void cyParticleSys::SetScaleMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamScaleMax,value); } -void cyParticleSys::SetGenLife(hsScalar value) +void cyParticleSys::SetGenLife(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamGenLife,value); } -void cyParticleSys::SetPartLifeMin(hsScalar value) +void cyParticleSys::SetPartLifeMin(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamPartLifeMin,value); } -void cyParticleSys::SetPartLifeMax(hsScalar value) +void cyParticleSys::SetPartLifeMax(float value) { ISendParticleSysMsg(plParticleUpdateMsg::kParamPartLifeMax,value); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h index 27eefcca..4065a6a2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyParticleSys.h @@ -63,7 +63,7 @@ protected: hsTArray fRecvr; hsBool fNetForce; - virtual void ISendParticleSysMsg(uint32_t param, hsScalar value); + virtual void ISendParticleSysMsg(uint32_t param, float value); cyParticleSys(const plKey sender=nil,const plKey recvr=nil); @@ -81,18 +81,18 @@ public: virtual void AddRecvr(plKey &recvr); virtual void SetNetForce(hsBool state); - virtual void SetParticlesPerSecond(hsScalar value); - virtual void SetInitPitchRange(hsScalar value); - virtual void SetInitYawRange(hsScalar value); - virtual void SetVelMin(hsScalar value); - virtual void SetVelMax(hsScalar value); - virtual void SetXSize(hsScalar value); - virtual void SetYSize(hsScalar value); - virtual void SetScaleMin(hsScalar value); - virtual void SetScaleMax(hsScalar value); - virtual void SetGenLife(hsScalar value); - virtual void SetPartLifeMin(hsScalar value); - virtual void SetPartLifeMax(hsScalar value); + virtual void SetParticlesPerSecond(float value); + virtual void SetInitPitchRange(float value); + virtual void SetInitYawRange(float value); + virtual void SetVelMin(float value); + virtual void SetVelMax(float value); + virtual void SetXSize(float value); + virtual void SetYSize(float value); + virtual void SetScaleMin(float value); + virtual void SetScaleMax(float value); + virtual void SetGenLife(float value); + virtual void SetPartLifeMin(float value); + virtual void SetPartLifeMax(float value); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp index b21b9d07..e8a74de2 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp @@ -283,7 +283,7 @@ void cyPhysics::WarpMat(pyMatrix44& mat) // : if the object is physical then warp it // : otherwise just use the coordinate interface and set the transform // -void cyPhysics::Move(pyVector3& direction, hsScalar distance) +void cyPhysics::Move(pyVector3& direction, float distance) { //move each receiver (object) separately int i; @@ -352,7 +352,7 @@ void cyPhysics::Move(pyVector3& direction, hsScalar distance) // : if the object is physical then warp it // : otherwise just use the coordinate interface and set the transform // -void cyPhysics::Rotate(hsScalar rad, pyVector3& axis) +void cyPhysics::Rotate(float rad, pyVector3& axis) { // rotate each receiver (object) separately int i; @@ -655,7 +655,7 @@ void cyPhysics::AngularImpulse(pyVector3& impulse) // : A damp factor of 1 leaves them alone. // // -void cyPhysics::Damp(hsScalar damp) +void cyPhysics::Damp(float damp) { hsAssert(0, "Who uses this?"); // must have a receiver! diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h index e23275ed..b1e61a16 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h +++ b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.h @@ -102,12 +102,12 @@ public: // Move the object in a direction and distance // if the object is physical then warp it // otherwise just use the coordinate interface and set the transform - virtual void Move(pyVector3& direction, hsScalar distance); + virtual void Move(pyVector3& direction, float distance); // Rotate the object // if the object is physical then warp it // otherwise just use the coordinate interface and set the transform - virtual void Rotate(hsScalar rad, pyVector3& axis); + virtual void Rotate(float rad, pyVector3& axis); // apply a force to the center of mass of the receiver virtual void Force(pyVector3& force); @@ -133,7 +133,7 @@ public: // Decrease all velocities on the given object. // A damp factor of 0 nulls them all entirely; // A damp factor of 1 leaves them alone. - virtual void Damp(hsScalar damp); + virtual void Damp(float damp); // Shift the center of mass of the given object by the given // amount in the given direction. diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index 8a08fdae..ba899a76 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -1131,7 +1131,7 @@ void plPythonFileMod::IFindActivatorAndAdd(const char *activatorName, int32_t id // Tasks: // - Call the Python code's Update function (if there) // -hsBool plPythonFileMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plPythonFileMod::IEval(double secs, float del, uint32_t dirty) { if ( fModule ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h index 0d7240eb..8c23857e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h @@ -72,7 +72,7 @@ protected: plPythonSDLModifier* fSDLMod; - hsBool IEval(double secs, hsScalar del, uint32_t dirty); + hsBool IEval(double secs, float del, uint32_t dirty); void IMakeModuleName(char* modulename,plSceneObject* sobj); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h index 6c53ee0e..1317b6dc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h @@ -96,7 +96,7 @@ public: { int32_t fIntNumber; - hsScalar fFloatNumber; + float fFloatNumber; hsBool fBool; @@ -227,7 +227,7 @@ public: fValueType = kInt; datarecord.fIntNumber = number; } - void SetToFloat(hsScalar number) + void SetToFloat(float number) { SetToNone(); fValueType = kFloat; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp index 09b88cb3..92c70f0f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudio/plAudioCaps.h" // Sets the master volume of a given audio channel -void pyAudioControl::SetSoundFXVolume( hsScalar volume ) +void pyAudioControl::SetSoundFXVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kSoundFX; @@ -68,7 +68,7 @@ void pyAudioControl::SetSoundFXVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetMusicVolume( hsScalar volume ) +void pyAudioControl::SetMusicVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kBgndMusic; @@ -82,7 +82,7 @@ void pyAudioControl::SetMusicVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetVoiceVolume( hsScalar volume ) +void pyAudioControl::SetVoiceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kVoice; @@ -96,7 +96,7 @@ void pyAudioControl::SetVoiceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetAmbienceVolume( hsScalar volume ) +void pyAudioControl::SetAmbienceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kAmbience; @@ -110,7 +110,7 @@ void pyAudioControl::SetAmbienceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetGUIVolume( hsScalar volume ) +void pyAudioControl::SetGUIVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kGUI; @@ -124,7 +124,7 @@ void pyAudioControl::SetGUIVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -void pyAudioControl::SetNPCVoiceVolume( hsScalar volume ) +void pyAudioControl::SetNPCVoiceVolume( float volume ) { plgAudioSys::ASChannel chan; chan = plgAudioSys::kNPCVoice; @@ -138,42 +138,42 @@ void pyAudioControl::SetNPCVoiceVolume( hsScalar volume ) plgAudioSys::SetChannelVolume( chan, volume ); } -hsScalar pyAudioControl::GetSoundFXVolume() +float pyAudioControl::GetSoundFXVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kSoundFX; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetMusicVolume() +float pyAudioControl::GetMusicVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kBgndMusic; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetVoiceVolume() +float pyAudioControl::GetVoiceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kVoice; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetAmbienceVolume() +float pyAudioControl::GetAmbienceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kAmbience; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetGUIVolume() +float pyAudioControl::GetGUIVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kGUI; return plgAudioSys::GetChannelVolume(chan); } -hsScalar pyAudioControl::GetNPCVoiceVolume() +float pyAudioControl::GetNPCVoiceVolume() { plgAudioSys::ASChannel chan; chan = plgAudioSys::kNPCVoice; @@ -271,7 +271,7 @@ hsBool pyAudioControl::CanSetMicLevel() return plWinMicLevel::CanSetLevel(); } -void pyAudioControl::SetMicLevel( hsScalar level ) +void pyAudioControl::SetMicLevel( float level ) { // make sure the volume is within range if( level > 1.f ) @@ -282,7 +282,7 @@ void pyAudioControl::SetMicLevel( hsScalar level ) plWinMicLevel::SetLevel( level ); } -hsScalar pyAudioControl::GetMicLevel() +float pyAudioControl::GetMicLevel() { return plWinMicLevel::GetLevel(); } @@ -348,7 +348,7 @@ void pyAudioControl::PushToTalk( hsBool state ) } // Set the squelch level -void pyAudioControl::SquelchLevel( hsScalar level ) +void pyAudioControl::SquelchLevel( float level ) { plVoiceRecorder::SetSquelch(level); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h index 0742aa37..df678b94 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyAudioControl.h @@ -71,18 +71,18 @@ public: // Audio settings // Sets the master volume of a given audio channel - virtual void SetSoundFXVolume( hsScalar volume ); - virtual void SetMusicVolume( hsScalar volume ); - virtual void SetVoiceVolume( hsScalar volume ); - virtual void SetAmbienceVolume( hsScalar volume ); - virtual void SetGUIVolume( hsScalar volume ); - virtual void SetNPCVoiceVolume( hsScalar volume ); - virtual hsScalar GetSoundFXVolume(); - virtual hsScalar GetMusicVolume(); - virtual hsScalar GetVoiceVolume(); - virtual hsScalar GetAmbienceVolume(); - virtual hsScalar GetGUIVolume(); - virtual hsScalar GetNPCVoiceVolume(); + virtual void SetSoundFXVolume( float volume ); + virtual void SetMusicVolume( float volume ); + virtual void SetVoiceVolume( float volume ); + virtual void SetAmbienceVolume( float volume ); + virtual void SetGUIVolume( float volume ); + virtual void SetNPCVoiceVolume( float volume ); + virtual float GetSoundFXVolume(); + virtual float GetMusicVolume(); + virtual float GetVoiceVolume(); + virtual float GetAmbienceVolume(); + virtual float GetGUIVolume(); + virtual float GetNPCVoiceVolume(); // Switch DirectX Audio on or off at runtime virtual void Enable(); @@ -124,8 +124,8 @@ public: // Sets the microphone volume, in the range of 0 to 1 virtual hsBool CanSetMicLevel(); - virtual void SetMicLevel( hsScalar level ); - virtual hsScalar GetMicLevel(); + virtual void SetMicLevel( float level ); + virtual float GetMicLevel(); // turn voice recording on or off virtual void EnableVoiceRecording( hsBool state ); @@ -149,7 +149,7 @@ public: virtual void PushToTalk( hsBool state ); // Set the squelch level - virtual void SquelchLevel( hsScalar level ); + virtual void SquelchLevel( float level ); // Adjust voice packet frame size virtual void RecordFrame( int32_t size ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp b/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp index ca44acf2..06f68e84 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyColor.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "pyColor.h" -pyColor::pyColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) +pyColor::pyColor(float r, float g, float b, float a) { fColor.Set(r, g, b ,a); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColor.h b/Sources/Plasma/FeatureLib/pfPython/pyColor.h index c4e36439..9b311e85 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColor.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyColor.h @@ -59,14 +59,14 @@ private: hsColorRGBA fColor; protected: - pyColor(hsScalar r=0.0f, hsScalar g=0.0f, hsScalar b=0.0f, hsScalar a=0.0f); + pyColor(float r=0.0f, float g=0.0f, float b=0.0f, float a=0.0f); pyColor(hsColorRGBA color); public: // required functions for PyObject interoperability PYTHON_CLASS_NEW_FRIEND(ptColor); PYTHON_CLASS_NEW_DEFINITION; - static PyObject *New(hsScalar red, hsScalar green, hsScalar blue, hsScalar alpha = 0.0f); + static PyObject *New(float red, float green, float blue, float alpha = 0.0f); static PyObject *New(const hsColorRGBA & color); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyColor object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyColor); // converts a PyObject to a pyColor (throws error if not correct type) @@ -78,16 +78,16 @@ public: void setColor(hsColorRGBA color) { fColor = color; } // python get attributes helpers - hsScalar getRed() const { return fColor.r; } - hsScalar getGreen() const { return fColor.g; } - hsScalar getBlue() const { return fColor.b; } - hsScalar getAlpha() const { return fColor.a; } + float getRed() const { return fColor.r; } + float getGreen() const { return fColor.g; } + float getBlue() const { return fColor.b; } + float getAlpha() const { return fColor.a; } // python set attributes helpers - void setRed(hsScalar red) { fColor.r = red; } - void setGreen(hsScalar green) { fColor.g = green; } - void setBlue(hsScalar blue) { fColor.b = blue; } - void setAlpha(hsScalar alpha) { fColor.a = alpha; } + void setRed(float red) { fColor.r = red; } + void setGreen(float green) { fColor.g = green; } + void setBlue(float blue) { fColor.b = blue; } + void setAlpha(float alpha) { fColor.a = alpha; } // override the equals to operator hsBool operator==(const pyColor &color) const diff --git a/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp index 9ef3d9db..9c95fe1a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyColorGlue.cpp @@ -280,7 +280,7 @@ PLASMA_CUSTOM_TYPE(ptColor, "Params: red=0, green=0, blue=0, alpha=0\nPlasma col // required functions for PyObject interoperability PYTHON_CLASS_NEW_IMPL(ptColor, pyColor) -PyObject *pyColor::New(hsScalar red, hsScalar green, hsScalar blue, hsScalar alpha) +PyObject *pyColor::New(float red, float green, float blue, float alpha) { ptColor *newObj = (ptColor*)ptColor_type.tp_new(&ptColor_type, NULL, NULL); newObj->fThis->setRed(red); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp index f5c961ca..b4883bdf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp @@ -172,56 +172,56 @@ bool pyCritterBrain::AtGoal() const return fBrain->AtGoal(); } -void pyCritterBrain::StopDistance(hsScalar stopDistance) +void pyCritterBrain::StopDistance(float stopDistance) { if (!fBrain) return; fBrain->StopDistance(stopDistance); } -hsScalar pyCritterBrain::StopDistance() const +float pyCritterBrain::StopDistance() const { if (!fBrain) return 0; return fBrain->StopDistance(); } -void pyCritterBrain::SightCone(hsScalar coneRad) +void pyCritterBrain::SightCone(float coneRad) { if (!fBrain) return; fBrain->SightCone(coneRad); } -hsScalar pyCritterBrain::SightCone() const +float pyCritterBrain::SightCone() const { if (!fBrain) return 0; return fBrain->SightCone(); } -void pyCritterBrain::SightDistance(hsScalar sightDis) +void pyCritterBrain::SightDistance(float sightDis) { if (!fBrain) return; fBrain->SightDistance(sightDis); } -hsScalar pyCritterBrain::SightDistance() const +float pyCritterBrain::SightDistance() const { if (!fBrain) return 0; return fBrain->SightDistance(); } -void pyCritterBrain::HearingDistance(hsScalar hearDis) +void pyCritterBrain::HearingDistance(float hearDis) { if (!fBrain) return; fBrain->HearingDistance(hearDis); } -hsScalar pyCritterBrain::HearingDistance() const +float pyCritterBrain::HearingDistance() const { if (!fBrain) return 0; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h index b60cc849..8f211ae9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h @@ -104,15 +104,15 @@ public: bool AvoidingAvatars() const; bool AtGoal() const; - void StopDistance(hsScalar stopDistance); - hsScalar StopDistance() const; - - void SightCone(hsScalar coneRad); - hsScalar SightCone() const; - void SightDistance(hsScalar sightDis); - hsScalar SightDistance() const; - void HearingDistance(hsScalar hearDis); - hsScalar HearingDistance() const; + void StopDistance(float stopDistance); + float StopDistance() const; + + void SightCone(float coneRad); + float SightCone() const; + void SightDistance(float sightDis); + float SightDistance() const; + void HearingDistance(float hearDis); + float HearingDistance() const; bool CanSeeAvatar(unsigned long id) const; bool CanHearAvatar(unsigned long id) const; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp index d27330a8..37c13498 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.cpp @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAvatar/plArmatureMod.h" #endif -void pyDrawControl::SetGamma2(hsScalar gamma) +void pyDrawControl::SetGamma2(float gamma) { #ifndef BUILDING_PYPLASMA char command[256]; @@ -77,14 +77,14 @@ void pyDrawControl::SetGamma2(hsScalar gamma) #include "plGLight/plShadowMaster.h" #endif -void pyDrawControl::SetShadowVisDistance(hsScalar distance) +void pyDrawControl::SetShadowVisDistance(float distance) { #ifndef BUILDING_PYPLASMA plShadowMaster::SetGlobalShadowQuality(distance); #endif } -hsScalar pyDrawControl::GetShadowVisDistance() +float pyDrawControl::GetShadowVisDistance() { #ifndef BUILDING_PYPLASMA return plShadowMaster::GetGlobalShadowQuality(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h index d271744e..6cb93a8a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyDrawControl.h @@ -65,9 +65,9 @@ public: //static void AddPlasmaConstantsClasses(PyObject* m); // static python functions - static void SetGamma2(hsScalar gamma); - static void SetShadowVisDistance(hsScalar distance); - static hsScalar GetShadowVisDistance(); + static void SetGamma2(float gamma); + static void SetShadowVisDistance(float distance); + static float GetShadowVisDistance(); static void EnableShadows(); static void DisableShadows(); static hsBool IsShadowsEnabled(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp index d37659ef..7baee232 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp @@ -351,7 +351,7 @@ uint32_t pyGUIControl::GetFontSize() // set color scheme -void pyGUIControl::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetForeColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -371,7 +371,7 @@ void pyGUIControl::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a } } -void pyGUIControl::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -391,7 +391,7 @@ void pyGUIControl::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIControl::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetBackColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -411,7 +411,7 @@ void pyGUIControl::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a } } -void pyGUIControl::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIControl::SetBackSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h index 6d577223..d2d854d7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h @@ -122,10 +122,10 @@ public: virtual PyObject* GetBackSelColor(); // returns pyColor virtual uint32_t GetFontSize(); // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); virtual void SetFontSize(uint32_t fontsize); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp index 6a9dd86d..8af06942 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.cpp @@ -69,7 +69,7 @@ hsBool pyGUIControlValue::IsGUIControlValue(pyKey& gckey) } -hsScalar pyGUIControlValue::GetValue() +float pyGUIControlValue::GetValue() { if ( fGCkey ) { @@ -81,7 +81,7 @@ hsScalar pyGUIControlValue::GetValue() return 0.0; } -void pyGUIControlValue::SetValue( hsScalar v ) +void pyGUIControlValue::SetValue( float v ) { if ( fGCkey ) { @@ -92,7 +92,7 @@ void pyGUIControlValue::SetValue( hsScalar v ) } } -hsScalar pyGUIControlValue::GetMin( void ) +float pyGUIControlValue::GetMin( void ) { if ( fGCkey ) { @@ -104,7 +104,7 @@ hsScalar pyGUIControlValue::GetMin( void ) return 0.0; } -hsScalar pyGUIControlValue::GetMax( void ) +float pyGUIControlValue::GetMax( void ) { if ( fGCkey ) { @@ -116,7 +116,7 @@ hsScalar pyGUIControlValue::GetMax( void ) return 0.0; } -hsScalar pyGUIControlValue::GetStep( void ) +float pyGUIControlValue::GetStep( void ) { if ( fGCkey ) { @@ -128,7 +128,7 @@ hsScalar pyGUIControlValue::GetStep( void ) return 0.0; } -void pyGUIControlValue::SetRange( hsScalar min, hsScalar max ) +void pyGUIControlValue::SetRange( float min, float max ) { if ( fGCkey ) { @@ -139,7 +139,7 @@ void pyGUIControlValue::SetRange( hsScalar min, hsScalar max ) } } -void pyGUIControlValue::SetStep( hsScalar step ) +void pyGUIControlValue::SetStep( float step ) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h index 3226d8b6..01290ec8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlValue.h @@ -75,13 +75,13 @@ public: static hsBool IsGUIControlValue(pyKey& gckey); - virtual hsScalar GetValue(); - virtual void SetValue( hsScalar v ); - virtual hsScalar GetMin( void ); - virtual hsScalar GetMax( void ); - virtual hsScalar GetStep( void ); - virtual void SetRange( hsScalar min, hsScalar max ); - virtual void SetStep( hsScalar step ); + virtual float GetValue(); + virtual void SetValue( float v ); + virtual float GetMin( void ); + virtual float GetMax( void ); + virtual float GetStep( void ); + virtual void SetRange( float min, float max ); + virtual void SetStep( float step ); }; class pyGUIControlKnob : public pyGUIControlValue diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp index 42973242..71ecf7b6 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.cpp @@ -392,7 +392,7 @@ uint32_t pyGUIDialog::GetFontSize() // set color scheme -void pyGUIDialog::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetForeColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -412,7 +412,7 @@ void pyGUIDialog::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -432,7 +432,7 @@ void pyGUIDialog::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetBackColor( float r, float g, float b, float a ) { if ( fGCkey ) { @@ -452,7 +452,7 @@ void pyGUIDialog::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) } } -void pyGUIDialog::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIDialog::SetBackSelColor( float r, float g, float b, float a ) { if ( fGCkey ) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h index e8b63fe7..5e2689b9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIDialog.h @@ -142,10 +142,10 @@ public: virtual PyObject* GetBackSelColor(); // returns pyColor virtual uint32_t GetFontSize(); // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); virtual void SetFontSize(uint32_t fontsize); virtual void UpdateAllBounds( void ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp index 313061d0..78d8268d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.cpp @@ -89,7 +89,7 @@ pyGUIPopUpMenu::pyGUIPopUpMenu() fBuiltMenu = nil; } -pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc/* = plLocation::kGlobalFixedLoc */) +pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc/* = plLocation::kGlobalFixedLoc */) { fBuiltMenu = pfGUIPopUpMenu::Build( name, nil, screenOriginX, screenOriginY, destLoc ); if( fBuiltMenu != nil ) @@ -101,7 +101,7 @@ pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScal fGCkey = nil; } -pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY ) +pyGUIPopUpMenu::pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY ) { pfGUIPopUpMenu *parentMenu = pfGUIPopUpMenu::ConvertNoRef( parent.fGCkey->ObjectIsLoaded() ); @@ -140,7 +140,7 @@ void pyGUIPopUpMenu::setup(plKey objkey) fGCkey = objkey; } -void pyGUIPopUpMenu::setup(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) +void pyGUIPopUpMenu::setup(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) { // kill any previous menu if( fBuiltMenu != nil ) @@ -160,7 +160,7 @@ void pyGUIPopUpMenu::setup(const char *name, hsScalar screenOriginX, hsScalar sc fGCkey = nil; } -void pyGUIPopUpMenu::setup(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY) +void pyGUIPopUpMenu::setup(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY) { // kill any previous menu if( fBuiltMenu != nil ) @@ -299,7 +299,7 @@ PyObject* pyGUIPopUpMenu::GetBackSelColor() } // set color scheme -void pyGUIPopUpMenu::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetForeColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -314,7 +314,7 @@ void pyGUIPopUpMenu::SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar color->fForeColor.a = a; } -void pyGUIPopUpMenu::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetSelColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -329,7 +329,7 @@ void pyGUIPopUpMenu::SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a color->fSelForeColor.a = a; } -void pyGUIPopUpMenu::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetBackColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); @@ -344,7 +344,7 @@ void pyGUIPopUpMenu::SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar color->fBackColor.a = a; } -void pyGUIPopUpMenu::SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ) +void pyGUIPopUpMenu::SetBackSelColor( float r, float g, float b, float a ) { kGetMenuPtr( ; ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h index 7df97082..4f453ba5 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h @@ -70,8 +70,8 @@ protected: pyGUIPopUpMenu(plKey objkey); pyGUIPopUpMenu(); // For creating new menus on the fly - pyGUIPopUpMenu( const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); - pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY ); + pyGUIPopUpMenu( const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc ); + pyGUIPopUpMenu( const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY ); public: virtual ~pyGUIPopUpMenu(); @@ -81,8 +81,8 @@ public: PYTHON_CLASS_NEW_DEFINITION; static PyObject *New(pyKey& gckey); static PyObject *New(plKey objkey); - static PyObject *New(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); - static PyObject *New(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY); + static PyObject *New(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); + static PyObject *New(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyGUIPopUpMenu object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyGUIPopUpMenu); // converts a PyObject to a pyGUIPopUpMenu (throws error if not correct type) @@ -90,8 +90,8 @@ public: // these three are for the python glue only, do NOT call void setup(plKey objkey); - void setup(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); - void setup(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY); + void setup(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc = plLocation::kGlobalFixedLoc); + void setup(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY); static hsBool IsGUIPopUpMenu(pyKey& gckey); @@ -122,10 +122,10 @@ public: virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor // set color scheme - virtual void SetForeColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); - virtual void SetBackSelColor( hsScalar r, hsScalar g, hsScalar b, hsScalar a ); + virtual void SetForeColor( float r, float g, float b, float a ); + virtual void SetSelColor( float r, float g, float b, float a ); + virtual void SetBackColor( float r, float g, float b, float a ); + virtual void SetBackSelColor( float r, float g, float b, float a ); // Menu item functions virtual void AddConsoleCmdItem( const char *name, const char *consoleCmd ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp index 801936d6..fac7ba72 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenuGlue.cpp @@ -417,14 +417,14 @@ PyObject *pyGUIPopUpMenu::New(plKey objkey) return (PyObject*)newObj; } -PyObject *pyGUIPopUpMenu::New(const char *name, hsScalar screenOriginX, hsScalar screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) +PyObject *pyGUIPopUpMenu::New(const char *name, float screenOriginX, float screenOriginY, const plLocation &destLoc /* = plLocation::kGlobalFixedLoc */) { ptGUIPopUpMenu *newObj = (ptGUIPopUpMenu*)ptGUIPopUpMenu_type.tp_new(&ptGUIPopUpMenu_type, NULL, NULL); newObj->fThis->setup(name, screenOriginX, screenOriginY, destLoc); return (PyObject*)newObj; } -PyObject *pyGUIPopUpMenu::New(const char *name, pyGUIPopUpMenu &parent, hsScalar screenOriginX, hsScalar screenOriginY) +PyObject *pyGUIPopUpMenu::New(const char *name, pyGUIPopUpMenu &parent, float screenOriginX, float screenOriginY) { ptGUIPopUpMenu *newObj = (ptGUIPopUpMenu*)ptGUIPopUpMenu_type.tp_new(&ptGUIPopUpMenu_type, NULL, NULL); newObj->fThis->setup(name, parent, screenOriginX, screenOriginY); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h b/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h index 7db09072..92df489b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGeometry3.h @@ -57,7 +57,7 @@ class pyPoint3 { protected: pyPoint3() : fPoint(0,0,0) {} - pyPoint3(hsScalar x, hsScalar y, hsScalar z) : fPoint(x,y,z) {} + pyPoint3(float x, float y, float z) : fPoint(x,y,z) {} pyPoint3(hsPoint3 pt) : fPoint(pt.fX,pt.fY,pt.fZ) {} public: @@ -73,20 +73,20 @@ public: hsPoint3 fPoint; // python get attributes helpers - hsScalar getX() { return fPoint.fX; } - hsScalar getY() { return fPoint.fY; } - hsScalar getZ() { return fPoint.fZ; } + float getX() { return fPoint.fX; } + float getY() { return fPoint.fY; } + float getZ() { return fPoint.fZ; } // python set attributes helpers - void setX(hsScalar x) { fPoint.fX = x; } - void setY(hsScalar y) { fPoint.fY = y; } - void setZ(hsScalar z) { fPoint.fZ = z; } + void setX(float x) { fPoint.fX = x; } + void setY(float y) { fPoint.fY = y; } + void setZ(float z) { fPoint.fZ = z; } // methods to manipulate point3's void Zero() { fPoint.fX=0; fPoint.fY=0; fPoint.fZ=0; } PyObject* Copy() { return pyPoint3::New(fPoint); } - hsScalar Distance(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).Magnitude(); } - hsScalar DistanceSquared(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).MagnitudeSquared(); } + float Distance(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).Magnitude(); } + float DistanceSquared(pyPoint3 other) { return hsVector3(&fPoint,&other.fPoint).MagnitudeSquared(); } }; @@ -94,7 +94,7 @@ class pyVector3 { protected: pyVector3() : fVector(0,0,0) {} - pyVector3(hsScalar x, hsScalar y, hsScalar z) : fVector(x,y,z) {} + pyVector3(float x, float y, float z) : fVector(x,y,z) {} pyVector3(hsVector3 v) : fVector(v.fX,v.fY,v.fZ) {} public: @@ -110,14 +110,14 @@ public: hsVector3 fVector; // python get attributes helpers - hsScalar getX() { return fVector.fX; } - hsScalar getY() { return fVector.fY; } - hsScalar getZ() { return fVector.fZ; } + float getX() { return fVector.fX; } + float getY() { return fVector.fY; } + float getZ() { return fVector.fZ; } // python set attributes helpers - void setX(hsScalar x) { fVector.fX = x; } - void setY(hsScalar y) { fVector.fY = y; } - void setZ(hsScalar z) { fVector.fZ = z; } + void setX(float x) { fVector.fX = x; } + void setY(float y) { fVector.fY = y; } + void setZ(float z) { fVector.fZ = z; } // operator methods PyObject* operator+(const pyVector3& b) const { return pyVector3::New(fVector + b.fVector); } @@ -125,12 +125,12 @@ public: // methods to manipulate vectors void Normalize() { fVector.Normalize(); } - hsScalar Dot(pyVector3 other) { return fVector*other.fVector;} + float Dot(pyVector3 other) { return fVector*other.fVector;} PyObject* Cross(pyVector3 other) {return pyVector3::New(fVector%other.fVector); } - hsScalar Magnitude() { return fVector.Magnitude(); } - hsScalar MagnitudeSquared() { return fVector.MagnitudeSquared(); } + float Magnitude() { return fVector.Magnitude(); } + float MagnitudeSquared() { return fVector.MagnitudeSquared(); } void Zero() { fVector.fX=0; fVector.fY=0; fVector.fZ=0; } - PyObject* Scale(hsScalar scale) { return pyVector3::New(fVector * scale); } + PyObject* Scale(float scale) { return pyVector3::New(fVector * scale); } PyObject* Add(pyVector3& other) { return pyVector3::New(fVector + other.fVector); } PyObject* Subtract(pyVector3& other) { return pyVector3::New(fVector - other.fVector); } PyObject* Copy() { return pyVector3::New(fVector); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp index 95050610..daf22061 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.cpp @@ -66,7 +66,7 @@ void pyGrassShader::SetKey(plKey key) // Setter functions ////////////////////////////////////////////////////////////////////// -void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & distortion) +void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & distortion) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -95,7 +95,7 @@ void pyGrassShader::SetWaveDistortion(int waveNum, const std::vector & } } -void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & direction) +void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & direction) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -123,7 +123,7 @@ void pyGrassShader::SetWaveDirection(int waveNum, const std::vector & } } -void pyGrassShader::SetWaveSpeed(int waveNum, hsScalar speed) +void pyGrassShader::SetWaveSpeed(int waveNum, float speed) { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { @@ -147,9 +147,9 @@ void pyGrassShader::SetWaveSpeed(int waveNum, hsScalar speed) // Getter functions ////////////////////////////////////////////////////////////////////// -std::vector pyGrassShader::GetWaveDistortion(int waveNum) const +std::vector pyGrassShader::GetWaveDistortion(int waveNum) const { - std::vector retVal; + std::vector retVal; retVal.push_back(-1); retVal.push_back(-1); retVal.push_back(-1); @@ -174,9 +174,9 @@ std::vector pyGrassShader::GetWaveDistortion(int waveNum) const return retVal; } -std::vector pyGrassShader::GetWaveDirection(int waveNum) const +std::vector pyGrassShader::GetWaveDirection(int waveNum) const { - std::vector retVal; + std::vector retVal; retVal.push_back(-1); retVal.push_back(-1); if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) @@ -199,7 +199,7 @@ std::vector pyGrassShader::GetWaveDirection(int waveNum) const return retVal; } -hsScalar pyGrassShader::GetWaveSpeed(int waveNum) const +float pyGrassShader::GetWaveSpeed(int waveNum) const { if ((waveNum < 0)||(waveNum >= plGrassShaderMod::kNumWaves)) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h index a32fee43..195c014f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShader.h @@ -77,13 +77,13 @@ public: void SetKey(plKey key); - void SetWaveDistortion(int waveNum, const std::vector & distortion); - void SetWaveDirection(int waveNum, const std::vector & direction); - void SetWaveSpeed(int waveNum, hsScalar speed); + void SetWaveDistortion(int waveNum, const std::vector & distortion); + void SetWaveDirection(int waveNum, const std::vector & direction); + void SetWaveSpeed(int waveNum, float speed); - std::vector GetWaveDistortion(int waveNum) const; - std::vector GetWaveDirection(int waveNum) const; - hsScalar GetWaveSpeed(int waveNum) const; + std::vector GetWaveDistortion(int waveNum) const; + std::vector GetWaveDirection(int waveNum) const; + float GetWaveSpeed(int waveNum) const; void ResetWaves(); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp index 88723cd5..876a32be 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGrassShaderGlue.cpp @@ -85,7 +85,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDistortion, args) } int len = PyTuple_Size(tupleObject); - std::vector vecArgs; + std::vector vecArgs; for (int curArg = 0; curArg < len; curArg++) { PyObject *arg = PyTuple_GetItem(tupleObject, curArg); @@ -94,7 +94,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDistortion, args) PyErr_SetString(PyExc_TypeError, "setWaveDistortion expects a integer and tuple of floats"); PYTHON_RETURN_ERROR; } - vecArgs.push_back((hsScalar)PyFloat_AsDouble(arg)); + vecArgs.push_back((float)PyFloat_AsDouble(arg)); } self->fThis->SetWaveDistortion(waveNum, vecArgs); @@ -117,7 +117,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDirection, args) } int len = PyTuple_Size(tupleObject); - std::vector vecArgs; + std::vector vecArgs; for (int curArg = 0; curArg < len; curArg++) { PyObject *arg = PyTuple_GetItem(tupleObject, curArg); @@ -126,7 +126,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, setWaveDirection, args) PyErr_SetString(PyExc_TypeError, "setWaveDirection expects a integer and tuple of floats"); PYTHON_RETURN_ERROR; } - vecArgs.push_back((hsScalar)PyFloat_AsDouble(arg)); + vecArgs.push_back((float)PyFloat_AsDouble(arg)); } self->fThis->SetWaveDirection(waveNum, vecArgs); @@ -155,7 +155,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, getWaveDistortion, args) PYTHON_RETURN_ERROR; } - std::vector vecArgs = self->fThis->GetWaveDistortion(waveNum); + std::vector vecArgs = self->fThis->GetWaveDistortion(waveNum); PyObject *retVal = PyTuple_New(vecArgs.size()); for (int curArg = 0; curArg < vecArgs.size(); curArg++) PyTuple_SetItem(retVal, curArg, PyFloat_FromDouble((double)vecArgs[curArg])); @@ -171,7 +171,7 @@ PYTHON_METHOD_DEFINITION(ptGrassShader, getWaveDirection, args) PYTHON_RETURN_ERROR; } - std::vector vecArgs = self->fThis->GetWaveDirection(waveNum); + std::vector vecArgs = self->fThis->GetWaveDirection(waveNum); PyObject *retVal = PyTuple_New(vecArgs.size()); for (int curArg = 0; curArg < vecArgs.size(); curArg++) PyTuple_SetItem(retVal, curArg, PyFloat_FromDouble((double)vecArgs[curArg])); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp index c7693ee8..c4dc9d99 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp @@ -209,7 +209,7 @@ void pyJournalBook::GoToPage( uint32_t page ) fBook->GoToPage( page ); } -void pyJournalBook::SetSize( hsScalar width, hsScalar height ) +void pyJournalBook::SetSize( float width, float height ) { if( fBook != nil ) fBook->SetBookSize( width, height ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h index 6fa72c39..23c6b085 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h @@ -115,7 +115,7 @@ public: virtual void SetPageMargin( uint32_t margin ); virtual void AllowPageTurning( bool allow ); - virtual void SetSize( hsScalar width, hsScalar height ); + virtual void SetSize( float width, float height ); virtual void SetGUI( const char *guiName ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp index 60976819..62793f3e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.cpp @@ -83,9 +83,9 @@ PyObject* pyMatrix44::GetTranslate(PyObject* pt) return pt; } -hsScalar* pyMatrix44::GetData() +float* pyMatrix44::GetData() { - hsScalar *res = new hsScalar[4*4]; + float *res = new float[4*4]; res[0] = fMatrix.fMap[0][0]; res[1] = fMatrix.fMap[0][1]; res[2] = fMatrix.fMap[0][2]; res[3] = fMatrix.fMap[0][3]; res[4] = fMatrix.fMap[1][0]; res[5] = fMatrix.fMap[1][1]; res[6] = fMatrix.fMap[1][2]; res[7] = fMatrix.fMap[1][3]; res[8] = fMatrix.fMap[2][0]; res[9] = fMatrix.fMap[2][1]; res[10] = fMatrix.fMap[2][2]; res[11] = fMatrix.fMap[2][3]; @@ -94,7 +94,7 @@ hsScalar* pyMatrix44::GetData() return res; } -void pyMatrix44::SetData(const hsScalar mat[]) +void pyMatrix44::SetData(const float mat[]) { fMatrix.fMap[0][0] = mat[0]; fMatrix.fMap[0][1] = mat[1]; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h index 11a8b4a9..05382273 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44.h @@ -78,15 +78,15 @@ public: PyObject* Copy() { return pyMatrix44::New(fMatrix); } // returns pyMatrix44 void Translate(pyVector3 v) { fMatrix.Translate(&v.fVector); } void Scale(pyVector3 v) { fMatrix.Scale(&v.fVector); } - void Rotate(int axis, hsScalar radians) { fMatrix.Rotate(axis,radians); } + void Rotate(int axis, float radians) { fMatrix.Rotate(axis,radians); } void Reset() { fMatrix.Reset(); } void MakeTranslateMat(pyVector3 trans) { fMatrix.MakeTranslateMat(&trans.fVector); } void MakeScaleMat(pyVector3 scale) { fMatrix.MakeScaleMat(&scale.fVector); } - void MakeRotateMat(int axis, hsScalar radians) { fMatrix.MakeRotateMat(axis,radians); } + void MakeRotateMat(int axis, float radians) { fMatrix.MakeRotateMat(axis,radians); } void Make(pyPoint3 from,pyPoint3 at,pyVector3 up) { fMatrix.Make(&from.fPoint,&at.fPoint,&up.fVector); } void MakeUpPreserving(pyPoint3 from,pyPoint3 at,pyVector3 up) { fMatrix.MakeUpPreserving(&from.fPoint,&at.fPoint,&up.fVector); } hsBool GetParity() { return fMatrix.GetParity(); } - hsScalar GetDeterminant() { return fMatrix.GetDeterminant(); } + float GetDeterminant() { return fMatrix.GetDeterminant(); } PyObject* GetInverse(PyObject* inverse); // returns (and accepts) pyMatrix44 PyObject* GetTranspose(PyObject* inverse); // returns (and accepts) pyMatrix44 PyObject* GetAdjoint(PyObject* adjoint); // returns (and accepts) pyMatrix44 @@ -95,8 +95,8 @@ public: PyObject* GetUpAxis() { return pyVector3::New(fMatrix.GetAxis(hsMatrix44::kUp)); } // returns pyVector3 PyObject* GetRightAxis() { return pyVector3::New(fMatrix.GetAxis(hsMatrix44::kRight)); } // returns pyVector3 - hsScalar* GetData(); - void SetData(const hsScalar mat[]); + float* GetData(); + void SetData(const float mat[]); }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp index f6705629..df040509 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMatrix44Glue.cpp @@ -300,7 +300,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, right) PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, getData) { - hsScalar *mat = self->fThis->GetData(); + float *mat = self->fThis->GetData(); PyObject *retVal = Py_BuildValue("(ffff)(ffff)(ffff)(ffff)", mat[0], mat[1], mat[2], mat[3], @@ -320,7 +320,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptMatrix44, getData) PYTHON_METHOD_DEFINITION(ptMatrix44, setData, args) { - hsScalar mat[4*4]; + float mat[4*4]; if (!PyArg_ParseTuple(args, "((ffff)(ffff)(ffff)(ffff))", &mat[0], &mat[1], &mat[2], &mat[3], diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp index f2dbddee..151ccbe7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.cpp @@ -93,7 +93,7 @@ void pyMoviePlayer::MakeMovie(const char* movieName, pyKey& selfKey) } } -void pyMoviePlayer::SetCenter(hsScalar x, hsScalar y) +void pyMoviePlayer::SetCenter(float x, float y) { if ( fMovieName) { @@ -105,7 +105,7 @@ void pyMoviePlayer::SetCenter(hsScalar x, hsScalar y) } } -void pyMoviePlayer::SetScale(hsScalar width, hsScalar height) +void pyMoviePlayer::SetScale(float width, float height) { if ( fMovieName) { @@ -128,7 +128,7 @@ void pyMoviePlayer::SetColor(pyColor color) } } -void pyMoviePlayer::SetVolume(hsScalar volume) +void pyMoviePlayer::SetVolume(float volume) { if ( fMovieName) { @@ -139,7 +139,7 @@ void pyMoviePlayer::SetVolume(hsScalar volume) } } -void pyMoviePlayer::SetOpacity(hsScalar opacity) +void pyMoviePlayer::SetOpacity(float opacity) { if ( fMovieName) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h index 38a53253..0e6a0faf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyMoviePlayer.h @@ -77,11 +77,11 @@ public: void MakeMovie(const char* movieName, pyKey& selfKey); // only used by python glue, do NOT call // getters and setters - virtual void SetCenter(hsScalar x, hsScalar y); - virtual void SetScale(hsScalar width, hsScalar height); + virtual void SetCenter(float x, float y); + virtual void SetScale(float width, float height); virtual void SetColor(pyColor color); - virtual void SetVolume(hsScalar volume); - virtual void SetOpacity(hsScalar opacity); + virtual void SetVolume(float volume); + virtual void SetOpacity(float opacity); // actions virtual void Play(); // kStart diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp index 1dc25e21..ef0147f3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.cpp @@ -112,7 +112,7 @@ void pyNotify::SetNetForce(hsBool state) } -void pyNotify::SetActivateState(hsScalar state) +void pyNotify::SetActivateState(float state) { fBuildMsg.SetState(state); } @@ -146,7 +146,7 @@ void pyNotify::AddControlKeyEvent( int32_t key, hsBool down ) fBuildMsg.AddControlKeyEvent(key,down); } -void pyNotify::AddVarNumber(const char* name, hsScalar number) +void pyNotify::AddVarNumber(const char* name, float number) { fBuildMsg.AddVariableEvent(name,number); } @@ -156,7 +156,7 @@ void pyNotify::AddVarKey(const char* name, pyKey* key) fBuildMsg.AddVariableEvent(name, key ? key->getKey() : plKey() ); } -void pyNotify::AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, hsScalar dot) +void pyNotify::AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, float dot) { fBuildMsg.AddFacingEvent( other ? other->getKey() : plKey(), self ? self->getKey() : plKey(), diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h index d186deff..72eb86c7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNotify.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNotify.h @@ -92,16 +92,16 @@ public: virtual void AddReceiver(pyKey* key); virtual void SetNetPropagate(hsBool propagate); virtual void SetNetForce(hsBool state); - virtual void SetActivateState(hsScalar state); + virtual void SetActivateState(float state); virtual void SetType(int32_t type); // add event record helpers virtual void AddCollisionEvent( hsBool enter, pyKey* other, pyKey* self ); virtual void AddPickEvent(hsBool enabled, pyKey* other, pyKey* self, pyPoint3 hitPoint); virtual void AddControlKeyEvent( int32_t key, hsBool down ); - virtual void AddVarNumber(const char* name, hsScalar number); + virtual void AddVarNumber(const char* name, float number); virtual void AddVarKey(const char* name, pyKey* key); - virtual void AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, hsScalar dot); + virtual void AddFacingEvent( hsBool enabled, pyKey* other, pyKey* self, float dot); virtual void AddContainerEvent( hsBool entering, pyKey* container, pyKey* contained); virtual void AddActivateEvent( hsBool active, hsBool activate ); virtual void AddCallbackEvent( int32_t event ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp index 05e1390d..e12d329a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.cpp @@ -51,7 +51,7 @@ pyPlayer::pyPlayer() // only used by python glue, do NOT call fIsServer = false; } -pyPlayer::pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, hsScalar distsq) +pyPlayer::pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, float distsq) { fAvatarKey = avKey.getKey(); fPlayerName = pname; @@ -61,7 +61,7 @@ pyPlayer::pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, hsScalar dists fIsServer = false; } -pyPlayer::pyPlayer(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq) +pyPlayer::pyPlayer(plKey avKey, const char* pname, uint32_t pid, float distsq) { fAvatarKey = avKey; fPlayerName = pname; @@ -82,7 +82,7 @@ pyPlayer::pyPlayer(const char* pname, uint32_t pid) fIsServer = false; } -void pyPlayer::Init(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq) // used by python glue, do NOT call +void pyPlayer::Init(plKey avKey, const char* pname, uint32_t pid, float distsq) // used by python glue, do NOT call { fAvatarKey = avKey; fPlayerName = pname; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h index 6e14449b..a90c716e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h @@ -63,22 +63,22 @@ protected: plKey fAvatarKey; std::string fPlayerName; uint32_t fPlayerID; - hsScalar fDistSq; // from local player, temp + float fDistSq; // from local player, temp hsBool fIsCCR; hsBool fIsServer; pyPlayer(); // only used by python glue, do NOT call - pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, hsScalar distsq); - pyPlayer(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq); + pyPlayer(pyKey& avKey, const char* pname, uint32_t pid, float distsq); + pyPlayer(plKey avKey, const char* pname, uint32_t pid, float distsq); // another way to create a player with just a name and number pyPlayer(const char* pname, uint32_t pid); public: - void Init(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq); // used by python glue, do NOT call + void Init(plKey avKey, const char* pname, uint32_t pid, float distsq); // used by python glue, do NOT call // required functions for PyObject interoperability PYTHON_CLASS_NEW_FRIEND(ptPlayer); - static PyObject *New(pyKey& avKey, const char* pname, uint32_t pid, hsScalar distsq); - static PyObject *New(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq); + static PyObject *New(pyKey& avKey, const char* pname, uint32_t pid, float distsq); + static PyObject *New(plKey avKey, const char* pname, uint32_t pid, float distsq); static PyObject *New(const char* pname, uint32_t pid); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyPlayer object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyPlayer); // converts a PyObject to a pyPlayer (throws error if not correct type) @@ -106,7 +106,7 @@ public: return fPlayerID; } - hsScalar GetDistSq() const { return fDistSq; } + float GetDistSq() const { return fDistSq; } void SetCCRFlag(hsBool state); hsBool IsCCR(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp index d0dce535..dced2f27 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp @@ -52,12 +52,12 @@ PYTHON_DEFAULT_DEALLOC_DEFINITION(ptPlayer) PYTHON_INIT_DEFINITION(ptPlayer, args, keywords) { // we have two sets of arguments we can use, hence the generic PyObject* pointers - // argument set 1: pyKey, string, uint32_t, hsScalar + // argument set 1: pyKey, string, uint32_t, float // argument set 2: string, uint32_t PyObject* firstObj = NULL; // can be a pyKey or a string PyObject* secondObj = NULL; // can be a string or a uint32_t PyObject* thirdObj = NULL; // uint32_t - PyObject* fourthObj = NULL; // hsScalar + PyObject* fourthObj = NULL; // float if (!PyArg_ParseTuple(args, "OO|OO", &firstObj, &secondObj, &thirdObj, &fourthObj)) { PyErr_SetString(PyExc_TypeError, "__init__ expects one of two argument lists: (ptKey, string, unsigned long, float) or (string, unsigned long)"); @@ -193,14 +193,14 @@ PYTHON_END_METHODS_TABLE; PLASMA_CUSTOM_TYPE(ptPlayer, "Params: avkey,name,playerID,distanceSq\nAnd optionally __init__(name,playerID)"); // required functions for PyObject interoperability -PyObject *pyPlayer::New(pyKey& avKey, const char* pname, uint32_t pid, hsScalar distsq) +PyObject *pyPlayer::New(pyKey& avKey, const char* pname, uint32_t pid, float distsq) { ptPlayer *newObj = (ptPlayer*)ptPlayer_type.tp_new(&ptPlayer_type, NULL, NULL); newObj->fThis->Init(avKey.getKey(), pname, pid, distsq); return (PyObject*)newObj; } -PyObject *pyPlayer::New(plKey avKey, const char* pname, uint32_t pid, hsScalar distsq) +PyObject *pyPlayer::New(plKey avKey, const char* pname, uint32_t pid, float distsq) { ptPlayer *newObj = (ptPlayer*)ptPlayer_type.tp_new(&ptPlayer_type, NULL, NULL); newObj->fThis->Init(avKey, pname, pid, distsq); diff --git a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp index 9f85c8a9..a522697b 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.cpp @@ -52,7 +52,7 @@ pySwimCurrentInterface::pySwimCurrentInterface(pyKey& key) fSwimCurrentKey = key.getKey(); } -hsScalar pySwimCurrentInterface::getNearDist() +float pySwimCurrentInterface::getNearDist() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -70,7 +70,7 @@ hsScalar pySwimCurrentInterface::getNearDist() } } -void pySwimCurrentInterface::setNearDist(hsScalar val) +void pySwimCurrentInterface::setNearDist(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -84,7 +84,7 @@ void pySwimCurrentInterface::setNearDist(hsScalar val) } } -hsScalar pySwimCurrentInterface::getFarDist() +float pySwimCurrentInterface::getFarDist() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -102,7 +102,7 @@ hsScalar pySwimCurrentInterface::getFarDist() } } -void pySwimCurrentInterface::setFarDist(hsScalar val) +void pySwimCurrentInterface::setFarDist(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -116,7 +116,7 @@ void pySwimCurrentInterface::setFarDist(hsScalar val) } } -hsScalar pySwimCurrentInterface::getNearVel() +float pySwimCurrentInterface::getNearVel() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -134,7 +134,7 @@ hsScalar pySwimCurrentInterface::getNearVel() } } -void pySwimCurrentInterface::setNearVel(hsScalar val) +void pySwimCurrentInterface::setNearVel(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -148,7 +148,7 @@ void pySwimCurrentInterface::setNearVel(hsScalar val) } } -hsScalar pySwimCurrentInterface::getFarVel() +float pySwimCurrentInterface::getFarVel() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -166,7 +166,7 @@ hsScalar pySwimCurrentInterface::getFarVel() } } -void pySwimCurrentInterface::setFarVel(hsScalar val) +void pySwimCurrentInterface::setFarVel(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -180,7 +180,7 @@ void pySwimCurrentInterface::setFarVel(hsScalar val) } } -hsScalar pySwimCurrentInterface::getRotation() +float pySwimCurrentInterface::getRotation() { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); @@ -194,7 +194,7 @@ hsScalar pySwimCurrentInterface::getRotation() } } -void pySwimCurrentInterface::setRotation(hsScalar val) +void pySwimCurrentInterface::setRotation(float val) { hsKeyedObject* obj = fSwimCurrentKey->ObjectIsLoaded(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h index 70fe7564..385ca669 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySwimCurrentInterface.h @@ -69,20 +69,20 @@ public: void setKey(pyKey& key) {fSwimCurrentKey = key.getKey();} // for python glue only, do NOT call - hsScalar getNearDist(); - void setNearDist(hsScalar val); + float getNearDist(); + void setNearDist(float val); - hsScalar getFarDist(); - void setFarDist(hsScalar val); + float getFarDist(); + void setFarDist(float val); - hsScalar getNearVel(); - void setNearVel(hsScalar val); + float getNearVel(); + void setNearVel(float val); - hsScalar getFarVel(); - void setFarVel(hsScalar val); + float getFarVel(); + void setFarVel(float val); - hsScalar getRotation(); - void setRotation(hsScalar val); + float getRotation(); + void setRotation(float val); void enable(); void disable(); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp index 5b625415..c52b9e7e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.cpp @@ -56,7 +56,7 @@ pyWaveSet::pyWaveSet(pyKey& key) // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. -void pyWaveSet::SetGeoMaxLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoMaxLength(float s, float secs) { if (fWaterKey) { @@ -68,7 +68,7 @@ void pyWaveSet::SetGeoMaxLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoMinLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoMinLength(float s, float secs) { if (fWaterKey) { @@ -80,7 +80,7 @@ void pyWaveSet::SetGeoMinLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoAmpOverLen(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoAmpOverLen(float s, float secs) { if (fWaterKey) { @@ -92,7 +92,7 @@ void pyWaveSet::SetGeoAmpOverLen(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoChop(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoChop(float s, float secs) { if (fWaterKey) { @@ -104,7 +104,7 @@ void pyWaveSet::SetGeoChop(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetGeoAngleDev(hsScalar s, hsScalar secs) +void pyWaveSet::SetGeoAngleDev(float s, float secs) { if (fWaterKey) { @@ -120,7 +120,7 @@ void pyWaveSet::SetGeoAngleDev(hsScalar s, hsScalar secs) // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. -void pyWaveSet::SetTexMaxLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexMaxLength(float s, float secs) { if (fWaterKey) { @@ -132,7 +132,7 @@ void pyWaveSet::SetTexMaxLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexMinLength(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexMinLength(float s, float secs) { if (fWaterKey) { @@ -144,7 +144,7 @@ void pyWaveSet::SetTexMinLength(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexAmpOverLen(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexAmpOverLen(float s, float secs) { if (fWaterKey) { @@ -156,7 +156,7 @@ void pyWaveSet::SetTexAmpOverLen(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexChop(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexChop(float s, float secs) { if (fWaterKey) { @@ -168,7 +168,7 @@ void pyWaveSet::SetTexChop(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetTexAngleDev(hsScalar s, hsScalar secs) +void pyWaveSet::SetTexAngleDev(float s, float secs) { if (fWaterKey) { @@ -183,7 +183,7 @@ void pyWaveSet::SetTexAngleDev(hsScalar s, hsScalar secs) // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. -void pyWaveSet::SetRippleScale(hsScalar s, hsScalar secs) +void pyWaveSet::SetRippleScale(float s, float secs) { if (fWaterKey) { @@ -199,7 +199,7 @@ void pyWaveSet::SetRippleScale(hsScalar s, hsScalar secs) // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. -void pyWaveSet::SetWindDir(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetWindDir(const pyVector3& s, float secs) { if (fWaterKey) { @@ -214,7 +214,7 @@ void pyWaveSet::SetWindDir(const pyVector3& s, hsScalar secs) // -------------------------------------------------------------------------------- // Change these gently, effect is immediate. -void pyWaveSet::SetSpecularNoise(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularNoise(float s, float secs) { if (fWaterKey) { @@ -226,7 +226,7 @@ void pyWaveSet::SetSpecularNoise(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularStart(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularStart(float s, float secs) { if (fWaterKey) { @@ -238,7 +238,7 @@ void pyWaveSet::SetSpecularStart(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularEnd(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularEnd(float s, float secs) { if (fWaterKey) { @@ -253,7 +253,7 @@ void pyWaveSet::SetSpecularEnd(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Water Height is overriden if the ref object is animated. -void pyWaveSet::SetWaterHeight(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaterHeight(float s, float secs) { if (fWaterKey) { @@ -268,7 +268,7 @@ void pyWaveSet::SetWaterHeight(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. -void pyWaveSet::SetWaterOffset(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetWaterOffset(const pyVector3& s, float secs) { if (fWaterKey) { @@ -280,7 +280,7 @@ void pyWaveSet::SetWaterOffset(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetOpacOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetOpacOffset(float s, float secs) { if (fWaterKey) { @@ -292,7 +292,7 @@ void pyWaveSet::SetOpacOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetReflOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetReflOffset(float s, float secs) { if (fWaterKey) { @@ -304,7 +304,7 @@ void pyWaveSet::SetReflOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetWaveOffset(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaveOffset(float s, float secs) { if (fWaterKey) { @@ -316,7 +316,7 @@ void pyWaveSet::SetWaveOffset(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetDepthFalloff(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetDepthFalloff(const pyVector3& s, float secs) { if (fWaterKey) { @@ -328,7 +328,7 @@ void pyWaveSet::SetDepthFalloff(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetOpacFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetOpacFalloff(float s, float secs) { if (fWaterKey) { @@ -340,7 +340,7 @@ void pyWaveSet::SetOpacFalloff(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetReflFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetReflFalloff(float s, float secs) { if (fWaterKey) { @@ -352,7 +352,7 @@ void pyWaveSet::SetReflFalloff(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetWaveFalloff(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaveFalloff(float s, float secs) { if (fWaterKey) { @@ -367,7 +367,7 @@ void pyWaveSet::SetWaveFalloff(hsScalar s, hsScalar secs) // -------------------------------------------------------------------------------- // Max and Min Atten aren't very interesting, and will probably go away. -void pyWaveSet::SetMaxAtten(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetMaxAtten(const pyVector3& s, float secs) { if (fWaterKey) { @@ -379,7 +379,7 @@ void pyWaveSet::SetMaxAtten(const pyVector3& s, hsScalar secs) } } -void pyWaveSet::SetMinAtten(const pyVector3& s, hsScalar secs) +void pyWaveSet::SetMinAtten(const pyVector3& s, float secs) { if (fWaterKey) { @@ -394,7 +394,7 @@ void pyWaveSet::SetMinAtten(const pyVector3& s, hsScalar secs) // -------------------------------------------------------------------------------- // Water colors, adjust slowly, effect is immediate. -void pyWaveSet::SetWaterTint(pyColor& s, hsScalar secs) +void pyWaveSet::SetWaterTint(pyColor& s, float secs) { if (fWaterKey) { @@ -406,7 +406,7 @@ void pyWaveSet::SetWaterTint(pyColor& s, hsScalar secs) } } -void pyWaveSet::SetWaterOpacity(hsScalar s, hsScalar secs) +void pyWaveSet::SetWaterOpacity(float s, float secs) { if (fWaterKey) { @@ -418,7 +418,7 @@ void pyWaveSet::SetWaterOpacity(hsScalar s, hsScalar secs) } } -void pyWaveSet::SetSpecularTint(pyColor& s, hsScalar secs) +void pyWaveSet::SetSpecularTint(pyColor& s, float secs) { if (fWaterKey) { @@ -430,7 +430,7 @@ void pyWaveSet::SetSpecularTint(pyColor& s, hsScalar secs) } } -void pyWaveSet::SetSpecularMute(hsScalar s, hsScalar secs) +void pyWaveSet::SetSpecularMute(float s, float secs) { if (fWaterKey) { @@ -447,7 +447,7 @@ void pyWaveSet::SetSpecularMute(hsScalar s, hsScalar secs) // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. -void pyWaveSet::SetEnvCenter(const pyPoint3& s, hsScalar secs) +void pyWaveSet::SetEnvCenter(const pyPoint3& s, float secs) { if (fWaterKey) { @@ -459,7 +459,7 @@ void pyWaveSet::SetEnvCenter(const pyPoint3& s, hsScalar secs) } } -void pyWaveSet::SetEnvRadius(hsScalar s, hsScalar secs) +void pyWaveSet::SetEnvRadius(float s, float secs) { if (fWaterKey) { @@ -478,7 +478,7 @@ void pyWaveSet::SetEnvRadius(hsScalar s, hsScalar secs) // ================================================================================ // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetGeoMaxLength() const +float pyWaveSet::GetGeoMaxLength() const { if (fWaterKey) { @@ -492,7 +492,7 @@ hsScalar pyWaveSet::GetGeoMaxLength() const return -1; } -hsScalar pyWaveSet::GetGeoMinLength() const +float pyWaveSet::GetGeoMinLength() const { if (fWaterKey) { @@ -506,7 +506,7 @@ hsScalar pyWaveSet::GetGeoMinLength() const return -1; } -hsScalar pyWaveSet::GetGeoAmpOverLen() const +float pyWaveSet::GetGeoAmpOverLen() const { if (fWaterKey) { @@ -520,7 +520,7 @@ hsScalar pyWaveSet::GetGeoAmpOverLen() const return -1; } -hsScalar pyWaveSet::GetGeoChop() const +float pyWaveSet::GetGeoChop() const { if (fWaterKey) { @@ -534,7 +534,7 @@ hsScalar pyWaveSet::GetGeoChop() const return -1; } -hsScalar pyWaveSet::GetGeoAngleDev() const +float pyWaveSet::GetGeoAngleDev() const { if (fWaterKey) { @@ -550,7 +550,7 @@ hsScalar pyWaveSet::GetGeoAngleDev() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetTexMaxLength() const +float pyWaveSet::GetTexMaxLength() const { if (fWaterKey) { @@ -564,7 +564,7 @@ hsScalar pyWaveSet::GetTexMaxLength() const return -1; } -hsScalar pyWaveSet::GetTexMinLength() const +float pyWaveSet::GetTexMinLength() const { if (fWaterKey) { @@ -578,7 +578,7 @@ hsScalar pyWaveSet::GetTexMinLength() const return -1; } -hsScalar pyWaveSet::GetTexAmpOverLen() const +float pyWaveSet::GetTexAmpOverLen() const { if (fWaterKey) { @@ -592,7 +592,7 @@ hsScalar pyWaveSet::GetTexAmpOverLen() const return -1; } -hsScalar pyWaveSet::GetTexChop() const +float pyWaveSet::GetTexChop() const { if (fWaterKey) { @@ -606,7 +606,7 @@ hsScalar pyWaveSet::GetTexChop() const return -1; } -hsScalar pyWaveSet::GetTexAngleDev() const +float pyWaveSet::GetTexAngleDev() const { if (fWaterKey) { @@ -622,7 +622,7 @@ hsScalar pyWaveSet::GetTexAngleDev() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetRippleScale() const +float pyWaveSet::GetRippleScale() const { if (fWaterKey) { @@ -654,7 +654,7 @@ PyObject* pyWaveSet::GetWindDir() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetSpecularNoise() const +float pyWaveSet::GetSpecularNoise() const { if (fWaterKey) { @@ -668,7 +668,7 @@ hsScalar pyWaveSet::GetSpecularNoise() const return -1; } -hsScalar pyWaveSet::GetSpecularStart() const +float pyWaveSet::GetSpecularStart() const { if (fWaterKey) { @@ -682,7 +682,7 @@ hsScalar pyWaveSet::GetSpecularStart() const return -1; } -hsScalar pyWaveSet::GetSpecularEnd() const +float pyWaveSet::GetSpecularEnd() const { if (fWaterKey) { @@ -698,7 +698,7 @@ hsScalar pyWaveSet::GetSpecularEnd() const // -------------------------------------------------------------------------------- -hsScalar pyWaveSet::GetWaterHeight() const +float pyWaveSet::GetWaterHeight() const { if (fWaterKey) { @@ -728,7 +728,7 @@ PyObject* pyWaveSet::GetWaterOffset() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetOpacOffset() const +float pyWaveSet::GetOpacOffset() const { if (fWaterKey) { @@ -742,7 +742,7 @@ hsScalar pyWaveSet::GetOpacOffset() const return -1; } -hsScalar pyWaveSet::GetReflOffset() const +float pyWaveSet::GetReflOffset() const { if (fWaterKey) { @@ -756,7 +756,7 @@ hsScalar pyWaveSet::GetReflOffset() const return -1; } -hsScalar pyWaveSet::GetWaveOffset() const +float pyWaveSet::GetWaveOffset() const { if (fWaterKey) { @@ -784,7 +784,7 @@ PyObject* pyWaveSet::GetDepthFalloff() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetOpacFalloff() const +float pyWaveSet::GetOpacFalloff() const { if (fWaterKey) { @@ -798,7 +798,7 @@ hsScalar pyWaveSet::GetOpacFalloff() const return -1; } -hsScalar pyWaveSet::GetReflFalloff() const +float pyWaveSet::GetReflFalloff() const { if (fWaterKey) { @@ -812,7 +812,7 @@ hsScalar pyWaveSet::GetReflFalloff() const return -1; } -hsScalar pyWaveSet::GetWaveFalloff() const +float pyWaveSet::GetWaveFalloff() const { if (fWaterKey) { @@ -872,7 +872,7 @@ PyObject* pyWaveSet::GetWaterTint() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetWaterOpacity() const +float pyWaveSet::GetWaterOpacity() const { if (fWaterKey) { @@ -900,7 +900,7 @@ PyObject* pyWaveSet::GetSpecularTint() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetSpecularMute() const +float pyWaveSet::GetSpecularMute() const { if (fWaterKey) { @@ -930,7 +930,7 @@ PyObject* pyWaveSet::GetEnvCenter() const PYTHON_RETURN_NONE; } -hsScalar pyWaveSet::GetEnvRadius() const +float pyWaveSet::GetEnvRadius() const { if (fWaterKey) { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h index 51d98f35..e9c095e3 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyWaveSet.h @@ -111,108 +111,108 @@ public: // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. - void SetGeoMaxLength(hsScalar s, hsScalar secs=0); - void SetGeoMinLength(hsScalar s, hsScalar secs=0); - void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0); - void SetGeoChop(hsScalar s, hsScalar secs=0); - void SetGeoAngleDev(hsScalar s, hsScalar secs=0); + void SetGeoMaxLength(float s, float secs=0); + void SetGeoMinLength(float s, float secs=0); + void SetGeoAmpOverLen(float s, float secs=0); + void SetGeoChop(float s, float secs=0); + void SetGeoAngleDev(float s, float secs=0); // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. - void SetTexMaxLength(hsScalar s, hsScalar secs=0); - void SetTexMinLength(hsScalar s, hsScalar secs=0); - void SetTexAmpOverLen(hsScalar s, hsScalar secs=0); - void SetTexChop(hsScalar s, hsScalar secs=0); - void SetTexAngleDev(hsScalar s, hsScalar secs=0); + void SetTexMaxLength(float s, float secs=0); + void SetTexMinLength(float s, float secs=0); + void SetTexAmpOverLen(float s, float secs=0); + void SetTexChop(float s, float secs=0); + void SetTexAngleDev(float s, float secs=0); // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. - void SetRippleScale(hsScalar s, hsScalar secs=0); + void SetRippleScale(float s, float secs=0); // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. - void SetWindDir(const pyVector3& s, hsScalar secs=0); + void SetWindDir(const pyVector3& s, float secs=0); // Change these gently, effect is immediate. - void SetSpecularNoise(hsScalar s, hsScalar secs=0); - void SetSpecularStart(hsScalar s, hsScalar secs=0); - void SetSpecularEnd(hsScalar s, hsScalar secs=0); + void SetSpecularNoise(float s, float secs=0); + void SetSpecularStart(float s, float secs=0); + void SetSpecularEnd(float s, float secs=0); // Water Height is overriden if the ref object is animated. - void SetWaterHeight(hsScalar s, hsScalar secs=0); + void SetWaterHeight(float s, float secs=0); // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. - void SetWaterOffset(const pyVector3& s, hsScalar secs=0); - void SetOpacOffset(hsScalar s, hsScalar secs=0); - void SetReflOffset(hsScalar s, hsScalar secs=0); - void SetWaveOffset(hsScalar s, hsScalar secs=0); - void SetDepthFalloff(const pyVector3& s, hsScalar secs=0); - void SetOpacFalloff(hsScalar s, hsScalar secs=0); - void SetReflFalloff(hsScalar s, hsScalar secs=0); - void SetWaveFalloff(hsScalar s, hsScalar secs=0); + void SetWaterOffset(const pyVector3& s, float secs=0); + void SetOpacOffset(float s, float secs=0); + void SetReflOffset(float s, float secs=0); + void SetWaveOffset(float s, float secs=0); + void SetDepthFalloff(const pyVector3& s, float secs=0); + void SetOpacFalloff(float s, float secs=0); + void SetReflFalloff(float s, float secs=0); + void SetWaveFalloff(float s, float secs=0); // Max and Min Atten aren't very interesting, and will probably go away. - void SetMaxAtten(const pyVector3& s, hsScalar secs=0); - void SetMinAtten(const pyVector3& s, hsScalar secs=0); + void SetMaxAtten(const pyVector3& s, float secs=0); + void SetMinAtten(const pyVector3& s, float secs=0); // Water colors, adjust slowly, effect is immediate. - void SetWaterTint(pyColor& s, hsScalar secs=0); - void SetWaterOpacity(hsScalar s, hsScalar secs=0); - void SetSpecularTint(pyColor& s, hsScalar secs=0); - void SetSpecularMute(hsScalar s, hsScalar secs=0); + void SetWaterTint(pyColor& s, float secs=0); + void SetWaterOpacity(float s, float secs=0); + void SetSpecularTint(pyColor& s, float secs=0); + void SetSpecularMute(float s, float secs=0); // The environment map is essentially projected onto a sphere. Moving the center of // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. - void SetEnvCenter(const pyPoint3& s, hsScalar secs=0); - void SetEnvRadius(hsScalar s, hsScalar secs=0); + void SetEnvCenter(const pyPoint3& s, float secs=0); + void SetEnvRadius(float s, float secs=0); // ============================================================================== // Get functions // ============================================================================== - hsScalar GetGeoMaxLength() const; - hsScalar GetGeoMinLength() const; - hsScalar GetGeoAmpOverLen() const; - hsScalar GetGeoChop() const; - hsScalar GetGeoAngleDev() const; + float GetGeoMaxLength() const; + float GetGeoMinLength() const; + float GetGeoAmpOverLen() const; + float GetGeoChop() const; + float GetGeoAngleDev() const; - hsScalar GetTexMaxLength() const; - hsScalar GetTexMinLength() const; - hsScalar GetTexAmpOverLen() const; - hsScalar GetTexChop() const; - hsScalar GetTexAngleDev() const; + float GetTexMaxLength() const; + float GetTexMinLength() const; + float GetTexAmpOverLen() const; + float GetTexChop() const; + float GetTexAngleDev() const; - hsScalar GetRippleScale() const; + float GetRippleScale() const; PyObject* GetWindDir() const; // returns pyVector3 - hsScalar GetSpecularNoise() const; - hsScalar GetSpecularStart() const; - hsScalar GetSpecularEnd() const; + float GetSpecularNoise() const; + float GetSpecularStart() const; + float GetSpecularEnd() const; - hsScalar GetWaterHeight() const; + float GetWaterHeight() const; PyObject* GetWaterOffset() const; // returns pyVector3 - hsScalar GetOpacOffset() const; - hsScalar GetReflOffset() const; - hsScalar GetWaveOffset() const; + float GetOpacOffset() const; + float GetReflOffset() const; + float GetWaveOffset() const; PyObject* GetDepthFalloff() const; // returns pyVector3 - hsScalar GetOpacFalloff() const; - hsScalar GetReflFalloff() const; - hsScalar GetWaveFalloff() const; + float GetOpacFalloff() const; + float GetReflFalloff() const; + float GetWaveFalloff() const; PyObject* GetMaxAtten() const; // returns pyVector3 PyObject* GetMinAtten() const; // returns pyVector3 PyObject* GetWaterTint() const; // returns pyColor - hsScalar GetWaterOpacity() const; + float GetWaterOpacity() const; PyObject* GetSpecularTint() const; // returns pyColor - hsScalar GetSpecularMute() const; + float GetSpecularMute() const; PyObject* GetEnvCenter() const; // returns pyPoint3 - hsScalar GetEnvRadius() const; + float GetEnvRadius() const; }; diff --git a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp index 7b68c1d2..158069a4 100644 --- a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp +++ b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp @@ -179,7 +179,7 @@ public: uint32_t Write(uint32_t count, const void* buf) { if (fProgress) - fProgress->Increment((hsScalar)count); + fProgress->Increment((float)count); if (fIsZipped) return plZlibStream::Write(count, buf); else @@ -351,7 +351,7 @@ void pfSecurePreloader::PreloadManifest(const NetCliAuthFileInfo manifestEntries if (fProgress) { - fProgress->SetLength((hsScalar)totalBytes); + fProgress->SetLength((float)totalBytes); fProgress->SetTitle("Downloading..."); } } @@ -402,7 +402,7 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn if (totalBytes && fProgress) { - fProgress->SetLength((hsScalar)totalBytes); + fProgress->SetLength((float)totalBytes); fProgress->SetTitle("Downloading..."); } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp index 3dd4bb7c..05d5fcd4 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp @@ -89,9 +89,9 @@ void plDistOpacityMod::SetKey(plKey k) } -hsScalar plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const +float plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const { - hsScalar dist = hsVector3(&targPos, &refPos).Magnitude(); + float dist = hsVector3(&targPos, &refPos).Magnitude(); if( dist > fDists[kFarTrans] ) return 0; @@ -129,7 +129,7 @@ void plDistOpacityMod::ISetOpacity() if( !fSetup ) ISetup(); - hsScalar opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos); + float opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos); const int num = fFadeLays.GetCount(); int i; @@ -209,7 +209,7 @@ void plDistOpacityMod::SetTarget(plSceneObject* so) fSetup = false; } -void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent) +void plDistOpacityMod::SetFarDist(float opaque, float transparent) { fDists[kFarOpaq] = opaque; fDists[kFarTrans] = transparent; @@ -217,7 +217,7 @@ void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent) ICheckDists(); } -void plDistOpacityMod::SetNearDist(hsScalar transparent, hsScalar opaque) +void plDistOpacityMod::SetNearDist(float transparent, float opaque) { fDists[kNearOpaq] = opaque; fDists[kNearTrans] = transparent; diff --git a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h index 57949dda..61683bb6 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.h @@ -77,16 +77,16 @@ protected: kNumDists }; - hsScalar fDists[kNumDists]; + float fDists[kNumDists]; hsPoint3 fRefPos; hsTArray fFadeLays; // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } - hsScalar ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const; + float ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const; void ISetOpacity(); void ISetup(); @@ -116,13 +116,13 @@ public: // Rules are: // NearTrans <= NearOpaq <= FarOpaque <= FarTrans - void SetFarDist(hsScalar opaque, hsScalar transparent); - void SetNearDist(hsScalar transparent, hsScalar opaque); + void SetFarDist(float opaque, float transparent); + void SetNearDist(float transparent, float opaque); - hsScalar GetFarTransparent() const { return fDists[kFarTrans]; } - hsScalar GetNearTransparent() const { return fDists[kNearTrans]; } - hsScalar GetFarOpaque() const { return fDists[kFarOpaq]; } - hsScalar GetNearOpaque() const { return fDists[kNearOpaq]; } + float GetFarTransparent() const { return fDists[kFarTrans]; } + float GetNearTransparent() const { return fDists[kNearTrans]; } + float GetFarOpaque() const { return fDists[kFarOpaq]; } + float GetNearOpaque() const { return fDists[kNearOpaq]; } }; #endif // plDistOpacityMod_inc diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp index 94420ffe..0df3ceb3 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp @@ -48,7 +48,7 @@ plFadeOpacityLay::plFadeOpacityLay() : fOpScale(1.f) { fOwnedChannels |= kOpacity; - fOpacity = TRACKED_NEW hsScalar; + fOpacity = TRACKED_NEW float; } plFadeOpacityLay::~plFadeOpacityLay() diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h index 90c93046..47d6cef0 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.h @@ -50,7 +50,7 @@ class plFadeOpacityLay : public plLayerInterface { protected: - hsScalar fOpScale; + float fOpScale; public: plFadeOpacityLay(); @@ -64,8 +64,8 @@ public: virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - void SetOpacity(hsScalar f) { fOpScale = f; } - hsScalar GetOpacity() const { return fOpScale; } + void SetOpacity(float f) { fOpScale = f; } + float GetOpacity() const { return fOpScale; } }; #endif // plFadeOpacityLay_inc diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp index 306299ad..1940ecfe 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp @@ -83,8 +83,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com hsBool plFadeOpacityMod::fLOSCheckDisabled = false; -const hsScalar kDefFadeUp(5.f); -const hsScalar kDefFadeDown(1.f); +const float kDefFadeUp(5.f); +const float kDefFadeDown(1.f); plFadeOpacityMod::plFadeOpacityMod() : fFadeUp(kDefFadeUp), @@ -178,7 +178,7 @@ void plFadeOpacityMod::IOnRenderMsg(plRenderMsg* rend) { // If we've moved more than 3 feet in a frame, we'll consider this a // camera cut. In that case, don't fade up or down, just go there. - const hsScalar kCutMagSquared = 3.f * 3.f; + const float kCutMagSquared = 3.f * 3.f; if( hsVector3(&eyePos, &fLastEye).MagnitudeSquared() > kCutMagSquared ) fFade = kImmediate; } @@ -237,7 +237,7 @@ void plFadeOpacityMod::ICalcOpacity() switch( fFade ) { case kFadeUp: - fOpCurrent = (hsScalar)(t - fStart); + fOpCurrent = (float)(t - fStart); if( fOpCurrent > fFadeUp ) { fOpCurrent = 1.f; @@ -249,7 +249,7 @@ void plFadeOpacityMod::ICalcOpacity() } break; case kFadeDown: - fOpCurrent = (hsScalar)(t - fStart); + fOpCurrent = (float)(t - fStart); if( fOpCurrent > fFadeDown ) { fOpCurrent = 0.f; diff --git a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h index bf8e0f5a..6693ae7d 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.h @@ -65,8 +65,8 @@ protected: }; // Input parameters - hsScalar fFadeUp; - hsScalar fFadeDown; + float fFadeUp; + float fFadeDown; // Internal fade state enum FadeState { @@ -76,7 +76,7 @@ protected: kFadeDown = 3, kImmediate = 4 }; - hsScalar fOpCurrent; + float fOpCurrent; double fStart; FadeState fFade; @@ -101,7 +101,7 @@ protected: void ISetup(plSceneObject* so); // We only act in response to messages. - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plFadeOpacityMod(); @@ -123,11 +123,11 @@ public: void FadeDown(); void Fade(hsBool up) { if( up ) FadeUp(); else FadeDown(); } - void SetFadeUp(hsScalar f) { fFadeUp = f; } - hsScalar GetFadeUp() const { return fFadeUp; } + void SetFadeUp(float f) { fFadeUp = f; } + float GetFadeUp() const { return fFadeUp; } - void SetFadeDown(hsScalar f) { fFadeDown = f; } - hsScalar GetFadeDown() const { return fFadeDown; } + void SetFadeDown(float f) { fFadeDown = f; } + float GetFadeDown() const { return fFadeDown; } static hsBool GetLOSCheckDisabled() { return fLOSCheckDisabled; } static void SetLOSCheckDisabled(hsBool on) { fLOSCheckDisabled = on; } diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp index 74dcb834..4dc4a7cd 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.cpp @@ -115,7 +115,7 @@ hsBool plLayerAVI::IInit() ISetSize(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight); int32_t endFrame = fAVIInfo->fAVIStreamInfo.dwLength-1; - hsScalar length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale) + float length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale) / float(fAVIInfo->fAVIStreamInfo.dwRate); ISetLength(length); #endif @@ -123,7 +123,7 @@ hsBool plLayerAVI::IInit() return false; } -int32_t plLayerAVI::ISecsToFrame(hsScalar secs) +int32_t plLayerAVI::ISecsToFrame(float secs) { #if HS_BUILD_FOR_WIN32 float timeScale = float(fAVIInfo->fAVIStreamInfo.dwRate) / float(fAVIInfo->fAVIStreamInfo.dwScale); diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h index 453fc1ae..8fdab521 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerAVI.h @@ -55,7 +55,7 @@ protected: hsBool ICloseMovie(); - virtual int32_t ISecsToFrame(hsScalar secs); + virtual int32_t ISecsToFrame(float secs); virtual hsBool IInit(); virtual hsBool IGetCurrentFrame(); virtual hsBool IRelease(); diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp index 0a2893bc..ba48ec53 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp @@ -82,7 +82,7 @@ hsBool plLayerMovie::ISetFault(const char* errStr) return true; } -hsBool plLayerMovie::ISetLength(hsScalar secs) +hsBool plLayerMovie::ISetLength(float secs) { fLength = secs; return false; @@ -142,7 +142,7 @@ hsBool plLayerMovie::IMovieIsIdle() hsBool plLayerMovie::ICurrentFrameDirty(double wSecs) { - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); + float secs = fTimeConvert.WorldToAnimTime(wSecs); uint32_t frame = ISecsToFrame(secs); if( frame == fCurrentFrame ) return false; diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h index 3c048ddc..8778a592 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.h @@ -58,10 +58,10 @@ protected: // plAnimTimeConvert fTimeConvert; int32_t fCurrentFrame; - hsScalar fLength; + float fLength; uint32_t fWidth, fHeight; - virtual int32_t ISecsToFrame(hsScalar secs) = 0; + virtual int32_t ISecsToFrame(float secs) = 0; hsBool IGetFault() const { return !(fMovieName && *fMovieName); } hsBool ISetFault(const char* errStr); @@ -69,7 +69,7 @@ protected: hsBool IMovieIsIdle(); // will call IRelease(); hsBool ISetupBitmap(); hsBool ISetSize(int w, int h); - hsBool ISetLength(hsScalar secs); + hsBool ISetLength(float secs); hsBool ICurrentFrameDirty(double wSecs); virtual hsBool IInit() = 0; // Load header etc, must call ISetSize(w, h), ISetLength(s) @@ -97,7 +97,7 @@ public: // Movie specific int GetWidth() const; int GetHeight() const; - hsScalar GetLength() const { return fLength; } + float GetLength() const { return fLength; } virtual void DefaultMovie(); }; diff --git a/Sources/Plasma/NucleusLib/inc/hsTimer.h b/Sources/Plasma/NucleusLib/inc/hsTimer.h index 893a9dbd..eb1cdcf6 100644 --- a/Sources/Plasma/NucleusLib/inc/hsTimer.h +++ b/Sources/Plasma/NucleusLib/inc/hsTimer.h @@ -43,11 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define hsTimer_Defined #include "hsWide.h" -#include "hsScalar.h" - -#if !HS_CAN_USE_FLOAT -#error "Unsupported without double's" -#endif // !HS_CAN_USE_FLOAT class plTimerShare { @@ -62,14 +57,14 @@ protected: double fSmoothBuff[kSmoothBuffLen]; int fCurrSlot; - hsScalar fSysTimeScale; + float fSysTimeScale; double fRealSeconds; double fSysSeconds; - hsScalar fDelSysSeconds; - hsScalar fFrameTimeInc; + float fDelSysSeconds; + float fFrameTimeInc; hsBool fRunningFrameTime; - hsScalar fTimeClampSecs; - hsScalar fSmoothingClampSecs; + float fTimeClampSecs; + float fSmoothingClampSecs; hsBool fClamping; hsWide* FactorInTimeZero(hsWide* ticks) const; @@ -82,21 +77,21 @@ protected: double RawTicksToDSeconds(const hsWide& ticks); hsWide DSecondsToRawTicks(double secs); - hsScalar GetDelSysSeconds() const { return fDelSysSeconds; } + float GetDelSysSeconds() const { return fDelSysSeconds; } double GetSysSeconds() const { return fSysSeconds; } double IncSysSeconds(); void SetRealTime(hsBool realTime); hsBool IsRealTime() const { return !fRunningFrameTime; } - void SetFrameTimeInc(hsScalar inc) { fFrameTimeInc = inc; } + void SetFrameTimeInc(float inc) { fFrameTimeInc = inc; } - void SetTimeScale(hsScalar s) { fSysTimeScale = s; } - hsScalar GetTimeScale() const { return fSysTimeScale; } + void SetTimeScale(float s) { fSysTimeScale = s; } + float GetTimeScale() const { return fSysTimeScale; } - void SetTimeClamp(hsScalar secs) { fTimeClampSecs = secs; } - void SetSmoothingCap(hsScalar secs) { fSmoothingClampSecs = secs; } - hsScalar GetTimeClamp() const { return fTimeClampSecs; } + void SetTimeClamp(float secs) { fTimeClampSecs = secs; } + void SetSmoothingCap(float secs) { fSmoothingClampSecs = secs; } + float GetTimeClamp() const { return fTimeClampSecs; } hsBool IsClamping() const { return fClamping; } friend class hsTimer; @@ -127,7 +122,7 @@ public: static double RawTicksToDSeconds(const hsWide& ticks) { return fTimer->RawTicksToDSeconds(ticks); } static hsWide DSecondsToRawTicks(double secs) { return fTimer->DSecondsToRawTicks(secs); } - static hsScalar GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); } + static float GetDelSysSeconds() { return fTimer->GetDelSysSeconds(); } static double GetSysSeconds() { return fTimer->GetSysSeconds(); } static double IncSysSeconds() { return fTimer->IncSysSeconds(); } @@ -135,14 +130,14 @@ public: static void SetRealTime(hsBool realTime) { fTimer->SetRealTime(realTime); } static hsBool IsRealTime() { return fTimer->IsRealTime(); } - static void SetFrameTimeInc(hsScalar inc) { fTimer->SetFrameTimeInc(inc); } + static void SetFrameTimeInc(float inc) { fTimer->SetFrameTimeInc(inc); } - static void SetTimeScale(hsScalar s) { fTimer->SetTimeScale(s); } - static hsScalar GetTimeScale() { return fTimer->GetTimeScale(); } + static void SetTimeScale(float s) { fTimer->SetTimeScale(s); } + static float GetTimeScale() { return fTimer->GetTimeScale(); } - static void SetTimeClamp(hsScalar secs) { fTimer->SetTimeClamp(secs); } - static void SetTimeSmoothingClamp(hsScalar secs) { fTimer->SetSmoothingCap(secs); } - static hsScalar GetTimeClamp() { return fTimer->GetTimeClamp(); } + static void SetTimeClamp(float secs) { fTimer->SetTimeClamp(secs); } + static void SetTimeSmoothingClamp(float secs) { fTimer->SetSmoothingCap(secs); } + static float GetTimeClamp() { return fTimer->GetTimeClamp(); } static hsBool IsClamping() { return fTimer->IsClamping(); } /////////////////////////// @@ -150,7 +145,7 @@ public: /////////////////////////// static uint32_t GetPrecTickCount(); static double GetPrecTicksPerSec(); - static uint32_t PrecSecsToTicks(hsScalar secs); + static uint32_t PrecSecsToTicks(float secs); static double PrecTicksToSecs(uint32_t ticks); static double PrecTicksToHz(uint32_t ticks); diff --git a/Sources/Plasma/NucleusLib/inc/plAudible.h b/Sources/Plasma/NucleusLib/inc/plAudible.h index 173e1e7d..2c9ac0a4 100644 --- a/Sources/Plasma/NucleusLib/inc/plAudible.h +++ b/Sources/Plasma/NucleusLib/inc/plAudible.h @@ -83,10 +83,10 @@ public: virtual void Stop(int index = -1) = 0; virtual void FastForwardPlay(int index = -1) = 0; virtual void FastForwardToggle( int index = -1) = 0; - virtual void SetMin(const hsScalar m,int index = -1) = 0; // sets minimum falloff distance - virtual void SetMax(const hsScalar m,int index = -1) = 0; // sets maximum falloff distance - virtual hsScalar GetMin(int index = -1) const = 0; - virtual hsScalar GetMax(int index = -1) const = 0; + virtual void SetMin(const float m,int index = -1) = 0; // sets minimum falloff distance + virtual void SetMax(const float m,int index = -1) = 0; // sets maximum falloff distance + virtual float GetMin(int index = -1) const = 0; + virtual float GetMax(int index = -1) const = 0; virtual void SetVelocity(const hsVector3 vel,int index = -1) = 0; virtual hsVector3 GetVelocity(int index = -1) const = 0; virtual hsPoint3 GetPosition(int index = -1) = 0; diff --git a/Sources/Plasma/NucleusLib/inc/plDrawable.h b/Sources/Plasma/NucleusLib/inc/plDrawable.h index 0dce8d73..d0131024 100644 --- a/Sources/Plasma/NucleusLib/inc/plDrawable.h +++ b/Sources/Plasma/NucleusLib/inc/plDrawable.h @@ -177,7 +177,7 @@ public: // Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc. virtual hsGMaterial* GetSubMaterial(int index) const = 0; - virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist + virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const = 0; // return true if span invisible before minDist and/or after maxDist // Should implement hsKeyedObject Read/Write/Save/Load as well diff --git a/Sources/Plasma/NucleusLib/inc/plPhysical.h b/Sources/Plasma/NucleusLib/inc/plPhysical.h index dea47818..6239c457 100644 --- a/Sources/Plasma/NucleusLib/inc/plPhysical.h +++ b/Sources/Plasma/NucleusLib/inc/plPhysical.h @@ -121,7 +121,7 @@ public: virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV) = 0; virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) = 0; - virtual hsScalar GetMass() = 0; + virtual float GetMass() = 0; // I wish I could think of a better way to do this, but this is how it's // going to be for now. virtual void ExcludeRegionHack(hsBool cleared) = 0; diff --git a/Sources/Plasma/NucleusLib/inc/plPipeline.h b/Sources/Plasma/NucleusLib/inc/plPipeline.h index 92f22cd8..374b5393 100644 --- a/Sources/Plasma/NucleusLib/inc/plPipeline.h +++ b/Sources/Plasma/NucleusLib/inc/plPipeline.h @@ -217,10 +217,10 @@ public: virtual void PopRenderRequest(plRenderRequest* req) = 0; virtual void ClearRenderTarget( plDrawable* d ) = 0; // nil d reverts to ClearRenderTarget(nil, nil). - virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const hsScalar* depth = nil) = 0; // col/depth are overrides for current default. - virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil) = 0; // sets the default clear for current render target. + virtual void ClearRenderTarget(const hsColorRGBA* col = nil, const float* depth = nil) = 0; // col/depth are overrides for current default. + virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil) = 0; // sets the default clear for current render target. virtual hsColorRGBA GetClearColor() const = 0; - virtual hsScalar GetClearDepth() const = 0; + virtual float GetClearDepth() const = 0; virtual hsGDeviceRef *MakeRenderTargetRef( plRenderTarget *owner ) = 0; virtual void PushRenderTarget( plRenderTarget *target ) = 0; virtual plRenderTarget *PopRenderTarget( void ) = 0; @@ -279,17 +279,17 @@ public: virtual hsVector3 GetViewDirWorld() const = 0; virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const = 0; - virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const = 0; - virtual void SetFOV(hsScalar fovX, hsScalar fovY) = 0; + virtual void GetFOV(float& fovX, float& fovY) const = 0; + virtual void SetFOV(float fovX, float fovY) = 0; - virtual void GetSize(hsScalar& width, hsScalar& height) const = 0; - virtual void SetSize(hsScalar width, hsScalar height) = 0; + virtual void GetSize(float& width, float& height) const = 0; + virtual void SetSize(float width, float height) = 0; - virtual void GetDepth(hsScalar& hither, hsScalar& yon) const = 0; - virtual void SetDepth(hsScalar hither, hsScalar yon) = 0; + virtual void GetDepth(float& hither, float& yon) const = 0; + virtual void SetDepth(float hither, float yon) = 0; - virtual void SetZBiasScale( hsScalar scale ) = 0; - virtual hsScalar GetZBiasScale( void ) const = 0; + virtual void SetZBiasScale( float scale ) = 0; + virtual float GetZBiasScale( void ) const = 0; virtual const hsMatrix44& GetWorldToCamera() const = 0; virtual const hsMatrix44& GetCameraToWorld() const = 0; @@ -301,7 +301,7 @@ public: virtual const plViewTransform& GetViewTransform() const = 0; virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, - hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut ) = 0; + float dist, uint32_t strideOut, hsPoint3 *worldOut ) = 0; virtual void RefreshMatrices( void ) = 0; virtual void RefreshScreenMatrices( void ) = 0; @@ -330,9 +330,9 @@ public: virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0; // These all return true if the gamma was successfully set. - virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) = 0; + virtual hsBool SetGamma(float eR, float eG, float eB) = 0; virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB) = 0; // len table = 256. - virtual hsBool SetGamma(hsScalar e) { return SetGamma(e, e, e); } + virtual hsBool SetGamma(float e) { return SetGamma(e, e, e); } virtual hsBool SetGamma(const uint16_t* const table) { return SetGamma(table, table, table); } // flipVertical is for the AVI writer, which wants it's frames upside down diff --git a/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h b/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h index a0a1f90b..7f046db8 100644 --- a/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h +++ b/Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h @@ -132,7 +132,7 @@ struct plMouseInfo fBox = _box; fControlDescription = _desc; } - plMouseInfo(ControlEventCode _code, uint32_t _flags, hsScalar pt1, hsScalar pt2, hsScalar pt3, hsScalar pt4, char* _desc) + plMouseInfo(ControlEventCode _code, uint32_t _flags, float pt1, float pt2, float pt3, float pt4, char* _desc) { fCode = _code; fControlFlags = _flags; diff --git a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h index c62a4d9a..6b05d010 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.h @@ -82,13 +82,13 @@ public: int fType; hsPoint3 fOffset; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVel; - hsScalar fFPAccel; - hsScalar fFPDecel; - hsScalar fFPVel; - hsScalar fFOVw, fFOVh; + float fAccel; + float fDecel; + float fVel; + float fFPAccel; + float fFPDecel; + float fFPVel; + float fFOVw, fFOVh; hsBool fWorldspace; void Read(hsStream* stream); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h index f9de7de5..56b862cc 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h @@ -65,7 +65,7 @@ class plEventCallbackMsg : public plMessage protected: public: - hsScalar fEventTime; // the time for time events + float fEventTime; // the time for time events CallbackEvent fEvent; // the event int16_t fIndex; // the index of the object we want the event to come from // (where applicable, required for sounds) @@ -79,7 +79,7 @@ public: plMessage(s, r, t), fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;} - plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plMessage(nil, receiver, nil), fEvent(e), fIndex(idx), fEventTime(t), fRepeats(repeats), fUser(user) {} ~plEventCallbackMsg(){;} diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp index fd57aa08..0d83482c 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp @@ -502,7 +502,7 @@ void plNotifyMsg::AddContainerEvent( const plKey &container, const plKey &contai // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, hsScalar dot, hsBool enabled ) +void plNotifyMsg::AddFacingEvent( const plKey &other, const plKey &self, float dot, hsBool enabled ) { // remove records that are like the one being added @@ -583,7 +583,7 @@ void plNotifyMsg::AddControlKeyEvent( int32_t key, hsBool down ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, hsScalar number ) +void plNotifyMsg::AddVariableEvent( const char* name, float number ) { // create the control key event record proVariableEventData* pED = TRACKED_NEW proVariableEventData; @@ -628,7 +628,7 @@ void plNotifyMsg::AddVariableEvent( const char* name, const plKey &key ) // NOTE: To test for duplicate record, it only checks for records of the same type // : Eventually, it might be wise to check if the same 'self' key also? // -void plNotifyMsg::AddClickDragEvent( const plKey& dragger, const plKey& dragee, hsScalar animPos ) +void plNotifyMsg::AddClickDragEvent( const plKey& dragger, const plKey& dragee, float animPos ) { // remove records that are like the one being added int num_recs = fEvents.GetCount(); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h index 2484827f..8cf49328 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h @@ -181,7 +181,7 @@ proEventType(Variable) int32_t fDataType; // type of data // Can't be a union, sadly, but it isn't that much of a waste of space... - hsScalar fNumber; // if its a number + float fNumber; // if its a number plKey fKey; // if its a plKey (pointer to something) @@ -198,7 +198,7 @@ protected: proEventType(Facing) plKey fFacer; // what was facing plKey fFacee; // what was being faced - hsScalar dot; // the dot prod of their view vectors + float dot; // the dot prod of their view vectors hsBool enabled; // Now meets facing requirement (true) or no longer meets requirement (false) protected: @@ -284,7 +284,7 @@ protected: proEventType(ClickDrag) plKey picker; // always the local avatar in this case plKey picked; - hsScalar animPos; // 0.0 to 1.0 animation percentage + float animPos; // 0.0 to 1.0 animation percentage }; proEventType(OfferLinkingBook) @@ -355,21 +355,21 @@ public: kResponderChangeState, // Change state without triggering }; int32_t fType; // what type of notification - hsScalar fState; // state of the notifier 0.0=false, 1.0=true + float fState; // state of the notifier 0.0=false, 1.0=true int32_t fID; // special ID mostly for responder State transitions hsTArray fEvents;// list of events with data void SetType(notificationType type) { fType = type; } - void SetState(hsScalar state) { fState = state; } + void SetState(float state) { fState = state; } // event records for the notify message void AddEvent( proEventData* ed); void AddCollisionEvent( hsBool enter, const plKey &other, const plKey &self, hsBool onlyOneCollision=true ); void AddPickEvent( const plKey &other, const plKey& self, hsBool enabled, hsPoint3 hitPoint ); void AddControlKeyEvent( int32_t key, hsBool down ); - void AddVariableEvent( const char* name, hsScalar number ); + void AddVariableEvent( const char* name, float number ); void AddVariableEvent( const char *name, const plKey &key); - void AddFacingEvent( const plKey &other, const plKey &self, hsScalar dot, hsBool enabled); + void AddFacingEvent( const plKey &other, const plKey &self, float dot, hsBool enabled); void AddContainerEvent( const plKey &container, const plKey &contained, hsBool entering); void AddActivateEvent( hsBool activate ); void AddCallbackEvent( int32_t event ); @@ -377,7 +377,7 @@ public: void AddMultiStageEvent( int32_t stage, int32_t event, const plKey& avatar ); void AddCoopEvent(uint32_t id, uint16_t serial); void AddSpawnedEvent (const plKey &spawner, const plKey &spawned); - void AddClickDragEvent(const plKey& dragger, const plKey& dragee, hsScalar animPos); + void AddClickDragEvent(const plKey& dragger, const plKey& dragee, float animPos); void AddOfferBookEvent(const plKey& offerer, int targetAge, int offeree); void AddBookEvent( uint32_t event, uint32_t linkID = 0 ); void AddHitClimbingBlockerEvent(const plKey &blocker); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h index 343f797a..4b7762ff 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.h @@ -98,13 +98,13 @@ public: double fBegin; double fEnd; hsBool fLoop; - hsScalar fSpeed; + float fSpeed; double fTime; int fIndex; int fRepeats; hsBool fPlaying; uint32_t fNameStr; - hsScalar fVolume; // Range: 0 - silence, 1.f - loudest + float fVolume; // Range: 0 - silence, 1.f - loudest enum FadeType { diff --git a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp index 63b9a700..7aea9187 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.cpp @@ -51,7 +51,7 @@ plTimeMsg::plTimeMsg() plTimeMsg::plTimeMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plMessage(s, r, t) { fSeconds = t ? *t : hsTimer::GetSysSeconds(); @@ -70,7 +70,7 @@ plEvalMsg::plEvalMsg() plEvalMsg::plEvalMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plTimeMsg(s, r, t, d) { } @@ -85,7 +85,7 @@ plTransformMsg::plTransformMsg() plTransformMsg::plTransformMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* d) + const double* t, const float* d) : plTimeMsg(s, r, t, d) { SetBCastFlag(plMessage::kClearAfterBCast); diff --git a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h index 40516462..285bf7f2 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h @@ -50,23 +50,23 @@ class plTimeMsg : public plMessage { protected: double fSeconds; - hsScalar fDelSecs; + float fDelSecs; public: plTimeMsg(); plTimeMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plTimeMsg(); CLASSNAME_REGISTER( plTimeMsg ); GETINTERFACE_ANY( plTimeMsg, plMessage ); plTimeMsg& SetSeconds(double s) { fSeconds = s; return *this; } - plTimeMsg& SetDelSeconds(hsScalar d) { fDelSecs = d; return *this; } + plTimeMsg& SetDelSeconds(float d) { fDelSecs = d; return *this; } double DSeconds() { return fSeconds; } - hsScalar DelSeconds() { return fDelSecs; } + float DelSeconds() { return fDelSecs; } // IO void Read(hsStream* stream, hsResMgr* mgr) @@ -90,7 +90,7 @@ public: plEvalMsg(); plEvalMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plEvalMsg(); CLASSNAME_REGISTER( plEvalMsg ); @@ -107,7 +107,7 @@ public: plTransformMsg(); plTransformMsg(const plKey &s, const plKey &r, - const double* t, const hsScalar* del); + const double* t, const float* del); ~plTransformMsg(); CLASSNAME_REGISTER( plTransformMsg ); @@ -125,7 +125,7 @@ class plDelayedTransformMsg : public plTransformMsg { public: plDelayedTransformMsg() : plTransformMsg() {} - plDelayedTransformMsg(const plKey &s, const plKey &r, const double* t, const hsScalar* del) : plTransformMsg(s, r, t, del) {} + plDelayedTransformMsg(const plKey &s, const plKey &r, const double* t, const float* del) : plTransformMsg(s, r, t, del) {} CLASSNAME_REGISTER( plDelayedTransformMsg ); GETINTERFACE_ANY( plDelayedTransformMsg, plTransformMsg ); diff --git a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h index ce0788cf..36eb346d 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h @@ -69,13 +69,13 @@ protected: hsTArray fCommandList; hsTArray fReceiverList; uint32_t fCounterLimit; - hsScalar fTimer; + float fTimer; hsBitVector fFlags; uint32_t fCounter; plNotifyMsg* fNotify; bool fDisabled; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return false;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return false;} void IUpdateSharedState(bool triggered) const; hsBool IEvalCounter(); virtual void PreTrigger(hsBool netRequest); diff --git a/Sources/Plasma/NucleusLib/pnModifier/plModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plModifier.h index fba11eaf..c1da9ede 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plModifier.h @@ -67,7 +67,7 @@ protected: plObjInterface* IGetTargetGenericInterface(int iTarg, uint32_t classIdx) const; plModifier* IGetTargetModifier(int iTarg, int iMod) const; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) = 0; // called only by owner object's Eval() + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; // called only by owner object's Eval() friend class plSceneObject; public: diff --git a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h index b2f8aebc..36e7be5d 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h @@ -64,7 +64,7 @@ public: CLASSNAME_REGISTER( plMultiModifier ); GETINTERFACE_ANY( plMultiModifier, plModifier ); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) = 0; + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h index 6f68b0c7..67992828 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h +++ b/Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h @@ -56,7 +56,7 @@ protected: plSceneObject* fTarget; hsBitVector fFlags; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) = 0; + virtual hsBool IEval(double secs, float del, uint32_t dirty) = 0; public: plSingleModifier(); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp index 094deb59..c5aca9c1 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp @@ -70,7 +70,7 @@ hsBitVector plSynchedValueBase::ISaveOrLoad(hsBitVector& v, hsBool32 save, hsStr return v; } -hsScalar plSynchedValueBase::ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* stream, hsResMgr* mgr) +float plSynchedValueBase::ISaveOrLoad(float v, hsBool32 save, hsStream* stream, hsResMgr* mgr) ISaveOrLoadSimpleType(); double plSynchedValueBase::ISaveOrLoad(double v, hsBool32 save, hsStream* stream, hsResMgr* mgr) diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h index addf8390..490a7870 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h @@ -110,7 +110,7 @@ protected: uint32_t ISaveOrLoad(uint32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr); bool ISaveOrLoad(bool v, hsBool32 save, hsStream* stream, hsResMgr* mgr); int ISaveOrLoad(int v, hsBool32 save, hsStream* stream, hsResMgr* mgr); // or hsBool32 - hsScalar ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* stream, hsResMgr* mgr); + float ISaveOrLoad(float v, hsBool32 save, hsStream* stream, hsResMgr* mgr); double ISaveOrLoad(double v, hsBool32 save, hsStream* stream, hsResMgr* mgr); hsBitVector ISaveOrLoad(hsBitVector& v, hsBool32 save, hsStream* stream, hsResMgr* mgr); plCoordinateInterface* ISaveOrLoad(const plCoordinateInterface* cInt, hsBool32 save, hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp index 52a16fcb..4236e10e 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp @@ -389,7 +389,7 @@ hsBool plSceneObject::IPropagateToModifiers(plMessage* msg) return retVal; } -hsBool plSceneObject::Eval(double secs, hsScalar delSecs) +hsBool plSceneObject::Eval(double secs, float delSecs) { uint32_t dirty = ~0L; hsBool retVal = false; diff --git a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h index cea5fc52..d3e7e373 100644 --- a/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h +++ b/Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.h @@ -147,7 +147,7 @@ public: const plModifier* GetModifierByType(uint16_t classIdx) const; virtual hsBool MsgReceive(plMessage* msg); - virtual hsBool Eval(double secs, hsScalar del); + virtual hsBool Eval(double secs, float del); void SetSceneNode(plKey newNode); plKey GetSceneNode() const; diff --git a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp index d8f8aefd..d7d8c008 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/hsTimer.cpp @@ -123,7 +123,7 @@ double plTimerShare::IncSysSeconds() else if( fSmoothingClampSecs >= 0 ) { double t = GetSeconds(); - hsScalar delSys = hsScalar(t - fRealSeconds); + float delSys = float(t - fRealSeconds); fClamping = ( (fTimeClampSecs > 0) && (delSys > fTimeClampSecs) ); if (fClamping) { @@ -132,8 +132,8 @@ double plTimerShare::IncSysSeconds() delSys *= fSysTimeScale; if( fDelSysSeconds > 0 && fDelSysSeconds < fSmoothingClampSecs ) { - const hsScalar kFrac = 0.1f; - const hsScalar kOneMinusFrac = 1.f-kFrac; + const float kFrac = 0.1f; + const float kOneMinusFrac = 1.f-kFrac; delSys *= kFrac; delSys += fDelSysSeconds * kOneMinusFrac; } @@ -146,7 +146,7 @@ double plTimerShare::IncSysSeconds() { fRealSeconds = t; t = GetSeconds(); - delSys = hsScalar(t - fRealSeconds); + delSys = float(t - fRealSeconds); count--; } #endif @@ -182,12 +182,12 @@ double plTimerShare::IncSysSeconds() } avg /= double(kSmoothBuffUsed); - plCONST(hsScalar) kMaxSmoothable(0.15f); - fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale; + plCONST(float) kMaxSmoothable(0.15f); + fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale; if( fDelSysSeconds > kMaxSmoothable * fSysTimeScale ) { avg = t; - fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale; + fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale; fResetSmooth = true; } fSysSeconds += fDelSysSeconds; @@ -312,7 +312,7 @@ uint32_t hsTimer::GetPrecTickCount() return 1; #endif } -uint32_t hsTimer::PrecSecsToTicks(hsScalar secs) +uint32_t hsTimer::PrecSecsToTicks(float secs) { return (uint32_t)(((double)secs) * fPrecTicksPerSec); } diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h index c55a32c3..fff0a67a 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h @@ -57,7 +57,7 @@ protected: T fGoal; T fInit; double fStart; - hsScalar fInvSecs; + float fInvSecs; public: plTimedValue() {} @@ -67,7 +67,7 @@ public: plTimedValue& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedValue& operator=(const T& v) { return Set(v, 0.f); } - plTimedValue& Set(const T& v, hsScalar secs=0); + plTimedValue& Set(const T& v, float secs=0); operator T () const { return Value(); } @@ -83,7 +83,7 @@ public: plTimedSimple& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedSimple& operator=(const T& v) { return Set(v, 0.f); } - plTimedSimple& Set(const T& v, hsScalar secs=0) { plTimedValue::Set(v, secs); return *this; } + plTimedSimple& Set(const T& v, float secs=0) { plTimedValue::Set(v, secs); return *this; } void Read(hsStream* s); void Write(hsStream* s) const; @@ -97,14 +97,14 @@ public: plTimedCompound& operator=(const plTimedValue& o) { return Set(o, 0.f); } plTimedCompound& operator=(const T& v) { return Set(v, 0.f); } - plTimedCompound& Set(const T& v, hsScalar secs=0) { plTimedValue::Set(v, secs); return *this; } + plTimedCompound& Set(const T& v, float secs=0) { plTimedValue::Set(v, secs); return *this; } void Read(hsStream* s); void Write(hsStream* s) const; }; template -plTimedValue& plTimedValue::Set(const T& v, hsScalar secs) +plTimedValue& plTimedValue::Set(const T& v, float secs) { if( secs <= 0 ) { @@ -126,7 +126,7 @@ T plTimedValue::Value() const { if( fInvSecs > 0 ) { - hsScalar t = (hsScalar)((hsTimer::GetSysSeconds() - fStart) * fInvSecs); + float t = (float)((hsTimer::GetSysSeconds() - fStart) * fInvSecs); hsAssert(t >= 0, "Moving back in time"); if( t < 1.f ) diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp index 2392391f..4a48ff7e 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.cpp @@ -82,7 +82,7 @@ hsBool plTimerCallbackManager::MsgReceive(plMessage* msg) return hsKeyedObject::MsgReceive(msg); } -plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg) +plTimerCallback* plTimerCallbackManager::NewTimer(float time, plMessage* pMsg) { plTimerCallback* t = TRACKED_NEW plTimerCallback( hsTimer::GetSysSeconds() + time, pMsg ); fCallbacks.Append(t); @@ -92,8 +92,8 @@ plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg for (int j = i + 1; j < fCallbacks.Count(); j++) { #if 0 - hsScalar a = fCallbacks[i]->fTime; - hsScalar b = fCallbacks[j]->fTime; + float a = fCallbacks[i]->fTime; + float b = fCallbacks[j]->fTime; #endif if (fCallbacks[i]->fTime < fCallbacks[j]->fTime) { diff --git a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h index 468ab1c8..52429caf 100644 --- a/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h +++ b/Sources/Plasma/NucleusLib/pnTimer/plTimerCallbackManager.h @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plTimerCallbackManager_Defined #define plTimerCallbackManager_Defined -#include "hsScalar.h" + #include "pnKeyedObject/hsKeyedObject.h" #include "hsTemplates.h" @@ -72,7 +72,7 @@ public: CLASSNAME_REGISTER( plTimerCallbackManager ); GETINTERFACE_ANY( plTimerCallbackManager, hsKeyedObject ); - virtual plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg); + virtual plTimerCallback* NewTimer(float time, plMessage* pMsg); hsBool CancelCallback(plTimerCallback* pTimer); hsBool CancelCallbacksToKey(const plKey& key); @@ -100,7 +100,7 @@ public: // External modifier use only static void SetTheTimerCallbackMgr(plTimerCallbackManager *mgr) { fMgr = mgr; } - static plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); } + static plTimerCallback* NewTimer(float time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); } static hsBool CancelCallback(plTimerCallback* pTimer); static hsBool CancelCallbacksToKey(const plKey& key); }; diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp index 34b195cf..9a4d2352 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp @@ -68,7 +68,7 @@ public: uint32_t Write(uint32_t count, const void* buf) { - fProgress->Increment((hsScalar)count); + fProgress->Increment((float)count); if (fIsZipped) return plZlibStream::Write(count, buf); else @@ -155,7 +155,7 @@ static void ManifestDownloaded( PatcherLog(kInfo, " Enqueueing %s: File Sizes Differ", fileName); // If we're still here, then we need to update the file. - patcher->GetProgress()->SetLength((hsScalar)mfs.fileSize + patcher->GetProgress()->GetMax()); + patcher->GetProgress()->SetLength((float)mfs.fileSize + patcher->GetProgress()->GetMax()); patcher->RequestFile(mfs.downloadName, mfs.clientName); } diff --git a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h index 061c89b8..b6c7e1a3 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h +++ b/Sources/Plasma/PubUtilLib/plAudible/plAudibleNull.h @@ -71,11 +71,11 @@ public: void Stop(int index = -1){;} void FastForwardPlay(int index = -1){;} void FastForwardToggle(int index = -1){;} - void SetMin(const hsScalar m,int index = -1){;} // sets minimum falloff distance - void SetMax(const hsScalar m,int index = -1){;} // sets maximum falloff distance + void SetMin(const float m,int index = -1){;} // sets minimum falloff distance + void SetMax(const float m,int index = -1){;} // sets maximum falloff distance virtual plAudible& SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, int index = -1){return *this;} - hsScalar GetMin(int index = -1) const{return 0;} - hsScalar GetMax(int index = -1) const{return 0;} + float GetMin(int index = -1) const{return 0;} + float GetMax(int index = -1) const{return 0;} void SetVelocity(const hsVector3 vel,int index = -1){;} hsVector3 GetVelocity(int index = -1) const; hsPoint3 GetPosition(int index = -1); diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp index 8442924c..ec6c28b2 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp @@ -328,12 +328,12 @@ void plWinAudible::Stop(int index) SND_APPLY_LOOP( index, Stop(), ; ); } -void plWinAudible::SetMin(const hsScalar m,int index) +void plWinAudible::SetMin(const float m,int index) { SND_APPLY_LOOP( index, SetMin( (int)m ), ; ); } -void plWinAudible::SetMax(const hsScalar m,int index) +void plWinAudible::SetMax(const float m,int index) { SND_APPLY_LOOP( index, SetMax( (int)m ), ; ); } @@ -367,14 +367,14 @@ void plWinAudible::ToggleMuted( int index ) } } -hsScalar plWinAudible::GetMin(int index) const +float plWinAudible::GetMin(int index) const { - return (hsScalar)(fSoundObjs[index]->GetMin()); + return (float)(fSoundObjs[index]->GetMin()); } -hsScalar plWinAudible::GetMax(int index) const +float plWinAudible::GetMax(int index) const { - return (hsScalar)(fSoundObjs[index]->GetMax()); + return (float)(fSoundObjs[index]->GetMax()); } void plWinAudible::SetVelocity(const hsVector3 vel,int index) diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h index 0cf1d1b4..6daaf01f 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.h @@ -82,11 +82,11 @@ public: void Stop(int index = -1); void FastForwardPlay(int index = -1); void FastForwardToggle(int index = -1); - void SetMin(const hsScalar m,int index = -1); // sets minimum falloff distance - void SetMax(const hsScalar m,int index = -1); // sets maximum falloff distance + void SetMin(const float m,int index = -1); // sets minimum falloff distance + void SetMax(const float m,int index = -1); // sets maximum falloff distance void SetPosition(const hsPoint3 p, int index = -1); - hsScalar GetMin(int index = -1) const; - hsScalar GetMax(int index = -1) const; + float GetMin(int index = -1) const; + float GetMax(int index = -1) const; virtual void SetVelocity(const hsVector3 vel,int index = -1); hsVector3 GetVelocity(int index = -1) const; hsPoint3 GetPosition(int index = -1); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index a4298745..84772ce5 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp @@ -88,7 +88,7 @@ class plSoftSoundNode { public: const plKey fSoundKey; - hsScalar fRank; + float fRank; plSoftSoundNode *fNext; plSoftSoundNode **fPrev; @@ -120,7 +120,7 @@ class plSoftSoundNode } } - void SortedLink( plSoftSoundNode **prev, hsScalar rank ) + void SortedLink( plSoftSoundNode **prev, float rank ) { fRank = rank; @@ -132,7 +132,7 @@ class plSoftSoundNode } // Larger values are first in the list - void AddToSortedLink( plSoftSoundNode *toAdd, hsScalar rank ) + void AddToSortedLink( plSoftSoundNode *toAdd, float rank ) { if( fRank > rank ) { @@ -632,7 +632,7 @@ void plAudioSystem::UnregisterSoftSound( const plKey soundKey ) void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) { plSoftSoundNode *node, *myNode; - hsScalar distSquared, rank; + float distSquared, rank; plSoftSoundNode *sortedList = nil; int32_t i; @@ -896,7 +896,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg) } else { - plgAudioSys::SetGlobalFadeVolume( (hsScalar)((currTime-fStartFade) / fFadeLength) ); + plgAudioSys::SetGlobalFadeVolume( (float)((currTime-fStartFade) / fFadeLength) ); } } return true; @@ -996,14 +996,14 @@ hsBool plgAudioSys::fMuted = true; hsBool plgAudioSys::fDelayedActivate = false; hsBool plgAudioSys::fEnableEAX = false; hsWindowHndl plgAudioSys::fWnd = nil; -hsScalar plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f }; -hsScalar plgAudioSys::f2D3DBias = 0.75f; +float plgAudioSys::fChannelVolumes[ kNumChannels ] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f }; +float plgAudioSys::f2D3DBias = 0.75f; uint32_t plgAudioSys::fDebugFlags = 0; -hsScalar plgAudioSys::fStreamingBufferSize = 2.f; -hsScalar plgAudioSys::fStreamFromRAMCutoff = 10.f; +float plgAudioSys::fStreamingBufferSize = 2.f; +float plgAudioSys::fStreamFromRAMCutoff = 10.f; uint8_t plgAudioSys::fPriorityCutoff = 9; // We cut off sounds above this priority hsBool plgAudioSys::fEnableExtendedLogs = false; -hsScalar plgAudioSys::fGlobalFadeVolume = 1.f; +float plgAudioSys::fGlobalFadeVolume = 1.f; hsBool plgAudioSys::fLogStreamingUpdates = false; std::string plgAudioSys::fDeviceName; hsBool plgAudioSys::fRestarting = false; @@ -1183,12 +1183,12 @@ void plgAudioSys::Activate(hsBool b) fInit = false; } -void plgAudioSys::SetChannelVolume( ASChannel chan, hsScalar vol ) +void plgAudioSys::SetChannelVolume( ASChannel chan, float vol ) { fChannelVolumes[ chan ] = vol; } -void plgAudioSys::SetGlobalFadeVolume( hsScalar vol ) +void plgAudioSys::SetGlobalFadeVolume( float vol ) { if(!fMuted) fGlobalFadeVolume = vol; @@ -1196,7 +1196,7 @@ void plgAudioSys::SetGlobalFadeVolume( hsScalar vol ) fGlobalFadeVolume = 0; } -hsScalar plgAudioSys::GetChannelVolume( ASChannel chan ) +float plgAudioSys::GetChannelVolume( ASChannel chan ) { return fChannelVolumes[ chan ]; } @@ -1206,12 +1206,12 @@ void plgAudioSys::NextDebugSound( void ) fSys->NextDebugSound(); } -void plgAudioSys::Set2D3DBias( hsScalar bias ) +void plgAudioSys::Set2D3DBias( float bias ) { f2D3DBias = bias; } -hsScalar plgAudioSys::Get2D3Dbias() +float plgAudioSys::Get2D3Dbias() { return f2D3DBias; } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h index b627e02e..4b5af377 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.h @@ -205,21 +205,21 @@ public: static void NextDebugSound( void ); - static void SetChannelVolume( ASChannel chan, hsScalar vol ); - static hsScalar GetChannelVolume( ASChannel chan ); + static void SetChannelVolume( ASChannel chan, float vol ); + static float GetChannelVolume( ASChannel chan ); - static void Set2D3DBias( hsScalar bias ); - static hsScalar Get2D3Dbias(); + static void Set2D3DBias( float bias ); + static float Get2D3Dbias(); - static void SetGlobalFadeVolume( hsScalar vol ); - static hsScalar GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; } + static void SetGlobalFadeVolume( float vol ); + static float GetGlobalFadeVolume( void ) { return fGlobalFadeVolume; } static void SetDebugFlag( uint32_t flag, hsBool set = true ) { if( set ) fDebugFlags |= flag; else fDebugFlags &= ~flag; } static hsBool IsDebugFlagSet( uint32_t flag ) { return fDebugFlags & flag; } static void ClearDebugFlags( void ) { fDebugFlags = 0; } - static hsScalar GetStreamingBufferSize( void ) { return fStreamingBufferSize; } - static void SetStreamingBufferSize( hsScalar size ) { fStreamingBufferSize = size; } + static float GetStreamingBufferSize( void ) { return fStreamingBufferSize; } + static void SetStreamingBufferSize( float size ) { fStreamingBufferSize = size; } static uint8_t GetPriorityCutoff( void ) { return fPriorityCutoff; } static void SetPriorityCutoff( uint8_t cut ) { fPriorityCutoff = cut; if(fSys) fSys->SetMaxNumberOfActiveSounds(); } @@ -227,8 +227,8 @@ public: static hsBool AreExtendedLogsEnabled( void ) { return fEnableExtendedLogs; } static void EnableExtendedLogs( hsBool e ) { fEnableExtendedLogs = e; } - static hsScalar GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; } - static void SetStreamFromRAMCutoff( hsScalar c ) { fStreamFromRAMCutoff = c; } + static float GetStreamFromRAMCutoff( void ) { return fStreamFromRAMCutoff; } + static void SetStreamFromRAMCutoff( float c ) { fStreamFromRAMCutoff = c; } static void SetListenerPos(const hsPoint3 pos); static void SetListenerVelocity(const hsVector3 vel); @@ -261,15 +261,15 @@ private: static hsWindowHndl fWnd; static hsBool fUseHardware; static hsBool fDelayedActivate; - static hsScalar fChannelVolumes[ kNumChannels ]; - static hsScalar fGlobalFadeVolume; + static float fChannelVolumes[ kNumChannels ]; + static float fGlobalFadeVolume; static uint32_t fDebugFlags; static hsBool fEnableEAX; - static hsScalar fStreamingBufferSize; + static float fStreamingBufferSize; static uint8_t fPriorityCutoff; static hsBool fEnableExtendedLogs; - static hsScalar fStreamFromRAMCutoff; - static hsScalar f2D3DBias; + static float fStreamFromRAMCutoff; + static float f2D3DBias; static hsBool fLogStreamingUpdates; static std::string fDeviceName; static hsBool fRestarting; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp index 7a1cf8d3..fd4d5cb1 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.cpp @@ -703,16 +703,16 @@ hsBool plDSoundBuffer::IsEAXAccelerated( void ) const uint32_t plDSoundBuffer::bytePosToMSecs( uint32_t bytePos ) const { - return (uint32_t)(bytePos * 1000 / (hsScalar)fBufferDesc->fAvgBytesPerSec); + return (uint32_t)(bytePos * 1000 / (float)fBufferDesc->fAvgBytesPerSec); } //// GetBufferBytePos //////////////////////////////////////////////////////// -uint32_t plDSoundBuffer::GetBufferBytePos( hsScalar timeInSecs ) const +uint32_t plDSoundBuffer::GetBufferBytePos( float timeInSecs ) const { hsAssert( fBufferDesc != nil, "Nil buffer description when calling GetBufferBytePos()" ); - uint32_t uint8_t = (uint32_t)( timeInSecs * (hsScalar)fBufferDesc->fNumSamplesPerSec ); + uint32_t uint8_t = (uint32_t)( timeInSecs * (float)fBufferDesc->fNumSamplesPerSec ); uint8_t *= fBufferDesc->fBlockAlign; return uint8_t; @@ -742,7 +742,7 @@ uint8_t plDSoundBuffer::GetBlockAlign( void ) const //// SetScalarVolume ///////////////////////////////////////////////////////// // Sets the volume, but on a range from 0 to 1 -void plDSoundBuffer::SetScalarVolume( hsScalar volume ) +void plDSoundBuffer::SetScalarVolume( float volume ) { if(source) { diff --git a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h index 8ec0f7ed..91d79f7a 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plDSoundBuffer.h @@ -76,7 +76,7 @@ public: void Rewind() ; uint32_t GetLengthInBytes( void ) const; - void SetScalarVolume( hsScalar volume ); // Sets the volume, but on a range from 0 to 1 + void SetScalarVolume( float volume ); // Sets the volume, but on a range from 0 to 1 unsigned GetSource() { return source; } void SetPosition(float x, float y, float z); @@ -109,7 +109,7 @@ public: unsigned GetByteOffset(); - uint32_t GetBufferBytePos( hsScalar timeInSecs ) const; + uint32_t GetBufferBytePos( float timeInSecs ) const; uint32_t bytePosToMSecs( uint32_t bytePos ) const; void SetEAXSettings( plEAXSourceSettings *settings, hsBool force = false ); @@ -156,7 +156,7 @@ protected: static float fDefaultMinDistance; unsigned fNumQueuedBuffers; - hsScalar fPrevVolume; + float fPrevVolume; void IAllocate( uint32_t size, plWAVHeader &bufferDesc, hsBool enable3D, hsBool tryStatic ); void IRelease( void ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp index 83eadbb0..b3485152 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp @@ -251,13 +251,13 @@ void plEAXListener::IFail( const char *msg, hsBool major ) // Mutes the given properties, so if you have some props that you want // half strength, this function will do it for ya. -void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent ) +void plEAXListener::IMuteProperties( EAXREVERBPROPERTIES *props, float percent ) { // We only mute the room, roomHF and roomLF, since those control the overall effect // application. All three are a direct linear blend as defined by eax-util.cpp, so // this should be rather easy - hsScalar invPercent = 1.f - percent; + float invPercent = 1.f - percent; // The old way, as dictated by EAX sample code... #ifdef EAX_SDK_AVAILABLE @@ -359,7 +359,7 @@ void plEAXListener::ProcessMods( hsTArray &modArray ) } else { - hsScalar scale = strength / ( totalStrength + strength ); + float scale = strength / ( totalStrength + strength ); EAX3ListenerInterpolate( &finalProps, modArray[ i ]->GetListenerProps(), scale, &finalProps, false ); totalStrength += strength; bMorphing = true; @@ -557,7 +557,7 @@ void plEAXSourceSettings::SetOutsideVolHF( int16_t vol ) fDirtyParams |= kOutsideVolHF; } -void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff ) +void plEAXSourceSettings::SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff ) { fAirAbsorptionFactor = airAbsorption; fRoomRolloffFactor = roomRolloff; @@ -566,7 +566,7 @@ void plEAXSourceSettings::SetFactors( hsScalar airAbsorption, hsScalar roomRo fDirtyParams |= kFactors; } -void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value ) +void plEAXSourceSettings::SetOcclusionSoftValue( float value ) { if( fOcclusionSoftValue != value ) { @@ -578,7 +578,7 @@ void plEAXSourceSettings::SetOcclusionSoftValue( hsScalar value ) void plEAXSourceSettings::IRecalcSofts( uint8_t whichOnes ) { - hsScalar percent, invPercent; + float percent, invPercent; if( whichOnes & kOcclusion ) { @@ -586,9 +586,9 @@ void plEAXSourceSettings::IRecalcSofts( uint8_t whichOnes ) invPercent = 1.f - percent; int16_t occ = (int16_t)( ( (float)fSoftStarts.GetOcclusion() * invPercent ) + ( (float)fSoftEnds.GetOcclusion() * percent ) ); - hsScalar lfRatio = (hsScalar)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) ); - hsScalar roomRatio = (hsScalar)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) ); - hsScalar directRatio = (hsScalar)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) ); + float lfRatio = (float)( ( fSoftStarts.GetOcclusionLFRatio() * invPercent ) + ( fSoftEnds.GetOcclusionLFRatio() * percent ) ); + float roomRatio = (float)( ( fSoftStarts.GetOcclusionRoomRatio() * invPercent ) + ( fSoftEnds.GetOcclusionRoomRatio() * percent ) ); + float directRatio = (float)( ( fSoftStarts.GetOcclusionDirectRatio() * invPercent ) + ( fSoftEnds.GetOcclusionDirectRatio() * percent ) ); fCurrSoftValues.SetOcclusion( occ, lfRatio, roomRatio, directRatio ); } @@ -623,7 +623,7 @@ void plEAXSourceSoftSettings::Write( hsStream *s ) s->WriteLE( fOcclusionDirectRatio ); } -void plEAXSourceSoftSettings::SetOcclusion( int16_t occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio ) +void plEAXSourceSoftSettings::SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio ) { fOcclusion = occ; fOcclusionLFRatio = lfRatio; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h index fb6c0e34..25735687 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.h @@ -90,14 +90,14 @@ protected: void IFail( const char *msg, hsBool major ); void IRelease( void ); - void IMuteProperties( EAXREVERBPROPERTIES *props, hsScalar percent ); + void IMuteProperties( EAXREVERBPROPERTIES *props, float percent ); hsBool fInited; // Cache info int32_t fLastModCount; hsBool fLastWasEmpty; - hsScalar fLastSingleStrength; + float fLastSingleStrength; plEAXListenerMod *fLastBigRegion; }; @@ -111,16 +111,16 @@ class plEAXSourceSoftSettings { public: int16_t fOcclusion; - hsScalar fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio; + float fOcclusionLFRatio, fOcclusionRoomRatio, fOcclusionDirectRatio; void Read( hsStream *s ); void Write( hsStream *s ); - void SetOcclusion( int16_t occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio ); + void SetOcclusion( int16_t occ, float lfRatio, float roomRatio, float directRatio ); int16_t GetOcclusion( void ) const { return fOcclusion; } - hsScalar GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; } - hsScalar GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; } - hsScalar GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; } + float GetOcclusionLFRatio( void ) const { return fOcclusionLFRatio; } + float GetOcclusionRoomRatio( void ) const { return fOcclusionRoomRatio; } + float GetOcclusionDirectRatio( void ) const { return fOcclusionDirectRatio; } void Reset( void ); }; @@ -150,19 +150,19 @@ class plEAXSourceSettings void SetOutsideVolHF( int16_t vol ); int16_t GetOutsideVolHF( void ) const { return fOutsideVolHF; } - void SetFactors( hsScalar airAbsorption, hsScalar roomRolloff, hsScalar doppler, hsScalar rolloff ); - hsScalar GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; } - hsScalar GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; } - hsScalar GetDopplerFactor( void ) const { return fDopplerFactor; } - hsScalar GetRolloffFactor( void ) const { return fRolloffFactor; } + void SetFactors( float airAbsorption, float roomRolloff, float doppler, float rolloff ); + float GetAirAbsorptionFactor( void ) const { return fAirAbsorptionFactor; } + float GetRoomRolloffFactor( void ) const { return fRoomRolloffFactor; } + float GetDopplerFactor( void ) const { return fDopplerFactor; } + float GetRolloffFactor( void ) const { return fRolloffFactor; } plEAXSourceSoftSettings &GetSoftStarts( void ) { return fSoftStarts; } plEAXSourceSoftSettings &GetSoftEnds( void ) { return fSoftEnds; } plEAXSourceSoftSettings &GetCurrSofts( void ) { return fCurrSoftValues; } - void SetOcclusionSoftValue( hsScalar value ); - hsScalar GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; } + void SetOcclusionSoftValue( float value ); + float GetOcclusionSoftValue( void ) const { return fOcclusionSoftValue; } void ClearDirtyParams( void ) const { fDirtyParams = 0; } @@ -174,9 +174,9 @@ class plEAXSourceSettings int16_t fRoom, fRoomHF; hsBool fRoomAuto, fRoomHFAuto; int16_t fOutsideVolHF; - hsScalar fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor; + float fAirAbsorptionFactor, fRoomRolloffFactor, fDopplerFactor, fRolloffFactor; plEAXSourceSoftSettings fSoftStarts, fSoftEnds, fCurrSoftValues; - hsScalar fOcclusionSoftValue; + float fOcclusionSoftValue; mutable uint32_t fDirtyParams; enum ParamSets diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp index 435076fa..8938413c 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp @@ -120,7 +120,7 @@ void plEAXListenerMod::IUnRegister( void ) fRegistered = false; } -hsBool plEAXListenerMod::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plEAXListenerMod::IEval( double secs, float del, uint32_t dirty ) { IRegister(); return false; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h index 02e2e9c5..d898babb 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.h @@ -87,7 +87,7 @@ protected: void IRegister( void ); void IUnRegister( void ); - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // called only by owner object's Eval() + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() }; #endif // _plEAXListenerMod_h diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp index 17821f7b..a5b61793 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp @@ -311,7 +311,7 @@ void plSound::SynchedPlay(unsigned bytes ) // we're given, NOT the current time, 'cause, well, duh, that should be our // start time! // So think of it as "Play() but act as if you started at *this* time"... -void plSound::SynchedPlay( hsScalar virtualStartTime ) +void plSound::SynchedPlay( float virtualStartTime ) { if( fFading ) IStopFade(); @@ -432,7 +432,7 @@ void plSound::SetOuterVolume(const int v) fOuterVol = v; } -void plSound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z ) +void plSound::SetConeOrientation( float x, float y, float z ) { fConeOrientation.Set( x, y, z ); } @@ -561,9 +561,9 @@ void plSound::Update() } } -hsScalar plSound::IGetChannelVolume( void ) const +float plSound::IGetChannelVolume( void ) const { - hsScalar channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType ); + float channelVol = plgAudioSys::GetChannelVolume( (plgAudioSys::ASChannel)fType ); // if not using hardware acceleration then apply 2D/3D bias to non 3D sounds if( !plgAudioSys::Hardware() && !IsPropertySet( kPropIs3DSound ) ) @@ -575,7 +575,7 @@ hsScalar plSound::IGetChannelVolume( void ) const return channelVol * plgAudioSys::GetGlobalFadeVolume(); } -void plSound::IStartFade( plFadeParams *params, hsScalar offsetIntoFade ) +void plSound::IStartFade( plFadeParams *params, float offsetIntoFade ) { fFading = true; @@ -924,27 +924,27 @@ void plSound::ISetSoftOcclusionRegion( plSoftVolume *region ) ///////////////////////////////////////////////////////////////////////// // This function calculates our new softVolume value. Used both to update the // said value and so the audio system can rank us in importance. -hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared ) +float plSound::CalcSoftVolume( hsBool enable, float distToListenerSquared ) { // Do distance-based attenuation ourselves #if MCN_HACK_OUR_ATTEN if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar minDist = (hsScalar)GetMin(); + float minDist = (float)GetMin(); if( distToListenerSquared <= minDist * minDist ) { fDistAttenuation = 1.f; } else { - hsScalar maxDist = (hsScalar)GetMax(); + float maxDist = (float)GetMax(); if( distToListenerSquared >= maxDist * maxDist ) { fDistAttenuation = 0.f; } else { - hsScalar d = (hsScalar)sqrt( distToListenerSquared ); + float d = (float)sqrt( distToListenerSquared ); fDistAttenuation = minDist / d; // The following line ramps it to 0 at the maxDistance. Kinda klunky, but good for now I guess... @@ -959,8 +959,8 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared // ramp down to 0 so we don't get annoying popping when we stop stuff if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar maxDistSquared = (hsScalar)( GetMax() * GetMax() ); - hsScalar distToStartSquared = (hsScalar)(maxDistSquared * 0.50); + float maxDistSquared = (float)( GetMax() * GetMax() ); + float distToStartSquared = (float)(maxDistSquared * 0.50); if( maxDistSquared < 0.f ) // Happens when the max distance is REALLY big { @@ -999,21 +999,21 @@ hsScalar plSound::CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared // Wee function for the audio system. This basically returns the effective // current volume of this sound. Useful for doing things like ranking all // sounds based on volume. -hsScalar plSound::GetVolumeRank( void ) +float plSound::GetVolumeRank( void ) { if( !IsPlaying() && !this->IActuallyPlaying() ) return 0.f; - hsScalar rank = fSoftVolume * fDesiredVol; + float rank = fSoftVolume * fDesiredVol; if( IsPropertySet( kPropIs3DSound ) ) { - hsScalar minDistSquared = (hsScalar)( GetMin() * GetMin() ); - hsScalar maxDistSquared = (hsScalar) (GetMax() * GetMax()); + float minDistSquared = (float)( GetMin() * GetMin() ); + float maxDistSquared = (float) (GetMax() * GetMax()); hsPoint3 listenerPos = plgAudioSys::Sys()->GetCurrListenerPos(); if( fDistToListenerSquared > minDistSquared ) { - hsScalar diff = maxDistSquared - minDistSquared; + float diff = maxDistSquared - minDistSquared; rank *= fabs((fDistToListenerSquared - maxDistSquared)) / diff; } } @@ -1036,7 +1036,7 @@ hsBool plSound::IWillBeAbleToPlay( void ) ///////////////////////////////////////////////////////////////////////// // Tests to see whether this sound is within range of the position given, // ignoring soft volumes. -hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared ) +hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, float *distSquared ) { if( !IsPropertySet( plSound::kPropIs3DSound ) ) { @@ -1056,7 +1056,7 @@ hsBool plSound::IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquare if( GetMax() == 1000000000 ) return true; - hsScalar soundRadius = (hsScalar)( GetMax() * GetMax() ); + float soundRadius = (float)( GetMax() * GetMax() ); return ( distance.MagnitudeSquared() <= soundRadius ) ? true : false; } @@ -1107,7 +1107,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime ) // Note: we just do it as a fade because it makes it easier on us that way! fCoolSoftVolumeTrickParams.fCurrTime = 0.f; - fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (hsScalar)fLength + ( (hsScalar)fLength - (hsScalar)GetTime() ); + fCoolSoftVolumeTrickParams.fLengthInSecs = firstTime ? 0.f : (float)fLength + ( (float)fLength - (float)GetTime() ); fCoolSoftVolumeTrickParams.fStopWhenDone = true; fCoolSoftVolumeTrickParams.fFadeSoftVol = true; fCoolSoftVolumeTrickParams.fType = plFadeParams::kLinear; @@ -1125,7 +1125,7 @@ void plSound::UpdateSoftVolume( hsBool enable, hsBool firstTime ) ///////////////////////////////////////////////////////////////////////// // Returns the current volume, attenuated -hsScalar plSound::QueryCurrVolume( void ) const +float plSound::QueryCurrVolume( void ) const { return IAttenuateActualVolume( fCurrVolume ) * IGetChannelVolume(); } @@ -1133,7 +1133,7 @@ hsScalar plSound::QueryCurrVolume( void ) const ///////////////////////////////////////////////////////////////////////// // Used by ISetActualVolume(). Does the final attenuation on a volume before // sending it to the sound processing. Only does soft regions for now. -hsScalar plSound::IAttenuateActualVolume( hsScalar volume ) const +float plSound::IAttenuateActualVolume( float volume ) const { if( fNotHighEnoughPriority ) return 0.f; @@ -1367,9 +1367,9 @@ void plSound::plFadeParams::Write( hsStream *s ) s->WriteLE( fFadeSoftVol ); } -hsScalar plSound::plFadeParams::InterpValue( void ) +float plSound::plFadeParams::InterpValue( void ) { - hsScalar val; + float val; switch( fType ) { @@ -1382,7 +1382,7 @@ hsScalar plSound::plFadeParams::InterpValue( void ) break; case kExponential: val = fCurrTime / fLengthInSecs; - val = ( (hsScalar)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart; + val = ( (float)sqrt( val ) * ( fVolEnd - fVolStart ) ) + fVolStart; break; default: val = 0.f; @@ -1390,7 +1390,7 @@ hsScalar plSound::plFadeParams::InterpValue( void ) return val; } -void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length ) +void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, float length ) { fFadeInParams.fLengthInSecs = length; fFadeInParams.fType = type; @@ -1406,7 +1406,7 @@ void plSound::SetFadeInEffect( plSound::plFadeParams::Type type, hsScalar length fFading = false; } -void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, hsScalar length ) +void plSound::SetFadeOutEffect( plSound::plFadeParams::Type type, float length ) { fFadeOutParams.fLengthInSecs = length; fFadeOutParams.fType = type; @@ -1422,9 +1422,9 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h if( fOuterCone < 360 ) { - hsScalar len = (hsScalar)GetMax(); - hsScalar halfAng = hsScalarDegToRad(hsScalar(fInnerCone) * 0.5f); - hsScalar radius = len * tanf(halfAng); + float len = (float)GetMax(); + float halfAng = hsDegreesToRadians(float(fInnerCone) * 0.5f); + float radius = len * tanf(halfAng); if( fInnerCone < 180 ) len = -len; myDraw = plDrawableGenerator::GenerateConicalDrawable( @@ -1437,8 +1437,8 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h &idx, myDraw); - len = (hsScalar)GetMin(); - halfAng = hsScalarDegToRad(hsScalar(fOuterCone) * 0.5f); + len = (float)GetMin(); + halfAng = hsDegreesToRadians(float(fOuterCone) * 0.5f); radius = len * tanf(halfAng); if( fOuterCone < 180 ) len = -len; @@ -1457,7 +1457,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h { myDraw = plDrawableGenerator::GenerateSphericalDrawable( hsPoint3(0,0,0), - (hsScalar)GetMin(), + (float)GetMin(), mat, l2w, true, @@ -1467,7 +1467,7 @@ plDrawableSpans* plSound::CreateProxy(const hsMatrix44& l2w, hsGMaterial* mat, h myDraw = plDrawableGenerator::GenerateSphericalDrawable( hsPoint3(0,0,0), - (hsScalar)GetMax(), + (float)GetMax(), mat, l2w, true, @@ -1502,9 +1502,9 @@ void plSoundVolumeApplicator::IApply( const plAGModifier *mod, double time ) plScalarChannel *chan = plScalarChannel::ConvertNoRef( fChannel ); if(chan) { - hsScalar volume = chan->Value( time ); + float volume = chan->Value( time ); - hsScalar digitalVolume = (float)pow( 10.f, volume / 20.f ); + float digitalVolume = (float)pow( 10.f, volume / 20.f ); // Find the audio interface and thus the plSound from it plSceneObject *so = mod->GetTarget( 0 ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.h b/Sources/Plasma/PubUtilLib/plAudio/plSound.h index 89f53e07..810921c8 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.h @@ -149,16 +149,16 @@ public: kExponential }; - hsScalar fLengthInSecs; // Time to take to fade - hsScalar fVolStart; // Set one of these two for fade in/out, - hsScalar fVolEnd; // the other becomes the current volume + float fLengthInSecs; // Time to take to fade + float fVolStart; // Set one of these two for fade in/out, + float fVolEnd; // the other becomes the current volume uint8_t fType; hsBool fStopWhenDone; // Actually stop the sound once the fade is complete hsBool fFadeSoftVol; // Fade the soft volume instead of fCurrVolume plFadeParams() { fLengthInSecs = 0.f; fCurrTime = -1.f; fStopWhenDone = false; fFadeSoftVol = false; fVolStart = fVolEnd = 0.f; fType = kLinear; } - plFadeParams( Type type, hsScalar len, hsScalar start, hsScalar end ) + plFadeParams( Type type, float len, float start, float end ) { fLengthInSecs = len; fVolStart = start; fVolEnd = end; fType = type; fStopWhenDone = false; @@ -168,18 +168,18 @@ public: void Read( hsStream *s ); void Write( hsStream *s ); - hsScalar InterpValue( void ); + float InterpValue( void ); protected: - hsScalar fCurrTime; // -1 if we aren't active, else it's how far we're into the animation + float fCurrTime; // -1 if we aren't active, else it's how far we're into the animation }; virtual hsBool LoadSound( hsBool is3D ) = 0; - hsScalar GetVirtualStartTime( void ) const { return (hsScalar)fVirtualStartTime; } + float GetVirtualStartTime( void ) const { return (float)fVirtualStartTime; } virtual void Play(); void SynchedPlay( unsigned bytes ); - void SynchedPlay( hsScalar virtualStartTime ); + void SynchedPlay( float virtualStartTime ); virtual void Stop(); virtual void FastForwardPlay(); virtual void FastForwardToggle(); @@ -189,7 +189,7 @@ public: virtual int GetMax() const; virtual void SetVolume(const float volume); virtual float GetVolume(void) const { return fCurrVolume; } - hsScalar GetMaxVolume() { return fMaxVolume; } + float GetMaxVolume() { return fMaxVolume; } virtual hsBool IsPlaying() { return fPlaying; } void SetTime(double t); virtual double GetTime( void ) { return 0.f; } @@ -200,7 +200,7 @@ public: virtual hsBool IsMuted( void ) { return fMuted; } void Disable() { fDistAttenuation = 0; } virtual plSoundMsg* GetStatus(plSoundMsg* pMsg){return NULL;} - virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z); + virtual void SetConeOrientation(float x, float y, float z); virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable) virtual void SetConeAngles( int inner, int outer ); virtual void SetPosition(const hsPoint3 pos); @@ -211,7 +211,7 @@ public: virtual void Update(); plSoundBuffer * GetDataBuffer( void ) const { return (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); } - hsScalar QueryCurrVolume( void ) const; // Returns the current volume, attenuated + float QueryCurrVolume( void ) const; // Returns the current volume, attenuated const char * GetFileName( void ) const; virtual double GetLength(); @@ -233,16 +233,16 @@ public: virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - virtual void SetFadeInEffect( plFadeParams::Type type, hsScalar length ); - virtual void SetFadeOutEffect( plFadeParams::Type type, hsScalar length ); - virtual hsScalar CalcSoftVolume( hsBool enable, hsScalar distToListenerSquared ); + virtual void SetFadeInEffect( plFadeParams::Type type, float length ); + virtual void SetFadeOutEffect( plFadeParams::Type type, float length ); + virtual float CalcSoftVolume( hsBool enable, float distToListenerSquared ); virtual void UpdateSoftVolume( hsBool enable, hsBool firstTime = false ); virtual hsBool MsgReceive( plMessage* pMsg ); virtual hsBool DirtySynchState( const char *sdlName = nil, uint32_t sendFlags = 0 ); // call when state has changed // Tests whether this sound is within range of the given position, not counting soft regions - hsBool IsWithinRange( const hsPoint3 &listenerPos, hsScalar *distSquared ); + hsBool IsWithinRange( const hsPoint3 &listenerPos, float *distSquared ); // Type setting and getting, from the Types enum void SetType( uint8_t type ) { fType = type; } @@ -266,7 +266,7 @@ public: void UnregisterOnAudioSys( void ); // Also only for the audio system - hsScalar GetVolumeRank( void ); + float GetVolumeRank( void ); void ForceUnregisterFromAudioSys( void ); static void SetLoadOnDemand( hsBool activate ) { fLoadOnDemandFlag = activate; } @@ -284,10 +284,10 @@ protected: double fTime; int fMaxFalloff; int fMinFalloff; - hsScalar fCurrVolume; - hsScalar fDesiredVol; // Equal to fCurrVolume except when we're fading or muted - hsScalar fFadedVolume; - hsScalar fMaxVolume; + float fCurrVolume; + float fDesiredVol; // Equal to fCurrVolume except when we're fading or muted + float fFadedVolume; + float fMaxVolume; int fOuterVol; int fInnerCone; @@ -322,8 +322,8 @@ protected: plFadeParams *fCurrFadeParams; plSoftVolume *fSoftRegion; - hsScalar fSoftVolume; - hsScalar fDistAttenuation, fDistToListenerSquared; + float fSoftVolume; + float fDistAttenuation, fDistToListenerSquared; double fVirtualStartTime; hsBool fRegistered; static unsigned fIncidentalsPlaying; @@ -356,17 +356,17 @@ protected: virtual hsBool IActuallyLoaded( void ) = 0; virtual void IRefreshEAXSettings( hsBool force = false ) = 0; - virtual hsScalar IGetChannelVolume( void ) const; + virtual float IGetChannelVolume( void ) const; void ISynchToStartTime( void ); void ISynchedPlay( double virtualStartTime ); - void IStartFade( plFadeParams *params, hsScalar offsetIntoFade = 0.f ); + void IStartFade( plFadeParams *params, float offsetIntoFade = 0.f ); void IStopFade( hsBool shuttingDown = false, hsBool SetVolEnd = true); hsBool IWillBeAbleToPlay( void ); void ISetSoftRegion( plSoftVolume *region ); - hsScalar IAttenuateActualVolume( hsScalar volume ) const; + float IAttenuateActualVolume( float volume ) const; void ISetSoftOcclusionRegion( plSoftVolume *region ); // Override to make sure the buffer is available before the base class is called diff --git a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp index 927d4923..14406427 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp @@ -76,7 +76,7 @@ hsBool plVoiceRecorder::fCompress = true; hsBool plVoiceRecorder::fRecording = true; hsBool plVoiceRecorder::fNetVoice = false; short plVoiceRecorder::fSampleRate = FREQUENCY; -hsScalar plVoiceRecorder::fRecordThreshhold = 200.0f; +float plVoiceRecorder::fRecordThreshhold = 200.0f; hsBool plVoiceRecorder::fShowIcons = true; hsBool plVoiceRecorder::fMicAlwaysOpen = false; hsBool plVoicePlayer::fEnabled = true; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h index 37ae0503..26fe362e 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.h @@ -130,7 +130,7 @@ public: static void EnableNetVoice(hsBool b) { fNetVoice = b; } static void EnableCompression(hsBool b) { fCompress = b; } static void SetSampleRate(short s) { fSampleRate = s; } - static void SetSquelch(hsScalar f) { fRecordThreshhold = f; } + static void SetSquelch(float f) { fRecordThreshhold = f; } static void IncreaseRecordingThreshhold(); static void DecreaseRecordingThreshhold(); @@ -154,7 +154,7 @@ private: static short fSampleRate; plPlate* fDisabledIcon; plPlate* fTalkIcon; - static hsScalar fRecordThreshhold; + static float fRecordThreshhold; }; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp index acbed0ea..8f59f655 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp @@ -79,7 +79,7 @@ plWin32GroupedSound::~plWin32GroupedSound() DeActivate(); } -void plWin32GroupedSound::SetPositionArray( uint16_t numSounds, uint32_t *posArray, hsScalar *volumeArray ) +void plWin32GroupedSound::SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray ) { uint16_t i; @@ -260,12 +260,12 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) //// GetSoundLength ////////////////////////////////////////////////////////// // Gets the length (in seconds) of the given sound index from the group. -hsScalar plWin32GroupedSound::GetSoundLength( int16_t soundIndex ) +float plWin32GroupedSound::GetSoundLength( int16_t soundIndex ) { plSoundBuffer *buffer = (plSoundBuffer *)fDataBufferKey->ObjectIsLoaded(); if(buffer) { - return (hsScalar)IGetSoundbyteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec; + return (float)IGetSoundbyteLength( soundIndex ) / buffer->GetHeader().fAvgBytesPerSec; } return 0; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h index 41a5e134..76e2d476 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.h @@ -70,15 +70,15 @@ public: virtual hsBool LoadSound( hsBool is3D ); virtual hsBool MsgReceive( plMessage *pMsg ); - void SetPositionArray( uint16_t numSounds, uint32_t *posArray, hsScalar *volumeArray ); - hsScalar GetSoundLength( int16_t soundIndex ); + void SetPositionArray( uint16_t numSounds, uint32_t *posArray, float *volumeArray ); + float GetSoundLength( int16_t soundIndex ); virtual double GetLength() { return GetSoundLength( fCurrentSound ); } protected: uint16_t fCurrentSound; uint32_t fCurrentSoundLength; hsTArray fStartPositions; // In bytes - hsTArray fVolumes; + hsTArray fVolumes; // Some extra handy info for us uint8_t fNumDestChannels, fNumDestBytesPerSample; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index 5f2e2c93..0ce0421d 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -229,7 +229,7 @@ void plWin32Sound::SetConeAngles( int inner, int outer ) } } -void plWin32Sound::SetConeOrientation( hsScalar x, hsScalar y, hsScalar z ) +void plWin32Sound::SetConeOrientation( float x, float y, float z ) { plSound::SetConeOrientation(x, y, z); if(fDSoundBuffer) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h index 1d12fbde..a9e92180 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.h @@ -80,7 +80,7 @@ public: virtual void SetMin(const int m); // sets minimum falloff distance virtual void SetMax(const int m); // sets maximum falloff distance - virtual void SetConeOrientation(hsScalar x, hsScalar y, hsScalar z); + virtual void SetConeOrientation(float x, float y, float z); virtual void SetOuterVolume( const int v ); // volume for the outer cone (if applicable) virtual void SetConeAngles( int inner, int outer ); virtual void SetPosition(const hsPoint3 pos); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp index aa5764d4..c8f4c98b 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp @@ -182,7 +182,7 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D ) plProfile_NewMem(MemSounds, fTotalBytes); // get pertinent info - hsScalar length = (hsScalar)bufferSize / (hsScalar)header.fAvgBytesPerSec; + float length = (float)bufferSize / (float)header.fAvgBytesPerSec; SetLength(length); if( fLoadFromDiskOnDemand && !IsPropertySet( kPropLoadOnlyOnCall ) ) diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 647a7c5b..33eabbfd 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -364,7 +364,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) plStatusLog::AddLineS( "audioTimes.log", 0xffffffff, "Streaming %4.2f secs of %s", fDataStream->GetLengthInSecs(), GetKey()->GetUoid().GetObjectName() ); // Get pertinent info - SetLength( (hsScalar)fDataStream->GetLengthInSecs() ); + SetLength( (float)fDataStream->GetLengthInSecs() ); // Set up our deswizzler, if necessary delete fDeswizzler; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h index 53bdf3a3..ea409cb5 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.h @@ -70,9 +70,9 @@ public: virtual hsBool MsgReceive( plMessage *pMsg ); protected: - hsScalar fTimeAtBufferStart; + float fTimeAtBufferStart; plAudioFileReader *fDataStream; - hsScalar fBufferLengthInSecs; + float fBufferLengthInSecs; uint8_t fBlankBufferFillCounter; plSoundDeswizzler *fDeswizzler; char fSrcFilename[ 256 ]; @@ -86,7 +86,7 @@ protected: bool fPlayWhenStopped; unsigned fStartPos; - hsScalar IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; } + float IGetTimeAtBufferStart( void ) { return fTimeAtBufferStart; } virtual void SetStartPos(unsigned bytes); virtual void IDerivedActuallyPlay( void ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp index 9eaabeb2..4e231377 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.cpp @@ -86,7 +86,7 @@ MIXERLINE *IGetMixerSubLineByType( MIXERCONTROL *mux, DWORD type ); //// The Publics ///////////////////////////////////////////////////////////// -hsScalar plWinMicLevel::GetLevel( void ) +float plWinMicLevel::GetLevel( void ) { if( !CanSetLevel() ) return -1; @@ -96,13 +96,13 @@ hsScalar plWinMicLevel::GetLevel( void ) if( !IGetControlValue( rawValue ) ) return -1; - return (hsScalar)( rawValue - sMinValue ) / (hsScalar)( sMaxValue - sMinValue ); + return (float)( rawValue - sMinValue ) / (float)( sMaxValue - sMinValue ); #else return -1; #endif } -void plWinMicLevel::SetLevel( hsScalar level ) +void plWinMicLevel::SetLevel( float level ) { if( !CanSetLevel() ) return; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h index bd7baec9..07f088ca 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h +++ b/Sources/Plasma/PubUtilLib/plAudio/plWinMicLevel.h @@ -63,10 +63,10 @@ public: ~plWinMicLevel(); // Gets the microphone volume, range 0-1, -1 if error - static hsScalar GetLevel( void ); + static float GetLevel( void ); // Sets the microphone volume, range 0-1 - static void SetLevel( hsScalar level ); + static void SetLevel( float level ); // Returns whether we can set the level static hsBool CanSetLevel( void ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp index d0dde7a8..78d30a12 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp @@ -212,9 +212,9 @@ void plSoundBuffer::IInitBuffer() //// GetDataLengthInSecs ///////////////////////////////////////////////////// -hsScalar plSoundBuffer::GetDataLengthInSecs( void ) const +float plSoundBuffer::GetDataLengthInSecs( void ) const { - return (hsScalar)fDataLength / (hsScalar)fHeader.fAvgBytesPerSec; + return (float)fDataLength / (float)fHeader.fAvgBytesPerSec; } //// Read/Write ////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h index e5e11562..43920065 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.h @@ -98,7 +98,7 @@ public: void *GetData( void ) const { return fData; } const char *GetFileName( void ) const { return fFileName; } hsBool IsValid( void ) const { return fValid; } - hsScalar GetDataLengthInSecs( void ) const; + float GetDataLengthInSecs( void ) const; void SetFileName( const char *name ); hsBool HasFlag( uint32_t flag ) { return ( fFlags & flag ) ? true : false; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp index db39bcde..525710a5 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp @@ -82,8 +82,8 @@ plAGAnim::plAGAnim() // ctor ------------------------------------------------------ // ----- plAGAnim::plAGAnim(const char *name, double start, double end) -: fStart((hsScalar)start), - fEnd((hsScalar)end) +: fStart((float)start), + fEnd((float)end) { if (name == nil) name = ""; @@ -197,7 +197,7 @@ hsBool plAGAnim::RemoveApplicator(int index) // ExtendToLength ---------------------------- // --------------- -void plAGAnim::ExtendToLength(hsScalar length) +void plAGAnim::ExtendToLength(float length) { if (length > GetEnd()) SetEnd(length); @@ -371,8 +371,8 @@ plATCAnim::plATCAnim(const char *name, double start, double end) : plAGAnim(name, start, end), fInitial(-1), fAutoStart(true), - fLoopStart((hsScalar)start), - fLoopEnd((hsScalar)end), + fLoopStart((float)start), + fLoopEnd((float)end), fLoop(false), fEaseInType(plAnimEaseTypes::kNoEase), fEaseOutType(plAnimEaseTypes::kNoEase), @@ -578,7 +578,7 @@ void plATCAnim::CopyMarkerNames(std::vector &out) // AddStopPoint --------------------------- // ------------- -void plATCAnim::AddStopPoint(hsScalar time) +void plATCAnim::AddStopPoint(float time) { fStopPoints.push_back(time); } @@ -592,7 +592,7 @@ uint32_t plATCAnim::NumStopPoints() // GetStopPoint -------------------------- // ------------- -hsScalar plATCAnim::GetStopPoint(uint32_t i) +float plATCAnim::GetStopPoint(uint32_t i) { hsAssert(i < fStopPoints.size(), "Invalid index for GetStopPoint"); return fStopPoints[i]; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h index 7906cb02..ef75eced 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h @@ -144,22 +144,22 @@ public: virtual const char * GetName() const { return fName; } /** Return the length of the animation; end - start. */ - virtual hsScalar GetLength() const { return fEnd - fStart; } + virtual float GetLength() const { return fEnd - fStart; } /** Hacky function to extend the length of the animation to some minimum length. Does nothing if the animation is already longer than this. */ - void ExtendToLength(hsScalar length); + void ExtendToLength(float length); /** Return the start time for the beginning of the animation. The animation contains no data prior to this time. In practice, this always returns 0.0f and this function may be deprecated. */ - virtual hsScalar GetStart() const { return fStart; } - void SetStart(hsScalar start) { fStart = start; } + virtual float GetStart() const { return fStart; } + void SetStart(float start) { fStart = start; } /** Return the end time of the animation. Since start is typically 0, this usually serves as the length of the animation as well. */ - virtual hsScalar GetEnd() const { return fEnd; } - void SetEnd(hsScalar end) { fEnd = end; } + virtual float GetEnd() const { return fEnd; } + void SetEnd(float end) { fEnd = end; } /** Returns true if any applicator on the arg anim tries to use the @@ -199,8 +199,8 @@ protected: ApplicatorVec fApps; /// our animation channels float fBlend; /// requested blend factor - hsScalar fStart; /// the start time of the beginning of the animation (usually 0) - hsScalar fEnd; /// the end time of the animation + float fStart; /// the start time of the beginning of the animation (usually 0) + float fEnd; /// the end time of the animation char *fName; /// the name of our animation @@ -238,8 +238,8 @@ public: Animations are not required to start at their actual beginning but can, for instance, start in the middle, play to the end, and then loop to the beginning or to their loop start point. */ - virtual hsScalar GetInitial() const { return fInitial; } - void SetInitial(hsScalar initial) { fInitial = initial; } + virtual float GetInitial() const { return fInitial; } + void SetInitial(float initial) { fInitial = initial; } /** Does this animation start automatically when it's applied? */ virtual bool GetAutoStart() const { return fAutoStart; } @@ -247,13 +247,13 @@ public: /** If the animation loops, this is where it will restart the loop. Note that loops do not have to start at the beginning of the animation. */ - virtual hsScalar GetLoopStart() const { return fLoopStart; } - void SetLoopStart(hsScalar start) { fLoopStart = start; } + virtual float GetLoopStart() const { return fLoopStart; } + void SetLoopStart(float start) { fLoopStart = start; } /** If the animation loops, this is the end point of the loop. After passing this point, the animation will cycle around to GetLoopStart */ - virtual hsScalar GetLoopEnd() const { return fLoopEnd; } - void SetLoopEnd(hsScalar end) { fLoopEnd = end; } + virtual float GetLoopEnd() const { return fLoopEnd; } + void SetLoopEnd(float end) { fLoopEnd = end; } /** Does this animation loop?. Note that there may be multiple loop segments defined within a given animation. */ @@ -268,19 +268,19 @@ public: void SetEaseInType(uint8_t type) { fEaseInType = type; } /** Set the length of time the ease-in should take. */ - virtual hsScalar GetEaseInLength() const { return fEaseInLength; } + virtual float GetEaseInLength() const { return fEaseInLength; } /** Set the length of time the ease-in should take. */ - void SetEaseInLength(hsScalar length) { fEaseInLength = length; } + void SetEaseInLength(float length) { fEaseInLength = length; } /** The minimum value used at the start of the ease in. */ - virtual hsScalar GetEaseInMin() const { return fEaseInMin; } + virtual float GetEaseInMin() const { return fEaseInMin; } /** The minimum value used at the start of the ease in. */ - void SetEaseInMin(hsScalar length) { fEaseInMin = length; } + void SetEaseInMin(float length) { fEaseInMin = length; } /** The maximum value reached at the end of the ease in. */ - virtual hsScalar GetEaseInMax() const { return fEaseInMax; } + virtual float GetEaseInMax() const { return fEaseInMax; } /** The maximum value reached at the end of the ease in. */ - void SetEaseInMax(hsScalar length) { fEaseInMax = length; } + void SetEaseInMax(float length) { fEaseInMax = length; } /** The curve type for the ease out. */ virtual uint8_t GetEaseOutType() const { return fEaseOutType; } @@ -288,19 +288,19 @@ public: void SetEaseOutType(uint8_t type) { fEaseOutType = type; } /** The length of time for the ease out. */ - virtual hsScalar GetEaseOutLength() const { return fEaseOutLength; } + virtual float GetEaseOutLength() const { return fEaseOutLength; } /** The length of time for the ease out. */ - void SetEaseOutLength(hsScalar length) { fEaseOutLength = length; } + void SetEaseOutLength(float length) { fEaseOutLength = length; } /** Minimum value reached in ease-out */ - virtual hsScalar GetEaseOutMin() const { return fEaseOutMin; } + virtual float GetEaseOutMin() const { return fEaseOutMin; } /** Minimum value reached in ease-out */ - void SetEaseOutMin(hsScalar length) { fEaseOutMin = length; } + void SetEaseOutMin(float length) { fEaseOutMin = length; } /** Maximum value reached in ease-in */ - virtual hsScalar GetEaseOutMax() const { return fEaseOutMax; } + virtual float GetEaseOutMax() const { return fEaseOutMax; } /** Maximum value reached in ease-in */ - void SetEaseOutMax(hsScalar length) { fEaseOutMax = length; } + void SetEaseOutMax(float length) { fEaseOutMax = length; } /** Animations can have multiple defined loop segments; these are selected using animation control messages. @@ -327,12 +327,12 @@ public: near a stop point and fading out, the stop point will override the fade, so that the animation stops precisely at the defined time. */ - void AddStopPoint(hsScalar time); + void AddStopPoint(float time); /** Return the number of stop points defined for this animation. */ uint32_t NumStopPoints(); /** Get the time corresponding to the given stop point. Stop points are numbered in the order they were added. */ - hsScalar GetStopPoint(uint32_t i); + float GetStopPoint(uint32_t i); /** Function to check for a zero-length loop, and set it to the anim's start/end instead */ void CheckLoop(); @@ -347,20 +347,20 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); protected: - hsScalar fInitial; /// the position of the playback head + float fInitial; /// the position of the playback head bool fAutoStart; /// does the animation start automatically? - hsScalar fLoopStart; /// when wrapping a loop, start here - hsScalar fLoopEnd; /// when you reach this point, loop back + float fLoopStart; /// when wrapping a loop, start here + float fLoopEnd; /// when you reach this point, loop back bool fLoop; /// do we loop? uint8_t fEaseInType; /// the type (none/linear/spline) of our ease-in curve, if any uint8_t fEaseOutType; /// the type (none/linear/spline) of our ease-out curve, if any - hsScalar fEaseInLength; /// the length of time our ease-in curve takes - hsScalar fEaseInMin; /// minimum (initial) value of our ease-in - hsScalar fEaseInMax; /// maximum (final) value of our ease-in - hsScalar fEaseOutLength; /// the length of time our ease-out curve takes - hsScalar fEaseOutMin; /// minimum (final) value of our ease-out - hsScalar fEaseOutMax; /// maximum (initial) value of our ease-out + float fEaseInLength; /// the length of time our ease-in curve takes + float fEaseInMin; /// minimum (initial) value of our ease-in + float fEaseInMax; /// maximum (final) value of our ease-in + float fEaseOutLength; /// the length of time our ease-out curve takes + float fEaseOutMin; /// minimum (final) value of our ease-out + float fEaseOutMax; /// maximum (initial) value of our ease-out // a map from segment names to times typedef std::map MarkerMap; @@ -369,7 +369,7 @@ protected: typedef std::map, stringSorter> LoopMap; LoopMap fLoops; - typedef std::vector ScalarMap; + typedef std::vector ScalarMap; ScalarMap fStopPoints; /// vector of stop points }; @@ -387,8 +387,8 @@ public: plEmoteAnim(const char *animName, double begin, double end, float fadeIn, float fadeOut, BodyUsage bodyUsage); BodyUsage GetBodyUsage() const; - hsScalar GetFadeIn() const; - hsScalar GetFadeOut() const; + float GetFadeIn() const; + float GetFadeOut() const; CLASSNAME_REGISTER( plEmoteAnim ); GETINTERFACE_ANY( plEmoteAnim, plATCAnim ); @@ -398,8 +398,8 @@ public: protected: BodyUsage fBodyUsage; // how much of the body is used by this emote? - hsScalar fFadeIn; // how fast to fade in the emote - hsScalar fFadeOut; // how fast to fade out the emote + float fFadeIn; // how fast to fade in the emote + float fFadeOut; // how fast to fade out the emote }; ////////////////// diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp index cf29bead..0a7003ff 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp @@ -91,7 +91,7 @@ extern const char *gGlobalChannelName = nil; // ctor ------------------------------------------------------------------- // ----- plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, - hsScalar blend, uint16_t blendPriority, hsBool cache, + float blend, uint16_t blendPriority, hsBool cache, bool useAmplitude) : fAnimation(anim), fMaster(master), @@ -214,7 +214,7 @@ void plAGAnimInstance::IRegisterDetach(const char *channelName, plAGChannel *cha // SetCurrentTime --------------------------------------------------------------- // --------------- -void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */) +void plAGAnimInstance::SetCurrentTime(float localT, hsBool jump /* = false */) { if (fTimeConvert) fTimeConvert->SetCurrentAnimTime(localT, jump); @@ -222,11 +222,11 @@ void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */ // SeekRelative ------------------------------------ // ------------- -void plAGAnimInstance::SeekRelative (hsScalar delta, hsBool jump) +void plAGAnimInstance::SeekRelative (float delta, hsBool jump) { if(fTimeConvert) { - hsScalar now = fTimeConvert->CurrentAnimTime(); + float now = fTimeConvert->CurrentAnimTime(); fTimeConvert->SetCurrentAnimTime (now + delta, jump); } } @@ -281,7 +281,7 @@ void plAGAnimInstance::DetachChannels() // SetBlend --------------------------------------- // --------- -hsScalar plAGAnimInstance::SetBlend(hsScalar blend) +float plAGAnimInstance::SetBlend(float blend) { float oldBlend = fBlend.Value(0.0, true); if(oldBlend != blend && @@ -298,14 +298,14 @@ hsScalar plAGAnimInstance::SetBlend(hsScalar blend) // GetBlend ------------------------- // --------- -hsScalar plAGAnimInstance::GetBlend() +float plAGAnimInstance::GetBlend() { return fBlend.Value(0); } // SetAmplitude ------------------------------------- // ------------- -hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp) +float plAGAnimInstance::SetAmplitude(float amp) { if(fAmplitude.Get() != -1.0f) { @@ -316,7 +316,7 @@ hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp) // GetAmplitude ------------------------- // ------------- -hsScalar plAGAnimInstance::GetAmplitude() +float plAGAnimInstance::GetAmplitude() { return fAmplitude.Value(0); } @@ -431,10 +431,10 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks) // ProcessFade ------------------------------------- // ------------ -void plAGAnimInstance::ProcessFade(hsScalar elapsed) +void plAGAnimInstance::ProcessFade(float elapsed) { if (fFadeBlend) { - hsScalar newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed); + float newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed); SetBlend(newBlend); if(fFadeDetach && (newBlend == fFadeBlendGoal) && (fFadeBlendGoal == 0.0f) ) { @@ -444,19 +444,19 @@ void plAGAnimInstance::ProcessFade(hsScalar elapsed) } if (fFadeAmp && fAmplitude.Get() != -1.0f) { - hsScalar curAmp = GetAmplitude(); - hsScalar newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed); + float curAmp = GetAmplitude(); + float newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed); SetAmplitude(newAmp); } } // ICalcFade --------------------------------------------------------------------- // ---------- -hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal, - hsScalar rate, hsScalar elapsed) +float plAGAnimInstance::ICalcFade(hsBool &fade, float curVal, float goal, + float rate, float elapsed) { - hsScalar newVal; - hsScalar curStep = rate * elapsed; + float newVal; + float curStep = rate * elapsed; if(rate > 0) { newVal = std::min(goal, curVal + curStep); } else { @@ -473,21 +473,21 @@ hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goa // FadeAndDetach ------------------------------------------------- // -------------- -void plAGAnimInstance::FadeAndDetach(hsScalar goal, hsScalar rate) +void plAGAnimInstance::FadeAndDetach(float goal, float rate) { ISetupFade(goal, rate, true, kFadeBlend); } // Fade -------------------------------------------------------------------------------- // ----- -void plAGAnimInstance::Fade(hsScalar goal, hsScalar rate, uint8_t type /* = kFadeBlend */) +void plAGAnimInstance::Fade(float goal, float rate, uint8_t type /* = kFadeBlend */) { ISetupFade(goal, rate, false, type); } // ISetupFade -------------------------------------------------------------------------- // ----------- -void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, uint8_t type) +void plAGAnimInstance::ISetupFade(float goal, float rate, bool detach, uint8_t type) { if (rate == 0) { @@ -509,7 +509,7 @@ void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, uin rate = (rate > 0 ? rate : -rate); // For old code that sends negative values - hsScalar curVal = 0; + float curVal = 0; switch (type) { case kFadeBlend: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h index 9a51506c..7c2ffd2d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h @@ -98,7 +98,7 @@ public: This attaches the animation channels to the channels of the master modifier and creates all the bookkeeping structures necessary to undo it later. */ - plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, hsScalar blend, uint16_t blendPriority, hsBool cache, bool useAmplitude); + plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, float blend, uint16_t blendPriority, hsBool cache, bool useAmplitude); /** Destructor. Removes the animation from the scene objects it's attached to. */ virtual ~plAGAnimInstance(); @@ -112,7 +112,7 @@ public: /** Set the speed of the animation. This is expressed as a fraction of the speed with which the animation was defined. */ - void SetSpeed(hsScalar speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); }; + void SetSpeed(float speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); }; // \{ /** @@ -126,8 +126,8 @@ public: yet been seen to have any practical utility whatsoever. Note that even if an animation has a blend strength of 1.0, it may have another animation on top/downstream from it that is masking it completely. */ - hsScalar SetBlend(hsScalar blend); - hsScalar GetBlend(); + float SetBlend(float blend); + float GetBlend(); // \} /** Set the strength of the animation with respect to its 0th frame. @@ -135,9 +135,9 @@ public: Animations must be designed to use this: frame 0 of the animation must be a reasonable "default pose" as it will be blended with the current frame of the animation to produce the result. */ - hsScalar SetAmplitude(hsScalar amp); + float SetAmplitude(float amp); /** Get the current strength of the animation. */ - hsScalar GetAmplitude(); + float GetAmplitude(); /** Make this animation loop (or not.) Note that the instance can loop or not without regard to whether the plAGAnim it is based on loops. */ @@ -159,20 +159,20 @@ public: Note that this time is in animation local time, not global time. The "jump" parameter specifies whether or not to fire callbacks that occur between the current time and the target time. */ - void SetCurrentTime(hsScalar newLocalTime, hsBool jump = false); + void SetCurrentTime(float newLocalTime, hsBool jump = false); /** Move the playback head by the specified relative amount within the animation. This may cause looping. If the beginning or end of the animation is reached an looping is not on, the movement will pin. \param jump if true, don't look for callbacks between old time and TRACKED_NEW */ - void SeekRelative(hsScalar delta, hsBool jump); + void SeekRelative(float delta, hsBool jump); /** Gradually fade the blend strength or amplitude of the animation. \param goal is the desired blend strength \param rate is in blend units per second \type is either kFadeBlend or kFadeAmp */ - void Fade(hsScalar goal, hsScalar rate, uint8_t type = kFadeBlend); + void Fade(float goal, float rate, uint8_t type = kFadeBlend); /** Fade the animation and detach it after the fade is complete. Extremely useful for situations where the controlling logic @@ -180,7 +180,7 @@ public: out gradually. \deprecated */ - void FadeAndDetach(hsScalar goal, hsScalar rate); + void FadeAndDetach(float goal, float rate); /** Has the animation terminated of natural causes? Primarily used to see if an animation has played all the @@ -218,11 +218,11 @@ public: in the animation and will be sent when playback passes that time. */ void AttachCallbacks(plOneShotCallbacks *callbacks); - void ProcessFade(hsScalar elapsed); // process any outstanding fades + void ProcessFade(float elapsed); // process any outstanding fades void SearchForGlobals(); // Util function to setup SDL channels protected: /** Set up bookkeeping for a fade. */ - void ISetupFade(hsScalar goal, hsScalar rate, bool detach, uint8_t type); + void ISetupFade(float goal, float rate, bool detach, uint8_t type); void IRegisterDetach(const char *channelName, plAGChannel *channel); @@ -244,15 +244,15 @@ protected: plAnimTimeConvert *fTimeConvert; hsBool fFadeBlend; /// we are fading the blend - hsScalar fFadeBlendGoal; /// what blend level we're trying to reach - hsScalar fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full) + float fFadeBlendGoal; /// what blend level we're trying to reach + float fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full) hsBool fFadeDetach; /// detach after fade is finished? (only used for blend fades) hsBool fFadeAmp; /// we are fading the amplitude - hsScalar fFadeAmpGoal; /// amplitude we're trying to reach - hsScalar fFadeAmpRate; /// how faster we're fading in blend units per second + float fFadeAmpGoal; /// amplitude we're trying to reach + float fFadeAmpRate; /// how faster we're fading in blend units per second - hsScalar ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal, hsScalar rate, hsScalar elapsed); + float ICalcFade(hsBool &fade, float curVal, float goal, float rate, float elapsed); }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp index 17690f8a..9d496646 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp @@ -218,7 +218,7 @@ plProfile_CreateTimer("AnimatingPhysicals", "Animation", AnimatingPhysicals); plProfile_CreateTimer("StoppedAnimPhysicals", "Animation", StoppedAnimPhysicals); // IEVAL -hsBool plAGMasterMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plAGMasterMod::IEval(double secs, float del, uint32_t dirty) { if (fFirstEval) { @@ -239,7 +239,7 @@ hsBool plAGMasterMod::IEval(double secs, hsScalar del, uint32_t dirty) } // APPLYANIMATIONS -void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed) +void plAGMasterMod::ApplyAnimations(double time, float elapsed) { plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName()); @@ -387,7 +387,7 @@ plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const cha // ATTACHANIMATIONBLENDED(anim, blend) plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim, - hsScalar blendFactor /* = 0 */, + float blendFactor /* = 0 */, uint16_t blendPriority /* plAGMedBlendPriority */, hsBool cache /* = false */) { @@ -421,7 +421,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim, } // ATTACHANIMATIONBLENDED(name, blend) -plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, hsScalar blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */) +plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */) { plAGAnimInstance *instance = nil; plAGAnim *anim = plAGAnim::FindAnim(name); @@ -482,7 +482,7 @@ plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name) } // FINDORATTACHINSTANCE -plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, hsScalar blendFactor) +plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, float blendFactor) { plAGAnimInstance *result = FindAnimInstance(name); if(result) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h index 044e066d..2ee35d87 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h @@ -106,13 +106,13 @@ public: /** Attach the given animation object with the given blend factor. If there's no animation already attached to blend with, the animation will be attached at full strength. */ - plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, hsScalar blendFactor = 0, + plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, float blendFactor = 0, uint16_t blendPriority = kAGMedBlendPriority, hsBool cache = false); /** Look up the given animation by name and attach it with the given blend factor. */ - plAGAnimInstance *AttachAnimationBlended(const char *name, hsScalar blendFactor = 0, + plAGAnimInstance *AttachAnimationBlended(const char *name, float blendFactor = 0, uint16_t blendPriority = kAGMedBlendPriority, hsBool cache = false); @@ -152,7 +152,7 @@ public: attached, it could be anywhere, including buried under a bunch of other animations. If it's important that it be on top of the stack, you may need to detach it first. */ - plAGAnimInstance *FindOrAttachInstance(const char *name, hsScalar blendFactor); + plAGAnimInstance *FindOrAttachInstance(const char *name, float blendFactor); /** Return the number of animations available. */ int GetNumAnimations(); @@ -168,7 +168,7 @@ public: /** Apply all our animations to all our parts. \param timeNow is the current world time \param elapsed is the time since the previous frame */ - void ApplyAnimations(double timeNow, hsScalar elapsed); + void ApplyAnimations(double timeNow, float elapsed); /** Runs through our anims and applies them, without processing fades. This is used when we load in anim @@ -220,7 +220,7 @@ protected: plAGModifier * ICacheChannelMod(plAGModifier *mod) const; plAGModifier * IFindChannelMod(const plSceneObject *obj, const char *name) const; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void IApplyDynamic() {}; // dummy function required by base class diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp index b24bbc26..0f5e022f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp @@ -191,7 +191,7 @@ void plAGMasterSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcSta if (objAGMaster->fIsGrouped && objAGMaster->fMsgForwarder) { - hsScalar animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f; + float animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f; plAGCmdMsg *msg = TRACKED_NEW plAGCmdMsg(); msg->SetCmd(plAGCmdMsg::kSetAnimTime); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp index 1032a422..e72e96e2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp @@ -133,7 +133,7 @@ void plAGModifier::Apply(double time) const // IEVAL // Apply our channels to our scene object -hsBool plAGModifier::IEval(double time, hsScalar delta, uint32_t dirty) +hsBool plAGModifier::IEval(double time, float delta, uint32_t dirty) { if(fAutoApply) { // Apply(time, delta); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h index f0d83a30..ae74e980 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h @@ -144,7 +144,7 @@ protected: hsBool fEnabled; // if not enabled, we don't eval any of our anims // APPLYING THE ANIMATION - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IHandleCmd(plAnimCmdMsg* modMsg) { return false; } // only plAGMasterMod should handle these virtual void IApplyDynamic() {}; // dummy function required by base class diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp index 79cdfa7d..d5b4da3c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.cpp @@ -84,9 +84,9 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) fAnimPosVel.fZ = vel.fZ; hsVector3 linCurrent(0.f, 0.f, 0.f); - hsScalar angCurrent = 0.f; + float angCurrent = 0.f; if (fCurrentRegion != nil) - fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (hsScalar)elapsed); + fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (float)elapsed); int numContacts = fPhysical->GetNumContacts(); fHadContacts = (numContacts > 0); @@ -97,7 +97,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) for (i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) { fOnGround = true; @@ -109,7 +109,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time) fPhysical->SetAngularVelocitySim(hsVector3(0.f, 0.f, fAnimAngVel + fTurnStr + angCurrent)); } -void plAntiGravAction::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight) +void plAntiGravAction::SetSurface(plSwimRegionInterface *region, float surfaceHeight) { fCurrentRegion = region; if (region != nil) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h index 1f7afc8e..59db9ca1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAntiGravAction.h @@ -59,8 +59,8 @@ public: /** Called by Havok at substep frequency. */ void apply(Havok::Subspace &s, Havok::hkTime time); - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight); - hsScalar GetBuoyancy() { return fBuoyancy; } + void SetSurface(plSwimRegionInterface *region, float surfaceHeight); + float GetBuoyancy() { return fBuoyancy; } hsBool IsOnGround() { return fOnGround; } hsBool HadContacts() { return fHadContacts; } @@ -69,8 +69,8 @@ protected: hsBool fOnGround; hsBool fHadContacts; - hsScalar fBuoyancy; - hsScalar fSurfaceHeight; + float fBuoyancy; + float fSurfaceHeight; plSwimRegionInterface *fCurrentRegion; }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp index 790f29f3..da8412ef 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp @@ -184,7 +184,7 @@ void plArmatureModBase::RemoveTarget(plSceneObject* so) plAGMasterMod::RemoveTarget(so); } -hsBool plArmatureModBase::IEval(double time, hsScalar elapsed, uint32_t dirty) +hsBool plArmatureModBase::IEval(double time, float elapsed, uint32_t dirty) { if (IsFinal()) { @@ -436,7 +436,7 @@ void plArmatureModBase::AdjustLOD() hsMatrix44 l2w = SO->GetLocalToWorld(); hsPoint3 ourPos = l2w.GetTranslate(); hsPoint3 delta = ourPos - camPos; - hsScalar distanceSquared = delta.MagnitudeSquared(); + float distanceSquared = delta.MagnitudeSquared(); if (distanceSquared < fLODDistance * fLODDistance) SetLOD(__max(0, fMinLOD)); else if (distanceSquared < fLODDistance * fLODDistance * 4.0) @@ -628,8 +628,8 @@ void plArmatureModBase::IEnableBones(int lod, hsBool enable) const char *plArmatureMod::BoneStrings[] = {"Male", "Female", "Critter", "Actor"}; -const hsScalar plArmatureMod::kAvatarInputSynchThreshold = 10.f; -hsScalar plArmatureMod::fMouseTurnSensitivity = 1.f; +const float plArmatureMod::kAvatarInputSynchThreshold = 10.f; +float plArmatureMod::fMouseTurnSensitivity = 1.f; hsBool plArmatureMod::fClickToTurn = true; void plArmatureMod::IInitDefaults() @@ -1548,7 +1548,7 @@ void plArmatureMod::ILinkToPersonalAge() pMsg->Send(); } -hsBool plArmatureMod::IEval(double time, hsScalar elapsed, uint32_t dirty) +hsBool plArmatureMod::IEval(double time, float elapsed, uint32_t dirty) { if (IsFinal()) { @@ -2285,12 +2285,12 @@ void plArmatureMod::SetJumpKeyDown() SetInputFlag(B_CONTROL_JUMP, true); } -hsScalar plArmatureMod::GetTurnStrength() const +float plArmatureMod::GetTurnStrength() const { return GetKeyTurnStrength() + GetAnalogTurnStrength(); } -hsScalar plArmatureMod::GetKeyTurnStrength() const +float plArmatureMod::GetKeyTurnStrength() const { if (StrafeKeyDown()) return 0.f; @@ -2298,12 +2298,12 @@ hsScalar plArmatureMod::GetKeyTurnStrength() const return (TurnLeftKeyDown() ? 1.f : 0.f) + (TurnRightKeyDown() ? -1.f: 0.f); } -hsScalar plArmatureMod::GetAnalogTurnStrength() const +float plArmatureMod::GetAnalogTurnStrength() const { if (StrafeKeyDown()) return 0.f; - hsScalar elapsed = hsTimer::GetDelSysSeconds(); + float elapsed = hsTimer::GetDelSysSeconds(); if (elapsed > 0) return fMouseFrameTurnStrength / elapsed; else @@ -2425,7 +2425,7 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at for (i = 0; i < markers.size(); i++) { - hsScalar time = -1; + float time = -1; hsBool isLeft = false; if (strstr(markers[i], "SndLeftFootDown") == markers[i]) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h index 1f12910c..c89fa1df 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h @@ -112,7 +112,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual void AddTarget(plSceneObject* so); virtual void RemoveTarget(plSceneObject* so); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void Read(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr); @@ -207,7 +207,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); virtual void AddTarget(plSceneObject* so); virtual void RemoveTarget(plSceneObject* so); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void Read(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr); @@ -253,9 +253,9 @@ public: void SetInputFlag(int which, hsBool status); void ClearInputFlags(bool saveAlwaysRun, bool clearBackup); hsBool HasMovementFlag() const; // Is any *movement* input flag on? - hsScalar GetTurnStrength() const; - hsScalar GetKeyTurnStrength() const; - hsScalar GetAnalogTurnStrength() const; + float GetTurnStrength() const; + float GetKeyTurnStrength() const; + float GetAnalogTurnStrength() const; void SetReverseFBOnIdle(bool val); hsBool IsFBReversed(); @@ -324,8 +324,8 @@ public: void SendBehaviorNotify(uint32_t type, hsBool start = true) { IFireBehaviorNotify(type,start); } // Discovered a bug which makes these values horribly out of scale. So we do the rescale // in the Get/Set functions for backwards compatability. - static void SetMouseTurnSensitivity(hsScalar val) { fMouseTurnSensitivity = val / 150.f; } - static hsScalar GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; } + static void SetMouseTurnSensitivity(float val) { fMouseTurnSensitivity = val / 150.f; } + static float GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; } static void SetSpawnPointOverride( const char *overrideObjName ); static void WindowActivate(bool active); @@ -361,11 +361,11 @@ public: }; plMatrixDelayedCorrectionApplicator *fBoneRootAnimator; - static const hsScalar kAvatarInputSynchThreshold; + static const float kAvatarInputSynchThreshold; static hsBool fClickToTurn; static const char *BoneStrings[]; - void SetPhysicalDims(hsScalar height, hsScalar width) { fPhysHeight = height; fPhysWidth = width; } + void SetPhysicalDims(float height, float width) { fPhysHeight = height; fPhysWidth = width; } void SetBodyAgeName(const char* ageName) {if (ageName) fBodyAgeName = ageName; else fBodyAgeName = "";} void SetBodyFootstepSoundPage(const char* pageName) {if (pageName) fBodyFootstepSoundPage = pageName; else fBodyFootstepSoundPage = "";} @@ -393,11 +393,11 @@ protected: hsBitVector fMoveFlagsBackup; // a copy of fMoveFlags typedef std::vector CtrlMessageVec; CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed - hsScalar fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval. + float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval. plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa... plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in. - static hsScalar fMouseTurnSensitivity; + static float fMouseTurnSensitivity; plArmatureUpdateMsg *fUpdateMsg; // Trying to be a good lad here and align all our bools and bytes... @@ -481,6 +481,6 @@ protected: BoneMapImp *fImp; // the thing that actually holds our map }; -#define TWO_PI (hsScalarPI * 2) +#define TWO_PI (M_PI * 2) #endif //plArmatureMod_inc diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp index dcd6d94f..cf6a7ff1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp @@ -72,9 +72,9 @@ void plArmatureBehavior::Process(double time, float elapsed) { } -void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */) +void plArmatureBehavior::SetStrength(float val, float rate /* = 0.f */) { - hsScalar oldStrength = GetStrength(); + float oldStrength = GetStrength(); if (rate == 0) fStrength.Set(val); else @@ -88,7 +88,7 @@ void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */) IStop(); } -hsScalar plArmatureBehavior::GetStrength() +float plArmatureBehavior::GetStrength() { return fStrength.Value(); } @@ -101,7 +101,7 @@ void plArmatureBehavior::Rewind() void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt) { - hsScalar strength = GetStrength(); + float strength = GetStrength(); const char *onOff = strength > 0 ? "on" : "off"; char blendBar[11] = "||||||||||"; int bars = (int)__min(10 * strength, 10); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h index fcc6d2ec..e7b2fff3 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.h @@ -62,8 +62,8 @@ public: void Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, uint8_t index); virtual void Process(double time, float elapsed); - virtual void SetStrength(hsScalar val, hsScalar rate = 0.f); // default instant change - virtual hsScalar GetStrength(); + virtual void SetStrength(float val, float rate = 0.f); // default instant change + virtual float GetStrength(); virtual void Rewind(); void DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt); @@ -77,7 +77,7 @@ protected: plAGAnimInstance *fAnim; plArmatureModBase *fArmature; plArmatureBrain *fBrain; - plTimedValue fStrength; + plTimedValue fStrength; uint8_t fIndex; virtual void IStart(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp index e81fefa2..e7cb7ab1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.cpp @@ -79,7 +79,7 @@ plArmatureBrain::~plArmatureBrain() delete fCurTask; } -hsBool plArmatureBrain::Apply(double timeNow, hsScalar elapsed) +hsBool plArmatureBrain::Apply(double timeNow, float elapsed) { IProcessTasks(timeNow, elapsed); fArmature->ApplyAnimations(timeNow, elapsed); @@ -167,7 +167,7 @@ hsBool plArmatureBrain::MsgReceive(plMessage * msg) return false; } -void plArmatureBrain::IProcessTasks(double time, hsScalar elapsed) +void plArmatureBrain::IProcessTasks(double time, float elapsed) { if (!fCurTask || !fCurTask->Process(plArmatureMod::ConvertNoRef(fArmature), this, time, elapsed)) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h index ae250dbd..2d714a4e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrain.h @@ -71,7 +71,7 @@ public: CLASSNAME_REGISTER( plArmatureBrain ); GETINTERFACE_ANY( plArmatureBrain, plCreatable ); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void Activate(plArmatureModBase *armature); virtual void Deactivate() {} virtual void Suspend() {} @@ -88,7 +88,7 @@ public: virtual hsBool MsgReceive(plMessage *msg); protected: - virtual void IProcessTasks(double time, hsScalar elapsed); + virtual void IProcessTasks(double time, float elapsed); virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg); typedef std::deque plAvTaskQueue; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp index 75694a7e..83f4eed4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp @@ -210,7 +210,7 @@ void plAvBrainClimb::Deactivate() } // APPLY -hsBool plAvBrainClimb::Apply(double time, hsScalar elapsed) +hsBool plAvBrainClimb::Apply(double time, float elapsed) { hsBool result = true; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h index 9d89a2e0..ff149109 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.h @@ -98,7 +98,7 @@ public: virtual void Activate(plArmatureModBase *avMod); virtual void Deactivate(); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void SaveToSDL(plStateDataRecord *sdl); virtual void LoadFromSDL(const plStateDataRecord *sdl); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp index 581746b0..183bd5b2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp @@ -93,8 +93,8 @@ public: virtual hsBool PreCondition(double time, float elapsed) {return true;} - hsScalar GetAnimLength() {return (fAnim->GetAnimation()->GetLength());} - void SetAnimTime(hsScalar time) {fAnim->SetCurrentTime(time, true);} + float GetAnimLength() {return (fAnim->GetAnimation()->GetLength());} + void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);} std::string Name() const {return fName;} std::string AnimName() const {return fAnimName;} @@ -131,7 +131,7 @@ plAvBrainCritter::plAvBrainCritter(): fCallbackAction(nil), fCurMode(kIdle), fNe fLocallyControlled(false), fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0), fAngRight(0) { - SightCone(hsScalarPI/2); // 90deg + SightCone(M_PI/2); // 90deg StopDistance(1); SightDistance(10); HearingDistance(10); @@ -154,7 +154,7 @@ plAvBrainCritter::~plAvBrainCritter() /////////////////////////////////////////////////////////////////////////////// -hsBool plAvBrainCritter::Apply(double time, hsScalar elapsed) +hsBool plAvBrainCritter::Apply(double time, float elapsed) { // update internal pathfinding variables IEvalGoal(); @@ -327,7 +327,7 @@ bool plAvBrainCritter::AtGoal() const return (finalGoalVec.MagnitudeSquared() <= fStopDistanceSquared); } -void plAvBrainCritter::SightCone(hsScalar coneRad) +void plAvBrainCritter::SightCone(float coneRad) { fSightConeAngle = coneRad; @@ -339,7 +339,7 @@ void plAvBrainCritter::SightCone(hsScalar coneRad) fSightConeDotMin = straightVector * viewVector; } -void plAvBrainCritter::HearingDistance(hsScalar hearDis) +void plAvBrainCritter::HearingDistance(float hearDis) { fHearingDistance = hearDis; fHearingDistanceSquared = fHearingDistance * fHearingDistance; @@ -533,7 +533,7 @@ void plAvBrainCritter::IStartBehavior() // if we start at a random point, do so if (behavior->RandomStartPoint()) { - hsScalar newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength(); + float newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength(); behavior->SetAnimTime(newStart); } @@ -584,7 +584,7 @@ void plAvBrainCritter::IEvalGoal() hsVector3 avVec(creaturePos - avPos); avVec.Normalize(); - hsScalar dotAv = avVec * goalVec; + float dotAv = avVec * goalVec; if (dotAv > 0.5f) // within a 45deg angle in front of us { // a player is in the way, so we will change our "goal" to a 90deg angle from the player @@ -616,7 +616,7 @@ void plAvBrainCritter::IEvalGoal() } } -hsScalar plAvBrainCritter::IGetTurnStrength(double time) const +float plAvBrainCritter::IGetTurnStrength(double time) const { if (!RunningBehavior(kDefaultRunBehName)) return 0.0f; @@ -673,7 +673,7 @@ bool plAvBrainCritter::ICanSeeAvatar(plArmatureMod* avatar) const const plSceneObject* creatureObj = fArmature->GetTarget(0); hsVector3 view(creatureObj->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView)); - hsScalar avDot = view * avVec; + float avDot = view * avVec; if (avDot < fSightConeDotMin) return false; // out of our cone of view return true; @@ -701,7 +701,7 @@ bool plAvBrainCritter::ICanHearAvatar(plArmatureMod* avatar) const fAvMod->GetPositionAndRotationSim(&creaturePos, &creatureRot); hsVector3 avVec(creaturePos - avPos); - hsScalar distSq = avVec.MagnitudeSquared(); + float distSq = avVec.MagnitudeSquared(); if (distSq <= fHearingDistanceSquared) return true; // within our normal hearing distance else if (isLoud && (distSq <= fLoudHearingDistanceSquared)) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h index afb2a369..96a0c5f0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h @@ -75,7 +75,7 @@ public: CLASSNAME_REGISTER(plAvBrainCritter); GETINTERFACE_ANY(plAvBrainCritter, plArmatureBrain); - hsBool Apply(double time, hsScalar elapsed); + hsBool Apply(double time, float elapsed); hsBool MsgReceive(plMessage* msg); virtual void Activate(plArmatureModBase* avMod); @@ -104,15 +104,15 @@ public: bool AvoidingAvatars() const {return fAvoidingAvatars;} bool AtGoal() const; - void StopDistance(hsScalar stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;} - hsScalar StopDistance() const {return fStopDistance;} + void StopDistance(float stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;} + float StopDistance() const {return fStopDistance;} - void SightCone(hsScalar coneRad); - hsScalar SightCone() const {return fSightConeAngle;} - void SightDistance(hsScalar sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;} - hsScalar SightDistance() const {return fSightDistance;} - void HearingDistance(hsScalar hearDis); - hsScalar HearingDistance() const {return fHearingDistance;} + void SightCone(float coneRad); + float SightCone() const {return fSightConeAngle;} + void SightDistance(float sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;} + float SightDistance() const {return fSightDistance;} + void HearingDistance(float hearDis); + float HearingDistance() const {return fHearingDistance;} bool CanSeeAvatar(unsigned long id) const; bool CanHearAvatar(unsigned long id) const; @@ -142,7 +142,7 @@ protected: void IStartBehavior(); // fades in and initializes fNextMode, then sets fCurMode void IProcessBehavior(double time, float elapsed); // processes fCurMode void IEvalGoal(); - hsScalar IGetTurnStrength(double time) const; + float IGetTurnStrength(double time) const; std::vector IGetAgePlayerIDList() const; @@ -162,19 +162,19 @@ protected: bool fAvoidingAvatars; // are we avoiding avatars to the best of our ability when pathfinding? hsPoint3 fFinalGoalPos; // the location we are pathfinding to hsPoint3 fImmediateGoalPos; // the location of the point we are immediately going towards (not necessarily our final goal) - hsScalar fDotGoal; // dot product to our goal - hsScalar fAngRight; // dot product of our local right-hand vector to our goal - - hsScalar fStopDistance; // how close we need to get to our goal before stopping - hsScalar fStopDistanceSquared; // the above, squared, for faster calculation - - hsScalar fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side) - hsScalar fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360) - hsScalar fSightDistance; // how far away we can see (cone in front of us) - hsScalar fSightDistanceSquared; // the above, squared, for faster calculation - hsScalar fHearingDistance; // how far away we can hear (360 degrees) - hsScalar fHearingDistanceSquared; // the above, squared, for faster calculation - hsScalar fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation + float fDotGoal; // dot product to our goal + float fAngRight; // dot product of our local right-hand vector to our goal + + float fStopDistance; // how close we need to get to our goal before stopping + float fStopDistanceSquared; // the above, squared, for faster calculation + + float fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side) + float fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360) + float fSightDistance; // how far away we can see (cone in front of us) + float fSightDistanceSquared; // the above, squared, for faster calculation + float fHearingDistance; // how far away we can hear (360 degrees) + float fHearingDistanceSquared; // the above, squared, for faster calculation + float fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation std::map > fUserBehaviors; // string is behavior name, internal vector is the list of behaviors that are randomly picked from diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp index fa2661e5..f66ca8cb 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.cpp @@ -64,7 +64,7 @@ plAvBrainDrive::plAvBrainDrive() } // CTOR max velocity, turn rate -plAvBrainDrive::plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate) +plAvBrainDrive::plAvBrainDrive(float maxVelocity, float turnRate) : fMaxVelocity(maxVelocity), fTurnRate(turnRate) { } @@ -100,17 +100,17 @@ void plAvBrainDrive::IEnablePhysics(bool enable, plKey avKey) } // APPLY -hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainDrive::Apply(double timeNow, float elapsed) { plSceneObject * avSO = fAvMod->GetTarget(0); - hsScalar eTime = hsTimer::GetDelSysSeconds(); + float eTime = hsTimer::GetDelSysSeconds(); hsMatrix44 targetMatrix = avSO->GetLocalToWorld(); hsPoint3 playerPos = targetMatrix.GetTranslate(); hsVector3 view, up, right; targetMatrix.GetAxis(&view, &up, &right); - hsScalar speed = fMaxVelocity; - hsScalar turn = fTurnRate; + float speed = fMaxVelocity; + float turn = fTurnRate; if (fAvMod->FastKeyDown()) { @@ -148,7 +148,7 @@ hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed) hsVector3 rotUp(0,0,1); hsVector3 rotRight(1,0,0); hsMatrix44 rot; - hsScalar angle = 0; + float angle = 0; if ( fAvMod->GetInputFlag( B_CONTROL_ROTATE_RIGHT ) || fAvMod->GetInputFlag( B_CONTROL_ROTATE_LEFT ) || fAvMod->GetInputFlag( A_CONTROL_TURN ) ) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h index 335a7c17..25ded4c4 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainDrive.h @@ -70,7 +70,7 @@ public: \param maxVelocity The highest speed this avatar can fly at. \param turnRate The speed at which we will turn, in radians per second. */ - plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate); + plAvBrainDrive(float maxVelocity, float turnRate); // BRAIN PROTOCOL @@ -81,7 +81,7 @@ public: virtual void Deactivate(); /** Look at the key states and figure out if and how we should move */ - virtual hsBool Apply(double timeNow, hsScalar elapsed); // main control loop. called by avatar eval() + virtual hsBool Apply(double timeNow, float elapsed); // main control loop. called by avatar eval() // the user brain base handles most of the details of control messages, // so this function just looks for the special command which gets us out @@ -94,8 +94,8 @@ public: protected: void IEnablePhysics(bool enable, plKey avKey); - hsScalar fMaxVelocity; - hsScalar fTurnRate; + float fMaxVelocity; + float fTurnRate; }; #endif // AVBRAINDRIVE_INC diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp index 270e03dc..476768f7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.cpp @@ -76,8 +76,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #endif hsBool plAvBrainGeneric::fForce3rdPerson = true; -const hsScalar plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in -const hsScalar plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out. +const float plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in +const float plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out. // plAvBrainGeneric ---------------- // ----------------- @@ -248,7 +248,7 @@ bool plAvBrainGeneric::MatchAnimNames(const char *names[], int count) // Apply ---------------------------------------------------- // ------ -hsBool plAvBrainGeneric::Apply(double time, hsScalar elapsed) +hsBool plAvBrainGeneric::Apply(double time, float elapsed) { hsBool result = false; @@ -491,7 +491,7 @@ hsBool plAvBrainGeneric::IProcessFadeOut(double time, float elapsed) // ISwitchStages --------------------------------------------------------------------------------------------------- // -------------- hsBool plAvBrainGeneric::ISwitchStages(int oldStageNum, int newStageNum, float delta, hsBool setTime, float newTime, - float fadeNew, hsScalar fadeOld, double worldTime) + float fadeNew, float fadeOld, double worldTime) { #ifdef DEBUG_MULTISTAGE char sbuf[256]; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h index 7b5fb384..5677ee8e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainGeneric.h @@ -118,8 +118,8 @@ public: kModeSize = 0xff } fMode; - static const hsScalar kDefaultFadeIn; - static const hsScalar kDefaultFadeOut; + static const float kDefaultFadeIn; + static const float kDefaultFadeOut; /** Default constructor for the class factory and descendants. */ plAvBrainGeneric(); @@ -154,7 +154,7 @@ public: virtual void Activate(plArmatureModBase *avMod); /** Advance the current stage and swap in a new stage if necessary. */ - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); /** Remove all our stages and release control of the armature. */ virtual void Deactivate(); @@ -283,8 +283,8 @@ protected: hsBool IProcessFadeIn(double time, float elapsed); hsBool IProcessFadeOut(double time, float elapsed); - hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, hsScalar newTime, - float fadeNew, hsScalar fadeOld, double worldTime); + hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, float newTime, + float fadeNew, float fadeOld, double worldTime); void IEnterMoveMode(double time); // we've just entered and we're about to begin animating. void IExitMoveMode(); // we're done animating; clean up diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp index 2723e3cf..69db56cd 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp @@ -64,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTimer.h" #include "hsGeometry3.h" -#include "float.h" + #include "plPipeline.h" #include "plgDispatch.h" #include "hsQuat.h" @@ -98,7 +98,7 @@ float plAvBrainHuman::fRunMaxTurnSpeed = 1.7; plAvBrainHuman::TurnCurve plAvBrainHuman::fWalkTurnCurve = plAvBrainHuman::kTurnExponential; plAvBrainHuman::TurnCurve plAvBrainHuman::fRunTurnCurve = plAvBrainHuman::kTurnExponential; -const hsScalar plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds +const float plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds void plAvBrainHuman::SetTimeToMaxTurn(float time, hsBool walk) { @@ -148,7 +148,7 @@ plAvBrainHuman::plAvBrainHuman(bool isActor /* = false */) : { } -hsBool plAvBrainHuman::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainHuman::Apply(double timeNow, float elapsed) { #ifndef _DEBUG try @@ -532,7 +532,7 @@ hsBool plAvBrainHuman::IHandleClimbMsg(plClimbMsg *msg) return true; } -hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow) +float plAvBrainHuman::IGetTurnStrength(double timeNow) { float result = 0.f; float timeToMaxTurn, maxTurnSpeed; @@ -553,8 +553,8 @@ hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow) plArmatureBehavior * turnLeft = fBehaviors.Count() >= kMovingTurnLeft ? fBehaviors[kMovingTurnLeft] : nil; plArmatureBehavior * turnRight = fBehaviors.Count() >= kMovingTurnRight ? fBehaviors[kMovingTurnRight] : nil; - hsScalar turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f; - hsScalar turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f; + float turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f; + float turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f; // Turning based on keypress @@ -653,7 +653,7 @@ void plAvBrainHuman::IdleOnly(bool instantOff) if (!fCallbackAction) return; - hsScalar rate = instantOff ? 0.f : 1.f; + float rate = instantOff ? 0.f : 1.f; int i; for (i = kWalk; i < fBehaviors.GetCount(); i++) @@ -1009,7 +1009,7 @@ void Idle::IStart() plHBehavior::IStart(); if (fAnim) { - hsScalar newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength(); + float newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength(); fAnim->SetCurrentTime(newStart, true); } } @@ -1329,12 +1329,12 @@ void Push::Process(double time, float elapsed) hsPoint3 lookAt; fHuBrain->fCallbackAction->GetPushingPhysical()->GetPositionSim(lookAt); hsVector3 up(0.f, 0.f, 1.f); - hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2; + float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2; hsQuat targRot(angle, &up); - const hsScalar kTurnSpeed = 3.f; - hsScalar angDiff = QuatAngleDiff(rot, targRot); - hsScalar turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed); + const float kTurnSpeed = 3.f; + float angDiff = QuatAngleDiff(rot, targRot); + float turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed); hsQuat invRot = targRot.Conjugate(); hsPoint3 globFwd = invRot.Rotate(&kAvatarForward); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h index db704574..2d093f8c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.h @@ -72,7 +72,7 @@ public: CLASSNAME_REGISTER( plAvBrainHuman ); GETINTERFACE_ANY( plAvBrainHuman, plArmatureBrain ); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); virtual void Activate(plArmatureModBase *avMod); virtual void Deactivate(); virtual void Suspend(); @@ -161,9 +161,9 @@ public: static void SetTurnCurve(TurnCurve curve, hsBool walk); static TurnCurve GetTurnCurve(hsBool walk); - static const hsScalar kControlledFlightThreshold; - static const hsScalar kAirTimeThreshold; - static const hsScalar kAirTimePanicThreshold; + static const float kControlledFlightThreshold; + static const float kAirTimeThreshold; + static const float kAirTimePanicThreshold; plWalkingController* fCallbackAction; protected: @@ -173,7 +173,7 @@ protected: virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg); virtual hsBool IInitAnimations(); virtual void IInitBoneMap(); - hsScalar IGetTurnStrength(double timeNow); + float IGetTurnStrength(double timeNow); void IChatOn(); void IChatOff(); hsBool IValidateAnimations(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp index 5ec80cfc..bdf5055f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.cpp @@ -184,7 +184,7 @@ hsBool plAvBrainRideAnimatedPhysical::LeaveAge() { return plArmatureBrain::LeaveAge(); } -hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, hsScalar elapsed) +hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, float elapsed) { if(this->fMode==kAbort) return false; else return plAvBrainHuman::Apply(timeNow, elapsed); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h index b4e962b4..d3eb0817 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainRideAnimatedPhysical.h @@ -58,7 +58,7 @@ public: virtual void Deactivate(); virtual hsBool MsgReceive(plMessage *msg); virtual hsBool LeaveAge(); - virtual hsBool Apply(double timeNow, hsScalar elapsed); + virtual hsBool Apply(double timeNow, float elapsed); protected: hsBool IInitAnimations(); mode fMode; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp index 4fad8ff5..f86e6ae2 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp @@ -234,7 +234,7 @@ public: /////////////////////////////////////////////////////////////////////////////////////////// -const hsScalar plAvBrainSwim::kMinSwimDepth = 4.0f; +const float plAvBrainSwim::kMinSwimDepth = 4.0f; plAvBrainSwim::plAvBrainSwim() : fCallbackAction(nil), @@ -263,7 +263,7 @@ plAvBrainSwim::~plAvBrainSwim() delete fBehaviors[i]; } -hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed) +hsBool plAvBrainSwim::Apply(double time, float elapsed) { IProbeSurface(); if (fMode == kWalking) @@ -278,12 +278,12 @@ hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed) { // We're jumping in! Trigger splash effect (sound) plArmatureEffectMsg *msg = TRACKED_NEW plArmatureEffectMsg(fAvMod->GetArmatureEffects()->GetKey(), kTime); - msg->fEventTime = (hsScalar)time; + msg->fEventTime = (float)time; msg->fTriggerIdx = plArmatureMod::kImpact; plEventCallbackInterceptMsg *iMsg = TRACKED_NEW plEventCallbackInterceptMsg; iMsg->AddReceiver(fAvMod->GetArmatureEffects()->GetKey()); - iMsg->fEventTime = (hsScalar)time; + iMsg->fEventTime = (float)time; iMsg->fEvent = kTime; iMsg->SetMessage(msg); iMsg->Send(); @@ -687,7 +687,7 @@ void plAvBrainSwim::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str // fAvMod->GetPhysical()->GetLinearVelocitySim(linV); // hsVector3 angV; // fAvMod->GetPhysical()->GetAngularVelocitySim(angV); -// hsScalar angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude(); +// float angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude(); // sprintf(strBuf, "Velocity: Linear (%5.2f, %5.2f, %5.2f), Angular %5.2f", linV.fX, linV.fY, linV.fZ, angle); // debugTxt.DrawString(x, y, strBuf); // y += lineHeight; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h index bd605a93..3d41dc5f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.h @@ -62,7 +62,7 @@ public: GETINTERFACE_ANY( plAvBrainSwim, plArmatureBrain ); virtual void Activate(plArmatureModBase *avMod); - hsBool Apply(double time, hsScalar elapsed); + hsBool Apply(double time, float elapsed); virtual void Deactivate(); virtual void Suspend(); virtual void Resume(); @@ -71,10 +71,10 @@ public: bool IsWalking(); bool IsWading(); bool IsSwimming(); - hsScalar GetSurfaceDistance() { return fSurfaceDistance; } + float GetSurfaceDistance() { return fSurfaceDistance; } plSwimmingController *fCallbackAction; - static const hsScalar kMinSwimDepth; + static const float kMinSwimDepth; protected: void IStartWading(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp index 5a7e5191..555bd2fd 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Generic geom utils. hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); -void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); +void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat); float AngleRad2d (float x1, float y1, float x3, float y3); inline hsVector3 GetYAxis(hsMatrix44 &mat) { @@ -98,7 +98,7 @@ void plAnimatedController::RecalcVelocity(double timeNow, double timePrev, hsBoo /////////////////////////////////////////////////////////////////////////// -const hsScalar plWalkingController::kControlledFlightThreshold = 1.f; // seconds +const float plWalkingController::kControlledFlightThreshold = 1.f; // seconds plWalkingController::plWalkingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller) : plAnimatedController(rootObject, rootApp, controller) @@ -227,7 +227,7 @@ void plWalkingController::Update() continue; // Physical no longer exists. Skip it. const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) ground = true; else if (contactPhys->GetProperty(plSimulationInterface::kAvAnimPushable)) @@ -258,7 +258,7 @@ void plWalkingController::Update() // has to overcome friction). I deal with that by making the threshold (360 - (180 - 60) = 240). I've // seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect. // This is the same running into 2 walls where the angle between them is 60. - const hsScalar threshold = hsScalarDegToRad(240); + const float threshold = hsDegreesToRadians(240); if (!ground && numContacts >= 2) { // Can probably do a special case for exactly 2 contacts. Not sure if it's worth it... @@ -267,7 +267,7 @@ void plWalkingController::Update() for (i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - fCollisionAngles[i] = hsATan2(contact->m_normal.y, contact->m_normal.x); + fCollisionAngles[i] = atan2(contact->m_normal.y, contact->m_normal.x); } // numContacts is rarely larger than 6, so let's do a simple bubble sort. @@ -277,7 +277,7 @@ void plWalkingController::Update() { if (fCollisionAngles[i] > fCollisionAngles[j]) { - hsScalar tempAngle = fCollisionAngles[i]; + float tempAngle = fCollisionAngles[i]; fCollisionAngles[i] = fCollisionAngles[j]; fCollisionAngles[j] = tempAngle; } @@ -294,7 +294,7 @@ void plWalkingController::Update() if (i == numContacts) { // We got to the end. Check the last with the first and make your decision. - if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI))) + if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI))) ground = true; } } @@ -307,7 +307,7 @@ void plWalkingController::Update() fHitGroundInThisAge = true; // if we're not pinned and we're not in an age yet, we are now. if (IsControlledFlight()) - fControlledFlightTime += (hsScalar)elapsed; + fControlledFlightTime += (float)elapsed; if (fControlledFlightTime > kControlledFlightThreshold && numContacts > 0) EnableControlledFlight(false); @@ -321,7 +321,7 @@ void plWalkingController::Update() // hsVector3 vel; // fPhysical->GetLinearVelocitySim(vel); // fImpactVel = vel.fZ; -// fTimeInAirPeak = (hsScalar)(fTimeInAir + elapsed); +// fTimeInAirPeak = (float)(fTimeInAir + elapsed); // } fWaitingForGround = false; @@ -334,7 +334,7 @@ void plWalkingController::Update() // collisions, which could trick us into thinking we've just gone a long // time without hitting ground. So we only count the time if this wasn't // the case. - fTimeInAir += (hsScalar)elapsed; + fTimeInAir += (float)elapsed; } @@ -385,7 +385,7 @@ void plHorizontalFreezeAction::apply(Havok::Subspace &s, Havok::hkTime time) for(i = 0; i < numContacts; i++) { const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i); - hsScalar dotUp = straightUp.dot(contact->m_normal); + float dotUp = straightUp.dot(contact->m_normal); if (dotUp > .5) ground = true; } @@ -540,22 +540,22 @@ static hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prev return result; } -static void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat) +static void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat) { outputV = 0.f; - hsScalar appliedVelocity = 0.0f; + float appliedVelocity = 0.0f; hsVector3 prevForward = GetYAxis(prevMat); hsVector3 curForward = GetYAxis(curMat); - hsScalar angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY); + float angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY); hsBool sincePrevSign = angleSincePrev > 0.0f; - if (angleSincePrev > hsScalarPI) + if (angleSincePrev > M_PI) angleSincePrev = angleSincePrev - TWO_PI; const hsVector3 startForward = hsVector3(0, -1.0, 0); // the Y orientation of a "resting" armature.... - hsScalar angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY); + float angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY); hsBool sinceStartSign = angleSinceStart > 0.0f; - if (angleSinceStart > hsScalarPI) + if (angleSinceStart > M_PI) angleSinceStart = angleSinceStart - TWO_PI; // HANDLING ANIMATION WRAPPING: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h index 0c6c5e0b..7c78dcf7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.h @@ -65,7 +65,7 @@ public: // some reason, just stub this function out. // // Pass in the key to the root sceneobject for the avatar - static plPhysicalController* Create(plKey ownerSO, hsScalar height, hsScalar width); + static plPhysicalController* Create(plKey ownerSO, float height, float width); virtual ~plPhysicalController() {} @@ -77,7 +77,7 @@ public: virtual void SetLOSDB(plSimDefs::plLOSDB losDB) = 0; // Call this once per frame with the velocities of the avatar in avatar space. - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel) = 0; + virtual void SetVelocities(const hsVector3& linearVel, float angVel) = 0; // Gets the actual velocity we achieved in the last step (relative to our subworld) virtual const hsVector3& GetLinearVelocity() const = 0; @@ -92,7 +92,7 @@ public: // cases like when the avatar spawns into a new age. virtual bool IsOnGround() const = 0; virtual bool IsOnFalseGround() const = 0; - virtual hsScalar GetAirTime() const = 0; + virtual float GetAirTime() const = 0; virtual void ResetAirTime() = 0; virtual plPhysical* GetPushingPhysical() const = 0; @@ -133,16 +133,16 @@ public: plAnimatedController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller); virtual void RecalcVelocity(double timeNow, double timePrev, hsBool useAnim = true); - void SetTurnStrength(hsScalar val) { fTurnStr = val; } - hsScalar GetTurnStrength() { return fTurnStr; } + void SetTurnStrength(float val) { fTurnStr = val; } + float GetTurnStrength() { return fTurnStr; } virtual void ActivateController()=0; protected: plSceneObject* fRootObject; plPhysicalControllerCore* fController; plAGApplicator* fRootApp; - hsScalar fAnimAngVel; + float fAnimAngVel; hsVector3 fAnimPosVel; - hsScalar fTurnStr; // Explicit turning, separate from animations + float fTurnStr; // Explicit turning, separate from animations }; class plWalkingController : public plAnimatedController @@ -158,13 +158,13 @@ public: bool IsOnFalseGround() const { return fWalkingStrategy ? fWalkingStrategy->IsOnFalseGround() : true; } bool HitGroundInThisAge() const { return fHitGroundInThisAge; } bool EnableControlledFlight(bool status); - hsScalar GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; } + float GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; } void ResetAirTime() { if (fWalkingStrategy) fWalkingStrategy->ResetAirTime(); } - hsScalar GetForwardVelocity() const; + float GetForwardVelocity() const; void ActivateController(); // Check these after the avatar the avatar hits the ground for his total // hangtime and impact velocity. - hsScalar GetImpactTime() const { return fImpactTime; } + float GetImpactTime() const { return fImpactTime; } const hsVector3& GetImpactVelocity() const { return fImpactVelocity; } plPhysical* GetPushingPhysical() const @@ -181,24 +181,24 @@ public: protected: bool fHitGroundInThisAge; bool fWaitingForGround; // We've gone airborne. IsOnGround() returns false until we hit ground again. - hsScalar fControlledFlightTime; + float fControlledFlightTime; int fControlledFlight; // Count of how many are currently forcing flight plWalkingStrategy* fWalkingStrategy; - hsScalar fImpactTime; + float fImpactTime; hsVector3 fImpactVelocity; bool fClearImpact; bool fGroundLastFrame;//used for a test to pass the event of first getting air during a jump - static const hsScalar kControlledFlightThreshold; + static const float kControlledFlightThreshold; }; class plSwimmingController: public plAnimatedController { public : plSwimmingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller); virtual ~plSwimmingController(); - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight){ + void SetSurface(plSwimRegionInterface *region, float surfaceHeight){ fSwimmingStrategy->SetSurface(region,surfaceHeight); } - hsScalar GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); } + float GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); } hsBool IsOnGround() { return fSwimmingStrategy->IsOnGround(); } hsBool HadContacts() { return fSwimmingStrategy->HadContacts();} void Enable(bool en){if (fController) fController->Enable(en);} diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp index 54355062..c2eca018 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp @@ -105,7 +105,7 @@ plAvLadderMod::plAvLadderMod(bool goingUp, int type, int loops, bool enabled, hs } // Must be facing within 45 degrees of the ladder -static const hsScalar kTolerance = hsCosine(hsScalarDegToRad(45)); +static const float kTolerance = cos(hsDegreesToRadians(45)); bool plAvLadderMod::IIsReadyToClimb() { @@ -120,7 +120,7 @@ bool plAvLadderMod::IIsReadyToClimb() playerView.fZ = 0; // Are we facing towards the ladder? - hsScalar dot = playerView * fLadderView; + float dot = playerView * fLadderView; bool movingForward = false; @@ -135,12 +135,12 @@ bool plAvLadderMod::IIsReadyToClimb() if (dot >= kTolerance && movingForward) { - DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot))); + DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot))); return true; } else if (movingForward) { -// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot))); +// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot))); return false; } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h index 81a340f5..b63cfbf7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.h @@ -78,7 +78,7 @@ public: void SetEnabled(bool enabled) { fEnabled = enabled; } protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} bool IIsReadyToClimb(); void ITriggerSelf(plKey avKey); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h index 2381cfc7..4c051cc9 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTask.h @@ -82,14 +82,14 @@ public: /** Start the task: set up initial conditions or wait for resources to become available. Start will be called repeatedly until it returns true, indicating the task has begun. */ - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Run the task. Start is guaranteed to have returned true before Process() is called even once. Returns false when the task has finished and epilogue code has been executed. */ - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Clean up the task. This is guaranteed to be called when Process returns false. */ - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar) {} diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp index 7e84424d..66704c98 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.cpp @@ -75,7 +75,7 @@ plAvTaskBrain::~plAvTaskBrain() // Start ------------------------------------------------------------------------------------------ // ------ -hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { if(fBrain) avatar->PushBrain(fBrain); @@ -87,7 +87,7 @@ hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, doubl return true; } -void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h index 608cf686..62571017 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskBrain.h @@ -71,8 +71,8 @@ public: virtual ~plAvTaskBrain(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** dump descriptive stuff to the given debug text */ virtual void DumpDebug(const char *name, int &x, int&y, int lineHeight, char *strBuf, plDebugText &debugTxt); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp index 793c6c64..35b4a2e0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp @@ -197,13 +197,13 @@ void plAvTaskSeek::SetTarget(hsPoint3 &pos, hsPoint3 &lookAt) { fSeekPos = pos; hsVector3 up(0.f, 0.f, 1.f); - hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2; + float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2; fSeekRot.SetAngleAxis(angle, up); } // Start ----------------------------------------------------------------------------------------- // ------ -hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain); hsAssert(huBrain, "Seek task only works on human brains"); @@ -243,7 +243,7 @@ hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double // Process ------------------------------------------------------------------------------------------- // -------- -hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { if (fState == kSeekAbort) return false; @@ -268,7 +268,7 @@ hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, doub // Finish --------------------------------------------------------------------------------------- // ------- -void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain); @@ -318,7 +318,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar) hsVector3 normalizedGoalVec(fGoalVec); normalizedGoalVec.Normalize(); - fDistance = hsSquareRoot(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY); + fDistance = sqrt(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY); if(fDistance < 3.0f) { @@ -350,7 +350,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar) // IMoveTowardsGoal -------------------------------------------------------------- // ----------------- hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { bool stillRunning = true; avatar->ClearInputFlags(false, false); @@ -435,7 +435,7 @@ hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *bra // ITRYFINISH -bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed) +bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed) { hsBool animsDone = brain->IsMovementZeroBlend(); @@ -458,7 +458,7 @@ bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, doub hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { // While warping, we might be hovering just above the ground. Don't want that to // trigger any falling behavior. @@ -494,7 +494,7 @@ hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition, // ---------------- hsBool plAvTaskSeek::IFinishRotation(hsQuat &newRotation, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed) + double time, float elapsed) { // we're pretty much done; just hop the rest of the way newRotation = fSeekRot; @@ -603,8 +603,8 @@ void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar) // -------------- float QuatAngleDiff(const hsQuat &a, const hsQuat &b) { - hsScalar theta; /* angle between A and B */ - hsScalar cos_t; /* sine, cosine of theta */ + float theta; /* angle between A and B */ + float cos_t; /* sine, cosine of theta */ /* cosine theta = dot product of A and B */ cos_t = a.Dot(b); @@ -616,11 +616,11 @@ float QuatAngleDiff(const hsQuat &a, const hsQuat &b) } // Calling acos on 1.0 is returning an undefined value. Need to check for it. - hsScalar epsilon = 0.00001; + float epsilon = 0.00001; if (hsABS(cos_t - 1.f) < epsilon) return 0; - theta = hsACosine(cos_t); + theta = acos(cos_t); return theta; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h index 695e8fea..964c0456 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.h @@ -82,15 +82,15 @@ public: /** Initiate the task; make sure we're running on the right type of brain, save off user input state, and turn off any other running behaviors.*/ - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Progress towards the goal using a combination of walking and cheating-via-sliding. Returns true if we're still working on it; false if we're done. */ - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** Restore user input state, etc. */ - virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); /** clear our target, and when we try to eval, we'll just finish */ virtual void LeaveAge(plArmatureMod *avatar); @@ -121,19 +121,19 @@ protected: /** Progress towards the goal. We get as close as we can by just pushing the same buttons as the user (forward, turn, etc.) when we're really close we slide around a bit so we can wind up on the *exact* initial orientation. */ - hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed); + hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed); /** Okay, we're in the pure cheating mode now. Try to wrap it up; returns true when it's finally there. */ - bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed); + bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed); /** Final cheating for position */ hsBool IFinishPosition(hsPoint3 &newPosition, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed); + double time, float elapsed); /** Final cheating for rotation */ hsBool IFinishRotation(hsQuat &newRotation, plArmatureMod *avatar, plAvBrainHuman *brain, - double time, hsScalar elapsed); + double time, float elapsed); /** If our target's moving, cache its new position and orientation for later math */ hsBool IUpdateObjective(plArmatureMod *avatar); @@ -170,17 +170,17 @@ protected: hsBool fStillRotating; // haven't yet reached the final orientation hsVector3 fGoalVec; // vec from us to the goal - hsScalar fDistance; // how far to the goal? - hsScalar fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward - hsScalar fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left - hsScalar fDistForward; // distance straight forward to goal plane - hsScalar fDistRight; // distance straight right to goal plane - - hsScalar fShuffleRange; - hsScalar fMaxSidleAngle; // in right . goal - hsScalar fMaxSidleRange; // in feet - hsScalar fMinFwdAngle; // in fwd . goal - hsScalar fMaxBackAngle; // in fwd . goal + float fDistance; // how far to the goal? + float fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward + float fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left + float fDistForward; // distance straight forward to goal plane + float fDistRight; // distance straight right to goal plane + + float fShuffleRange; + float fMaxSidleAngle; // in right . goal + float fMaxSidleRange; // in feet + float fMinFwdAngle; // in fwd . goal + float fMaxBackAngle; // in fwd . goal double fStartTime; uint8_t fFlags; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp index dd61032b..99b6870d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp @@ -502,7 +502,7 @@ void plClothingOutfit::RemoveItem(plClothingItem *item, hsBool update /* = true plgDispatch::MsgSend(msg); } -void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue, +void plClothingOutfit::TintItem(plClothingItem *item, float red, float green, float blue, hsBool update /* = true */, hsBool broadcast /* = true */, hsBool netForce /* = false */, hsBool retry /* = true */, uint8_t layer /* = kLayerTint1 */) { @@ -526,7 +526,7 @@ void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar gre plgDispatch::MsgSend(msg); } -void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue, +void plClothingOutfit::TintSkin(float red, float green, float blue, hsBool update /* = true */, hsBool broadcast /* = true */) { plClothingMsg *msg = TRACKED_NEW plClothingMsg(); @@ -541,7 +541,7 @@ void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue, plgDispatch::MsgSend(msg); } -void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight, +void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight, hsBool retry /* = true */) { plClothingMsg *msg = TRACKED_NEW plClothingMsg(); @@ -556,12 +556,12 @@ void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t de plgDispatch::MsgSend(msg); } -void plClothingOutfit::SetAge(hsScalar age, hsBool update /* = true */, hsBool broadcast /* = true */) +void plClothingOutfit::SetAge(float age, hsBool update /* = true */, hsBool broadcast /* = true */) { SetSkinBlend(age, plClothingElement::kLayerSkinBlend1, update, broadcast); } -void plClothingOutfit::SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update /* = true */, hsBool broadcast /* = true */) +void plClothingOutfit::SetSkinBlend(float blend, uint8_t layer, hsBool update /* = true */, hsBool broadcast /* = true */) { plClothingMsg *msg = TRACKED_NEW plClothingMsg(); msg->AddReceiver(GetKey()); @@ -576,7 +576,7 @@ void plClothingOutfit::SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update plgDispatch::MsgSend(msg); } -hsScalar plClothingOutfit::GetSkinBlend(uint8_t layer) +float plClothingOutfit::GetSkinBlend(uint8_t layer) { if (layer >= plClothingElement::kLayerSkinBlend1 && layer <= plClothingElement::kLayerSkinLast) return fSkinBlends[layer - plClothingElement::kLayerSkinBlend1]; @@ -712,7 +712,7 @@ hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, uint8_t layer /* return color; } -hsBool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight) +hsBool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight) { uint32_t index = fItems.Find(item); if (index != fItems.kMissingIndex) @@ -1159,12 +1159,12 @@ void plClothingOutfit::WearRandomOutfit() cMgr->GetItemsByGroupAndType(fGroup, (uint8_t)i, items); j = (uint32_t)(sRandom.RandZeroToOne() * items.GetCount()); - hsScalar r1 = sRandom.RandZeroToOne(); - hsScalar g1 = sRandom.RandZeroToOne(); - hsScalar b1 = sRandom.RandZeroToOne(); - hsScalar r2 = sRandom.RandZeroToOne(); - hsScalar g2 = sRandom.RandZeroToOne(); - hsScalar b2 = sRandom.RandZeroToOne(); + float r1 = sRandom.RandZeroToOne(); + float g1 = sRandom.RandZeroToOne(); + float b1 = sRandom.RandZeroToOne(); + float r2 = sRandom.RandZeroToOne(); + float g2 = sRandom.RandZeroToOne(); + float b2 = sRandom.RandZeroToOne(); AddItem(items[j], false, false); TintItem(items[j], r1, g1, b1, false, false, false, true, 1); @@ -1360,7 +1360,7 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg) if (cMsg->GetCommand(plClothingMsg::kBlendSkin)) { - hsScalar blend = cMsg->fColor.a; + float blend = cMsg->fColor.a; if (blend > 1.f) blend = 1.f; if (blend < 0.f) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h index 8dbbad56..6f09c6f6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h @@ -170,7 +170,7 @@ public: uint8_t fGroup; bool fSynchClients; // set true if the next synch should be bcast hsColorRGBA fSkinTint; - hsScalar fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures. + float fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures. plClothingOutfit(); ~plClothingOutfit(); @@ -181,16 +181,16 @@ public: void SaveCustomizations(hsBool retry = true); void AddItem(plClothingItem *item, hsBool update = true, hsBool broadcast = true, hsBool netForce=false); void RemoveItem(plClothingItem *item, hsBool update = true, hsBool netForce=false); - void TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue, hsBool update = true, hsBool broadcast = true, + void TintItem(plClothingItem *item, float red, float green, float blue, hsBool update = true, hsBool broadcast = true, hsBool netForce = false, hsBool retry = true, uint8_t fLayer = plClothingElement::kLayerTint1); - void TintSkin(hsScalar red, hsScalar green, hsScalar blue, + void TintSkin(float red, float green, float blue, hsBool update = true, hsBool broadcast = true); - void MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight, hsBool retry = true); - void SetAge(hsScalar age, hsBool update = true, hsBool broadcast = true); - void SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update = true, hsBool broadcast = true); - hsScalar GetSkinBlend(uint8_t layer); + void MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight, hsBool retry = true); + void SetAge(float age, hsBool update = true, hsBool broadcast = true); + void SetSkinBlend(float blend, uint8_t layer, hsBool update = true, hsBool broadcast = true); + float GetSkinBlend(uint8_t layer); hsColorRGBA GetItemTint(plClothingItem *item, uint8_t layer = 2) const; - hsScalar GetAge() const { return fSkinBlends[0]; } + float GetAge() const { return fSkinBlends[0]; } hsTArray &GetItemList() { return fItems; } hsTArray &GetOptionList() { return fOptions; } @@ -232,7 +232,7 @@ protected: void IAddItem(plClothingItem *item); void IRemoveItem(plClothingItem *item); hsBool ITintItem(plClothingItem *item, hsColorRGBA color, uint8_t layer); - hsBool IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight); + hsBool IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight); void IHandleMorphSDR(plStateDataRecord *sdr); void IUpdate(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp index 10c35305..b9fe8695 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp @@ -843,7 +843,7 @@ int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, uint32_t remoteID) return hsOK; } -int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z) +int plAvatarMgr::WarpPlayerToXYZ(float x, float y, float z) { plSceneObject *localSO = plSceneObject::ConvertNoRef(plNetClientMgr::GetInstance()->GetLocalPlayer()); if (!localSO) @@ -860,7 +860,7 @@ int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z) return hsOK; } -int plAvatarMgr::WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z) +int plAvatarMgr::WarpPlayerToXYZ(int pid, float x, float y, float z) { plNetClientMgr* nc=plNetClientMgr::GetInstance(); plNetTransportMember* mbr=nc->TransportMgr().GetMember(nc->TransportMgr().FindMember(pid)); @@ -962,10 +962,10 @@ void plAvatarMgr::PointToDniCoordinate(hsPoint3 pt, plDniCoordinateInfo* ret) hsVector3 retVec(pt - retPoint); retVec.Normalize(); - hsScalar dotView = retVec * zeroVec; - hsScalar dotRight = retVec * zeroRight; + float dotView = retVec * zeroVec; + float dotRight = retVec * zeroRight; - hsScalar deg = acosf(dotView); + float deg = acosf(dotView); deg*=(180/3.141592); // account for being > 180 if (dotRight < 0.0f) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h index 5eb7b157..7b65e90d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h @@ -150,8 +150,8 @@ public: int FindSpawnPoint( const char *name ) const; // \} static int WarpPlayerToAnother(hsBool iMove, uint32_t remoteID); - static int WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z); - static int WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z); + static int WarpPlayerToXYZ(float x, float y, float z); + static int WarpPlayerToXYZ(int pid, float x, float y, float z); static plAvatarMgr *GetInstance(); static void ShutDown(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp index 3a1b0ba8..1dff5a3b 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarSDLModifier.cpp @@ -135,7 +135,7 @@ void plAvatarPhysicalSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* if ((rotVar->IsDirty() || posVar->IsDirty()) && avMod->GetController()) { hsPoint3 pos; - hsScalar zRot; + float zRot; posVar->Get(&pos.fX); rotVar->Get(&zRot); avMod->GetController()->SetState(pos, zRot); @@ -155,7 +155,7 @@ void plAvatarPhysicalSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState if(avMod && avMod->GetController()) { hsPoint3 pos; - hsScalar zRot; + float zRot; avMod->GetController()->GetState(pos, zRot); dstState->FindVar(kStrRotation)->Set(zRot); dstState->FindVar(kStrPosition)->Set(&pos.fX); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp index 62b2ff21..57ffce48 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp @@ -89,20 +89,20 @@ plAvTask::plAvTask() } // START -hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { return true; // true indicates the task has started succesfully } // PROCESS -hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { return false; } // Finish ----------------------------------------------------------------------------------- // ------- -void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { } @@ -214,7 +214,7 @@ void GetPositionAndRotation(hsMatrix44 transform, hsScalarTriple *position, hsQu // START // Adjust our goal time based on our duration and the current time -hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { fTargetTime = time + fDuration; // clock starts now.... fPhysicalAtStart = avatar->IsPhysicsEnabled(); @@ -281,7 +281,7 @@ void CalcHandleTargetPosition(hsMatrix44 &result, plSceneObject *insert, plScene // PROCESS // Move closer to the goal position and orientation -hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsQuat rotation; hsPoint3 position; @@ -349,10 +349,10 @@ plAvAnimTask::plAvAnimTask() // CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach plAvAnimTask::plAvAnimTask(const char *animName, - hsScalar initialBlend, - hsScalar targetBlend, - hsScalar fadeSpeed, - hsScalar setTime, + float initialBlend, + float targetBlend, + float fadeSpeed, + float setTime, hsBool start, hsBool loop, hsBool attach) @@ -370,7 +370,7 @@ plAvAnimTask::plAvAnimTask(const char *animName, } // CTOR animName, fadeSpeed, attach -plAvAnimTask::plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach) +plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach) : fInitialBlend(0.0f), fTargetBlend(0.0f), fFadeSpeed(fadeSpeed), @@ -398,7 +398,7 @@ plAvAnimTask::~plAvAnimTask() } // START -hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = false; if(fAttach) @@ -440,7 +440,7 @@ hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double } // PROCESS -hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { // the only reason we need this function is to watch the animation until it fades out hsBool result = false; @@ -579,7 +579,7 @@ plAvOneShotTask::~plAvOneShotTask() // START -hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = false; @@ -664,7 +664,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou } // PROCESS -hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { // *** if we are under mouse control, adjust it here @@ -675,7 +675,7 @@ hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, d { const plAGAnim * animation = fAnimInstance->GetAnimation(); double endTime = (fBackwards ? animation->GetStart() : animation->GetEnd()); - fAnimInstance->SetCurrentTime((hsScalar)endTime); + fAnimInstance->SetCurrentTime((float)endTime); avatar->ApplyAnimations(time, elapsed); if(--fWaitFrames == 0) @@ -778,7 +778,7 @@ plAvOneShotLinkTask::~plAvOneShotLinkTask() } // task protocol -hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed); fStartTime = time; @@ -795,7 +795,7 @@ hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, return result; } -hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed) +hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) { hsBool result = plAvOneShotTask::Process(avatar, brain, time, elapsed); if (fIgnore) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h index 2caab5c1..79b206ea 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h @@ -84,19 +84,19 @@ public: \param loop Make the animation loop? \param attach Are we attaching or detaching the animation? */ - plAvAnimTask(const char *animName, hsScalar initialBlend, hsScalar targetBlend, hsScalar fadeSpeed, - hsScalar setTime, hsBool start, hsBool loop, hsBool attach); + plAvAnimTask(const char *animName, float initialBlend, float targetBlend, float fadeSpeed, + float setTime, hsBool start, hsBool loop, hsBool attach); /** Canonical constructor form form for detaching \param animName The name of the animation we're detaching \param fadeSpeed How fast to fade it out. */ - plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach = false); + plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach = false); virtual ~plAvAnimTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); // plasma protocol @@ -109,10 +109,10 @@ public: protected: // public members char* fAnimName; // the animation we're operating on - hsScalar fInitialBlend; // the blend to establish (attaching only) - hsScalar fTargetBlend; // the blend to achieve eventually (attaching only) - hsScalar fFadeSpeed; // how fast to achieve the blend - hsScalar fSetTime; // set the animation to this time + float fInitialBlend; // the blend to establish (attaching only) + float fTargetBlend; // the blend to achieve eventually (attaching only) + float fFadeSpeed; // how fast to achieve the blend + float fSetTime; // set the animation to this time hsBool fStart; // start the animation playing? (attaching only) hsBool fLoop; // turn on looping? (attaching only) hsBool fAttach; // attach? (otherwise detach) @@ -137,8 +137,8 @@ public: plAvSeekTask(plKey target, plAvAlignment alignType, const char *animName); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); // plasma protocol @@ -193,8 +193,8 @@ public: virtual ~plAvOneShotTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual void LeaveAge(plArmatureMod *avatar); void SetAnimName(char *name); @@ -246,8 +246,8 @@ public: virtual ~plAvOneShotLinkTask(); // task protocol - virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); - virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed); + virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); + virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); CLASSNAME_REGISTER( plAvOneShotLinkTask ); GETINTERFACE_ANY( plAvOneShotLinkTask, plAvOneShotTask ); @@ -262,7 +262,7 @@ public: protected: char *fMarkerName; double fStartTime; - hsScalar fMarkerTime; + float fMarkerTime; hsBool fLinkFired; }; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp index 3b78b3cf..646ba07e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plClothingSDLModifier.cpp @@ -230,7 +230,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot int i; uint8_t tint[3]; - hsScalar tintScalar[3]; + float tintScalar[3]; if (!strcmp(sdr->GetDescriptor()->GetName(), kStrClothingDescName)) { // get item from clothesItem @@ -302,7 +302,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot { uint8_t blend; faceBlends->Get(&blend, i); - clothing->fSkinBlends[i] = (hsScalar)blend / 255; + clothing->fSkinBlends[i] = (float)blend / 255; } } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp index 7286eb67..533532f8 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp @@ -376,7 +376,7 @@ uint16_t plMatrixBlend::GetPriority() { hsBool plMatrixBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fChannelA->IsStoppedAt(time); if (blend == 1) @@ -401,7 +401,7 @@ const hsMatrix44 & plMatrixBlend::Value(double time, bool peek) // ------------ const hsAffineParts & plMatrixBlend::AffineValue(double time, bool peek) { - const hsScalar &blend = fChannelBias->Value(time); + const float &blend = fChannelBias->Value(time); if(blend == 0) { return fOptimizedA->AffineValue(time, peek); } else { @@ -452,7 +452,7 @@ plAGChannel *plMatrixBlend::Optimize(double time) { fOptimizedA = (plMatrixChannel *)fChannelA->Optimize(time); fOptimizedB = (plMatrixChannel *)fChannelB->Optimize(time); - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if(blend == 0.0f) return fOptimizedA; if(blend == 1.0f) @@ -526,7 +526,7 @@ const hsMatrix44 & plMatrixControllerChannel::Value(double time, bool peek, plControllerCacheInfo *cache) { plProfile_BeginTiming(AffineInterp); - fController->Interp((hsScalar)time, &fAP, cache); + fController->Interp((float)time, &fAP, cache); plProfile_EndTiming(AffineInterp); plProfile_BeginTiming(AffineCompose); @@ -548,7 +548,7 @@ const hsAffineParts & plMatrixControllerChannel::AffineValue(double time, bool p plControllerCacheInfo *cache) { plProfile_BeginTiming(AffineInterp); - fController->Interp((hsScalar)time, &fAP, cache); + fController->Interp((float)time, &fAP, cache); plProfile_EndTiming(AffineInterp); return fAP; } @@ -764,7 +764,7 @@ void plMatrixChannelApplicator::IApply(const plAGModifier *mod, double time) // /////////////////////////////////////////////////////////////////////////////////////////// -const hsScalar plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds +const float plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds void plMatrixDelayedCorrectionApplicator::SetCorrection(hsMatrix44 &cor) { @@ -822,7 +822,7 @@ void plMatrixDelayedCorrectionApplicator::IApply(const plAGModifier *mod, double hsAffineParts interpAP; hsMatrix44 interpResult; - hsScalar blend = (hsScalar)((time - fDelayStart) / fDelayLength); + float blend = (float)((time - fDelayStart) / fDelayLength); hsInterp::LinInterp(&fCorAP, &identAP, blend, &interpAP); interpAP.ComposeMatrix(&interpResult); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h index 020e7eb6..fa5a67fd 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.h @@ -348,7 +348,7 @@ public: virtual hsBool CanBlend(plAGApplicator *app); hsBool fIgnoreNextCorrection; - static const hsScalar fDelayLength; // static var for now. + static const float fDelayLength; // static var for now. }; // PLMATRIXDIFFERENCEAPP diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h index 63000f7b..ffd125c1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.h @@ -61,7 +61,7 @@ protected: std::vector fReceivers; void IDeleteStageVec(); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: plMultistageBehMod(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp index 678b5dcd..1a09c72a 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp @@ -175,7 +175,7 @@ void plNPCSpawnMod::Write(hsStream *stream, hsResMgr *mgr) // IEVAL // attack of the bogons -hsBool plNPCSpawnMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plNPCSpawnMod::IEval(double secs, float del, uint32_t dirty) { return true; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h index b17959c9..0e9003bf 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h @@ -65,7 +65,7 @@ public: virtual void Write(hsStream *stream, hsResMgr *mgr); protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); void ISendNotify(plKey &avatarKey); // send our notification message private: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h index e3d22c14..5cf9c546 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plOneShotMod : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} char * fAnimName; // the name of the animation associated with this one-shot hsBool fDrivable; // whether the user can control the position of the animation hsBool fReversable; // whether the user can back up the animation (fDrivable must be true as well) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp index 3c7af1eb..f830a2c0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp @@ -56,8 +56,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define kGENERICCONTROLLERRADIUS 1.1f #define kGENERICCONTROLLERHEIGHT 2.8f -//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsScalarDegToRad(80.f))) -const hsScalar plMovementStrategy::kAirTimeThreshold = .1f; // seconds +//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsDegreesToRadians(80.f))) +const float plMovementStrategy::kAirTimeThreshold = .1f; // seconds bool CompareMatrices(const hsMatrix44 &matA, const hsMatrix44 &matB, float tolerance); bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right) { @@ -91,18 +91,18 @@ void plMovementStrategy::IApplyKinematic() plPhysicalControllerCore::~plPhysicalControllerCore() { } -void plPhysicalControllerCore::Apply(hsScalar delSecs) +void plPhysicalControllerCore::Apply(float delSecs) { fSimLength=delSecs; hsAssert(fMovementInterface, "plPhysicalControllerCore::Apply() missing a movement interface"); if(fMovementInterface)fMovementInterface->Apply(delSecs); } -void plPhysicalControllerCore::PostStep(hsScalar delSecs) +void plPhysicalControllerCore::PostStep(float delSecs) { hsAssert(fMovementInterface, "plPhysicalControllerCore::PostStep() missing a movement interface"); if(fMovementInterface)fMovementInterface->PostStep(delSecs); } -void plPhysicalControllerCore::Update(hsScalar delSecs) +void plPhysicalControllerCore::Update(float delSecs) { hsAssert(fMovementInterface, "plPhysicalControllerCore::Update() missing a movement interface"); if(fMovementInterface)fMovementInterface->Update(delSecs); @@ -122,7 +122,7 @@ void plPhysicalControllerCore::SendCorrectionMessages() corrMsg->AddReceiver(fOwner); corrMsg->Send(); } -plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, hsScalar height, hsScalar radius) +plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, float height, float radius) :fMovementInterface(nil) ,fOwner(OwnerSceneObject) ,fHeight(height) @@ -188,21 +188,21 @@ void plPhysicalControllerCore::MoveActorToSim() fAchievedLinearVelocity=fDisplacementThisStep/fSimLength; else fAchievedLinearVelocity.Set(0.0f,0.0f,0.0f); } -void plPhysicalControllerCore::IncrementAngle(hsScalar deltaAngle) +void plPhysicalControllerCore::IncrementAngle(float deltaAngle) { - hsScalar angle; + float angle; hsVector3 axis; fLocalRotation.NormalizeIfNeeded(); fLocalRotation.GetAngleAxis(&angle, &axis); // adjust it (quaternions are weird...) if (axis.fZ < 0) - angle = (2*hsScalarPI) - angle; // axis is backwards, so reverse the angle too + angle = (2*M_PI) - angle; // axis is backwards, so reverse the angle too angle += deltaAngle; // make sure we wrap around if (angle < 0) - angle = (2*hsScalarPI) + angle; // angle is -, so this works like a subtract - if (angle >= (2*hsScalarPI)) - angle = angle - (2*hsScalarPI); + angle = (2*M_PI) + angle; // angle is -, so this works like a subtract + if (angle >= (2*M_PI)) + angle = angle - (2*M_PI); // and set the new angle fLocalRotation.SetAngleAxis(angle, hsVector3(0,0,1)); } @@ -235,7 +235,7 @@ bool plPhysicalControllerCore::GetFacingPushingPhysical() } /////////////////////////// //Walking Strategy -void plWalkingStrategy::Apply(hsScalar delSecs) +void plWalkingStrategy::Apply(float delSecs) { //Apply Should Only be Called from a PhysicalControllerCore hsAssert(fCore,"No Core shouldn't be Applying"); @@ -304,13 +304,13 @@ void plWalkingStrategy::Apply(hsScalar delSecs) { // Get our previous z velocity. If we're on the ground, clamp it to zero at // the largest, so we won't launch into the air if we're running uphill. - hsScalar prevZVel = AchievedLinearVelocity.fZ; + float prevZVel = AchievedLinearVelocity.fZ; if (IsOnGround()) prevZVel = hsMinimum(prevZVel, 0.f); - hsScalar grav = kGravity * delSecs; + float grav = kGravity * delSecs; // If our gravity contribution isn't high enough this frame, we won't // report a collision even when standing on solid ground. - hsScalar maxGrav = -.001f / delSecs; + float maxGrav = -.001f / delSecs; if (grav > maxGrav) grav = maxGrav; LinearVelocity.fZ = prevZVel + grav; @@ -447,23 +447,23 @@ void plWalkingStrategy::ICheckForFalseGround() // seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect. // This is the same running into 2 walls where the angle between them is 60. int i, j; - const hsScalar threshold = hsScalarDegToRad(240.f); + const float threshold = hsDegreesToRadians(240.f); int numContacts = fContactNormals.GetCount() + fPrevSlidingNormals.GetCount(); if (numContacts >= 2) { // For extra fun... PhysX will actually report some collisions every other frame, as though // we're bouncing back and forth between the two (or more) objects blocking us. So it's not // enough to look at this frame's collisions, we have to check previous frames too. - hsTArray fCollisionAngles; + hsTArray fCollisionAngles; fCollisionAngles.SetCount(numContacts); int angleIdx = 0; for (i = 0; i < fContactNormals.GetCount(); i++, angleIdx++) { - fCollisionAngles[angleIdx] = hsATan2(fContactNormals[i].fY, fContactNormals[i].fX); + fCollisionAngles[angleIdx] = atan2(fContactNormals[i].fY, fContactNormals[i].fX); } for (i = 0; i < fPrevSlidingNormals.GetCount(); i++, angleIdx++) { - fCollisionAngles[angleIdx] = hsATan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX); + fCollisionAngles[angleIdx] = atan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX); } // numContacts is rarely larger than 6, so let's do a simple bubble sort. for (i = 0; i < numContacts; i++) @@ -472,7 +472,7 @@ void plWalkingStrategy::ICheckForFalseGround() { if (fCollisionAngles[i] > fCollisionAngles[j]) { - hsScalar tempAngle = fCollisionAngles[i]; + float tempAngle = fCollisionAngles[i]; fCollisionAngles[i] = fCollisionAngles[j]; fCollisionAngles[j] = tempAngle; } @@ -487,16 +487,16 @@ void plWalkingStrategy::ICheckForFalseGround() if (i == numContacts) { // We got to the end. Check the last with the first and make your decision. - if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI))) + if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI))) fFalseGround = true; } } } -void plWalkingStrategy::Update(hsScalar delSecs) +void plWalkingStrategy::Update(float delSecs) { //Update Should Only be Called from a PhysicalControllerCore hsAssert(fCore,"Running Update: but have no Core"); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); hsVector3 LinearVelocity=fCore->GetLinearVelocity(); if (!fCore->IsEnabled() || fCore->IsKinematic()) @@ -515,7 +515,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) fCore->MoveActorToSim(); if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } // We can't only send updates when the physical position changes because the @@ -539,7 +539,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) { //we have hit our head and we don't have anything beneath our feet //not really friction just a way to make it seem more realistic keep between 0 and 1 - hsScalar headFriction=0.0f; + float headFriction=0.0f; AchievedLinearVelocity.fX=(1.0f-headFriction)*LinearVelocity.fX; AchievedLinearVelocity.fY=(1.0f-headFriction)*LinearVelocity.fY; //only clamping when hitting head and going upwards, if going down leave it be @@ -565,7 +565,7 @@ void plWalkingStrategy::Update(hsScalar delSecs) void plWalkingStrategy::IAddContactNormals(hsVector3& vec) { //TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here - hsScalar dot = vec * kAvatarUp; + float dot = vec * kAvatarUp; if ( dot >= kSLOPELIMIT ) fGroundHit=true; else plMovementStrategySimulationInterface::IAddContactNormals(vec); } @@ -610,7 +610,7 @@ void plSwimStrategy::IAdjustBuoyancy() else fBuoyancy =(depth/surfaceDepth ); } -void plSwimStrategy::Apply(hsScalar delSecs) +void plSwimStrategy::Apply(float delSecs) { hsAssert(fCore,"PlSwimStrategy::Apply No Core shouldn't be Applying"); uint32_t collideFlags = @@ -666,16 +666,16 @@ void plSwimStrategy::Apply(hsScalar delSecs) LinearVelocity = subworldCI->GetWorldToLocal() * LinearVelocity; } IAdjustBuoyancy(); - hsScalar zacc; - hsScalar retardent=0.0f; - static hsScalar FinalBobSpeed=0.5f; + float zacc; + float retardent=0.0f; + static float FinalBobSpeed=0.5f; //trying to dampen the oscillations if((AchievedLinearVelocity.fZ>FinalBobSpeed)||(AchievedLinearVelocity.fZ<-FinalBobSpeed)) retardent=AchievedLinearVelocity.fZ *-.90f; zacc=(1-fBuoyancy)*-32.f + retardent; hsVector3 linCurrent(0.0f,0.0f,0.0f); - hsScalar angCurrent = 0.f; + float angCurrent = 0.f; if (fCurrentRegion != nil) { @@ -702,14 +702,14 @@ void plSwimStrategy::Apply(hsScalar delSecs) fContactNormals.SetCount(0); fCore->Move(displacement,collideFlags,colFlags); if((colFlags&kBottom)||(colFlags&kSides))fHadContacts=true; - hsScalar angvel=fCore->GetAngularVelocity(); + float angvel=fCore->GetAngularVelocity(); fCore->SetAngularVelocity(angvel +angCurrent); } } -void plSwimStrategy::Update(hsScalar delSecs) +void plSwimStrategy::Update(float delSecs) { hsAssert(fCore,"Running Update: but have no Core"); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); hsVector3 LinearVelocity=fCore->GetLinearVelocity(); if (!fCore->IsEnabled() || fCore->IsKinematic()) { @@ -724,7 +724,7 @@ void plSwimStrategy::Update(hsScalar delSecs) if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } fCore->UpdateWorldRelativePos(); @@ -737,7 +737,7 @@ void plSwimStrategy::Update(hsScalar delSecs) void plSwimStrategy::IAddContactNormals(hsVector3& vec) { //TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here - hsScalar dot = vec * kAvatarUp; + float dot = vec * kAvatarUp; if ( dot >= kSLOPELIMIT ) { fOnGround=true; @@ -745,12 +745,12 @@ void plSwimStrategy::IAddContactNormals(hsVector3& vec) } else plMovementStrategySimulationInterface::IAddContactNormals(vec); } -void plSwimStrategy::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight) +void plSwimStrategy::SetSurface(plSwimRegionInterface *region, float surfaceHeight) { fCurrentRegion=region; fSurfaceHeight=surfaceHeight; } -void plRidingAnimatedPhysicalStrategy::Apply(hsScalar delSecs) +void plRidingAnimatedPhysicalStrategy::Apply(float delSecs) { hsVector3 LinearVelocity=fCore->GetLinearVelocity(); hsVector3 AchievedLinearVelocity=fCore->GetAchievedLinearVelocity(); @@ -940,7 +940,7 @@ bool plRidingAnimatedPhysicalStrategy::ICheckMove(const hsPoint3& startPos, cons } } -void plRidingAnimatedPhysicalStrategy::Update(hsScalar delSecs) +void plRidingAnimatedPhysicalStrategy::Update(float delSecs) { if (!fCore->IsEnabled() || fCore->IsKinematic()) { @@ -949,7 +949,7 @@ void plRidingAnimatedPhysicalStrategy::Update(hsScalar delSecs) } fCore->CheckAndHandleAnyStateChanges(); } -void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) +void plRidingAnimatedPhysicalStrategy::PostStep(float delSecs) { if(!(!fCore->IsEnabled() || fCore->IsKinematic())) { @@ -959,7 +959,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) fTimeInAir = 0.f; hsVector3 AchievedLinearVelocity, LinearVelocity; AchievedLinearVelocity = fCore->GetLinearVelocity(); - hsScalar AngularVelocity=fCore->GetAngularVelocity(); + float AngularVelocity=fCore->GetAngularVelocity(); fCore->OverrideAchievedVelocity(AchievedLinearVelocity); plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded()); if (so) @@ -967,7 +967,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs) fCore->UpdateControllerAndPhysicalRep(); if (AngularVelocity != 0.f) { - hsScalar deltaAngle=AngularVelocity*delSecs; + float deltaAngle=AngularVelocity*delSecs; fCore->IncrementAngle( deltaAngle); } fCore->UpdateWorldRelativePos(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h index 62e26d42..c8415ef1 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsQuat.h" #define PHYSX_ONLY_TRIGGER_FROM_KINEMATIC 1 -#define kSLOPELIMIT (cosf(hsScalarDegToRad(55.f))) +#define kSLOPELIMIT (cosf(hsDegreesToRadians(55.f))) class plCoordinateInterface; class plPhysical; @@ -72,12 +72,12 @@ class plMovementStrategySimulationInterface { public: - virtual void Apply(hsScalar delSecs)=0; - virtual void Update(hsScalar delSecs)=0; + virtual void Apply(float delSecs)=0; + virtual void Update(float delSecs)=0; //most strategies don't require this. Only the ones that require behavior like a physical or need //something after the sim step. this used to be taken care of by Update, but this was moved to take care of //some of the frame lag - virtual void PostStep(hsScalar delSecs){}; + virtual void PostStep(float delSecs){}; virtual void IAddContactNormals(hsVector3& vec){fContactNormals.Append(vec);} virtual void AddOnTopOfObject(plPhysical* phys){ fOnTopOf.Append(phys);} virtual void LeaveAge() @@ -95,7 +95,7 @@ class plControllerSweepRecord public: plPhysical *ObjHit; hsPoint3 locHit;//World space - hsScalar TimeHit;//Normalized between 0 and 1 + float TimeHit;//Normalized between 0 and 1 hsVector3 Norm; }; bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right); @@ -105,9 +105,9 @@ public: virtual ~plPhysicalControllerCore(); virtual void Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults)=0; virtual void SetMovementSimulationInterface(plMovementStrategySimulationInterface* strat){fMovementInterface=strat;} - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - virtual void PostStep(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + virtual void PostStep(float delSecs); // A disabled avatar doesn't move or accumulate air time if he's off the ground. virtual void Enable(bool enable) = 0; virtual bool IsEnabled() {return fEnabled;} @@ -125,9 +125,9 @@ public: //when seeking no longer want to interact with exclusion regions virtual void SetSeek(bool seek){fSeeking=seek;} virtual bool IsSeeking(){return fSeeking;} - static plPhysicalControllerCore* Create(plKey ownerSO, hsScalar height, hsScalar radius); + static plPhysicalControllerCore* Create(plKey ownerSO, float height, float radius); virtual plMovementStrategySimulationInterface* GetMovementInterface(){return fMovementInterface;} - plPhysicalControllerCore(plKey ownerSceneObject, hsScalar height, hsScalar radius); + plPhysicalControllerCore(plKey ownerSceneObject, float height, float radius); virtual plKey GetOwner(){return fOwner;}; // Set the LOS DB this avatar will be in (only one) virtual void SetLOSDB(plSimDefs::plLOSDB losDB) { fLOSDB = losDB; } ; @@ -162,36 +162,36 @@ public: return vel/fSimLength; } void SendCorrectionMessages(); - void IncrementAngle(hsScalar deltaAngle); + void IncrementAngle(float deltaAngle); void UpdateWorldRelativePos(); virtual void SetLinearVelocity(const hsVector3& linearVel){fLinearVelocity=linearVel;} //should actually be a 3 vector but everywhere else it is assumed to be just around Z - virtual void SetAngularVelocity(const hsScalar angvel){ fAngularVelocity=angvel;} - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel) + virtual void SetAngularVelocity(const float angvel){ fAngularVelocity=angvel;} + virtual void SetVelocities(const hsVector3& linearVel, float angVel) { fLinearVelocity=linearVel; fAngularVelocity=angVel; } virtual const hsVector3& GetLinearVelocity() ; - virtual hsScalar GetAngularVelocity(){return fAngularVelocity;} + virtual float GetAngularVelocity(){return fAngularVelocity;} virtual const hsVector3& GetAchievedLinearVelocity()const {return fAchievedLinearVelocity;} plPhysical* GetPushingPhysical(); bool GetFacingPushingPhysical(); virtual void SetPushingPhysical(plPhysical* pl){fPushingPhysical=pl;} virtual void SetFacingPushingPhysical(bool ans){fFacingPushingPhysical=ans;} //To be Used during runtime conversions, say to switch a tall controller to a ball for swimming - virtual void SetControllerDimensions(hsScalar radius, hsScalar height)=0; - virtual hsScalar GetControllerWidth(){return fRadius;} - virtual hsScalar GetControllerHeight(){return fHeight;} + virtual void SetControllerDimensions(float radius, float height)=0; + virtual float GetControllerWidth(){return fRadius;} + virtual float GetControllerHeight(){return fHeight;} virtual void ResetAchievedLinearVelocity() { fAchievedLinearVelocity.Set(0.f,0.f,0.f); } virtual int SweepControllerPath(const hsPoint3& startPos,const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)=0; //this should only be used to force a move it could place your head into a wall and that would be good - virtual hsScalar GetHeight() {return fHeight;} - virtual hsScalar GetRadius() {return fRadius;} + virtual float GetHeight() {return fHeight;} + virtual float GetRadius() {return fRadius;} //Wether the avatar thing has mass and forces things down or not, and changes the way things move //This is an attempt fix things like riding on an animated physical virtual void BehaveLikeAnimatedPhysical(hsBool actLikeAnAnimatedPhys)=0; @@ -199,8 +199,8 @@ public: protected: plKey fOwner; - hsScalar fHeight; - hsScalar fRadius; + float fHeight; + float fRadius; plKey fWorldKey; plSimDefs::plLOSDB fLOSDB; bool fSeeking; @@ -215,11 +215,11 @@ protected: hsQuat fLocalRotation; hsMatrix44 fPrevSubworldW2L; hsVector3 fDisplacementThisStep; - hsScalar fSimLength; + float fSimLength; //physical properties hsVector3 fLinearVelocity; - hsScalar fAngularVelocity; + float fAngularVelocity; hsVector3 fAchievedLinearVelocity; plPhysical* fPushingPhysical; bool fFacingPushingPhysical; @@ -251,7 +251,7 @@ public: if(fCore)fCore->OverrideAchievedVelocity(AchievedLinearVelocity); } //proxy functions for Controller Core - virtual hsScalar GetAirTime() const { return fTimeInAir; } + virtual float GetAirTime() const { return fTimeInAir; } virtual void ResetAirTime() { fTimeInAir = 0.f; } protected: @@ -259,12 +259,12 @@ protected: virtual void IApplyKinematic(); plPhysicalControllerCore* fCore; hsVector3 fLinearAcceleration; - hsScalar fAngularAcceleration; + float fAngularAcceleration; plKey fOwner; - static const hsScalar kAirTimeThreshold; - hsScalar fTimeInAir; - hsScalar fPreferedControllerWidth; - hsScalar fPreferedControllerHeight; + static const float kAirTimeThreshold; + float fTimeInAir; + float fPreferedControllerWidth; + float fPreferedControllerHeight; }; @@ -283,8 +283,8 @@ public: fOnTopOfAnimatedPhysLastFrame=false; } virtual ~plWalkingStrategy(){}; - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; } bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; } @@ -309,10 +309,10 @@ class plSwimStrategy: public plMovementStrategy public: plSwimStrategy(plPhysicalControllerCore *core); virtual ~plSwimStrategy(){}; - void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight); - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - hsScalar GetBuoyancy() { return fBuoyancy; } + void SetSurface(plSwimRegionInterface *region, float surfaceHeight); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + float GetBuoyancy() { return fBuoyancy; } hsBool IsOnGround() { return fOnGround; } hsBool HadContacts() { return fHadContacts; } virtual void IAddContactNormals(hsVector3& vec); @@ -320,10 +320,10 @@ protected: virtual hsBool IRequireBehaviourLikeAnAnimatedPhysical(){return true;} private: void IAdjustBuoyancy(); - hsScalar fBuoyancy; + float fBuoyancy; hsBool fOnGround; hsBool fHadContacts; - hsScalar fSurfaceHeight; + float fSurfaceHeight; plSwimRegionInterface *fCurrentRegion; }; class plRidingAnimatedPhysicalStrategy : public plWalkingStrategy @@ -332,9 +332,9 @@ public: plRidingAnimatedPhysicalStrategy(plPhysicalControllerCore *core ) : fNeedVelocityOverride(false),fStartJump(false),plWalkingStrategy(core){}; virtual ~plRidingAnimatedPhysicalStrategy(){}; - virtual void Apply(hsScalar delSecs); - virtual void Update(hsScalar delSecs); - virtual void PostStep(hsScalar delSecs); + virtual void Apply(float delSecs); + virtual void Update(float delSecs); + virtual void PostStep(float delSecs); bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; } bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; } void GroundHit() { fGroundHit = true; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp index 0d6ec732..3832b197 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPointChannel.cpp @@ -242,7 +242,7 @@ plPointBlend::~plPointBlend() // ------------ hsBool plPointBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fPointA->IsStoppedAt(time); if (blend == 1) @@ -257,7 +257,7 @@ const hsPoint3 &plPointBlend::Value(double time) { if (fPointA && fPointB) { - hsScalar curBlend = fChannelBias->Value(time); + float curBlend = fChannelBias->Value(time); if(curBlend == 0) { fPointA->Value(fResult, time); } else { @@ -360,7 +360,7 @@ const hsPoint3 & plPointControllerChannel::Value(double time) // VALUE(time) const hsPoint3 & plPointControllerChannel::Value(double time, plControllerCacheInfo *cache) { - fController->Interp((hsScalar)time, &fResult, cache); + fController->Interp((float)time, &fResult, cache); return fResult; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp index f346c793..41848534 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plQuatChannel.cpp @@ -246,7 +246,7 @@ plQuatBlend::~plQuatBlend() hsBool plQuatBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fQuatA->IsStoppedAt(time); if (blend == 1) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp index 9b43428e..6afa799f 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.cpp @@ -80,14 +80,14 @@ plScalarChannel::~plScalarChannel() // value -------------------------------------------------------- // ------ -const hsScalar & plScalarChannel::Value(double time, hsBool peek) +const float & plScalarChannel::Value(double time, hsBool peek) { return fResult; } // value -------------------------------------------------------------- // ------ -void plScalarChannel::Value(hsScalar &scalar, double time, hsBool peek) +void plScalarChannel::Value(float &scalar, double time, hsBool peek) { scalar = Value(time, peek); } @@ -146,7 +146,7 @@ plScalarConstant::plScalarConstant() // ctor ------------------------------------------ // ----- -plScalarConstant::plScalarConstant(hsScalar value) +plScalarConstant::plScalarConstant(float value) { fResult = value; } @@ -202,7 +202,7 @@ hsBool plScalarTimeScale::IsStoppedAt(double time) } // VALUE -const hsScalar & plScalarTimeScale::Value(double time, hsBool peek) +const float & plScalarTimeScale::Value(double time, hsBool peek) { fResult = fChannelIn->Value(fTimeSource->Value(time, peek)); @@ -265,7 +265,7 @@ plScalarBlend::~plScalarBlend() // ------------ hsBool plScalarBlend::IsStoppedAt(double time) { - hsScalar blend = fChannelBias->Value(time); + float blend = fChannelBias->Value(time); if (blend == 0) return fChannelA->IsStoppedAt(time); if (blend == 1) @@ -276,17 +276,17 @@ hsBool plScalarBlend::IsStoppedAt(double time) // Value ------------------------------------------------------ // ------ -const hsScalar & plScalarBlend::Value(double time, hsBool peek) +const float & plScalarBlend::Value(double time, hsBool peek) { - hsScalar curBlend = fChannelBias->Value(time, peek); + float curBlend = fChannelBias->Value(time, peek); if(curBlend == 0) { fChannelA->Value(fResult, time, peek); } else { if(curBlend == 1) { fChannelB->Value(fResult, time, peek); } else { - const hsScalar &scalarA = fChannelA->Value(time, peek); - const hsScalar &scalarB = fChannelB->Value(time, peek); + const float &scalarA = fChannelA->Value(time, peek); + const float &scalarB = fChannelB->Value(time, peek); fResult = scalarA + curBlend * (scalarB - scalarA); } } @@ -353,17 +353,17 @@ plScalarControllerChannel::~plScalarControllerChannel() // Value ------------------------------------------------------------------ // ------ -const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek) +const float & plScalarControllerChannel::Value(double time, hsBool peek) { return Value(time, peek, nil); } // Value ------------------------------------------------------------------ // ------ -const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek, +const float & plScalarControllerChannel::Value(double time, hsBool peek, plControllerCacheInfo *cache) { - fController->Interp((hsScalar)time, &fResult, cache); + fController->Interp((float)time, &fResult, cache); return fResult; } @@ -428,7 +428,7 @@ plScalarControllerCacheChannel::~plScalarControllerCacheChannel() // Value --------------------------------------------------------------------- // ------ -const hsScalar & plScalarControllerCacheChannel::Value(double time, bool peek) +const float & plScalarControllerCacheChannel::Value(double time, bool peek) { return fControllerChannel->Value(time, peek, fCache); } @@ -486,7 +486,7 @@ hsBool plATCChannel::IsStoppedAt(double time) // Value ----------------------------------------------------- // ------ -const hsScalar & plATCChannel::Value(double time, hsBool peek) +const float & plATCChannel::Value(double time, hsBool peek) { fResult = (peek ? fConvert->WorldToAnimTimeNoUpdate(time) : fConvert->WorldToAnimTime(time)); return fResult; @@ -506,7 +506,7 @@ plScalarSDLChannel::plScalarSDLChannel() fResult = 0; } -plScalarSDLChannel::plScalarSDLChannel(hsScalar length) +plScalarSDLChannel::plScalarSDLChannel(float length) : fLength(length), fVar(nil) { fResult = 0; @@ -526,7 +526,7 @@ hsBool plScalarSDLChannel::IsStoppedAt(double time) // Value ----------------------------------------------------------- // ------ -const hsScalar & plScalarSDLChannel::Value(double time, hsBool peek) +const float & plScalarSDLChannel::Value(double time, hsBool peek) { if (fVar) fVar->Get(&fResult); @@ -557,8 +557,8 @@ void plSpotInnerApplicator::IApply(const plAGModifier *mod, double time) plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index())); - const hsScalar &scalar = scalarChan->Value(time); - sli->SetSpotInner(hsScalarDegToRad(scalar)*0.5f); + const float &scalar = scalarChan->Value(time); + sli->SetSpotInner(hsDegreesToRadians(scalar)*0.5f); } // IApply -------------------------------------------------------------- @@ -570,8 +570,8 @@ void plSpotOuterApplicator::IApply(const plAGModifier *mod, double time) plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index())); - const hsScalar &scalar = scalarChan->Value(time); - sli->SetSpotOuter(hsScalarDegToRad(scalar)*0.5f); + const float &scalar = scalarChan->Value(time); + sli->SetSpotOuter(hsDegreesToRadians(scalar)*0.5f); } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h index afe86367..6c4508a0 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plScalarChannel.h @@ -74,15 +74,15 @@ class plControllerCacheInfo; class plScalarChannel : public plAGChannel { protected: - hsScalar fResult; + float fResult; public: plScalarChannel(); virtual ~plScalarChannel(); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); - virtual void Value(hsScalar &result, double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); + virtual void Value(float &result, double time, hsBool peek = false); // combine it (allocates combine object) virtual plAGChannel * MakeCombine(plAGChannel * channelB); @@ -109,11 +109,11 @@ class plScalarConstant : public plScalarChannel { public: plScalarConstant(); - plScalarConstant(hsScalar value); + plScalarConstant(float value); virtual ~plScalarConstant(); - void Set(hsScalar value) { fResult = value; } - hsScalar Get() { return fResult; } + void Set(float value) { fResult = value; } + float Get() { return fResult; } // PLASMA PROTOCOL CLASSNAME_REGISTER( plScalarConstant ); @@ -141,7 +141,7 @@ public: virtual ~plScalarTimeScale(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); virtual plAGChannel * Detach(plAGChannel * channel); // PLASMA PROTOCOL @@ -179,7 +179,7 @@ public: virtual hsBool IsStoppedAt(double time); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); // remove the specified channel from our graph virtual plAGChannel * Detach(plAGChannel * channel); @@ -205,8 +205,8 @@ public: virtual ~plScalarControllerChannel(); // AG PROTOCOL - virtual const hsScalar & Value(double time, hsBool peek = false); - virtual const hsScalar & Value(double time, hsBool peek, plControllerCacheInfo *cache); + virtual const float & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek, plControllerCacheInfo *cache); virtual plAGChannel *MakeCacheChannel(plAnimTimeConvert *atc); @@ -235,7 +235,7 @@ public: plScalarControllerCacheChannel(plScalarControllerChannel *channel, plControllerCacheInfo *cache); virtual ~plScalarControllerCacheChannel(); - virtual const hsScalar & Value(double time, bool peek = false); + virtual const float & Value(double time, bool peek = false); virtual plAGChannel * Detach(plAGChannel * channel); @@ -261,7 +261,7 @@ public: virtual ~plATCChannel(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); // PLASMA PROTOCOL CLASSNAME_REGISTER( plATCChannel ); @@ -276,15 +276,15 @@ class plScalarSDLChannel : public plScalarChannel { protected: plSimpleStateVariable *fVar; - hsScalar fLength; + float fLength; public: plScalarSDLChannel(); - plScalarSDLChannel(hsScalar length); + plScalarSDLChannel(float length); virtual ~plScalarSDLChannel(); virtual hsBool IsStoppedAt(double time); - virtual const hsScalar & Value(double time, hsBool peek = false); + virtual const float & Value(double time, hsBool peek = false); void SetVar(plSimpleStateVariable *var) { fVar = var; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h index 54d9c5ab..9ab66861 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSeekPointMod.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSeekPointMod : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} char * fName; // public because you can't change it public: diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp index ff723257..3803be05 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp @@ -264,7 +264,7 @@ void plSittingModifier::Trigger(const plArmatureMod *avMod, plNotifyMsg *enterNo // IIsClosestAnim ------------------------------------------------------------------- // --------------- -bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closestDist, +bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDist, hsPoint3 curPosition, const plArmatureMod *avatar) { plAGAnim *anim = avatar->FindCustomAnim(animName); @@ -283,7 +283,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closest hsMatrix44 candidateGoal = sitGoal * animEndToStart; hsPoint3 distP = candidateGoal.GetTranslate() - curPosition; hsVector3 distV(distP.fX, distP.fY, distP.fZ); - hsScalar dist = distP.Magnitude(); + float dist = distP.Magnitude(); if(closestDist == 0.0 || dist < closestDist) { closestDist = dist; @@ -307,7 +307,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe hsMatrix44 animEndToStart; hsMatrix44 sitGoal = seekObj->GetLocalToWorld(); hsMatrix44 candidateGoal; - hsScalar closestDist = 0.0f; + float closestDist = 0.0f; uint8_t closestApproach = 0; hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate(); char * sitAnimName = nil; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h index d98360d4..ff6c66a5 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.h @@ -113,7 +113,7 @@ protected: plAvBrainGeneric * IBuildSitBrain(plKey avModKey, plKey seekKey,char **pAnimName, plNotifyMsg *enterNotify, plNotifyMsg *exitNotify); /** Unused. */ - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } /** An array of keys to objects that are interested in receiving our sit messages. */ hsTArray fNotifyKeys; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp index 3edfaba8..4ed6ad27 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.cpp @@ -64,7 +64,7 @@ void plSwimRegionInterface::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fMaxUpwardVel); } -void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { linearResult.Set(0.f, 0.f, 0.f); angularResult = 0.f; @@ -126,7 +126,7 @@ hsBool plSwimCircularCurrentRegion::MsgReceive(plMessage* msg) return plSwimRegionInterface::MsgReceive(msg); } -void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { if (elapsed <= 0.f || fCurrentSO == nil || GetProperty(kDisable)) { @@ -151,8 +151,8 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsBool applyPull = true; hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f); - hsScalar pullVel; - hsScalar distSq = pos2Center.MagnitudeSquared(); + float pullVel; + float distSq = pos2Center.MagnitudeSquared(); if (distSq < .5) { // Don't want to pull us too close to the center, or we @@ -176,12 +176,12 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 v1 = linearResult * elapsed - pos2Center; hsVector3 v2 = -pos2Center; - hsScalar invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude(); + float invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude(); if (invCos > 1) invCos = 1; if (invCos < -1) invCos = -1; - angularResult = hsACosine(invCos) / elapsed; + angularResult = acos(invCos) / elapsed; // hsAssert(real_finite(linearResult.fX) && // real_finite(linearResult.fY) && @@ -242,7 +242,7 @@ hsBool plSwimStraightCurrentRegion::MsgReceive(plMessage* msg) return plSwimRegionInterface::MsgReceive(msg); } -void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed) +void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed) { angularResult = 0.f; @@ -267,8 +267,8 @@ void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, } hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f); - hsScalar dist = current.InnerProduct(pos - center); - hsScalar pullVel; + float dist = current.InnerProduct(pos - center); + float pullVel; if (dist <= fNearDist) pullVel = fNearVel; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h index 30542532..5c071bc6 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSwimRegion.h @@ -67,11 +67,11 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); - hsScalar fDownBuoyancy; - hsScalar fUpBuoyancy; - hsScalar fMaxUpwardVel; + float fDownBuoyancy; + float fUpBuoyancy; + float fMaxUpwardVel; }; class plSwimCircularCurrentRegion : public plSwimRegionInterface @@ -86,14 +86,14 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); virtual hsBool MsgReceive(plMessage* msg); - hsScalar fRotation; - hsScalar fPullNearDistSq; - hsScalar fPullNearVel; - hsScalar fPullFarDistSq; - hsScalar fPullFarVel; + float fRotation; + float fPullNearDistSq; + float fPullNearVel; + float fPullFarDistSq; + float fPullFarVel; protected: plSceneObject *fCurrentSO; @@ -111,13 +111,13 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed); + virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed); virtual hsBool MsgReceive(plMessage* msg); - hsScalar fNearDist; - hsScalar fNearVel; - hsScalar fFarDist; - hsScalar fFarVel; + float fNearDist; + float fNearVel; + float fFarDist; + float fFarVel; protected: plSceneObject *fCurrentSO; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp index e9c281ec..51066595 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.cpp @@ -336,22 +336,22 @@ void plAccMeshSmooth::SetDiffuse(plAccessSpan& span, hsTArray& shareVt triSpan.Diffuse32(shareVtx[i]) = diff.ToARGB32(); } -void plAccMeshSmooth::SetAngle(hsScalar degs) +void plAccMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plAccMeshSmooth::GetAngle() const +float plAccMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); + return hsRadiansToDegrees(acos(fMinNormDot)); } -void plAccMeshSmooth::SetDistTol(hsScalar dist) +void plAccMeshSmooth::SetDistTol(float dist) { fDistTolSq = dist * dist; } -hsScalar plAccMeshSmooth::GetDistTol() const +float plAccMeshSmooth::GetDistTol() const { - return hsSquareRoot(fDistTolSq); + return sqrt(fDistTolSq); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h index 30f82dc0..1ee60da0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccMeshSmooth.h @@ -71,8 +71,8 @@ protected: uint32_t fFlags; - hsScalar fMinNormDot; - hsScalar fDistTolSq; + float fMinNormDot; + float fDistTolSq; plAccessGeometry fAccGeom; hsTArray fSpans; @@ -92,11 +92,11 @@ protected: public: plAccMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees - void SetDistTol(hsScalar dist); - hsScalar GetDistTol() const; + void SetDistTol(float dist); + float GetDistTol() const; void Smooth(hsTArray& sets); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp index 8bc79744..806cc516 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp @@ -468,7 +468,7 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp { acc.SetNumWeights(numWgts); acc.WeightStream(ptr, (uint16_t)stride, offset); - ptr += numWgts * sizeof(hsScalar); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { acc.WgtIndexStream(ptr, (uint16_t)stride, offset); @@ -513,7 +513,7 @@ void plAccessGeometry::IAccessSpanFromVertexSpan(plAccessSpan& dst, plDrawableSp { acc.SetNumWeights(numWgts); acc.WeightStream(ptr, (uint16_t)stride, posOffset); - ptr += numWgts * sizeof(hsScalar); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { acc.WgtIndexStream(ptr, (uint16_t)stride, posOffset); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp index aeb6e84a..efd455e3 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSnapShot.cpp @@ -185,7 +185,7 @@ uint32_t plAccessSnapShot::CopyFrom(const plAccessVtxSpan& src, uint32_t chanMas // mask that we already have. chanMask = ICheckAlloc(src, chanMask, kPosition, sizeof(hsPoint3)); - chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(hsScalar) * src.fNumWeights); + chanMask = ICheckAlloc(src, chanMask, kWeight, sizeof(float) * src.fNumWeights); if( fChanSize[kWeight] ) fNumWeights = src.fNumWeights; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h index 7244d635..1265b10a 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessSpan.h @@ -80,7 +80,7 @@ private: hsBounds3Ext* fLocalBounds; hsBounds3Ext* fWorldBounds; - hsScalar* fWaterHeight; + float* fWaterHeight; hsGMaterial* fMaterial; @@ -119,7 +119,7 @@ public: void SetWorldBounds(const hsBounds3Ext& wBnd) { *fWorldBounds = wBnd; } hsBool HasWaterHeight() const { return nil != fWaterHeight; } - hsScalar GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; } + float GetWaterHeight() const { hsAssert(HasWaterHeight(), "Check before asking"); return *fWaterHeight; } }; inline plAccessVtxSpan& plAccessSpan::AccessVtx() diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h index 6fc76d38..ce7fd7b0 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessVtxSpan.h @@ -131,8 +131,8 @@ public: hsPoint3& Position(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition]); } hsVector3& Normal(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal]); } - hsScalar& Weight(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(hsScalar)); } - hsScalar* Weights(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight]); } + float& Weight(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + iWgt*sizeof(float)); } + float* Weights(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight]); } uint32_t& WgtIndices(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex]); } uint8_t& WgtIndex(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + iWgt); } @@ -153,10 +153,10 @@ public: hsPoint3& PositionOff(int i) const { return *(hsPoint3*)(fChannels[kPosition] + i*fStrides[kPosition] + fOffsets[kPosition]); } hsVector3& NormalOff(int i) const { return *(hsVector3*)(fChannels[kNormal] + i*fStrides[kNormal] + fOffsets[kNormal]); } - hsScalar& WeightOff(int iVtx, int iWgt) const { return *(hsScalar*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(hsScalar)); } - hsScalar* WeightsOff(int i) const { return (hsScalar*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); } - uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); } - uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); } + float& WeightOff(int iVtx, int iWgt) const { return *(float*)(fChannels[kWeight] + iVtx*fStrides[kWeight] + fOffsets[kWeight] + iWgt*sizeof(float)); } + float* WeightsOff(int i) const { return (float*)(fChannels[kWeight] + i*fStrides[kWeight] + fOffsets[kWeight]); } + uint32_t& WgtIndicesOff(int i) const { return *(uint32_t*)(fChannels[kWgtIndex] + i * fStrides[kWgtIndex] + fOffsets[kWgtIndex]); } + uint8_t& WgtIndexOff(int iVtx, int iWgt) const { return *(fChannels[kWgtIndex] + iVtx*fStrides[kWgtIndex] + fOffsets[kWgtIndex] + iWgt); } uint32_t& Diffuse32Off(int i) const { return *(uint32_t*)(fChannels[kDiffuse] + i*fStrides[kDiffuse] + fOffsets[kDiffuse]); } uint32_t& Specular32Off(int i) const { return *(uint32_t*)(fChannels[kSpecular] + i*fStrides[kSpecular] + fOffsets[kSpecular]); } @@ -410,7 +410,7 @@ class plAccVertexIterator { protected: plAccIterator fPosition; - plAccIterator fWeight; + plAccIterator fWeight; plAccIterator fWgtIndex; plAccIterator fNormal; plAccIterator fDiffuse; @@ -440,8 +440,8 @@ public: } hsPoint3* Position() const { return fPosition.Value(); } - hsScalar* Weights() const { return fWeight.Value(); } - hsScalar* Weight(int i) const { return fWeight.Value() + i; } + float* Weights() const { return fWeight.Value(); } + float* Weight(int i) const { return fWeight.Value() + i; } uint32_t* WgtIndices() const { return (uint32_t*)(fWgtIndex.Value()); } uint8_t* WgtIndex(int i) const { return fWgtIndex.Value() + i; } hsVector3* Normal() const { return fNormal.Value(); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp index 272f85ba..72bb134c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.cpp @@ -194,7 +194,7 @@ void plAvMeshSmooth::Smooth(hsTArray& srcSpans, hsTArray& dstS else dstDiff.Set(1.f, 1.f, 1.f, 1.f); - hsScalar maxDot = fMinNormDot; + float maxDot = fMinNormDot; hsPoint3 smoothPos = dstPos; hsVector3 smoothNorm = dstNorm; @@ -209,12 +209,12 @@ void plAvMeshSmooth::Smooth(hsTArray& srcSpans, hsTArray& dstS hsPoint3 srcPos = IPositionToNeutral(srcSpans[k], srcEdgeVerts[k][m]); hsVector3 srcNorm = INormalToNeutral(srcSpans[k], srcEdgeVerts[k][m]); - hsScalar dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared(); + float dist = hsVector3(&dstPos, &srcPos).MagnitudeSquared(); if( dist <= fDistTolSq ) { smoothPos = srcPos; - hsScalar currDot = srcNorm.InnerProduct(dstNorm); + float currDot = srcNorm.InnerProduct(dstNorm); if( currDot > maxDot ) { maxDot = currDot; @@ -265,22 +265,22 @@ hsVector3 plAvMeshSmooth::INormalToSpan(XfmSpan& span, const hsVector3& wNorm) c return ret; } -void plAvMeshSmooth::SetAngle(hsScalar degs) +void plAvMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plAvMeshSmooth::GetAngle() const +float plAvMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); + return hsRadiansToDegrees(acos(fMinNormDot)); } -void plAvMeshSmooth::SetDistTol(hsScalar dist) +void plAvMeshSmooth::SetDistTol(float dist) { fDistTolSq = dist * dist; } -hsScalar plAvMeshSmooth::GetDistTol() const +float plAvMeshSmooth::GetDistTol() const { - return hsSquareRoot(fDistTolSq); + return sqrt(fDistTolSq); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h index ecad254a..48f653d3 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAvMeshSmooth.h @@ -77,8 +77,8 @@ public: protected: uint32_t fFlags; - hsScalar fMinNormDot; - hsScalar fDistTolSq; + float fMinNormDot; + float fDistTolSq; plAccessGeometry fAccGeom; @@ -93,11 +93,11 @@ protected: public: plAvMeshSmooth() : fFlags(kSmoothNorm), fMinNormDot(0.25f), fDistTolSq(1.e-4f), fAccGeom() {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees - void SetDistTol(hsScalar dist); - hsScalar GetDistTol() const; + void SetDistTol(float dist); + float GetDistTol() const; void Smooth(hsTArray& srcSpans, hsTArray& dstSpans); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp index 2560e19d..8526d507 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.cpp @@ -94,8 +94,8 @@ void plCluster::Write(hsStream* s) const } inline void inlTESTPOINT(const hsPoint3& destP, - hsScalar& minX, hsScalar& minY, hsScalar& minZ, - hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ) + float& minX, float& minY, float& minZ, + float& maxX, float& maxY, float& maxZ) { if( destP.fX < minX ) minX = destP.fX; @@ -115,13 +115,13 @@ inline void inlTESTPOINT(const hsPoint3& destP, void plCluster::UnPack(uint8_t* vDst, uint16_t* iDst, int idxOffset, hsBounds3Ext& wBnd) const { - hsScalar minX = 1.e33f; - hsScalar minY = 1.e33f; - hsScalar minZ = 1.e33f; + float minX = 1.e33f; + float minY = 1.e33f; + float minZ = 1.e33f; - hsScalar maxX = -1.e33f; - hsScalar maxY = -1.e33f; - hsScalar maxZ = -1.e33f; + float maxX = -1.e33f; + float maxY = -1.e33f; + float maxZ = -1.e33f; hsAssert(fGroup->GetTemplate(), "Can't unpack without a template"); const plSpanTemplate& templ = *fGroup->GetTemplate(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h index 3adc8a7f..7bd2546d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plClusterGroup.h @@ -62,15 +62,15 @@ class plDrawableSpans; class plLODDist { public: - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - plLODDist(hsScalar minDist, hsScalar maxDist) : fMinDist(minDist), fMaxDist(maxDist) {} + plLODDist(float minDist, float maxDist) : fMinDist(minDist), fMaxDist(maxDist) {} plLODDist() : fMinDist(0), fMaxDist(0) {} plLODDist& Set(float minDist, float maxDist) { fMinDist = minDist; fMaxDist = maxDist; return *this; } - plLODDist& operator=(int d) { fMinDist = hsScalar(d); fMaxDist = hsScalar(d); return *this; } + plLODDist& operator=(int d) { fMinDist = float(d); fMaxDist = float(d); return *this; } int operator==(const plLODDist& d) const { return (fMinDist == d.fMinDist)&&(fMaxDist == d.fMaxDist); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp index 2f4ae678..9aecfd5f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.cpp @@ -134,7 +134,7 @@ void plCutter::Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& o } -inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const +inline void plCutter::ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { dst.fPos = outVtx.fPos; dst.fPos += parm * (inVtx.fPos - outVtx.fPos); @@ -161,7 +161,7 @@ inline void plCutter::ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = outVtx.fUVW.fX / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -172,7 +172,7 @@ inline void plCutter::ICutoutVtxLoU(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = outVtx.fUVW.fY / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -183,7 +183,7 @@ inline void plCutter::ICutoutVtxLoV(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = outVtx.fUVW.fZ / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -198,7 +198,7 @@ inline void plCutter::ICutoutVtxLoW(const plCutoutVtx& inVtx, const plCutoutVtx& // parm = (outVtx.fUVW - 1.f) / (outVtx.fUVW - inVtx.fUVW) inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = (outVtx.fUVW.fX - 1.f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -209,7 +209,7 @@ inline void plCutter::ICutoutVtxHiU(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = (outVtx.fUVW.fY - 1.f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -220,7 +220,7 @@ inline void plCutter::ICutoutVtxHiV(const plCutoutVtx& inVtx, const plCutoutVtx& inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = (outVtx.fUVW.fZ - 1.f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -236,7 +236,7 @@ inline void plCutter::ICutoutVtxHiW(const plCutoutVtx& inVtx, const plCutoutVtx& // parm = (outVtx.fUVW - 0.5f) / (outVtx.fUVW - inVtx.fUVW) inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); + float parm = (outVtx.fUVW.fX - 0.5f) / (outVtx.fUVW.fX - inVtx.fUVW.fX); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -249,7 +249,7 @@ inline void plCutter::ICutoutVtxMidU(const plCutoutVtx& inVtx, const plCutoutVtx inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); + float parm = (outVtx.fUVW.fY - 0.5f) / (outVtx.fUVW.fY - inVtx.fUVW.fY); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -262,7 +262,7 @@ inline void plCutter::ICutoutVtxMidV(const plCutoutVtx& inVtx, const plCutoutVtx inline void plCutter::ICutoutVtxMidW(const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const { - hsScalar parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); + float parm = (outVtx.fUVW.fZ - 0.5f) / (outVtx.fUVW.fZ - inVtx.fUVW.fZ); ISetPosNorm(parm, inVtx, outVtx, dst); @@ -721,7 +721,7 @@ hsBool plCutter::FindHitPoints(const hsTArray& src, hsTArray 0; } -hsBool plCutter::FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, hsScalar height) const +hsBool plCutter::FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, float height) const { if( FindHitPoints(src, hits) ) { @@ -933,14 +933,14 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe corner += -dux; corner += -dvx; - hsScalar sWid = 1.f / hsScalar(nWid-1); - hsScalar sLen = 1.f / hsScalar(nLen-1); + float sWid = 1.f / float(nWid-1); + float sLen = 1.f / float(nLen-1); dux *= 2.f * sWid; dvx *= 2.f * sLen; - hsScalar du = sWid; - hsScalar dv = sLen; + float du = sWid; + float dv = sLen; int j; for( j = 0; j < nLen; j++ ) { @@ -950,8 +950,8 @@ hsBool plCutter::MakeGrid(int nWid, int nLen, const hsPoint3& center, const hsVe plCutoutMiniVtx& vtx = grid.fVerts[j * nWid + i]; vtx.fPos = corner; - vtx.fPos += dux * (hsScalar)i; - vtx.fPos += dvx * (hsScalar)j; + vtx.fPos += dux * (float)i; + vtx.fPos += dvx * (float)j; vtx.fUVW.fX = du * i; vtx.fUVW.fY = dv * j; @@ -1168,7 +1168,7 @@ void TestCutter(const plKey& key, const hsVector3& size, const hsPoint3& pos) uvw[iv] = dst[iPoly].fVerts[iVert].fUVW; col[iv] = dst[iPoly].fVerts[iVert].fColor; - hsScalar opac = uvw[iv].fZ < 0.25f + float opac = uvw[iv].fZ < 0.25f ? uvw[iv].fZ * 4.f : uvw[iv].fZ > 0.75f ? (1.f - uvw[iv].fZ) * 4.f @@ -1322,7 +1322,7 @@ void TestCutter2(const plKey& key, const hsVector3& size, const hsPoint3& pos, h uvw[iv] = dst[iPoly].fVerts[iVert].fUVW; col[iv] = dst[iPoly].fVerts[iVert].fColor; - hsScalar opac = uvw[iv].fZ < 0.25f + float opac = uvw[iv].fZ < 0.25f ? uvw[iv].fZ * 4.f : uvw[iv].fZ > 0.75f ? (1.f - uvw[iv].fZ) * 4.f diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h index cf9a9f03..3c5d326d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCutter.h @@ -105,14 +105,14 @@ class plCutter : public plCreatable protected: // Permanent attributes - hsScalar fLengthU; - hsScalar fLengthV; - hsScalar fLengthW; + float fLengthU; + float fLengthV; + float fLengthW; // Internal cached stuff - hsScalar fDistU; - hsScalar fDistV; - hsScalar fDistW; + float fDistU; + float fDistV; + float fDistW; hsVector3 fDirU; hsVector3 fDirV; hsVector3 fDirW; @@ -136,7 +136,7 @@ protected: hsBool IFindHitPoint(const hsTArray& inPoly, plCutoutHit& hit) const; - inline void ISetPosNorm(hsScalar parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const; + inline void ISetPosNorm(float parm, const plCutoutVtx& inVtx, const plCutoutVtx& outVtx, plCutoutVtx& dst) const; void ICutoutTransformed(plAccessSpan& src, hsTArray& dst) const; void ICutoutConstHeight(plAccessSpan& src, hsTArray& dst) const; @@ -155,7 +155,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); hsBool FindHitPoints(const hsTArray& src, hsTArray& hits) const; - hsBool FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, hsScalar height) const; + hsBool FindHitPointsConstHeight(const hsTArray& src, hsTArray& hits, float height) const; void Set(const hsPoint3& pos, const hsVector3& dir, const hsVector3& out, hsBool flip=false); @@ -163,9 +163,9 @@ public: hsBool CutoutGrid(int nWid, int nLen, plFlatGridMesh& dst) const; void SetLength(const hsVector3& s) { fLengthU = s.fX; fLengthV = s.fY; fLengthW = s.fZ; } - hsScalar GetLengthU() const { return fLengthU; } - hsScalar GetLengthV() const { return fLengthV; } - hsScalar GetLengthW() const { return fLengthW; } + float GetLengthU() const { return fLengthU; } + float GetLengthV() const { return fLengthV; } + float GetLengthW() const { return fLengthW; } const hsBounds3Ext& GetWorldBounds() const { return fWorldBounds; } plBoundsIsect& GetIsect() { return fIsect; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp index 4ce23ac0..18fce516 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp @@ -94,7 +94,7 @@ void plDrawableGenerator::IQuickShadeVerts( uint32_t count, hsVector3 *normal scale = ( normals[ count ] * lightDir ); // pretend there are two opposing directional lights, but the // one pointing downish is a little stronger. - const hsScalar kReverseLight = -0.8f; + const float kReverseLight = -0.8f; if( scale < 0 ) scale = kReverseLight * scale; colors[ count ] = fLiteColor * scale + fDarkColor * ( 1.f - scale ); @@ -286,11 +286,11 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( uint32_t vertCount, hsPo //// GenerateSphericalDrawable /////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, hsScalar radius, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoint3& pos, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, hsTArray *retIndex, plDrawableSpans *toAddTo, - hsScalar qualityScalar ) + float qualityScalar ) { hsTArray points; hsTArray normals; @@ -314,13 +314,13 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi /// Generate points for( i = 0; i <= numDivisions; i++ ) { - angle = (float)i * ( hsScalarPI ) / (float)numDivisions; + angle = (float)i * ( M_PI ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, internRad, z ); internRad *= radius; for( j = 0; j < numDivisions; j++ ) { - angle = (float)j * ( 2 * hsScalarPI ) / (float)numDivisions; + angle = (float)j * ( 2 * M_PI ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, x, y ); point.Set( pos.fX + x * internRad, pos.fY + y * internRad, pos.fZ + z * radius ); @@ -367,7 +367,7 @@ plDrawableSpans *plDrawableGenerator::GenerateSphericalDrawable( const hsPoi //// GenerateBoxDrawable ///////////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth, +plDrawableSpans *plDrawableGenerator::GenerateBoxDrawable( float width, float height, float depth, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, hsTArray *retIndex, plDrawableSpans *toAddTo ) @@ -537,7 +537,7 @@ plDrawableSpans *plDrawableGenerator::GenerateBoundsDrawable( hsBounds3Ext * //// GenerateConicalDrawable ///////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( float radius, float height, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, hsTArray *retIndex, plDrawableSpans *toAddTo ) @@ -555,7 +555,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsScalar radi //// GenerateConicalDrawable ///////////////////////////////////////////////// -plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material, +plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended, const hsColorRGBA* multColor, hsTArray *retIndex, plDrawableSpans *toAddTo ) @@ -604,7 +604,7 @@ plDrawableSpans *plDrawableGenerator::GenerateConicalDrawable( hsPoint3 &ape normals.Append( -direction ); for( i = 0; i < numDivisions; i++ ) { - angle = (float)i * ( hsScalarPI * 2.f ) / (float)numDivisions; + angle = (float)i * ( M_PI * 2.f ) / (float)numDivisions; hsFastMath::SinCosInRange( angle, x, y ); points.Append( baseCenter + ( xVec * x * radius ) + ( yVec * y * radius ) ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h index 1ac0d247..f46d6a4e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.h @@ -93,14 +93,14 @@ class plDrawableGenerator hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a spherical drawable - static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, hsScalar radius, hsGMaterial *material, + static plDrawableSpans *GenerateSphericalDrawable( const hsPoint3& localPos, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil, - hsScalar qualityScalar = 1.f ); + float qualityScalar = 1.f ); // Generates a rectangular drawable - static plDrawableSpans *GenerateBoxDrawable( hsScalar width, hsScalar height, hsScalar depth, + static plDrawableSpans *GenerateBoxDrawable( float width, float height, float depth, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); @@ -117,13 +117,13 @@ class plDrawableGenerator hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a conical drawable - static plDrawableSpans *GenerateConicalDrawable( hsScalar radius, hsScalar height, hsGMaterial *material, + static plDrawableSpans *GenerateConicalDrawable( float radius, float height, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); // Generates a general conical drawable based on a center and direction - static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, hsScalar radius, hsGMaterial *material, + static plDrawableSpans *GenerateConicalDrawable( hsPoint3 &apex, hsVector3 &direction, float radius, hsGMaterial *material, const hsMatrix44 &localToWorld, hsBool blended = false, const hsColorRGBA* multColor = nil, hsTArray *retIndex = nil, plDrawableSpans *toAddTo = nil ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp index a1e1a2c2..6e58a861 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp @@ -405,7 +405,7 @@ hsBool plDrawableSpans::IBoundsInvalid(const hsBounds3Ext& bnd) const int i; for( i = 0; i < 3; i++ ) { - const hsScalar kLimit(1.e5f); + const float kLimit(1.e5f); if( bnd.GetMaxs()[i] > kLimit ) return true; @@ -1512,7 +1512,7 @@ hsGMaterial* plDrawableSpans::GetSubMaterial(int index) const } // return true if span invisible before minDist and/or after maxDist -hsBool plDrawableSpans::GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const +hsBool plDrawableSpans::GetSubVisDists(int index, float& minDist, float& maxDist) const { return (minDist = fSpans[index]->GetMinDist()) < (maxDist = fSpans[index]->GetMaxDist()); } @@ -1540,7 +1540,7 @@ void plDrawableSpans::SortSpan( uint32_t index, plPipeline *pipe ) uint32_t numTris; int i; hsMatrix44 w2cMatrix = pipe->GetWorldToCamera() * pipe->GetLocalToWorld(); - hsScalar dist; + float dist; ICheckSpanForSortable(index); @@ -1566,7 +1566,7 @@ void plDrawableSpans::SortSpan( uint32_t index, plPipeline *pipe ) plProfile_BeginLap(FaceSort, "1"); hsVector3 vec(w2cMatrix.fMap[2][0], w2cMatrix.fMap[2][1], w2cMatrix.fMap[2][2]); - hsScalar trans = w2cMatrix.fMap[2][3]; + float trans = w2cMatrix.fMap[2][3]; // Fill out the radix sort elements with our data for( i = 0; i < numTris; i++ ) @@ -1720,7 +1720,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipel int j; for( j = 0; j < nTris; j++ ) { - hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); + float dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); elem[cnt].fKey.fFloat = dist; elem[cnt].fBody = &list[j]; elem[cnt].fNext = elem + cnt + 1; @@ -1919,7 +1919,7 @@ void plDrawableSpans::SortVisibleSpans(const hsTArray& visList, plPipel int j; for( j = 0; j < nTris; j++ ) { - hsScalar dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); + float dist = -(viewPos - list[j].fCenter).MagnitudeSquared(); elem[cnt].fKey.fFloat = dist; elem[cnt].fBody = &list[j]; elem[cnt].fNext = elem + cnt + 1; @@ -2113,7 +2113,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plP uint16_t fIndex0; uint16_t fIndex1; uint16_t fIndex2; - hsScalar fDist; + float fDist; }; static hsLargeArray sortList; @@ -2126,7 +2126,7 @@ void plDrawableSpans::SortVisibleSpansUnit(const hsTArray& visList, plP }; hsPoint3 viewPos = fSpans[visList[0]]->fWorldToLocal * pipe->GetViewPositionWorld(); - hsScalar dist1 = (fViewPos - face1->fCenter).MagnitudeSquared(); + float dist1 = (fViewPos - face1->fCenter).MagnitudeSquared(); // First figure out the total number of tris to deal with. sortList.SetCount(0); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h index ec8dc305..7ebde71c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h @@ -332,7 +332,7 @@ class plDrawableSpans : public plDrawable // Taking span index. DI Index doesn't make sense here, because one object's DI can dereference into many materials etc. virtual hsGMaterial* GetSubMaterial(int index) const; - virtual hsBool GetSubVisDists(int index, hsScalar& minDist, hsScalar& maxDist) const; // return true if span invisible before minDist and/or after maxDist + virtual hsBool GetSubVisDists(int index, float& minDist, float& maxDist) const; // return true if span invisible before minDist and/or after maxDist // Used by the pipeline to keep from reskinning on multiple renders per frame. uint32_t GetSkinTime() const { return fSkinTime; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp index 3c27a826..ba8719c1 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.cpp @@ -45,9 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plDynaDecal.h" #include "plAuxSpan.h" -hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaSplot::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -55,7 +55,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -98,13 +98,13 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) { const int stride = sizeof(plDecalVtxFormat); - hsScalar* sPtr = &origUVW->fZ; + float* sPtr = &origUVW->fZ; unsigned char* alpha = (unsigned char*)&fVtxBase->fDiffuse; alpha += 3; while( n-- ) { - hsScalar initOpac = *sPtr; + float initOpac = *sPtr; *alpha = (unsigned char)(initOpac * atten * 255.99f); alpha += stride; @@ -113,7 +113,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) } else { - hsScalar* sPtr = &origUVW->fZ; + float* sPtr = &origUVW->fZ; char* oPtr = (char*)&fVtxBase->fUVW[1].fX; @@ -121,7 +121,7 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) while( n-- ) { - (*(hsScalar*)oPtr) = *sPtr * atten; + (*(float*)oPtr) = *sPtr * atten; oPtr += stride; sPtr += 3; @@ -130,9 +130,9 @@ hsBool plDynaSplot::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaRipple::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -140,7 +140,7 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -150,8 +150,8 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scaleU = fC1U / (age*fC2U + 1.f); - hsScalar scaleV = fC1V / (age*fC2V + 1.f); + float scaleU = fC1U / (age*fC2U + 1.f); + float scaleV = fC1V / (age*fC2V + 1.f); hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -210,9 +210,9 @@ hsBool plDynaRipple::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaWake::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -220,7 +220,7 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -230,8 +230,8 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scaleU = fC1U / (age*fC2U + 1.f); - hsScalar scaleV = fC1V / (age*fC2V + 1.f); + float scaleU = fC1U / (age*fC2U + 1.f); + float scaleV = fC1V / (age*fC2V + 1.f); hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -290,9 +290,9 @@ hsBool plDynaWake::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaWave::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; @@ -300,7 +300,7 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) if( !n ) return true; - hsScalar atten = fInitAtten; + float atten = fInitAtten; if( age < ramp ) { atten *= age / ramp; @@ -310,8 +310,8 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) atten *= (life - age) / (life - decay); } - hsScalar scale = 1.f + life * fScrollRate; - hsScalar scroll = -fScrollRate * age; + float scale = 1.f + life * fScrollRate; + float scroll = -fScrollRate * age; hsPoint3* origUVW = &fAuxSpan->fOrigUVW[fStartVtx]; @@ -370,9 +370,9 @@ hsBool plDynaWave::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) return false; } -hsBool plDynaRippleVS::Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) +hsBool plDynaRippleVS::Age(double t, float ramp, float decay, float life) { - hsScalar age = hsScalar(t - fBirth); + float age = float(t - fBirth); if( age >= life ) return true; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h index 72555df3..81276b58 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecal.h @@ -85,7 +85,7 @@ protected: uint16_t fNumIdx; double fBirth; - hsScalar fInitAtten; + float fInitAtten; hsBool fFlags; plDecalVtxFormat* fVtxBase; // Safe pointer, the buffer data will outlive this decal @@ -95,7 +95,7 @@ protected: friend class plDynaDecalMgr; public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life) = 0; + virtual hsBool Age(double t, float ramp, float decay, float life) = 0; }; // No expansion @@ -105,7 +105,7 @@ protected: public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); }; // Expands radially from center @@ -113,13 +113,13 @@ class plDynaRipple : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fC1U; - hsScalar fC2U; + float fC1U; + float fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1V; + float fC2V; }; @@ -128,13 +128,13 @@ class plDynaWake : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fC1U; - hsScalar fC2U; + float fC1U; + float fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1V; + float fC2V; }; @@ -143,9 +143,9 @@ class plDynaWave : public plDynaDecal { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); - hsScalar fScrollRate; + float fScrollRate; }; // About the same as a DynaRipple, but implemented with vertex/pixel shaders. @@ -154,7 +154,7 @@ class plDynaRippleVS : public plDynaRipple { public: - virtual hsBool Age(double t, hsScalar ramp, hsScalar decay, hsScalar life); + virtual hsBool Age(double t, float ramp, float decay, float life); }; #endif // plDynaDecal_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp index f6fc4727..5955be06 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp @@ -110,11 +110,11 @@ static const int kBinBlockSize = 20; static const uint16_t kDefMaxNumVerts = 1000; static const uint16_t kDefMaxNumIdx = kDefMaxNumVerts; -static const hsScalar kDefLifeSpan = 30.f; -static const hsScalar kDefDecayStart = kDefLifeSpan * 0.5f; -static const hsScalar kDefRampEnd = kDefLifeSpan * 0.1f; +static const float kDefLifeSpan = 30.f; +static const float kDefDecayStart = kDefLifeSpan * 0.5f; +static const float kDefRampEnd = kDefLifeSpan * 0.1f; -static const hsScalar kInitAuxSpans = 5; +static const float kInitAuxSpans = 5; #define MF_NO_INIT_ALLOC #define MF_NEVER_RUN_OUT @@ -582,7 +582,7 @@ void plDynaDecalMgr::IRemoveDecalInfos(const plKey& key) } } -hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const +float plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const { // We aren't playing this wet/dry/enable/disable thing. if( !fWaitOnEnable ) @@ -601,7 +601,7 @@ hsScalar plDynaDecalMgr::IHowWet(plDynaDecalInfo& info, double t) const return 0; // We're wet, let's see how wet. - hsScalar wet = (hsScalar)(1.f - (t - info.fWetTime) / info.fWetLength); + float wet = (float)(1.f - (t - info.fWetTime) / info.fWetLength); if( wet > 1.f ) // This should never happen. It means t < info.fWetTime (we get wet in the future). return fIntensity; if( wet < 0 ) @@ -1024,14 +1024,14 @@ hsBool plDynaDecalMgr::IConvertFlatGrid(plAuxSpan* auxSpan, void plDynaDecalMgr::ISetDepthFalloff() { - const hsScalar totalDepth = fCutter->GetLengthW(); + const float totalDepth = fCutter->GetLengthW(); // Currently all constants, but these could be set per DecalMgr. - plConst(hsScalar) kMinFeet(3.f); - plConst(hsScalar) kMaxFeet(10.f); + plConst(float) kMinFeet(3.f); + plConst(float) kMaxFeet(10.f); - plConst(hsScalar) kMinDepth(0.25f); - plConst(hsScalar) kMaxDepth(0.75f); + plConst(float) kMinDepth(0.25f); + plConst(float) kMaxDepth(0.75f); fMinDepth = kMinFeet / totalDepth; if( fMinDepth > kMinDepth ) @@ -1099,15 +1099,15 @@ hsBool plDynaDecalMgr::IConvertPolysAlpha(plAuxSpan* auxSpan, hsColorRGBA col = src[iPoly].fVerts[iVert].fColor; - hsScalar depth = vtx->fUVW[0].fZ; + float depth = vtx->fUVW[0].fZ; - hsScalar opac = depth < fMinDepth + float opac = depth < fMinDepth ? depth * fMinDepthRange : depth > fMaxDepth ? (1.f - depth) * fMaxDepthRange : 1.f; - hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); + float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); opac *= 1.f - normOpac * normOpac; if( opac < 0 ) opac = 0; @@ -1197,14 +1197,14 @@ hsBool plDynaDecalMgr::IConvertPolysColor(plAuxSpan* auxSpan, else hiV = true; - hsScalar depth = vtx->fUVW[0].fZ; - hsScalar opac = depth < fMinDepth + float depth = vtx->fUVW[0].fZ; + float opac = depth < fMinDepth ? depth * fMinDepthRange : depth > fMaxDepth ? (1.f - depth) * fMaxDepthRange : 1.f; - hsScalar normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); + float normOpac = 1.f - vtx->fNorm.InnerProduct(backDir); opac *= 1.f - normOpac * normOpac; if( opac < 0 ) opac = 0; @@ -1292,7 +1292,7 @@ hsBool plDynaDecalMgr::IConvertPolysVS(plAuxSpan* auxSpan, origUVW->fX = vtx->fUVW[0].fX; origUVW->fY = vtx->fUVW[0].fY; - origUVW->fZ = vtx->fUVW[0].fZ = (hsScalar)decal->fBirth; + origUVW->fZ = vtx->fUVW[0].fZ = (float)decal->fBirth; vtx->fUVW[1].Set(0, 0, 0); @@ -1582,7 +1582,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap sprintf(buff, "%s_%s", GetKey()->GetName(), "EnvMat"); hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation()); - static plTweak kSmooth(1.f); + static plTweak kSmooth(1.f); plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0); @@ -1676,11 +1676,11 @@ hsVector3 plDynaDecalMgr::IRandomUp(hsVector3 dir) const // Only problem here is that our random scalings might wind us up with // a zero vector. Unlikely, which means almost certain to happen. So // we keep trying till we get a non-zero vector. - hsScalar lenSq(-1.f); + float lenSq(-1.f); do { - hsScalar ranXx = sRand.RandMinusOneToOne(); - hsScalar ranXy = sRand.RandMinusOneToOne(); - hsScalar ranXz = sRand.RandMinusOneToOne(); + float ranXx = sRand.RandMinusOneToOne(); + float ranXy = sRand.RandMinusOneToOne(); + float ranXz = sRand.RandMinusOneToOne(); retVal.fX = -dir.fZ * ranXy + dir.fY * ranXz; retVal.fY = dir.fZ * ranXx + -dir.fX * ranXz; retVal.fZ = -dir.fY * ranXx + dir.fX * ranXy; @@ -1706,11 +1706,11 @@ hsVector3 plDynaDecalMgr::IReflectDir(hsVector3 dir) const // Simplifying gives (2*K*(N dot B) + (1-K)) * N + K*B // Or something. - plConst(hsScalar) parm(0.5f); + plConst(float) parm(0.5f); hsVector3 b = -fCutter->GetBackDir(); - hsScalar t = dir.InnerProduct(b); + float t = dir.InnerProduct(b); t *= -2.f * parm; t += (1.f - parm); @@ -1755,7 +1755,7 @@ hsMatrix44 plDynaDecalMgr::IL2WFromHit(hsPoint3 pos, hsVector3 dir) const return l2w; } -void plDynaDecalMgr::ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight, hsScalar waterHeight) +void plDynaDecalMgr::ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight, float waterHeight) { hsTArray hits; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h index e1a0a0b7..e5e03b03 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.h @@ -98,7 +98,7 @@ public: double fLastTime; hsPoint3 fLastPos; double fWetTime; - hsScalar fWetLength; + float fWetLength; uint32_t fFlags; plDynaDecalInfo& Init(const plKey& key); @@ -150,31 +150,31 @@ protected: hsTArray fPartyObjects; hsTArray fParticles; - hsScalar fPartyTime; + float fPartyTime; uint16_t fMaxNumVerts; uint16_t fMaxNumIdx; uint32_t fWaitOnEnable; - hsScalar fWetLength; - hsScalar fRampEnd; - hsScalar fDecayStart; - hsScalar fLifeSpan; - hsScalar fIntensity; + float fWetLength; + float fRampEnd; + float fDecayStart; + float fLifeSpan; + float fIntensity; - hsScalar fGridSizeU; - hsScalar fGridSizeV; + float fGridSizeU; + float fGridSizeV; hsVector3 fScale; // some temp calculated stuff - hsScalar fInitAtten; + float fInitAtten; // These 4 are in normalized units [0..1], not feet. - hsScalar fMinDepth; - hsScalar fMinDepthRange; - hsScalar fMaxDepth; - hsScalar fMaxDepthRange; + float fMinDepth; + float fMinDepthRange; + float fMaxDepth; + float fMaxDepthRange; hsTArray fPartIDs; hsTArray fNotifies; @@ -188,7 +188,7 @@ protected: hsBool IWetParts(const plDynaDecalEnableMsg* enaMsg); hsBool IWetPart(uint32_t id, const plDynaDecalEnableMsg* enaMsg); void IWetInfo(plDynaDecalInfo& info, const plDynaDecalEnableMsg* enaMsg) const; - hsScalar IHowWet(plDynaDecalInfo& info, double t) const; + float IHowWet(plDynaDecalInfo& info, double t) const; plDynaDecalInfo& IGetDecalInfo(uintptr_t id, const plKey& key); void IRemoveDecalInfo(uint32_t id); void IRemoveDecalInfos(const plKey& key); @@ -225,7 +225,7 @@ protected: void ISetDepthFalloff(); // Sets from current cutter settings. - virtual void ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight=false, hsScalar waterHeight=0.f); + virtual void ICutoutCallback(const hsTArray& cutouts, hsBool hasWaterHeight=false, float waterHeight=0.f); hsGMaterial* IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap); @@ -259,19 +259,19 @@ public: void SetWaitOnEnable(hsBool on) { fWaitOnEnable = on; } hsBool GetWaitOnEnable() const { return fWaitOnEnable; } - void SetWetLength(hsScalar f) { fWetLength = f; } - void SetRampEnd(hsScalar f) { fRampEnd = f; } - void SetDecayStart(hsScalar f) { fDecayStart = f; } - void SetLifeSpan(hsScalar f) { fLifeSpan = f; } - void SetIntensity(hsScalar f) { fIntensity = f; } - hsScalar GetWetLength() const { return fWetLength; } - hsScalar GetRampEnd() const { return fRampEnd; } - hsScalar GetDecayStart() const { return fDecayStart; } - hsScalar GetLifeSpan() const { return fLifeSpan; } - hsScalar GetIntensity() const { return fIntensity; } - - void SetPartyTime(hsScalar secs) { fPartyTime = secs; } // Duration of particle spewage - hsScalar GetPartyTime() const { return fPartyTime; } + void SetWetLength(float f) { fWetLength = f; } + void SetRampEnd(float f) { fRampEnd = f; } + void SetDecayStart(float f) { fDecayStart = f; } + void SetLifeSpan(float f) { fLifeSpan = f; } + void SetIntensity(float f) { fIntensity = f; } + float GetWetLength() const { return fWetLength; } + float GetRampEnd() const { return fRampEnd; } + float GetDecayStart() const { return fDecayStart; } + float GetLifeSpan() const { return fLifeSpan; } + float GetIntensity() const { return fIntensity; } + + void SetPartyTime(float secs) { fPartyTime = secs; } // Duration of particle spewage + float GetPartyTime() const { return fPartyTime; } void ConvertToEnvMap(plBitmap* envMap); const plMipmap* GetMipmap() const; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp index 0ef89e4a..24e4d71f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaFootMgr.cpp @@ -141,7 +141,7 @@ hsBool plDynaFootMgr::IPrintFromShape(const plPrintShape* shape, hsBool flip) plDynaDecalInfo& info = IGetDecalInfo(uintptr_t(shape), shape->GetKey()); double secs = hsTimer::GetSysSeconds(); - hsScalar wetness = IHowWet(info, secs); + float wetness = IHowWet(info, secs); fInitAtten = wetness; if( wetness <= 0 ) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp index dc31d709..3c9d8c3c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgr.cpp @@ -92,7 +92,7 @@ int plDynaRippleMgr::INewDecal() fDecals.Append(rip); #else plDynaWave* wave = TRACKED_NEW plDynaWave(); - static hsScalar kDefScrollRate = 0.1f; + static float kDefScrollRate = 0.1f; wave->fScrollRate = kDefScrollRate; fDecals.Append(wave); #endif @@ -186,10 +186,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - plConst(hsScalar) kMinDist(2.0f); - plConst(hsScalar) kMinTime(1.5f); + plConst(float) kMinDist(2.0f); + plConst(float) kMinTime(1.5f); double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -203,12 +203,12 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force randPert.Normalize(); if( !farEnough ) { - plConst(hsScalar) kRandPert = 0.5f; + plConst(float) kRandPert = 0.5f; randPert *= kRandPert; } else { - plConst(hsScalar) kRandPert = 0.15f; + plConst(float) kRandPert = 0.15f; randPert *= kRandPert; } pos += randPert; @@ -216,10 +216,10 @@ hsBool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, hsBool force hsVector3 dir(0.f, 1.f, 0.f); hsVector3 up(0.f, 0.f, 1.f); - plConst(hsScalar) kHeightScale = 1.f; + plConst(float) kHeightScale = 1.f; pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f; - hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength()); + float wid = hsMaximum(shape->GetWidth(), shape->GetLength()); hsVector3 size(wid * fScale.fX, wid * fScale.fY, shape->GetHeight() * fScale.fZ * kHeightScale); fCutter->SetLength(size); fCutter->Set(pos, dir, up); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp index b746e5bc..56d3ccdb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaRippleMgrVS.cpp @@ -176,10 +176,10 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - plConst(hsScalar) kMinDist(2.0f); - plConst(hsScalar) kMinTime(1.5f); + plConst(float) kMinDist(2.0f); + plConst(float) kMinTime(1.5f); double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -193,18 +193,18 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for randPert.Normalize(); if( !farEnough ) { - plConst(hsScalar) kRandPert = 0.5f; + plConst(float) kRandPert = 0.5f; randPert *= kRandPert; } else { - plConst(hsScalar) kRandPert = 0.15f; + plConst(float) kRandPert = 0.15f; randPert *= kRandPert; } pos += randPert; // Are we potentially touching the water? - hsScalar waterHeight = fWaveSetBase->GetHeight(); + float waterHeight = fWaveSetBase->GetHeight(); if( (pos.fZ - fScale.fZ * shape->GetHeight() < waterHeight) &&(pos.fZ + fScale.fZ * shape->GetHeight() > waterHeight) ) { @@ -212,9 +212,9 @@ hsBool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, hsBool for hsVector3 dir(fWaveSetBase->GetWindDir()); hsVector3 up(0.f, 0.f, 1.f); - hsScalar wid = hsMaximum(shape->GetWidth(), shape->GetLength()); + float wid = hsMaximum(shape->GetWidth(), shape->GetLength()); - plConst(hsScalar) kMaxWaterDepth(1000.f); + plConst(float) kMaxWaterDepth(1000.f); hsVector3 size(wid * fScale.fX, wid * fScale.fY, kMaxWaterDepth); fCutter->SetLength(size); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp index fd972929..6e302752 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaTorpedoMgr.cpp @@ -78,7 +78,7 @@ void plDynaTorpedoMgr::Read(hsStream* stream, hsResMgr* mgr) hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) { - hsScalar partyTime = fPartyTime; + float partyTime = fPartyTime; plConst(int) kNumShots(3); int i; @@ -87,8 +87,8 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) hsVector3 up = IRandomUp(bull->Dir()); hsVector3 pert = bull->Dir() % up; - plConst(hsScalar) kMaxPert(1.f); - hsScalar maxPert = i ? kMaxPert * bull->Radius() : 0; + plConst(float) kMaxPert(1.f); + float maxPert = i ? kMaxPert * bull->Radius() : 0; pert *= sRand.RandMinusOneToOne() * maxPert * fScale.fX; pert += up * (sRand.RandMinusOneToOne() * maxPert * fScale.fY); @@ -96,26 +96,26 @@ hsBool plDynaTorpedoMgr::IHandleShot(plBulletMsg* bull) hsPoint3 pos = bull->From() + bull->Dir() * (bull->Range() * 0.5f); pos += pert; - hsScalar scaleX = bull->Radius() * fScale.fX * fInitUVW.fX; - hsScalar scaleY = bull->Radius() * fScale.fY * fInitUVW.fY; + float scaleX = bull->Radius() * fScale.fX * fInitUVW.fX; + float scaleY = bull->Radius() * fScale.fY * fInitUVW.fY; #if 0 - plConst(hsScalar) kMinScale(0.5f); + plConst(float) kMinScale(0.5f); if( i ) { scaleX *= sRand.RandRangeF(kMinScale, 1.f); scaleY *= sRand.RandRangeF(kMinScale, 1.f); } #elif 0 - hsScalar div = 1.f / (1.f + hsScalar(i)); + float div = 1.f / (1.f + float(i)); scaleX *= div; scaleY *= div; #else - plConst(hsScalar) kMinScale(0.25f); - plConst(hsScalar) kMaxScale(0.75f); + plConst(float) kMinScale(0.25f); + plConst(float) kMaxScale(0.75f); if( i ) { - hsScalar scale = sRand.RandRangeF(kMinScale, kMaxScale); + float scale = sRand.RandRangeF(kMinScale, kMaxScale); scaleX *= scale; scaleY *= scale; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp index 4ff9436a..ee7625a2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.cpp @@ -140,7 +140,7 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin { hsVector3 animDir; hsPoint3 p = pos; - hsScalar t = fAnimPath->GetExtremePoint(p); + float t = fAnimPath->GetExtremePoint(p); fAnimPath->SetCurTime(t, plAnimPath::kNone); fAnimPath->GetVelocity(&animDir); @@ -151,8 +151,8 @@ hsVector3 plDynaWakeMgr::IGetDirection(const plDynaDecalInfo& info, const hsPoin } // Now if we want to factor in velocity, we can use (pos - info.fLastPos) / (hsTimer::GetSysSeconds() - info.fLastTime) - hsScalar dt = hsScalar(hsTimer::GetSysSeconds() - info.fLastTime); - const hsScalar kMinDt = 1.e-3f; + float dt = float(hsTimer::GetSysSeconds() - info.fLastTime); + const float kMinDt = 1.e-3f; if( (info.fFlags & plDynaDecalInfo::kImmersed) && (dt > kMinDt) ) { hsVector3 velDir(&pos, &info.fLastPos); @@ -177,10 +177,10 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) const hsMatrix44& shapeL2W = shape->GetOwner()->GetLocalToWorld(); - static hsScalar kMinDist = 1.0f; - static hsScalar kMinTime = 0.25f; + static float kMinDist = 1.0f; + static float kMinTime = 0.25f; double t = hsTimer::GetSysSeconds(); - hsScalar dt = hsScalar(t - info.fLastTime) * sRand.RandZeroToOne(); + float dt = float(t - info.fLastTime) * sRand.RandZeroToOne(); hsBool longEnough = (dt >= kMinTime); hsPoint3 xlate = shapeL2W.GetTranslate(); hsBool farEnough = (hsVector3(&info.fLastPos, &xlate).Magnitude() > kMinDist); @@ -197,19 +197,19 @@ hsBool plDynaWakeMgr::IRippleFromShape(const plPrintShape* shape, hsBool force) randPert.Normalize(); if( !farEnough ) { - static hsScalar kRandPert = 0.05f; + static float kRandPert = 0.05f; randPert *= kRandPert * shape->GetWidth(); } else { - static hsScalar kRandPert = 0.05f; + static float kRandPert = 0.05f; randPert *= kRandPert * shape->GetWidth(); } pos += randPert; hsVector3 up(0.f, 0.f, 1.f); - static hsScalar kHeightScale = 1.f; + static float kHeightScale = 1.f; pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f; pos += dir * shape->GetLength() * 0.5f * (1.f - fScale.fY); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h index f276ba53..191a4608 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaWakeMgr.h @@ -54,8 +54,8 @@ protected: hsVector3 fDefaultDir; plAnimPath* fAnimPath; - hsScalar fAnimWgt; - hsScalar fVelWgt; + float fAnimWgt; + float fVelWgt; virtual hsVector3 IGetDirection(const plDynaDecalInfo& info, const hsPoint3& pos) const; @@ -78,11 +78,11 @@ public: void SetDefaultDir(const hsVector3& v); const hsVector3& GetDefaultDir() const { return fDefaultDir; } - void SetAnimWeight(hsScalar f) { fAnimWgt = f; } - hsScalar GetAnimWeight() const { return fAnimWgt; } + void SetAnimWeight(float f) { fAnimWgt = f; } + float GetAnimWeight() const { return fAnimWgt; } - void SetVelocityWeight(hsScalar f) { fVelWgt = f; } - hsScalar GetVelocityWeight() const { return fVelWgt; } + void SetVelocityWeight(float f) { fVelWgt = f; } + float GetVelocityWeight() const { return fVelWgt; } }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp index ac9c81e8..efce36cd 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" -void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, hsScalar secs) +void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, float secs) { fMaxLength.Set(w.fMaxLength, secs); fMinLength.Set(w.fMinLength, secs); @@ -54,7 +54,7 @@ void plFixedWaterState7::WaveState::Set(const plFixedWaterState7::WaveState& w, fAngleDev.Set(w.fAngleDev, secs); } -void plFixedWaterState7::Set(const plFixedWaterState7& t, hsScalar secs) +void plFixedWaterState7::Set(const plFixedWaterState7& t, float secs) { fWindDir.Set(t.fWindDir, secs); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h index 54ceae50..23540063 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plFixedWaterState7.h @@ -55,13 +55,13 @@ public: class WaveState { public: - plTimedSimple fMaxLength; - plTimedSimple fMinLength; - plTimedSimple fAmpOverLen; - plTimedSimple fChop; - plTimedSimple fAngleDev; + plTimedSimple fMaxLength; + plTimedSimple fMinLength; + plTimedSimple fAmpOverLen; + plTimedSimple fChop; + plTimedSimple fAngleDev; - void Set(const WaveState& w, hsScalar secs); + void Set(const WaveState& w, float secs); void Read(hsStream* s); void Write(hsStream* s) const; @@ -73,7 +73,7 @@ public: // Texture waves WaveState fTexState; - plTimedSimple fRippleScale; + plTimedSimple fRippleScale; // Geometric and Texture share wind direction plTimedCompound fWindDir; @@ -89,7 +89,7 @@ public: // Depth parameters. Affect how the depth of // the water vertex is interpreted into water // surface properties. - plTimedSimple fWaterHeight; + plTimedSimple fWaterHeight; plTimedCompound fWaterOffset; plTimedCompound fMaxAtten; plTimedCompound fMinAtten; @@ -98,17 +98,17 @@ public: // Shore parameters // Appearance - plTimedSimple fWispiness; + plTimedSimple fWispiness; plTimedCompound fShoreTint; // Next two only used in generation of bubble layer plTimedCompound fMaxColor; plTimedCompound fMinColor; - plTimedSimple fEdgeOpac; - plTimedSimple fEdgeRadius; + plTimedSimple fEdgeOpac; + plTimedSimple fEdgeRadius; // Simulation - plTimedSimple fPeriod; - plTimedSimple fFingerLength; + plTimedSimple fPeriod; + plTimedSimple fFingerLength; // The rest aren't really part of the state, that is they are normally controlled // by something exterior to the state. They are included here to allow a convenient @@ -119,10 +119,10 @@ public: plTimedCompound fSpecularTint; plTimedCompound fEnvCenter; - plTimedSimple fEnvRefresh; - plTimedSimple fEnvRadius; + plTimedSimple fEnvRefresh; + plTimedSimple fEnvRadius; - void Set(const plFixedWaterState7& s, hsScalar secs); + void Set(const plFixedWaterState7& s, float secs); void Read(hsStream* s); void Write(hsStream* s) const; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp index 53ad9433..ce12327c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeoSpanDice.cpp @@ -121,7 +121,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray& out, if( iAxis < 0 ) return false; - hsScalar midPoint = src->fLocalBounds.GetCenter()[iAxis]; + float midPoint = src->fLocalBounds.GetCenter()[iAxis]; hsTArray loTris; hsTArray hiTris; @@ -170,7 +170,7 @@ hsBool plGeoSpanDice::IHalf(plGeometrySpan* src, hsTArray& out, int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const { int iAxis = -1; - hsScalar maxDim = 0; + float maxDim = 0; int i; for( i = 0; i < 3; i++ ) @@ -179,7 +179,7 @@ int plGeoSpanDice::ISelectAxis(int exclAxis, plGeometrySpan* src) const if( exclAxis & (1 << i) ) continue; - hsScalar dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i]; + float dim = src->fLocalBounds.GetMaxs()[i] - src->fLocalBounds.GetMins()[i]; if( dim > maxDim ) { maxDim = dim; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp index 627c299b..bf66099b 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp @@ -1019,7 +1019,7 @@ void plGeometrySpan::AdjustBounds(hsBounds3Ext& bnd) const hsBounds3Ext wBnd = bnd; wBnd.Transform(&fLocalToWorld); - const hsScalar kMaxWaveHeight(5.f); + const float kMaxWaveHeight(5.f); hsBounds3Ext rebound; rebound.MakeEmpty(); hsPoint3 pos = wBnd.GetMins(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h index 94f7adf1..f40615a8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h @@ -142,10 +142,10 @@ class plGeometrySpan uint16_t fMaxBoneIdx; uint32_t fPenBoneIdx; - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - hsScalar fWaterHeight; + float fWaterHeight; uint8_t fFormat; uint32_t fProps; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp index eada8cb2..eb758f68 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.cpp @@ -237,12 +237,12 @@ hsVector3& plInterMeshSmooth::GetNormal(plSpanHandle& set, uint16_t idx) return set.fDrawable->CvtGetNormal(set.fSpanIdx, idx); } -void plInterMeshSmooth::SetAngle(hsScalar degs) +void plInterMeshSmooth::SetAngle(float degs) { - fMinNormDot = hsCosine(hsScalarDegToRad(degs)); + fMinNormDot = cos(hsDegreesToRadians(degs)); } -hsScalar plInterMeshSmooth::GetAngle() const +float plInterMeshSmooth::GetAngle() const { - return hsScalarRadToDeg(hsACosine(fMinNormDot)); + return hsRadiansToDegrees(acos(fMinNormDot)); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h index c8977041..d1a02652 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInterMeshSmooth.h @@ -59,7 +59,7 @@ public: class plInterMeshSmooth { protected: - hsScalar fMinNormDot; + float fMinNormDot; void FindEdges(uint32_t maxVtxIdx, uint32_t nTris, uint16_t* idxList, hsTArray& edgeVerts); void FindEdges(hsTArray& sets, hsTArray* edgeVerts); @@ -71,8 +71,8 @@ protected: public: plInterMeshSmooth() : fMinNormDot(0.25f) {} - void SetAngle(hsScalar degs); - hsScalar GetAngle() const; // returns degrees + void SetAngle(float degs); + float GetAngle() const; // returns degrees void SmoothNormals(hsTArray& sets); }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp index 6f062f51..3d817510 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.cpp @@ -53,7 +53,7 @@ plMorphArray::~plMorphArray() // MorphArray - Apply -void plMorphArray::Apply(hsTArray& dst, hsTArray* weights /* = nil */) const +void plMorphArray::Apply(hsTArray& dst, hsTArray* weights /* = nil */) const { // Have our choice of cache thrashing here // We can for each delta/for each vert diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h index 21f4c17d..468ed597 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphArray.h @@ -53,7 +53,7 @@ public: plMorphArray(); virtual ~plMorphArray(); - void Apply(hsTArray& dst, hsTArray* weights = nil) const; + void Apply(hsTArray& dst, hsTArray* weights = nil) const; void Read(hsStream* s, hsResMgr* mgr); void Write(hsStream* s, hsResMgr* mgr); @@ -62,8 +62,8 @@ public: void AddDelta(const plMorphDelta& delta); int GetNumDeltas() const { return fDeltas.GetCount(); } - hsScalar GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); } - void SetWeight(int iDel, hsScalar w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); } + float GetWeight(int iDel) { return fDeltas[iDel].GetWeight(); } + void SetWeight(int iDel, float w) { if( iDel < fDeltas.GetCount() )fDeltas[iDel].SetWeight(w); } }; #endif // plMorphArray_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp index 7b88049b..46d2b8d5 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plTweak.h" -static const hsScalar kMinWeight = 1.e-2f; +static const float kMinWeight = 1.e-2f; plMorphSpan::plMorphSpan() : fUVWs(nil), @@ -91,7 +91,7 @@ plMorphDelta& plMorphDelta::operator=(const plMorphDelta& src) return *this; } -void plMorphDelta::Apply(hsTArray& dst, hsScalar weight /* = -1.f */) const +void plMorphDelta::Apply(hsTArray& dst, float weight /* = -1.f */) const { if( weight == -1.f) weight = fWeight; // None passed in, use our stored value @@ -213,12 +213,12 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs hsBool nonZero = false; // These are actually min del SQUARED. - plConst(hsScalar) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants - plConst(hsScalar) kMinDelNorm(3.e-2f); // About 10 degrees - plConst(hsScalar) kMinDelUVW(1.e-4f); // From BHC + plConst(float) kMinDelPos(1.e-4f); // From Budtpueller's Handbook of Constants + plConst(float) kMinDelNorm(3.e-2f); // About 10 degrees + plConst(float) kMinDelUVW(1.e-4f); // From BHC hsPoint3 mPos = d2b * *movedIter.Position(); hsVector3 delPos( &mPos, baseIter.Position()); - hsScalar delPosSq = delPos.MagnitudeSquared(); + float delPosSq = delPos.MagnitudeSquared(); if( delPosSq > kMinDelPos ) nonZero = true; else @@ -226,7 +226,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs hsVector3 delNorm = (d2bTInv * *movedIter.Normal()) - *baseIter.Normal(); - hsScalar delNormSq = delNorm.MagnitudeSquared(); + float delNormSq = delNorm.MagnitudeSquared(); if( delNormSq > kMinDelNorm ) nonZero = true; else @@ -236,7 +236,7 @@ void plMorphDelta::ComputeDeltas(const hsTArray& base, const hs for( i = 0; i < numUVWs; i++ ) { delUVWs[i] = *movedIter.UVW(i) - *baseIter.UVW(i); - hsScalar delUVWSq = delUVWs[i].MagnitudeSquared(); + float delUVWSq = delUVWs[i].MagnitudeSquared(); if( delUVWSq > kMinDelUVW ) nonZero = true; else diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h index 241d1a45..759e80f4 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphDelta.h @@ -75,7 +75,7 @@ class plMorphDelta : public plCreatable protected: hsTArray fSpans; - hsScalar fWeight; + float fWeight; public: plMorphDelta(); virtual ~plMorphDelta(); @@ -86,10 +86,10 @@ public: CLASSNAME_REGISTER( plMorphDelta ); GETINTERFACE_ANY( plMorphDelta, plCreatable ); - void SetWeight(hsScalar w) { fWeight = w; } - hsScalar GetWeight() const { return fWeight; } + void SetWeight(float w) { fWeight = w; } + float GetWeight() const { return fWeight; } - void Apply(hsTArray& dst, hsScalar weight = -1.f) const; + void Apply(hsTArray& dst, float weight = -1.f) const; void ComputeDeltas(const hsTArray& base, const hsTArray& moved); void ComputeDeltas(const hsTArray& base, const hsTArray& moved, const hsMatrix44& d2b, const hsMatrix44& d2bTInv); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp index c684f0ab..720f4bec 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.cpp @@ -98,14 +98,14 @@ const uint32_t kChanMask = plAccessVtxSpan::kPositionMask // that's what got loaded from disk. // Use Access RW. That might already be handled in the customization stuff. -plConst(hsScalar) kMorphTime(0.5); +plConst(float) kMorphTime(0.5); class plMorphTarget { public: uint16_t fLayer; uint16_t fDelta; - hsScalar fWeight; + float fWeight; }; hsTArray fTgtWgts; @@ -131,11 +131,11 @@ hsBool plMorphSequence::MsgReceive(plMessage* msg) // Can always add it in later if desired. if( fTgtWgts.GetCount() ) { - hsScalar delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f); + float delWgt = hsTimer::GetDelSysSeconds() / (kMorphTime > 0 ? kMorphTime : 1.e-3f); int i; for( i = 0; i < fTgtWgts.GetCount(); i++ ) { - hsScalar currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta); + float currWgt = GetWeight(fTgtWgts[i].fLayer, fTgtWgts[i].fDelta); if( fTgtWgts[i].fWeight < currWgt ) { if( fTgtWgts[i].fWeight >= (currWgt -= delWgt) ) @@ -233,7 +233,7 @@ int plMorphSequence::GetNumDeltas(int iLay, plKey meshKey /* = nil */) const return fSharedMeshes[index].fMesh->fMorphSet->fMorphs[iLay].GetNumDeltas(); } -hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const +float plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil */) const { int index = IFindSharedMeshIndex(meshKey); if (index == -1) @@ -242,7 +242,7 @@ hsScalar plMorphSequence::GetWeight(int iLay, int iDel, plKey meshKey /* = nil * return fSharedMeshes[index].fArrayWeights[iLay].fDeltaWeights[iDel]; } -void plMorphSequence::SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey /* = nil */) +void plMorphSequence::SetWeight(int iLay, int iDel, float w, plKey meshKey /* = nil */) { int index = IFindSharedMeshIndex(meshKey); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h index e03804b6..1c4da5fb 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequence.h @@ -54,7 +54,7 @@ class plMorphSequenceSDLMod; class plMorphArrayWeights { public: - hsTArray fDeltaWeights; + hsTArray fDeltaWeights; }; class plSharedMeshInfo @@ -121,7 +121,7 @@ protected: const plDrawInterface* IGetDrawInterface() const; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } void ISetHaveSnap(hsBool on) { if(on)fMorphFlags |= kHaveSnap; else fMorphFlags &= ~kHaveSnap; } void ISetDirty(hsBool on); @@ -173,8 +173,8 @@ public: void AddLayer(const plMorphArray& ma) { fMorphs.Append(ma); } int GetNumDeltas(int iLay, plKey meshKey = nil) const; - hsScalar GetWeight(int iLay, int iDel, plKey meshKey = nil) const; - void SetWeight(int iLay, int iDel, hsScalar w, plKey meshKey = nil); + float GetWeight(int iLay, int iDel, plKey meshKey = nil) const; + void SetWeight(int iLay, int iDel, float w, plKey meshKey = nil); hsBool GetHaveSnap() const { return 0 != (fMorphFlags & kHaveSnap); } hsBool GetDirty() const { return 0 != (fMorphFlags & kDirty); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp index 00694807..e9554ccd 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plMorphSequenceSDLMod.cpp @@ -169,8 +169,8 @@ void plMorphSequenceSDLMod::ISetCurrentStateFrom(const plStateDataRecord* srcSta { uint8_t weight; weights->Get(&weight, j); - hsScalar posWeight = weight * 2.f / 255.f - 1.f; - hsScalar negWeight = 0; + float posWeight = weight * 2.f / 255.f - 1.f; + float negWeight = 0; if (posWeight < 0) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp index e61773b9..b93314b5 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plParticleSystem/plParticleEmitter.h" #include "plParticleSystem/plParticle.h" -static hsScalar sInvDelSecs; +static float sInvDelSecs; //// Local Static Stuff /////////////////////////////////////////////////////// @@ -85,7 +85,7 @@ static hsScalar sInvDelSecs; uint = dPtr[ 0 ]; ptr += sizeof( uint32_t ); } -static hsScalar sCurrMinWidth = 0; +static float sCurrMinWidth = 0; /////////////////////////////////////////////////////////////////////////////// //// Particles //////////////////////////////////////////////////////////////// @@ -155,7 +155,7 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs hsPoint3 xlate = viewToWorld.GetTranslate(); hsVector3 viewDir(&particle.fPos, &xlate); - hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); + float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; zVec = viewDir; @@ -172,12 +172,12 @@ void inline IInlSetParticlePathStretch( const plParticleCore &particle, const hs xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize. - hsScalar xLen = particle.fHSize; + float xLen = particle.fHSize; if( xLen * invD < sCurrMinWidth ) xLen = sCurrMinWidth / invD; xVec *= xLen; - hsScalar len = yVec.InnerProduct(orientation); + float len = yVec.InnerProduct(orientation); // Might want to give it a little boost to overlap itself (and compensate for the massive // transparent border the artists love). But they can do that themselves with the VSize. // len *= 1.5f; @@ -195,7 +195,7 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat hsPoint3 xlate = viewToWorld.GetTranslate(); hsVector3 viewDir(&particle.fPos, &xlate); - hsScalar invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); + float invD = hsFastMath::InvSqrtAppr(viewDir.MagnitudeSquared()); viewDir *= invD; zVec = viewDir; @@ -212,9 +212,9 @@ void inline IInlSetParticlePathFlow( const plParticleCore &particle, const hsMat xVec = yVec % viewDir; // cross product of two orthonormal vectors, no need to normalize. - hsScalar len = yVec.InnerProduct(orientation); + float len = yVec.InnerProduct(orientation); - hsScalar xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs); + float xLen = particle.fHSize * hsFastMath::InvSqrtAppr(1.f + len * sInvDelSecs); if( xLen * invD < sCurrMinWidth ) xLen = sCurrMinWidth / invD; xVec *= xLen; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h index ea204e5a..1021bc65 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plPrintShape.h @@ -48,9 +48,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plPrintShape : public plObjInterface { protected: - hsScalar fWidth; - hsScalar fLength; - hsScalar fHeight; + float fWidth; + float fLength; + float fHeight; public: plPrintShape(); virtual ~plPrintShape(); @@ -65,13 +65,13 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar GetWidth() const { return fWidth; } - hsScalar GetLength() const { return fLength; } - hsScalar GetHeight() const { return fHeight; } + float GetWidth() const { return fWidth; } + float GetLength() const { return fLength; } + float GetHeight() const { return fHeight; } - void SetWidth(hsScalar f) { fWidth = f; } - void SetLength(hsScalar f) { fLength = f; } - void SetHeight(hsScalar f) { fHeight = f; } + void SetWidth(float f) { fWidth = f; } + void SetLength(float f) { fLength = f; } + void SetHeight(float f) { fHeight = f; } }; #endif // plPrintShape_inc diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp index 249625ce..66151323 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp @@ -58,7 +58,7 @@ static hsTArray fProxyDrawables; static hsTArray fProxyMaterials; static uint32_t fProxyKeyCounter = 0; -plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac) +plProxyGen::plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac) : fProxyMsgType(0), fProxyDraw(nil), fProxyMat(nil) @@ -153,7 +153,7 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const { const hsColorRGBA& amb = fAmbient; const hsColorRGBA& dif = fColor; - hsScalar opac = fAmbient.a; + float opac = fAmbient.a; hsGMaterial* retVal = TRACKED_NEW hsGMaterial(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h index 167497ac..44ba0248 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.h @@ -116,7 +116,7 @@ protected: virtual void IRemoveProxy(uint32_t drawIdx) const; virtual void IDestroyProxy(); public: - plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac); + plProxyGen(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac); virtual ~plProxyGen(); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h b/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h index b1560537..fb9c558d 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plRipVSConsts.h @@ -46,16 +46,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plRipVSConsts { public: - hsScalar fC1U; - hsScalar fC2U; - hsScalar fC1V; - hsScalar fC2V; + float fC1U; + float fC2U; + float fC1V; + float fC2V; - hsScalar fInitAtten; - hsScalar fLife; - hsScalar fDecay; + float fInitAtten; + float fLife; + float fDecay; - hsScalar fRamp; + float fRamp; }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp index a7b7f838..f736a237 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.cpp @@ -172,7 +172,7 @@ void plSpaceTreeMaker::ISplitList(hsTArray& nodes, const hsVec upper[i] = nodes[i + lowerCount]; } -hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis) +hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& nodes, float& length, hsVector3& axis) { hsBounds3Ext bnd; bnd.MakeEmpty(); @@ -189,14 +189,14 @@ hsBounds3Ext plSpaceTreeMaker::IFindDistToCenterAxis(hsTArray& { hsVector3 sep; sep.Set(&bnd.GetCenter(), &nodes[i]->fWorldBounds.GetCenter()); - hsScalar len = sep.MagnitudeSquared(); + float len = sep.MagnitudeSquared(); if( len > length ) { axis = sep; length = len; } } - length = hsSquareRoot(length); + length = sqrt(length); if( length > 1.e-3f ) axis /= length; else @@ -231,7 +231,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray& // Find the maximum length vector from nodes[i] center to list center. // If that length is zero, just use the maximum dimension of overall bounds. - hsScalar length; + float length; hsVector3 axis; hsBounds3Ext bnd = IFindDistToCenterAxis(nodes, length, axis); @@ -249,7 +249,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeFatTreeRecur(hsTArray& return subRoot; } -hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis) +hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, float& length, hsVector3& axis) { hsBounds3Ext bnd; bnd.MakeEmpty(); @@ -258,7 +258,7 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, { bnd.Union(&nodes[i]->fWorldBounds); } - hsScalar maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0]; + float maxLen = bnd.GetMaxs()[0] - bnd.GetMins()[0]; int maxAxis = 0; if( bnd.GetMaxs()[1] - bnd.GetMins()[1] > maxLen ) @@ -290,9 +290,9 @@ hsBounds3Ext plSpaceTreeMaker::IFindSplitAxis(hsTArray& nodes, return bnd; } -void plSpaceTreeMaker::IFindBigList(hsTArray& nodes, hsScalar length, const hsVector3& axis, hsTArray& giants, hsTArray& strimps) +void plSpaceTreeMaker::IFindBigList(hsTArray& nodes, float length, const hsVector3& axis, hsTArray& giants, hsTArray& strimps) { - const hsScalar kCutoffFrac = 0.5f; + const float kCutoffFrac = 0.5f; giants.SetCount(0); strimps.SetCount(0); @@ -332,7 +332,7 @@ plSpacePrepNode* plSpaceTreeMaker::IMakeTreeRecur(hsTArray& no StartTimer(kMakeTree); // Find the maximum bounds dimension - hsScalar length; + float length; hsVector3 axis; hsBounds3Ext bnd = IFindSplitAxis(nodes, length, axis); @@ -487,7 +487,7 @@ void plSpaceTreeMaker::TestTree() tree->SetViewPos(*hsPoint3().Set(0,0,0)); plConeIsect cone; - cone.SetAngle(hsScalarPI*0.25f); + cone.SetAngle(M_PI*0.25f); cone.SetTransform(liX, invLiX); StartTimer(kHarvestCone); @@ -498,7 +498,7 @@ void plSpaceTreeMaker::TestTree() StopTimer(kHarvestCone); plConeIsect capped; - capped.SetAngle(hsScalarPI*0.25f); + capped.SetAngle(M_PI*0.25f); capped.SetLength(0.5f); capped.SetTransform(liX, invLiX); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h index dbe30528..02adbdaa 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpaceTreeMaker.h @@ -74,12 +74,12 @@ protected: int16_t fTreeSize; plSpacePrepNode* INewSubRoot(const hsBounds3Ext& bnd); - void IFindBigList(hsTArray& nodes, hsScalar length, const hsVector3& axis, hsTArray& giants, hsTArray& strimp); + void IFindBigList(hsTArray& nodes, float length, const hsVector3& axis, hsTArray& giants, hsTArray& strimp); void ISortList(hsTArray& nodes, const hsVector3& axis); void ISplitList(hsTArray& nodes, const hsVector3& axis, hsTArray& lower, hsTArray& upper); - hsBounds3Ext IFindDistToCenterAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis); + hsBounds3Ext IFindDistToCenterAxis(hsTArray& nodes, float& length, hsVector3& axis); plSpacePrepNode* IMakeFatTreeRecur(hsTArray& nodes); - hsBounds3Ext IFindSplitAxis(hsTArray& nodes, hsScalar& length, hsVector3& axis); + hsBounds3Ext IFindSplitAxis(hsTArray& nodes, float& length, hsVector3& axis); plSpacePrepNode* IMakeTreeRecur(hsTArray& nodes); void IMakeTree(); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp index 76e425dd..24028e75 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.cpp @@ -98,7 +98,7 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint { Alloc(encoding, numVerts); - stream->Read(12 * sizeof(hsScalar), fL2W[0]); + stream->Read(12 * sizeof(float), fL2W[0]); if( fPosDelta ) { stream->Read(numVerts * PosStrideFromEncoding(encoding), fPosDelta); @@ -112,7 +112,7 @@ void plSpanInstance::Read(hsStream* stream, const plSpanEncoding& encoding, uint void plSpanInstance::Write(hsStream* stream, const plSpanEncoding& encoding, uint32_t numVerts) const { - stream->Write(12 * sizeof(hsScalar), fL2W[0]); + stream->Write(12 * sizeof(float), fL2W[0]); if( fPosDelta ) { stream->Write(numVerts * PosStrideFromEncoding(encoding), fPosDelta); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h index eefba790..197502a2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanInstance.h @@ -113,13 +113,13 @@ public: }; uint32_t fCode; - hsScalar fPosScale; + float fPosScale; plSpanEncoding() : fCode(kPosNone|kColNone), fPosScale(0) {} - plSpanEncoding(uint32_t c, hsScalar s) : fCode(c), fPosScale(s) {} + plSpanEncoding(uint32_t c, float s) : fCode(c), fPosScale(s) {} uint32_t Code() const { return fCode; } - hsScalar Scale() const { return fPosScale; } + float Scale() const { return fPosScale; } void Read(hsStream* s); void Write(hsStream* s) const; @@ -131,7 +131,7 @@ protected: uint8_t* fPosDelta; uint8_t* fCol; - hsScalar fL2W[3][4]; + float fL2W[3][4]; friend class plSpanInstanceIter; public: diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp index ab8964e6..958efd68 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.cpp @@ -74,7 +74,7 @@ uint32_t plSpanTemplate::CalcStride() if( NumUVWs() ) fStride += (uint8_t)(sizeof(hsPoint3) * NumUVWs()); if( NumWeights() ) - fStride += (uint8_t)(sizeof(hsScalar) * NumWeights()); + fStride += (uint8_t)(sizeof(float) * NumWeights()); return uint32_t(fStride); } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h index 472b3860..0482b49f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTemplate.h @@ -140,7 +140,7 @@ public: uint8_t PositionOffset() const { return uint8_t(0); } uint8_t WgtIdxOffset() const { return uint8_t(PositionOffset() + NumPos() * sizeof(hsPoint3)); } uint8_t WeightOffset() const { return uint8_t(WgtIdxOffset() + NumWgtIdx() * sizeof(uint32_t)); } - uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(hsScalar)); } + uint8_t NormalOffset() const { return uint8_t(WeightOffset() + NumWeights() * sizeof(float)); } uint8_t ColorOffset() const { return uint8_t(NormalOffset() + NumNorm() * sizeof(hsVector3)); } uint8_t Color2Offset() const { return uint8_t(ColorOffset() + NumColor() * sizeof(uint32_t)); } uint8_t UVWOffset() const { return uint8_t(Color2Offset() + NumColor2() * sizeof(uint32_t)); } @@ -160,7 +160,7 @@ public: uint32_t* Color2(int i) const { return (uint32_t*)GetData(kColor2, i); } uint32_t* WgtIdx(int i) const { return (uint32_t*)GetData(kWgtIdx, i); } hsPoint3* UVWs(int iv, int iuv) const { return (hsPoint3*)GetData(kUVW, iv, iuv); } - hsScalar* Weight(int iv, int iw) const { return (hsScalar*)GetData(kWeight, iv, iw); } + float* Weight(int iv, int iw) const { return (float*)GetData(kWeight, iv, iw); } uint8_t* GetData(Channel chan, int i, int j=0) const { @@ -173,33 +173,33 @@ public: case kWeight: return base + NumPos() * sizeof(hsPoint3) - + j * sizeof(hsScalar); + + j * sizeof(float); case kWgtIdx: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar); + + NumWeights() * sizeof(float); case kNormal: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) + + NumWeights() * sizeof(float) + NumWgtIdx() * sizeof(uint32_t); case kColor: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) + + NumWeights() * sizeof(float) + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3); case kColor2: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) + + NumWeights() * sizeof(float) + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3) + NumColor() * sizeof(uint32_t); case kUVW: return base + NumPos() * sizeof(hsPoint3) - + NumWeights() * sizeof(hsScalar) + + NumWeights() * sizeof(float) + NumWgtIdx() * sizeof(uint32_t) + NumNorm() * sizeof(hsVector3) + NumColor() * sizeof(uint32_t) diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp index 298d4b41..200a4ec5 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp @@ -172,11 +172,11 @@ void plSpan::RemovePermaLight(plLightInfo* li, hsBool proj) //// AddLight //////////////////////////////////////////////////////////////// // Smart function for maintaining the sorted list of lights for a plSpan. -void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hsBool proj ) const +void plSpan::AddLight( plLightInfo *li, float strength, float scale, hsBool proj ) const { hsTArray& lights = proj ? fProjectors : fLights; - hsTArray& strengths = proj ? fProjStrengths : fLightStrengths; - hsTArray& scales = proj ? fProjScales : fLightScales; + hsTArray& strengths = proj ? fProjStrengths : fLightStrengths; + hsTArray& scales = proj ? fProjScales : fLightScales; int i; @@ -187,7 +187,7 @@ void plSpan::AddLight( plLightInfo *li, hsScalar strength, hsScalar scale, hs } lights.Insert(i, li); strengths.Insert(i, strength); - scales.Insert(i, hsScalar(uint32_t(scale * 127.9f)) / 127.f); + scales.Insert(i, float(uint32_t(scale * 127.9f)) / 127.f); } void plSpan::ClearLights() const @@ -266,14 +266,14 @@ hsBool plSpan::CanMergeInto( plSpan *other ) { if( !HSMemory::EqualBlocks(fLights.AcquireArray(), other->fLights.AcquireArray(), fLights.GetCount() * sizeof(plLightInfo*)) ) return false; - if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(hsScalar)) ) + if( !HSMemory::EqualBlocks(fLightScales.AcquireArray(), other->fLightScales.AcquireArray(), fLights.GetCount() * sizeof(float)) ) return false; } if( fProjectors.GetCount() ) { if( !HSMemory::EqualBlocks(fProjectors.AcquireArray(), other->fProjectors.AcquireArray(), fProjectors.GetCount() * sizeof(plLightInfo*)) ) return false; - if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(hsScalar)) ) + if( !HSMemory::EqualBlocks(fProjScales.AcquireArray(), other->fProjScales.AcquireArray(), fProjectors.GetCount() * sizeof(float)) ) return false; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h index 4b604b3d..fbb46aad 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.h @@ -137,10 +137,10 @@ class plSpan plFogEnvironment *fFogEnvironment; // Use setter/getters below. - hsScalar fMinDist; - hsScalar fMaxDist; + float fMinDist; + float fMaxDist; - hsScalar fWaterHeight; + float fWaterHeight; hsBitVector fVisSet; hsBitVector fVisNot; @@ -149,11 +149,11 @@ class plSpan // mutable hsBitVector fLightBits; mutable hsTArray fLights; - mutable hsTArray fLightStrengths; - mutable hsTArray fLightScales; + mutable hsTArray fLightStrengths; + mutable hsTArray fLightScales; mutable hsTArray fProjectors; - mutable hsTArray fProjStrengths; - mutable hsTArray fProjScales; + mutable hsTArray fProjStrengths; + mutable hsTArray fProjScales; mutable hsBitVector fShadowBits; mutable hsBitVector fShadowSlaveBits; @@ -177,14 +177,14 @@ class plSpan hsBool IsShadowBitSet(uint32_t idx) const { return fShadowBits.IsBitSet(idx); } void ClearLights() const; - void AddLight( plLightInfo* li, hsScalar strength, hsScalar scale, hsBool proj ) const; + void AddLight( plLightInfo* li, float strength, float scale, hsBool proj ) const; hsTArray& GetLightList(hsBool proj) const { return proj ? fProjectors : fLights; } uint32_t GetNumLights(hsBool proj) const { return proj ? fProjectors.GetCount() : fLights.GetCount(); } plLightInfo* GetLight(int i, hsBool proj) const { return proj ? fProjectors[i] : fLights[i]; } - hsScalar GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; } - hsScalar GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; } + float GetLightStrength(int i, hsBool proj) const { return proj ? fProjStrengths[i] : fLightStrengths[i]; } + float GetLightScale(int i, hsBool proj) const { return proj ? fProjScales[i] : fLightScales[i]; } void AddPermaLight(plLightInfo* li, hsBool proj); void RemovePermaLight(plLightInfo* li, hsBool proj); @@ -206,10 +206,10 @@ class plSpan virtual void MergeInto( plSpan* other ); virtual void Destroy( void ); - void SetMinDist(hsScalar minDist) { fMinDist = minDist; } - void SetMaxDist(hsScalar maxDist) { fMaxDist = maxDist; } - hsScalar GetMinDist() const { return fMinDist; } - hsScalar GetMaxDist() const { return fMaxDist; } + void SetMinDist(float minDist) { fMinDist = minDist; } + void SetMaxDist(float maxDist) { fMaxDist = maxDist; } + float GetMinDist() const { return fMinDist; } + float GetMaxDist() const { return fMaxDist; } }; //// plVertexSpan Definition diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h b/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h index ddebde35..a0a5ba3c 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plTimedInterp.h @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Requires class T to have the following members // T& operator+=(const class T& t); // T& operator-=(const class T& t); -// T& operator*=(hsScalar scale); +// T& operator*=(float scale); // T& operator=(const class T&); // unless builtin = is adequate. // template class plTimedInterp @@ -72,7 +72,7 @@ protected: const T& IEnd(); const T& IBegin(); - const T& IEval(hsScalar parm); + const T& IEval(float parm); public: plTimedInterp(); plTimedInterp(const T& t); @@ -110,7 +110,7 @@ plTimedInterp::Update(double t) if( fDuration <= 0 ) return IEnd(); - hsScalar parm = hsScalar((fEnd - t) / fDuration); + float parm = float((fEnd - t) / fDuration); if( parm <= 0 ) return IEnd(); else if( parm >= 1.f ) @@ -150,7 +150,7 @@ plTimedInterp::IBegin() template const T& -plTimedInterp::IEval(hsScalar parm) +plTimedInterp::IEval(float parm) { fCurr = fInit; fCurr -= fTarg; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp index d08dff93..2f721dff 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.cpp @@ -84,7 +84,7 @@ hsBool plVisLOSMgr::ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray if( node.fFlags & plSpaceTreeNode::kDisabled ) return false; - hsScalar closest; + float closest; // If it's a hit if( ICheckBound(node.fWorldBounds, closest) ) { @@ -149,7 +149,7 @@ hsBool plVisLOSMgr::ISetup(const hsPoint3& pStart, const hsPoint3& pEnd) fMaxDist = hsVector3(&fCurrTarg, &fCurrFrom).Magnitude(); - const hsScalar kMinMaxDist(0); + const float kMinMaxDist(0); return fMaxDist > kMinMaxDist; } @@ -263,7 +263,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& hsPoint3 currTarg = src.GetWorldToLocal() * fCurrTarg; hsVector3 currDir(&currTarg, &currFrom); - hsScalar maxDist = currDir.Magnitude(); + float maxDist = currDir.Magnitude(); currDir /= maxDist; @@ -272,9 +272,9 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& { // Project the current ray onto the tri plane hsVector3 norm = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&tri.Position(2), &tri.Position(0)); - hsScalar dotNorm = norm.InnerProduct(currDir); + float dotNorm = norm.InnerProduct(currDir); - const hsScalar kMinDotNorm = 1.e-3f; + const float kMinDotNorm = 1.e-3f; if( dotNorm >= -kMinDotNorm ) { if( !twoSided ) @@ -282,7 +282,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& if( dotNorm <= kMinDotNorm ) continue; } - hsScalar dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm); + float dist = hsVector3(&tri.Position(0), &currFrom).InnerProduct(norm); if( dist > 0 ) continue; dist /= dotNorm; @@ -295,13 +295,13 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& // Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray hsVector3 cross0 = hsVector3(&tri.Position(1), &tri.Position(0)) % hsVector3(&projPt, &tri.Position(0)); - hsScalar dot0 = cross0.InnerProduct(currDir); + float dot0 = cross0.InnerProduct(currDir); hsVector3 cross1 = hsVector3(&tri.Position(2), &tri.Position(1)) % hsVector3(&projPt, &tri.Position(1)); - hsScalar dot1 = cross1.InnerProduct(currDir); + float dot1 = cross1.InnerProduct(currDir); hsVector3 cross2 = hsVector3(&tri.Position(0), &tri.Position(2)) % hsVector3(&projPt, &tri.Position(2)); - hsScalar dot2 = cross2.InnerProduct(currDir); + float dot2 = cross2.InnerProduct(currDir); // If all 3 are negative, projPt is a hit // If all 3 are positive and we're two sided, projPt is a hit @@ -330,7 +330,7 @@ hsBool plVisLOSMgr::ICheckSpan(plDrawableSpans* dr, uint32_t spanIdx, plVisHit& return retVal; } -hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) +hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, float& closest) { if( bnd.GetType() != kBoundsNormal ) return false; @@ -360,7 +360,7 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) const hsPoint3& currTarg = fCurrTarg; hsVector3 currDir(&currTarg, &currFrom); - const hsScalar maxDistSq = currDir.MagnitudeSquared(); + const float maxDistSq = currDir.MagnitudeSquared(); currDir *= hsFastMath::InvSqrt(maxDistSq); @@ -374,14 +374,14 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) // Project the current ray onto the tri plane hsVector3 norm = hsVector3(&p1, &p0) % hsVector3(&p2, &p0); - hsScalar dotNorm = norm.InnerProduct(currDir); + float dotNorm = norm.InnerProduct(currDir); - const hsScalar kMinDotNorm = 1.e-3f; + const float kMinDotNorm = 1.e-3f; if( dotNorm >= -kMinDotNorm ) { continue; } - hsScalar dist = hsVector3(&p0, &currFrom).InnerProduct(norm); + float dist = hsVector3(&p0, &currFrom).InnerProduct(norm); if( dist >= 0 ) continue; dist /= dotNorm; @@ -395,16 +395,16 @@ hsBool plVisLOSMgr::ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest) // Find the 3 cross products (v[i+1]-v[i]) X (proj - v[i]) dotted with current ray hsVector3 cross0 = hsVector3(&p1, &p0) % hsVector3(&projPt, &p0); - hsScalar dot0 = cross0.InnerProduct(currDir); + float dot0 = cross0.InnerProduct(currDir); hsVector3 cross1 = hsVector3(&p2, &p1) % hsVector3(&projPt, &p1); - hsScalar dot1 = cross1.InnerProduct(currDir); + float dot1 = cross1.InnerProduct(currDir); hsVector3 cross2 = hsVector3(&p3, &p2) % hsVector3(&projPt, &p2); - hsScalar dot2 = cross2.InnerProduct(currDir); + float dot2 = cross2.InnerProduct(currDir); hsVector3 cross3 = hsVector3(&p0, &p3) % hsVector3(&projPt, &p3); - hsScalar dot3 = cross3.InnerProduct(currDir); + float dot3 = cross3.InnerProduct(currDir); // If all 4 are negative, projPt is a hit if( (dot0 <= 0) && (dot1 <= 0) && (dot2 <= 0) && (dot3 <= 0) ) @@ -422,7 +422,7 @@ hsBool plVisLOSMgr::CursorCheck(plVisHit& hit) int32_t sy= int32_t(plMouseDevice::Instance()->GetCursorY() * fPipe->Height()); hsPoint3 from = fPipe->GetViewPositionWorld(); - plConst(hsScalar) dist(1.e5f); + plConst(float) dist(1.e5f); hsPoint3 targ; fPipe->ScreenToWorldPoint(1, 0, &sx, &sy, dist, 0, &targ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h index 0fad5eb3..ec76ce52 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plVisLOSMgr.h @@ -65,7 +65,7 @@ class plSpaceHit { public: int fIdx; - hsScalar fClosest; + float fClosest; }; class plVisLOSMgr @@ -74,13 +74,13 @@ protected: plPageTreeMgr* fPageMgr; plPipeline* fPipe; - hsScalar fMaxDist; + float fMaxDist; hsPoint3 fCurrFrom; hsPoint3 fCurrTarg; hsBool ISetup(const hsPoint3& pStart, const hsPoint3& pEnd); - hsBool ICheckBound(const hsBounds3Ext& bnd, hsScalar& closest); + hsBool ICheckBound(const hsBounds3Ext& bnd, float& closest); hsBool ICheckSpaceTreeRecur(plSpaceTree* space, int which, hsTArray& hits); hsBool ICheckSpaceTree(plSpaceTree* space, hsTArray& hits); hsBool ICheckSceneNode(plSceneNode* node, plVisHit& hit); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp index 0c6cf994..6ff54df2 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp @@ -115,29 +115,29 @@ using namespace plShaderID; // #define TEST_UVWS -static const hsScalar kPiOverTwo = hsScalarPI * 0.5f; +static const float kPiOverTwo = M_PI * 0.5f; -static const hsScalar kGravConst = 30.f; +static const float kGravConst = 30.f; -static const hsScalar kOOEightNsqPI = 1.f / (8.f * hsScalarPI * 4.f * 4.f); -static hsScalar currOOEightNsqPI = kOOEightNsqPI; +static const float kOOEightNsqPI = 1.f / (8.f * M_PI * 4.f * 4.f); +static float currOOEightNsqPI = kOOEightNsqPI; -static inline hsScalar FreqToLen(hsScalar f) { return 2.f * hsScalarPI / f; } -static inline hsScalar LenToFreq(hsScalar l) { return 2.f * hsScalarPI / l; } +static inline float FreqToLen(float f) { return 2.f * M_PI / f; } +static inline float LenToFreq(float l) { return 2.f * M_PI / l; } -static inline hsScalar MPH2FPS(hsScalar f) { return f * 5280.f / 3600.f; } -static inline hsScalar FPS2MPH(hsScalar f) { return f / 5280.f * 3600.f; } +static inline float MPH2FPS(float f) { return f * 5280.f / 3600.f; } +static inline float FPS2MPH(float f) { return f / 5280.f * 3600.f; } -plCONST(hsScalar) kTimeClamp(0.3f); +plCONST(float) kTimeClamp(0.3f); inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) const { - hsScalar dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY; + float dist = accumPos.fX * fDir.fX + accumPos.fY * fDir.fY; dist *= fFreq; dist += fPhase; - hsScalar s, c; + float s, c; hsFastMath::SinCosAppr(dist, s, c); // s += 1.f; @@ -153,11 +153,11 @@ inline void plWorldWave7::Accumulate(hsPoint3& accumPos, hsVector3& accumNorm) c } #ifndef PLASMA_EXTERNAL_RELEASE -inline void plWaveSet7::GraphLen(hsScalar len) const +inline void plWaveSet7::GraphLen(float len) const { if( fStatusGraph ) { - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; int32_t val = int32_t(len / maxLen * 100.f); fStatusGraph->AddData(val); } @@ -226,7 +226,7 @@ void plWaveSet7::StopLog() fStatusLog = nil; } #else // PLASMA_EXTERNAL_RELEASE -inline void plWaveSet7::GraphLen(hsScalar len) const +inline void plWaveSet7::GraphLen(float len) const { } @@ -456,7 +456,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg) } } - hsScalar dt = update->DelSeconds(); + float dt = update->DelSeconds(); if( dt > kTimeClamp ) dt = kTimeClamp; @@ -474,7 +474,7 @@ hsBool plWaveSet7::MsgReceive(plMessage* msg) fCurrTime = hsTimer::GetSysSeconds(); // Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS. - hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); if( dt > kTimeClamp ) dt = kTimeClamp; @@ -753,7 +753,7 @@ hsBool plWaveSet7::IOnRemove(plGenRefMsg* refMsg) return false; } -void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur) +void plWaveSet7::SetState(const plFixedWaterState7& state, float dur) { fState.Set(state, dur); @@ -764,7 +764,7 @@ void plWaveSet7::SetState(const plFixedWaterState7& state, hsScalar dur) } } -void plWaveSet7::IUpdateWaves(hsScalar dt) +void plWaveSet7::IUpdateWaves(float dt) { ITransition(dt); ITransTex(dt); @@ -786,9 +786,9 @@ void plWaveSet7::IUpdateWaves(hsScalar dt) } // return true if we've finished this transition. -hsBool plWaveSet7::ITransContinue(hsScalar dt) +hsBool plWaveSet7::ITransContinue(float dt) { - hsScalar currFade = (fFreqMod[fTransistor] += fTransDel * dt); + float currFade = (fFreqMod[fTransistor] += fTransDel * dt); if( currFade <= 0 ) { @@ -814,24 +814,24 @@ hsBool plWaveSet7::ITransContinue(hsScalar dt) return false; } -void plWaveSet7::IStartTransition(hsScalar dt) +void plWaveSet7::IStartTransition(float dt) { // select the next wave for transitioning if( ++fTransistor >= kNumWaves ) fTransistor = 0; // set the transFade to be fading down. - plCONST(hsScalar) kTransDel(0.5f); + plCONST(float) kTransDel(0.5f); fTransDel = -kTransDel; } -hsScalar plWaveSet7::ITransitionDelay() const +float plWaveSet7::ITransitionDelay() const { - plCONST(hsScalar) kTransDelay(2.f); + plCONST(float) kTransDelay(2.f); return kTransDelay; } -void plWaveSet7::ITransition(hsScalar dt) +void plWaveSet7::ITransition(float dt) { // If we're in a transition, keep transitioning till it's done. if( fTransDel != 0 ) @@ -847,9 +847,9 @@ void plWaveSet7::ITransition(hsScalar dt) } -hsBool plWaveSet7::ITransTexContinue(hsScalar dt) +hsBool plWaveSet7::ITransTexContinue(float dt) { - hsScalar currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt); + float currFade = (fTexWaveFade[fTexTrans] += fTexTransDel * dt); if( currFade <= 0 ) { @@ -875,22 +875,22 @@ hsBool plWaveSet7::ITransTexContinue(hsScalar dt) return false; } -void plWaveSet7::IStartTexTransition(hsScalar dt) +void plWaveSet7::IStartTexTransition(float dt) { if( ++fTexTrans >= kNumTexWaves ) fTexTrans = 0; - plConst(hsScalar) kTexTransDel(4.f); + plConst(float) kTexTransDel(4.f); fTexTransDel = -kTexTransDel; } -void plWaveSet7::ITransTex(hsScalar dt) +void plWaveSet7::ITransTex(float dt) { // If we're in a transition, keep with it. if( fTexTransDel != 0 ) { - plConst(hsScalar) kTexTransDelay(0); + plConst(float) kTexTransDelay(0); if( ITransTexContinue(dt) ) fTexTransCountDown = kTexTransDelay; } @@ -905,20 +905,20 @@ void plWaveSet7::ICalcScale() { } -void plWaveSet7::IUpdateWave(hsScalar dt, int i) +void plWaveSet7::IUpdateWave(float dt, int i) { plWorldWave7& wave = fWorldWaves[i]; - hsScalar len = FreqToLen(wave.fFreq); + float len = FreqToLen(wave.fFreq); - hsScalar speed = hsFastMath::InvSqrtAppr(len / (2.f * hsScalarPI * kGravConst)); + float speed = hsFastMath::InvSqrtAppr(len / (2.f * M_PI * kGravConst)); - static hsScalar speedHack = 1.f; + static float speedHack = 1.f; speed *= speedHack; wave.fPhase += speed * dt; -// wave.fPhase = fmod( speed * t, 2.f * hsScalarPI); +// wave.fPhase = fmod( speed * t, 2.f * M_PI); - hsScalar amp = GeoState().fAmpOverLen * len / hsScalar(kNumWaves); + float amp = GeoState().fAmpOverLen * len / float(kNumWaves); amp *= fFreqMod[i] * fFreqScale; @@ -945,7 +945,7 @@ void plWaveSet7::IInitWave(int i) wave.fLength = GeoState().fMinLength + fRand.RandZeroToOne() * (GeoState().fMaxLength - GeoState().fMinLength); - hsScalar len = wave.fLength; + float len = wave.fLength; wave.fFreq = LenToFreq(len); @@ -956,18 +956,18 @@ void plWaveSet7::IInitWave(int i) // Figure out the direction based on wind direction. // Even waves go in the wind direction, // odd waves go opposite direction - plConst(hsScalar) kMinRotDeg(15.f); - plConst(hsScalar) kMaxRotDeg(180.f); + plConst(float) kMinRotDeg(15.f); + plConst(float) kMaxRotDeg(180.f); hsVector3 dir = fWindDir; - hsScalar rotBase = GeoState().fAngleDev; + float rotBase = GeoState().fAngleDev; - hsScalar rads = rotBase * fRand.RandMinusOneToOne(); - hsScalar rx = hsScalar(cosf(rads)); - hsScalar ry = hsScalar(sinf(rads)); + float rads = rotBase * fRand.RandMinusOneToOne(); + float rx = float(cosf(rads)); + float ry = float(sinf(rads)); - hsScalar x = dir.fX; - hsScalar y = dir.fY; + float x = dir.fX; + float y = dir.fY; dir.fX = x * rx + y * ry; dir.fY = x * -ry + y * rx; @@ -985,7 +985,7 @@ inline void plWaveSet7::IScrunch(hsPoint3& pos, hsVector3& norm) const hsFastMath::NormalizeAppr(norm); } -hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) +float plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) { hsPoint3 accumPos; hsVector3 accumNorm; @@ -1003,7 +1003,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) IScrunch(accumPos, accumNorm); // Project original pos along Z onto the plane tangent at accumPos with norm accumNorm - hsScalar t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm); + float t = hsVector3(&accumPos, &pos).InnerProduct(accumNorm); t /= accumNorm.fZ; pos.fZ += t; @@ -1013,7 +1013,7 @@ hsScalar plWaveSet7::EvalPoint(hsPoint3& pos, hsVector3& norm) return pos.fZ; } -void plWaveSet7::IUpdateWindDir(hsScalar dt) +void plWaveSet7::IUpdateWindDir(float dt) { fWindDir = -State().fWindDir; hsFastMath::NormalizeAppr(fWindDir); @@ -1025,10 +1025,10 @@ void plWaveSet7::IUpdateRefObject() { hsMatrix44 l2w = fRefObj->GetLocalToWorld(); - hsScalar h = l2w.fMap[2][3]; + float h = l2w.fMap[2][3]; - hsScalar x = -l2w.fMap[0][1]; - hsScalar y = -l2w.fMap[1][1]; + float x = -l2w.fMap[0][1]; + float y = -l2w.fMap[1][1]; fState.fWaterHeight = h; @@ -1036,7 +1036,7 @@ void plWaveSet7::IUpdateRefObject() } } -void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) +void plWaveSet7::IFloatBuoy(float dt, plSceneObject* so) { // Compute force based on world bounds hsBounds3Ext wBnd = so->GetDrawInterface()->GetWorldBounds(); @@ -1052,8 +1052,8 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) // (in an approximation lazy hackish way). hsPoint2 boxDepth; wBnd.TestPlane(surfNorm, boxDepth); - hsScalar surfDepth = surfNorm.InnerProduct(surfPos); - hsScalar depth = surfDepth - boxDepth.fX; + float surfDepth = surfNorm.InnerProduct(surfPos); + float depth = surfDepth - boxDepth.fX; if( depth < 0 ) return; @@ -1063,12 +1063,12 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) // We really want the cross section area as facing into the water, // but life is full of little disappointments. - hsScalar area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY); + float area = (wBnd.GetMaxs().fX - wBnd.GetMins().fX) * (wBnd.GetMaxs().fY - wBnd.GetMins().fY); - hsScalar volume = area * depth; + float volume = area * depth; - plCONST(hsScalar) kWaterDensity(1.0f); - hsScalar forceMag = volume * kWaterDensity; + plCONST(float) kWaterDensity(1.0f); + float forceMag = volume * kWaterDensity; // surfNorm is now the impulse vector. But where to apply it. // Don't currently have anything informative from the physical to use. @@ -1080,7 +1080,7 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) // iMsg->Send(); #if 0 - plCONST(hsScalar) kRotScale(1.f); + plCONST(float) kRotScale(1.f); hsVector3 rotAx = hsVector3(0, 0, 1.f) % surfNorm; rotAx *= kRotScale * dt * volume; @@ -1088,12 +1088,12 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) aMsg->Send(); #endif - plCONST(hsScalar) kDampener(0.1f); - plCONST(hsScalar) kBaseDamp(0.1f); + plCONST(float) kDampener(0.1f); + plCONST(float) kBaseDamp(0.1f); if( wBnd.GetMaxs().fZ > wBnd.GetMins().fZ ) { // Remember, we've already limited depth to be <= Max.fZ - Min.fZ; - hsScalar damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ); + float damp = depth / (wBnd.GetMaxs().fZ - wBnd.GetMins().fZ); damp *= kDampener; damp += kBaseDamp; @@ -1102,7 +1102,7 @@ void plWaveSet7::IFloatBuoy(hsScalar dt, plSceneObject* so) } } -void plWaveSet7::IFloatBuoys(hsScalar dt) +void plWaveSet7::IFloatBuoys(float dt) { int i; for( i = 0; i < fBuoys.GetCount(); i++ ) @@ -1171,7 +1171,7 @@ void plWaveSet7::ICheckTargetMaterials() if( !fTargBnds.GetCount() ) fTargBnds.SetCount(1); - plConst(hsScalar) kMaxWaveHeight(5.f); + plConst(float) kMaxWaveHeight(5.f); hsPoint3 p; p = targBnd.GetMins(); @@ -1239,39 +1239,39 @@ class plFilterMask { protected: int fExt; - hsScalar **fMask; + float **fMask; public: - plFilterMask( hsScalar sig ); + plFilterMask( float sig ); virtual ~plFilterMask(); int Begin() const { return -fExt; } int End() const { return fExt; } - hsScalar Mask( int i, int j ) const { return fMask[ i ][ j ]; } + float Mask( int i, int j ) const { return fMask[ i ][ j ]; } }; // End evil. void plWaveSet7::IInitState() { - plConst(hsScalar) kWaterTable(-10.f); - plConst(hsScalar) kWaterOffset[3] = { 3.f, 3.f, 0.f }; - plConst(hsScalar) kMaxAtten[3] = { 1.f, 1.f, 1.f }; - plConst(hsScalar) kMinAtten[3] = { 0.f, 0.f, 0.f }; - plConst(hsScalar) kDepthFalloff[3] = { 4.f, 4.f, 6.f }; + plConst(float) kWaterTable(-10.f); + plConst(float) kWaterOffset[3] = { 3.f, 3.f, 0.f }; + plConst(float) kMaxAtten[3] = { 1.f, 1.f, 1.f }; + plConst(float) kMinAtten[3] = { 0.f, 0.f, 0.f }; + plConst(float) kDepthFalloff[3] = { 4.f, 4.f, 6.f }; - plConst(hsScalar) kGeoMinLen(3.f); - plConst(hsScalar) kGeoMaxLen(8.f); - plConst(hsScalar) kGeoAmpOverLen(0.1f); - plConst(hsScalar) kGeoAngleDev(30.f * hsScalarPI / 180.f); - plConst(hsScalar) kGeoChop(1.f); + plConst(float) kGeoMinLen(3.f); + plConst(float) kGeoMaxLen(8.f); + plConst(float) kGeoAmpOverLen(0.1f); + plConst(float) kGeoAngleDev(30.f * M_PI / 180.f); + plConst(float) kGeoChop(1.f); - plConst(hsScalar) kTexMinLen(4.f); - plConst(hsScalar) kTexMaxLen(30.f); - plConst(hsScalar) kTexAmpOverLen(0.1f); - plConst(hsScalar) kTexAngleDev(30.f * hsScalarPI / 180.f); - plConst(hsScalar) kTexChop(1.f); + plConst(float) kTexMinLen(4.f); + plConst(float) kTexMaxLen(30.f); + plConst(float) kTexAmpOverLen(0.1f); + plConst(float) kTexAngleDev(30.f * M_PI / 180.f); + plConst(float) kTexChop(1.f); plFixedWaterState7 state; @@ -1291,9 +1291,9 @@ void plWaveSet7::IInitState() state.fRippleScale = 25.f; - plConst(hsScalar) kNoise(1.f); - plConst(hsScalar) kSpecStart(50.f); - plConst(hsScalar) kSpecEnd(10000.f); + plConst(float) kNoise(1.f); + plConst(float) kSpecStart(50.f); + plConst(float) kSpecEnd(10000.f); hsVector3 spec; spec[state.kNoise] = kNoise; @@ -1405,20 +1405,20 @@ void plWaveSet7::ISetupTextureWaves() void plWaveSet7::IInitTexWave(int i) { - hsScalar rads = fRand.RandMinusOneToOne() * TexState().fAngleDev; - hsScalar dx = sin(rads); - hsScalar dy = cos(rads); + float rads = fRand.RandMinusOneToOne() * TexState().fAngleDev; + float dx = sin(rads); + float dy = cos(rads); - hsScalar tx = dx; + float tx = dx; dx = fWindDir.fY * dx - fWindDir.fX * dy; dy = fWindDir.fX * tx + fWindDir.fY * dy; - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; - hsScalar minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale; - hsScalar len = hsScalar(i) / hsScalar(kNumTexWaves-1) * (maxLen - minLen) + minLen; + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + float minLen = TexState().fMinLength * kCompositeSize / State().fRippleScale; + float len = float(i) / float(kNumTexWaves-1) * (maxLen - minLen) + minLen; - hsScalar reps = hsScalar(kCompositeSize) / len; + float reps = float(kCompositeSize) / len; dx *= reps; dy *= reps; @@ -1428,9 +1428,9 @@ void plWaveSet7::IInitTexWave(int i) fTexWaves[i].fRotScale00 = dx; fTexWaves[i].fRotScale01 = dy; - hsScalar effK = hsFastMath::InvSqrt(dx*dx + dy*dy); - fTexWaves[i].fLen = hsScalar(kCompositeSize) * effK; - fTexWaves[i].fFreq = hsScalarPI * 2.f / fTexWaves[i].fLen; + float effK = hsFastMath::InvSqrt(dx*dx + dy*dy); + fTexWaves[i].fLen = float(kCompositeSize) * effK; + fTexWaves[i].fFreq = M_PI * 2.f / fTexWaves[i].fLen; fTexWaves[i].fAmp = fTexWaves[i].fLen * TexState().fAmpOverLen; fTexWaves[i].fPhase = fRand.RandZeroToOne(); @@ -1470,20 +1470,20 @@ void plWaveSet7::RemoveDynaDecalMgr(plKey& key) ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// -void plWaveSet7::IUpdateLayers(hsScalar dt) +void plWaveSet7::IUpdateLayers(float dt) { IUpdateBumpLayers(dt); ISubmitRenderRequests(); } -void plWaveSet7::IUpdateBumpLayers(hsScalar dt) +void plWaveSet7::IUpdateBumpLayers(float dt) { - plCONST(hsScalar) speedHack(1.f / 3.f); + plCONST(float) speedHack(1.f / 3.f); int i; for( i = 0; i < kNumTexWaves; i++ ) { - hsScalar speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * hsScalarPI * kGravConst)) * speedHack; + float speed = hsFastMath::InvSqrtAppr(fTexWaves[i].fLen / (2.f * M_PI * kGravConst)) * speedHack; fTexWaves[i].fPhase -= dt * speed; fTexWaves[i].fPhase -= int(fTexWaves[i].fPhase); @@ -1518,7 +1518,7 @@ void plWaveSet7::ISubmitRenderRequests() } } -plMipmap* plWaveSet7::ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const +plMipmap* plWaveSet7::ICreateBumpBitmapFFP(float amp, float dx, float dy) const { return nil; } @@ -1627,8 +1627,8 @@ plMipmap* plWaveSet7::ICreateBiasNoiseMap() int j; for( j = 0; j < size; j++ ) { - hsScalar x = fRand.RandMinusOneToOne(); - hsScalar y = fRand.RandMinusOneToOne(); + float x = fRand.RandMinusOneToOne(); + float y = fRand.RandMinusOneToOne(); uint8_t r = uint8_t((x * 0.5f + 0.5f) * 255.999f); uint8_t g = uint8_t((y * 0.5f + 0.5f) * 255.999f); @@ -1681,13 +1681,13 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS() int i; for( i = 0; i < sizeU; i++ ) { - hsScalar y = hsScalar(i); - hsScalar dist = hsScalar(i) / hsScalar(sizeU-1) * 2.f * hsScalarPI; - hsScalar c = cos(dist); - hsScalar s = sin(dist); + float y = float(i); + float dist = float(i) / float(sizeU-1) * 2.f * M_PI; + float c = cos(dist); + float s = sin(dist); s *= 0.5f; s += 0.5f; - s = hsScalar(pow(s, TexState().fChop)); + s = float(pow(s, TexState().fChop)); c *= s; uint8_t cosDist = uint8_t((c * 0.5 + 0.5) * 255.999f); int j; @@ -1888,7 +1888,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer) 2.f); hsVector3 specVec = State().fSpecVec; - hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]); vShader->SetVector(plBiasVS::kScaleBias, biasScale, biasScale, @@ -2007,8 +2007,8 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst, for( iLay = 0; iLay < kBumpPerPass; iLay++ ) { pShader->SetVector(plBumpPS::kWave0, - -fTexWaves[iBase + iLay].fDirX * (1.f / hsScalar(kBumpPerPass)), - -fTexWaves[iBase + iLay].fDirY * (1.f / hsScalar(kBumpPerPass)), + -fTexWaves[iBase + iLay].fDirX * (1.f / float(kBumpPerPass)), + -fTexWaves[iBase + iLay].fDirY * (1.f / float(kBumpPerPass)), 1.f, 1.f); } @@ -2120,7 +2120,7 @@ plDrawableSpans* plWaveSet7::ICreateClearDrawable(plDrawableSpans* drawable, hsG return drawable; } -plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri) +plRenderRequest* plWaveSet7::ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri) { plRenderRequest* req = TRACKED_NEW plRenderRequest; @@ -2316,12 +2316,12 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat) vShader->SetVector(plShoreVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plShoreVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plShoreVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plShoreVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); - plConst(hsScalar) kK1(0.5f); - plConst(hsScalar) kK2(1.5f); - hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2); + plConst(float) kK1(0.5f); + plConst(float) kK2(1.5f); + float negK1OverK2Sq = -kK1 / (kK2 * kK2); vShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f); vShader->SetNumPipeConsts(5); @@ -2394,7 +2394,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs) vShader->SetVector(plFixedVS7::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plFixedVS7::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plFixedVS7::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plFixedVS7::kNumericConsts, 0, 0.5f, 1.f, 2.f); vShader->SetNumPipeConsts(5); @@ -2493,7 +2493,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC vShader->SetVector(plRipVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plRipVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plRipVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plRipVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); hsVector3 waterOffset = State().fWaterOffset; @@ -2533,7 +2533,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC ripConsts.fLife, 1.f / (ripConsts.fLife - ripConsts.fDecay)); - plConst(hsScalar) kRipBias(0.1); + plConst(float) kRipBias(0.1); vShader->SetVector(plRipVS::kRampBias, ripConsts.fRamp, 1.f / ripConsts.fRamp, @@ -2639,7 +2639,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) vShader->SetVector(plWaveDecVS::kSinConsts, 1.f, -1.f/6.f, 1.f/120.f, -1.f/5040.f); vShader->SetVector(plWaveDecVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); - vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plWaveDecVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plWaveDecVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); hsVector3 waterOffset = State().fWaterOffset; @@ -2665,7 +2665,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t) 0.f ); - plConst(hsScalar) kBias(0.1); + plConst(float) kBias(0.1); vShader->SetVector(plWaveDecVS::kBias, kBias, 0, @@ -2861,16 +2861,16 @@ void plWaveSet7::IUpdateBumpPShader(plPipeline* pipe, const hsMatrix44& l2w, con int iTex = i*kBumpPerPass + j; hsVector3 specVec = State().fSpecVec; - hsScalar scale = 1.f / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float scale = 1.f / (float(kNumBumpShaders) + specVec[State().kNoise]); - hsScalar maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; - hsScalar rescale = fTexWaves[iTex].fLen / maxLen; + float maxLen = TexState().fMaxLength * kCompositeSize / State().fRippleScale; + float rescale = fTexWaves[iTex].fLen / maxLen; - hsScalar bias = 0.5f * scale; + float bias = 0.5f * scale; fBumpPShader[i]->SetVector(plBumpPS::kHalfOne, scale, scale, 1.f, 1.f); fBumpPShader[i]->SetVector(plBumpPS::kBias, bias, bias, 1.f, 1.f); - hsScalar layScale = skip & (1 << iTex) ? 0.f : (1.f / hsScalar(kBumpPerPass)); + float layScale = skip & (1 << iTex) ? 0.f : (1.f / float(kBumpPerPass)); layScale *= fTexWaveFade[iTex]; fBumpPShader[i]->SetVector(plBumpPS::kWave0 + j, @@ -2887,9 +2887,9 @@ void plWaveSet7::IUpdateBumpVShader(plPipeline* pipe, const hsMatrix44& l2w, con { } -static inline hsScalar IRound(hsScalar f) +static inline float IRound(float f) { - return hsScalar(int(f + (f > 0 ? 0.5f : -0.5f))); + return float(int(f + (f > 0 ? 0.5f : -0.5f))); } void plWaveSet7::IUpdateBiasVShader() @@ -2898,24 +2898,24 @@ void plWaveSet7::IUpdateBiasVShader() if( fBiasVShader ) { // Can't just use GetDelSysSeconds() or else we lose time if we skip a frame render because of high FPS. - hsScalar dt = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); - plConst(hsScalar) kRate(-0.1f); - hsScalar tx = kRate * dt; - hsScalar ty = kRate * dt; - plConst(hsScalar) kScaleU(4.f); - plConst(hsScalar) kScaleV(1.f); + float dt = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + plConst(float) kRate(-0.1f); + float tx = kRate * dt; + float ty = kRate * dt; + plConst(float) kScaleU(4.f); + plConst(float) kScaleV(1.f); tx += fBiasVShader->GetFloat(plBiasVS::kTexU0, 3); - tx -= hsScalar(int(tx)); + tx -= float(int(tx)); ty += fBiasVShader->GetFloat(plBiasVS::kTexV0, 3); - ty -= hsScalar(int(ty)); + ty -= float(int(ty)); - hsScalar scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/hsScalarPI; + float scale = 1.f + (4.f - 1.f) * TexState().fAngleDev/M_PI; - hsScalar m00 = IRound(fWindDir.fY * scale); - hsScalar m01 = IRound(fWindDir.fX * scale); - hsScalar m10 = IRound(-fWindDir.fX * 4.f); - hsScalar m11 = IRound(fWindDir.fY * 4.f); + float m00 = IRound(fWindDir.fY * scale); + float m01 = IRound(fWindDir.fX * scale); + float m10 = IRound(-fWindDir.fX * 4.f); + float m11 = IRound(fWindDir.fY * 4.f); fBiasVShader->SetVector(plBiasVS::kTexU0, m00, @@ -2928,8 +2928,8 @@ void plWaveSet7::IUpdateBiasVShader() 0, ty); - plConst(hsScalar) kUpperNoiseOffU(0.f); - plConst(hsScalar) kUpperNoiseOffV(0.3f); + plConst(float) kUpperNoiseOffU(0.f); + plConst(float) kUpperNoiseOffV(0.3f); fBiasVShader->SetVector(plBiasVS::kTexU1, m00, m01, @@ -2942,7 +2942,7 @@ void plWaveSet7::IUpdateBiasVShader() ty + kUpperNoiseOffV); hsVector3 specVec = State().fSpecVec; - hsScalar biasScale = 0.5f * specVec[State().kNoise] / (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + float biasScale = 0.5f * specVec[State().kNoise] / (float(kNumBumpShaders) + specVec[State().kNoise]); fBiasVShader->SetVector(plBiasVS::kScaleBias, biasScale, biasScale, @@ -3011,7 +3011,7 @@ void plWaveSet7::IUpdateRipVShader(plPipeline* pipe, const hsMatrix44& l2w, cons int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fRipVShader->SetVector(plRipVS::kQADirX, @@ -3083,10 +3083,10 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe) hsPoint3 envCenter(State().fEnvCenter); - hsScalar envRadius = State().fEnvRadius; + float envRadius = State().fEnvRadius; hsVector3 camToCen(&envCenter, &worldCam); - hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius; + float G = camToCen.MagnitudeSquared() - envRadius * envRadius; shader->SetVectorW(plWaveDecVS::kEnvAdjust, camToCen, G); } @@ -3095,7 +3095,7 @@ void plWaveSet7::IUpdateDecVShader(int t, plPipeline* pipe) int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } shader->SetVector(plWaveDecVS::kQADirX, @@ -3213,16 +3213,16 @@ void plWaveSet7::IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, co fWorldWaves[2].fLength, fWorldWaves[3].fLength); - plConst(hsScalar) kK1(2.f); - plConst(hsScalar) kK2(5.f); - hsScalar negK1OverK2Sq = -kK1 / (kK2 * kK2); + plConst(float) kK1(2.f); + plConst(float) kK2(5.f); + float negK1OverK2Sq = -kK1 / (kK2 * kK2); fShoreVShader->SetVector(plShoreVS::kIncline, negK1OverK2Sq, kK1, 0.f, 0.f); float normQ[kNumWaves]; int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fShoreVShader->SetVector(plShoreVS::kQADirX, @@ -3279,18 +3279,18 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co fWorldWaves[2].fDir.fY, fWorldWaves[3].fDir.fY); - plCONST(hsScalar) kEnvRadius(500.f); - hsScalar envRadius = State().fEnvRadius; + plCONST(float) kEnvRadius(500.f); + float envRadius = State().fEnvRadius; hsPoint3 worldCam = pipe->GetViewTransform().GetCameraToWorld().GetTranslate(); hsPoint3 envCenter(State().fEnvCenter); hsVector3 camToCen(&envCenter, &worldCam); - hsScalar G = camToCen.MagnitudeSquared() - envRadius * envRadius; + float G = camToCen.MagnitudeSquared() - envRadius * envRadius; fFixedVShader->SetVectorW(plFixedVS7::kEnvAdjust, camToCen, G); - hsScalar texScale = 1.f / State().fRippleScale; + float texScale = 1.f / State().fRippleScale; fFixedVShader->SetVector(plFixedVS7::kUVScale, texScale, @@ -3298,21 +3298,21 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co 0, 0); - hsScalar specAtten = State().fTexState.fAmpOverLen * hsScalarPI * 2.f; + float specAtten = State().fTexState.fAmpOverLen * M_PI * 2.f; - plCONST(hsScalar) kScaleHack(0.1f); - hsScalar baseScale = kScaleHack; -// baseScale *= hsScalar(kBumpPerPass) * (hsScalar(kNumBumpShaders) + State().fSpecVec[State().kNoise]); + plCONST(float) kScaleHack(0.1f); + float baseScale = kScaleHack; +// baseScale *= float(kBumpPerPass) * (float(kNumBumpShaders) + State().fSpecVec[State().kNoise]); // Not sure what's right here. but we are currently scaling down by 1/(numBumpShaders + noise), // so I guess we want to scale up by that amount here. Not sure we shouldn't figuring in bumpperpass // on both, but at least now we're consistent. hsVector3 specVec = State().fSpecVec; - baseScale *= (hsScalar(kNumBumpShaders) + specVec[State().kNoise]); + baseScale *= (float(kNumBumpShaders) + specVec[State().kNoise]); baseScale *= (TexState().fChop + 1.f); - hsScalar specStart = specVec[State().kSpecStart]; - hsScalar specEnd = specVec[State().kSpecEnd]; + float specStart = specVec[State().kSpecStart]; + float specEnd = specVec[State().kSpecEnd]; if( specStart > specEnd ) specEnd = specStart + 1.f; fFixedVShader->SetVector(plFixedVS7::kSpecAtten, @@ -3370,7 +3370,7 @@ void plWaveSet7::IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, co int i; for( i = 0; i < kNumWaves; i++ ) { - normQ[i] = GeoState().fChop / (2.f*hsScalarPI * GeoState().fAmpOverLen * kNumWaves); + normQ[i] = GeoState().fChop / (2.f*M_PI * GeoState().fAmpOverLen * kNumWaves); } fFixedVShader->SetVector(plFixedVS7::kDirXK, @@ -3631,7 +3631,7 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG int iDn = i << 1; int iUp = iDn + 1; - hsScalar delX = hsScalar(i) / hsScalar(nWid-1); + float delX = float(i) / float(nWid-1); pos[iDn].fX = delX * 2.f - 1.f; pos[iDn].fY = -1.f; @@ -3762,8 +3762,8 @@ plMipmap* plWaveSet7::ICreateGraphShoreTex(int width, int height) { plMipmap* mipMap = ICreateBlankTex("Graph", width, height, kRefGraphShoreTex); - plConst(hsScalar) kRampFrac(0.4f); - plConst(hsScalar) kTruncFrac(0.8f); + plConst(float) kRampFrac(0.4f); + plConst(float) kTruncFrac(0.8f); const int rampEnd = int(kRampFrac * height + 0.5f); int truncEnd = int(kTruncFrac * height); if( truncEnd >= (height-1) ) @@ -3825,10 +3825,10 @@ void plWaveSet7::IRefillBubbleShoreTex() int jLoc = (int)(fRand.RandZeroToOne() * height); // Select a random radius - plConst(hsScalar) kMinRad(2.f); - plConst(hsScalar) kMaxRad(5.0f); + plConst(float) kMinRad(2.f); + plConst(float) kMaxRad(5.0f); int radius = int(kMinRad + fRand.RandZeroToOne() * (kMaxRad - kMinRad)); - hsScalar invRadiusSq = 1.f / hsScalar(radius*radius); + float invRadiusSq = 1.f / float(radius*radius); // Carve out a hole. int j; @@ -3849,17 +3849,17 @@ void plWaveSet7::IRefillBubbleShoreTex() else if( ii >= width ) ii -= width; - hsScalar f = hsScalar(i*i + j*j) * invRadiusSq; + float f = float(i*i + j*j) * invRadiusSq; if( f > 1.f ) f = 1.f; - plConst(hsScalar) kMinAlpha(0.8f); - plConst(hsScalar) kMaxAlpha(1.f); + plConst(float) kMinAlpha(0.8f); + plConst(float) kMaxAlpha(1.f); f *= (kMaxAlpha - kMinAlpha); f += kMinAlpha; uint32_t* val = mipMap->GetAddr32(ii, jj); uint32_t alpha = (*val) >> 24; - alpha = uint32_t(hsScalar(alpha) * f); + alpha = uint32_t(float(alpha) * f); *val &= 0x00ffffff; *val |= (alpha << 24); } @@ -3877,7 +3877,7 @@ void plWaveSet7::IRefillBubbleShoreTex() uint32_t* val = mipMap->GetAddr32(i, j); hsColorRGBA col; col.FromARGB32(*val); - hsScalar alpha = col.a; + float alpha = col.a; col = maxColor - minColor; col *= alpha; col += minColor; @@ -3915,8 +3915,8 @@ void plWaveSet7::IRefillEdgeShoreTex() const int width = mipMap->GetWidth(); const int height = mipMap->GetHeight(); - plConst(hsScalar) kCenter(0.8f); - plConst(hsScalar) kRadius(0.025f); + plConst(float) kCenter(0.8f); + plConst(float) kRadius(0.025f); const int center = int(kCenter * height); @@ -3924,11 +3924,11 @@ void plWaveSet7::IRefillEdgeShoreTex() const int top = center + radius; const int bot = center - radius; - const hsScalar invRadiusSq = 1.f / hsScalar(radius*radius); + const float invRadiusSq = 1.f / float(radius*radius); hsAssert(top < height-1, "Center too high or radius too big"); - const hsScalar maxAlpha = State().fEdgeOpac * 255.9f; + const float maxAlpha = State().fEdgeOpac * 255.9f; int j; for( j = 0; j < height; j++ ) { @@ -3936,21 +3936,21 @@ void plWaveSet7::IRefillEdgeShoreTex() if( (j > bot)&&(j < top) ) { #if 0 // like x^2 - hsScalar a = hsScalar(j-center); + float a = float(j-center); a *= a; a *= invRadiusSq; a = 1.f - a; #elif 1 // like 1/x^2 - hsScalar a = hsScalar(j-center); + float a = float(j-center); if( a < 0 ) a = -a; - a /= hsScalar(radius); + a /= float(radius); a = 1.f - a; a *= a; #else // like cos - hsScalar a = hsScalar(j - center); - a /= hsScalar(radius); - a *= hsScalarPI; + float a = float(j - center); + a /= float(radius); + a *= M_PI; a = hsFastMath::CosInRange(a); a += 1.f; a *= 0.5f; @@ -4154,7 +4154,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass) vShader->SetNumConsts(plGraphVS::kNumConsts); vShader->SetVector(plGraphVS::kNumericConsts, 0, 0.5f, 1.f, 2.f); - vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*hsScalarPI), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plGraphVS::kPiConsts, 1.f / (2.f*M_PI), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plGraphVS::kCosConsts, 1.f, -1.f/2.f, 1.f/24.f, -1.f/720.f); #ifndef TEST_UVWS @@ -4333,9 +4333,9 @@ void plWaveSet7::IInitGraph(int iPass) static int lastOne = 0; - plConst(hsScalar) kBasePeriod(3.f); - hsScalar life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne()); - gs.fInvLife = (1.f + hsScalar(lastOne)/hsScalar(kGraphShorePasses-1)) / life; + plConst(float) kBasePeriod(3.f); + float life = State().fPeriod * kBasePeriod * (1.f + fRand.RandZeroToOne()); + gs.fInvLife = (1.f + float(lastOne)/float(kGraphShorePasses-1)) / life; lastOne = !lastOne; @@ -4348,7 +4348,7 @@ void plWaveSet7::IInitGraph(int iPass) { // Okay, phase we don't have to think too hard about, // it doesn't matter as long as it's random. - gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * hsScalarPI; + gs.fPhase[i] = fRand.RandZeroToOne() * 2.f * M_PI; // Next up is frequency, but frequency is the hard one. // Remember frequency has to preserve tiling, so freq = k * 2 * PI. @@ -4369,16 +4369,16 @@ void plWaveSet7::IInitGraph(int iPass) } // Input will be in range [0..2], so we'll omit the customary 2*PI here. - gs.fFreq[i] = k * hsScalarPI; + gs.fFreq[i] = k * M_PI; // Amplitude depends on freqency, or roughly inversely proportional // to frequency (randomized about linear on period). // Divide by 4 because that's how many oscillators we have, and they // are summed. - hsScalar period = 1.f / hsScalar(k); - plConst(hsScalar) kAmpScale(1.f / 4.f / 2.f); - plConst(hsScalar) kMinPeriodFrac(1.f); - plConst(hsScalar) kMaxPeriodFrac(2.f); + float period = 1.f / float(k); + plConst(float) kAmpScale(1.f / 4.f / 2.f); + plConst(float) kMinPeriodFrac(1.f); + plConst(float) kMaxPeriodFrac(2.f); period *= kMinPeriodFrac + fRand.RandZeroToOne() * (kMaxPeriodFrac - kMinPeriodFrac); period *= kAmpScale; gs.fAmp[i] = period; @@ -4410,7 +4410,7 @@ void plWaveSet7::IShuffleDownGraphs(int iPass) IInitGraph(kGraphShorePasses-1); } -void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) +void plWaveSet7::IUpdateGraphShader(float dt, int iPass) { if( fGraphShoreDraw[iPass] ) { @@ -4418,15 +4418,15 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) plShader* shader = fGraphVShader[iPass]; gs.fAge += dt; - hsScalar rads = gs.fAge * gs.fInvLife; - if( rads >= hsScalarPI ) + float rads = gs.fAge * gs.fInvLife; + if( rads >= M_PI ) { // Recycle this one and restart the upper. IShuffleDownGraphs(iPass); } else { - hsScalar sinAge = hsFastMath::SinInRange(rads); + float sinAge = hsFastMath::SinInRange(rads); shader->SetVector(plGraphVS::kAmplitude, gs.fAmp[0] * sinAge, @@ -4440,11 +4440,11 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) tint.a *= sinAge; shader->SetColor(plGraphVS::kColor, tint); - plConst(hsScalar) kCMax(1.f); - plConst(hsScalar) kCMin(3.f); - hsScalar cMin = kCMax + (kCMin - kCMax) * State().fFingerLength; - plConst(hsScalar) k2ndLayerScale(2.f); - plConst(hsScalar) k2ndLayerVoff(1.5f); + plConst(float) kCMax(1.f); + plConst(float) kCMin(3.f); + float cMin = kCMax + (kCMin - kCMax) * State().fFingerLength; + plConst(float) k2ndLayerScale(2.f); + plConst(float) k2ndLayerVoff(1.5f); shader->SetVector(plGraphVS::kUVWConsts, (kCMax - cMin) * sinAge + cMin, gs.fUOff, @@ -4454,7 +4454,7 @@ void plWaveSet7::IUpdateGraphShader(hsScalar dt, int iPass) } } -void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, hsScalar dt) +void plWaveSet7::IUpdateGraphShaders(plPipeline* pipe, float dt) { if( fGraphShoreDraw[0] ) { diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h index 3fd20d4c..90207cf8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.h @@ -81,11 +81,11 @@ class plWorldWaveData7 { public: hsPoint3 fDir; - hsScalar fLength; + float fLength; - hsScalar fFreq; - hsScalar fPhase; - hsScalar fAmplitude; + float fFreq; + float fPhase; + float fAmplitude; }; class plWorldWave7 : public plWorldWaveData7 @@ -184,26 +184,26 @@ protected: plFixedWaterState7 fState; - hsScalar fScrunchLen; - hsScalar fScrunchScale; + float fScrunchLen; + float fScrunchScale; hsVector3 fWindDir; - hsScalar fMinLen; - hsScalar fMaxLen; - hsScalar fFreqScale; + float fMinLen; + float fMaxLen; + float fFreqScale; - hsScalar fTransCountDown; + float fTransCountDown; int fTransistor; - hsScalar fTransDel; + float fTransDel; - hsScalar fTexTransCountDown; + float fTexTransCountDown; int fTexTrans; - hsScalar fTexTransDel; - hsScalar fTexWaveFade[kNumTexWaves]; + float fTexTransDel; + float fTexWaveFade[kNumTexWaves]; plWorldWave7 fWorldWaves[kNumWaves]; - hsScalar fFreqMod[kNumWaves]; + float fFreqMod[kNumWaves]; plRandom fRand; @@ -234,7 +234,7 @@ protected: plBitmap* fEnvMap; uint32_t fEnvSize; - hsScalar fEnvRefresh; + float fEnvRefresh; plLayer* fFixedLayers[4]; @@ -321,24 +321,24 @@ protected: class TexWaveDesc { public: - hsScalar fPhase; - hsScalar fAmp; - hsScalar fLen; - hsScalar fFreq; - hsScalar fDirX; - hsScalar fDirY; - hsScalar fRotScale00; - hsScalar fRotScale01; + float fPhase; + float fAmp; + float fLen; + float fFreq; + float fDirX; + float fDirY; + float fRotScale00; + float fRotScale01; }; TexWaveDesc fTexWaves[kNumTexWaves]; class TexWaveWindDep { public: - hsScalar fWindSpeed; + float fWindSpeed; - hsScalar fHeight; - hsScalar fSpecular; + float fHeight; + float fSpecular; }; TexWaveWindDep fWindDeps[kNumWindDep]; @@ -348,47 +348,47 @@ protected: inline void IScrunch(hsPoint3& pos, hsVector3& norm) const; - void ICalcWindow(hsScalar dt); + void ICalcWindow(float dt); void ICalcScale(); - void IUpdateWaves(hsScalar dt); - void IUpdateWave(hsScalar dt, int i); + void IUpdateWaves(float dt); + void IUpdateWave(float dt, int i); hsBool IAnyBoundsVisible(plPipeline* pipe) const; void IInitWave(int i); void IReInitWaves(); void IUpdateRefObject(); - void IUpdateWindDir(hsScalar dt); + void IUpdateWindDir(float dt); void IShiftCenter(plSceneObject* so) const; - void IFloatBuoys(hsScalar dt); - void IFloatBuoy(hsScalar dt, plSceneObject* so); + void IFloatBuoys(float dt); + void IFloatBuoy(float dt, plSceneObject* so); // Bookkeeping void IAddTarget(const plKey& key); void IRemoveTarget(const plKey& key); - void ISetWindSpeed(hsScalar s); + void ISetWindSpeed(float s); hsBool IOnReceive(plGenRefMsg* refMsg); hsBool IOnRemove(plGenRefMsg* refMsg); - hsBool ITransContinue(hsScalar dt); - void IStartTransition(hsScalar dt); - hsScalar ITransitionDelay() const; - void ITransition(hsScalar dt); + hsBool ITransContinue(float dt); + void IStartTransition(float dt); + float ITransitionDelay() const; + void ITransition(float dt); - hsBool ITransTexContinue(hsScalar dt); - void IStartTexTransition(hsScalar dt); - void ITransTex(hsScalar dt); + hsBool ITransTexContinue(float dt); + void IStartTexTransition(float dt); + void ITransTex(float dt); void IInitTexWave(int i); void ISetupTextureWaves(); - void IUpdateLayers(hsScalar dt); - void IUpdateBumpLayers(hsScalar dt); + void IUpdateLayers(float dt); + void IUpdateBumpLayers(float dt); - plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, hsScalar pri); + plRenderRequest* ICreateRenderRequest(plRenderTarget* rt, plDrawableSpans* draw, float pri); void ISubmitRenderRequests(); plRenderTarget* ICreateTransferRenderTarget(const char* name, int size); @@ -398,7 +398,7 @@ protected: plMipmap* ICreateBiasNoiseMap(); void IAddBumpBiasLayer(hsGMaterial* mat); - plMipmap* ICreateBumpBitmapFFP(hsScalar amp, hsScalar dx, hsScalar dy) const; + plMipmap* ICreateBumpBitmapFFP(float amp, float dx, float dy) const; hsGMaterial* ICreateBumpLayersFFP(); plMipmap* ICreateBumpMipmapPS(); plLayer* ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which); @@ -440,7 +440,7 @@ protected: void IAddGraphPShader(hsGMaterial* mat, int iPass); void IAddGraphVShader(hsGMaterial* mat, int iPass); - void IUpdateGraphShader(hsScalar dt, int iPass); + void IUpdateGraphShader(float dt, int iPass); void IInitGraph(int iPass); void IShuffleDownGraphs(int iPass); @@ -474,7 +474,7 @@ protected: void IUpdateShoreVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); void IUpdateFixedVShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); void IUpdateFixedPShader(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); - void IUpdateGraphShaders(plPipeline* pipe, hsScalar dt); + void IUpdateGraphShaders(plPipeline* pipe, float dt); void IUpdateDecVShader(int t, plPipeline* pipe); void IUpdateDecVShaders(plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -484,7 +484,7 @@ protected: inline void LogF(const char *format, ...) const; inline void LogF(uint32_t color, const char *format, ...) const; inline void IRestartLog() const; - inline void GraphLen(hsScalar len) const; + inline void GraphLen(float len) const; inline void IRestartGraph() const; public: @@ -496,14 +496,14 @@ public: virtual hsBool MsgReceive(plMessage* msg); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } int32_t GetNumProperties() const { return kNumProps; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar EvalPoint(hsPoint3& pos, hsVector3& norm); + float EvalPoint(hsPoint3& pos, hsVector3& norm); // Getters and Setters for Python twiddling // @@ -512,112 +512,112 @@ public: // // Geometric wave parameters. These are all safe to twiddle at any time or speed. // The new settings take effect as new waves are spawned. - void SetGeoMaxLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); } - void SetGeoMinLength(hsScalar s, hsScalar secs=0) { fState.fGeoState.fMinLength.Set(s, secs); } - void SetGeoAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); } - void SetGeoChop(hsScalar s, hsScalar secs=0) { fState.fGeoState.fChop.Set(s, secs); } - void SetGeoAngleDev(hsScalar s, hsScalar secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); } + void SetGeoMaxLength(float s, float secs=0) { fState.fGeoState.fMaxLength.Set(s, secs); } + void SetGeoMinLength(float s, float secs=0) { fState.fGeoState.fMinLength.Set(s, secs); } + void SetGeoAmpOverLen(float s, float secs=0) { fState.fGeoState.fAmpOverLen.Set(s, secs); } + void SetGeoChop(float s, float secs=0) { fState.fGeoState.fChop.Set(s, secs); } + void SetGeoAngleDev(float s, float secs=0) { fState.fGeoState.fAngleDev.Set(s, secs); } // Texture wave parameters. Safe to twiddle any time or speed. // The new settings take effect as new waves are spawned. - void SetTexMaxLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMaxLength.Set(s, secs); } - void SetTexMinLength(hsScalar s, hsScalar secs=0) { fState.fTexState.fMinLength.Set(s, secs); } - void SetTexAmpOverLen(hsScalar s, hsScalar secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); } - void SetTexChop(hsScalar s, hsScalar secs=0) { fState.fTexState.fChop.Set(s, secs); } - void SetTexAngleDev(hsScalar s, hsScalar secs=0) { fState.fTexState.fAngleDev.Set(s, secs); } + void SetTexMaxLength(float s, float secs=0) { fState.fTexState.fMaxLength.Set(s, secs); } + void SetTexMinLength(float s, float secs=0) { fState.fTexState.fMinLength.Set(s, secs); } + void SetTexAmpOverLen(float s, float secs=0) { fState.fTexState.fAmpOverLen.Set(s, secs); } + void SetTexChop(float s, float secs=0) { fState.fTexState.fChop.Set(s, secs); } + void SetTexAngleDev(float s, float secs=0) { fState.fTexState.fAngleDev.Set(s, secs); } // The size in feet of one tile of the ripple texture. If you change this (I don't // recommend it), you need to change it very slowly or it will look very stupid. - void SetRippleScale(hsScalar s, hsScalar secs=0) { fState.fRippleScale.Set(s, secs); } + void SetRippleScale(float s, float secs=0) { fState.fRippleScale.Set(s, secs); } // The direction the wind is blowing (waves will be more or less perpindicular to wind dir). // Change somewhat slowly, like over 30 seconds. - void SetWindDir(const hsVector3& s, hsScalar secs=0) { fState.fWindDir.Set(s, secs); } + void SetWindDir(const hsVector3& s, float secs=0) { fState.fWindDir.Set(s, secs); } // Change these gently, effect is immediate. - void SetSpecularNoise(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); } - void SetSpecularStart(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); } - void SetSpecularEnd(hsScalar s, hsScalar secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularNoise(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kNoise] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularStart(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecStart] = s; fState.fSpecVec.Set(spec, secs); } + void SetSpecularEnd(float s, float secs=0) { hsVector3 spec = fState.fSpecVec; spec[plFixedWaterState7::kSpecEnd] = s; fState.fSpecVec.Set(spec, secs); } // Water Height is overriden if the ref object is animated. - void SetWaterHeight(hsScalar s, hsScalar secs=0) { fState.fWaterHeight.Set(s, secs); } + void SetWaterHeight(float s, float secs=0) { fState.fWaterHeight.Set(s, secs); } // Water Offset and DepthFalloff are complicated, and not immediately interesting to animate. - void SetWaterOffset(const hsVector3& s, hsScalar secs=0) { fState.fWaterOffset.Set(s, secs); } - void SetOpacOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); } - void SetReflOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); } - void SetWaveOffset(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); } - void SetDepthFalloff(const hsVector3& s, hsScalar secs=0) { fState.fDepthFalloff.Set(s, secs); } - void SetOpacFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); } - void SetReflFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); } - void SetWaveFalloff(hsScalar s, hsScalar secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); } + void SetWaterOffset(const hsVector3& s, float secs=0) { fState.fWaterOffset.Set(s, secs); } + void SetOpacOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fX = s; fState.fWaterOffset.Set(off, secs); } + void SetReflOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fY = s; fState.fWaterOffset.Set(off, secs); } + void SetWaveOffset(float s, float secs=0) { hsVector3 off = fState.fWaterOffset; off.fZ = s; fState.fWaterOffset.Set(off, secs); } + void SetDepthFalloff(const hsVector3& s, float secs=0) { fState.fDepthFalloff.Set(s, secs); } + void SetOpacFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fX = s; fState.fDepthFalloff.Set(off, secs); } + void SetReflFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fY = s; fState.fDepthFalloff.Set(off, secs); } + void SetWaveFalloff(float s, float secs=0) { hsVector3 off = fState.fDepthFalloff; off.fZ = s; fState.fDepthFalloff.Set(off, secs); } // Max and Min Atten aren't very interesting, and will probably go away. - void SetMaxAtten(const hsVector3& s, hsScalar secs=0) { fState.fMaxAtten.Set(s, secs); } - void SetMinAtten(const hsVector3& s, hsScalar secs=0) { fState.fMinAtten.Set(s, secs); } + void SetMaxAtten(const hsVector3& s, float secs=0) { fState.fMaxAtten.Set(s, secs); } + void SetMinAtten(const hsVector3& s, float secs=0) { fState.fMinAtten.Set(s, secs); } // Skipping the shore parameters, because they are never used. // Water colors, adjust slowly, effect is immediate. - void SetWaterTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fWaterTint.Set(s, secs); } - void SetWaterRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); } - void SetWaterOpacity(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); } - void SetSpecularTint(const hsColorRGBA& s, hsScalar secs=0) { fState.fSpecularTint.Set(s, secs); } - void SetSpecularRGB(const hsVector3& col, hsScalar secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); } - void SetSpecularMute(hsScalar s, hsScalar secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); } + void SetWaterTint(const hsColorRGBA& s, float secs=0) { fState.fWaterTint.Set(s, secs); } + void SetWaterRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetWaterOpacity()); SetWaterTint(rgb, secs); } + void SetWaterOpacity(float s, float secs=0) { hsColorRGBA col = GetWaterTint(); col.a = s; SetWaterTint(col, secs); } + void SetSpecularTint(const hsColorRGBA& s, float secs=0) { fState.fSpecularTint.Set(s, secs); } + void SetSpecularRGB(const hsVector3& col, float secs=0) { hsColorRGBA rgb; rgb.Set(col.fX, col.fY, col.fZ, GetSpecularMute()); SetSpecularTint(rgb, secs); } + void SetSpecularMute(float s, float secs=0) { hsColorRGBA col = GetSpecularTint(); col.a = s; SetSpecularTint(col, secs); } // The environment map is essentially projected onto a sphere. Moving the center of // the sphere north will move the reflections north, changing the radius of the // sphere effects parallax in the obvious way. - void SetEnvCenter(const hsPoint3& s, hsScalar secs=0) { fState.fEnvCenter.Set(s, secs); } - void SetEnvRadius(hsScalar s, hsScalar secs=0) { fState.fEnvRadius.Set(s, secs); } + void SetEnvCenter(const hsPoint3& s, float secs=0) { fState.fEnvCenter.Set(s, secs); } + void SetEnvRadius(float s, float secs=0) { fState.fEnvRadius.Set(s, secs); } // Now a way to get current values. See the accompanying Setter for notes on // what the parameter means. // - hsScalar GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; } - hsScalar GetGeoMinLength() const { return fState.fGeoState.fMinLength; } - hsScalar GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; } - hsScalar GetGeoChop() const { return fState.fGeoState.fChop; } - hsScalar GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; } + float GetGeoMaxLength() const { return fState.fGeoState.fMaxLength; } + float GetGeoMinLength() const { return fState.fGeoState.fMinLength; } + float GetGeoAmpOverLen() const { return fState.fGeoState.fAmpOverLen; } + float GetGeoChop() const { return fState.fGeoState.fChop; } + float GetGeoAngleDev() const { return fState.fGeoState.fAngleDev; } - hsScalar GetTexMaxLength() const { return fState.fTexState.fMaxLength; } - hsScalar GetTexMinLength() const { return fState.fTexState.fMinLength; } - hsScalar GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; } - hsScalar GetTexChop() const { return fState.fTexState.fChop; } - hsScalar GetTexAngleDev() const { return fState.fTexState.fAngleDev; } + float GetTexMaxLength() const { return fState.fTexState.fMaxLength; } + float GetTexMinLength() const { return fState.fTexState.fMinLength; } + float GetTexAmpOverLen() const { return fState.fTexState.fAmpOverLen; } + float GetTexChop() const { return fState.fTexState.fChop; } + float GetTexAngleDev() const { return fState.fTexState.fAngleDev; } - hsScalar GetRippleScale() const { return fState.fRippleScale; } + float GetRippleScale() const { return fState.fRippleScale; } hsVector3 GetWindDir() const { return fState.fWindDir; } - hsScalar GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; } - hsScalar GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; } - hsScalar GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; } + float GetSpecularNoise() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kNoise]; } + float GetSpecularStart() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecStart]; } + float GetSpecularEnd() const { hsVector3 spec = fState.fSpecVec; return spec[plFixedWaterState7::kSpecEnd]; } - hsScalar GetWaterHeight() const { return fState.fWaterHeight; } + float GetWaterHeight() const { return fState.fWaterHeight; } hsVector3 GetWaterOffset() const { return fState.fWaterOffset; } - hsScalar GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; } - hsScalar GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; } - hsScalar GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; } + float GetOpacOffset() const { hsVector3 off = fState.fWaterOffset; return off.fX; } + float GetReflOffset() const { hsVector3 off = fState.fWaterOffset; return off.fY; } + float GetWaveOffset() const { hsVector3 off = fState.fWaterOffset; return off.fZ; } hsVector3 GetDepthFalloff() const { return fState.fDepthFalloff; } - hsScalar GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; } - hsScalar GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; } - hsScalar GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; } + float GetOpacFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fX; } + float GetReflFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fY; } + float GetWaveFalloff() const { hsVector3 off = fState.fDepthFalloff; return off.fZ; } hsVector3 GetMaxAtten() const { return fState.fMaxAtten; } hsVector3 GetMinAtten() const { return fState.fMinAtten; } hsColorRGBA GetWaterTint() const { return fState.fWaterTint; } hsVector3 GetWaterRGB() const { hsColorRGBA col = GetWaterTint(); return hsVector3(col.r, col.g, col.b); } - hsScalar GetWaterOpacity() const { return GetWaterTint().a; } + float GetWaterOpacity() const { return GetWaterTint().a; } hsColorRGBA GetSpecularTint() const { return fState.fSpecularTint; } hsVector3 GetSpecularRGB() const { hsColorRGBA col = GetSpecularTint(); return hsVector3(col.r, col.g, col.b); } - hsScalar GetSpecularMute() const { return GetSpecularTint().a; } + float GetSpecularMute() const { return GetSpecularTint().a; } hsPoint3 GetEnvCenter() const { return fState.fEnvCenter; } - hsScalar GetEnvRadius() const { return fState.fEnvRadius; } + float GetEnvRadius() const { return fState.fEnvRadius; } // Export/debugging functions. For runtime, use message interface (plGenRefMsg, plWaveMsg). void AddTarget(const plKey& key); @@ -637,12 +637,12 @@ public: virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts); - virtual hsScalar GetHeight() const { return State().fWaterHeight; } + virtual float GetHeight() const { return State().fWaterHeight; } const plFixedWaterState7::WaveState& GeoState() const { return State().fGeoState; } const plFixedWaterState7::WaveState& TexState() const { return State().fTexState; } const plFixedWaterState7& State() const { return fState; } - void SetState(const plFixedWaterState7& state, hsScalar dur); + void SetState(const plFixedWaterState7& state, float dur); void SetEnvSize(uint32_t s) { fEnvSize = s; } uint32_t GetEnvSize() const { return fEnvSize; } diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h index cf050646..9c78c452 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSetBase.h @@ -61,12 +61,12 @@ public: CLASSNAME_REGISTER( plWaveSetBase ); GETINTERFACE_ANY( plWaveSetBase, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } int32_t GetNumProperties() const { return 0; } virtual hsBool SetupRippleMat(hsGMaterial* mat, const plRipVSConsts& ripConsts) = 0; - virtual hsScalar GetHeight() const = 0; + virtual float GetHeight() const = 0; virtual hsVector3 GetWindDir() const = 0; diff --git a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt index 992e5853..176be87e 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt @@ -29,7 +29,6 @@ set(plGImage_HEADERS hsCodecManager.h hsDXTDirectXCodec.h hsDXTSoftwareCodec.h - hsRect.h plAVIWriter.h plBitmap.h plBumpMapGen.h diff --git a/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc b/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc deleted file mode 100644 index c5df1315..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/HS_RECT.inc +++ /dev/null @@ -1,235 +0,0 @@ - -struct HS_RECT_NAME { - HS_RECT_TYPE fLeft, fTop, fRight, fBottom; - - HS_RECT_TYPE Width() const { return fRight - fLeft; } - HS_RECT_TYPE Height() const { return fBottom - fTop; } - hsBool IsEmpty() const { return fLeft >= fRight || fTop >= fBottom; } - - void SetEmpty() { fLeft = fTop = fRight = fBottom = 0; } - HS_RECT_NAME* Set(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) - { - fLeft = left; fTop = top; fRight = right; fBottom = bottom; - return this; - } - HS_RECT_NAME* Set(const HS_RECT_POINT* p1, const HS_RECT_POINT* p2) - { - if (p1->fX < p2->fX) - { fLeft = p1->fX; - fRight = p2->fX; - } else - { fLeft = p2->fX; - fRight = p1->fX; - } - - if (p1->fY < p2->fY) - { fTop = p1->fY; - fBottom = p2->fY; - } else - { fTop = p2->fY; - fBottom = p1->fY; - } - return this; - } - HS_RECT_NAME* Set(UInt32 count, const HS_RECT_POINT pts[]) - { - if (count > 0) - { fLeft = fRight = pts[0].fX; - fTop = fBottom = pts[0].fY; - (void)this->Union(count - 1, &pts[1]); - } - return this; - } - - hsBool Contains(HS_RECT_TYPE x, HS_RECT_TYPE y) const - { - return x >= fLeft && x < fRight && y >= fTop && y < fBottom; - } - hsBool Contains(const HS_RECT_POINT* p) const - { - return this->Contains(p->fX, p->fY); - } - hsBool Contains(const HS_RECT_NAME* r) const - { - return fLeft <= r->fLeft && fTop <= r->fTop && fRight >= r->fRight && fBottom >= r->fBottom; - } - hsBool Contains(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) const - { - return fLeft <= left && fTop <= top && fRight >= right && fBottom >= bottom; - } - HS_RECT_NAME* Offset(HS_RECT_TYPE dx, HS_RECT_TYPE dy) - { - fLeft += dx; fTop += dy; fRight += dx; fBottom += dy; - return this; - } - HS_RECT_NAME* MoveTo(HS_RECT_TYPE x, HS_RECT_TYPE y) - { - this->fRight += x - this->fLeft; - this->fBottom += y - this->fTop; - this->fLeft = x; - this->fTop = y; - return this; - } - HS_RECT_NAME* Inset(HS_RECT_TYPE dx, HS_RECT_TYPE dy) - { - fLeft += dx; fRight -= dx; - fTop += dy; fBottom -= dy; - return this; - } - - HS_RECT_NAME* UnionX(HS_RECT_TYPE x) - { - if (x < fLeft) fLeft = x; else - if (x > fRight) fRight = x; - return this; - } - HS_RECT_NAME* UnionY(HS_RECT_TYPE y) - { - if (y < fTop) fTop = y; else - if (y > fBottom) fBottom = y; - return this; - } - HS_RECT_NAME* Union(const HS_RECT_NAME* r) - { - if (r->fLeft < fLeft) fLeft = r->fLeft; - if (r->fTop < fTop) fTop = r->fTop; - if (r->fRight > fRight) fRight = r->fRight; - if (r->fBottom > fBottom) fBottom = r->fBottom; - return this; - } - HS_RECT_NAME* Union(const HS_RECT_POINT* p) - { - if (p->fX < fLeft) fLeft = p->fX; - if (p->fX > fRight) fRight = p->fX; - if (p->fY < fTop) fTop = p->fY; - if (p->fY> fBottom) fBottom = p->fY; - return this; - } - HS_RECT_NAME* Union(UInt32 count, const HS_RECT_POINT p[]) - { - HS_RECT_TYPE left = this->fLeft; - HS_RECT_TYPE top = this->fTop; - HS_RECT_TYPE right = this->fRight; - HS_RECT_TYPE bottom = this->fBottom; - - for (; count > 0; ++p, --count) - { HS_RECT_TYPE value = p->fX; - if (value < left) left = value; - else if (value > right) right = value; - - value = p->fY; - if (value < top) top = value; - else if (value > bottom) bottom = value; - } - return this->Set(left, top, right, bottom); - } - -#if 0 // Havok reeks - friend int operator==(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return a.fLeft == b.fLeft && a.fTop == b.fTop && - a.fRight == b.fRight && a.fBottom == b.fBottom; - } - friend int operator!=(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return !(a == b); - } -#else // Havok reeks - int operator==(const HS_RECT_NAME& aa) const - { - return aa.fLeft == fLeft && aa.fTop == fTop && - aa.fRight == fRight && aa.fBottom == fBottom; - } - int operator!=(const HS_RECT_NAME& aa) const - { - return !(aa == *this); - } -#endif // Havok reeks - - // Intersect Test - friend int operator&&(const HS_RECT_NAME& a, const HS_RECT_NAME& b) - { - return a.fLeft < b.fRight && a.fRight > b.fLeft && - a.fTop < b.fBottom && a.fBottom > b.fTop; - } - - hsBool Intersect(const HS_RECT_NAME* r) - { - return this->Intersect(r->fLeft, r->fTop, r->fRight, r->fBottom); - } - hsBool Intersect(HS_RECT_TYPE left, HS_RECT_TYPE top, HS_RECT_TYPE right, HS_RECT_TYPE bottom) - { - if (left < fRight && top < fBottom && fLeft < right && fTop < bottom) - { if (left > fLeft) fLeft = left; - if (top > fTop) fTop = top; - if (right < fRight) fRight = right; - if (bottom < fBottom) fBottom = bottom; - return true; - } - return false; - } - hsBool Intersect(const HS_RECT_NAME* a, const HS_RECT_NAME* b) - { - if (a->fLeft < b->fRight && a->fTop < b->fBottom && b->fLeft < a->fRight && b->fTop < a->fBottom) - { *this = *b; - if (a->fLeft > fLeft) fLeft = a->fLeft; - if (a->fTop > fTop) fTop = a->fTop; - if (a->fRight < fRight) fRight = a->fRight; - if (a->fBottom < fBottom) fBottom = a->fBottom; - return true; - } - return false; // "this" is not changed - } - - HS_RECT_POINT* ToQuad(HS_RECT_POINT quad[4]) const - { - quad[0].fX = fLeft; quad[0].fY = fTop; - quad[1].fX = fRight; quad[1].fY = fTop; - quad[2].fX = fRight; quad[2].fY = fBottom; - quad[3].fX = fLeft; quad[3].fY = fBottom; - return quad; - } - - hsBool CornerTest(const HS_RECT_NAME* area, - HS_RECT_POINT* hitPt = nil, HS_RECT_POINT* oppositePt = nil) const - { - if (area->Contains(fLeft, fTop)) - { if (hitPt) hitPt->Set(fLeft, fTop); - if (oppositePt) oppositePt->Set(fRight, fBottom); - return true; - } - if (area->Contains(fLeft, fBottom)) - { if (hitPt) hitPt->Set(fLeft, fBottom); - if (oppositePt) oppositePt->Set(fRight, fTop); - return true; - } - if (area->Contains(fRight, fTop)) - { if (hitPt) hitPt->Set(fRight, fTop); - if (oppositePt) oppositePt->Set(fLeft, fBottom); - return true; - } - if (area->Contains(fRight, fBottom)) - { if (hitPt) hitPt->Set(fRight, fBottom); - if (oppositePt) oppositePt->Set(fLeft, fTop); - return true; - } - return false; - } - hsBool CornerTest(HS_RECT_POINT* pt, HS_RECT_TYPE tolerance, - HS_RECT_POINT* hitPt = nil, HS_RECT_POINT* oppositePt = nil) const - { - HS_RECT_NAME area = { pt->fX - tolerance, pt->fY - tolerance, - pt->fX + tolerance, pt->fY + tolerance }; - - return this->CornerTest(&area, hitPt, oppositePt); - } - -#if !(HS_RECT_EXTEND) -}; -#endif - -#undef HS_RECT_NAME -#undef HS_RECT_POINT -#undef HS_RECT_TYPE -#undef HS_RECT_EXTEND - diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp index 2d445f05..31d7e1db 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp @@ -148,7 +148,7 @@ hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorM return false; } -hsBool hsCodecManager::Register(hsCodec *codec, uint32_t compressionFormat, hsScalar priority) +hsBool hsCodecManager::Register(hsCodec *codec, uint32_t compressionFormat, float priority) { int32_t i, j; for (i = 0; i < fCodecTable.Count(); i++) diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h index c9933cc5..fc762a77 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.h @@ -71,7 +71,7 @@ public: plMipmap *CreateUncompressedMipmap( plMipmap *compressed, uint8_t bitDepth = 0 ); hsBool ColorizeCompMipmap( plMipmap *bMap, const uint8_t *colorMask ); - hsBool Register(hsCodec *codec, uint32_t compressionFormat, hsScalar priority); + hsBool Register(hsCodec *codec, uint32_t compressionFormat, float priority); /// Decompression flags enum { @@ -92,9 +92,9 @@ private: struct hsCodecEntry { hsCodecEntry() : fPriority(0), fCodec(nil) { } - hsCodecEntry(hsScalar p, hsCodec *c) : fPriority(p), fCodec(c) { } + hsCodecEntry(float p, hsCodec *c) : fPriority(p), fCodec(c) { } - hsScalar fPriority; + float fPriority; hsCodec *fCodec; }; diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsRect.h b/Sources/Plasma/PubUtilLib/plGImage/hsRect.h deleted file mode 100644 index 43516580..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/hsRect.h +++ /dev/null @@ -1,147 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef hsRect_Defined -#define hsRect_Defined - -#include "hsPoint2.h" - -#define HS_RECT_NAME hsIntRect -#define HS_RECT_POINT hsIntPoint2 -#define HS_RECT_TYPE int32_t -#define HS_RECT_EXTEND 1 -#include "HS_RECT.inc" - -#ifdef _WINDOWS_ - RECT* ToRECT(RECT* r) const - { - r->left = this->fLeft; - r->top = this->fTop; - r->right = this->fRight; - r->bottom = this->fBottom; - return r; - } - hsIntRect* Set(const RECT* r) - { - return this->Set(r->left, r->top, r->right, r->bottom); - } -#endif -}; - -#define HS_RECT_NAME hsFixedRect -#define HS_RECT_POINT hsFixedPoint2 -#define HS_RECT_TYPE hsFixed -#define HS_RECT_EXTEND 1 -#include "HS_RECT.inc" - - hsFixedRect* Set(const hsIntRect* src) - { - this->fLeft = hsIntToFixed(src->fLeft); - this->fTop = hsIntToFixed(src->fTop); - this->fRight = hsIntToFixed(src->fRight); - this->fBottom = hsIntToFixed(src->fBottom); - return this; - } - - hsFixed CenterX(void) const { return (fLeft + fRight) >> 1; } - hsFixed CenterY(void) const { return (fTop + fBottom) >> 1; } - hsFixedPoint2* Center(hsFixedPoint2* center) const - { - (void)center->Set(this->CenterX(), this->CenterY()); - return center; - } - hsIntRect* Truncate(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedToInt(fLeft), hsFixedToInt(fTop), - hsFixedToInt(fRight), hsFixedToInt(fBottom)); - } - hsIntRect* Round(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedRound(fLeft), hsFixedRound(fTop), - hsFixedRound(fRight), hsFixedRound(fBottom)); - } - hsIntRect* RoundOut(hsIntRect* dst) const - { - return (hsIntRect*)dst->Set( hsFixedToFloorInt(fLeft), - hsFixedToFloorInt(fTop), - hsFixedToCeilingInt(fRight), - hsFixedToCeilingInt(fBottom)); - } -}; - -#if HS_SCALAR_IS_FLOAT - #define HS_RECT_NAME hsFloatRect - #define HS_RECT_POINT hsFloatPoint2 - #define HS_RECT_TYPE float - #define HS_RECT_EXTEND 1 - #include "HS_RECT.inc" - - hsFloatRect* Set(const hsIntRect* src) - { - this->fLeft = float(src->fLeft); - this->fTop = float(src->fTop); - this->fRight = float(src->fRight); - this->fBottom = float(src->fBottom); - return this; - } - - float CenterX(void) const { return (fLeft + fRight) / float(2); } - float CenterY(void) const { return (fTop + fBottom) / float(2); } - hsFloatPoint2* Center(hsFloatPoint2* center) const - { - (void)center->Set(this->CenterX(), this->CenterY()); - return center; - } - float Area() const { return this->Width() * this->Height(); } - - hsIntRect* Round(hsIntRect* r) const; - hsIntRect* RoundOut(hsIntRect* r) const; - hsIntRect* Truncate(hsIntRect* r) const; - }; -#endif - -#if HS_SCALAR_IS_FIXED - typedef hsFixedRect hsRect; -#else - typedef hsFloatRect hsRect; -#endif - -#endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index 299535b3..4e5da55a 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -68,7 +68,7 @@ protected: BITMAPINFOHEADER fBitmapInfo; hsBool fOldRealTime; - hsScalar fOldFrameTimeInc; + float fOldFrameTimeInc; double fStartTime; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp index 9f171b81..e710ef57 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.cpp @@ -196,7 +196,7 @@ plMipmap* plBumpMapGen::QikBumpMap(plMipmap* dst, const plMipmap* origSrc, uint3 return dst; } -plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, hsScalar smooth) +plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, float smooth) { dst = QikBumpMap(dst, src, mask, flags & ~kBias); @@ -215,12 +215,12 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_ { for( i = 0; i < width; i++ ) { - hsScalar x = hsScalar(i) / hsScalar(width-1) * 2.f - 1.f; - hsScalar y = hsScalar(j) / hsScalar(height-1) * 2.f - 1.f; + float x = float(i) / float(width-1) * 2.f - 1.f; + float y = float(j) / float(height-1) * 2.f - 1.f; - hsScalar z = 1.f - x*x - y*y; + float z = 1.f - x*x - y*y; if( z > 0 ) - z = hsSquareRoot(z); + z = sqrt(z); else { x = 0; @@ -228,7 +228,7 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_ z = 1.f; } z *= smooth; - hsScalar invLen = hsFastMath::InvSqrt(x*x + y*y + z*z) * 127.00f; + float invLen = hsFastMath::InvSqrt(x*x + y*y + z*z) * 127.00f; pDst[2] = int8_t(x * invLen); @@ -260,7 +260,7 @@ plMipmap* plBumpMapGen::QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_ if( y ) y *= 1; - hsScalar invLen = hsFastMath::InvSqrt((hsScalar)(x*x + y*y + nZ*nZ)) * 127.0f; + float invLen = hsFastMath::InvSqrt((float)(x*x + y*y + nZ*nZ)) * 127.0f; pDst[2] = int8_t(x * invLen); pDst[1] = int8_t(y * invLen); pDst[0] = int8_t(nZ * invLen); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h index 3e593c09..085e414a 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plBumpMapGen.h @@ -58,7 +58,7 @@ public: }; static plMipmap* QikBumpMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags); - static plMipmap* QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, hsScalar smooth=1.f); // higher smooth means less bumpy, valid range [0..inf]. + static plMipmap* QikNormalMap(plMipmap* dst, const plMipmap* src, uint32_t mask, uint32_t flags, float smooth=1.f); // higher smooth means less bumpy, valid range [0..inf]. static plMipmap* TwosCompToBias(plMipmap* dst); static plMipmap* MakeCompatibleBlank(const plMipmap* src); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp index 8bbc09c3..7fff8641 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plFont.cpp @@ -261,7 +261,7 @@ void plFont::IRenderString( plMipmap *mip, uint16_t x, uint16_t y, const wcha fRenderInfo.fX = x; fRenderInfo.fY = y; fRenderInfo.fNumCols = (int16_t)(( fBPP <= 8 ) ? ( ( fWidth * fBPP ) >> 3 ) : 0); - fRenderInfo.fFloatWidth = (hsScalar)fWidth; + fRenderInfo.fFloatWidth = (float)fWidth; fRenderInfo.fFarthestX = x; fRenderInfo.fMaxAscent = 0; fRenderInfo.fVolatileStringPtr = string; @@ -1258,7 +1258,7 @@ hsBool plFont::LoadFromFNTStream( hsStream *stream ) outChar.fHeight = ( charEntries[ i ].offset == 0 ) ? 0 : height; outChar.fBaseline = fntInfo.ascent; outChar.fLeftKern = 0.f; - outChar.fRightKern = (hsScalar)(charEntries[ i ].width - fWidth); + outChar.fRightKern = (float)(charEntries[ i ].width - fWidth); fCharacters.Append( outChar ); if( outChar.fHeight > fMaxCharHeight ) @@ -1415,9 +1415,9 @@ class plLineParser return atoi( IGetNextToken() ); } - hsScalar GetFloat( void ) + float GetFloat( void ) { - return (hsScalar)atof( IGetNextToken() ); + return (float)atof( IGetNextToken() ); } }; @@ -1601,7 +1601,7 @@ class plBDFCharsParser : public plBDFSectParser } // Set these now, since setting them before would've changed the IGetFreeCharData results - fCharacter->fLeftKern = (hsScalar)xOff; + fCharacter->fLeftKern = (float)xOff; fCharacter->fBaseline = yOff + pixH; fCharacter->fHeight = fRowsLeft = pixH; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFont.h b/Sources/Plasma/PubUtilLib/plGImage/plFont.h index 9b9709b0..1de6d114 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFont.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plFont.h @@ -156,8 +156,8 @@ class plFont : public hsKeyedObject int32_t fBaseline; // Number of pixels down from the top of // the char bitmap to the baseline. - hsScalar fLeftKern; // Kerning values for this char, in pixels - hsScalar fRightKern; // Note that the right kern is relative to + float fLeftKern; // Kerning values for this char, in pixels + float fRightKern; // Note that the right kern is relative to // the right side of the bitmap area, which // is the width of the font bitmap, so // basically each character is the same width, @@ -208,7 +208,7 @@ class plFont : public hsKeyedObject plMipmap *fMipmap; uint32_t fFlags; pcSmallRect fClipRect; - hsScalar fFloatWidth; + float fFloatWidth; const wchar_t *fVolatileStringPtr; // Just so we know where we clipped @@ -249,8 +249,8 @@ class plFont : public hsKeyedObject uint16_t GetFirstChar( void ) const { return fFirstChar; } uint16_t GetNumChars( void ) const { return fCharacters.GetCount(); } uint32_t GetFlags( void ) const { return fFlags; } - hsScalar GetDescent( void ) const { return (hsScalar)fFontDescent; } - hsScalar GetAscent( void ) const { return (hsScalar)fFontAscent; } + float GetDescent( void ) const { return (float)fFontDescent; } + float GetAscent( void ) const { return (float)fFontAscent; } uint32_t GetBitmapWidth( void ) const { return fWidth; } uint32_t GetBitmapHeight( void ) const { return fHeight; } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp index dac2d626..ac834f2f 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp @@ -60,6 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/hsGDeviceRef.h" #include "plProfile.h" #include "plJPEG/plJPEG.h" +#include plProfile_CreateMemCounter("Mipmaps", "Memory", MemMipmaps); @@ -814,7 +815,7 @@ void plMipmap::RemoveMipping() namespace { const uint32_t kVersion = 1; - const hsScalar kDefaultSigma = 1.f; + const float kDefaultSigma = 1.f; const uint32_t kDefaultDetailBias = 5; // Color masks (out of 0-2) @@ -842,33 +843,33 @@ class plFilterMask { protected: int fExt; - hsScalar **fMask; + float **fMask; public: - plFilterMask( hsScalar sig ); + plFilterMask( float sig ); virtual ~plFilterMask(); int Begin() const { return -fExt; } int End() const { return fExt; } - hsScalar Mask( int i, int j ) const { return fMask[ i ][ j ]; } + float Mask( int i, int j ) const { return fMask[ i ][ j ]; } }; -plFilterMask::plFilterMask( hsScalar sig ) +plFilterMask::plFilterMask( float sig ) { fExt = (int)( sig * 2.f ); if( fExt < 1 ) fExt = 1; - hsScalar **m = TRACKED_NEW hsScalar *[ ( fExt << 1 ) + 1 ]; + float **m = TRACKED_NEW float *[ ( fExt << 1 ) + 1 ]; m += fExt; int i, j; - hsScalar ooSigSq = 1.f / ( sig * sig ); + float ooSigSq = 1.f / ( sig * sig ); for( i = -fExt; i <= fExt; i++ ) { - m[ i ] = ( TRACKED_NEW hsScalar[ ( fExt << 1 ) + 1] ) + fExt; + m[ i ] = ( TRACKED_NEW float[ ( fExt << 1 ) + 1] ) + fExt; for( j = -fExt; j <= fExt; j++ ) { m[ i ][ j ] = expf( -( i*i + j*j ) * ooSigSq ); @@ -890,9 +891,9 @@ plFilterMask::~plFilterMask() //// Some More Functions ////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -plMipmap::plMipmap( plMipmap *bm, hsScalar sig, uint32_t createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin) +plMipmap::plMipmap( plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin) { int i; @@ -985,9 +986,9 @@ plMipmap::plMipmap( plMipmap *bm, hsScalar sig, uint32_t createFlags, // Given the detail range and the current level, returns the detail's alpha // value at that level. -hsScalar plMipmap::IGetDetailLevelAlpha( uint8_t level, hsScalar dropStart, hsScalar dropStop, hsScalar min, hsScalar max ) +float plMipmap::IGetDetailLevelAlpha( uint8_t level, float dropStart, float dropStop, float min, float max ) { - hsScalar detailAlpha; + float detailAlpha; detailAlpha = ( level - dropStart ) * ( min - max ) / ( dropStop - dropStart ) + max; @@ -1000,9 +1001,9 @@ hsScalar plMipmap::IGetDetailLevelAlpha( uint8_t level, hsScalar dropStart, hsSc return detailAlpha; } -void plMipmap::SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, hsScalar sig, uint32_t createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin) +void plMipmap::SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin) { SetCurrLevel( iDst ); @@ -1083,8 +1084,8 @@ void plMipmap::ICreateLevelNoDetail( uint8_t iDst, const plFilterMask& mask ) uint32_t chan; for( chan = 0; chan < 4; chan++ ) { - hsScalar w = 0; - hsScalar a = 0; + float w = 0; + float a = 0; for( ii = mask.Begin(); ii <= mask.End(); ii++ ) { @@ -1094,7 +1095,7 @@ void plMipmap::ICreateLevelNoDetail( uint8_t iDst, const plFilterMask& mask ) &&(jj + (j << 1) >= 0)&&(jj + (j << 1) < srcWidth) ) { w += mask.Mask(ii, jj); - a += (hsScalar(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); + a += (float(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); } } } @@ -1186,8 +1187,8 @@ void plMipmap::ICarryColor(uint8_t iDst, uint32_t col) // standard detail map blending. void plMipmap::IBlendLevelDetailAlpha( uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1200,7 +1201,7 @@ void plMipmap::IBlendLevelDetailAlpha( uint8_t iDst, const plFilterMask& mask uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); for( i = 0; i < fCurrLevelHeight; i++ ) { @@ -1220,8 +1221,8 @@ void plMipmap::IBlendLevelDetailAlpha( uint8_t iDst, const plFilterMask& mask // detail map blending. (Shesh, gotta hate C sometimes....) void plMipmap::IBlendLevelDetailAdd( uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1234,7 +1235,7 @@ void plMipmap::IBlendLevelDetailAdd( uint8_t iDst, const plFilterMask& mask, uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); for( i = 0; i < fCurrLevelHeight; i++ ) { @@ -1259,8 +1260,8 @@ void plMipmap::IBlendLevelDetailAdd( uint8_t iDst, const plFilterMask& mask, // multiplicitive detail map blending. (Shesh, gotta hate C sometimes....) void plMipmap::IBlendLevelDetailMult( uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ) + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1273,8 +1274,8 @@ void plMipmap::IBlendLevelDetailMult( uint8_t iDst, const plFilterMask& mask, uint8_t *dst = (uint8_t *)GetLevelPtr(iDst); - hsScalar detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); - hsScalar invDetailAlpha = ( 1.f - detailAlpha ) * 255.f; + float detailAlpha = IGetDetailLevelAlpha( iDst, detailDropoffStart, detailDropoffStop, detailMin, detailMax ); + float invDetailAlpha = ( 1.f - detailAlpha ) * 255.f; for( i = 0; i < fCurrLevelHeight; i++ ) { @@ -1416,7 +1417,7 @@ void plMipmap::ISetCurrLevelVBorder( uint32_t color ) } } -void plMipmap::Filter(hsScalar sig) +void plMipmap::Filter(float sig) { hsAssert(fPixelSize == 32, "Only 32 bit implemented"); ASSERT_UNCOMPRESSED(); @@ -1448,8 +1449,8 @@ void plMipmap::Filter(hsScalar sig) uint32_t chan; for( chan = 0; chan < 4; chan++ ) { - hsScalar w = 0; - hsScalar a = 0; + float w = 0; + float a = 0; for( ii = mask.Begin(); ii <= mask.End(); ii++ ) { @@ -1459,7 +1460,7 @@ void plMipmap::Filter(hsScalar sig) &&(jj + j >= 0)&&(jj + j < srcWidth) ) { w += mask.Mask(ii, jj); - a += (hsScalar(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); + a += (float(center[ii*srcRowBytes + (jj<<2) + chan]) + 0.5f) * mask.Mask(ii, jj); } } } diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h index eaa1f659..64fd1b91 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.h @@ -92,9 +92,9 @@ class plMipmap : public plBitmap plMipmap(); plMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels = 0, uint8_t compType = kUncompressed, uint8_t format = UncompressedInfo::kRGB8888 ); - plMipmap( plMipmap *bm, hsScalar sig, uint32_t createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin ); + plMipmap( plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin ); virtual ~plMipmap(); CLASSNAME_REGISTER( plMipmap ); @@ -210,20 +210,20 @@ class plMipmap : public plBitmap kAlphaDataRLE = 0x2 }; - void SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, hsScalar sig, uint32_t createFlags, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); + void SetBitmapAsLevel(uint8_t iDst, plMipmap *bm, float sig, uint32_t createFlags, + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); void ICreateLevelNoDetail(uint8_t iDst, const plFilterMask& mask); void IBlendLevelDetailAlpha(uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); void IBlendLevelDetailAdd(uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); void IBlendLevelDetailMult(uint8_t iDst, const plFilterMask& mask, - hsScalar detailDropoffStart, hsScalar detailDropoffStop, - hsScalar detailMax, hsScalar detailMin); - void Filter(hsScalar sig); + float detailDropoffStart, float detailDropoffStop, + float detailMax, float detailMin); + void Filter(float sig); uint32_t CopyOutPixels(uint32_t destXSize, uint32_t destYSize, uint32_t dstFormat, void *destPixels, uint32_t copyOptions); void ClipToMaxSize( uint32_t maxDimension ); @@ -247,15 +247,15 @@ class plMipmap : public plBitmap uint16_t fFlags; uint8_t fSrcLevelsToSkip; uint8_t fOpacity; - hsScalar fRedTint, fGreenTint, fBlueTint; + float fRedTint, fGreenTint, fBlueTint; uint16_t fSrcClipX, fSrcClipY; // Clipping is applied AFTER levelSkip uint16_t fSrcClipWidth, fSrcClipHeight; // 0 means max width/height CompositeOptions() { fFlags = 0; fSrcLevelsToSkip = 0; fRedTint = fGreenTint = fBlueTint = 1.f; fSrcClipX = fSrcClipY = fSrcClipWidth = fSrcClipHeight = 0; fOpacity = 255;} - CompositeOptions( uint16_t flags, uint8_t srcLevelsToSkip = 0, hsScalar red = 1.f, hsScalar green = 1.f, - hsScalar blue = 1.f, uint16_t srcClipX = 0, uint16_t srcClipY = 0, + CompositeOptions( uint16_t flags, uint8_t srcLevelsToSkip = 0, float red = 1.f, float green = 1.f, + float blue = 1.f, uint16_t srcClipX = 0, uint16_t srcClipY = 0, uint16_t srcClipWidth = 0, uint16_t srcClipHeight = 0, uint8_t opacity = 255 ) { fFlags = flags; @@ -311,7 +311,7 @@ class plMipmap : public plBitmap void IColorLevel( uint8_t level, const uint8_t *colorMask ); - hsScalar IGetDetailLevelAlpha( uint8_t level, hsScalar dropStart, hsScalar dropStop, hsScalar min, hsScalar max ); + float IGetDetailLevelAlpha( uint8_t level, float dropStart, float dropStop, float min, float max ); void ICarryZeroAlpha(uint8_t iDst); void ICarryColor(uint8_t iDst, uint32_t col); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp index 70e60913..ade9fd35 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp @@ -74,8 +74,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // heinous #include "plNetClient/plNetClientMgr.h" #include "pnMessage/plEnableMsg.h" -static hsScalar kMaxYon = 1000.f; -static hsScalar kMinHither = 1.f; +static float kMaxYon = 1000.f; +static float kMinHither = 1.f; #include "plLightProxy.h" @@ -141,9 +141,9 @@ void plLightInfo::IRefresh() void plLightInfo::ICheckMaxStrength() { - hsScalar r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r; - hsScalar g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g; - hsScalar b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b; + float r = GetDiffuse().r >= 0 ? GetDiffuse().r : -GetDiffuse().r; + float g = GetDiffuse().g >= 0 ? GetDiffuse().g : -GetDiffuse().g; + float b = GetDiffuse().b >= 0 ? GetDiffuse().b : -GetDiffuse().b; fMaxStrength = r > g ? ( @@ -157,11 +157,11 @@ void plLightInfo::ICheckMaxStrength() : b ); - const hsScalar kMinMaxStrength = 1.e-2f; + const float kMinMaxStrength = 1.e-2f; SetZero(fMaxStrength < kMinMaxStrength); } -void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { if( IsIdle() ) { @@ -592,7 +592,7 @@ plDirectionalLightInfo::~plDirectionalLightInfo() { } -void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plDirectionalLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { plLightInfo::GetStrengthAndScale(bnd, strength, scale); } @@ -637,8 +637,8 @@ void plLimitedDirLightInfo::IRefresh() hsMatrix44 l2ndc; l2ndc.Reset(); - hsScalar width = fWidth; - hsScalar height = fHeight; + float width = fWidth; + float height = fHeight; l2ndc.fMap[0][0] = 1.f / width; l2ndc.fMap[0][3] = 0.5f; @@ -658,7 +658,7 @@ void plLimitedDirLightInfo::IRefresh() } } -void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plLimitedDirLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { // If we haven't culled the object, return that we're full strength. plLightInfo::GetStrengthAndScale(bnd, strength, scale); @@ -691,8 +691,8 @@ void plLimitedDirLightInfo::IMakeIsect() hsPoint3 p0, p1; - hsScalar width = fWidth; - hsScalar height = fHeight; + float width = fWidth; + float height = fHeight; p0.Set(-width*0.5f, 0, 0); p1.Set(width*0.5f, 0, 0); fParPlanes->SetPlane(0, p0, p1); @@ -756,7 +756,7 @@ void plOmniLightInfo::IMakeIsect() fSphere->SetTransform(fLightToWorld, fWorldToLight); } -void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const +void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const { plLightInfo::GetStrengthAndScale(bnd, strength, scale); @@ -764,7 +764,7 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str const hsPoint3& pos = bnd.GetCenter(); hsPoint3 wpos = GetWorldPosition(); - hsScalar dist = hsVector3(&pos, &wpos).MagnitudeSquared(); + float dist = hsVector3(&pos, &wpos).MagnitudeSquared(); dist = 1.f / hsFastMath::InvSqrtAppr(dist); if( fAttenQuadratic > 0 ) { @@ -785,16 +785,16 @@ void plOmniLightInfo::GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& str } } -hsScalar plOmniLightInfo::GetRadius() const +float plOmniLightInfo::GetRadius() const { - hsScalar radius = 0; + float radius = 0; if( fAttenQuadratic > 0 ) { - hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; - hsScalar det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst()); + float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; + float det = fAttenLinear*fAttenLinear - 4.f * fAttenQuadratic * fAttenConst * (1.f - mult * plSillyLightKonstants::GetFarPowerKonst()); if( det > 0 ) { - det = hsSquareRoot(det); + det = sqrt(det); radius = -fAttenLinear + det; radius /= fAttenQuadratic * 2.f; @@ -804,7 +804,7 @@ hsScalar plOmniLightInfo::GetRadius() const } else if( fAttenLinear > 0 ) { - hsScalar mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; + float mult = fDiffuse.a >= 0 ? fDiffuse.a : -fDiffuse.a; radius = (mult * plSillyLightKonstants::GetFarPowerKonst() - 1.f ) * fAttenConst / fAttenLinear; } else if( fAttenCutoff > 0 ) @@ -887,8 +887,8 @@ plDrawableSpans* plOmniLightInfo::CreateProxy(hsGMaterial* mat, hsTArraySetAngle(effFOV); @@ -948,12 +948,12 @@ void plSpotLightInfo::IRefresh() if( GetProjection() ) { - hsScalar yon = GetRadius(); + float yon = GetRadius(); if( yon < kMinHither ) yon = kMaxYon; - hsScalar hither = hsMinimum(kMinHither, yon * 0.5f); + float hither = hsMinimum(kMinHither, yon * 0.5f); - hsScalar sinFOV, cosFOV; + float sinFOV, cosFOV; hsFastMath::SinCos(effFOV, sinFOV, cosFOV); hsMatrix44 l2ndc; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h index 95012728..1edc397e 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.h @@ -136,7 +136,7 @@ protected: plSoftVolume* fSoftVolume; - hsScalar fMaxStrength; + float fMaxStrength; hsBool fRegisteredForRenderMsg; @@ -183,7 +183,7 @@ public: void SetShadowCaster(hsBool on) { SetProperty(kLPCastShadows, on); } void Refresh() { if( IsDirty() ) { IRefresh(); SetDirty(false); } } - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsBool AffectsBound(const hsBounds3Ext& bnd) { return IGetIsect() ? IGetIsect()->Test(bnd) != kVolumeCulled : true; } void GetAffectedForced(const plSpaceTree* space, hsBitVector& list, hsBool charac); @@ -256,7 +256,7 @@ public: CLASSNAME_REGISTER( plDirectionalLightInfo ); GETINTERFACE_ANY( plDirectionalLightInfo, plLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsVector3 GetWorldDirection() const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); } @@ -270,9 +270,9 @@ class plLimitedDirLightInfo : public plDirectionalLightInfo { protected: - hsScalar fWidth; - hsScalar fHeight; - hsScalar fDepth; + float fWidth; + float fHeight; + float fDepth; plParallelIsect* fParPlanes; @@ -288,15 +288,15 @@ public: CLASSNAME_REGISTER( plLimitedDirLightInfo ); GETINTERFACE_ANY( plLimitedDirLightInfo, plDirectionalLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; - hsScalar GetWidth() const { return fWidth; } - hsScalar GetHeight() const { return fHeight; } - hsScalar GetDepth() const { return fDepth; } + float GetWidth() const { return fWidth; } + float GetHeight() const { return fHeight; } + float GetDepth() const { return fDepth; } - void SetWidth(hsScalar w) { fWidth = w; } - void SetHeight(hsScalar h) { fHeight = h; } - void SetDepth(hsScalar d) { fDepth = d; } + void SetWidth(float w) { fWidth = w; } + void SetHeight(float h) { fHeight = h; } + void SetDepth(float d) { fDepth = d; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); @@ -309,10 +309,10 @@ class plOmniLightInfo : public plLightInfo { protected: // Omni and spot - hsScalar fAttenConst; - hsScalar fAttenLinear; - hsScalar fAttenQuadratic; - hsScalar fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise + float fAttenConst; + float fAttenLinear; + float fAttenQuadratic; + float fAttenCutoff; // Only for attenuate-but-not-really mode, 0 otherwise plSphereIsect* fSphere; @@ -329,23 +329,23 @@ public: CLASSNAME_REGISTER( plOmniLightInfo ); GETINTERFACE_ANY( plOmniLightInfo, plLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const; hsBool IsAttenuated() const { return (fAttenLinear != 0)||(fAttenQuadratic != 0) || ( fAttenCutoff != 0 ); } - hsScalar GetRadius() const; + float GetRadius() const; - hsScalar GetConstantAttenuation() const { return fAttenConst; } - hsScalar GetLinearAttenuation() const { return fAttenLinear; } - hsScalar GetQuadraticAttenuation() const { return fAttenQuadratic; } - hsScalar GetCutoffAttenuation() const { return fAttenCutoff; } + float GetConstantAttenuation() const { return fAttenConst; } + float GetLinearAttenuation() const { return fAttenLinear; } + float GetQuadraticAttenuation() const { return fAttenQuadratic; } + float GetCutoffAttenuation() const { return fAttenCutoff; } hsPoint3 GetWorldPosition() const { return fLightToWorld.GetTranslate(); } - void SetConstantAttenuation(hsScalar a) { fAttenConst = a; SetDirty(true); } - void SetLinearAttenuation(hsScalar a) { fAttenLinear = a; SetDirty(true); } - void SetQuadraticAttenuation(hsScalar a) { fAttenQuadratic = a; SetDirty(true); } - void SetCutoffAttenuation( hsScalar a ) { fAttenCutoff = a; SetDirty( true ); } + void SetConstantAttenuation(float a) { fAttenConst = a; SetDirty(true); } + void SetLinearAttenuation(float a) { fAttenLinear = a; SetDirty(true); } + void SetQuadraticAttenuation(float a) { fAttenQuadratic = a; SetDirty(true); } + void SetCutoffAttenuation( float a ) { fAttenCutoff = a; SetDirty( true ); } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); @@ -359,13 +359,13 @@ class plSpotLightInfo : public plOmniLightInfo { protected: // Valid only for spot - hsScalar fFalloff; + float fFalloff; // Note - these are half angles, D3D wants whole angles, so fSpotInner*2 etc. - hsScalar fSpotInner; - hsScalar fSpotOuter; + float fSpotInner; + float fSpotOuter; - hsScalar fEffectiveFOV; + float fEffectiveFOV; plConeIsect* fCone; @@ -381,18 +381,18 @@ public: CLASSNAME_REGISTER( plSpotLightInfo ); GETINTERFACE_ANY( plSpotLightInfo, plOmniLightInfo ); - virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, hsScalar& strength, hsScalar& scale) const; + virtual void GetStrengthAndScale(const hsBounds3Ext& bnd, float& strength, float& scale) const; hsVector3 GetWorldDirection() const; virtual hsVector3 GetNegativeWorldDirection(const hsPoint3& pos) const { return -GetWorldDirection(); } - void SetFalloff(hsScalar f) { fFalloff = f; SetDirty(true); } - void SetSpotInner(hsScalar rads) { fSpotInner = rads; SetDirty(true); } - void SetSpotOuter(hsScalar rads) { fSpotOuter = rads; SetDirty(true); } + void SetFalloff(float f) { fFalloff = f; SetDirty(true); } + void SetSpotInner(float rads) { fSpotInner = rads; SetDirty(true); } + void SetSpotOuter(float rads) { fSpotOuter = rads; SetDirty(true); } - hsScalar GetFalloff() const { return fFalloff; } - hsScalar GetSpotInner() const { return fSpotInner; } - hsScalar GetSpotOuter() const { return fSpotOuter; } + float GetFalloff() const { return fFalloff; } + float GetSpotInner() const { return fSpotInner; } + float GetSpotOuter() const { return fSpotOuter; } virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h index 629bf9cc..d357ed7a 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightSpace.h @@ -62,7 +62,7 @@ public: CLASSNAME_REGISTER( plLightSpace ); GETINTERFACE_ANY( plLightSpace, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp index 0e7ec495..1fa563b6 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.cpp @@ -60,7 +60,7 @@ void plPerspDirSlave::Init() fFlags |= kCastInCameraSpace; } -hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w) const +hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w) const { hsPoint3 retVal; retVal.fX = world2NDC.fMap[0][0] * pos.fX @@ -78,7 +78,7 @@ hsPoint3 plPerspDirSlave::IProject(const hsMatrix44& world2NDC, const hsPoint3& + world2NDC.fMap[2][2] * pos.fZ + world2NDC.fMap[2][3] * w; - hsScalar invW = 1.f / ( + float invW = 1.f / ( world2NDC.fMap[3][0] * pos.fX + world2NDC.fMap[3][1] * pos.fY + world2NDC.fMap[3][2] * pos.fZ @@ -125,8 +125,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) { plViewTransform pipeView = pipe->GetViewTransform(); - plConst(hsScalar) kYon(100.f); - plConst(hsScalar) kHither(30.f); + plConst(float) kYon(100.f); + plConst(float) kHither(30.f); pipeView.SetHither(kHither); pipeView.SetYon(kYon); @@ -153,7 +153,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) } else if( kUseFrustCenter ) { - plConst(hsScalar) kDist(50.f); + plConst(float) kDist(50.f); hsPoint3 camFrustCenter(0.f, 0.f, kDist); lookAt = IProject(cam2NDC, camFrustCenter); } @@ -167,8 +167,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) hsMatrix44 li2CamNDC; IComputeCamNDCToLight(perspLiPos, lookAt, camNDC2Li, li2CamNDC); - hsScalar minZ, maxZ; - hsScalar cotX, cotY; + float minZ, maxZ; + float cotX, cotY; plConst(hsBool) kFixedPersp(true); if( !kFixedPersp ) @@ -197,13 +197,13 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) plConst(hsBool) kFakeDepth(false); if( kFakeDepth ) { - plConst(hsScalar) kMin(1.f); - plConst(hsScalar) kMax(30.f); + plConst(float) kMin(1.f); + plConst(float) kMax(30.f); minZ = kMin; maxZ = kMax; } - plConst(hsScalar) kMinMinZ(1.f); + plConst(float) kMinMinZ(1.f); if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -231,7 +231,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) } else { - plConst(hsScalar) kHi(1.f); + plConst(float) kHi(1.f); hsBounds3Ext bnd; const hsPoint3 lo(-1.f, -1.f, 0.f); const hsPoint3 hi(1.f, 1.f, kHi); @@ -254,7 +254,7 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; - plConst(hsScalar) kMinMinZ(1.f); + plConst(float) kMinMinZ(1.f); if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -320,8 +320,8 @@ bool plPerspDirSlave::SetupViewTransform(plPipeline* pipe) cotX -= cotX / (fWidth * 0.5f); cotY -= cotY / (fHeight * 0.5f); - hsScalar tanX = 1.f / cotX; - hsScalar tanY = 1.f / cotY; + float tanX = 1.f / cotX; + float tanY = 1.f / cotY; fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(pipe->GetViewTransform().GetWorldToCamera(), pipe->GetViewTransform().GetCameraToWorld()); fView.SetPerspective(true); @@ -368,10 +368,10 @@ void plPerspDirSlave::IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3 { hsVector3 atToFrom(&from, &at); - hsScalar distSq = atToFrom.MagnitudeSquared(); + float distSq = atToFrom.MagnitudeSquared(); atToFrom *= hsFastMath::InvSqrtAppr(distSq); - const hsScalar kMinMag = 0.5f; + const float kMinMag = 0.5f; hsVector3 up(0,0,1.f); if( CrossProd(up, (at - from)).MagnitudeSquared() < kMinMag ) { diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h index 8bb8f6a6..a6d4a183 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plPerspDirSlave.h @@ -49,7 +49,7 @@ class plPerspDirSlave : public plShadowSlave { protected: hsBounds3Ext IGetPerspCasterBound(const hsMatrix44& world2NDC) const; - hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, hsScalar w=1.f) const; + hsPoint3 IProject(const hsMatrix44& world2NDC, const hsPoint3& pos, float w=1.f) const; void IComputeCamNDCToLight(const hsPoint3& from, const hsPoint3& at, hsMatrix44& camNDC2Li, hsMatrix44& li2CamNDC); public: diff --git a/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp index 162197df..76fde8e8 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plPointShadowMaster.cpp @@ -53,11 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsBounds.h" #include "hsFastMath.h" -static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). +static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). -static inline void QuickNorm( hsVector3& a, hsScalar& b ) +static inline void QuickNorm( hsVector3& a, float& b ) { - hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); + float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } @@ -119,22 +119,22 @@ void plPointShadowMaster::IBeginRender() void plPointShadowMaster::IComputeWorldToLight(const hsBounds3Ext& bnd, plShadowSlave* slave) const { - const hsScalar kMinMag = 0.5f; + const float kMinMag = 0.5f; hsPoint3 from = fLightInfo->GetLightToWorld().GetTranslate(); hsPoint3 at = bnd.GetCenter(); hsVector3 atToFrom(&from, &at); - hsScalar distSq = atToFrom.MagnitudeSquared(); + float distSq = atToFrom.MagnitudeSquared(); atToFrom *= hsFastMath::InvSqrtAppr(distSq); hsPoint2 depth; bnd.TestPlane(atToFrom, depth); - hsScalar fromDepth = atToFrom.InnerProduct(from); + float fromDepth = atToFrom.InnerProduct(from); - hsScalar dist = fromDepth - depth.fY; + float dist = fromDepth - depth.fY; - static hsScalar kMinDist = 3.f; + static float kMinDist = 3.f; if( dist < kMinDist ) { atToFrom *= kMinDist - dist; @@ -199,10 +199,10 @@ void plPointShadowMaster::IComputeBounds(const hsBounds3Ext& wBnd, plShadowSlave hsBounds3Ext bnd = sBnd; - hsScalar dist = sBnd.GetCenter().fZ; + float dist = sBnd.GetCenter().fZ; dist += slave->fAttenDist; - hsScalar minZ = sBnd.GetMaxs().fZ; + float minZ = sBnd.GetMaxs().fZ; hsPoint3 p(sBnd.GetMins().fX * dist / minZ, sBnd.GetMins().fY * dist / minZ, dist); bnd.Union(&p); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h index 2cc9a864..e37a6b2a 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.h @@ -87,12 +87,12 @@ protected: // to be network synced. uint8_t fCastFlags; - hsScalar fBoost; - hsScalar fAttenScale; - hsScalar fBlurScale; + float fBoost; + float fAttenScale; + float fBlurScale; // Casting attributes calculated each frame. - hsScalar fMaxOpacity; + float fMaxOpacity; hsTArray fSpans; friend class plShadowMaster; @@ -110,14 +110,14 @@ public: CLASSNAME_REGISTER( plShadowCaster ); GETINTERFACE_ANY( plShadowCaster, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } virtual hsBool MsgReceive(plMessage* msg); virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - hsScalar MaxOpacity() const { return fMaxOpacity; } + float MaxOpacity() const { return fMaxOpacity; } const hsTArray& Spans() const { return fSpans; } hsBool GetSelfShadow() const { return 0 != (fCastFlags & kSelfShadow); } @@ -129,14 +129,14 @@ public: hsBool GetLimitRes() const { return 0 != (fCastFlags & kLimitRes); } void SetLimitRes(hsBool on) { if(on) fCastFlags |= kLimitRes; else fCastFlags &= ~kLimitRes; } - hsScalar GetAttenScale() const { return fAttenScale; } - void SetAttenScale(hsScalar s) { fAttenScale = s; } + float GetAttenScale() const { return fAttenScale; } + void SetAttenScale(float s) { fAttenScale = s; } - hsScalar GetBlurScale() const { return fBlurScale; } - void SetBlurScale(hsScalar s) { fBlurScale = s; } + float GetBlurScale() const { return fBlurScale; } + void SetBlurScale(float s) { fBlurScale = s; } - hsScalar GetBoost() const { return fBoost; } - void SetBoost(hsScalar s) { fBoost = s; } + float GetBoost() const { return fBoost; } + void SetBoost(float s) { fBoost = s; } // These are usually handled internally, activating on read and deactivating // on destruct. Made public in case they need to be manually handled, like diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp index d785a781..dbb41122 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp @@ -63,11 +63,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plTweak.h" uint32_t plShadowMaster::fGlobalMaxSize = 512; -hsScalar plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST -// hsScalar plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST -hsScalar plShadowMaster::fGlobalVisParm = 1.f; +float plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST +// float plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST +float plShadowMaster::fGlobalVisParm = 1.f; -void plShadowMaster::SetGlobalShadowQuality(hsScalar s) +void plShadowMaster::SetGlobalShadowQuality(float s) { if( s < 0 ) s = 0; @@ -166,7 +166,7 @@ void plShadowMaster::Deactivate() const plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey()); } -void plShadowMaster::SetMaxDist(hsScalar f) +void plShadowMaster::SetMaxDist(float f) { fMaxDist = f; fMinDist = f * 0.75f; @@ -227,11 +227,11 @@ hsBool plShadowMaster::IOnCastMsg(plShadowCastMsg* castMsg) hsBounds3Ext casterBnd; IComputeCasterBounds(caster, casterBnd); - hsScalar power = IComputePower(caster, casterBnd); + float power = IComputePower(caster, casterBnd); - static hsScalar kVisShadowPower = 1.e-1f; - static hsScalar kMinShadowPower = 2.e-1f; - static hsScalar kKneeShadowPower = 3.e-1f; + static float kVisShadowPower = 1.e-1f; + static float kMinShadowPower = 2.e-1f; + static float kKneeShadowPower = 3.e-1f; if( power < kMinShadowPower ) return false; if( power < kKneeShadowPower ) @@ -318,7 +318,7 @@ plShadowSlave* plShadowMaster::INextSlave(const plShadowCaster* caster) return slave; } -plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power) +plShadowSlave* plShadowMaster::ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power) { const plShadowCaster* caster = castMsg->Caster(); @@ -371,13 +371,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha if( !castMsg->Pipeline()->TestVisibleWorld(wBnd) ) return IRecycleSlave(slave); - hsScalar maxDist = fMaxDist > 0 + float maxDist = fMaxDist > 0 ? (fGlobalMaxDist > 0 ? hsMinimum(fMaxDist, fGlobalMaxDist) : fMaxDist) : fGlobalMaxDist; - plConst(hsScalar) kMinFrac(0.6f); + plConst(float) kMinFrac(0.6f); maxDist *= kMinFrac + GetGlobalShadowQuality() * (1.f - kMinFrac); // If we haven't got a max distance at which the shadow stays visible @@ -385,10 +385,10 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha if( maxDist <= 0 ) return slave; - plConst(hsScalar) kMinFadeFrac(0.90f); - plConst(hsScalar) kMaxFadeFrac(0.75f); - const hsScalar fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac); - hsScalar minDist = maxDist * fadeFrac; + plConst(float) kMinFadeFrac(0.90f); + plConst(float) kMaxFadeFrac(0.75f); + const float fadeFrac = kMinFadeFrac + GetGlobalShadowQuality() * (kMaxFadeFrac - kMinFadeFrac); + float minDist = maxDist * fadeFrac; // So we want to fade out the shadow as it gets farther away, hopefully // pitching it in the distance when we couldn't see it anyway. @@ -400,16 +400,16 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha // but at least nothing will change when you swing the camera around. #if 0 wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth); - hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); + float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); #else hsPoint3 centre = wBnd.GetCenter(); hsPoint3 vpos = castMsg->Pipeline()->GetViewPositionWorld(); hsVector3 dir(¢re, &vpos); hsFastMath::NormalizeAppr(dir); wBnd.TestPlane(dir, depth); - hsScalar eyeDist = dir.InnerProduct(vpos); + float eyeDist = dir.InnerProduct(vpos); #endif - hsScalar dist = depth.fX - eyeDist; + float dist = depth.fX - eyeDist; // If it's not far enough to be fading, just go with it as is. dist -= minDist; @@ -429,13 +429,13 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha } // compute ShadowSlave power influenced by SoftRegion, current light intensity, and ShadowCaster.fMaxOpacity; -hsScalar plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const +float plShadowMaster::IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const { - hsScalar power = 0; + float power = 0; if( fLightInfo && !fLightInfo->IsIdle() ) { power = caster->fMaxOpacity; - hsScalar strength, scale; + float strength, scale; fLightInfo->GetStrengthAndScale(casterBnd, strength, scale); power *= strength; } @@ -465,15 +465,15 @@ void plShadowMaster::IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSl hsPoint2 depth; wBnd.TestPlane(castMsg->Pipeline()->GetViewDirWorld(), depth); - hsScalar eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); - hsScalar dist = depth.fX - eyeDist; + float eyeDist = castMsg->Pipeline()->GetViewDirWorld().InnerProduct(castMsg->Pipeline()->GetViewPositionWorld()); + float dist = depth.fX - eyeDist; if( dist < 0 ) dist = 0; slave->fPriority = dist; // Might want to boost the local players priority. - plConst(hsScalar) kShiftDist = 50.f; // PERSPTEST -// plConst(hsScalar) kShiftDist = 5000.f; // PERSPTEST + plConst(float) kShiftDist = 50.f; // PERSPTEST +// plConst(float) kShiftDist = 5000.f; // PERSPTEST int iShift = int(dist / kShiftDist); slave->fWidth >>= iShift; slave->fHeight >>= iShift; @@ -507,8 +507,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) hsBounds3Ext bnd = slave->fCasterWorldBounds; bnd.Transform(&slave->fWorldToLight); - hsScalar farthest = bnd.GetCenter().fZ + slave->fAttenDist; - hsScalar closest = bnd.GetMins().fZ; + float farthest = bnd.GetCenter().fZ + slave->fAttenDist; + float closest = bnd.GetMins().fZ; // Shouldn't this always be negated? static hsMatrix44 lightToLut; // Static ensures initialized to all zeros. @@ -524,8 +524,8 @@ void plShadowMaster::IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) // bias to ShadowSlave.LUTXfm.fMap[0][3]. Bias magnitude would probably be at // least 0.5f/256.f to compensate for quantization. - plConst(hsScalar) kSelfBias = 2.f / 256.f; - plConst(hsScalar) kOtherBias = -0.5 / 256.f; + plConst(float) kSelfBias = 2.f / 256.f; + plConst(float) kOtherBias = -0.5 / 256.f; #if 0 // MF_NOSELF lightToLut.fMap[0][3] += slave->HasFlag(plShadowSlave::kSelfShadow) ? kSelfBias : kOtherBias; #else // MF_NOSELF @@ -722,7 +722,7 @@ protected: hsTArray fSpans; hsBounds3Ext fTotalWorldBounds; - hsScalar fMaxOpacity; + float fMaxOpacity; On RenderMsg @@ -741,7 +741,7 @@ protected: //find max opacity of all spans //clear shadowBits of all spans - hsScalar fMaxOpacity = 0.f; + float fMaxOpacity = 0.f; int i; for( i = 0; i < fSpans.GetCount(); i++ ) { @@ -803,7 +803,7 @@ public: CLASSNAME_REGISTER( plShadowCaster ); GETINTERFACE_ANY( plShadowCaster, plMultiModifier ); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {} virtual hsBool MsgReceive(plMessage* msg); @@ -818,7 +818,7 @@ protected: plVolumeIsect* fIsect; - hsScalar fAttenDist; + float fAttenDist; plSoftVolume* fSoftVolume; @@ -831,7 +831,7 @@ protected: // Override if you want to attenuate (e.g. dist for omni, cone angle for spot). // But make sure you factor in base class power. - virtual hsScalar IComputePower(const plShadowCaster* caster); + virtual float IComputePower(const plShadowCaster* caster); public: plVolumeIsect* GetIsect() const { return fIsect; } @@ -853,7 +853,7 @@ public: } } - virtual void CreateShadowSlave(const hsBounds3Ext& bnd, hsScalar power) + virtual void CreateShadowSlave(const hsBounds3Ext& bnd, float power) { int iSlave = fSlavePool.GetCount(); fSlavePool.ExpandAndZero(iSlave+1); @@ -883,9 +883,9 @@ public: }; // compute ShadowSlave power influenced by SoftRegion and ShadowCaster.fMaxOpacity; -hsScalar plShadowMaster::ComputePower(const plShadowCaster* caster) +float plShadowMaster::ComputePower(const plShadowCaster* caster) { - hsScalar power = caster->fMaxOpacity; + float power = caster->fMaxOpacity; if( fSoftVolume ) { power *= fSoftVolume->GetStrength(caster->fTotalWorldBounds.GetCenter()); @@ -928,13 +928,13 @@ void plOmniShadowMaster::IComputeProjections(const hsBounds3Ext& wBnd, plShadowS hsBounds3Ext bnd = wBnd; bnd.Transform(slave->fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; if( minZ < kMinMinZ ) minZ = kMinMinZ; - hsScalar cotX, cotY; + float cotX, cotY; if( -bnd.GetMins().fX > bnd.GetMaxs().fX ) { hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?"); @@ -1011,7 +1011,7 @@ public: hsMatrix44 fCastLUT; hsMatrix44 fRcvLUT; - hsScalar fPower; + float fPower; plVolumeIsect* fISect; @@ -1038,7 +1038,7 @@ Harvest if( !ShadowMaster.CanSee(ShadowCaster.fTotalWorldBounds) ) forget it; - hsScalar power = ComputePower(ShadowCaster); + float power = ComputePower(ShadowCaster); if( power == 0 ) forget it; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h index 4f3170cf..d7ed5b44 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h @@ -72,18 +72,18 @@ public: protected: // Global clamp on shadow map size and stuff static uint32_t fGlobalMaxSize; - static hsScalar fGlobalMaxDist; - static hsScalar fGlobalVisParm; + static float fGlobalMaxDist; + static float fGlobalVisParm; // Constant parameter(s) for this master. - hsScalar fAttenDist; - hsScalar fMaxDist; - hsScalar fMinDist; + float fAttenDist; + float fMaxDist; + float fMinDist; uint32_t fMaxSize; uint32_t fMinSize; - hsScalar fPower; + float fPower; // Temp data used for one frame and recycled. hsTArray fSlavePool; @@ -102,11 +102,11 @@ protected: virtual void IComputeCasterBounds(const plShadowCaster* caster, hsBounds3Ext& casterBnd); virtual void IComputeWidthAndHeight(plShadowCastMsg* castMsg, plShadowSlave* slave) const; virtual void IComputeLUT(plShadowCastMsg* castMsg, plShadowSlave* slave) const; - virtual hsScalar IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const; + virtual float IComputePower(const plShadowCaster* caster, const hsBounds3Ext& casterBnd) const; virtual plShadowSlave* ILastChanceToBail(plShadowCastMsg* castMsg, plShadowSlave* slave); - virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, hsScalar power); + virtual plShadowSlave* ICreateShadowSlave(plShadowCastMsg* castMsg, const hsBounds3Ext& casterBnd, float power); virtual plShadowSlave* INewSlave(const plShadowCaster* caster) = 0; virtual plShadowSlave* INextSlave(const plShadowCaster* caster); @@ -140,29 +140,29 @@ public: void Activate() const; // These should only be useful on scene conversion. - hsScalar GetAttenDist() const { return fAttenDist; } - void SetAttenDist(hsScalar d) { fAttenDist = d; } + float GetAttenDist() const { return fAttenDist; } + void SetAttenDist(float d) { fAttenDist = d; } - hsScalar GetMaxDist() const { return fMaxDist; } - hsScalar GetMinDist() const { return fMinDist; } - void SetMaxDist(hsScalar m); + float GetMaxDist() const { return fMaxDist; } + float GetMinDist() const { return fMinDist; } + void SetMaxDist(float m); uint32_t GetMaxSize() const { return fMaxSize; } uint32_t GetMinSize() const { return fMinSize; } void SetMaxSize(uint32_t s) { fMaxSize = s; } void SetMinSize(uint32_t s) { fMinSize = s; } - hsScalar GetPower() const { return fPower; } - void SetPower(hsScalar f) { fPower = f; } + float GetPower() const { return fPower; } + void SetPower(float f) { fPower = f; } static void SetGlobalMaxSize(uint32_t s) ; static uint32_t GetGlobalMaxSize() { return fGlobalMaxSize; } - static void SetGlobalMaxDist(hsScalar s) { fGlobalMaxDist = s; } - static hsScalar GetGlobalMaxDist() { return fGlobalMaxDist; } + static void SetGlobalMaxDist(float s) { fGlobalMaxDist = s; } + static float GetGlobalMaxDist() { return fGlobalMaxDist; } - static void SetGlobalShadowQuality(hsScalar s); - static hsScalar GetGlobalShadowQuality() { return fGlobalVisParm; } + static void SetGlobalShadowQuality(float s); + static float GetGlobalShadowQuality() { return fGlobalVisParm; } }; diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp index 0ac33dea..37ab8a16 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define isnan _isnan #endif -static const hsScalar kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). +static const float kMinMinZ = 1.f; // totally random arbitrary number (has to be > 0). bool plShadowSlave::ISetupOrthoViewTransform() { @@ -60,14 +60,14 @@ bool plShadowSlave::ISetupOrthoViewTransform() bnd.Transform(&fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; - hsScalar minX = bnd.GetMins().fX; - hsScalar maxX = bnd.GetMaxs().fX; + float minX = bnd.GetMins().fX; + float maxX = bnd.GetMaxs().fX; - hsScalar minY = bnd.GetMins().fY; - hsScalar maxY = bnd.GetMaxs().fY; + float minY = bnd.GetMins().fY; + float maxY = bnd.GetMaxs().fY; hsMatrix44 proj; @@ -82,7 +82,7 @@ bool plShadowSlave::ISetupOrthoViewTransform() // and an offset of zero works great. This could be a driver bug, or // hardware "dependency" (read IHV bug), but whatever, zero is working // now. Might need to adjust for new drivers or other hardware. - const hsScalar kAdjustBias = 0.0f; + const float kAdjustBias = 0.0f; proj.fMap[0][0] = 1.f / (maxX - minX); proj.fMap[0][3] = -minX / (maxX - minX) + kAdjustBias / fWidth; proj.fMap[1][1] = -1.f / (maxY - minY); @@ -98,10 +98,10 @@ bool plShadowSlave::ISetupOrthoViewTransform() // Like the adjust bias above, this part is correct in theory, but only // screws things up (increases Z-acne). #if 0 - hsScalar delX = maxX - minX; + float delX = maxX - minX; minX += delX / (fWidth * 0.5f); maxX -= delX / (fWidth * 0.5f); - hsScalar delY = maxY - minY; + float delY = maxY - minY; minY += delY / (fHeight * 0.5f); maxY -= delY / (fHeight * 0.5f); #endif @@ -111,7 +111,7 @@ bool plShadowSlave::ISetupOrthoViewTransform() fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(fWorldToLight, fLightToWorld); fView.SetPerspective(false); - fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false); + fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false); fLightDir = fLightToWorld.GetAxis(hsMatrix44::kUp); SetFlag(kPositional, false); @@ -126,8 +126,8 @@ bool plShadowSlave::ISetupPerspViewTransform() bnd.Transform(&fWorldToLight); - hsScalar minZ = bnd.GetMins().fZ; - hsScalar maxZ = bnd.GetCenter().fZ + fAttenDist; + float minZ = bnd.GetMins().fZ; + float maxZ = bnd.GetCenter().fZ + fAttenDist; if( minZ < kMinMinZ ) minZ = kMinMinZ; @@ -142,7 +142,7 @@ bool plShadowSlave::ISetupPerspViewTransform() if (isnan(bnd.GetMaxs().fX) || isnan(bnd.GetMaxs().fY)) return false; - hsScalar cotX, cotY; + float cotX, cotY; if( -bnd.GetMins().fX > bnd.GetMaxs().fX ) { hsAssert(bnd.GetMins().fX < 0, "Empty shadow caster bounds?"); @@ -180,11 +180,11 @@ bool plShadowSlave::ISetupPerspViewTransform() proj.fMap[1][1] = cotY * 0.5f; proj.fMap[1][2] = -0.5f * (1.f + 0.5f/fHeight); #else - plConst(hsScalar) kBiasScale(1.f); - plConst(hsScalar) kBiasTrans(1.f); - proj.fMap[0][0] = cotX * 0.5f * ( hsScalar(fWidth-2.f) / hsScalar(fWidth) ) * kBiasScale; + plConst(float) kBiasScale(1.f); + plConst(float) kBiasTrans(1.f); + proj.fMap[0][0] = cotX * 0.5f * ( float(fWidth-2.f) / float(fWidth) ) * kBiasScale; proj.fMap[0][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fWidth); - proj.fMap[1][1] = -cotY * 0.5f * ( hsScalar(fHeight-2.f) / hsScalar(fHeight) ) * kBiasScale; + proj.fMap[1][1] = -cotY * 0.5f * ( float(fHeight-2.f) / float(fHeight) ) * kBiasScale; proj.fMap[1][2] = 0.5f * (1.f - kBiasTrans * 0.5f/fHeight); #endif @@ -206,13 +206,13 @@ bool plShadowSlave::ISetupPerspViewTransform() cotX -= cotX / (fWidth * 0.5f); cotY -= cotY / (fHeight * 0.5f); - hsScalar tanX = 1.f / cotX; - hsScalar tanY = 1.f / cotY; + float tanX = 1.f / cotX; + float tanY = 1.f / cotY; fView.SetView(hsPoint3(-tanX, -tanY, minZ), hsPoint3(tanX, tanY, maxZ)); fView.SetScreenSize((uint16_t)fWidth, (uint16_t)fHeight); fView.SetCameraTransform(fWorldToLight, fLightToWorld); fView.SetPerspective(true); - fView.SetViewPort(0, 0, hsScalar(fWidth), hsScalar(fHeight), false); + fView.SetViewPort(0, 0, float(fWidth), float(fHeight), false); fLightPos = fLightToWorld.GetTranslate(); SetFlag(kPositional, true); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h index 13e9edf5..b3d0d4d2 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plShadowSlave.h @@ -70,8 +70,8 @@ public: plViewTransform fView; - hsScalar fPower; - hsScalar fBlurScale; + float fPower; + float fBlurScale; hsBounds3Ext fCasterWorldBounds; hsBounds3Ext fWorldBounds; @@ -81,9 +81,9 @@ public: uint32_t fWidth; uint32_t fHeight; - hsScalar fAttenDist; + float fAttenDist; - hsScalar fPriority; + float fPriority; uint32_t fFlags; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp index 6082f1b9..912b940b 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.cpp @@ -427,7 +427,7 @@ void plAvatarInputInterface::ForceAlwaysRun(hsBool val) //// IEval /////////////////////////////////////////////////////////////////// // Gets called once per IUpdate(), just like normal IEval()s -hsBool plAvatarInputInterface::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plAvatarInputInterface::IEval( double secs, float del, uint32_t dirty ) { fCursorTimeout += del; if( fCursorTimeout > fCursorFadeDelay ) @@ -848,7 +848,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = mouseMap->fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos) { if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) @@ -878,7 +878,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = mouseMap->fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) pct = pMouseMsg->GetDX(); @@ -959,7 +959,7 @@ hsBool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) pCmd->fNetPropagateToPlayers = mouseMap->fMap[i]->fControlFlags & kControlFlagNetPropagate; // figure out what percent (if any) - hsScalar pct = 0.0f; + float pct = 0.0f; if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos) { if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h index 738699ff..c61c6500 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h @@ -179,7 +179,7 @@ class plAvatarInputInterface : public plInputInterface protected: uint32_t fCurrentCursor; - hsScalar fCursorOpacity, fCursorTimeout, fCursorFadeDelay; + float fCursorOpacity, fCursorTimeout, fCursorFadeDelay; plAvatarInputMap *fInputMap; @@ -188,7 +188,7 @@ class plAvatarInputInterface : public plInputInterface virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ); // Gets called once per IUpdate(), just like normal IEval()s - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); void IDeactivateCommand(plMouseInfo *info); void IChangeInputMaps(plAvatarInputMap *newMap); @@ -209,7 +209,7 @@ class plAvatarInputInterface : public plInputInterface void Reset(); - void RequestCursorToWorldPos(hsScalar xPos, hsScalar yPos, int ID); + void RequestCursorToWorldPos(float xPos, float yPos, int ID); hsBitVector fControlFlags; hsBool fMouseDisabled; @@ -230,7 +230,7 @@ class plAvatarInputInterface : public plInputInterface virtual hsBool HasInterestingCursorID( void ) const { return true; } virtual uint32_t GetPriorityLevel( void ) const { return kAvatarInputPriority; } virtual uint32_t GetCurrentCursorID( void ) const { return fCurrentCursor; } - virtual hsScalar GetCurrentCursorOpacity( void ) const { return fCursorOpacity; } + virtual float GetCurrentCursorOpacity( void ) const { return fCursorOpacity; } const char* GetInputMapName() { return fInputMap ? fInputMap->GetName() : ""; } virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); @@ -256,7 +256,7 @@ class plAvatarInputInterface : public plInputInterface void SetControlFlag(int f, hsBool val = true) { fControlFlags.SetBit(f, val); } - void SetCursorFadeDelay( hsScalar delay ) { fCursorFadeDelay = delay; } + void SetCursorFadeDelay( float delay ) { fCursorFadeDelay = delay; } hsBool IsEnterChatModeBound(); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h index c60da7c3..4227e6e2 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDInputDevice.h @@ -59,7 +59,7 @@ public: virtual void Update(DIDEVICEOBJECTDATA* js); protected: - hsScalar fX,fY; + float fX,fY; }; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp index 86530d74..7a0bc5f6 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.cpp @@ -139,7 +139,7 @@ void plDebugInputInterface::RestoreDefaultKeyMappings( void ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool plDebugInputInterface::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plDebugInputInterface::IEval( double secs, float del, uint32_t dirty ) { return true; } @@ -244,7 +244,7 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) plCtrlCmd* pCmd = TRACKED_NEW plCtrlCmd( this ); pCmd->fControlActivated = true; pCmd->fControlCode = fMouseMap.fMap[i]->fCode; - hsScalar pct = 0.0f; + float pct = 0.0f; if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos) { if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent) @@ -319,7 +319,7 @@ hsBool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg ) pCmd->fNetPropagateToPlayers = fMouseMap.fMap[i]->fControlFlags & kControlFlagNetPropagate; // figure out what percent (if any) - hsScalar pct = 0.0f; + float pct = 0.0f; if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos) { if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h index 40610637..2c9b1ab2 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plDebugInputInterface.h @@ -60,7 +60,7 @@ class plDebugInputInterface : public plInputInterface { protected: - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); hsBool CursorInBox(plMouseEventMsg* pMsg, hsPoint4 box); plMouseMap fMouseMap; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index d462af77..10631be0 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -225,8 +225,8 @@ bool plMouseDevice::bMsgAlways = true; bool plMouseDevice::bCursorHidden = false; bool plMouseDevice::bCursorOverride = false; bool plMouseDevice::bInverted = false; -hsScalar plMouseDevice::fWidth = BASE_WIDTH; -hsScalar plMouseDevice::fHeight = BASE_HEIGHT; +float plMouseDevice::fWidth = BASE_WIDTH; +float plMouseDevice::fHeight = BASE_HEIGHT; plMouseDevice* plMouseDevice::fInstance = 0; plMouseDevice::plMouseDevice() @@ -259,7 +259,7 @@ plMouseDevice::~plMouseDevice() fCursor = nil; plMouseDevice::fInstance = nil; } -void plMouseDevice::SetDisplayResolution(hsScalar Width, hsScalar Height) +void plMouseDevice::SetDisplayResolution(float Width, float Height) { fWidth = Width; fHeight = Height; @@ -321,7 +321,7 @@ void plMouseDevice::AddIDNumToCursor(uint32_t idNum) } -void plMouseDevice::SetCursorX(hsScalar x) +void plMouseDevice::SetCursorX(float x) { /// Set the cursor position if( fCursor == nil && !plMouseDevice::bCursorHidden) @@ -335,7 +335,7 @@ void plMouseDevice::SetCursorX(hsScalar x) // txt.DrawString(fWXPos + 20,fWYPos - 5,"test"); } -void plMouseDevice::SetCursorY(hsScalar y) +void plMouseDevice::SetCursorY(float y) { /// Set the cursor position if( fCursor == nil && !plMouseDevice::bCursorHidden) @@ -387,7 +387,7 @@ void plMouseDevice::NewCursor(char* cursor) fInstance->fCursor->SetVisible( true ); } -void plMouseDevice::SetCursorOpacity( hsScalar opacity ) +void plMouseDevice::SetCursorOpacity( float opacity ) { fInstance->fOpacity = opacity; if( fInstance->fCursor != nil ) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h index cbea1656..e2a22e01 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h @@ -168,13 +168,13 @@ public: fControlFlags.SetBit(f); } void ClearControlFlag(int which) { fControlFlags.ClearBit( which ); } - void SetCursorX(hsScalar x); - void SetCursorY(hsScalar y); - hsScalar GetCursorX() { return fXPos; } - hsScalar GetCursorY() { return fYPos; } + void SetCursorX(float x); + void SetCursorY(float y); + float GetCursorX() { return fXPos; } + float GetCursorY() { return fYPos; } uint32_t GetButtonState() { return fButtonState; } - hsScalar GetCursorOpacity() { return fOpacity; } - void SetDisplayResolution(hsScalar Width, hsScalar Height); + float GetCursorOpacity() { return fOpacity; } + void SetDisplayResolution(float Width, float Height); virtual hsBool MsgReceive(plMessage* msg); @@ -185,7 +185,7 @@ public: static void NewCursor(char* cursor); static void HideCursor(hsBool override = false); static bool GetHideCursor() { return plMouseDevice::bCursorHidden; } - static void SetCursorOpacity( hsScalar opacity = 1.f ); + static void SetCursorOpacity( float opacity = 1.f ); static bool GetInverted() { return plMouseDevice::bInverted; } static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; } static void AddNameToCursor(const char* name); @@ -202,12 +202,12 @@ protected: plInputEventMsg* fRightBMsg[2]; plInputEventMsg* fMiddleBMsg[2]; - hsScalar fXPos; - hsScalar fYPos; + float fXPos; + float fYPos; int fWXPos; // the windows coordinates of the cursor int fWYPos; uint32_t fButtonState; - hsScalar fOpacity; + float fOpacity; hsBitVector fControlFlags; @@ -222,7 +222,7 @@ protected: static bool bCursorHidden; static bool bCursorOverride; static bool bInverted; - static hsScalar fWidth, fHeight; + static float fWidth, fHeight; }; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h index 1629b4ae..24aa7b4e 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterface.h @@ -125,7 +125,7 @@ class plInputInterface : public hsRefCnt // Gets called once per IUpdate(), just like normal IEval()s - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ) { return false; } + virtual hsBool IEval( double secs, float del, uint32_t dirty ) { return false; } // Override to handle special-cased control messages of your own (same as receiving them via a message, but if you process them, nobody else gets them). Return false if you don't handle it. virtual hsBool IHandleCtrlCmd( plCtrlCmd *cmd ) { return false; } @@ -184,7 +184,7 @@ class plInputInterface : public hsRefCnt virtual uint32_t GetCurrentCursorID( void ) const = 0; // Returns the current opacity that this layer wants the cursor to be, from 0 (xparent) to 1 (opaque) - virtual hsScalar GetCurrentCursorOpacity( void ) const { return 1.f; } + virtual float GetCurrentCursorOpacity( void ) const { return 1.f; } // Returns true if this layer is wanting to change the mouse, false if it isn't interested virtual hsBool HasInterestingCursorID( void ) const = 0; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp index d8d14143..2a82ec6c 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp @@ -297,7 +297,7 @@ void plInputInterfaceMgr::IUpdateCursor( int32_t newCursor ) //// IEval /////////////////////////////////////////////////////////////////// // Inherited from plSingleModifier, gets called once per IUpdate() loop. -hsBool plInputInterfaceMgr::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plInputInterfaceMgr::IEval( double secs, float del, uint32_t dirty ) { const char *inputEval = "Eval"; plProfile_BeginLap(Input, inputEval); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h index ffb4f1f9..d6019399 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.h @@ -88,14 +88,14 @@ class plInputInterfaceMgr : public plSingleModifier hsBool fClickEnabled; int32_t fCurrentCursor; - hsScalar fCursorOpacity; + float fCursorOpacity; hsBool fForceCursorHidden; int32_t fForceCursorHiddenCount; plInputInterface *fCurrentFocus; plDefaultKeyCatcher *fDefaultCatcher; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); void IAddInterface( plInputInterface *iface ); void IRemoveInterface( plInputInterface *iface ); @@ -170,7 +170,7 @@ class plCtrlCmd ControlEventCode fControlCode; hsBool fControlActivated; hsPoint3 fPt; - hsScalar fPct; + float fPct; hsBool fNetPropagateToPlayers; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp index ea2b7a40..6443980a 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.cpp @@ -208,7 +208,7 @@ void plInputManager::Update() fDInputMgr->Update(); } -void plInputManager::SetMouseScale( hsScalar s ) +void plInputManager::SetMouseScale( float s ) { /* RECT rect; POINT currPos; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h index f5f68c91..80d57486 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputManager.h @@ -84,8 +84,8 @@ public: void Activate( bool activating ); - hsScalar GetMouseScale( void ) const { return fMouseScale; } - void SetMouseScale( hsScalar s ); + float GetMouseScale( void ) const { return fMouseScale; } + void SetMouseScale( float s ); static plKeyDef UntranslateKey(plKeyDef key, hsBool extended); @@ -96,7 +96,7 @@ protected: plInputInterfaceMgr *fInterfaceMgr; bool fActive, fFirstActivated; - hsScalar fMouseScale; + float fMouseScale; static uint8_t bRecenterMouse; static HWND fhWnd; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index 74a0ddee..bdf4a4bb 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -207,7 +207,7 @@ void plSceneInputInterface::ResetClickableState() } //// IEval /////////////////////////////////////////////////////////////////// -hsBool plSceneInputInterface::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plSceneInputInterface::IEval( double secs, float del, uint32_t dirty ) { // this needs to always go no matter what... // ...unless we have cliclability disabled (as in the case of certain multistage behaviors) @@ -395,10 +395,10 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) { hsVector3 ourView = locPlayer->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView); hsVector3 theirView = pObj->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView); - hsScalar viewdot = ourView * theirView; + float viewdot = ourView * theirView; hsVector3 towards(locPlayer->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pObj->GetCoordinateInterface()->GetLocalToWorld().GetTranslate()); towards.Normalize(); - hsScalar towardsdot = ourView * towards; + float towardsdot = ourView * towards; if (viewdot > SHARE_FACING_TOLERANCE || towardsdot > SHARE_FACING_TOLERANCE ) { ResetClickableState(); @@ -1151,7 +1151,7 @@ void plSceneInputInterface::ISendAvatarDisabledNotification(hsBool enabled) //// IRequestLOSCheck //////////////////////////////////////////////////////// -void plSceneInputInterface::IRequestLOSCheck( hsScalar xPos, hsScalar yPos, int ID ) +void plSceneInputInterface::IRequestLOSCheck( float xPos, float yPos, int ID ) { if( fPipe == nil ) return; diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h index 71ca21ee..77ae0488 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.h @@ -106,10 +106,10 @@ class plSceneInputInterface : public plInputInterface hsPoint3 fLastStartPt, fLastEndPt; plPipeline *fPipe; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); - void IRequestLOSCheck( hsScalar xPos, hsScalar yPos, int ID ); + void IRequestLOSCheck( float xPos, float yPos, int ID ); void ISetLastClicked( plKey obj, hsPoint3 hitPoint ); void IHalfFadeAvatar(hsBool out); diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp index 135100c1..75634250 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.cpp @@ -100,7 +100,7 @@ void plTelescopeInputInterface::Init( plInputInterfaceMgr *manager ) //// IEval /////////////////////////////////////////////////////////////////// -hsBool plTelescopeInputInterface::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plTelescopeInputInterface::IEval( double secs, float del, uint32_t dirty ) { return true; } diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h index 22eb9306..3bbed4ea 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plTelescopeInputInterface.h @@ -57,7 +57,7 @@ class plTelescopeInputInterface : public plInputInterface { protected: - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); + virtual hsBool IEval( double secs, float del, uint32_t dirty ); public: @@ -80,7 +80,7 @@ class plTelescopeInputInterface : public plInputInterface virtual uint32_t GetCurrentCursorID( void ) const { return kCursorUp; } // Returns the current opacity that this layer wants the cursor to be, from 0 (xparent) to 1 (opaque) - virtual hsScalar GetCurrentCursorOpacity( void ) const { return 1.f; } + virtual float GetCurrentCursorOpacity( void ) const { return 1.f; } // Returns true if this layer is wanting to change the mouse, false if it isn't interested virtual hsBool HasInterestingCursorID( void ) const { return false; } diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp index 76e6ce9b..9aacd5a9 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp @@ -50,12 +50,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // linear interpolation /////////////////////////////////////////////////////// // -void hsInterp::LinInterp(hsScalar k1, hsScalar k2, hsScalar t, hsScalar* result) +void hsInterp::LinInterp(float k1, float k2, float t, float* result) { *result = k1 + t * (k2 - k1); } -void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, hsScalar t, +void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, float t, hsScalarTriple* result) { if (t==0.0) @@ -71,7 +71,7 @@ void hsInterp::LinInterp(const hsScalarTriple* k1, const hsScalarTriple* k2, hsS } } -void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, hsScalar t, +void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, float t, hsColorRGBA* result, uint32_t flags) { if (t==0.0) @@ -102,7 +102,7 @@ void hsInterp::LinInterp(const hsColorRGBA* k1, const hsColorRGBA* k2, hsScalar LinInterp(k1->a, k2->a, t, &result->a); } -void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, hsScalar t, +void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, float t, hsMatrix33* result, uint32_t flags) { if (t==0.0) @@ -162,7 +162,7 @@ void hsInterp::LinInterp(const hsMatrix33* k1, const hsMatrix33* k2, hsScalar t, // // -void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScalar t, +void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, float t, hsMatrix44* out, uint32_t flags) { if (flags == 0) @@ -173,7 +173,7 @@ void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScala return; } - if( hsScalar1 == t ) + if( 1.f == t ) { *out = *mat2; return; @@ -234,7 +234,7 @@ void hsInterp::LinInterp(const hsMatrix44* mat1, const hsMatrix44* mat2, hsScala } } -void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, hsScalar t, hsQuat* result) +void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, float t, hsQuat* result) { if (t==0.0) *result = *k1; @@ -247,14 +247,14 @@ void hsInterp::LinInterp(const hsQuat* k1, const hsQuat* k2, hsScalar t, hsQuat* } } -void hsInterp::LinInterp(const hsScaleValue* k1, const hsScaleValue* k2, hsScalar t, +void hsInterp::LinInterp(const hsScaleValue* k1, const hsScaleValue* k2, float t, hsScaleValue* result) { LinInterp(&k1->fS, &k2->fS, t, &result->fS); // Stretch rotation LinInterp(&k1->fQ, &k2->fQ, t, &result->fQ); // Stretch factor } -void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, hsScalar t, +void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, float t, hsAffineParts* result, uint32_t flags) { if (t==0.0) @@ -329,28 +329,28 @@ void hsInterp::LinInterp(const hsAffineParts* k1, const hsAffineParts* k2, hsSca /////////////////////////////////////////////////////// // -void hsInterp::BezScalarEval(const hsScalar value1, const hsScalar outTan, - const hsScalar value2, const hsScalar inTan, - const hsScalar t, const hsScalar tanScale, hsScalar *result) +void hsInterp::BezScalarEval(const float value1, const float outTan, + const float value2, const float inTan, + const float t, const float tanScale, float *result) { #if 0 // If the tangents were what you'd expect them to be... Hermite splines, than this code // would make sense. But no, Max likes to store them in a scaled form based on the // time of each frame. If we ever optimize this further, we could do the scaling on export, // but I need this to work right now before all the artists hate me too much. - const hsScalar t2 = t * t; - const hsScalar t3 = t2 * t; + const float t2 = t * t; + const float t3 = t2 * t; - const hsScalar term1 = 2 * t3 - 3 * t2; + const float term1 = 2 * t3 - 3 * t2; *result = ((term1 + 1) * value1) + (-term1 * value2) + ((t3 - 2 * t2 + 1) * outTan) + ((t3 - t2) * inTan); #else - const hsScalar oneMinusT = (1.0f - t); - const hsScalar tSq = t * t; - const hsScalar oneMinusTSq = oneMinusT * oneMinusT; + const float oneMinusT = (1.0f - t); + const float tSq = t * t; + const float oneMinusTSq = oneMinusT * oneMinusT; *result = (oneMinusT * oneMinusTSq * value1) + (3.f * t * oneMinusTSq * (value1 + outTan * tanScale)) + @@ -359,23 +359,23 @@ void hsInterp::BezScalarEval(const hsScalar value1, const hsScalar outTan, #endif } -void hsInterp::BezInterp(const hsBezPoint3Key* k1, const hsBezPoint3Key* k2, const hsScalar t, hsScalarTriple* result) +void hsInterp::BezInterp(const hsBezPoint3Key* k1, const hsBezPoint3Key* k2, const float t, hsScalarTriple* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue.fX, k1->fOutTan.fX, k2->fValue.fX, k2->fInTan.fX, t, scale, &result->fX); BezScalarEval(k1->fValue.fY, k1->fOutTan.fY, k2->fValue.fY, k2->fInTan.fY, t, scale, &result->fY); BezScalarEval(k1->fValue.fZ, k1->fOutTan.fZ, k2->fValue.fZ, k2->fInTan.fZ, t, scale, &result->fZ); } -void hsInterp::BezInterp(const hsBezScalarKey* k1, const hsBezScalarKey* k2, const hsScalar t, hsScalar* result) +void hsInterp::BezInterp(const hsBezScalarKey* k1, const hsBezScalarKey* k2, const float t, float* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue, k1->fOutTan, k2->fValue, k2->fInTan, t, scale, result); } -void hsInterp::BezInterp(const hsBezScaleKey* k1, const hsBezScaleKey* k2, const hsScalar t, hsScaleValue* result) +void hsInterp::BezInterp(const hsBezScaleKey* k1, const hsBezScaleKey* k2, const float t, hsScaleValue* result) { - hsScalar scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; + float scale = (k2->fFrame - k1->fFrame) * MAX_TICKS_PER_FRAME / 3.f; BezScalarEval(k1->fValue.fS.fX, k1->fOutTan.fX, k2->fValue.fS.fX, k2->fInTan.fX, t, scale, &result->fS.fX); BezScalarEval(k1->fValue.fS.fY, k1->fOutTan.fY, k2->fValue.fS.fY, k2->fInTan.fY, t, scale, &result->fS.fY); BezScalarEval(k1->fValue.fS.fZ, k1->fOutTan.fZ, k2->fValue.fS.fZ, k2->fInTan.fZ, t, scale, &result->fS.fZ); @@ -399,8 +399,8 @@ static inline hsKeyFrame* GetKey(int32_t i, void *keys, int32_t size) // Returns the index of the first key which can be passed in as a hint (lastKeyIdx) // for the next search. // -void hsInterp::GetBoundaryKeyFrames(hsScalar time, uint32_t numKeys, void *keys, uint32_t size, - hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, hsScalar *p, hsBool forwards) +void hsInterp::GetBoundaryKeyFrames(float time, uint32_t numKeys, void *keys, uint32_t size, + hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, float *p, hsBool forwards) { hsAssert(numKeys>1, "Must have more than 1 keyframe"); int k1, k2; diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h index e5ca4d97..8d80fc0a 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsInterp.h @@ -68,26 +68,26 @@ public: kPreservePartsScale = 0x40 // result gets the scale of key1 }; - static void BezScalarEval(const hsScalar value1, const hsScalar outTan, - const hsScalar value2, const hsScalar inTan, - const hsScalar t, const hsScalar scale, hsScalar *result); - static void BezInterp(const hsBezPoint3Key *k1, const hsBezPoint3Key *k2, const hsScalar t, hsScalarTriple *result); - static void BezInterp(const hsBezScalarKey *k1, const hsBezScalarKey *k2, const hsScalar t, hsScalar *result); - static void BezInterp(const hsBezScaleKey *k1, const hsBezScaleKey *k2, const hsScalar t, hsScaleValue *result); + static void BezScalarEval(const float value1, const float outTan, + const float value2, const float inTan, + const float t, const float scale, float *result); + static void BezInterp(const hsBezPoint3Key *k1, const hsBezPoint3Key *k2, const float t, hsScalarTriple *result); + static void BezInterp(const hsBezScalarKey *k1, const hsBezScalarKey *k2, const float t, float *result); + static void BezInterp(const hsBezScaleKey *k1, const hsBezScaleKey *k2, const float t, hsScaleValue *result); // simple linear interpolation - static void LinInterp(const hsScalar k1, const hsScalar k2, const hsScalar t, hsScalar *result); - static void LinInterp(const hsScalarTriple *k1, const hsScalarTriple *k2, const hsScalar t, hsScalarTriple *result); - static void LinInterp(const hsColorRGBA *k1, const hsColorRGBA *k2, const hsScalar t, hsColorRGBA *result, uint32_t ignoreFlags=0); - static void LinInterp(const hsMatrix33 *k1, const hsMatrix33 *k2, const hsScalar t, hsMatrix33 *result, uint32_t ignoreFlags=0); - static void LinInterp(const hsMatrix44 *mat1, const hsMatrix44 *mat2, const hsScalar t, hsMatrix44 *out, uint32_t ignoreFlags=0); - static void LinInterp(const hsQuat *k1, const hsQuat *k2, const hsScalar t, hsQuat *result); - static void LinInterp(const hsScaleValue *k1, const hsScaleValue *k2, const hsScalar t, hsScaleValue *result); - static void LinInterp(const hsAffineParts *k1, const hsAffineParts *k2, const hsScalar t, hsAffineParts *result, uint32_t ignoreFlags=0); + static void LinInterp(const float k1, const float k2, const float t, float *result); + static void LinInterp(const hsScalarTriple *k1, const hsScalarTriple *k2, const float t, hsScalarTriple *result); + static void LinInterp(const hsColorRGBA *k1, const hsColorRGBA *k2, const float t, hsColorRGBA *result, uint32_t ignoreFlags=0); + static void LinInterp(const hsMatrix33 *k1, const hsMatrix33 *k2, const float t, hsMatrix33 *result, uint32_t ignoreFlags=0); + static void LinInterp(const hsMatrix44 *mat1, const hsMatrix44 *mat2, const float t, hsMatrix44 *out, uint32_t ignoreFlags=0); + static void LinInterp(const hsQuat *k1, const hsQuat *k2, const float t, hsQuat *result); + static void LinInterp(const hsScaleValue *k1, const hsScaleValue *k2, const float t, hsScaleValue *result); + static void LinInterp(const hsAffineParts *k1, const hsAffineParts *k2, const float t, hsAffineParts *result, uint32_t ignoreFlags=0); // Given a time value, find the enclosing keyframes and normalize time (0-1) - static void GetBoundaryKeyFrames(hsScalar time, uint32_t numKeys, void *keys, - uint32_t keySize, hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, hsScalar *p, hsBool forwards); + static void GetBoundaryKeyFrames(float time, uint32_t numKeys, void *keys, + uint32_t keySize, hsKeyFrame **kF1, hsKeyFrame **kF2, uint32_t *lastKeyIdx, float *p, hsBool forwards); }; diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp index 9b179ab7..6cd08a7c 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.cpp @@ -41,6 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsKeys.h" #include "hsStream.h" +#include const int hsKeyFrame::kMaxFrameNumber = 65535; @@ -149,8 +150,8 @@ hsBool hsQuatKey::CompareValue(hsQuatKey *key) ////////////////////////////////////////////////////////////////////////////// -const hsScalar hsCompressedQuatKey32::kOneOverRootTwo = 0.70710678; -const hsScalar hsCompressedQuatKey32::k10BitScaleRange = 1023 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey32::kOneOverRootTwo = 0.70710678; +const float hsCompressedQuatKey32::k10BitScaleRange = 1023 / (2 * kOneOverRootTwo); void hsCompressedQuatKey32::Read(hsStream *stream) { @@ -178,7 +179,7 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q) { q.Normalize(); uint32_t maxElement = kCompQuatNukeX; - hsScalar maxVal = hsABS(q.fX); + float maxVal = hsABS(q.fX); if (hsABS(q.fY) > maxVal) { maxElement = kCompQuatNukeY; @@ -256,7 +257,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fY = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fX = hsSquareRoot(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); + q.fX = sqrt(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeY: @@ -264,7 +265,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fY = hsSquareRoot(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); + q.fY = sqrt(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeZ: @@ -272,7 +273,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fY = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fW = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fZ = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); + q.fZ = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); break; } case kCompQuatNukeW: @@ -281,7 +282,7 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) q.fX = (fData >> 20 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fY = (fData >> 10 & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; q.fZ = (fData & 0x000003ff) / k10BitScaleRange - kOneOverRootTwo; - q.fW = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); + q.fW = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); break; } } @@ -289,9 +290,9 @@ void hsCompressedQuatKey32::GetQuat(hsQuat &q) ///////////////////////////////////////////////////////////////////////////// -const hsScalar hsCompressedQuatKey64::kOneOverRootTwo = 0.70710678; -const hsScalar hsCompressedQuatKey64::k20BitScaleRange = 1048575 / (2 * kOneOverRootTwo); -const hsScalar hsCompressedQuatKey64::k21BitScaleRange = 2097151 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey64::kOneOverRootTwo = 0.70710678; +const float hsCompressedQuatKey64::k20BitScaleRange = 1048575 / (2 * kOneOverRootTwo); +const float hsCompressedQuatKey64::k21BitScaleRange = 2097151 / (2 * kOneOverRootTwo); void hsCompressedQuatKey64::Read(hsStream *stream) { @@ -321,7 +322,7 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q) { q.Normalize(); uint32_t maxElement = kCompQuatNukeX; - hsScalar maxVal = hsABS(q.fX); + float maxVal = hsABS(q.fX); if (hsABS(q.fY) > maxVal) { maxElement = kCompQuatNukeY; @@ -407,7 +408,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fY = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fZ = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fX = hsSquareRoot(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); + q.fX = sqrt(1 - q.fY * q.fY - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeY: @@ -415,7 +416,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fZ = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fY = hsSquareRoot(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); + q.fY = sqrt(1 - q.fX * q.fX - q.fZ * q.fZ - q.fW *q.fW); break; } case kCompQuatNukeZ: @@ -423,7 +424,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fY = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fW = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fZ = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); + q.fZ = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fW *q.fW); break; } case kCompQuatNukeW: @@ -432,7 +433,7 @@ void hsCompressedQuatKey64::GetQuat(hsQuat &q) q.fX = ((fData[0] >> 10) & 0x000fffff) / k20BitScaleRange - kOneOverRootTwo; q.fY = (((fData[0] & 0x000003ff) << 11) | (fData[1] >> 21)) / k21BitScaleRange - kOneOverRootTwo; q.fZ = (fData[1] & 0x001fffff) / k21BitScaleRange - kOneOverRootTwo; - q.fW = hsSquareRoot(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); + q.fW = sqrt(1 - q.fX * q.fX - q.fY * q.fY - q.fZ * q.fZ); break; } } diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h index 66286745..e77c3d7a 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsKeys.h @@ -98,7 +98,7 @@ struct hsBezPoint3Key : public hsKeyFrame struct hsScalarKey : public hsKeyFrame { - hsScalar fValue; + float fValue; void Read(hsStream *stream); void Write(hsStream *stream); @@ -108,9 +108,9 @@ struct hsScalarKey : public hsKeyFrame struct hsBezScalarKey : public hsKeyFrame { - hsScalar fInTan; - hsScalar fOutTan; - hsScalar fValue; + float fInTan; + float fOutTan; + float fValue; void Read(hsStream *stream); void Write(hsStream *stream); @@ -138,8 +138,8 @@ struct hsCompressedQuatKey32 : public hsKeyFrame kCompQuatNukeW, }; - static const hsScalar kOneOverRootTwo; - static const hsScalar k10BitScaleRange; + static const float kOneOverRootTwo; + static const float k10BitScaleRange; void SetQuat(hsQuat &q); void GetQuat(hsQuat &q); @@ -163,9 +163,9 @@ struct hsCompressedQuatKey64 : public hsKeyFrame kCompQuatNukeW, }; - static const hsScalar kOneOverRootTwo; - static const hsScalar k20BitScaleRange; - static const hsScalar k21BitScaleRange; + static const float kOneOverRootTwo; + static const float k20BitScaleRange; + static const float k21BitScaleRange; void SetQuat(hsQuat &q); void GetQuat(hsQuat &q); diff --git a/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h b/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h index 431fa00d..53787750 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h +++ b/Sources/Plasma/PubUtilLib/plInterp/hsTimedValue.h @@ -54,8 +54,8 @@ public: }; protected: uint32_t fFlags; - hsScalar fDuration; - hsScalar fStartTime; + float fDuration; + float fStartTime; T fValue; T fGoal; @@ -67,8 +67,8 @@ public: uint32_t GetFlags() { return fFlags; } - void SetDuration(hsScalar duration); - hsScalar GetDuration() const { return fDuration; } + void SetDuration(float duration); + float GetDuration() const { return fDuration; } hsBool32 operator==(const hsTimedValue& v); hsTimedValue& operator=(const T& v) { SetValue(v); return *this; } @@ -83,22 +83,22 @@ public: void Reset() { fFlags |= (kIdle | kInstant); } - void StartClock(hsScalar s); - hsScalar GetStartTime() const { return fStartTime; } + void StartClock(float s); + float GetStartTime() const { return fStartTime; } const T& GetFrom() const { return fFrom; } - void Update(hsScalar s); + void Update(float s); - void WriteScalar(hsStream* s, hsScalar currSecs); - void Write(hsStream* s, hsScalar currSecs); + void WriteScalar(hsStream* s, float currSecs); + void Write(hsStream* s, float currSecs); - void ReadScalar(hsStream* s, hsScalar currSecs); - void Read(hsStream* s, hsScalar currSecs); + void ReadScalar(hsStream* s, float currSecs); + void Read(hsStream* s, float currSecs); }; template -void hsTimedValue::WriteScalar(hsStream* s, hsScalar currSecs) +void hsTimedValue::WriteScalar(hsStream* s, float currSecs) { s->WriteLE32(fFlags); @@ -115,7 +115,7 @@ void hsTimedValue::WriteScalar(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::Write(hsStream* s, hsScalar currSecs) +void hsTimedValue::Write(hsStream* s, float currSecs) { s->WriteLE32(fFlags); @@ -132,7 +132,7 @@ void hsTimedValue::Write(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::ReadScalar(hsStream* s, hsScalar currSecs) +void hsTimedValue::ReadScalar(hsStream* s, float currSecs) { fFlags = s->ReadLE32(); @@ -149,7 +149,7 @@ void hsTimedValue::ReadScalar(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::Read(hsStream* s, hsScalar currSecs) +void hsTimedValue::Read(hsStream* s, float currSecs) { fFlags = s->ReadLE32(); @@ -166,7 +166,7 @@ void hsTimedValue::Read(hsStream* s, hsScalar currSecs) } template -void hsTimedValue::SetDuration(hsScalar duration) +void hsTimedValue::SetDuration(float duration) { fDuration = duration; if( fDuration > 0 ) @@ -192,7 +192,7 @@ hsBool32 hsTimedValue::operator==(const hsTimedValue& v) } template -void hsTimedValue::StartClock(hsScalar s) +void hsTimedValue::StartClock(float s) { fStartTime = s; @@ -212,19 +212,19 @@ void hsTimedValue::StartClock(hsScalar s) } template -void hsTimedValue::Update(hsScalar s) +void hsTimedValue::Update(float s) { if( fFlags & kIdle ) return; hsAssert(fDuration > 0, "Instant should always be idle"); - hsScalar interp = (s - fStartTime) / fDuration; + float interp = (s - fStartTime) / fDuration; - if( interp >= hsScalar1 ) + if( interp >= 1.f ) { fValue = fGoal; - interp = hsScalar1; + interp = 1.f; fFlags |= kIdle; } else diff --git a/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp b/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp index 50df315b..820f80aa 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plATCEaseCurves.cpp @@ -44,8 +44,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com /////////////////////////////////////////////////////////////////////////////////////////////// -plATCEaseCurve *plATCEaseCurve::CreateEaseCurve(uint8_t type, hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plATCEaseCurve *plATCEaseCurve::CreateEaseCurve(uint8_t type, float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { if (type == plAnimEaseTypes::kConstAccel) return TRACKED_NEW plConstAccelEaseCurve(minLength, maxLength, length, startSpeed, goalSpeed); @@ -55,9 +55,9 @@ plATCEaseCurve *plATCEaseCurve::CreateEaseCurve(uint8_t type, hsScalar minLength return nil; } -void plATCEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate /* = false */) +void plATCEaseCurve::RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate /* = false */) { - hsScalar rate = 1; + float rate = 1; if (fSpeed == goalSpeed && fStartSpeed == startSpeed) // already there, no need to do anything return; @@ -72,45 +72,45 @@ void plATCEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBo SetLengthOnRate(rate); } -void plATCEaseCurve::SetLengthOnRate(hsScalar rate) +void plATCEaseCurve::SetLengthOnRate(float rate) { fLength = (fSpeed - fStartSpeed) / rate; if (fLength < 0) fLength = -fLength; } -hsScalar plATCEaseCurve::GetMinDistance() +float plATCEaseCurve::GetMinDistance() { if (fMinLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fMinLength; - hsScalar result = PositionGivenTime(fMinLength); + float result = PositionGivenTime(fMinLength); fLength = oldLength; return result; } -hsScalar plATCEaseCurve::GetMaxDistance() +float plATCEaseCurve::GetMaxDistance() { if (fMaxLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fMaxLength; - hsScalar result = PositionGivenTime(fMaxLength); + float result = PositionGivenTime(fMaxLength); fLength = oldLength; return result; } -hsScalar plATCEaseCurve::GetNormDistance() +float plATCEaseCurve::GetNormDistance() { if (fNormLength == 0) return 0; - hsScalar oldLength = fLength; + float oldLength = fLength; fLength = fNormLength; - hsScalar result = PositionGivenTime(fNormLength); + float result = PositionGivenTime(fNormLength); fLength = oldLength; return result; } @@ -149,8 +149,8 @@ plConstAccelEaseCurve::plConstAccelEaseCurve() RecalcToSpeed(0, 1); } -plConstAccelEaseCurve::plConstAccelEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plConstAccelEaseCurve::plConstAccelEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { fMinLength = minLength; fMaxLength = maxLength; @@ -174,22 +174,22 @@ plATCEaseCurve *plConstAccelEaseCurve::Clone() const return curve; } -void plConstAccelEaseCurve::SetLengthOnDistance(hsScalar dist) +void plConstAccelEaseCurve::SetLengthOnDistance(float dist) { fLength = 2 * dist / (fSpeed + fStartSpeed); } -hsScalar plConstAccelEaseCurve::PositionGivenTime(hsScalar time) const +float plConstAccelEaseCurve::PositionGivenTime(float time) const { - return (hsScalar)(fStartSpeed * time + (0.5 * (fSpeed - fStartSpeed) / fLength) * time * time); + return (float)(fStartSpeed * time + (0.5 * (fSpeed - fStartSpeed) / fLength) * time * time); } -hsScalar plConstAccelEaseCurve::VelocityGivenTime(hsScalar time) const +float plConstAccelEaseCurve::VelocityGivenTime(float time) const { return fStartSpeed + ((fSpeed - fStartSpeed) / fLength) * time; } -hsScalar plConstAccelEaseCurve::TimeGivenVelocity(hsScalar velocity) const +float plConstAccelEaseCurve::TimeGivenVelocity(float velocity) const { return (velocity - fStartSpeed) / ((fSpeed - fStartSpeed) / fLength); } @@ -204,8 +204,8 @@ plSplineEaseCurve::plSplineEaseCurve() RecalcToSpeed(0, 1); } -plSplineEaseCurve::plSplineEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed) +plSplineEaseCurve::plSplineEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed) { fMinLength = minLength; fMaxLength = maxLength; @@ -233,7 +233,7 @@ plATCEaseCurve *plSplineEaseCurve::Clone() const return curve; } -void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate /* = false */) +void plSplineEaseCurve::RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate /* = false */) { plATCEaseCurve::RecalcToSpeed(startSpeed, goalSpeed, preserveRate); @@ -241,7 +241,7 @@ void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, h // Note: "b" is always zero for the ease splines we're currently doing (and will remain that way // so long as the initial acceleration is zero. Can optimize a bit of the eval math to take // advantage of this. - hsScalar a, b, c, d; + float a, b, c, d; a = fStartSpeed; b = 0; @@ -254,16 +254,16 @@ void plSplineEaseCurve::RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, h fCoef[3] = d; } -void plSplineEaseCurve::SetLengthOnDistance(hsScalar dist) +void plSplineEaseCurve::SetLengthOnDistance(float dist) { - hsScalar curDist = PositionGivenTime(fLength); + float curDist = PositionGivenTime(fLength); fLength = fLength * dist / curDist; } -hsScalar plSplineEaseCurve::PositionGivenTime(hsScalar time) const +float plSplineEaseCurve::PositionGivenTime(float time) const { - hsScalar t1, t2, t3, t4; + float t1, t2, t3, t4; t1 = time / fLength; t2 = t1 * t1; t3 = t2 * t1; @@ -272,53 +272,53 @@ hsScalar plSplineEaseCurve::PositionGivenTime(hsScalar time) const return fLength * (fCoef[0] * t1 + fCoef[1] * t2 / 2 + fCoef[2] * t3 / 3 + fCoef[3] * t4 / 4); } -hsScalar plSplineEaseCurve::VelocityGivenTime(hsScalar time) const +float plSplineEaseCurve::VelocityGivenTime(float time) const { - hsScalar t1, t2, t3; + float t1, t2, t3; t1 = time / fLength; t2 = t1 * t1; t3 = t2 * t1; return fCoef[0] + fCoef[1] * t1 + fCoef[2] * t2 + fCoef[3] * t3; } -hsScalar plSplineEaseCurve::TimeGivenVelocity(hsScalar velocity) const +float plSplineEaseCurve::TimeGivenVelocity(float velocity) const { // Code based off of Graphics Gems V, pp 11-12 and // http://www.worldserver.com/turk/opensource/FindCubicRoots.c.txt // Solving the equation: fCoef[0] + fCoef[1] * t + fCoef[2] * t^2 + fCoef[3] * t^3 - velocity = 0 - hsScalar root; - hsScalar a = (fCoef[0] - velocity) / fCoef[3]; - hsScalar b = fCoef[1] / fCoef[3]; - hsScalar c = fCoef[2] / fCoef[3]; + float root; + float a = (fCoef[0] - velocity) / fCoef[3]; + float b = fCoef[1] / fCoef[3]; + float c = fCoef[2] / fCoef[3]; - hsScalar Q = (c * c - 3 * b) / 9; - hsScalar R = (2 * c * c * c - 9 * c * b + 27 * a) / 54; - hsScalar Q3 = Q * Q * Q; - hsScalar D = Q3 - R * R; + float Q = (c * c - 3 * b) / 9; + float R = (2 * c * c * c - 9 * c * b + 27 * a) / 54; + float Q3 = Q * Q * Q; + float D = Q3 - R * R; if (D >= 0) { // 3 roots, find the one in the range [0, 1] - const hsScalar pi = 3.14159; + const float pi = 3.14159; double theta = acos(R / sqrt(Q3)); double sqrtQ = sqrt(Q); - root = (hsScalar)(-2 * sqrtQ * cos((theta + 4 * pi) / 3) - c / 3); // Middle root, most likely to match + root = (float)(-2 * sqrtQ * cos((theta + 4 * pi) / 3) - c / 3); // Middle root, most likely to match if (root < 0.f || root > 1.f) { - root = (hsScalar)(-2 * sqrtQ * cos((theta + 2 * pi) / 3) - c / 3); // Lower root + root = (float)(-2 * sqrtQ * cos((theta + 2 * pi) / 3) - c / 3); // Lower root if (root < 0.f || root > 1.f) { - root = (hsScalar)(-2 * sqrtQ * cos(theta / 3) - c / 3); // Upper root + root = (float)(-2 * sqrtQ * cos(theta / 3) - c / 3); // Upper root } } } else // One root to the equation (I don't expect this to happen for ease splines, but JIC) { double E = sqrt(-D) + pow(fabs(R), 1.f / 3.f); - root = (hsScalar)((E + Q / E) - c / 3); + root = (float)((E + Q / E) - c / 3); if (R > 0) root = -root; } @@ -328,10 +328,10 @@ hsScalar plSplineEaseCurve::TimeGivenVelocity(hsScalar velocity) const hsAssert(false, "No valid root found while solving animation spline"); // Either a bug, or a rare case of floating-point inaccuracy. Either way, guess // the proper root as either the start or end of the curve based on the velocity. - hsScalar dStart = velocity - fStartSpeed; + float dStart = velocity - fStartSpeed; if (dStart < 0) dStart = -dStart; - hsScalar dEnd = velocity - fSpeed; + float dEnd = velocity - fSpeed; if (dEnd < 0) dEnd = -dEnd; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp index 56fd4da2..42bfae15 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.cpp @@ -45,11 +45,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plController.h" #include "hsFastMath.h" #include "hsResMgr.h" +#include -const hsScalar kSmallDelTime = 1.e-2f; -const hsScalar kInvSmallDelTime = 1.f / kSmallDelTime; -const hsScalar kTerminateDelTime = 1.e-3f; -const hsScalar kTerminateDelDistSq = .1f; +const float kSmallDelTime = 1.e-2f; +const float kInvSmallDelTime = 1.f / kSmallDelTime; +const float kTerminateDelTime = 1.e-3f; +const float kTerminateDelDistSq = .1f; plAnimPath::plAnimPath() : fController(nil), fLength(0), fMinDistSq(0), @@ -70,7 +71,7 @@ void plAnimPath::Reset() SetCurTime(0); } -void plAnimPath::SetCurTime(hsScalar t, uint32_t calcFlags) +void plAnimPath::SetCurTime(float t, uint32_t calcFlags) { fTime = t; if( !fController ) @@ -82,7 +83,7 @@ void plAnimPath::SetCurTime(hsScalar t, uint32_t calcFlags) return; } - hsScalar t0, t1, t2; + float t0, t1, t2; if( t < kSmallDelTime ) { @@ -144,7 +145,7 @@ void plAnimPath::ICalcBounds() int i; hsPoint3 pos; - hsTArray keyTimes; + hsTArray keyTimes; pc->GetKeyTimes(keyTimes); fCenter.Set(0,0,0); for( i = 0; i < keyTimes.GetCount() ; i++ ) @@ -152,19 +153,19 @@ void plAnimPath::ICalcBounds() pc->Interp(keyTimes[i], &pos); fCenter += pos; } - fCenter *= hsScalarInvert((hsScalar)keyTimes.GetCount()); + fCenter *= hsInvert((float)keyTimes.GetCount()); fRadius = 0; for( i = 0; i < keyTimes.GetCount(); i++ ) { pc->Interp(keyTimes[i], &pos); - hsScalar rad = (pos - fCenter).Magnitude(); + float rad = (pos - fCenter).Magnitude(); if( rad > fRadius ) fRadius = rad; } } -hsScalar plAnimPath::ICalcTotalLength() +float plAnimPath::ICalcTotalLength() { if( !(fController && fController->GetPosController()) ) return 0; @@ -183,6 +184,11 @@ void plAnimPath::SetController(plCompoundController* tmc) ICalcBounds(); } +float plAnimPath::GetMinDistance() const +{ + return sqrt(fMinDistSq); +} + void plAnimPath::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) { fLocalToWorld = l2w; @@ -224,15 +230,15 @@ void plAnimPath::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLEScalar(fMinDistSq); } -hsBool plAnimPath::OutOfRange(hsPoint3 &worldPt, hsScalar range) const +hsBool plAnimPath::OutOfRange(hsPoint3 &worldPt, float range) const { hsPoint3 pt = fWorldToLocal * worldPt; - hsScalar radius = (pt - fCenter).Magnitude() - fRadius; + float radius = (pt - fCenter).Magnitude() - fRadius; return( radius > range ); } -hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const +float plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const { if( !fController ) return 0; @@ -241,18 +247,18 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const plController *pc = fController->GetPosController(); - hsScalar minDistSq = 1.e33f; - hsScalar minTime = 0, delTime = 0; + float minDistSq = 1.e33f; + float minTime = 0, delTime = 0; // start search by using the time of the closest ctrl point int i; - hsTArray keyTimes; + hsTArray keyTimes; pc->GetKeyTimes(keyTimes); for( i = 0; i < keyTimes.GetCount(); i++ ) { - hsScalar t = keyTimes[i]; + float t = keyTimes[i]; hsPoint3 pos; pc->Interp(t, &pos); // handles easing - hsScalar distSq = (pt - pos).MagnitudeSquared(); + float distSq = (pt - pos).MagnitudeSquared(); if( distSq < minDistSq ) { minDistSq = distSq; @@ -263,8 +269,8 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const delTime = t - keyTimes[i - 1]; else { - hsScalar fore = keyTimes[i + 1] - t; - hsScalar back = t - keyTimes[i - 1]; + float fore = keyTimes[i + 1] - t; + float back = t - keyTimes[i - 1]; delTime = hsMaximum(fore, back); } } @@ -273,7 +279,7 @@ hsScalar plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const return GetExtremePoint(minTime, delTime, worldPt); } -hsScalar plAnimPath::GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoint3 &worldPt) const +float plAnimPath::GetExtremePoint(float lastTime, float delTime, hsPoint3 &worldPt) const { if( !fController ) return 0; @@ -284,7 +290,7 @@ hsScalar plAnimPath::GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoin return ICheckInterval(pt); } -hsScalar plAnimPath::ICheckInterval(hsPoint3 &pt) const +float plAnimPath::ICheckInterval(hsPoint3 &pt) const { if( fDelTime <= kTerminateDelTime && hsVector3(&fCurPos, &fPrevPos).MagnitudeSquared() < kTerminateDelDistSq) @@ -331,7 +337,7 @@ hsScalar plAnimPath::ICheckInterval(hsPoint3 &pt) const return 0; } -void plAnimPath::IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) const +void plAnimPath::IInitInterval(float time, float delTime, hsPoint3 &pt) const { plController* pc = fController->GetPosController(); @@ -395,7 +401,7 @@ void plAnimPath::IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) co } } -hsScalar plAnimPath::ISubDivBack(hsPoint3 &pt) const +float plAnimPath::ISubDivBack(hsPoint3 &pt) const { fNextTime = fThisTime; fNextDistSq = fThisDistSq; @@ -419,7 +425,7 @@ hsScalar plAnimPath::ISubDivBack(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::ISubDivFore(hsPoint3 &pt) const +float plAnimPath::ISubDivFore(hsPoint3 &pt) const { fLastTime = fThisTime; fLastDistSq = fThisDistSq; @@ -443,7 +449,7 @@ hsScalar plAnimPath::ISubDivFore(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::IShiftBack(hsPoint3 &pt) const +float plAnimPath::IShiftBack(hsPoint3 &pt) const { if( !GetWrap() && (fLastTime <= 0) ) return ISubDivBack(pt); @@ -470,7 +476,7 @@ hsScalar plAnimPath::IShiftBack(hsPoint3 &pt) const return ICheckInterval(pt); } -hsScalar plAnimPath::IShiftFore(hsPoint3 &pt) const +float plAnimPath::IShiftFore(hsPoint3 &pt) const { if( !GetWrap() &&(fNextTime >= fLength) ) return ISubDivFore(pt); @@ -509,10 +515,10 @@ void plAnimPath::IMakeSegment(hsTArray& idx, hsTArray& pos, hsVector3 up; up.Set(0,0,1.f); - const hsScalar kOutLength = 0.25f; + const float kOutLength = 0.25f; hsVector3 a = del % up; - hsScalar magSq = a.MagnitudeSquared(); + float magSq = a.MagnitudeSquared(); if( magSq < 1.e-3f ) { a.Set(kOutLength, 0, 0); @@ -585,12 +591,12 @@ void plAnimPath::MakeDrawList(hsTArray& idx, hsTArray& pos) ident.Reset(); SetTransform(ident, ident); - hsScalar numSegs = fRadius; // crude estimate of arclength + float numSegs = fRadius; // crude estimate of arclength if (numSegs>100) numSegs=100; - hsScalar animLen = GetLength(); - hsScalar timeInc = animLen/numSegs; - hsScalar time=0; + float animLen = GetLength(); + float timeInc = animLen/numSegs; + float time=0; hsPoint3 p1, p2; SetCurTime(0, kCalcPosOnly); @@ -631,9 +637,9 @@ void plAnimPath::ComputeArcLenDeltas(int32_t numSamples) // compute arc len deltas fArcLenDeltas.Reset(); fArcLenDeltas.SetCount(numSamples); - hsScalar animLen = GetLength(); - hsScalar timeInc = animLen/(numSamples-1); // use num-1 since we'll create the zeroth entry by hand - hsScalar time=0; + float animLen = GetLength(); + float timeInc = animLen/(numSamples-1); // use num-1 since we'll create the zeroth entry by hand + float time=0; hsPoint3 p1, p2; int32_t cnt=0; @@ -671,7 +677,7 @@ void plAnimPath::ComputeArcLenDeltas(int32_t numSamples) // Returns time of point (at least) arcLength units away from point at startTime. // Also sets strtSrchIdx for incremental searching. // -hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, hsBool bwd, +float plAnimPath::GetLookAheadTime(float startTime, float arcLengthIn, hsBool bwd, int32_t* startSrchIdx) { if (arcLengthIn==0) @@ -685,7 +691,7 @@ hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, hsAssert(startSrchIdx, "nil var for startSrchIdx"); - hsScalar oldTime=fTime; + float oldTime=fTime; ComputeArcLenDeltas(); // precompute first time only @@ -736,14 +742,14 @@ hsScalar plAnimPath::GetLookAheadTime(hsScalar startTime, hsScalar arcLengthIn, GetPosition(&pos); // startTime position hsPoint3 pos2; - hsScalar endTime = fArcLenDeltas[nearestIdx].fT; + float endTime = fArcLenDeltas[nearestIdx].fT; SetCurTime(endTime, kCalcPosOnly); GetPosition(&pos2); // position at nearest sample point - hsScalar curArcLen = hsVector3(&pos2, &pos).Magnitude(); - hsScalar curTime=0; + float curArcLen = hsVector3(&pos2, &pos).Magnitude(); + float curTime=0; hsBool quit=false; - hsScalar timeOut = 0; + float timeOut = 0; int32_t inc = bwd ? -1 : 1; // now sum distance deltas until we exceed the desired arcLen if (curArcLen=0 && percent<=1, "illegal percent value"); // 3. compute interpolated time value using percent diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h index b436ffc8..df5b8034 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimPath.h @@ -70,12 +70,12 @@ protected: hsPoint3 fPos; hsVector3 fVel; hsVector3 fAccel; - hsScalar fTime; // presumably seconds + float fTime; // presumably seconds // The paramters (and options) for this curve. uint32_t fAnimPathFlags; // currently set at runtime only - hsScalar fMinDistSq; - hsScalar fLength; // presumably seconds + float fMinDistSq; + float fLength; // presumably seconds // Controller stuff only works in local space. hsMatrix44 fLocalToWorld; @@ -83,31 +83,31 @@ protected: // Bounding sphere available for ignoring out of range hsPoint3 fCenter; - hsScalar fRadius; + float fRadius; plCompoundController* fController; hsAffineParts fParts; // These are temps during a search. They're here to avoid recalc. - mutable hsScalar fLastTime; - mutable hsScalar fLastDistSq; - mutable hsScalar fThisTime; - mutable hsScalar fThisDistSq; - mutable hsScalar fNextTime; - mutable hsScalar fNextDistSq; - mutable hsScalar fDelTime; + mutable float fLastTime; + mutable float fLastDistSq; + mutable float fThisTime; + mutable float fThisDistSq; + mutable float fNextTime; + mutable float fNextDistSq; + mutable float fDelTime; mutable hsPoint3 fPrevPos, fCurPos; void ICalcBounds(); - hsScalar ICalcTotalLength(); - hsScalar IShiftFore(hsPoint3 &pt) const; - hsScalar IShiftBack(hsPoint3 &pt) const; - hsScalar ISubDivFore(hsPoint3 &pt) const; - hsScalar ISubDivBack(hsPoint3 &pt) const; - void IInitInterval(hsScalar time, hsScalar delTime, hsPoint3 &pt) const; - hsScalar ICheckInterval(hsPoint3 &pt) const; - hsScalar IBestTime() const { return fLastDistSq < fThisDistSq + float ICalcTotalLength(); + float IShiftFore(hsPoint3 &pt) const; + float IShiftBack(hsPoint3 &pt) const; + float ISubDivFore(hsPoint3 &pt) const; + float ISubDivBack(hsPoint3 &pt) const; + void IInitInterval(float time, float delTime, hsPoint3 &pt) const; + float ICheckInterval(hsPoint3 &pt) const; + float IBestTime() const { return fLastDistSq < fThisDistSq ? (fLastDistSq < fNextDistSq ? fLastTime : fNextTime) @@ -122,9 +122,9 @@ protected: // For computing arclen struct ArcLenDeltaInfo { - hsScalar fT; - hsScalar fArcLenDelta; // arc len distance from prev sample point (array entry) - ArcLenDeltaInfo(hsScalar t, hsScalar del) : fT(t),fArcLenDelta(del) {} + float fT; + float fArcLenDelta; // arc len distance from prev sample point (array entry) + ArcLenDeltaInfo(float t, float del) : fT(t),fArcLenDelta(del) {} ArcLenDeltaInfo() : fT(0),fArcLenDelta(0) {} }; hsTArray fArcLenDeltas; @@ -153,15 +153,15 @@ public: void SetFarthest(hsBool on) { if(on)fAnimPathFlags |= kFarthest; else fAnimPathFlags &= ~kFarthest; } hsBool GetFarthest() const { return 0 != (fAnimPathFlags & kFarthest); } - void SetCurTime(hsScalar t, uint32_t calcFlags=0); - hsScalar GetCurTime() const { return fTime; } + void SetCurTime(float t, uint32_t calcFlags=0); + float GetCurTime() const { return fTime; } void SetController(plCompoundController* tmc); plCompoundController* GetController() const { return fController; } - hsScalar GetLength() const { return fLength; } // seconds + float GetLength() const { return fLength; } // seconds - void SetMinDistance(hsScalar d) { fMinDistSq = d*d; } - hsScalar GetMinDistance() const { return hsSquareRoot(fMinDistSq); } + void SetMinDistance(float d) { fMinDistSq = d*d; } + float GetMinDistance() const; hsMatrix44* GetMatrix44(hsMatrix44* xOut) const { *xOut = fXform; return xOut; } hsPoint3* GetPosition(hsPoint3* pOut) const { *pOut = fPos; return pOut; } @@ -170,16 +170,16 @@ public: hsVector3* GetUp(hsVector3* uOut) const { uOut->Set(fXform.fMap[0][1], fXform.fMap[1][1], fXform.fMap[2][1]); return uOut; } hsVector3* GetAcceleration(hsVector3* aOut) const { *aOut = fAccel; return aOut; } - hsBool OutOfRange(hsPoint3 &pt, hsScalar range) const; + hsBool OutOfRange(hsPoint3 &pt, float range) const; const hsAffineParts* Parts() const { return &fParts; } void InitParts(const hsAffineParts& p) { fParts = p; } - hsScalar GetExtremePoint(hsPoint3 &worldPt) const; // Exhaustive search - hsScalar GetExtremePoint(hsScalar lastTime, hsScalar delTime, hsPoint3 &worldPt) const; // Incremental search + float GetExtremePoint(hsPoint3 &worldPt) const; // Exhaustive search + float GetExtremePoint(float lastTime, float delTime, hsPoint3 &worldPt) const; // Incremental search // for arclen usage void ComputeArcLenDeltas(int32_t numSamples=256); - hsScalar GetLookAheadTime(hsScalar startTime, hsScalar arcLength, hsBool bwd, int32_t* startSrchIdx); + float GetLookAheadTime(float startTime, float arcLength, hsBool bwd, int32_t* startSrchIdx); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp index 2581dd47..e036e8a6 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp @@ -212,7 +212,7 @@ void plAnimTimeConvert::ResetWrap() fFlags &= (~kWrap & ~kNeedsReset); } -hsScalar plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double start, double end) +float plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double start, double end) { start -= curve->fBeginWorldTime; end -= curve->fBeginWorldTime; @@ -224,12 +224,12 @@ hsScalar plAnimTimeConvert::ICalcEaseTime(const plATCEaseCurve *curve, double st end = curve->fLength; - hsScalar delSecs = 0; + float delSecs = 0; if (start < curve->fLength) { // Redundant eval... but only when easing. - delSecs = curve->PositionGivenTime((hsScalar)end) - curve->PositionGivenTime((hsScalar)start); + delSecs = curve->PositionGivenTime((float)end) - curve->PositionGivenTime((float)start); } return delSecs; } @@ -244,7 +244,7 @@ void plAnimTimeConvert::IClearSpeedEase() fSpeedEaseCurve = nil; } -void plAnimTimeConvert::ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameStop) +void plAnimTimeConvert::ICheckTimeCallbacks(float frameStart, float frameStop) { int i; for( i = fCallbackMsgs.GetCount()-1; i >= 0; --i ) @@ -262,7 +262,7 @@ void plAnimTimeConvert::ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameS } } -hsBool plAnimTimeConvert::ITimeInFrame(hsScalar secs, hsScalar start, hsScalar stop) +hsBool plAnimTimeConvert::ITimeInFrame(float secs, float start, float stop) { if (secs == start && secs == stop) return true; @@ -328,7 +328,7 @@ void plAnimTimeConvert::ISendCallback(int i) } } -plAnimTimeConvert& plAnimTimeConvert::IStop(double time, hsScalar animTime) +plAnimTimeConvert& plAnimTimeConvert::IStop(double time, float animTime) { if( IsStopped() ) return *this; @@ -352,7 +352,7 @@ plAnimTimeConvert& plAnimTimeConvert::IStop(double time, hsScalar animTime) return *this; } -plAnimTimeConvert& plAnimTimeConvert::IProcessStateChange(double worldTime, hsScalar animTime /* = -1 */) +plAnimTimeConvert& plAnimTimeConvert::IProcessStateChange(double worldTime, float animTime /* = -1 */) { if (fStates.size() > 0 && worldTime < fStates.front()->fStartWorldTime) return *this; // Sorry... state saves only work in the forward direction @@ -468,11 +468,11 @@ hsBool plAnimTimeConvert::IsStoppedAt(double wSecs) const return IIsStoppedAt(wSecs, state->fFlags, state->fEaseCurve); } -hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) +float plAnimTimeConvert::WorldToAnimTime(double wSecs) { //hsAssert(wSecs >= fLastEvalWorldTime, "Tried to eval a time that's earlier than the last eval time."); double d = wSecs - fLastEvalWorldTime; - hsScalar f = fCurrentAnimTime; + float f = fCurrentAnimTime; if (wSecs < fLastStateChange) { @@ -505,8 +505,8 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) return fCurrentAnimTime; } - hsScalar note = fCurrentAnimTime - f; - hsScalar secs = 0, delSecs = 0; + float note = fCurrentAnimTime - f; + float secs = 0, delSecs = 0; if (fCurrentEaseCurve != nil) { @@ -514,7 +514,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) if (wSecs > fCurrentEaseCurve->GetEndWorldTime()) { if (fFlags & kEasingIn) - delSecs += hsScalar(wSecs - fCurrentEaseCurve->GetEndWorldTime()) * fSpeed; + delSecs += float(wSecs - fCurrentEaseCurve->GetEndWorldTime()) * fSpeed; IClearSpeedEase(); @@ -524,7 +524,7 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) else { // The easy case... playing the animation at a constant speed. - delSecs = hsScalar(wSecs - fLastEvalWorldTime) * fSpeed; + delSecs = float(wSecs - fLastEvalWorldTime) * fSpeed; } if (fFlags & kBackwards) @@ -617,12 +617,12 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs) return fCurrentAnimTime = secs; } -hsScalar plAnimTimeConvert::WorldToAnimTimeNoUpdate(double wSecs) const +float plAnimTimeConvert::WorldToAnimTimeNoUpdate(double wSecs) const { return IWorldToAnimTimeNoUpdate(wSecs, IGetState(wSecs)); } -hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state) +float plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state) { //hsAssert(wSecs >= fLastEvalWorldTime, "Tried to eval a time that's earlier than the last eval time."); if (state == nil) @@ -631,7 +631,7 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s if (state->fFlags & kStopped) return state->fStartAnimTime; - hsScalar secs = 0, delSecs = 0; + float secs = 0, delSecs = 0; if (state->fEaseCurve != nil) { @@ -639,13 +639,13 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s if (wSecs > state->fEaseCurve->GetEndWorldTime()) { if (state->fFlags & kEasingIn) - delSecs += hsScalar(wSecs - state->fEaseCurve->GetEndWorldTime()) * state->fSpeed; + delSecs += float(wSecs - state->fEaseCurve->GetEndWorldTime()) * state->fSpeed; } } else { // The easy case... playing the animation at a constant speed. - delSecs = hsScalar(wSecs - state->fStartWorldTime) * state->fSpeed; + delSecs = float(wSecs - state->fStartWorldTime) * state->fSpeed; } if (state->fFlags & kBackwards) @@ -720,12 +720,12 @@ hsScalar plAnimTimeConvert::IWorldToAnimTimeNoUpdate(double wSecs, plATCState *s return secs; } -hsScalar plAnimTimeConvert::IWorldToAnimTimeBeforeState(double wSecs) const +float plAnimTimeConvert::IWorldToAnimTimeBeforeState(double wSecs) const { return IWorldToAnimTimeNoUpdate(wSecs, IGetState(wSecs)); } -void plAnimTimeConvert::SetCurrentAnimTime(hsScalar s, hsBool jump /* = false */) +void plAnimTimeConvert::SetCurrentAnimTime(float s, hsBool jump /* = false */) { // We're setting the anim value for whenever we last evaluated. fFlags |= kForcedMove; @@ -743,7 +743,7 @@ void plAnimTimeConvert::SetCurrentAnimTime(hsScalar s, hsBool jump /* = false */ IProcessStateChange(hsTimer::GetSysSeconds(), fCurrentAnimTime); } -void plAnimTimeConvert::SetEase(hsBool easeIn, uint8_t type, hsScalar minLength, hsScalar maxLength, hsScalar normLength) +void plAnimTimeConvert::SetEase(hsBool easeIn, uint8_t type, float minLength, float maxLength, float normLength) { if (easeIn) { @@ -759,24 +759,24 @@ void plAnimTimeConvert::SetEase(hsBool easeIn, uint8_t type, hsScalar minLength, -hsScalar plAnimTimeConvert::GetBestStopDist(hsScalar min, hsScalar max, hsScalar norm, hsScalar time) const +float plAnimTimeConvert::GetBestStopDist(float min, float max, float norm, float time) const { - hsScalar bestTime = -1; - hsScalar bestDist = -1; + float bestTime = -1; + float bestDist = -1; if (fStopPoints.GetCount() == 0) return norm; - hsScalar curTime; - hsScalar curDist; + float curTime; + float curDist; int i; for (i = 0; i < fStopPoints.GetCount(); i++) { - hsScalar stop = fStopPoints.Get(i); + float stop = fStopPoints.Get(i); if (IsLooped()) { - hsScalar loopDist; + float loopDist; if (IsBackwards()) { if ((time >= fLoopBegin && stop < fLoopBegin) || @@ -841,9 +841,9 @@ hsScalar plAnimTimeConvert::GetBestStopDist(hsScalar min, hsScalar max, hsScalar } // Passing in a rate of zero specifies an immediate change. -void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) +void plAnimTimeConvert::SetSpeed(float goal, float rate /* = 0 */) { - hsScalar curSpeed = fSpeed; + float curSpeed = fSpeed; fSpeed = goal; @@ -860,7 +860,7 @@ void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) if (fCurrentEaseCurve != nil) { double easeTime = curTime - fCurrentEaseCurve->fBeginWorldTime; - curSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)easeTime); + curSpeed = fCurrentEaseCurve->VelocityGivenTime((float)easeTime); } if (fSpeedEaseCurve != nil) { @@ -869,7 +869,7 @@ void plAnimTimeConvert::SetSpeed(hsScalar goal, hsScalar rate /* = 0 */) } else { - hsScalar length; + float length; length = (goal - curSpeed) / rate; if (length < 0) length = -length; @@ -975,7 +975,7 @@ plAnimTimeConvert& plAnimTimeConvert::Stop(double stopTime) if (stopTime < 0) stopTime = hsTimer::GetSysSeconds(); - hsScalar stopAnimTime = WorldToAnimTimeNoUpdate(stopTime); + float stopAnimTime = WorldToAnimTimeNoUpdate(stopTime); SetFlag(kEasingIn, false); @@ -984,11 +984,11 @@ plAnimTimeConvert& plAnimTimeConvert::Stop(double stopTime) return IStop(stopTime, fCurrentAnimTime); } - hsScalar currSpeed; + float currSpeed; if (fCurrentEaseCurve == nil || stopTime >= fCurrentEaseCurve->GetEndWorldTime()) currSpeed = fSpeed; else - currSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)(stopTime - fCurrentEaseCurve->fBeginWorldTime)); + currSpeed = fCurrentEaseCurve->VelocityGivenTime((float)(stopTime - fCurrentEaseCurve->fBeginWorldTime)); fEaseOutCurve->RecalcToSpeed(currSpeed > fSpeed ? currSpeed : fSpeed, 0); fEaseOutCurve->SetLengthOnDistance(GetBestStopDist(fEaseOutCurve->GetMinDistance(), fEaseOutCurve->GetMaxDistance(), @@ -1013,11 +1013,11 @@ plAnimTimeConvert& plAnimTimeConvert::Start(double startTime) if (fEaseInCurve != nil) { - hsScalar currSpeed; + float currSpeed; if (fCurrentEaseCurve == nil || startTime >= fCurrentEaseCurve->GetEndWorldTime()) currSpeed = 0; else - currSpeed = fCurrentEaseCurve->VelocityGivenTime((hsScalar)(startTime - fCurrentEaseCurve->fBeginWorldTime)); + currSpeed = fCurrentEaseCurve->VelocityGivenTime((float)(startTime - fCurrentEaseCurve->fBeginWorldTime)); if (currSpeed <= fSpeed) { @@ -1119,7 +1119,7 @@ plAnimTimeConvert& plAnimTimeConvert::Loop(hsBool on) return *this; } -plAnimTimeConvert& plAnimTimeConvert::PlayToTime(hsScalar time) +plAnimTimeConvert& plAnimTimeConvert::PlayToTime(float time) { fFlags |= kNeedsReset; if (fCurrentAnimTime > time) @@ -1144,7 +1144,7 @@ plAnimTimeConvert& plAnimTimeConvert::PlayToTime(hsScalar time) return *this; } -plAnimTimeConvert& plAnimTimeConvert::PlayToPercentage(hsScalar percent) +plAnimTimeConvert& plAnimTimeConvert::PlayToPercentage(float percent) { return PlayToTime(fBegin + (fEnd - fBegin) * percent); } @@ -1280,7 +1280,7 @@ hsBool plAnimTimeConvert::HandleCmd(plAnimCmdMsg* modMsg) if (fCurrentAnimTime == fEnd) return true; double currTime = hsTimer::GetSysSeconds(); - hsScalar newTime = fCurrentAnimTime + hsTimer::GetDelSysSeconds(); + float newTime = fCurrentAnimTime + hsTimer::GetDelSysSeconds(); if (newTime > fEnd) { newTime = fEnd; @@ -1293,7 +1293,7 @@ hsBool plAnimTimeConvert::HandleCmd(plAnimCmdMsg* modMsg) if (fCurrentAnimTime == fBegin) return true; double currTime = hsTimer::GetSysSeconds(); - hsScalar newTime = fCurrentAnimTime - hsTimer::GetDelSysSeconds(); + float newTime = fCurrentAnimTime - hsTimer::GetDelSysSeconds(); if (newTime < fBegin) { newTime = fBegin; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h index f695a9db..739aa594 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.h @@ -64,13 +64,13 @@ class plAnimTimeConvert : public plCreatable protected: uint16_t fFlags; - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopEnd; - hsScalar fLoopBegin; - hsScalar fSpeed; - hsScalar fCurrentAnimTime; - hsScalar fWrapTime; + float fBegin; + float fEnd; + float fLoopEnd; + float fLoopBegin; + float fSpeed; + float fCurrentAnimTime; + float fWrapTime; double fLastEvalWorldTime; // Do not change fLastEvalWorldTime anywhere except WorldToAnimTime() @@ -80,7 +80,7 @@ protected: typedef std::list plATCStateList; plATCStateList fStates; - hsTArray fStopPoints; + hsTArray fStopPoints; hsTArray fCallbackMsgs; ///////////////////////// @@ -94,19 +94,19 @@ protected: // ///////////////////////// - hsScalar fInitialBegin; - hsScalar fInitialEnd; + float fInitialBegin; + float fInitialEnd; - static hsScalar ICalcEaseTime(const plATCEaseCurve *curve, double start, double end); + static float ICalcEaseTime(const plATCEaseCurve *curve, double start, double end); void IClearSpeedEase(); - void ICheckTimeCallbacks(hsScalar frameStart, hsScalar frameStop); - hsBool ITimeInFrame(hsScalar secs, hsScalar start, hsScalar stop); + void ICheckTimeCallbacks(float frameStart, float frameStop); + hsBool ITimeInFrame(float secs, float start, float stop); void ISendCallback(int i); - plAnimTimeConvert& IStop(double time, hsScalar animTime); + plAnimTimeConvert& IStop(double time, float animTime); hsBool IIsStoppedAt(const double &wSecs, const uint32_t &flags, const plATCEaseCurve *curve) const; - plAnimTimeConvert& IProcessStateChange(double worldTime, hsScalar animTime = -1); + plAnimTimeConvert& IProcessStateChange(double worldTime, float animTime = -1); void IFlushOldStates(); void IClearAllStates(); plATCState *IGetState(double wSecs) const; @@ -128,30 +128,30 @@ public: // ALL WorldToAnimTime functions are only valid if called with a time >= fLastEvalWorldTime. hsBool IsStoppedAt(double wSecs) const; - hsScalar WorldToAnimTime(double wSecs); - hsScalar WorldToAnimTimeNoUpdate(double wSecs) const; // convert time but don't fire triggers or set state + float WorldToAnimTime(double wSecs); + float WorldToAnimTimeNoUpdate(double wSecs) const; // convert time but don't fire triggers or set state protected: - static hsScalar IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state); - hsScalar IWorldToAnimTimeBeforeState(double wSecs) const; + static float IWorldToAnimTimeNoUpdate(double wSecs, plATCState *state); + float IWorldToAnimTimeBeforeState(double wSecs) const; public: - void SetBegin(hsScalar s) { fBegin = s; } - void SetEnd(hsScalar s) { fEnd = s; } - void SetSpeed(hsScalar goal, hsScalar rate = 0); - void SetLoopPoints(hsScalar begin, hsScalar end) { SetLoopBegin(begin); SetLoopEnd(end); } - void SetLoopBegin(hsScalar s) { fLoopBegin = s; } - void SetLoopEnd(hsScalar s) { fLoopEnd = s; } - void SetEase(hsBool easeIn, uint8_t inType, hsScalar minLength, hsScalar maxLength, hsScalar inLength); + void SetBegin(float s) { fBegin = s; } + void SetEnd(float s) { fEnd = s; } + void SetSpeed(float goal, float rate = 0); + void SetLoopPoints(float begin, float end) { SetLoopBegin(begin); SetLoopEnd(end); } + void SetLoopBegin(float s) { fLoopBegin = s; } + void SetLoopEnd(float s) { fLoopEnd = s; } + void SetEase(hsBool easeIn, uint8_t inType, float minLength, float maxLength, float inLength); void SetCurrentEaseCurve(int x); // 0=nil, 1=easeIn, 2=easeOut, 3=speed - hsScalar GetBegin() const { return fBegin; } - hsScalar GetEnd() const { return fEnd; } - hsScalar GetLoopBegin() const { return fLoopBegin; } - hsScalar GetLoopEnd() const { return fLoopEnd; } - hsScalar GetSpeed() const { return fSpeed; } - hsTArray &GetStopPoints() { return fStopPoints; } - hsScalar GetBestStopDist(hsScalar min, hsScalar max, hsScalar norm, hsScalar time) const; + float GetBegin() const { return fBegin; } + float GetEnd() const { return fEnd; } + float GetLoopBegin() const { return fLoopBegin; } + float GetLoopEnd() const { return fLoopEnd; } + float GetSpeed() const { return fSpeed; } + hsTArray &GetStopPoints() { return fStopPoints; } + float GetBestStopDist(float min, float max, float norm, float time) const; int GetCurrentEaseCurve() const; // returns 0=nil, 1=easeIn, 2=easeOut, 3=speed void ResizeStates(int cnt); @@ -164,8 +164,8 @@ public: plAnimTimeConvert& Stop(hsBool on); plAnimTimeConvert& Stop(double s = -1.0); plAnimTimeConvert& Start(double s = -1.0); - plAnimTimeConvert& PlayToTime(hsScalar time); - plAnimTimeConvert& PlayToPercentage(hsScalar percent); // zero to one. + plAnimTimeConvert& PlayToTime(float time); + plAnimTimeConvert& PlayToPercentage(float percent); // zero to one. plAnimTimeConvert& Loop(hsBool on); plAnimTimeConvert& Loop() { return Loop(true); } @@ -181,8 +181,8 @@ public: hsBool IsForewards() const { return !(fFlags & kBackwards); } double LastEvalWorldTime() const { return fLastEvalWorldTime; } - hsScalar CurrentAnimTime() const { return fCurrentAnimTime; } - void SetCurrentAnimTime(hsScalar s, hsBool jump = false); + float CurrentAnimTime() const { return fCurrentAnimTime; } + void SetCurrentAnimTime(float s, hsBool jump = false); virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -224,21 +224,21 @@ public: class plATCEaseCurve : public plCreatable { protected: - hsScalar fStartSpeed; - hsScalar fMinLength; - hsScalar fMaxLength; - hsScalar fNormLength; + float fStartSpeed; + float fMinLength; + float fMaxLength; + float fNormLength; public: CLASSNAME_REGISTER( plATCEaseCurve ); GETINTERFACE_ANY( plATCEaseCurve, plCreatable ); double fBeginWorldTime; - hsScalar fLength; - hsScalar fSpeed; // The anim's target ("full") speed. + float fLength; + float fSpeed; // The anim's target ("full") speed. - static plATCEaseCurve *CreateEaseCurve(uint8_t type, hsScalar minLength, hsScalar maxLength, hsScalar normLength, - hsScalar startSpeed, hsScalar goalSpeed); + static plATCEaseCurve *CreateEaseCurve(uint8_t type, float minLength, float maxLength, float normLength, + float startSpeed, float goalSpeed); double GetEndWorldTime() const { return fBeginWorldTime + fLength; } @@ -246,40 +246,40 @@ public: virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - virtual void RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate = false); - virtual void SetLengthOnRate(hsScalar rate); - virtual void SetLengthOnDistance(hsScalar dist) = 0; - virtual hsScalar PositionGivenTime(hsScalar time) const = 0; - virtual hsScalar VelocityGivenTime(hsScalar time) const = 0; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const = 0; - virtual hsScalar GetMinDistance(); - virtual hsScalar GetMaxDistance(); - virtual hsScalar GetNormDistance(); + virtual void RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate = false); + virtual void SetLengthOnRate(float rate); + virtual void SetLengthOnDistance(float dist) = 0; + virtual float PositionGivenTime(float time) const = 0; + virtual float VelocityGivenTime(float time) const = 0; + virtual float TimeGivenVelocity(float velocity) const = 0; + virtual float GetMinDistance(); + virtual float GetMaxDistance(); + virtual float GetNormDistance(); }; class plConstAccelEaseCurve : public plATCEaseCurve { public: plConstAccelEaseCurve(); - plConstAccelEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed); + plConstAccelEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed); CLASSNAME_REGISTER( plConstAccelEaseCurve ); GETINTERFACE_ANY( plConstAccelEaseCurve, plATCEaseCurve ); virtual plATCEaseCurve *Clone() const; - virtual void SetLengthOnDistance(hsScalar dist); - virtual hsScalar PositionGivenTime(hsScalar time) const; - virtual hsScalar VelocityGivenTime(hsScalar time) const; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const; + virtual void SetLengthOnDistance(float dist); + virtual float PositionGivenTime(float time) const; + virtual float VelocityGivenTime(float time) const; + virtual float TimeGivenVelocity(float velocity) const; }; class plSplineEaseCurve : public plATCEaseCurve { public: plSplineEaseCurve(); - plSplineEaseCurve(hsScalar minLength, hsScalar maxLength, hsScalar length, - hsScalar startSpeed, hsScalar goalSpeed); + plSplineEaseCurve(float minLength, float maxLength, float length, + float startSpeed, float goalSpeed); CLASSNAME_REGISTER( plSplineEaseCurve ); GETINTERFACE_ANY( plSplineEaseCurve, plATCEaseCurve ); @@ -288,13 +288,13 @@ public: virtual void Write(hsStream *s, hsResMgr *mgr); virtual plATCEaseCurve *Clone() const; - virtual void RecalcToSpeed(hsScalar startSpeed, hsScalar goalSpeed, hsBool preserveRate = false); - virtual void SetLengthOnDistance(hsScalar dist); - virtual hsScalar PositionGivenTime(hsScalar time) const; - virtual hsScalar VelocityGivenTime(hsScalar time) const; - virtual hsScalar TimeGivenVelocity(hsScalar velocity) const; + virtual void RecalcToSpeed(float startSpeed, float goalSpeed, hsBool preserveRate = false); + virtual void SetLengthOnDistance(float dist); + virtual float PositionGivenTime(float time) const; + virtual float VelocityGivenTime(float time) const; + virtual float TimeGivenVelocity(float velocity) const; - hsScalar fCoef[4]; + float fCoef[4]; }; class plATCState @@ -307,15 +307,15 @@ public: void Write(hsStream *s, hsResMgr *mgr); double fStartWorldTime; - hsScalar fStartAnimTime; + float fStartAnimTime; uint8_t fFlags; - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopBegin; - hsScalar fLoopEnd; - hsScalar fSpeed; - hsScalar fWrapTime; + float fBegin; + float fEnd; + float fLoopBegin; + float fLoopEnd; + float fSpeed; + float fWrapTime; plATCEaseCurve *fEaseCurve; }; diff --git a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp index dc513698..439a790a 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plController.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plController.cpp @@ -79,7 +79,7 @@ plLeafController::~plLeafController() delete[] fKeys; } -void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, float* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kScalarKeyFrame || fType == hsKeyFrame::kBezScalarKeyFrame, kInvalidInterpString); @@ -87,7 +87,7 @@ void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCache if (fType == hsKeyFrame::kScalarKeyFrame) { hsScalarKey *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsScalarKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(k1->fValue, k2->fValue, t, result); @@ -95,14 +95,14 @@ void plLeafController::Interp(hsScalar time, hsScalar* result, plControllerCache else { hsBezScalarKey *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezScalarKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kPoint3KeyFrame || fType == hsKeyFrame::kBezPoint3KeyFrame, kInvalidInterpString); @@ -110,7 +110,7 @@ void plLeafController::Interp(hsScalar time, hsScalarTriple* result, plControlle if (fType == hsKeyFrame::kPoint3KeyFrame) { hsPoint3Key *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsPoint3Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); @@ -118,14 +118,14 @@ void plLeafController::Interp(hsScalar time, hsScalarTriple* result, plControlle else { hsBezPoint3Key *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezPoint3Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kScaleKeyFrame || fType == hsKeyFrame::kBezScaleKeyFrame, kInvalidInterpString); @@ -133,7 +133,7 @@ void plLeafController::Interp(hsScalar time, hsScaleValue* result, plControllerC if (fType == hsKeyFrame::kScaleKeyFrame) { hsScaleKey *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsScaleKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); @@ -141,14 +141,14 @@ void plLeafController::Interp(hsScalar time, hsScaleValue* result, plControllerC else { hsBezScaleKey *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsBezScaleKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::BezInterp(k1, k2, t, result); } } -void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsQuat* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kQuatKeyFrame || fType == hsKeyFrame::kCompressedQuatKeyFrame32 || @@ -158,7 +158,7 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn if (fType == hsKeyFrame::kQuatKeyFrame) { hsQuatKey *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsQuatKey), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); @@ -166,7 +166,7 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn else if (fType == hsKeyFrame::kCompressedQuatKeyFrame32) { hsCompressedQuatKey32 *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsCompressedQuatKey32), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); @@ -178,7 +178,7 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn else // (fType == hsKeyFrame::kCompressedQuatKeyFrame64) { hsCompressedQuatKey64 *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsCompressedQuatKey64), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); @@ -189,31 +189,31 @@ void plLeafController::Interp(hsScalar time, hsQuat* result, plControllerCacheIn } } -void plLeafController::Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kMatrix33KeyFrame, kInvalidInterpString); hsBool tryForward = (cache? cache->fAtc->IsForewards() : true); hsMatrix33Key *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsMatrix33Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } -void plLeafController::Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache) const { hsAssert(fType == hsKeyFrame::kMatrix44KeyFrame, kInvalidInterpString); hsBool tryForward = (cache? cache->fAtc->IsForewards() : true); hsMatrix44Key *k1, *k2; - hsScalar t; + float t; uint32_t *idxStore = (cache ? &cache->fKeyIndex : &fLastKeyIdx); hsInterp::GetBoundaryKeyFrames(time, fNumKeys, fKeys, sizeof(hsMatrix44Key), (hsKeyFrame**)&k1, (hsKeyFrame**)&k2, idxStore, &t, tryForward); hsInterp::LinInterp(&k1->fValue, &k2->fValue, t, result); } -void plLeafController::Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache) const +void plLeafController::Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache) const { hsPoint3 value; Interp(time, &value, cache); @@ -229,7 +229,7 @@ plControllerCacheInfo *plLeafController::CreateCache() const return cache; } -hsScalar plLeafController::GetLength() const +float plLeafController::GetLength() const { uint32_t stride = GetStride(); if (stride == 0 || fNumKeys == 0) @@ -369,7 +369,7 @@ hsMatrix44Key *plLeafController::GetMatrix44Key(uint32_t i) const return (hsMatrix44Key *)((uint8_t *)fKeys + i * sizeof(hsMatrix44Key)); } -void plLeafController::GetKeyTimes(hsTArray &keyTimes) const +void plLeafController::GetKeyTimes(hsTArray &keyTimes) const { int cIdx; int kIdx; @@ -377,8 +377,8 @@ void plLeafController::GetKeyTimes(hsTArray &keyTimes) const uint8_t *keyPtr = (uint8_t *)fKeys; for (cIdx = 0, kIdx = 0; cIdx < fNumKeys, kIdx < keyTimes.GetCount();) { - hsScalar kTime = keyTimes[kIdx]; - hsScalar cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; + float kTime = keyTimes[kIdx]; + float cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; if (cTime < kTime) { keyTimes.InsertAtIndex(kIdx, cTime); @@ -399,7 +399,7 @@ void plLeafController::GetKeyTimes(hsTArray &keyTimes) const // All remaining times in the controller are later than the original keyTimes set for (; cIdx < fNumKeys; cIdx++) { - hsScalar cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; + float cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC; keyTimes.Append(cTime); } } @@ -467,7 +467,7 @@ void plLeafController::AllocKeys(uint32_t numKeys, uint8_t type) } } -void plLeafController::QuickScalarController(int numKeys, hsScalar* times, hsScalar* values, uint32_t valueStrides) +void plLeafController::QuickScalarController(int numKeys, float* times, float* values, uint32_t valueStrides) { AllocKeys(numKeys, hsKeyFrame::kScalarKeyFrame); int i; @@ -475,7 +475,7 @@ void plLeafController::QuickScalarController(int numKeys, hsScalar* times, hsSca { ((hsScalarKey*)fKeys)[i].fFrame = (uint16_t)(*times++ * MAX_FRAMES_PER_SEC); ((hsScalarKey*)fKeys)[i].fValue = *values; - values = (hsScalar *)((uint8_t *)values + valueStrides); + values = (float *)((uint8_t *)values + valueStrides); } } @@ -764,7 +764,7 @@ plCompoundController::~plCompoundController() delete fZController; } -void plCompoundController::Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache) const { if (fXController) fXController->Interp(time, &result->fX, (cache ? cache->fSubControllers[0] : nil)); @@ -774,7 +774,7 @@ void plCompoundController::Interp(hsScalar time, hsScalarTriple* result, plContr fZController->Interp(time, &result->fZ, (cache ? cache->fSubControllers[2] : nil)); } -void plCompoundController::Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsQuat* result, plControllerCacheInfo *cache) const { hsEuler eul(0,0,0,EulOrdXYZs); @@ -785,7 +785,7 @@ void plCompoundController::Interp(hsScalar time, hsQuat* result, plControllerCac eul.GetQuat(result); } -void plCompoundController::Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache) const { if (fXController) fXController->Interp(time, &parts->fT, (cache ? cache->fSubControllers[0] : nil)); @@ -802,16 +802,16 @@ void plCompoundController::Interp(hsScalar time, hsAffineParts* parts, plControl } } -void plCompoundController::Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache) const +void plCompoundController::Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache) const { fXController->Interp(time, &result->r, (cache ? cache->fSubControllers[0] : nil)); fYController->Interp(time, &result->g, (cache ? cache->fSubControllers[1] : nil)); fZController->Interp(time, &result->b, (cache ? cache->fSubControllers[2] : nil)); } -hsScalar plCompoundController::GetLength() const +float plCompoundController::GetLength() const { - hsScalar len=0; + float len=0; int i; for(i=0; i<3; i++) { @@ -821,7 +821,7 @@ hsScalar plCompoundController::GetLength() const return len; } -void plCompoundController::GetKeyTimes(hsTArray &keyTimes) const +void plCompoundController::GetKeyTimes(hsTArray &keyTimes) const { if (fXController) fXController->GetKeyTimes(keyTimes); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plController.h b/Sources/Plasma/PubUtilLib/plInterp/plController.h index bcc365cb..c6aabace 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plController.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plController.h @@ -98,18 +98,18 @@ public: CLASSNAME_REGISTER( plController ); GETINTERFACE_ANY( plController, plCreatable ); - virtual void Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const {} - virtual void Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, float* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const {} + virtual void Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const {} virtual plControllerCacheInfo* CreateCache() const { return nil; } // Caller must handle deleting the pointer. - virtual hsScalar GetLength() const = 0; - virtual void GetKeyTimes(hsTArray &keyTimes) const = 0; + virtual float GetLength() const = 0; + virtual void GetKeyTimes(hsTArray &keyTimes) const = 0; virtual hsBool AllKeysMatch() const = 0; // Checks each of our subcontrollers (if we have any) and deletes any that @@ -138,16 +138,16 @@ public: CLASSNAME_REGISTER( plLeafController ); GETINTERFACE_ANY( plLeafController, plController ); - void Interp(hsScalar time, hsScalar* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, float* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScaleValue* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsMatrix33* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsMatrix44* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; virtual plControllerCacheInfo* CreateCache() const; - hsScalar GetLength() const; + float GetLength() const; uint32_t GetStride() const; hsPoint3Key *GetPoint3Key(uint32_t i) const; @@ -166,9 +166,9 @@ public: uint8_t GetType() const { return fType; } uint32_t GetNumKeys() const { return fNumKeys; } void *GetKeyBuffer() const { return fKeys; } - void GetKeyTimes(hsTArray &keyTimes) const; + void GetKeyTimes(hsTArray &keyTimes) const; void AllocKeys(uint32_t n, uint8_t type); - void QuickScalarController(int numKeys, hsScalar* times, hsScalar* values, uint32_t valueStrides); + void QuickScalarController(int numKeys, float* times, float* values, uint32_t valueStrides); hsBool AllKeysMatch() const; hsBool PurgeRedundantSubcontrollers(); @@ -196,10 +196,10 @@ public: CLASSNAME_REGISTER( plCompoundController ); GETINTERFACE_ANY( plCompoundController, plController ); - void Interp(hsScalar time, hsQuat* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const; - void Interp(hsScalar time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsQuat* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsScalarTriple* result, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsAffineParts* parts, plControllerCacheInfo *cache = nil) const; + void Interp(float time, hsColorRGBA* result, plControllerCacheInfo *cache = nil) const; plControllerCacheInfo* CreateCache() const; plController *GetXController() const { return fXController; } @@ -209,8 +209,8 @@ public: plController *GetRotController() const { return fYController; } plController *GetScaleController() const { return fZController; } plController *GetController(int32_t i) const; - hsScalar GetLength() const; - void GetKeyTimes(hsTArray &keyTimes) const; + float GetLength() const; + void GetKeyTimes(hsTArray &keyTimes) const; hsBool AllKeysMatch() const; hsBool PurgeRedundantSubcontrollers(); diff --git a/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp b/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp index 99963824..2038c5a5 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp +++ b/Sources/Plasma/PubUtilLib/plInterp/plModulator.cpp @@ -76,18 +76,18 @@ void plModulator::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) } // Volume - Want to base this on the closest point on the bounds, instead of just the center. -hsScalar plModulator::Modulation(const hsBounds3Ext& bnd) const +float plModulator::Modulation(const hsBounds3Ext& bnd) const { return Modulation(bnd.GetCenter()); } -hsScalar plModulator::Modulation(const hsPoint3& pos) const +float plModulator::Modulation(const hsPoint3& pos) const { hsAssert(fVolume, "Modulator with no Volume is pretty useless"); - hsScalar dist = fVolume->Test(pos); + float dist = fVolume->Test(pos); - hsScalar retVal; + float retVal; if( dist > 0 ) { if( dist < fSoftDist ) diff --git a/Sources/Plasma/PubUtilLib/plInterp/plModulator.h b/Sources/Plasma/PubUtilLib/plInterp/plModulator.h index 52c457d3..dbe8b43d 100644 --- a/Sources/Plasma/PubUtilLib/plInterp/plModulator.h +++ b/Sources/Plasma/PubUtilLib/plInterp/plModulator.h @@ -54,7 +54,7 @@ class plModulator : public plCreatable { protected: plVolumeIsect* fVolume; - hsScalar fSoftDist; + float fSoftDist; public: plModulator(); @@ -66,13 +66,13 @@ public: const plVolumeIsect* GetVolume() const { return fVolume; } void SetVolume(plVolumeIsect* vol); // Takes ownership, so don't delete after handing it in. - hsScalar Modulation(const hsPoint3& pos) const; - hsScalar Modulation(const hsBounds3Ext& bnd) const; + float Modulation(const hsPoint3& pos) const; + float Modulation(const hsBounds3Ext& bnd) const; void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); - hsScalar GetSoftDist() const { return fSoftDist; } - void SetSoftDist(hsScalar s) { fSoftDist = s; } + float GetSoftDist() const { return fSoftDist; } + void SetSoftDist(float s) { fSoftDist = s; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp index 87840be8..0b49d89f 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsFastMath.h" -static const hsScalar kRealSmall = 1.e-5f; +static const float kRealSmall = 1.e-5f; // Find the closest point on a line (or segment) to a point. uint32_t plClosest::PointOnLine(const hsPoint3& p0, @@ -54,14 +54,14 @@ uint32_t plClosest::PointOnLine(const hsPoint3& p0, hsPoint3& cp, uint32_t clamp) { - hsScalar invV1Sq = v1.MagnitudeSquared(); + float invV1Sq = v1.MagnitudeSquared(); // v1 is also zero length. The two input points are the only options for output. if( invV1Sq < kRealSmall ) { cp = p1; return kClamp; } - hsScalar t = v1.InnerProduct(p0 - p1) / invV1Sq; + float t = v1.InnerProduct(p0 - p1) / invV1Sq; cp = p1; // clamp to the ends of segment v1. if( (clamp & kClampLower1) && (t < 0) ) @@ -84,7 +84,7 @@ uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, hsPoint3& cp0, hsPoint3& cp1, uint32_t clamp) { - hsScalar invV0Sq = v0.MagnitudeSquared(); + float invV0Sq = v0.MagnitudeSquared(); // First handle degenerate cases. // v0 is zero length. Resolves to finding closest point on p1+v1 to p0 if( invV0Sq < kRealSmall ) @@ -139,7 +139,7 @@ uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, // Check for the vectors v0 and v1 being parallel, in which case // following the lines won't get us to any closer point. - hsScalar DV0dotDV0 = DV0.InnerProduct(DV0); + float DV0dotDV0 = DV0.InnerProduct(DV0); if( DV0dotDV0 < kRealSmall ) { // If neither is clamped, return any two corresponding points. @@ -154,7 +154,7 @@ uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, uint32_t retVal = 0; - hsScalar t1 = - (CV0.InnerProduct(DV0)) / DV0dotDV0; + float t1 = - (CV0.InnerProduct(DV0)) / DV0dotDV0; if( (clamp & kClampLower1) && (t1 <= 0) ) { t1 = 0; @@ -166,7 +166,7 @@ uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, retVal |= kClampUpper1; } - hsScalar t0 = v0.InnerProduct(p0subp1 - v1 * t1) * -invV0Sq; + float t0 = v0.InnerProduct(p0subp1 - v1 * t1) * -invV0Sq; cp0 = p0; if( (clamp & kClampUpper0) && (t0 >= 1.f) ) { @@ -207,11 +207,11 @@ uint32_t plClosest::PointsOnLines(const hsPoint3& p0, const hsVector3& v0, } hsBool plClosest::PointOnSphere(const hsPoint3& p0, - const hsPoint3& center, hsScalar rad, + const hsPoint3& center, float rad, hsPoint3& cp) { hsVector3 del(&p0, ¢er); - hsScalar dist = hsFastMath::InvSqrtAppr(del.MagnitudeSquared()); + float dist = hsFastMath::InvSqrtAppr(del.MagnitudeSquared()); dist *= rad; del *= dist; cp = center; @@ -238,7 +238,7 @@ hsBool plClosest::PointOnBox(const hsPoint3& p0, } hsBool plClosest::PointOnSphere(const hsPoint3& p0, const hsVector3& v0, - const hsPoint3& center, hsScalar rad, + const hsPoint3& center, float rad, hsPoint3& cp, uint32_t clamp) { @@ -261,22 +261,22 @@ hsBool plClosest::PointOnSphere(const hsPoint3& p0, const hsVector3& v0, to the center of the sphere, and return the intersection of the segment connecting that point and the center with the sphere. */ - hsScalar termA = v0.InnerProduct(v0); + float termA = v0.InnerProduct(v0); if( termA < kRealSmall ) { return PointOnSphere(p0, center, rad, cp); } hsVector3 p0Subc(&p0, ¢er); - hsScalar termB = v0.InnerProduct(p0Subc); - hsScalar termC = p0Subc.InnerProduct(p0Subc) - rad; - hsScalar disc = termB * termB - 4 * termA * termC; + float termB = v0.InnerProduct(p0Subc); + float termC = p0Subc.InnerProduct(p0Subc) - rad; + float disc = termB * termB - 4 * termA * termC; if( disc >= 0 ) { - disc = hsSquareRoot(disc); - hsScalar t = (-termB - disc) / (2.f * termA); + disc = sqrt(disc); + float t = (-termB - disc) / (2.f * termA); if( (t < 0) && (clamp & kClampLower0) ) { - hsScalar tOut = (-termB + disc) / (2.f * termA); + float tOut = (-termB + disc) / (2.f * termA); if( tOut < 0 ) { // Both isects are before beginning of clamped line. @@ -354,9 +354,9 @@ hsBool plClosest::PointOnPlane(const hsPoint3& p0, p' = p - ((p-pPln)*n)/|n| * n/|n| p' = p + ((pPln-p)*n) * n / |n|^2 */ - hsScalar invNLen = hsFastMath::InvSqrt(n.MagnitudeSquared()); + float invNLen = hsFastMath::InvSqrt(n.MagnitudeSquared()); - hsScalar nDotp = n.InnerProduct(pPln - p0); + float nDotp = n.InnerProduct(pPln - p0); cp = p0 + n * (nDotp * invNLen); return nDotp >= 0; @@ -378,11 +378,11 @@ hsBool plClosest::PointOnPlane(const hsPoint3& p0, const hsVector3& v0, Then clamp appropriately, garnish, and serve with wild rice. */ hsBool retVal = true; - hsScalar pDotn = n.InnerProduct(pPln - p0); - hsScalar v0Dotn = n.InnerProduct(v0); + float pDotn = n.InnerProduct(pPln - p0); + float v0Dotn = n.InnerProduct(v0); if( (v0Dotn < -kRealSmall) || (v0Dotn > kRealSmall) ) { - hsScalar t = pDotn / v0Dotn; + float t = pDotn / v0Dotn; if( (clamp & kClampLower) && (t < 0) ) { @@ -443,7 +443,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, hsPoint3 aBestPt; hsPoint3 bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; for( j = 0; j < 3; j++ ) { hsPoint3 aNextPt, bNextPt; @@ -452,7 +452,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, aNextPt, bNextPt, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; @@ -501,7 +501,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, int bIdx2 = 2; hsPoint3 aBestPt, bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; hsBool retVal = false; @@ -534,7 +534,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; @@ -647,7 +647,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, } hsPoint3 aBestPt, bBestPt; - hsScalar minDistSq = 1.e33f; + float minDistSq = 1.e33f; hsBool retVal = false; @@ -680,7 +680,7 @@ hsBool plClosest::PointBetweenBoxes(const hsPoint3& aCorner, plClosest::kClamp); - hsScalar distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); + float distSq = hsVector3(&aNextPt, &bNextPt).MagnitudeSquared(); if( distSq < minDistSq ) { aBestPt = aNextPt; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h index 91c57493..66e29b8f 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plClosest.h @@ -79,7 +79,7 @@ enum plClosestClampFlags // Return true if p0 is inside or on sphere. static hsBool PointOnSphere(const hsPoint3& p0, // Point - const hsPoint3& center, hsScalar rad, // Sphere + const hsPoint3& center, float rad, // Sphere hsPoint3& cp); // Output closest on sphere to p0 // Return true if p0 is inside box. @@ -92,7 +92,7 @@ enum plClosestClampFlags // Return true if line intersects or is inside sphere. static hsBool PointOnSphere(const hsPoint3& p0, const hsVector3& v0, // Line - const hsPoint3& center, hsScalar rad, // Sphere + const hsPoint3& center, float rad, // Sphere hsPoint3& cp, // Output closest on sphere to p0, or entry point if line hits sphere uint32_t clamp); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp index fb0f914e..d03eaeb0 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.cpp @@ -147,11 +147,11 @@ void plHardRegionPlanes::AddPlane(const hsVector3& n, const hsPoint3& p) int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - const hsScalar kCloseToOne = 1.f - 1.e-4f; + const float kCloseToOne = 1.f - 1.e-4f; if( fPlanes[i].fNorm.InnerProduct(nNorm) >= kCloseToOne ) { - hsScalar newDist = nNorm.InnerProduct(p); - hsScalar oldDist = fPlanes[i].fNorm.InnerProduct(fPlanes[i].fPos); + float newDist = nNorm.InnerProduct(p); + float oldDist = fPlanes[i].fNorm.InnerProduct(fPlanes[i].fPos); if( newDist > oldDist ) { fPlanes[i].fPos = p; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h index deb9c927..9450417d 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plHardRegionPlanes.h @@ -56,7 +56,7 @@ protected: hsVector3 fWorldNorm; hsPoint3 fWorldPos; - hsScalar fWorldDist; + float fWorldDist; }; hsTArray fPlanes; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp index 4d3e9728..fbb2930c 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.cpp @@ -83,12 +83,12 @@ void plSoftVolume::Write(hsStream* s, hsResMgr* mgr) s->WriteLEScalar(fOutsideStrength); } -hsScalar plSoftVolume::GetStrength(const hsPoint3& pos) const +float plSoftVolume::GetStrength(const hsPoint3& pos) const { return IRemapStrength(IGetStrength(pos)); } -hsScalar plSoftVolume::GetListenerStrength() const +float plSoftVolume::GetListenerStrength() const { if( !(fListenState & kListenPosSet) ) { @@ -135,12 +135,12 @@ hsBool plSoftVolume::MsgReceive(plMessage* msg) return plRegionBase::MsgReceive(msg); } -hsScalar plSoftVolume::IUpdateListenerStrength() const +float plSoftVolume::IUpdateListenerStrength() const { return fListenStrength = GetStrength(fListenPos); } -void plSoftVolume::SetInsideStrength(hsScalar s) +void plSoftVolume::SetInsideStrength(float s) { if( s < 0 ) s = 0; @@ -149,7 +149,7 @@ void plSoftVolume::SetInsideStrength(hsScalar s) fInsideStrength = s; } -void plSoftVolume::SetOutsideStrength(hsScalar s) +void plSoftVolume::SetOutsideStrength(float s) { if( s < 0 ) s = 0; diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h index 70302af4..a4b1e1f5 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolume.h @@ -67,19 +67,19 @@ protected: }; hsPoint3 fListenPos; - mutable hsScalar fListenStrength; + mutable float fListenStrength; mutable uint32_t fListenState; - hsScalar fInsideStrength; - hsScalar fOutsideStrength; + float fInsideStrength; + float fOutsideStrength; - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; - hsScalar IRemapStrength(hsScalar s) const { return fOutsideStrength + s * (fInsideStrength - fOutsideStrength); } + float IRemapStrength(float s) const { return fOutsideStrength + s * (fInsideStrength - fOutsideStrength); } private: // Don't call this, use public GetStrength(). - virtual hsScalar IGetStrength(const hsPoint3& pos) const = 0; + virtual float IGetStrength(const hsPoint3& pos) const = 0; public: plSoftVolume(); @@ -88,14 +88,14 @@ public: CLASSNAME_REGISTER( plSoftVolume ); GETINTERFACE_ANY( plSoftVolume, plRegionBase ); - virtual hsScalar GetStrength(const hsPoint3& pos) const; + virtual float GetStrength(const hsPoint3& pos) const; virtual hsBool IsInside(const hsPoint3& pos) const { return GetStrength(pos) >= 1.f; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; virtual int32_t GetNumProperties() const { return 1; } // This is stupid. - virtual hsScalar GetListenerStrength() const; + virtual float GetListenerStrength() const; virtual void UpdateListenerPosition(const hsPoint3& p); virtual void SetCheckListener(hsBool on=true); virtual hsBool GetCheckListener() const { return 0 != (fListenState & kListenCheck); } @@ -105,11 +105,11 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetInsideStrength(hsScalar s); - void SetOutsideStrength(hsScalar s); + void SetInsideStrength(float s); + void SetOutsideStrength(float s); - hsScalar GetInsideStrength() const { return fInsideStrength; } - hsScalar GetOutsideStrength() const { return fOutsideStrength; } + float GetInsideStrength() const { return fInsideStrength; } + float GetOutsideStrength() const { return fOutsideStrength; } }; #endif // plSoftVolume_inc diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp index 25d4a6b4..0927d08e 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.cpp @@ -63,12 +63,12 @@ plSoftVolumeSimple::~plSoftVolumeSimple() delete fVolume; } -hsScalar plSoftVolumeSimple::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeSimple::IGetStrength(const hsPoint3& pos) const { if( !fVolume || GetProperty(kDisable) ) return 0; - hsScalar dist = fVolume->Test(pos); + float dist = fVolume->Test(pos); if( dist <= 0 ) return 1.f; @@ -184,13 +184,13 @@ plSoftVolumeUnion::~plSoftVolumeUnion() { } -hsScalar plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const { - hsScalar retVal = 0; + float retVal = 0; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetStrength(pos); + float subRet = fSubVolumes[i]->GetStrength(pos); if( subRet >= 1.f ) return 1.f; if( subRet > retVal ) @@ -199,13 +199,13 @@ hsScalar plSoftVolumeUnion::IGetStrength(const hsPoint3& pos) const return retVal; } -hsScalar plSoftVolumeUnion::IUpdateListenerStrength() const +float plSoftVolumeUnion::IUpdateListenerStrength() const { - hsScalar retVal = 0; + float retVal = 0; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetListenerStrength(); + float subRet = fSubVolumes[i]->GetListenerStrength(); if( subRet >= 1.f ) { retVal = 1.f; @@ -228,13 +228,13 @@ plSoftVolumeIntersect::~plSoftVolumeIntersect() { } -hsScalar plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const { - hsScalar retVal = 1.f; + float retVal = 1.f; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetStrength(pos); + float subRet = fSubVolumes[i]->GetStrength(pos); if( subRet <= 0 ) return 0; if( subRet < retVal ) @@ -243,13 +243,13 @@ hsScalar plSoftVolumeIntersect::IGetStrength(const hsPoint3& pos) const return retVal; } -hsScalar plSoftVolumeIntersect::IUpdateListenerStrength() const +float plSoftVolumeIntersect::IUpdateListenerStrength() const { - hsScalar retVal = 1.f; + float retVal = 1.f; int i; for( i = 0; i < fSubVolumes.GetCount(); i++ ) { - hsScalar subRet = fSubVolumes[i]->GetListenerStrength(); + float subRet = fSubVolumes[i]->GetListenerStrength(); if( subRet <= 0 ) { retVal = 0.f; @@ -272,7 +272,7 @@ plSoftVolumeInvert::~plSoftVolumeInvert() { } -hsScalar plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const +float plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const { hsAssert(fSubVolumes.GetCount() <= 1, "Too many subvolumes on inverter"); if( fSubVolumes.GetCount() ) @@ -281,10 +281,10 @@ hsScalar plSoftVolumeInvert::IGetStrength(const hsPoint3& pos) const return 1.f; } -hsScalar plSoftVolumeInvert::IUpdateListenerStrength() const +float plSoftVolumeInvert::IUpdateListenerStrength() const { hsAssert(fSubVolumes.GetCount() <= 1, "Too many subvolumes on inverter"); - hsScalar retVal = 1.f; + float retVal = 1.f; if( fSubVolumes.GetCount() ) retVal = (1.f - fSubVolumes[0]->GetListenerStrength()); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h index 18dc0b79..c5dcd32a 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plSoftVolumeTypes.h @@ -52,10 +52,10 @@ class plSoftVolumeSimple : public plSoftVolume { protected: plVolumeIsect* fVolume; - hsScalar fSoftDist; + float fSoftDist; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeSimple(); @@ -73,8 +73,8 @@ public: plVolumeIsect* GetVolume() const { return fVolume; } void SetVolume(plVolumeIsect* v); // Takes ownership, don't delete after giving to SoftVolume - hsScalar GetDistance() const { return fSoftDist; } - void SetDistance(hsScalar d) { fSoftDist = d; } + float GetDistance() const { return fSoftDist; } + void SetDistance(float d) { fSoftDist = d; } }; @@ -108,10 +108,10 @@ public: class plSoftVolumeUnion : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeUnion(); @@ -125,10 +125,10 @@ public: class plSoftVolumeIntersect : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeIntersect(); @@ -142,10 +142,10 @@ public: class plSoftVolumeInvert : public plSoftVolumeComplex { protected: - virtual hsScalar IUpdateListenerStrength() const; + virtual float IUpdateListenerStrength() const; private: - virtual hsScalar IGetStrength(const hsPoint3& pos) const; + virtual float IGetStrength(const hsPoint3& pos) const; public: plSoftVolumeInvert(); diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp index 9e78f294..463857b8 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp +++ b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.cpp @@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plIntersect/plClosest.h" -static const hsScalar kDefLength = 5.f; +static const float kDefLength = 5.f; plSphereIsect::plSphereIsect() : fRadius(1.f) @@ -77,9 +77,9 @@ void plSphereIsect::SetCenter(const hsPoint3& c) } } -void plSphereIsect::SetRadius(hsScalar r) +void plSphereIsect::SetRadius(float r) { - hsScalar del = r - fRadius; + float del = r - fRadius; int i; for( i = 0; i < 3; i++ ) { @@ -140,12 +140,12 @@ plVolumeCullResult plSphereIsect::Test(const hsBounds3Ext& bnd) const return kVolumeClear; } -hsScalar plSphereIsect::Test(const hsPoint3& pos) const +float plSphereIsect::Test(const hsPoint3& pos) const { - hsScalar dist = (pos - fWorldCenter).MagnitudeSquared(); + float dist = (pos - fWorldCenter).MagnitudeSquared(); if( dist < fRadius*fRadius ) return 0; - dist = hsSquareRoot(dist); + dist = sqrt(dist); return dist - fRadius; } @@ -171,7 +171,7 @@ void plSphereIsect::Write(hsStream* s, hsResMgr* mgr) /////////////////////////////////////////////////////////////////////////// plConeIsect::plConeIsect() -: fLength(kDefLength), fRadAngle(hsScalarPI*0.25f), fCapped(false) +: fLength(kDefLength), fRadAngle(M_PI*0.25f), fCapped(false) { ISetup(); } @@ -180,7 +180,7 @@ plConeIsect::~plConeIsect() { } -void plConeIsect::SetAngle(hsScalar rads) +void plConeIsect::SetAngle(float rads) { fRadAngle = rads; ISetup(); @@ -188,17 +188,17 @@ void plConeIsect::SetAngle(hsScalar rads) void plConeIsect::ISetup() { - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); - const hsScalar kHither = 0.1f; + const float kHither = 0.1f; fLightToNDC.Reset(); - fLightToNDC.fMap[0][0] = hsScalarDiv( cosAng, sinAng ); - fLightToNDC.fMap[1][1] = hsScalarDiv( cosAng, sinAng ); - fLightToNDC.fMap[2][2] = -hsScalarDiv( fLength, fLength - kHither ); - fLightToNDC.fMap[3][3] = hsIntToScalar( 0 ); - fLightToNDC.fMap[3][2] = hsIntToScalar( -1 ); - fLightToNDC.fMap[2][3] = -hsScalarMulDiv( fLength, kHither, fLength - kHither ); + fLightToNDC.fMap[0][0] = cosAng / sinAng; + fLightToNDC.fMap[1][1] = cosAng / sinAng; + fLightToNDC.fMap[2][2] = -(fLength / (fLength - kHither)); + fLightToNDC.fMap[3][3] = int32_t( 0 ); + fLightToNDC.fMap[3][2] = int32_t( -1 ); + fLightToNDC.fMap[2][3] = -(fLength * kHither / (fLength - kHither)); fLightToNDC.NotIdentity(); } @@ -229,7 +229,7 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const hsVector3 perp = axis % normDir; - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); hsVector3 tangent = normDir + sinAng * perp + (1-cosAng) * (axis % perp); @@ -239,7 +239,7 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const hsVector3 normIn2 = perp + sinAng * (perp % axis) + (1-cosAng) * (axis % (axis % perp)); bnd.TestPlane(normIn, depth); - hsScalar normInDotTip = normIn.InnerProduct(fWorldTip); + float normInDotTip = normIn.InnerProduct(fWorldTip); if( depth.fY < normInDotTip ) return kVolumeCulled; } @@ -247,7 +247,7 @@ plVolumeCullResult plConeIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plConeIsect::Test(const hsPoint3& pos) const +float plConeIsect::Test(const hsPoint3& pos) const { uint32_t clampFlags = fCapped ? plClosest::kClamp : plClosest::kClampLower; hsPoint3 cp; @@ -257,17 +257,17 @@ hsScalar plConeIsect::Test(const hsPoint3& pos) const cp, clampFlags); - hsScalar radDist = (pos - cp).Magnitude(); - hsScalar axDist = fWorldNorm.InnerProduct(pos - fWorldTip) / fLength; + float radDist = (pos - cp).Magnitude(); + float axDist = fWorldNorm.InnerProduct(pos - fWorldTip) / fLength; if( axDist < 0 ) { return radDist; } - hsScalar sinAng, cosAng; + float sinAng, cosAng; hsFastMath::SinCosInRangeAppr(fRadAngle, sinAng, cosAng); - hsScalar radius = axDist * sinAng / cosAng; + float radius = axDist * sinAng / cosAng; radDist -= radius; axDist -= fLength; @@ -282,7 +282,7 @@ hsScalar plConeIsect::Test(const hsPoint3& pos) const //#define MF_DEBUG_NORM #ifdef MF_DEBUG_NORM -#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = 1.f / a.Magnitude(); a *= len; b *= len; } +#define IDEBUG_NORMALIZE( a, b ) { float len = 1.f / a.Magnitude(); a *= len; b *= len; } #else // MF_DEBUG_NORM #define IDEBUG_NORMALIZE( a, b ) #endif // MF_DEBUG_NORM @@ -316,7 +316,7 @@ void plConeIsect::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) } } -void plConeIsect::SetLength(hsScalar d) +void plConeIsect::SetLength(float d) { if( d > 0 ) { @@ -386,7 +386,7 @@ plCylinderIsect::~plCylinderIsect() { } -void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsScalar radius) +void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, float radius) { fWorldNorm.Set(&wTop, &wBot); fLength = fWorldNorm.Magnitude(); @@ -394,14 +394,14 @@ void plCylinderIsect::ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsSc fMax = fWorldNorm.InnerProduct(wTop); if( fMin > fMax ) { - hsScalar t = fMin; + float t = fMin; fMin = fMax; fMax = t; } fRadius = radius; } -void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hsScalar radius) +void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, float radius) { fTop = lTop; fBot = lBot; @@ -410,7 +410,7 @@ void plCylinderIsect::SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hs ISetupCyl(fTop, fBot, fRadius); } -void plCylinderIsect::SetCylinder(const hsPoint3& lBot, const hsVector3& axis, hsScalar radius) +void plCylinderIsect::SetCylinder(const hsPoint3& lBot, const hsVector3& axis, float radius) { fBot = lBot; fTop = fBot; @@ -457,12 +457,12 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const bnd.GetAxes(axes+0, axes+1, axes+2); hsPoint3 cp = corner; - hsScalar bndRadiusSq = bnd.GetRadius(); + float bndRadiusSq = bnd.GetRadius(); bndRadiusSq *= bndRadiusSq; - hsScalar radiusSq = fRadius*fRadius; + float radiusSq = fRadius*fRadius; - hsScalar maxClearDistSq = fRadius - bnd.GetRadius(); + float maxClearDistSq = fRadius - bnd.GetRadius(); maxClearDistSq *= maxClearDistSq; int i; @@ -474,7 +474,7 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const cp, axes[i], cp0, currPt, plClosest::kClamp); - hsScalar distSq = (cp0 - currPt).MagnitudeSquared(); + float distSq = (cp0 - currPt).MagnitudeSquared(); if( distSq < radiusSq ) { if( distSq < maxClearDistSq ) @@ -489,7 +489,7 @@ plVolumeCullResult plCylinderIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plCylinderIsect::Test(const hsPoint3& pos) const +float plCylinderIsect::Test(const hsPoint3& pos) const { hsPoint3 cp; @@ -498,15 +498,15 @@ hsScalar plCylinderIsect::Test(const hsPoint3& pos) const cp, plClosest::kClamp); - hsScalar radDist = (pos - cp).Magnitude() - fRadius; - hsScalar axDist = fWorldNorm.InnerProduct(pos - fWorldBot) / fLength; + float radDist = (pos - cp).Magnitude() - fRadius; + float axDist = fWorldNorm.InnerProduct(pos - fWorldBot) / fLength; if( axDist < 0 ) axDist = -axDist; else axDist -= fLength; - hsScalar dist = axDist > radDist ? axDist : radDist; + float dist = axDist > radDist ? axDist : radDist; return dist > 0 ? dist : 0; } @@ -569,8 +569,8 @@ void plParallelIsect::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) hsVector3 norm; norm.Set(&wPosOne, &wPosTwo); fPlanes[i].fNorm = norm; - hsScalar t0 = norm.InnerProduct(wPosOne); - hsScalar t1 = norm.InnerProduct(wPosTwo); + float t0 = norm.InnerProduct(wPosOne); + float t1 = norm.InnerProduct(wPosTwo); if( t0 > t1 ) { @@ -605,13 +605,13 @@ plVolumeCullResult plParallelIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plParallelIsect::Test(const hsPoint3& pos) const +float plParallelIsect::Test(const hsPoint3& pos) const { - hsScalar maxDist = 0; + float maxDist = 0; int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - hsScalar dist = fPlanes[i].fNorm.InnerProduct(pos); + float dist = fPlanes[i].fNorm.InnerProduct(pos); if( dist > fPlanes[i].fMax ) { @@ -676,7 +676,7 @@ plConvexIsect::~plConvexIsect() { } -void plConvexIsect::AddPlaneUnchecked(const hsVector3& n, hsScalar dist) +void plConvexIsect::AddPlaneUnchecked(const hsVector3& n, float dist) { SinglePlane plane; plane.fNorm = n; @@ -697,10 +697,10 @@ void plConvexIsect::AddPlane(const hsVector3& n, const hsPoint3& p) int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - const hsScalar kCloseToOne = 1.f - 1.e-4f; + const float kCloseToOne = 1.f - 1.e-4f; if( fPlanes[i].fNorm.InnerProduct(nNorm) >= kCloseToOne ) { - hsScalar dist = nNorm.InnerProduct(p); + float dist = nNorm.InnerProduct(p); if( dist > fPlanes[i].fDist ) { fPlanes[i].fDist = dist; @@ -761,13 +761,13 @@ plVolumeCullResult plConvexIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plConvexIsect::Test(const hsPoint3& pos) const +float plConvexIsect::Test(const hsPoint3& pos) const { - hsScalar maxDist = 0; + float maxDist = 0; int i; for( i = 0; i < fPlanes.GetCount(); i++ ) { - hsScalar dist = fPlanes[i].fWorldNorm.InnerProduct(pos) - fPlanes[i].fWorldDist; + float dist = fPlanes[i].fWorldNorm.InnerProduct(pos) - fPlanes[i].fWorldDist; if( dist > maxDist ) maxDist = dist; @@ -843,7 +843,7 @@ plVolumeCullResult plBoundsIsect::Test(const hsBounds3Ext& bnd) const return retVal < 0 ? kVolumeCulled : kVolumeSplit; } -hsScalar plBoundsIsect::Test(const hsPoint3& pos) const +float plBoundsIsect::Test(const hsPoint3& pos) const { hsAssert(false, "Unimplemented"); return 0.f; @@ -942,13 +942,13 @@ plVolumeCullResult plUnionIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plUnionIsect::Test(const hsPoint3& pos) const +float plUnionIsect::Test(const hsPoint3& pos) const { - hsScalar retVal = 1.e33f; + float retVal = 1.e33f; int i; for( i = 0; i < fVolumes.GetCount(); i++ ) { - hsScalar ret = fVolumes[i]->Test(pos); + float ret = fVolumes[i]->Test(pos); if( ret <= 0 ) return 0; if( ret < retVal ) @@ -990,13 +990,13 @@ plVolumeCullResult plIntersectionIsect::Test(const hsBounds3Ext& bnd) const return retVal; } -hsScalar plIntersectionIsect::Test(const hsPoint3& pos) const +float plIntersectionIsect::Test(const hsPoint3& pos) const { - hsScalar retVal = -1.f; + float retVal = -1.f; int i; for( i = 0; i < fVolumes.GetCount(); i++ ) { - hsScalar ret = fVolumes[i]->Test(pos); + float ret = fVolumes[i]->Test(pos); if( ret > retVal ) retVal = ret; } diff --git a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h index 2ba3480b..94364616 100644 --- a/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h +++ b/Sources/Plasma/PubUtilLib/plIntersect/plVolumeIsect.h @@ -68,7 +68,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) = 0; virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const = 0; - virtual hsScalar Test(const hsPoint3& pos) const = 0; + virtual float Test(const hsPoint3& pos) const = 0; virtual void Read(hsStream* s, hsResMgr* mgr) = 0; virtual void Write(hsStream* s, hsResMgr* mgr) = 0; @@ -79,7 +79,7 @@ class plSphereIsect : public plVolumeIsect protected: hsPoint3 fCenter; hsPoint3 fWorldCenter; - hsScalar fRadius; + float fRadius; hsPoint3 fMins; hsPoint3 fMaxs; public: @@ -90,14 +90,14 @@ public: GETINTERFACE_ANY( plSphereIsect, plVolumeIsect ); void SetCenter(const hsPoint3& c); - void SetRadius(hsScalar r); + void SetRadius(float r); - hsScalar GetRadius() const { return fRadius; } + float GetRadius() const { return fRadius; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; // return 0 if point inside, else "distance" from pos to volume + virtual float Test(const hsPoint3& pos) const; // return 0 if point inside, else "distance" from pos to volume virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -108,8 +108,8 @@ class plConeIsect : public plVolumeIsect protected: hsBool fCapped; - hsScalar fRadAngle; - hsScalar fLength; + float fRadAngle; + float fLength; hsPoint3 fWorldTip; hsVector3 fWorldNorm; @@ -118,7 +118,7 @@ protected: hsMatrix44 fLightToNDC; hsVector3 fNorms[5]; - hsScalar fDists[5]; + float fDists[5]; void ISetup(); public: @@ -129,16 +129,16 @@ public: CLASSNAME_REGISTER( plConeIsect ); GETINTERFACE_ANY( plConeIsect, plVolumeIsect ); - void SetAngle(hsScalar rads); - void SetLength(hsScalar d); + void SetAngle(float rads); + void SetLength(float d); - hsScalar GetLength() const { return fCapped ? fLength : 0; } - hsScalar GetAngle() const { return fRadAngle; } + float GetLength() const { return fCapped ? fLength : 0; } + float GetAngle() const { return fRadAngle; } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -149,15 +149,15 @@ class plCylinderIsect : public plVolumeIsect protected: hsPoint3 fTop; hsPoint3 fBot; - hsScalar fRadius; + float fRadius; hsPoint3 fWorldBot; hsVector3 fWorldNorm; - hsScalar fLength; - hsScalar fMin; - hsScalar fMax; + float fLength; + float fMin; + float fMax; - void ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, hsScalar radius); + void ISetupCyl(const hsPoint3& wTop, const hsPoint3& wBot, float radius); public: plCylinderIsect(); @@ -166,13 +166,13 @@ public: CLASSNAME_REGISTER( plCylinderIsect ); GETINTERFACE_ANY( plCylinderIsect, plVolumeIsect ); - void SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, hsScalar radius); - void SetCylinder(const hsPoint3& lBot, const hsVector3& axis, hsScalar radius); + void SetCylinder(const hsPoint3& lTop, const hsPoint3& lBot, float radius); + void SetCylinder(const hsPoint3& lBot, const hsVector3& axis, float radius); virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -185,8 +185,8 @@ protected: { public: hsVector3 fNorm; - hsScalar fMin; - hsScalar fMax; + float fMin; + float fMax; hsPoint3 fPosOne; hsPoint3 fPosTwo; @@ -208,7 +208,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -221,11 +221,11 @@ protected: { public: hsVector3 fNorm; - hsScalar fDist; + float fDist; hsPoint3 fPos; hsVector3 fWorldNorm; - hsScalar fWorldDist; + float fWorldDist; }; hsTArray fPlanes; @@ -238,14 +238,14 @@ public: GETINTERFACE_ANY( plConvexIsect, plVolumeIsect ); void ClearPlanes() { fPlanes.SetCount(0); } - void AddPlaneUnchecked(const hsVector3& n, hsScalar dist); // no validation here + void AddPlaneUnchecked(const hsVector3& n, float dist); // no validation here void AddPlane(const hsVector3& n, const hsPoint3& p); uint16_t GetNumPlanes() const { return fPlanes.GetCount(); } virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -268,7 +268,7 @@ public: virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); @@ -305,7 +305,7 @@ public: GETINTERFACE_ANY( plUnionIsect, plComplexIsect ); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; }; class plIntersectionIsect : public plComplexIsect @@ -318,7 +318,7 @@ public: GETINTERFACE_ANY( plIntersectionIsect, plComplexIsect ); virtual plVolumeCullResult Test(const hsBounds3Ext& bnd) const; - virtual hsScalar Test(const hsPoint3& pos) const; + virtual float Test(const hsPoint3& pos) const; }; #endif // plVolumeIsect_inc diff --git a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp index 37b0929a..33865c63 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsNoiseFunc.h" #include "hsTypes.h" -#include "hsScalar.h" + #include "hsGeometry3.h" hsNoiseFunc::hsNoiseFunc() @@ -67,7 +67,7 @@ hsTableNoise::~hsTableNoise() delete [] fTable; } -void hsTableNoise::SetTable(int len, hsScalar* arr) +void hsTableNoise::SetTable(int len, float* arr) { fTableLen = len; @@ -78,7 +78,7 @@ void hsTableNoise::SetTable(int len, hsScalar* arr) return; } - fTable = TRACKED_NEW hsScalar[len+2]; + fTable = TRACKED_NEW float[len+2]; int i; for( i = 0; i < len; i++ ) @@ -88,31 +88,31 @@ void hsTableNoise::SetTable(int len, hsScalar* arr) } -hsScalar hsTableNoise::Noise(hsScalar lo, hsScalar hi, hsScalar t) +float hsTableNoise::Noise(float lo, float hi, float t) { hsAssert(fTableLen, "Badly initialized table noise function"); - hsScalar r = hsScalar(rand()) / hsScalar(RAND_MAX); + float r = float(rand()) / float(RAND_MAX); r = lo + (hi - lo) * r; if( t < 0 ) t = 0; - else if( t > hsScalar1 ) - t = hsScalar1; + else if( t > 1.f ) + t = 1.f; - hsScalar tIdx = t * fTableLen; + float tIdx = t * fTableLen; uint32_t idx = uint32_t(tIdx); - hsScalar frac = tIdx - hsScalar(idx); + float frac = tIdx - float(idx); hsAssert((idx >= 0)&&(idx <= fTableLen), "Noise parm t out of range [0..1]"); - hsScalar scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; + float scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; r *= scale; return r; } -hsScalar hsTableNoise::NoisePoint(const hsPoint3& p, hsScalar lo, hsScalar hi, hsScalar t) +float hsTableNoise::NoisePoint(const hsPoint3& p, float lo, float hi, float t) { hsAssert(fTableLen, "Badly initialized table noise function"); @@ -134,21 +134,21 @@ hsScalar hsTableNoise::NoisePoint(const hsPoint3& p, hsScalar lo, hsScalar hi, h iR &= kMsk; iR |= kExp; - hsScalar r = (*(float*)&iR) - 1.f; + float r = (*(float*)&iR) - 1.f; r = lo + (hi - lo) * r; if( t < 0 ) t = 0; - else if( t > hsScalar1 ) - t = hsScalar1; + else if( t > 1.f ) + t = 1.f; - hsScalar tIdx = t * fTableLen; + float tIdx = t * fTableLen; uint32_t idx = uint32_t(tIdx); - hsScalar frac = tIdx - hsScalar(idx); + float frac = tIdx - float(idx); hsAssert((idx >= 0)&&(idx <= fTableLen), "Noise parm t out of range [0..1]"); - hsScalar scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; + float scale = fTable[idx] + (fTable[idx+1] - fTable[idx]) * frac; r *= scale; diff --git a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h index 3bcf63eb..69ff288b 100644 --- a/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h +++ b/Sources/Plasma/PubUtilLib/plMath/hsNoiseFunc.h @@ -43,8 +43,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsNoiseFunc_inc #define hsNoiseFunc_inc +#include "HeadSpin.h" #include "hsRefCnt.h" -#include "hsScalar.h" struct hsPoint3; @@ -55,15 +55,15 @@ public: virtual ~hsNoiseFunc(); virtual void Seed(uint32_t s); - virtual hsScalar Noise(hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float Noise(float lo=0, float hi=1.f, float t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] - virtual hsScalar NoisePoint(const hsPoint3& p, hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float NoisePoint(const hsPoint3& p, float lo=0, float hi=1.f, float t=0) = 0; // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] }; class hsTableNoise : public hsNoiseFunc // should inherit from keyed object { protected: - hsScalar* fTable; + float* fTable; uint32_t fTableLen; @@ -71,12 +71,12 @@ public: hsTableNoise(); virtual ~hsTableNoise(); - void SetTable(int len, hsScalar* arr); // copies. arr should be hsScalars in range [0..1] - hsScalar* GetTable(int& len) { len = fTableLen; return fTable; } // should be debug only, access through noise func + void SetTable(int len, float* arr); // copies. arr should be hsScalars in range [0..1] + float* GetTable(int& len) { len = fTableLen; return fTable; } // should be debug only, access through noise func - virtual hsScalar Noise(hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float Noise(float lo=0, float hi=1.f, float t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] - virtual hsScalar NoisePoint(const hsPoint3& p, hsScalar lo=0, hsScalar hi=hsScalar1, hsScalar t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] + virtual float NoisePoint(const hsPoint3& p, float lo=0, float hi=1.f, float t=0); // t = [0..1] - returns random num [lo..hi] scaled by fTable[t] }; #endif // hsNoiseFunc_inc diff --git a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp index f41d730a..28d9e2ea 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp +++ b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.cpp @@ -42,13 +42,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTypes.h" #include "hsGeometry3.h" +#include #include "plTriUtils.h" -static const hsScalar kAlmostZero = 1.e-5f; -static const hsScalar kPastZero = -kAlmostZero; -static const hsScalar kPastOne = 1.f + kAlmostZero; -static const hsScalar kAlmostOne = 1.f - kAlmostZero; -static const hsScalar kAlmostZeroSquared = kAlmostZero*kAlmostZero; +static const float kAlmostZero = 1.e-5f; +static const float kPastZero = -kAlmostZero; +static const float kPastOne = 1.f + kAlmostZero; +static const float kAlmostOne = 1.f - kAlmostZero; +static const float kAlmostZeroSquared = kAlmostZero*kAlmostZero; static inline hsVector3 Cross(const hsScalarTriple& p0, const hsScalarTriple& p1) { @@ -71,7 +72,7 @@ plTriUtils::Bary plTriUtils::ComputeBarycentricProjection(const hsPoint3& p0, co hsVector3 v02(&p0, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return kDegenerateTri; // degenerate triangle @@ -91,7 +92,7 @@ plTriUtils::Bary plTriUtils::ComputeBarycentric(const hsPoint3& p0, const hsPoin hsVector3 v12(&p1, &p2); hsVector3 v02(&p0, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return kDegenerateTri; // degenerate triangle @@ -105,11 +106,11 @@ plTriUtils::Bary plTriUtils::ComputeBarycentric(const hsPoint3& p0, const hsPoin } -plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out) +plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, float invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out) { uint32_t state = 0; - hsScalar lenSq0 = v0.MagnitudeSquared(); + float lenSq0 = v0.MagnitudeSquared(); if( lenSq0 < kAlmostZeroSquared ) { // On edge p1-p2; @@ -119,7 +120,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar else { out[0] = lenSq0 * invLenSq12; - out[0] = hsSquareRoot(out[0]); + out[0] = sqrt(out[0]); // if( v0.InnerProduct(v12) < 0 ) { @@ -132,7 +133,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar state |= kOnVertex0; } - hsScalar lenSq1 = v1.MagnitudeSquared(); + float lenSq1 = v1.MagnitudeSquared(); if( lenSq1 < kAlmostZeroSquared ) { // On edge p0-p2 @@ -142,7 +143,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar else { out[1] = lenSq1 * invLenSq12; - out[1] = hsSquareRoot(out[1]); + out[1] = sqrt(out[1]); if( v1.InnerProduct(v12) < 0 ) { @@ -194,7 +195,7 @@ plTriUtils::Bary plTriUtils::IComputeBarycentric(const hsVector3& v12, hsScalar int plTriUtils::ISelectAxis(const hsVector3& norm) { int retVal = -2; - hsScalar maxDim = 0; + float maxDim = 0; int i; for( i = 0; i < 3; i++ ) { @@ -223,16 +224,16 @@ hsBool plTriUtils::IFastBarycentric(int iAx, const hsPoint3& p0, const hsPoint3& hsVector3 v02(&p0, &p2); hsVector3 v12(&p1, &p2); - hsScalar totArea = v02[iAx] * v12[jAx] - v02[jAx] * v12[iAx]; + float totArea = v02[iAx] * v12[jAx] - v02[jAx] * v12[iAx]; hsAssert(totArea != 0, "Should have already filtered degerate tris and degenerate projection"); - hsScalar invTotArea = 1.f / totArea; + float invTotArea = 1.f / totArea; hsVector3 vp2(&p, &p2); - hsScalar aArea = vp2[iAx] * v12[jAx] - vp2[jAx] * v12[iAx]; + float aArea = vp2[iAx] * v12[jAx] - vp2[jAx] * v12[iAx]; - hsScalar bArea = v02[iAx] * vp2[jAx] - v02[jAx] * vp2[iAx]; + float bArea = v02[iAx] * vp2[jAx] - v02[jAx] * vp2[iAx]; out[0] = aArea * invTotArea; out[1] = bArea * invTotArea; @@ -247,14 +248,14 @@ hsBool plTriUtils::FastBarycentricProjection(const hsPoint3& p0, const hsPoint3& hsVector3 v12(&p1, &p2); hsVector3 norm = Cross(v12, v02); - hsScalar invLenSq12 = norm.MagnitudeSquared(); + float invLenSq12 = norm.MagnitudeSquared(); if( invLenSq12 < kAlmostZero ) return false; // degenerate triangle invLenSq12 = 1.f / invLenSq12; hsVector3 del(&p0, &p); - hsScalar delDotNormOverLenSq = del.InnerProduct(norm) * invLenSq12; + float delDotNormOverLenSq = del.InnerProduct(norm) * invLenSq12; p += norm * delDotNormOverLenSq; @@ -277,9 +278,9 @@ hsBool plTriUtils::FastBarycentric(const hsPoint3& p0, const hsPoint3& p1, const ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// -hsBool plTriUtils::ProjectOntoPlane(const hsVector3& norm, hsScalar dist, hsPoint3& p) +hsBool plTriUtils::ProjectOntoPlane(const hsVector3& norm, float dist, hsPoint3& p) { - hsScalar normMagSq = norm.MagnitudeSquared(); + float normMagSq = norm.MagnitudeSquared(); if( normMagSq > kAlmostZero ) { dist /= normMagSq; @@ -298,15 +299,15 @@ hsBool plTriUtils::ProjectOntoPlane(const hsPoint3& p0, const hsPoint3& p1, cons hsVector3 norm = v12 % v02; - hsScalar dist = norm.InnerProduct(p0 - p); + float dist = norm.InnerProduct(p0 - p); return ProjectOntoPlane(norm, dist, p); } -hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsVector3& norm, hsScalar dist, const hsVector3& vec, hsPoint3& p) +hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsVector3& norm, float dist, const hsVector3& vec, hsPoint3& p) { - hsScalar s = norm.InnerProduct(vec); - const hsScalar kAlmostZero = 1.e-5f; + float s = norm.InnerProduct(vec); + const float kAlmostZero = 1.e-5f; if( (s > kAlmostZero)||(s < kPastZero) ) { dist /= s; @@ -324,7 +325,7 @@ hsBool plTriUtils::ProjectOntoPlaneAlongVector(const hsPoint3& p0, const hsPoint hsVector3 v12(&p1, &p2); hsVector3 norm = v12 % v02; - hsScalar dist = norm.InnerProduct(p0 - p); + float dist = norm.InnerProduct(p0 - p); return ProjectOntoPlaneAlongVector(norm, dist, vec, p); } \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h index e1bf5715..704c2bc3 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h +++ b/Sources/Plasma/PubUtilLib/plMath/plTriUtils.h @@ -64,7 +64,7 @@ public: protected: - Bary IComputeBarycentric(const hsVector3& v12, hsScalar invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out); + Bary IComputeBarycentric(const hsVector3& v12, float invLenSq12, const hsVector3& v0, const hsVector3& v1, hsPoint3& out); int ISelectAxis(const hsVector3& norm); hsBool IFastBarycentric(int iAx, const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsPoint3&p, hsPoint3& out); @@ -77,9 +77,9 @@ public: hsBool FastBarycentricProjection(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, hsPoint3&p, hsPoint3& out); hsBool FastBarycentric(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsPoint3&p, hsPoint3& out); - hsBool ProjectOntoPlane(const hsVector3& norm, hsScalar dist, hsPoint3& p); + hsBool ProjectOntoPlane(const hsVector3& norm, float dist, hsPoint3& p); hsBool ProjectOntoPlane(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, hsPoint3& p); - hsBool ProjectOntoPlaneAlongVector(const hsVector3& norm, hsScalar dist, const hsVector3& vec, hsPoint3& p); + hsBool ProjectOntoPlaneAlongVector(const hsVector3& norm, float dist, const hsVector3& vec, hsPoint3& p); hsBool ProjectOntoPlaneAlongVector(const hsPoint3& p0, const hsPoint3& p1, const hsPoint3& p2, const hsVector3& vec, hsPoint3& p); }; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h index d10be358..219da379 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h @@ -117,13 +117,13 @@ public: void SetLoopName(const char *name); const char *GetLoopName(); - hsScalar fBegin; - hsScalar fEnd; - hsScalar fLoopEnd; - hsScalar fLoopBegin; - hsScalar fSpeed; - hsScalar fSpeedChangeRate; - hsScalar fTime; + float fBegin; + float fEnd; + float fLoopEnd; + float fLoopBegin; + float fSpeed; + float fSpeedChangeRate; + float fTime; // IO void Read(hsStream* stream, hsResMgr* mgr); @@ -168,11 +168,11 @@ public: void SetAnimName(const char *name); const char *GetAnimName(); - hsScalar fBlend; - hsScalar fBlendRate; - hsScalar fAmp; - hsScalar fAmpRate; - hsScalar fAnimTime; + float fBlend; + float fBlendRate; + float fAmp; + float fAmpRate; + float fAnimTime; // IO void Read(hsStream* stream, hsResMgr* mgr); @@ -183,7 +183,7 @@ class plAGInstanceCallbackMsg : public plEventCallbackMsg { public: plAGInstanceCallbackMsg() : plEventCallbackMsg(), fInstance(nil) {} - plAGInstanceCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plAGInstanceCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fInstance(nil) {} CLASSNAME_REGISTER( plAGInstanceCallbackMsg ); @@ -203,7 +203,7 @@ protected: public: plAGDetachCallbackMsg() : plEventCallbackMsg(), fAnimName(nil) {} - plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user), fAnimName(nil) {} virtual ~plAGDetachCallbackMsg(); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp index e40fd501..4b4f0c29 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp @@ -416,7 +416,7 @@ plAvBrainGenericMsg::plAvBrainGenericMsg() // canonical CTOR sender receiver type stage rewind transitionTime plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - plAvBrainGenericMsg::Type type, int stage, hsBool rewind, hsScalar transitionTime) + plAvBrainGenericMsg::Type type, int stage, hsBool rewind, float transitionTime) : plAvatarMsg(sender, receiver), fType(type), fWhichStage(stage), @@ -430,8 +430,8 @@ plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &recei } plAvBrainGenericMsg::plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool setTime, hsScalar newTime, - hsBool setDirection, bool isForward, hsScalar transitiontime) + Type type, int stage, hsBool setTime, float newTime, + hsBool setDirection, bool isForward, float transitiontime) : plAvatarMsg(sender, receiver), fType(type), fWhichStage(stage), diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h index 9bfa2b18..3517248e 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h @@ -282,9 +282,9 @@ public: } fType; int fWhichStage; // used only by goto stage - hsScalar fTransitionTime; // for crossfade between stages + float fTransitionTime; // for crossfade between stages hsBool fSetTime; - hsScalar fNewTime; + float fNewTime; hsBool fSetDirection; hsBool fNewDirection; int fNewLoopCount; @@ -293,7 +293,7 @@ public: //! Older constructor version, allowing simple rewinding only plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool rewind, hsScalar transitionTime); + Type type, int stage, hsBool rewind, float transitionTime); /** Canonical constructor, allowing full control over time and direction of new stage. \param sender Message sender @@ -307,8 +307,8 @@ public: \param transitionTime Time in seconds to transition between stages. */ plAvBrainGenericMsg(const plKey& sender, const plKey &receiver, - Type type, int stage, hsBool setTime, hsScalar newTime, - hsBool setDirection, bool isForward, hsScalar transitiontime); + Type type, int stage, hsBool setTime, float newTime, + hsBool setDirection, bool isForward, float transitiontime); /** Constructor for setting the loop count in a particular stage. \param sender The sender of this message. @@ -419,7 +419,7 @@ class plAvatarOpacityCallbackMsg : public plEventCallbackMsg { public: plAvatarOpacityCallbackMsg() : plEventCallbackMsg() {} - plAvatarOpacityCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plAvatarOpacityCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user) {} CLASSNAME_REGISTER( plAvatarOpacityCallbackMsg ); @@ -449,7 +449,7 @@ class plAvatarPhysicsEnableCallbackMsg : public plEventCallbackMsg { public: plAvatarPhysicsEnableCallbackMsg() : plEventCallbackMsg() {} - plAvatarPhysicsEnableCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, hsScalar t=0, int16_t repeats=-1, uint16_t user=0) : + plAvatarPhysicsEnableCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plEventCallbackMsg(receiver, e, idx, t, repeats, user) {} CLASSNAME_REGISTER( plAvatarPhysicsEnableCallbackMsg ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp index 51313e9f..3652f351 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.cpp @@ -73,7 +73,7 @@ void plBulletMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLEScalar(fPartyTime); } -void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar radius, hsScalar range, hsScalar psecs) +void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, float radius, float range, float psecs) { fFrom = from; fDir = dir; @@ -84,13 +84,13 @@ void plBulletMsg::FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar fCmd = kShot; } -void plBulletMsg::FireShot(const hsPoint3& from, const hsPoint3& at, hsScalar radius, hsScalar psecs) +void plBulletMsg::FireShot(const hsPoint3& from, const hsPoint3& at, float radius, float psecs) { hsVector3 dir(&at, &from); - hsScalar invLen = hsFastMath::InvSqrt(dir.MagnitudeSquared()); + float invLen = hsFastMath::InvSqrt(dir.MagnitudeSquared()); hsAssert(invLen > 0, "degenerate from and at to fire bullet"); dir *= invLen; - hsScalar range = 1.f / invLen; + float range = 1.f / invLen; FireShot(from, dir, radius, range, psecs); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h index 09c148dc..ded09309 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plBulletMsg.h @@ -60,9 +60,9 @@ protected: hsPoint3 fFrom; hsVector3 fDir; - hsScalar fRange; - hsScalar fRadius; - hsScalar fPartyTime; + float fRange; + float fRadius; + float fPartyTime; public: plBulletMsg() { SetBCastFlag(kNetPropagate | kBCastByType, true); } plBulletMsg(const plKey &s, @@ -81,17 +81,17 @@ public: hsBool Spray() const { return fCmd == kSpray; } hsBool Stop() const { return fCmd == kStop; } - void FireShot(const hsPoint3& from, const hsVector3& dir, hsScalar radius, hsScalar range, hsScalar psecs=-1.f); - void FireShot(const hsPoint3& from, const hsPoint3& at, hsScalar radius, hsScalar psecs=-1.f); + void FireShot(const hsPoint3& from, const hsVector3& dir, float radius, float range, float psecs=-1.f); + void FireShot(const hsPoint3& from, const hsPoint3& at, float radius, float psecs=-1.f); Cmd GetCmd() const { return fCmd; } void SetCmd(Cmd c) { fCmd = c; } const hsPoint3& From() const { return fFrom; } const hsVector3& Dir() const { return fDir; } - hsScalar Range() const { return fRange; } - hsScalar Radius() const { return fRadius; } - hsScalar PartyTime() const { return fPartyTime; } + float Range() const { return fRange; } + float Radius() const { return fRadius; } + float PartyTime() const { return fPartyTime; } }; #endif // plBulletMsg_inc diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp index e7d8545a..1d7a4580 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.cpp @@ -55,7 +55,7 @@ plDynaDecalEnableMsg::plDynaDecalEnableMsg() { } -plDynaDecalEnableMsg::plDynaDecalEnableMsg(const plKey& r, const plKey& a, double t, hsScalar w, hsBool end, uint32_t id, hsBool isArm) +plDynaDecalEnableMsg::plDynaDecalEnableMsg(const plKey& r, const plKey& a, double t, float w, hsBool end, uint32_t id, hsBool isArm) : plMessage(nil, r, nil), fKey(a), fFlags(0), diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h index 74b0e9b6..5ca73168 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynaDecalEnableMsg.h @@ -58,12 +58,12 @@ protected: }; plKey fKey; double fConTime; - hsScalar fWetLength; + float fWetLength; uint32_t fFlags; uint32_t fID; public: plDynaDecalEnableMsg(); - plDynaDecalEnableMsg(const plKey& r, const plKey& armOrShapeKey, double conTime, hsScalar wetLength, hsBool end, uint32_t id=uint32_t(-1), hsBool isArm=true); + plDynaDecalEnableMsg(const plKey& r, const plKey& armOrShapeKey, double conTime, float wetLength, hsBool end, uint32_t id=uint32_t(-1), hsBool isArm=true); ~plDynaDecalEnableMsg(); CLASSNAME_REGISTER( plDynaDecalEnableMsg ); @@ -85,8 +85,8 @@ public: double GetContactTime() const { return fConTime; } void SetContactTime(double t) { fConTime = t; } - hsScalar GetWetLength() const { return fWetLength; } - void SetWetLength(hsScalar w) { fWetLength = w; } + float GetWetLength() const { return fWetLength; } + void SetWetLength(float w) { fWetLength = w; } hsBool AtEnd() const { return 0 != (fFlags & kAtEnd); } void SetAtEnd(hsBool b) { if(b)fFlags |= kAtEnd; else fFlags &= ~kAtEnd; } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h index 6e771759..5992ba75 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicEnvMapMsg.h @@ -67,11 +67,11 @@ public: uint32_t fCmd; hsPoint3 fPos; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; - hsScalar fRefresh; + float fRefresh; public: plDynamicEnvMapMsg() : plMessage(nil, nil, nil), fCmd(0) {} diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h index d357e609..795718af 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInputEventMsg.h @@ -89,7 +89,7 @@ protected: ControlEventCode fControlCode; hsBool fControlActivated; hsPoint3 fTurnToPt; - hsScalar fControlPct; + float fControlPct; public: plControlEventMsg(); @@ -105,12 +105,12 @@ public: void SetControlCode(ControlEventCode c) { fControlCode = c; } void SetControlActivated(hsBool b) { fControlActivated = b; } void SetTurnToPt(hsPoint3 pt) { fTurnToPt = pt; } - void SetControlPct(hsScalar p) { fControlPct = p; } + void SetControlPct(float p) { fControlPct = p; } ControlEventCode GetControlCode() const { return fControlCode; } hsBool ControlActivated() { return fControlActivated; } hsPoint3 GetTurnToPt() { return fTurnToPt; } - hsScalar GetPct() { return fControlPct; } + float GetPct() { return fControlPct; } char* GetCmdString() { return fCmd; } // IO diff --git a/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h b/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h index 3101126e..49b204a3 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plInterestingPing.h @@ -60,9 +60,9 @@ public: CLASSNAME_REGISTER( plInterestingModMsg ); GETINTERFACE_ANY( plInterestingModMsg, plMessage ); - hsScalar fWeight; - hsScalar fRadius; - hsScalar fSize; + float fWeight; + float fRadius; + float fSize; hsPoint3 fPos; plKey fObj; uint8_t fType; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h index c9779b5e..2db1ed71 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plMovieMsg.h @@ -78,12 +78,12 @@ protected: hsColorRGBA fColor; hsColorRGBA fFadeInColor; - hsScalar fFadeInSecs; + float fFadeInSecs; hsColorRGBA fFadeOutColor; - hsScalar fFadeOutSecs; + float fFadeOutSecs; - hsScalar fVolume; + float fVolume; char* fFileName; @@ -135,25 +135,25 @@ public: // Center 0,0 is center of screen, 1,1 is Upper-Right, -1,-1 is Lower-Left, etc. const hsPoint2& GetCenter() const { return fCenter; } - hsScalar GetCenterX() const { return fCenter.fX; } - hsScalar GetCenterY() const { return fCenter.fY; } + float GetCenterX() const { return fCenter.fX; } + float GetCenterY() const { return fCenter.fY; } plMovieMsg& SetCenter(const hsPoint2& p) { fCenter = p; return *this; } - plMovieMsg& SetCenter(hsScalar x, hsScalar y) { fCenter.Set(x, y); return *this; } - plMovieMsg& SetCenterX(hsScalar x) { fCenter.fX = x; return *this; } - plMovieMsg& SetCenterY(hsScalar y) { fCenter.fY = y; return *this; } + plMovieMsg& SetCenter(float x, float y) { fCenter.Set(x, y); return *this; } + plMovieMsg& SetCenterX(float x) { fCenter.fX = x; return *this; } + plMovieMsg& SetCenterY(float y) { fCenter.fY = y; return *this; } // Scale of 1.0 matches movie pixel to screen pixel (whatever the resolution). // Scale of 2.0 doubles each movie pixel across 2 screen pixels. // Etc. const hsPoint2& GetScale() const { return fScale; } - hsScalar GetScaleX() const { return fScale.fX; } - hsScalar GetScaleY() const { return fScale.fY; } + float GetScaleX() const { return fScale.fX; } + float GetScaleY() const { return fScale.fY; } plMovieMsg& SetScale(const hsPoint2& p) { fScale = p; return *this; } - plMovieMsg& SetScale(hsScalar x, hsScalar y) { fScale.Set(x, y); return *this; } - plMovieMsg& SetScaleX(hsScalar x) { fScale.fX = x; return *this; } - plMovieMsg& SetScaleY(hsScalar y) { fScale.fY = y; return *this; } + plMovieMsg& SetScale(float x, float y) { fScale.Set(x, y); return *this; } + plMovieMsg& SetScaleX(float x) { fScale.fX = x; return *this; } + plMovieMsg& SetScaleY(float y) { fScale.fY = y; return *this; } // Include the movie folder, e.g. "avi/porno.bik" // String is copied, not pointer copy. @@ -163,27 +163,27 @@ public: // Color is mostly useful for alpha fade up and down. const hsColorRGBA& GetColor() const { return fColor; } plMovieMsg& SetColor(const hsColorRGBA& c) { fColor = c; return *this; } - plMovieMsg& SetColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fColor.Set(r,g,b,a); return *this; } - plMovieMsg& SetOpacity(hsScalar a) { return SetColor(1.f, 1.f, 1.f, a); } + plMovieMsg& SetColor(float r, float g, float b, float a) { fColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetOpacity(float a) { return SetColor(1.f, 1.f, 1.f, a); } // Or the auto matic fades const hsColorRGBA& GetFadeInColor() const { return fFadeInColor; } plMovieMsg& SetFadeInColor(const hsColorRGBA& c) { fFadeInColor = c; return *this; } - plMovieMsg& SetFadeInColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fFadeInColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetFadeInColor(float r, float g, float b, float a) { fFadeInColor.Set(r,g,b,a); return *this; } - hsScalar GetFadeInSecs() const { return fFadeInSecs; } - plMovieMsg& SetFadeInSecs(hsScalar s) { fFadeInSecs = s; return *this; } + float GetFadeInSecs() const { return fFadeInSecs; } + plMovieMsg& SetFadeInSecs(float s) { fFadeInSecs = s; return *this; } const hsColorRGBA& GetFadeOutColor() const { return fFadeOutColor; } plMovieMsg& SetFadeOutColor(const hsColorRGBA& c) { fFadeOutColor = c; return *this; } - plMovieMsg& SetFadeOutColor(hsScalar r, hsScalar g, hsScalar b, hsScalar a) { fFadeOutColor.Set(r,g,b,a); return *this; } + plMovieMsg& SetFadeOutColor(float r, float g, float b, float a) { fFadeOutColor.Set(r,g,b,a); return *this; } - hsScalar GetFadeOutSecs() const { return fFadeOutSecs; } - plMovieMsg& SetFadeOutSecs(hsScalar s) { fFadeOutSecs = s; return *this; } + float GetFadeOutSecs() const { return fFadeOutSecs; } + plMovieMsg& SetFadeOutSecs(float s) { fFadeOutSecs = s; return *this; } // Volume is on scale of 0=muted to 1=full - hsScalar GetVolume() const { return fVolume; } - plMovieMsg& SetVolume(hsScalar v) { fVolume = v; return *this; } + float GetVolume() const { return fVolume; } + plMovieMsg& SetVolume(float v) { fVolume = v; return *this; } plMovieMsg& AddCallback(plMessage* msg) { hsRefCnt_SafeRef(msg); fCallbacks.Append(msg); return *this; } uint32_t GetNumCallbacks() const { return fCallbacks.GetCount(); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h index 5119bb55..5a7eccdb 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plParticleUpdateMsg.h @@ -56,7 +56,7 @@ class plParticleUpdateMsg : public plMessage public: plParticleUpdateMsg() : plMessage(nil, nil, nil) {} - plParticleUpdateMsg(const plKey &s, const plKey &r, const double* t, uint32_t paramID, hsScalar paramValue ) + plParticleUpdateMsg(const plKey &s, const plKey &r, const double* t, uint32_t paramID, float paramValue ) : plMessage(s, r, t) { fParamID = paramID; fParamValue = paramValue; } virtual ~plParticleUpdateMsg() {} @@ -86,10 +86,10 @@ public: }; uint32_t fParamID; - hsScalar fParamValue; + float fParamValue; uint32_t GetParamID() { return fParamID; } - hsScalar GetParamValue() { return fParamValue; } + float GetParamValue() { return fParamValue; } // IO virtual void Read(hsStream* stream, hsResMgr* mgr) @@ -155,8 +155,8 @@ public: class plParticleKillMsg : public plMessage { public: - hsScalar fNumToKill; - hsScalar fTimeLeft; + float fNumToKill; + float fTimeLeft; uint8_t fFlags; enum @@ -166,7 +166,7 @@ public: }; plParticleKillMsg() : plMessage(nil, nil, nil), fNumToKill(0.f), fTimeLeft(0.f), fFlags(kParticleKillImmortalOnly) {} - plParticleKillMsg(const plKey &s, const plKey &r, const double* t, hsScalar numToKill, hsScalar timeLeft, uint8_t flags = kParticleKillImmortalOnly ) + plParticleKillMsg(const plKey &s, const plKey &r, const double* t, float numToKill, float timeLeft, uint8_t flags = kParticleKillImmortalOnly ) : plMessage(s, r, t) { fNumToKill = numToKill; fTimeLeft = timeLeft; fFlags = flags; } virtual ~plParticleKillMsg() {} @@ -196,7 +196,7 @@ public: class plParticleFlockMsg : public plMessage { public: - hsScalar fX, fY, fZ; + float fX, fY, fZ; uint8_t fCmd; enum { @@ -205,7 +205,7 @@ public: }; plParticleFlockMsg() : plMessage(nil, nil, nil), fCmd(0), fX(0.f), fY(0.f), fZ(0.f) {} - plParticleFlockMsg(const plKey &s, const plKey &r, const double* t, uint8_t cmd, hsScalar x, hsScalar y, hsScalar z) + plParticleFlockMsg(const plKey &s, const plKey &r, const double* t, uint8_t cmd, float x, float y, float z) : plMessage(s, r, t), fCmd(cmd), fX(x), fY(y), fZ(z) {} virtual ~plParticleFlockMsg() {} diff --git a/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h index 609eac77..4b229f84 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plTimerCallbackMsg.h @@ -59,7 +59,7 @@ public: GETINTERFACE_ANY( plTimerCallbackMsg, plMessage ); uint32_t fID; - hsScalar fTime; + float fTime; virtual void Read(hsStream* stream, hsResMgr* mgr) { diff --git a/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h index 438e38e5..8491fac0 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plTransitionMsg.h @@ -52,7 +52,7 @@ class plTransitionMsg : public plMessageWithCallbacks protected: uint32_t fEffect; - hsScalar fLengthInSecs; + float fLengthInSecs; hsBool fHoldUntilNext; public: enum @@ -64,7 +64,7 @@ public: }; plTransitionMsg() : plMessageWithCallbacks(nil, nil, nil), fEffect( 0 ) { SetBCastFlag(kBCastByExactType); } - plTransitionMsg( uint32_t type, hsScalar lengthInSecs, hsBool holdUntilNext = false ) : + plTransitionMsg( uint32_t type, float lengthInSecs, hsBool holdUntilNext = false ) : plMessageWithCallbacks(nil, nil, nil), fEffect( type ), fLengthInSecs( lengthInSecs ), fHoldUntilNext( holdUntilNext ) { SetBCastFlag( kBCastByExactType ); } @@ -74,7 +74,7 @@ public: GETINTERFACE_ANY( plTransitionMsg, plMessageWithCallbacks ); uint32_t GetEffect( void ) const { return fEffect; } - hsScalar GetLengthInSecs( void ) const { return fLengthInSecs; } + float GetLengthInSecs( void ) const { return fLengthInSecs; } hsBool GetHoldState( void ) const { return fHoldUntilNext; } virtual void Read(hsStream* s, hsResMgr* mgr) diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h index b2c00651..068fa3e1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plAnimEventModifier.h @@ -54,7 +54,7 @@ protected: hsTArray fReceivers;// Keys to notify when the anim event happens plMessage* fCallback; // The callback setup message we send when the anim loads - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } void ISendNotify(bool triggered); hsBool fDisabled; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp index 8512ffd8..657b9ae1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plAnimTimeConvertSDLModifier.cpp @@ -88,7 +88,7 @@ void plAnimTimeConvertSDLModifier::ISetCurrentATC(const plStateDataRecord* atcSt plStateDataRecord::SimpleVarsList vars; int num=atcStateDataRec->GetUsedVars(&vars); int j; - hsScalar lastStateAnimTime = 0; + float lastStateAnimTime = 0; double lastStateChange = 0; for(j=0;jfEvent == kEnd) time = 1.0f; fNotify->ClearEvents(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h index 8c1b373d..4bb981b8 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h @@ -66,8 +66,8 @@ protected: plKey fYAnim; plKey fNotificationKey; - hsScalar fXPos; - hsScalar fYPos; + float fXPos; + float fYPos; hsBool fActive; hsBool fAllOrNothing; @@ -78,7 +78,7 @@ protected: plAxisInputInterface *fInputIface; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plAxisAnimModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h index ea63c7e7..c768d38d 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.h @@ -50,7 +50,7 @@ protected: char* fTemplateName; bool fExportTime; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } public: plCloneSpawnModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h index 04846f52..8c1c6527 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plDecalEnableMod.h @@ -53,9 +53,9 @@ protected: hsTArray fDecalMgrs; - hsScalar fWetLength; + float fWetLength; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plDecalEnableMod(); @@ -69,8 +69,8 @@ public: virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr); - void SetWetLength(hsScalar t) { fWetLength = t; } - hsScalar GetWetLength() const { return fWetLength; } + void SetWetLength(float t) { fWetLength = t; } + float GetWetLength() const { return fWetLength; } void AddDecalKey(const plKey& k) { fDecalMgrs.Append(k); } uint32_t GetNumDecalKeys() const { return fDecalMgrs.GetCount(); } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h index 3e8a8512..15b70999 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plExcludeRegionModifier.h @@ -63,8 +63,8 @@ protected: hsTArray fContainedAvatars; // Avatars inside our volume plExcludeRegionSDLModifier *fSDLModifier; hsBool fSeek; // use smart seek or teleport? - hsScalar fSeekTime; // how long to seek for - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + float fSeekTime; // how long to seek for + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } void ISetPhysicalState(bool cleared); @@ -91,7 +91,7 @@ public: void AddSafePoint(plKey& key); void UseSmartSeek() { fSeek = true; } - void SetSeekTime(hsScalar s) { fSeekTime = s; } + void SetSeekTime(float s) { fSeekTime = s; } void SetBlockCameras(bool block) { fFlags.SetBit(kBlockCameras, block); } }; diff --git a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h index 06ff8d16..290e55bb 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plGameMarkerModifier.h @@ -54,7 +54,7 @@ protected: uint16_t fPlaceSndIdx; uint16_t fHitSndIdx; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } plKey IFindCloneKey(plKey baseKey); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h index 5ba60bac..ded2f8fd 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plImageLibMod.h @@ -54,7 +54,7 @@ protected: hsTArray fImages; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; } public: plImageLibMod(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h index 5e0f4ebe..33fc6ea3 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plInterfaceInfoModifier.h @@ -52,7 +52,7 @@ class plInterfaceInfoModifier : public plSingleModifier protected: hsTArray fKeyList; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty){ return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty){ return true; } public: plInterfaceInfoModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h index 87a9a5d4..5bc700c6 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plMaintainersMarkerModifier.h @@ -57,7 +57,7 @@ public: kCalibrated, }; protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} int fCalibrated; public: diff --git a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h index f45c3d04..5d0b57dd 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h @@ -103,7 +103,7 @@ protected: int8_t ICmdFromWait(int8_t waitIdx); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; } static bool fDebugAnimBox; // Draws a box on screen when an animation is started static void IDebugAnimBox(bool start); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h index b30fcb41..2de7dd61 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.h @@ -60,7 +60,7 @@ protected: virtual void IPutCurrentStateIn(plStateDataRecord* dstState) = 0; virtual void ISetCurrentStateFrom(const plStateDataRecord* srcState) = 0; virtual void ISentState(const plStateDataRecord* sentState) {} - hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return false;} + hsBool IEval(double secs, float del, uint32_t dirty) {return false;} virtual uint32_t IApplyModFlags(uint32_t sendFlags); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp index dbbefd56..bdb1acdd 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.cpp @@ -114,7 +114,7 @@ void plSimpleModifier::IEnd() } } -hsBool plSimpleModifier::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plSimpleModifier::IEval(double secs, float del, uint32_t dirty) { return IHandleTime(secs, del); } @@ -180,13 +180,13 @@ hsBool plSimpleModifier::IHandleCmd(plAnimCmdMsg* modMsg) return true; } -hsBool plSimpleModifier::IHandleTime(double wSecs, hsScalar del) +hsBool plSimpleModifier::IHandleTime(double wSecs, float del) { if( !fTarget ) return true; - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); + float secs = fTimeConvert.WorldToAnimTime(wSecs); if( secs != fCurrentTime ) { diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h index 0b45cfda..73990dd1 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSimpleModifier.h @@ -71,9 +71,9 @@ protected: plAnimTimeConvert fTimeConvert; // The following are in animation time. - hsScalar fCurrentTime; + float fCurrentTime; - hsBool IHandleTime(double wSecs, hsScalar del); + hsBool IHandleTime(double wSecs, float del); hsBool IHandleRef(plRefMsg* refMsg); virtual hsBool IHandleCmd(plAnimCmdMsg* modMsg); @@ -83,7 +83,7 @@ protected: virtual void IBegin(); virtual void IEnd(); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); public: plSimpleModifier(); diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp index e4f895a0..3639d809 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSoundSDLModifier.cpp @@ -116,7 +116,7 @@ void plSoundSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcState) { //double timeStarted; /*if (soundState->FindVar(kStrTime)->Get(&timeStarted)) - sound->SynchedPlay((hsScalar)timeStarted); + sound->SynchedPlay((float)timeStarted); else { // Can't get the time we're supposed to start at, so we'll just try to play normally, diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h index e36cca73..1ddb919f 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plSpawnModifier.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSpawnModifier : public plMultiModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;} + virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;} public: plSpawnModifier(){;} diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp index ed5bee0a..0215d3fd 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp @@ -498,7 +498,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) return true; } - const hsScalar kMaxTimeForLinkTrigger = 30.f; + const float kMaxTimeForLinkTrigger = 30.f; // If we're not loading state, we're in the age. So this avatar coming in must be linking in. // If the player is us, no prep is necessary. @@ -529,7 +529,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) return hsKeyedObject::MsgReceive(msg); } -void plLinkEffectsMgr::WaitForEffect(plKey linkKey, hsScalar time) +void plLinkEffectsMgr::WaitForEffect(plKey linkKey, float time) { plLinkEffectsTriggerMsg *msg = IFindLinkTriggerMsg(linkKey); if (msg == nil) @@ -567,7 +567,7 @@ plMessage *plLinkEffectsMgr::WaitForEffect(plKey linkKey) return callback; } -void plLinkEffectsMgr::WaitForPseudoEffect(plKey linkKey, hsScalar time) +void plLinkEffectsMgr::WaitForPseudoEffect(plKey linkKey, float time) { plPseudoLinkEffectMsg* msg = IFindPseudo(linkKey); if (msg == nil) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h index cea212b7..e4cd3b45 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.h @@ -86,8 +86,8 @@ public: CLASSNAME_REGISTER( plLinkEffectsMgr ); GETINTERFACE_ANY( plLinkEffectsMgr, hsKeyedObject ); - void WaitForEffect(plKey linkKey, hsScalar time); - void WaitForPseudoEffect(plKey linkKey, hsScalar time); + void WaitForEffect(plKey linkKey, float time); + void WaitForPseudoEffect(plKey linkKey, float time); plMessage *WaitForEffect(plKey linkKey); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp index dea957e5..c1eb32bc 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp @@ -105,7 +105,7 @@ void plNetClientMgr::IShowLists() mbr->GetTransportFlags() & plNetTransportMember::kSendingActions ? "A" : " ", mbr->AsStdString().c_str(), mbr->IsPeerToPeer(), - mbr->GetDistSq() != hsScalarMax ? hsSquareRoot(mbr->GetDistSq()) :-1.f); + mbr->GetDistSq() != FLT_MAX ? sqrt(mbr->GetDistSq()) :-1.f); txt.DrawString(x,y,str); y+=yOff; mbr->SetTransportFlags(mbr->GetTransportFlags() & diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp index 32739663..d49948c1 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrVoice.cpp @@ -245,7 +245,7 @@ hsBool plNetClientMgr::IUpdateListenList(double secs) int i; for(i=0;iSetDistSq(hsScalarMax); + fTransport.GetMember(i)->SetDistSq(FLT_MAX); if (fTransport.GetMember(i)->IsServer()) continue; diff --git a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp index a16ffcf5..2075c0c5 100644 --- a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp +++ b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp @@ -349,8 +349,8 @@ int compare( const void* arg1, const void *arg2 ) { plNetTransportMember** m1 = (plNetTransportMember**)arg1; plNetTransportMember** m2 = (plNetTransportMember**)arg2; - float d1=m1 ? (*m1)->GetDistSq() : hsScalarMax; - float d2=m2 ? (*m2)->GetDistSq() : hsScalarMax; + float d1=m1 ? (*m1)->GetDistSq() : FLT_MAX; + float d2=m2 ? (*m2)->GetDistSq() : FLT_MAX; return (int)(d1-d2); } diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp index 2f160621..878a4eb6 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.cpp @@ -138,10 +138,10 @@ hsBool plConvexVolume::IsInside(const hsPoint3 &pos) const hsBool plConvexVolume::ResolvePoint(hsPoint3 &pos) const { - hsScalar minDist = 1.e33f; + float minDist = 1.e33f; int32_t minIndex = -1; - hsScalar currDist; + float currDist; int i; for (i = 0; i < fNumPlanes; i++) { @@ -159,12 +159,12 @@ hsBool plConvexVolume::ResolvePoint(hsPoint3 &pos) const return true; } -hsBool plConvexVolume::BouncePoint(hsPoint3 &pos, hsVector3 &velocity, hsScalar bounce, hsScalar friction) const +hsBool plConvexVolume::BouncePoint(hsPoint3 &pos, hsVector3 &velocity, float bounce, float friction) const { - hsScalar minDist = 1.e33f; + float minDist = 1.e33f; int32_t minIndex = -1; - hsScalar currDist; + float currDist; int i; for (i = 0; i < fNumPlanes; i++) { diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h index ee7b947d..984ae8f3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plConvexVolume.h @@ -75,7 +75,7 @@ public: // returns true if the point was inside and pos and velocity updated to bounce off offending plane. // input bounce==1.f for perfect bounce, bounce==0 to slide. - hsBool BouncePoint(hsPoint3 &pos, hsVector3 &velocity, hsScalar bounce, hsScalar friction) const; + hsBool BouncePoint(hsPoint3 &pos, hsVector3 &velocity, float bounce, float friction) const; inline hsBool TestPlane(const hsPoint3 &pos, const hsPlane3 &plane) const; // Is the point inside the plane? virtual void Read(hsStream* s, hsResMgr *mgr); @@ -92,7 +92,7 @@ protected: inline hsBool plConvexVolume::TestPlane(const hsPoint3 &pos, const hsPlane3 &plane) const { - hsScalar dis = plane.fN.InnerProduct(pos); + float dis = plane.fN.InnerProduct(pos); dis += plane.fD; if( dis >= 0.f ) return false; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h index 9d6747e2..bac6a7ef 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plEffectTargetInfo.h @@ -58,7 +58,7 @@ public: plPipeline* fPipeline; plParticleSystem* fSystem; double fSecs; - hsScalar fDelSecs; + float fDelSecs; }; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h index 71123aa2..f037f6e3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticle.h @@ -85,7 +85,7 @@ public: uint32_t fColor; // Particle opacity goes into the color's alpha. hsPoint3 fOrientation; // fMiscFlags determines how this should be used. hsVector3 fNormal; - hsScalar fHSize, fVSize; // distance from the heart of the particle to the borders of its poly. + float fHSize, fVSize; // distance from the heart of the particle to the borders of its poly. hsPoint3 fUVCoords[4]; }; @@ -94,13 +94,13 @@ class plParticleExt public: //hsPoint3 fOldPos; hsVector3 fVelocity; - hsScalar fInvMass; // The inverse (1 / mass) is what we actually need for calculations. Storing it this + float fInvMass; // The inverse (1 / mass) is what we actually need for calculations. Storing it this // way allows us to make an object immovable with an inverse mass of 0 (and save a divide). hsVector3 fAcceleration; // Accumulated from multiple forces. - hsScalar fLife; // how many seconds before we recycle this? (My particle has more of a life than I do...) - hsScalar fStartLife; - hsScalar fScale; - hsScalar fRadsPerSec; + float fLife; // how many seconds before we recycle this? (My particle has more of a life than I do...) + float fStartLife; + float fScale; + float fRadsPerSec; //uint32_t fOrigColor; enum // Miscellaneous flags for particles diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp index 5be2f842..86f807c3 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleApplicator.cpp @@ -88,7 +88,7 @@ void plParticleAngleApplicator::IApply(const plAGModifier *mod, double time) { plScalarChannel *chan = plScalarChannel::ConvertNoRef(fChannel); IGetParticleGen(mod->GetTarget(0))->UpdateParam(plParticleUpdateMsg::kParamInitPitchRange, - (hsScalar)(chan->Value(time) * PI / 180.f)); + (float)(chan->Value(time) * PI / 180.f)); } void plParticleVelMinApplicator::IApply(const plAGModifier *mod, double time) diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp index 946e685b..3d46b731 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.cpp @@ -234,9 +234,9 @@ plParticleFadeVolumeEffect::~plParticleFadeVolumeEffect() // The shorter the distance, the more noticable the fade out. // Note the wierdness between the fractions, because kFadeFrac is fraction // of fLength, but kFadeParm and kInvFadeFrac are fraction of 2.f*fLength. Sorry. -const hsScalar kFadeFrac = 0.5f; -const hsScalar kFadeParm = 1.f - kFadeFrac * 0.5f; -const hsScalar kInvFadeFrac = 1.f / (kFadeFrac * 0.5f); +const float kFadeFrac = 0.5f; +const float kFadeParm = 1.f - kFadeFrac * 0.5f; +const float kInvFadeFrac = 1.f / (kFadeFrac * 0.5f); void plParticleFadeVolumeEffect::PrepareEffect(const plEffectTargetInfo &target) { @@ -269,9 +269,9 @@ hsBool plParticleFadeVolumeEffect::ApplyEffect(const plEffectTargetInfo& target, { hsPoint3 *currPos = (hsPoint3 *)(target.fPos + i * target.fPosStride); - hsScalar parm; + float parm; - hsScalar fade = 1.f; + float fade = 1.f; parm = (currPos->fX - fMin.fX) * fNorm.fX; if( parm < 0 ) @@ -409,7 +409,7 @@ void plParticleWindEffect::Write(hsStream *s, hsResMgr *mgr) void plParticleWindEffect::SetRefDirection(const hsVector3& v) { fRefDir = v; - hsScalar lenSq = fRefDir.MagnitudeSquared(); + float lenSq = fRefDir.MagnitudeSquared(); if( lenSq > 1.e-1f ) { fDir = fRefDir * hsFastMath::InvSqrtAppr(lenSq); @@ -489,7 +489,7 @@ hsBool plParticleLocalWind::ApplyEffect(const plEffectTargetInfo& target, int32_ const hsPoint3& pos = *(hsPoint3 *)(target.fPos + i * target.fPosStride); hsVector3& vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - const hsScalar kMinToBother = 0; + const float kMinToBother = 0; float strength = 1.f / ( (1.f + fConstancy) * (1.f + fConstancy) ); float s, c, t; @@ -516,7 +516,7 @@ hsBool plParticleLocalWind::ApplyEffect(const plEffectTargetInfo& target, int32_ strength *= c; #endif - const hsScalar& invMass = *(hsScalar*)(target.fInvMass + i * target.fInvMassStride); + const float& invMass = *(float*)(target.fInvMass + i * target.fInvMassStride); strength *= invMass; vel += fWindVec * strength; @@ -569,9 +569,9 @@ void plParticleUniformWind::Write(hsStream *s, hsResMgr *mgr) s->WriteLEScalar(fFreqRate); } -void plParticleUniformWind::SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar maxSecsPerCycle) +void plParticleUniformWind::SetFrequencyRange(float minSecsPerCycle, float maxSecsPerCycle) { - const hsScalar kMinSecsPerCycle = 1.f; + const float kMinSecsPerCycle = 1.f; if( minSecsPerCycle < kMinSecsPerCycle ) minSecsPerCycle = kMinSecsPerCycle; if( minSecsPerCycle < kMinSecsPerCycle ) @@ -589,9 +589,9 @@ void plParticleUniformWind::SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar } } -void plParticleUniformWind::SetFrequencyRate(hsScalar secsPerCycle) +void plParticleUniformWind::SetFrequencyRate(float secsPerCycle) { - const hsScalar kMinSecsPerCycle = 1.f; + const float kMinSecsPerCycle = 1.f; if( secsPerCycle < kMinSecsPerCycle ) secsPerCycle = kMinSecsPerCycle; fFreqRate = 1.f / secsPerCycle; @@ -606,9 +606,9 @@ void plParticleUniformWind::PrepareEffect(const plEffectTargetInfo& target) { static plRandom random; - const double kTwoPi = hsScalarPI * 2.0; + const double kTwoPi = M_PI * 2.0; double t0 = fFreqCurr * fLastFreqSecs + fCurrPhase; - hsScalar t1 = (hsScalar)fmod(t0, kTwoPi); + float t1 = (float)fmod(t0, kTwoPi); fCurrPhase -= t0 - t1; fFreqCurr += fFreqRate * target.fContext.fDelSecs * random.RandZeroToOne(); @@ -624,11 +624,11 @@ void plParticleUniformWind::PrepareEffect(const plEffectTargetInfo& target) fFreqRate = -fFreqRate; } - hsScalar phaseDel = (hsScalar)(t1 - (fFreqCurr * fLastFreqSecs + fCurrPhase)); + float phaseDel = (float)(t1 - (fFreqCurr * fLastFreqSecs + fCurrPhase)); fCurrPhase += phaseDel; - hsScalar t = hsScalar(fFreqCurr * target.fContext.fSecs + fCurrPhase); - hsScalar s; + float t = float(fFreqCurr * target.fContext.fSecs + fCurrPhase); + float s; hsFastMath::SinCosAppr(t, s, fCurrentStrength); fCurrentStrength += fConstancy; fCurrentStrength /= (1.f + fConstancy); @@ -645,7 +645,7 @@ hsBool plParticleUniformWind::ApplyEffect(const plEffectTargetInfo& target, int3 { hsVector3& vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - const hsScalar& invMass = *(hsScalar*)(target.fInvMass + i * target.fInvMassStride); + const float& invMass = *(float*)(target.fInvMass + i * target.fInvMassStride); vel += fWindVec * (invMass * fCurrentStrength); @@ -729,9 +729,9 @@ void plParticleFlockEffect::IUpdateInfluences(const plEffectTargetInfo &target) } if (numAvg > 0) - fInfluences[i].fAvgVel /= (hsScalar)numAvg; + fInfluences[i].fAvgVel /= (float)numAvg; if (numRep > 0) - fInfluences[i].fRepDir /= (hsScalar)numRep; + fInfluences[i].fRepDir /= (float)numRep; } } @@ -751,7 +751,7 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, int3 const hsPoint3 &pos = *(hsPoint3*)(target.fPos + i * target.fPosStride); hsVector3 &vel = *(hsVector3*)(target.fVelocity + i * target.fVelocityStride); - hsScalar curSpeed = vel.Magnitude(); + float curSpeed = vel.Magnitude(); hsPoint3 goal; if (*(uint32_t*)(target.fMiscFlags + i * target.fMiscFlagsStride) & plParticleExt::kImmortal) goal = target.fContext.fSystem->GetTarget(0)->GetLocalToWorld().GetTranslate() + fTargetOffset; @@ -761,13 +761,13 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, int3 hsVector3 goalDir; hsPoint3 tmp = goal - pos; goalDir.Set(&tmp); - hsScalar distSq = goalDir.MagnitudeSquared(); + float distSq = goalDir.MagnitudeSquared(); goalDir.Normalize(); - hsScalar goalStr; - hsScalar maxSpeed; - hsScalar maxSpeedSq; + float goalStr; + float maxSpeed; + float maxSpeedSq; if (distSq <= fGoalDistSq) { goalStr = fGoalOrbitStr; @@ -785,7 +785,7 @@ hsBool plParticleFlockEffect::ApplyEffect(const plEffectTargetInfo& target, int3 } else { - hsScalar pct = (distSq - fGoalDistSq) / (fFullChaseDistSq - fGoalDistSq); + float pct = (distSq - fGoalDistSq) / (fFullChaseDistSq - fGoalDistSq); goalStr = fGoalOrbitStr + (fGoalChaseStr - fGoalOrbitStr) * pct; maxSpeed = fMaxOrbitSpeed + (fMaxChaseSpeed - fMaxOrbitSpeed) * pct; } @@ -812,7 +812,7 @@ void plParticleFlockEffect::SetMaxParticles(const uint16_t num) if (num > 0) { - fDistSq = TRACKED_NEW hsScalar[num * num]; + fDistSq = TRACKED_NEW float[num * num]; fInfluences = TRACKED_NEW plParticleInfluenceInfo[num]; } } diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h index eac5731f..f74073c6 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEffect.h @@ -120,8 +120,8 @@ public: class plParticleCollisionEffectBounce : public plParticleCollisionEffect { protected: - hsScalar fBounce; - hsScalar fFriction; + float fBounce; + float fFriction; public: plParticleCollisionEffectBounce(); @@ -133,11 +133,11 @@ public: virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - void SetBounce(hsScalar b) { fBounce = b; } - hsScalar GetBounce() const { return fBounce; } + void SetBounce(float b) { fBounce = b; } + float GetBounce() const { return fBounce; } - void SetFriction(hsScalar f) { fFriction = f; } - hsScalar GetFriction() const { return fFriction; } + void SetFriction(float f) { fFriction = f; } + float GetFriction() const { return fFriction; } }; class plParticleFadeVolumeEffect : public plParticleEffect @@ -163,7 +163,7 @@ public: virtual void Write(hsStream *s, hsResMgr *mgr); //virtual hsBool MsgReceive(plMessage *msg); - hsScalar fLength; + float fLength; hsBool fIgnoreZ; }; @@ -171,9 +171,9 @@ class plParticleWindEffect : public plParticleEffect { protected: // The properties that define the wind. These might/should be animatable. - hsScalar fStrength; - hsScalar fConstancy; - hsScalar fSwirl; + float fStrength; + float fConstancy; + float fSwirl; hsBool fHorizontal; hsVector3 fRefDir; @@ -198,14 +198,14 @@ public: virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); - void SetStrength(hsScalar v) { fStrength = v; } - hsScalar GetStrength() const { return fStrength; } + void SetStrength(float v) { fStrength = v; } + float GetStrength() const { return fStrength; } - void SetConstancy(hsScalar c) { fConstancy = c; } - hsScalar GetConstancy() const { return fConstancy; } + void SetConstancy(float c) { fConstancy = c; } + float GetConstancy() const { return fConstancy; } - void SetSwirl(hsScalar s) { fSwirl = s; } - hsScalar GetSwirl() const { return fSwirl; } + void SetSwirl(float s) { fSwirl = s; } + float GetSwirl() const { return fSwirl; } void SetHorizontal(hsBool on) { fHorizontal = on; } hsBool GetHorizontal() const { return fHorizontal; } @@ -218,7 +218,7 @@ class plParticleLocalWind : public plParticleWindEffect { protected: hsVector3 fScale; - hsScalar fSpeed; + float fSpeed; hsVector3 fPhase; hsVector3 fInvScale; @@ -237,8 +237,8 @@ public: void SetScale(const hsVector3& v) { fScale = v; } const hsVector3& GetScale() const { return fScale; } - void SetSpeed(hsScalar v) { fSpeed = v; } - hsScalar GetSpeed() const { return fSpeed; } + void SetSpeed(float v) { fSpeed = v; } + float GetSpeed() const { return fSpeed; } virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); @@ -249,15 +249,15 @@ class plParticleUniformWind : public plParticleWindEffect { protected: - hsScalar fFreqMin; - hsScalar fFreqMax; - hsScalar fFreqCurr; - hsScalar fFreqRate; + float fFreqMin; + float fFreqMax; + float fFreqCurr; + float fFreqRate; double fCurrPhase; double fLastFreqSecs; - hsScalar fCurrentStrength; + float fCurrentStrength; public: plParticleUniformWind(); ~plParticleUniformWind(); @@ -268,8 +268,8 @@ public: virtual void PrepareEffect(const plEffectTargetInfo& target); virtual hsBool ApplyEffect(const plEffectTargetInfo& target, int32_t i); - void SetFrequencyRange(hsScalar minSecsPerCycle, hsScalar maxSecsPerCycle); - void SetFrequencyRate(hsScalar secsPerCycle); + void SetFrequencyRange(float minSecsPerCycle, float maxSecsPerCycle); + void SetFrequencyRate(float secsPerCycle); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); @@ -289,19 +289,19 @@ class plParticleFlockEffect : public plParticleEffect protected: hsPoint3 fTargetOffset; // Worldspace offset from our target to get the true goal hsPoint3 fDissenterTarget; // Where to particles go when they get scared and leave us? - hsScalar fInfAvgRadSq; // Square of the radius of influence for average velocity matching. - hsScalar fInfRepRadSq; // Same, for repelling from neighbors. - hsScalar fAvgVelStr; // How strongly are we influenced by average dir? - hsScalar fRepDirStr; // Same for repelling - hsScalar fGoalOrbitStr; // Same for the goal (when we're within the desired distance) - hsScalar fGoalChaseStr; // Same for the goal (when we're too far away, and chasing it) - hsScalar fGoalDistSq; - hsScalar fFullChaseDistSq; - hsScalar fMaxOrbitSpeed; - hsScalar fMaxChaseSpeed; + float fInfAvgRadSq; // Square of the radius of influence for average velocity matching. + float fInfRepRadSq; // Same, for repelling from neighbors. + float fAvgVelStr; // How strongly are we influenced by average dir? + float fRepDirStr; // Same for repelling + float fGoalOrbitStr; // Same for the goal (when we're within the desired distance) + float fGoalChaseStr; // Same for the goal (when we're too far away, and chasing it) + float fGoalDistSq; + float fFullChaseDistSq; + float fMaxOrbitSpeed; + float fMaxChaseSpeed; uint16_t fMaxParticles; - hsScalar *fDistSq; // Table of distances from particle to particle + float *fDistSq; // Table of distances from particle to particle plParticleInfluenceInfo *fInfluences; void IUpdateDistances(const plEffectTargetInfo &target); @@ -319,16 +319,16 @@ public: void SetTargetOffset(const hsPoint3 &offset) { fTargetOffset = offset; } void SetDissenterTarget(const hsPoint3 &target) { fDissenterTarget = target; } - void SetInfluenceAvgRadius(hsScalar val) { fInfAvgRadSq = val * val; } - void SetInfluenceRepelRadius(hsScalar val) { fInfRepRadSq = val * val; } - void SetGoalRadius(hsScalar val) { fGoalDistSq = val * val; } - void SetFullChaseRadius(hsScalar val) { fFullChaseDistSq = val * val; } - void SetConformStr(hsScalar val) { fAvgVelStr = val; } - void SetRepelStr(hsScalar val) { fRepDirStr = val; } - void SetGoalOrbitStr(hsScalar val) { fGoalOrbitStr = val; } - void SetGoalChaseStr(hsScalar val) { fGoalChaseStr = val; } - void SetMaxOrbitSpeed(hsScalar val) { fMaxOrbitSpeed = val; } - void SetMaxChaseSpeed(hsScalar val) { fMaxChaseSpeed = val; } + void SetInfluenceAvgRadius(float val) { fInfAvgRadSq = val * val; } + void SetInfluenceRepelRadius(float val) { fInfRepRadSq = val * val; } + void SetGoalRadius(float val) { fGoalDistSq = val * val; } + void SetFullChaseRadius(float val) { fFullChaseDistSq = val * val; } + void SetConformStr(float val) { fAvgVelStr = val; } + void SetRepelStr(float val) { fRepDirStr = val; } + void SetGoalOrbitStr(float val) { fGoalOrbitStr = val; } + void SetGoalChaseStr(float val) { fGoalChaseStr = val; } + void SetMaxOrbitSpeed(float val) { fMaxOrbitSpeed = val; } + void SetMaxChaseSpeed(float val) { fMaxChaseSpeed = val; } void SetMaxParticles(uint16_t num); virtual void Read(hsStream *s, hsResMgr *mgr); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp index 997f2ec5..c3358c3b 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp @@ -140,7 +140,7 @@ void plParticleEmitter::ISetupParticleMem() fTargetInfo.fVelocity = (uint8_t *)fParticleExts; fTargetInfo.fInvMass = fTargetInfo.fVelocity + sizeof(hsVector3); - fTargetInfo.fAcceleration = fTargetInfo.fInvMass + sizeof(hsScalar); + fTargetInfo.fAcceleration = fTargetInfo.fInvMass + sizeof(float); fTargetInfo.fMiscFlags = (uint8_t *)&(fParticleExts[0].fMiscFlags); fTargetInfo.fRadsPerSec = (uint8_t *)&(fParticleExts[0].fRadsPerSec); fTargetInfo.fVelocityStride @@ -162,8 +162,8 @@ const hsMatrix44 &plParticleEmitter::GetLocalToWorld() const } void plParticleEmitter::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, uint32_t miscFlags, hsScalar radsPerSec) + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec) { plParticleCore *core; plParticleExt *ext; @@ -185,8 +185,8 @@ void plParticleEmitter::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t //if (core->fMiscFlags & kNormalUp != 0) core->fNormal.Set(0, 0, 1); - hsScalar xOff = (tileIndex % fSystem->fXTiles) / (float)fSystem->fXTiles; - hsScalar yOff = (tileIndex / fSystem->fXTiles) / (float)fSystem->fYTiles; + float xOff = (tileIndex % fSystem->fXTiles) / (float)fSystem->fXTiles; + float yOff = (tileIndex / fSystem->fXTiles) / (float)fSystem->fYTiles; core->fUVCoords[0].fX = xOff; core->fUVCoords[0].fY = yOff + 1.0f / fSystem->fYTiles; @@ -220,7 +220,7 @@ void plParticleEmitter::WipeExistingParticles() } // This method is called from a network received message. Don't trust the args without checking. -void plParticleEmitter::KillParticles(hsScalar num, hsScalar timeToDie, uint8_t flags) +void plParticleEmitter::KillParticles(float num, float timeToDie, uint8_t flags) { if (flags & plParticleKillMsg::kParticleKillPercentage) { @@ -252,7 +252,7 @@ void plParticleEmitter::KillParticles(hsScalar num, hsScalar timeToDie, uint8_t } } -void plParticleEmitter::UpdateGenerator(uint32_t paramID, hsScalar paramValue) +void plParticleEmitter::UpdateGenerator(uint32_t paramID, float paramValue) { if (fGenerator != nil) fGenerator->UpdateParam(paramID, paramValue); @@ -285,7 +285,7 @@ void plParticleEmitter::TranslateAllParticles(hsPoint3 &amount) fParticleCores[i].fPos += amount; } -hsBool plParticleEmitter::IUpdate(hsScalar delta) +hsBool plParticleEmitter::IUpdate(float delta) { if (fMiscFlags & kNeedsUpdate) { @@ -303,7 +303,7 @@ hsBool plParticleEmitter::IUpdate(hsScalar delta) return true; } -void plParticleEmitter::IUpdateParticles(hsScalar delta) +void plParticleEmitter::IUpdateParticles(float delta) { int i, j; @@ -343,7 +343,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) hsVector3 *currVelocity; hsVector3 *currAccel; hsPoint3 color(fColor.r, fColor.g, fColor.b); - hsScalar alpha = fColor.a; + float alpha = fColor.a; plController *colorCtl; // Allow effects a chance to cache any upfront calculations @@ -365,7 +365,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) { if (!( fParticleExts[i].fMiscFlags & plParticleExt::kImmortal )) { - hsScalar percent = (1.0f - fParticleExts[i].fLife / fParticleExts[i].fStartLife); + float percent = (1.0f - fParticleExts[i].fLife / fParticleExts[i].fStartLife); colorCtl = (fMiscFlags & kMatIsEmissive ? fSystem->fAmbientCtl : fSystem->fDiffuseCtl); if (colorCtl != nil) colorCtl->Interp(colorCtl->GetLength() * percent, &color); @@ -417,8 +417,8 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) } else if( fParticleExts[i].fRadsPerSec != 0 ) { - hsScalar sinX, cosX; - hsFastMath::SinCos(fParticleExts[i].fLife * fParticleExts[i].fRadsPerSec * 2.f * hsScalarPI, sinX, cosX); + float sinX, cosX; + hsFastMath::SinCos(fParticleExts[i].fLife * fParticleExts[i].fRadsPerSec * 2.f * M_PI, sinX, cosX); fParticleCores[i].fOrientation.Set(sinX, -cosX, 0); } @@ -431,7 +431,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) // V = V + -k*(V * delta) // V *= (1 + -k * delta) // Giving the change in velocity. - hsScalar drag = 1.f + fSystem->fDrag * delta; + float drag = 1.f + fSystem->fDrag * delta; // Clamp it at 0. Drag should never cause a reversal in velocity direction. if( drag < 0.f ) drag = 0.f; @@ -478,7 +478,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta) plProfile_CreateTimer("Bound", "Particles", ParticleBound); plProfile_CreateTimer("Normal", "Particles", ParticleNormal); -void plParticleEmitter::IUpdateBoundsAndNormals(hsScalar delta) +void plParticleEmitter::IUpdateBoundsAndNormals(float delta) { plProfile_BeginTiming(ParticleBound); fBoundBox.MakeEmpty(); @@ -576,7 +576,7 @@ uint32_t plParticleEmitter::CreateHexColor(const hsColorRGBA &color) return CreateHexColor(color.r, color.g, color.b, color.a); } -uint32_t plParticleEmitter::CreateHexColor(const hsScalar r, const hsScalar g, const hsScalar b, const hsScalar a) +uint32_t plParticleEmitter::CreateHexColor(const float r, const float g, const float b, const float a) { uint32_t ru, gu, bu, au; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h index 85af9aa5..ebb61737 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.h @@ -79,22 +79,22 @@ public: const hsMatrix44 &GetLocalToWorld() const; void AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, uint32_t miscFlags, hsScalar radsPerSec=0); + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec=0); void WipeExistingParticles(); - void KillParticles(hsScalar num, hsScalar timeToDie, uint8_t flags); + void KillParticles(float num, float timeToDie, uint8_t flags); uint16_t StealParticlesFrom(plParticleEmitter *victim, uint16_t num); // returns the number actually stolen void TranslateAllParticles(hsPoint3 &amount); // Used to recenter the system when linking between ages. - void UpdateGenerator(uint32_t paramID, hsScalar paramValue); + void UpdateGenerator(uint32_t paramID, float paramValue); static uint32_t CreateHexColor(const hsColorRGBA &color); - static uint32_t CreateHexColor(const hsScalar r, const hsScalar g, const hsScalar b, const hsScalar a); + static uint32_t CreateHexColor(const float r, const float g, const float b, const float a); void OverrideLocalToWorld(const hsMatrix44& l2w); void UnOverrideLocalToWorld() { fMiscFlags &= ~kOverrideLocalToWorld; } hsBool LocalToWorldOverridden() const { return 0 != (fMiscFlags & kOverrideLocalToWorld); } - void SetTimeToLive(hsScalar dt) { fTimeToLive = dt; } - hsScalar GetTimeToLive() const { return fTimeToLive; } // 0 time to live is never turn off. + void SetTimeToLive(float dt) { fTimeToLive = dt; } + float GetTimeToLive() const { return fTimeToLive; } // 0 time to live is never turn off. CLASSNAME_REGISTER( plParticleEmitter ); GETINTERFACE_ANY( plParticleEmitter, plCreatable); @@ -145,14 +145,14 @@ protected: hsColorRGBA fColor; hsMatrix44 fLocalToWorld; - hsScalar fTimeToLive; + float fTimeToLive; void IClear(); void ISetupParticleMem(); void ISetSystem(plParticleSystem *sys) { fSystem = sys; } - hsBool IUpdate(hsScalar delta); - void IUpdateParticles(hsScalar delta); - void IUpdateBoundsAndNormals(hsScalar delta); + hsBool IUpdate(float delta); + void IUpdateParticles(float delta); + void IUpdateBoundsAndNormals(float delta); void IRemoveParticle(uint32_t index); }; diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp index 270546c4..6c10c5f1 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp @@ -54,14 +54,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plMath/plRandom.h" -static const hsScalar DEFAULT_INVERSE_MASS = 1.f; +static const float DEFAULT_INVERSE_MASS = 1.f; static plRandom sRandom; const void plParticleGenerator::ComputeDirection(float pitch, float yaw, hsVector3 &direction) { - hsScalar cosPitch, sinPitch; - hsScalar cosYaw, sinYaw; + float cosPitch, sinPitch; + float cosYaw, sinYaw; hsFastMath::SinCos(pitch, sinPitch, cosPitch); hsFastMath::SinCos(yaw, sinYaw, cosYaw); @@ -101,13 +101,13 @@ plSimpleParticleGenerator::~plSimpleParticleGenerator() delete [] fInitYaw; } -void plSimpleParticleGenerator::Init(hsScalar genLife, hsScalar partLifeMin, hsScalar partLifeMax, - hsScalar particlesPerSecond, uint32_t numSources, hsPoint3 *initPos, - hsScalar *initPitch, hsScalar *initYaw, hsScalar angleRange, - hsScalar initVelMin, hsScalar initVelMax, - hsScalar xSize, hsScalar ySize, - hsScalar scaleMin, hsScalar scaleMax, - hsScalar massRange, hsScalar radsPerSecRange) +void plSimpleParticleGenerator::Init(float genLife, float partLifeMin, float partLifeMax, + float particlesPerSecond, uint32_t numSources, hsPoint3 *initPos, + float *initPitch, float *initYaw, float angleRange, + float initVelMin, float initVelMax, + float xSize, float ySize, + float scaleMin, float scaleMax, + float massRange, float radsPerSecRange) { fGenLife = genLife; fPartLifeMin = partLifeMin; @@ -162,21 +162,21 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f hsPoint3 orientation; hsVector3 initDirection; - hsScalar vel = (fVelMax + fVelMin) * 0.5f; - hsScalar velRange = vel - fVelMin; - hsScalar initVelocity; - hsScalar initLife; - hsScalar life = (fPartLifeMax + fPartLifeMin) * 0.5f; - hsScalar lifeRange = life - fPartLifeMin; - hsScalar currSizeVar; - hsScalar scale = (fScaleMax + fScaleMin) * 0.5f; - hsScalar scaleRange = scale - fScaleMin; - hsScalar radsPerSec = 0; + float vel = (fVelMax + fVelMin) * 0.5f; + float velRange = vel - fVelMin; + float initVelocity; + float initLife; + float life = (fPartLifeMax + fPartLifeMin) * 0.5f; + float lifeRange = life - fPartLifeMin; + float currSizeVar; + float scale = (fScaleMax + fScaleMin) * 0.5f; + float scaleRange = scale - fScaleMin; + float radsPerSec = 0; uint32_t tile; uint32_t sourceIndex; - const hsScalar lifeDiff = dt / numNewParticles; - hsScalar lifeSoFar; + const float lifeDiff = dt / numNewParticles; + float lifeSoFar; int i; for (i = 0, lifeSoFar = 0; i < numNewParticles; i++, lifeSoFar += lifeDiff) { @@ -208,7 +208,7 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f tile = (uint32_t)(sRandom.RandZeroToOne() * emitter->GetNumTiles()); currSizeVar = scale + scaleRange * sRandom.RandMinusOneToOne(); - hsScalar invMass = fPartInvMassMin; + float invMass = fPartInvMassMin; // Might be faster to just do the math instead of checking for zero... if( fPartInvMassRange > 0 ) invMass += fPartInvMassRange * sRandom.RandZeroToOne(); @@ -224,7 +224,7 @@ hsBool plSimpleParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, f return true; } -void plSimpleParticleGenerator::UpdateParam(uint32_t paramID, hsScalar paramValue) +void plSimpleParticleGenerator::UpdateParam(uint32_t paramID, float paramValue) { switch (paramID) { @@ -296,14 +296,14 @@ void plSimpleParticleGenerator::UpdateParam(uint32_t paramID, hsScalar paramValu void plSimpleParticleGenerator::Read(hsStream* s, hsResMgr *mgr) { - hsScalar genLife = s->ReadLEScalar(); - hsScalar partLifeMin = s->ReadLEScalar(); - hsScalar partLifeMax = s->ReadLEScalar(); - hsScalar pps = s->ReadLEScalar(); + float genLife = s->ReadLEScalar(); + float partLifeMin = s->ReadLEScalar(); + float partLifeMax = s->ReadLEScalar(); + float pps = s->ReadLEScalar(); uint32_t numSources = s->ReadLE32(); hsPoint3 *pos = TRACKED_NEW hsPoint3[numSources]; - hsScalar *pitch = TRACKED_NEW hsScalar[numSources]; - hsScalar *yaw = TRACKED_NEW hsScalar[numSources]; + float *pitch = TRACKED_NEW float[numSources]; + float *yaw = TRACKED_NEW float[numSources]; int i; for (i = 0; i < numSources; i++) { @@ -311,15 +311,15 @@ void plSimpleParticleGenerator::Read(hsStream* s, hsResMgr *mgr) pitch[i] = s->ReadLEScalar(); yaw[i] = s->ReadLEScalar(); } - hsScalar angleRange = s->ReadLEScalar(); - hsScalar velMin = s->ReadLEScalar(); - hsScalar velMax = s->ReadLEScalar(); - hsScalar xSize = s->ReadLEScalar(); - hsScalar ySize = s->ReadLEScalar(); - hsScalar scaleMin = s->ReadLEScalar(); - hsScalar scaleMax = s->ReadLEScalar(); - hsScalar massRange = s->ReadLEScalar(); - hsScalar radsPerSec = s->ReadLEScalar(); + float angleRange = s->ReadLEScalar(); + float velMin = s->ReadLEScalar(); + float velMax = s->ReadLEScalar(); + float xSize = s->ReadLEScalar(); + float ySize = s->ReadLEScalar(); + float scaleMin = s->ReadLEScalar(); + float scaleMax = s->ReadLEScalar(); + float massRange = s->ReadLEScalar(); + float radsPerSec = s->ReadLEScalar(); Init(genLife, partLifeMin, partLifeMax, pps, numSources, pos, pitch, yaw, angleRange, velMin, velMax, xSize, ySize, scaleMin, scaleMax, massRange, radsPerSec); @@ -347,7 +347,7 @@ void plSimpleParticleGenerator::Write(hsStream* s, hsResMgr *mgr) s->WriteLEScalar(fScaleMin); s->WriteLEScalar(fScaleMax); - hsScalar massRange = 1.f / fPartInvMassMin - DEFAULT_INVERSE_MASS; + float massRange = 1.f / fPartInvMassMin - DEFAULT_INVERSE_MASS; s->WriteLEScalar(massRange); s->WriteLEScalar(fPartRadsPerSecRange); } @@ -364,8 +364,8 @@ plOneTimeParticleGenerator::~plOneTimeParticleGenerator() delete [] fDirection; } -void plOneTimeParticleGenerator::Init(hsScalar count, hsPoint3 *pointArray, hsVector3 *dirArray, - hsScalar xSize, hsScalar ySize, hsScalar scaleMin, hsScalar scaleMax, hsScalar radsPerSecRange) +void plOneTimeParticleGenerator::Init(float count, hsPoint3 *pointArray, hsVector3 *dirArray, + float xSize, float ySize, float scaleMin, float scaleMax, float radsPerSecRange) { fCount = count; fPosition = pointArray; @@ -380,16 +380,16 @@ void plOneTimeParticleGenerator::Init(hsScalar count, hsPoint3 *pointArray, hsVe // The numForced param is required by the parent class, but ignored by this particular generator hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced /* = 0 */) { - hsScalar currSizeVar; - hsScalar scale = (fScaleMax + fScaleMin) / 2; - hsScalar scaleRange = scale - fScaleMin; + float currSizeVar; + float scale = (fScaleMax + fScaleMin) / 2; + float scaleRange = scale - fScaleMin; - hsScalar tile; + float tile; hsPoint3 currStart; hsPoint3 orientation; hsVector3 initDirection; hsVector3 zeroVel(0.f, 0.f, 0.f); - hsScalar radsPerSec = 0; + float radsPerSec = 0; int i; for (i = 0; i < fCount; i++) @@ -402,7 +402,7 @@ hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, else orientation.Set(&initDirection); - tile = (hsScalar)(sRandom.Rand() % emitter->GetNumTiles()); + tile = (float)(sRandom.Rand() % emitter->GetNumTiles()); currSizeVar = scale + scaleRange * sRandom.RandMinusOneToOne(); if( fPartRadsPerSecRange > 0 ) @@ -418,11 +418,11 @@ hsBool plOneTimeParticleGenerator::AddAutoParticles(plParticleEmitter *emitter, void plOneTimeParticleGenerator::Read(hsStream* s, hsResMgr *mgr) { uint32_t count = s->ReadLE32(); - hsScalar xSize = s->ReadLEScalar(); - hsScalar ySize = s->ReadLEScalar(); - hsScalar scaleMin = s->ReadLEScalar(); - hsScalar scaleMax = s->ReadLEScalar(); - hsScalar radsPerSecRange = s->ReadLEScalar(); + float xSize = s->ReadLEScalar(); + float ySize = s->ReadLEScalar(); + float scaleMin = s->ReadLEScalar(); + float scaleMax = s->ReadLEScalar(); + float radsPerSecRange = s->ReadLEScalar(); hsPoint3 *pos = TRACKED_NEW hsPoint3[count]; hsVector3 *dir = TRACKED_NEW hsVector3[count]; @@ -434,7 +434,7 @@ void plOneTimeParticleGenerator::Read(hsStream* s, hsResMgr *mgr) dir[i].Read(s); } - Init((hsScalar)count, pos, dir, xSize, ySize, scaleMin, scaleMax, radsPerSecRange); + Init((float)count, pos, dir, xSize, ySize, scaleMin, scaleMax, radsPerSecRange); } void plOneTimeParticleGenerator::Write(hsStream* s, hsResMgr *mgr) diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h index b8b42589..dd8109ee 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h @@ -58,7 +58,7 @@ public: // returns false if it's done generating particles and is safe to delete. virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced = 0) = 0; - virtual void UpdateParam(uint32_t paramID, hsScalar paramValue) = 0; + virtual void UpdateParam(uint32_t paramID, float paramValue) = 0; CLASSNAME_REGISTER( plParticleGenerator ); GETINTERFACE_ANY( plParticleGenerator, plCreatable ); @@ -73,43 +73,43 @@ class plSimpleParticleGenerator : public plParticleGenerator public: plSimpleParticleGenerator(); ~plSimpleParticleGenerator(); - void Init(hsScalar genLife, hsScalar partLifeMin, hsScalar partLifeMax, hsScalar particlesPerSecond, - uint32_t numSources, hsPoint3 *pos, hsScalar *initPitch, hsScalar *initYaw, hsScalar angleRange, - hsScalar initVelMin, hsScalar initVelMax, hsScalar xSize, hsScalar ySize, - hsScalar scaleMin, hsScalar scaleMax, - hsScalar massRange, hsScalar radsPerSecRange); + void Init(float genLife, float partLifeMin, float partLifeMax, float particlesPerSecond, + uint32_t numSources, hsPoint3 *pos, float *initPitch, float *initYaw, float angleRange, + float initVelMin, float initVelMax, float xSize, float ySize, + float scaleMin, float scaleMax, + float massRange, float radsPerSecRange); CLASSNAME_REGISTER( plSimpleParticleGenerator ); GETINTERFACE_ANY( plSimpleParticleGenerator, plParticleGenerator); virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced); - virtual void UpdateParam(uint32_t paramID, hsScalar paramValue); + virtual void UpdateParam(uint32_t paramID, float paramValue); virtual void Read(hsStream* s, hsResMgr *mgr); virtual void Write(hsStream* s, hsResMgr *mgr); protected: - hsScalar fParticlesPerSecond; + float fParticlesPerSecond; uint32_t fNumSources; hsPoint3 *fInitPos; - hsScalar *fInitPitch, *fInitYaw; - hsScalar fAngleRange; - hsScalar fVelMin, fVelMax; - hsScalar fXSize, fYSize, fScaleMin, fScaleMax; - hsScalar fGenLife; // How long shall we spit out particles from this location? When this time runs out, we stop + float *fInitPitch, *fInitYaw; + float fAngleRange; + float fVelMin, fVelMax; + float fXSize, fYSize, fScaleMin, fScaleMax; + float fGenLife; // How long shall we spit out particles from this location? When this time runs out, we stop // spitting particles, but we don't actually die until all of our particles die naturally. // (Even the ones that we feel are suffering needlessly.) - hsScalar fPartLifeMin; // lifespan for the particles we generate - hsScalar fPartLifeMax; + float fPartLifeMin; // lifespan for the particles we generate + float fPartLifeMax; - hsScalar fPartInvMassMin; // Doing a uniform variant over the inverse mass range (instead of over the mass range - hsScalar fPartInvMassRange; // and then inverting) will favor the low end of the mass range, but then again, + float fPartInvMassMin; // Doing a uniform variant over the inverse mass range (instead of over the mass range + float fPartInvMassRange; // and then inverting) will favor the low end of the mass range, but then again, // it's just a freaking game. Note though that fPartInvMassMin == 1.f / massMAX. - hsScalar fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] + float fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] - hsScalar fParticleSum; + float fParticleSum; enum { @@ -125,24 +125,24 @@ public: plOneTimeParticleGenerator(); ~plOneTimeParticleGenerator(); - void Init(hsScalar count, hsPoint3 *pointArray, hsVector3 *dirArray, - hsScalar xSize, hsScalar ySize, hsScalar scaleMin, hsScalar scaleMax, hsScalar radsPerSec); + void Init(float count, hsPoint3 *pointArray, hsVector3 *dirArray, + float xSize, float ySize, float scaleMin, float scaleMax, float radsPerSec); CLASSNAME_REGISTER( plOneTimeParticleGenerator ); GETINTERFACE_ANY( plOneTimeParticleGenerator, plParticleGenerator); virtual hsBool AddAutoParticles(plParticleEmitter *emitter, float dt, uint32_t numForced = 0); - virtual void UpdateParam(uint32_t paramID, hsScalar paramValue) {} + virtual void UpdateParam(uint32_t paramID, float paramValue) {} virtual void Read(hsStream* s, hsResMgr *mgr); virtual void Write(hsStream* s, hsResMgr *mgr); protected: - hsScalar fCount; + float fCount; hsPoint3 *fPosition; hsVector3 *fDirection; - hsScalar fXSize, fYSize, fScaleMin, fScaleMax; - hsScalar fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] + float fXSize, fYSize, fScaleMin, fScaleMax; + float fPartRadsPerSecRange; // Zero means no rot, otherwise uniform random between [-range..range] }; #endif diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp index a531cd4c..955bdc20 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp @@ -67,7 +67,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plProfile_CreateCounter("Num Particles", "Particles", NumParticles); -const hsScalar plParticleSystem::GRAVITY_ACCEL_FEET_PER_SEC2 = 32.0f; +const float plParticleSystem::GRAVITY_ACCEL_FEET_PER_SEC2 = 32.0f; plParticleSystem::plParticleSystem() : fParticleSDLMod(nil), fAttachedToAvatar(false) { @@ -147,7 +147,7 @@ plParticleEmitter* plParticleSystem::GetAvailEmitter() if( !fNumValidEmitters ) // got to start with at least one. return nil; - hsScalar minTTL = 1.e33; + float minTTL = 1.e33; int iMinTTL = -1; int i; for( i = 0; i < fNumValidEmitters; i++ ) @@ -217,8 +217,8 @@ uint32_t plParticleSystem::AddEmitter(uint32_t maxParticles, plParticleGenerator } void plParticleSystem::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, uint32_t miscFlags, hsScalar radsPerSec) + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec) { hsAssert(fNumValidEmitters > 0, "Trying to explicitly add particles to a system with no valid emitters."); if (fNumValidEmitters == 0) @@ -227,7 +227,7 @@ void plParticleSystem::AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t fEmitters[0]->AddParticle(pos, velocity, tileIndex, hSize, vSize, scale, invMass, life, orientation, miscFlags, radsPerSec); } -void plParticleSystem::GenerateParticles(uint32_t num, hsScalar dt /* = 0.f */) +void plParticleSystem::GenerateParticles(uint32_t num, float dt /* = 0.f */) { if (num <= 0) return; @@ -245,7 +245,7 @@ void plParticleSystem::WipeExistingParticles() fEmitters[i]->WipeExistingParticles(); } -void plParticleSystem::KillParticles(hsScalar num, hsScalar timeToDie, uint8_t flags) +void plParticleSystem::KillParticles(float num, float timeToDie, uint8_t flags) { if (fEmitters[0]) fEmitters[0]->KillParticles(num, timeToDie, flags); @@ -332,7 +332,7 @@ const hsMatrix44 &plParticleSystem::GetLocalToWorld() const return fTarget->GetCoordinateInterface()->GetLocalToWorld(); } -hsBool plParticleSystem::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plParticleSystem::IEval(double secs, float del, uint32_t dirty) { return false; } @@ -367,7 +367,7 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const // Now, are we visible? hsBool isVisible = pipe->TestVisibleWorld(wBnd); - hsScalar delta = fLastTime > 0 ? hsScalar(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); + float delta = fLastTime > 0 ? float(fCurrTime - fLastTime) : hsTimer::GetDelSysSeconds(); if( isVisible ) { // If we know how fast the fastest particle is moving, then we can @@ -382,13 +382,13 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const // We're in view, but how close are we to the camera? Look at closest point. hsPoint2 depth; wBnd.TestPlane(pipe->GetViewDirWorld(), depth); - hsScalar eyeDist = pipe->GetViewDirWorld().InnerProduct(pipe->GetViewPositionWorld()); - hsScalar dist = depth.fX - eyeDist; + float eyeDist = pipe->GetViewDirWorld().InnerProduct(pipe->GetViewPositionWorld()); + float dist = depth.fX - eyeDist; - static hsScalar kUpdateCutoffDist = 100.f; + static float kUpdateCutoffDist = 100.f; if( dist > kUpdateCutoffDist ) { - static hsScalar kDistantUpdateSecs = 0.1f; + static float kDistantUpdateSecs = 0.1f; return delta >= kDistantUpdateSecs; } #endif // ALWAYS_IF_VISIBLE @@ -397,7 +397,7 @@ hsBool plParticleSystem::IShouldUpdate(plPipeline* pipe) const } - static hsScalar kOffscreenUpdateSecs = 1.f; + static float kOffscreenUpdateSecs = 1.f; return delta >= kOffscreenUpdateSecs; } @@ -419,10 +419,10 @@ plDrawInterface* plParticleSystem::ICheckDrawInterface() void plParticleSystem::IHandleRenderMsg(plPipeline* pipe) { fCurrTime = hsTimer::GetSysSeconds(); - hsScalar delta = hsScalar(fCurrTime - fLastTime); + float delta = float(fCurrTime - fLastTime); if (delta == 0) return; - plConst(hsScalar) kMaxDelta(0.3f); + plConst(float) kMaxDelta(0.3f); if( delta > kMaxDelta ) delta = kMaxDelta; @@ -536,7 +536,7 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg) return plModifier::MsgReceive(msg); } -void plParticleSystem::UpdateGenerator(uint32_t paramID, hsScalar value) +void plParticleSystem::UpdateGenerator(uint32_t paramID, float value) { int i; for (i = 0; i < fNumValidEmitters; i++) @@ -585,7 +585,7 @@ void plParticleSystem::IPreSim() double secs = fPreSim; while (secs > 0) { - fEmitters[i]->IUpdateParticles((hsScalar)PRESIM_UPDATE_TICK); + fEmitters[i]->IUpdateParticles((float)PRESIM_UPDATE_TICK); secs -= PRESIM_UPDATE_TICK; } } diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h index a6f9a348..1f8df20a 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.h @@ -72,7 +72,7 @@ class plParticleSystem : public plModifier friend class plSimpleParticleGenerator; protected: - static const hsScalar GRAVITY_ACCEL_FEET_PER_SEC2; + static const float GRAVITY_ACCEL_FEET_PER_SEC2; plSceneObject *fTarget; hsGMaterial *fTexture; // One texture per system (Tiling is your friend!) @@ -81,9 +81,9 @@ protected: double fCurrTime; double fLastTime; hsVector3 fAccel; - hsScalar fPreSim; - hsScalar fDrag; - hsScalar fWindMult; + float fPreSim; + float fDrag; + float fWindMult; bool fAttachedToAvatar; uint32_t fMaxTotalParticles; @@ -113,7 +113,7 @@ protected: plParticleSDLMod *fParticleSDLMod; hsBool IShouldUpdate(plPipeline* pipe) const; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); // required by plModifier + virtual hsBool IEval(double secs, float del, uint32_t dirty); // required by plModifier void IHandleRenderMsg(plPipeline* pipe); plDrawInterface* ICheckDrawInterface(); void IAddEffect(plParticleEffect *effect, uint32_t type); @@ -152,11 +152,11 @@ public: // These are just public wrappers to the equivalent plParticleEmitter functions, provided for the purpose // of adding particles to a system explicitly. void AddParticle(hsPoint3 &pos, hsVector3 &velocity, uint32_t tileIndex, - hsScalar hSize, hsScalar vSize, hsScalar scale, hsScalar invMass, hsScalar life, - hsPoint3 &orientation, uint32_t miscFlags, hsScalar radsPerSec=0.f); - void GenerateParticles(uint32_t num, hsScalar dt = 0.f); + float hSize, float vSize, float scale, float invMass, float life, + hsPoint3 &orientation, uint32_t miscFlags, float radsPerSec=0.f); + void GenerateParticles(uint32_t num, float dt = 0.f); void WipeExistingParticles(); // Instant nuke - void KillParticles(hsScalar num, hsScalar timeToDie, uint8_t flags); // Sets a death timer. They'll get removed on the next update (if time has run out) + void KillParticles(float num, float timeToDie, uint8_t flags); // Sets a death timer. They'll get removed on the next update (if time has run out) uint16_t StealParticlesFrom(plParticleSystem *victim, uint16_t num); // Returns the number of particles actually stolen void TranslateAllParticles(hsPoint3 &amount); // Used to recenter the system when linking between ages. @@ -168,16 +168,16 @@ public: const hsMatrix44 &GetLocalToWorld() const; void SetAccel(const hsVector3& a) { fAccel = GRAVITY_ACCEL_FEET_PER_SEC2 * a; } - void SetGravity(hsScalar pct) { fAccel.Set(0, 0, -GRAVITY_ACCEL_FEET_PER_SEC2 * pct); } - void SetDrag(hsScalar d) { fDrag = -d; } - void SetWindMult(hsScalar m) { fWindMult = m; } - void SetPreSim(hsScalar time) { fPreSim = time; } - void UpdateGenerator(uint32_t paramID, hsScalar value); + void SetGravity(float pct) { fAccel.Set(0, 0, -GRAVITY_ACCEL_FEET_PER_SEC2 * pct); } + void SetDrag(float d) { fDrag = -d; } + void SetWindMult(float m) { fWindMult = m; } + void SetPreSim(float time) { fPreSim = time; } + void UpdateGenerator(uint32_t paramID, float value); plParticleGenerator *GetExportedGenerator() const; const hsVector3& GetAccel() const { return fAccel; } - hsScalar GetDrag() const { return fDrag; } - hsScalar GetWindMult() const { return fWindMult; } + float GetDrag() const { return fDrag; } + float GetWindMult() const { return fWindMult; } plParticleEffect *GetEffect(uint16_t type) const; plParticleSDLMod* GetSDLMod() {return fParticleSDLMod;} diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp index d876cacd..9dd9ac82 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp @@ -74,7 +74,7 @@ public: bool GotHit() { return fDist != FLT_MAX; } plKey GetObj() { return fHitObj; } - hsScalar GetDistance() { return fDist; } + float GetDistance() { return fDist; } const hsVector3& GetNormal() { return fNormal; } const hsPoint3& GetPoint() { return fPoint; } void ResetHitObj(){fHitObj=nil;} @@ -153,7 +153,7 @@ private: plKey fHitObj; hsVector3 fNormal; hsPoint3 fPoint; - hsScalar fDist; + float fDist; } gMyReport; plLOSDispatch::plLOSDispatch() @@ -213,7 +213,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg) gMyReport.InitCast(requestMsg->GetRequestType(), requestMsg->GetTestType()); hsVector3 norm = hsVector3(at - from); - hsScalar dist = norm.Magnitude(); + float dist = norm.Magnitude(); norm.Normalize(); NxRay worldRay; @@ -238,7 +238,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg) // If we have a cull db, adjust the length of the raycast to be from the // original point to the object we hit. If we find anything from the cull // db in there, the cast fails. - hsScalar dist = gMyReport.GetDistance(); + float dist = gMyReport.GetDistance(); if(dist!=0.0) { gMyReport.InitCast(requestMsg->GetCullDB(), plLOSRequestMsg::kTestAny); diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index fd9d9bc6..05489d9d 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -212,7 +212,7 @@ static void MakeBoxFromHull(NxConvexMesh* convexMesh, NxBoxShapeDesc& box) NxConvexMeshDesc desc; convexMesh->saveToDesc(desc); - hsScalar minX, minY, minZ, maxX, maxY, maxZ; + float minX, minY, minZ, maxX, maxY, maxZ; minX = minY = minZ = FLT_MAX; maxX = maxY = maxZ = -FLT_MAX; @@ -1071,7 +1071,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr) hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; if (fGroup == plSimDefs::kGroupAvatar) { diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h index 72908dd2..37e9c7bf 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.h @@ -74,9 +74,9 @@ class PhysRecipe public: PhysRecipe(); - hsScalar mass; - hsScalar friction; - hsScalar restitution; + float mass; + float friction; + float restitution; plSimDefs::Bounds bounds; plSimDefs::Group group; uint32_t reportsOn; @@ -91,7 +91,7 @@ public: NxTriangleMesh* triMesh; // For spheres only - hsScalar radius; + float radius; hsPoint3 offset; // For Boxes @@ -191,7 +191,7 @@ public: //this partially for exclude regions vs avatar capsule virtual hsBool OverlapWithCapsule(NxCapsule& cap); - virtual hsScalar GetMass() {return fMass;} + virtual float GetMass() {return fMass;} protected: void IGetPositionSim(hsPoint3& pos) const; void IGetRotationSim(hsQuat& rot) const; @@ -259,7 +259,7 @@ protected: void ISetHullToWorldWTriangles(); inline hsBool ITestPlane(const hsPoint3 &pos, const hsPlane3 &plane) { - hsScalar dis = plane.fN.InnerProduct(pos); + float dis = plane.fN.InnerProduct(pos); dis += plane.fD; if (dis == 0.f) return false; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp index 936d2cc2..963ff982 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp @@ -99,7 +99,7 @@ public: plPXPhysicalControllerCore* ac = plPXPhysicalControllerCore::FindController(hit.controller); NxActor& actor = hit.shape->getActor(); plPXPhysical* phys = (plPXPhysical*)actor.userData; - static hsScalar SlopeLimit = kSLOPELIMIT; + static float SlopeLimit = kSLOPELIMIT; hsVector3 normal = plPXConvert::Vector(hit.worldNormal); ac->fMovementInterface->IAddContactNormals(normal); #ifndef PLASMA_EXTERNAL_RELEASE @@ -127,9 +127,9 @@ public: // If the avatar hit a movable physical, apply some force to it. hsVector3 dir = plPXConvert::Vector(hit.dir); float dirdotup=dir.fZ; - hsPoint3 pos((hsScalar)hit.worldPos.x, (hsScalar)hit.worldPos.y, (hsScalar)hit.worldPos.z); + hsPoint3 pos((float)hit.worldPos.x, (float)hit.worldPos.y, (float)hit.worldPos.z); NxExtendedVec3 controllerPos=hit.controller->getPosition(); - hsVector3 bottomOfTheCapsule((hsScalar)controllerPos.x,(hsScalar)controllerPos.y,(hsScalar)controllerPos.z); + hsVector3 bottomOfTheCapsule((float)controllerPos.x,(float)controllerPos.y,(float)controllerPos.z); bottomOfTheCapsule.fZ=bottomOfTheCapsule.fZ-(ac->fHeight/2.0f + ac->fRadius); if (actor.isDynamic() ) { @@ -167,10 +167,10 @@ public: hsVector3 vel=ac->GetLinearVelocity()- plPXConvert::Vector( actor.getLinearVelocity()); if(dirdotup>=0)vel.fZ=0.001f; else vel.fZ=0.0f; - static hsScalar kAvieMass = 140.f/32.f; + static float kAvieMass = 140.f/32.f; if (!vel.IsEmpty()) { - static hsScalar kForceScale = 140.0f; + static float kForceScale = 140.0f; NxF32 coeff; NxExtendedVec3 norm2=hit.controller->getPosition(); norm2.x=hit.worldPos.x-bottomOfTheCapsule.fX; @@ -195,9 +195,9 @@ public: float proj=(float)(norm2.x*dir.fX+dir.fY*norm2.y+dir.fZ*norm2.z); coeff =abs(proj*kForceScale*vel.Magnitude()); - vel.fZ=(hsScalar)norm2.z; - vel.fY=(hsScalar)norm2.y; - vel.fX=(hsScalar)norm2.x; + vel.fZ=(float)norm2.z; + vel.fY=(float)norm2.y; + vel.fX=(float)norm2.x; phys->SetHitForce(vel*coeff, pos); } } @@ -223,13 +223,13 @@ public: } gMyReport; -plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, hsScalar height, hsScalar width) +plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, float height, float width) { // Test to see how many controller there already is if ( !plPXPhysicalControllerCore::fPXControllersMax || plPXPhysicalControllerCore::NumControllers() < plPXPhysicalControllerCore::fPXControllersMax ) { - hsScalar radius = width / 2.f; - hsScalar realHeight = height - width + kPhysicalHeightFudge; + float radius = width / 2.f; + float realHeight = height - width + kPhysicalHeightFudge; return TRACKED_NEW plPXPhysicalControllerCore(ownerSO, realHeight,radius); } return nil; @@ -326,7 +326,7 @@ int plPXPhysicalControllerCore::GetNumberOfControllersInThisSubWorld(plKey world return i; } // -plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius) +plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, float height, float radius) : plPhysicalControllerCore(ownerSO,height,radius) , fController(nil) , fProxyGen(nil) @@ -499,12 +499,12 @@ void plPXPhysicalControllerCore::IGetPositionSim(hsPoint3& pos) const if(this->fBehavingLikeAnimatedPhys) { const NxExtendedVec3& nxPos = fController->getPosition(); - pos.Set(hsScalar(nxPos.x), hsScalar(nxPos.y), hsScalar(nxPos.z) - kPhysZOffset); + pos.Set(float(nxPos.x), float(nxPos.y), float(nxPos.z) - kPhysZOffset); } else { NxVec3 Pos = fKinematicActor->getGlobalPosition(); - pos.Set(hsScalar(Pos.x), hsScalar(Pos.y), hsScalar(Pos.z) - kPhysZOffset); + pos.Set(float(Pos.x), float(Pos.y), float(Pos.z) - kPhysZOffset); } } void plPXPhysicalControllerCore::ICreateController() @@ -568,7 +568,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey); //hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); @@ -638,7 +638,7 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos) //hsAssert(!fProxyGen, "Already have proxy gen, double read?"); hsColorRGBA physColor; - hsScalar opac = 1.0f; + float opac = 1.0f; // local avatar is light purple and transparent physColor.Set(.2f, .1f, .2f, 1.f); @@ -809,7 +809,7 @@ void plPXPhysicalControllerCore::GetState(hsPoint3& pos, float& zRot) fLocalRotation.GetAngleAxis(&zRot, (hsVector3*)&pos); if (pos.fZ < 0) - zRot = (2 * hsScalarPI) - zRot; // axis is backwards, so reverse the angle too + zRot = (2 * M_PI) - zRot; // axis is backwards, so reverse the angle too pos = fLocalPosition; @@ -870,10 +870,10 @@ void plPXPhysicalControllerCore::GetKinematicPosition(hsPoint3& pos) if ( fKinematicActor ) { NxVec3 klPos = fKinematicActor->getGlobalPosition(); - pos.Set(hsScalar(klPos.x), hsScalar(klPos.y), hsScalar(klPos.z) - kPhysZOffset); + pos.Set(float(klPos.x), float(klPos.y), float(klPos.z) - kPhysZOffset); } } -void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePoststep( float delSecs) { // Apparently the user data field of the controllers is broken // uint32_t count = gControllerMgr.getNbControllers(); @@ -901,7 +901,7 @@ void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs) } } } -void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePrestep(float delSecs) { for (int i = 0; i < gControllers.size(); i++) { @@ -928,7 +928,7 @@ void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs) } gRebuildCache = false; } -void plPXPhysicalControllerCore::UpdatePostSimStep(hsScalar delSecs) +void plPXPhysicalControllerCore::UpdatePostSimStep(float delSecs) { for (int i = 0; i < gControllers.size(); i++) { @@ -1011,7 +1011,7 @@ void plPXPhysicalControllerCore::IHandleResize() // delete[] response; } -void plPXPhysicalControllerCore::SetControllerDimensions(hsScalar radius, hsScalar height) +void plPXPhysicalControllerCore::SetControllerDimensions(float radius, float height) { fNeedsResize=false; if(fRadius!=radius) @@ -1129,7 +1129,7 @@ void plPXPhysicalControllerCore::SetLinearVelocity(const hsVector3& linearVel) fKinematicActor->setLinearVelocity(vel); } } -void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel) +void plPXPhysicalControllerCore::SetAngularVelocity(const float angvel) { plPhysicalControllerCore::SetAngularVelocity(angvel); if(fKinematicActor && !fBehavingLikeAnimatedPhys) @@ -1138,7 +1138,7 @@ void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel) fKinematicActor->setAngularVelocity(vel); } } -void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, hsScalar angVel) +void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, float angVel) { SetLinearVelocity(linearVel); SetAngularVelocity(angVel); @@ -1212,7 +1212,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay() { hsVector3 normal = fDbgCollisionInfo[i].fNormal; char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no"; - hsScalar angle = hsScalarRadToDeg(hsACosine(normal * hsVector3(0, 0, 1))); + float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1))); sprintf(strBuf, " Obj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%3s)", fDbgCollisionInfo[i].fSO->GetKeyName(), normal.fX, normal.fY, normal.fZ, angle, overlapStr); diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h index 4e2710eb..c4dcb935 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h @@ -68,7 +68,7 @@ class plPXPhysicalControllerCore: public plPhysicalControllerCore { friend class PXControllerHitReportWalk; public: - plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius); + plPXPhysicalControllerCore(plKey ownerSO, float height, float radius); ~plPXPhysicalControllerCore(); //should actually be a 3 vector but everywhere else it is assumed to be just around Z @@ -98,7 +98,7 @@ public: virtual void GetPositionSim(hsPoint3& pos){IGetPositionSim(pos);} virtual void MoveKinematicToController(hsPoint3& pos); virtual const hsPoint3& GetLocalPosition(){return fLocalPosition;} - virtual void SetControllerDimensions(hsScalar radius, hsScalar height); + virtual void SetControllerDimensions(float radius, float height); virtual void LeaveAge(); virtual void UpdateControllerAndPhysicalRep(); @@ -113,9 +113,9 @@ public: static int GetControllersInThisSubWorld(plKey world, int maxToReturn, plPXPhysicalControllerCore** bufferout); static int GetNumberOfControllersInThisSubWorld(plKey world); - static void UpdatePrestep(hsScalar delSecs); - static void UpdatePoststep(hsScalar delSecs); - static void UpdatePostSimStep(hsScalar delSecs); + static void UpdatePrestep(float delSecs); + static void UpdatePoststep(float delSecs); + static void UpdatePostSimStep(float delSecs); virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray& idx, plDrawableSpans* addTo); #ifndef PLASMA_EXTERNAL_RELEASE static hsBool fDebugDisplay; @@ -129,8 +129,8 @@ public: virtual void SetLinearVelocity(const hsVector3& linearVel); //should actually be a 3 vector but everywhere else it is assumed to be just around Z - virtual void SetAngularVelocity(const hsScalar angvel); - virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel); + virtual void SetAngularVelocity(const float angvel); + virtual void SetVelocities(const hsVector3& linearVel, float angVel); protected: friend class PXControllerHitReport; @@ -151,8 +151,8 @@ protected: void IDrawDebugDisplay(); #endif void IHandleResize(); - hsScalar fPreferedRadius; - hsScalar fPreferedHeight; + float fPreferedRadius; + float fPreferedHeight; // The global position and rotation of the avatar last time we set it (so we // can detect if someone else moves him) plPhysicalProxy* fProxyGen; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp index af539f29..d6691e3d 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp @@ -468,7 +468,7 @@ NxScene* plSimulationMgr::GetScene(plKey world) if (!scene) { - uint32_t maxSteps = (uint32_t)hsCeil(fMaxDelta / fStepSize); + uint32_t maxSteps = (uint32_t)ceil(fMaxDelta / fStepSize); NxSceneDesc sceneDesc; sceneDesc.gravity.set(0, 0, -32.174049f); @@ -802,7 +802,7 @@ int plSimulationMgr::GetStepsPerSecond() return (int)((1.0 / fStepSize) + 0.5f); // round to nearest int } -int plSimulationMgr::GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution) +int plSimulationMgr::GetMaterialIdx(NxScene* scene, float friction, float restitution) { if (friction == 0.5f && restitution == 0.5f) return 0; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h index 18448172..d22fc286 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h @@ -97,7 +97,7 @@ public: // the scene void ReleaseScene(plKey world); - int GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution); + int GetMaterialIdx(NxScene* scene, float friction, float restitution); // PHYSX FIXME - walk thru all the convex hull detector regions to see if we are in any... we're either coming or going void UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp index a858a29a..15a01c62 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp @@ -743,7 +743,7 @@ plObjectInVolumeAndFacingDetector::~plObjectInVolumeAndFacingDetector() void plObjectInVolumeAndFacingDetector::SetFacingTolerance(int degrees) { - fFacingTolerance = hsCosine(hsScalarDegToRad(degrees)); + fFacingTolerance = cos(hsDegreesToRadians(degrees)); } void plObjectInVolumeAndFacingDetector::ICheckForTrigger() @@ -760,7 +760,7 @@ void plObjectInVolumeAndFacingDetector::ICheckForTrigger() playerView.Normalize(); objView.Normalize(); - hsScalar dot = playerView * objView; + float dot = playerView * objView; // hsStatusMessageF("Dot: %f Tolerance: %f", dot, fFacingTolerance); bool facing = dot >= fFacingTolerance; @@ -1075,7 +1075,7 @@ hsBool plSimpleRegionSensor::MsgReceive(plMessage *msg) } // IEVAL -hsBool plSimpleRegionSensor::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plSimpleRegionSensor::IEval(double secs, float del, uint32_t dirty) { return false; } diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h index a8331104..519215d3 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.h @@ -147,7 +147,7 @@ public: class plObjectInVolumeAndFacingDetector : public plObjectInVolumeDetector { protected: - hsScalar fFacingTolerance; + float fFacingTolerance; bool fNeedWalkingForward; bool fAvatarInVolume; @@ -271,7 +271,7 @@ public: virtual void Write(hsStream *stream, hsResMgr *mgr); virtual void Read(hsStream *stream, hsResMgr *mgr); - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); protected: plMessage *fEnterMsg; plMessage *fExitMsg; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h b/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h index ea95d9ed..849af880 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plDetectorModifier.h @@ -51,7 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plDetectorModifier : public plSingleModifier { protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty){ return true; } + virtual hsBool IEval(double secs, float del, uint32_t dirty){ return true; } hsTArray fReceivers; plModifier* fRemoteMod; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp index 5fdec3c5..a8cd5f5a 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.cpp @@ -55,7 +55,7 @@ plPhysicalProxy::plPhysicalProxy() { } -plPhysicalProxy::plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac) +plPhysicalProxy::plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac) : plProxyGen(amb, dif, opac), fOwner(nil), fController(nil) diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h index dd226dca..6804d7ad 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalProxy.h @@ -53,7 +53,7 @@ class plPhysicalProxy : public plProxyGen { public: plPhysicalProxy(); - plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, hsScalar opac); + plPhysicalProxy(const hsColorRGBA& amb, const hsColorRGBA& dif, float opac); virtual ~plPhysicalProxy(); bool Init(plPhysical* phys); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp index c54d4838..771d0efe 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.cpp @@ -171,7 +171,7 @@ void plPhysicalSndGroup::PlayImpactSound(uint32_t against) animMsg->Send(fImpactSounds[against]); } -void plPhysicalSndGroup::SetSlideSoundVolume(uint32_t against, hsScalar volume) +void plPhysicalSndGroup::SetSlideSoundVolume(uint32_t against, float volume) { if(against >= fSlideSounds.Count()) return; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h index 64f01aa5..8f54bc81 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSndGroup.h @@ -88,7 +88,7 @@ public: void PlaySlideSound(uint32_t against); void StopSlideSound(uint32_t against); void PlayImpactSound(uint32_t against); - void SetSlideSoundVolume(uint32_t against, hsScalar volume); + void SetSlideSoundVolume(uint32_t against, float volume); bool HasSlideSound(uint32_t against); bool HasImpactSound(uint32_t against); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp index d6a06732..0df567ce 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.cpp @@ -88,7 +88,7 @@ void plPhysicsSoundMgr::Update() void plPhysicsSoundMgr::IStartCollision(const CollidePair& cp) { hsVector3 v1, v2; - const hsScalar strengthThreshold = 20.0f; + const float strengthThreshold = 20.0f; plPhysical* physicalA = cp.FirstPhysical(); plPhysical* physicalB = cp.SecondPhysical(); @@ -106,7 +106,7 @@ void plPhysicsSoundMgr::IStartCollision(const CollidePair& cp) physicalA->GetLinearVelocitySim(v1); physicalB->GetLinearVelocitySim(v2); hsVector3 vel = v1 - v2; - hsScalar strength = vel.MagnitudeSquared(); + float strength = vel.MagnitudeSquared(); if (strength >= strengthThreshold) { @@ -149,7 +149,7 @@ void plPhysicsSoundMgr::IStopCollision(const CollidePair& cp) void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) { - const hsScalar slideThreshhold = 0.f; + const float slideThreshhold = 0.f; hsVector3 v1, v2; plPhysical* physicalA = cp.FirstPhysical(); plPhysical* physicalB = cp.SecondPhysical(); @@ -162,7 +162,7 @@ void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) physicalA->GetLinearVelocitySim(v1); physicalB->GetLinearVelocitySim(v2); hsVector3 vel = v1 - v2; - hsScalar strength = vel.MagnitudeSquared(); + float strength = vel.MagnitudeSquared(); // scale strength to use as volume strength /= 16*8; @@ -175,7 +175,7 @@ void plPhysicsSoundMgr::IUpdateCollision(const CollidePair& cp) IProcessSlide(sndB, sndA, strength); } -void plPhysicsSoundMgr::IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, hsScalar strength) +void plPhysicsSoundMgr::IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, float strength) { sndA->SetSlideSoundVolume(sndB->GetGroup(), strength); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h index 6b86136b..7ee2c8b7 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicsSoundMgr.h @@ -84,7 +84,7 @@ private: void IStartCollision(const CollidePair& cp); void IStopCollision(const CollidePair& cp); void IUpdateCollision(const CollidePair& cp); - void IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, hsScalar strength); + void IProcessSlide(plPhysicalSndGroup* sndA, plPhysicalSndGroup* sndB, float strength); typedef std::set CollideSet; CollideSet fPrevCollisions; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h b/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h index 6d8c41d8..013b21f0 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsFogControl.h @@ -62,14 +62,14 @@ protected: hsDynamicArray fFogNodes; // hsGEnvironment::FogState fAvgFog; - virtual hsScalar IGetStrength(hsSceneNode* node) = 0; + virtual float IGetStrength(hsSceneNode* node) = 0; void IPopNodes(); void IPushNodes(); void IZeroAvgFog(); void IAverageNodes(); -// void IAccumFog(hsGEnvironment* env, hsScalar wgt); +// void IAccumFog(hsGEnvironment* env, float wgt); public: hsFogControl() {} @@ -120,17 +120,17 @@ protected: }; hsDynamicArray fPortals; - hsScalar fDefRadius; + float fDefRadius; uint32_t fStatus; void IFindFogNodes(); - virtual hsScalar IGetStrength(hsSceneNode* node); + virtual float IGetStrength(hsSceneNode* node); public: hsPortalFogControl(); - void SetDefaultRadius(hsScalar r) { fDefRadius = r; } - hsScalar GetDefaultRadius() { return fDefRadius; } + void SetDefaultRadius(float r) { fDefRadius = r; } + float GetDefaultRadius() { return fDefRadius; } hsPortal* GetPortal(int i); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp index 33079b0a..0476ed5a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp @@ -1230,7 +1230,7 @@ namespace /// The table consists of entries for each of our supported chipsets in the table, /// plus, flags to be forced set and flags to be forced cleared. Also included /// is a Z-buffer suckiness rating, which represents how badly we need to bias - /// the z and w values to avoid z-buffer artifacts, stored as an hsScalar (i.e + /// the z and w values to avoid z-buffer artifacts, stored as an float (i.e /// a float). A rating of 0 means very good/default (read: Nvidia), while, say, /// a 9.0 (i.e. shift the scale 9 times above normal) means s****y, like, say, /// a Savage4. Also also included is a forced value for max # of layers (0 means @@ -1281,13 +1281,13 @@ namespace typedef struct { - hsScalar fFogExpApproxStart; - hsScalar fFogExp2ApproxStart; - hsScalar fFogEndBias; - hsScalar fFogExpKnee; // Fog knees - hsScalar fFogExpKneeVal; - hsScalar fFogExp2Knee; - hsScalar fFogExp2KneeVal; + float fFogExpApproxStart; + float fFogExp2ApproxStart; + float fFogEndBias; + float fFogExpKnee; // Fog knees + float fFogExpKneeVal; + float fFogExp2Knee; + float fFogExp2KneeVal; } FogTweakTable; FogTweakTable dsDefaultFogVals = { 0, 0, 254.0 / 255.0, 0.5f, 0.15f, 0.5f, 0.15f }; @@ -1301,9 +1301,9 @@ namespace uint8_t fType; // Our chipset ID uint32_t *fFlagsToSet; uint32_t *fFlagsToClear; - hsScalar fZSuckiness; // See above + float fZSuckiness; // See above uint32_t fForceMaxLayers; // The max # of layers we REALLY want (0 to not force) - hsScalar fLODRating; + float fLODRating; FogTweakTable *fFogTweaks; } CFTable; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp index e7eccb5f..85f7842d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp @@ -146,7 +146,7 @@ hsBool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t heigh // Create a render request and render request message plCaptureRenderRequest* req = TRACKED_NEW plCaptureRenderRequest; - const hsScalar pri(-100.f); + const float pri(-100.f); req->SetPriority(pri); req->SetRenderTarget(rt); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp index 2e2d188c..02e30c28 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.cpp @@ -124,7 +124,7 @@ void plCubicRenderTargetModifier::ICreateRenderRequest( int face ) //// IEval //////////////////////////////////////////////////////////////////// -hsBool plCubicRenderTargetModifier::IEval( double secs, hsScalar del, uint32_t dirty ) +hsBool plCubicRenderTargetModifier::IEval( double secs, float del, uint32_t dirty ) { hsPoint3 center; hsMatrix44 mtx, invMtx; @@ -178,7 +178,7 @@ hsBool plCubicRenderTargetModifier::MsgReceive( plMessage* msg ) if( eval ) { const double secs = eval->DSeconds(); - const hsScalar del = eval->DelSeconds(); + const float del = eval->DelSeconds(); IEval( secs, del, 0 ); return true; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h index c0f7c7fe..0c0ee15f 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCubicRenderTargetModifier.h @@ -93,7 +93,7 @@ protected: plRenderRequest *fRequests[ 6 ]; - virtual hsBool IEval( double secs, hsScalar del, uint32_t dirty ); // required by plModifier + virtual hsBool IEval( double secs, float del, uint32_t dirty ); // required by plModifier void ICreateRenderRequest( int face ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp index 5b1e2853..ba215cfd 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define MF_DEBUG_NORM #ifdef MF_DEBUG_NORM -#define IDEBUG_NORMALIZE( a, b ) { hsScalar len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } +#define IDEBUG_NORMALIZE( a, b ) { float len = hsFastMath::InvSqrtAppr((a).MagnitudeSquared()); a *= len; b *= len; } #else // MF_DEBUG_NORM #define IDEBUG_NORMALIZE( a, b ) @@ -60,10 +60,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //#define CULL_SMALL_TOLERANCE #ifdef CULL_SMALL_TOLERANCE -//static const hsScalar kTolerance = 1.e-5f; -static const hsScalar kTolerance = 1.e-3f; +//static const float kTolerance = 1.e-5f; +static const float kTolerance = 1.e-3f; #else //CULL_SMALL_TOLERANCE -static const hsScalar kTolerance = 1.e-1f; +static const float kTolerance = 1.e-1f; #endif // CULL_SMALL_TOLERANCE plProfile_CreateCounter("Harvest Nodes", "Draw", HarvestNodes); @@ -128,8 +128,8 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const // side timings to be sure. Still looking for some reasonably constructed real data sets. mf #define MF_TEST_SPHERE_FIRST #ifdef MF_TEST_SPHERE_FIRST - hsScalar dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist; - hsScalar rad = bnd.GetRadius(); + float dist = fNorm.InnerProduct(bnd.GetCenter()) + fDist; + float rad = bnd.GetRadius(); if( dist < -rad ) return kCulled; if( dist > rad ) @@ -139,7 +139,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const hsPoint2 depth; bnd.TestPlane(fNorm, depth); - const hsScalar kSafetyDist = -0.1f; + const float kSafetyDist = -0.1f; if( depth.fY + fDist < kSafetyDist ) return kCulled; @@ -149,7 +149,7 @@ plCullNode::plCullStatus plCullNode::TestBounds(const hsBounds3Ext& bnd) const return kSplit; } -plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hsScalar rad) const +plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, float rad) const { plCullNode::plCullStatus retVal = TestSphere(center, rad); @@ -198,9 +198,9 @@ plCullNode::plCullStatus plCullNode::ITestSphereRecur(const hsPoint3& center, hs return kCulled; } -plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, hsScalar rad) const +plCullNode::plCullStatus plCullNode::TestSphere(const hsPoint3& center, float rad) const { - hsScalar dist = fNorm.InnerProduct(center) + fDist; + float dist = fNorm.InnerProduct(center) + fDist; if( dist < -rad ) return kCulled; if( dist > rad ) @@ -384,7 +384,7 @@ void plCullNode::IHarvest(const plSpaceTree* space, hsTArray& outList) // This section builds the tree from the input cullpoly's ////////////////////////////////////////////////////////////////////// -void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& depths, +void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& depths, hsBitVector& inVerts, hsBitVector& outVerts, hsBitVector& onVerts, @@ -415,7 +415,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de if( outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); + float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); // add interp onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(i-1) ) @@ -429,7 +429,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de if( inVerts.IsBitSet(outPoly.fVerts.GetCount()-1) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); + float t = IInterpVert(poly.fVerts[i-1], poly.fVerts[i], interp); // add interp onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(i-1) ) @@ -451,7 +451,7 @@ void plCullNode::IBreakPoly(const plCullPoly& poly, const hsTArray& de ||(outVerts.IsBitSet(outPoly.fVerts.GetCount()-1) && inVerts.IsBitSet(0)) ) { hsPoint3 interp; - hsScalar t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp); + float t = IInterpVert(poly.fVerts[poly.fVerts.GetCount()-1], poly.fVerts[0], interp); onVerts.SetBit(outPoly.fVerts.GetCount()); if( poly.fClipped.IsBitSet(poly.fVerts.GetCount()-1) ) outPoly.fClipped.SetBit(outPoly.fVerts.GetCount()); @@ -477,7 +477,7 @@ void plCullNode::ITakeHalfPoly(const plCullPoly& srcPoly, if( onVerts.IsBitSet(vtxIdx[i]) && onVerts.IsBitSet(vtxIdx[last]) && onVerts.IsBitSet(vtxIdx[next]) ) { #if 0 // FISH - hsScalar dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]])); + float dot = hsVector3(&srcPoly.fVerts[vtxIdx[last]], &srcPoly.fVerts[vtxIdx[i]]).InnerProduct(hsVector3(&srcPoly.fVerts[vtxIdx[next]], &srcPoly.fVerts[vtxIdx[i]])); if( dot <= 0 ) #endif // FISH continue; @@ -512,7 +512,7 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const { - static hsTArray depths; + static hsTArray depths; depths.SetCount(poly.fVerts.GetCount()); static hsBitVector onVerts; @@ -597,12 +597,12 @@ plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly, return kSplit; } -hsScalar plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const +float plCullNode::IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const { hsVector3 oneToOh; oneToOh.Set(&p0, &p1); - hsScalar t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh); + float t = -(fNorm.InnerProduct(p1) + fDist) / fNorm.InnerProduct(oneToOh); if( t >= 1.f ) { out = p0; @@ -658,8 +658,8 @@ void plCullTree::AddPoly(const plCullPoly& poly) hsVector3 cenToEye(&fViewPos, &poly.fCenter); hsFastMath::NormalizeAppr(cenToEye); - hsScalar camDist = cenToEye.InnerProduct(poly.fNorm); - plConst(hsScalar) kTol(0.1f); + float camDist = cenToEye.InnerProduct(poly.fNorm); + plConst(float) kTol(0.1f); hsBool backFace = camDist < -kTol; if( !backFace && (camDist < kTol) ) return; @@ -768,7 +768,7 @@ int16_t plCullTree::IMakePolyNode(const plCullPoly& poly, int i0, int i1) const a.Set(&poly.fVerts[i0], &fViewPos); b.Set(&poly.fVerts[i1], &fViewPos); hsVector3 n = a % b; - hsScalar d = -n.InnerProduct(fViewPos); + float d = -n.InnerProduct(fViewPos); IDEBUG_NORMALIZE(n, d); @@ -1000,7 +1000,7 @@ void plCullTree::InitFrustum(const hsMatrix44& world2NDC) plCullNode* node; hsVector3 norm; - hsScalar dist; + float dist; int i; for( i = 0; i < 2; i++ ) @@ -1080,7 +1080,7 @@ hsBool plCullTree::BoundsVisible(const hsBounds3Ext& bnd) const return plCullNode::kCulled != IGetRoot()->ITestBoundsRecur(bnd); } -hsBool plCullTree::SphereVisible(const hsPoint3& center, hsScalar rad) const +hsBool plCullTree::SphereVisible(const hsPoint3& center, float rad) const { return plCullNode::kCulled != IGetRoot()->ITestSphereRecur(center, rad); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h index 0d6dc3ba..ad3fc42b 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h @@ -71,7 +71,7 @@ protected: mutable hsTArray fVisNorms; mutable hsTArray fVisColors; mutable hsTArray fVisTris; - mutable hsScalar fVisYon; + mutable float fVisYon; mutable hsTArray fScratchPolys; mutable hsLargeArray fScratchClear; @@ -125,10 +125,10 @@ public: virtual void Harvest(const plSpaceTree* space, hsTArray& outList) const; virtual hsBool BoundsVisible(const hsBounds3Ext& bnd) const; - virtual hsBool SphereVisible(const hsPoint3& center, hsScalar rad) const; + virtual hsBool SphereVisible(const hsPoint3& center, float rad) const; // Visualization stuff. Only to be called by the pipeline (or some other vis manager). - void SetVisualizationYon(hsScalar y) const { fVisYon = y; } + void SetVisualizationYon(float y) const { fVisYon = y; } void BeginCapturePolys() const { fCapturePolys = true; } void EndCapturePolys() const { fCapturePolys = false; } hsTArray& GetCaptureVerts() const { return fVisVerts; } @@ -150,7 +150,7 @@ enum plCullStatus }; protected: hsVector3 fNorm; - hsScalar fDist; + float fDist; hsBool fIsFace; @@ -172,7 +172,7 @@ protected: // Bounds only version plCullNode::plCullStatus ITestBoundsRecur(const hsBounds3Ext& bnd) const; - plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, hsScalar rad) const; + plCullNode::plCullStatus ITestSphereRecur(const hsPoint3& center, float rad) const; // Using the nodes plCullNode::plCullStatus ITestNode(const plSpaceTree* space, int16_t who, hsLargeArray& clear, hsLargeArray& split, hsLargeArray& culled) const; @@ -180,14 +180,14 @@ protected: void IHarvest(const plSpaceTree* space, hsTArray& outList) const; // Constructing the tree - hsScalar IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const; + float IInterpVert(const hsPoint3& p0, const hsPoint3& p1, hsPoint3& out) const; plCullNode::plCullStatus ISplitPoly(const plCullPoly& poly, plCullPoly*& innerPoly, plCullPoly*& outerPoly) const; void IMarkClipped(const plCullPoly& poly, const hsBitVector& onVerts) const; void ITakeHalfPoly(const plCullPoly& scrPoly, const hsTArray& vtxIdx, const hsBitVector& onVerts, plCullPoly& outPoly) const; - void IBreakPoly(const plCullPoly& poly, const hsTArray& depths, + void IBreakPoly(const plCullPoly& poly, const hsTArray& depths, hsBitVector& inVerts, hsBitVector& outVerts, hsBitVector& onVerts, @@ -203,16 +203,16 @@ protected: friend class plCullTree; public: - void Init(const plCullTree* t, const hsVector3& n, hsScalar d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); } + void Init(const plCullTree* t, const hsVector3& n, float d) { fIsFace = false; fTree = t; fInnerChild = fOuterChild = -1; SetPlane(n, d); } void Init(const plCullTree* t, const plCullPoly& poly) { Init(t, poly.fNorm, poly.fDist); } - void SetPlane(const hsVector3& n, hsScalar d) { fNorm = n; fDist = d; } + void SetPlane(const hsVector3& n, float d) { fNorm = n; fDist = d; } const hsVector3& GetNormal() const { return fNorm; } - const hsScalar GetDist() const { return fDist; } + const float GetDist() const { return fDist; } plCullStatus TestBounds(const hsBounds3Ext& bnd) const; - plCullStatus TestSphere(const hsPoint3& center, hsScalar rad) const; + plCullStatus TestSphere(const hsPoint3& center, float rad) const; }; inline plCullNode* plCullNode::IGetNode(int16_t i) const diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp index d4ed6122..d6487206 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDTProgressMgr.cpp @@ -198,7 +198,7 @@ void plDTProgressMgr::IDrawTheStupidThing( plPipeline *p, plOperationProgress uint16_t rightX = drawX + drawWidth; if (prog->GetProgress() <= prog->GetMax()) - drawWidth = (uint16_t)( (hsScalar)width * prog->GetProgress() / prog->GetMax() ); + drawWidth = (uint16_t)( (float)width * prog->GetProgress() / prog->GetMax() ); rightX = drawX + drawWidth; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp index c771cb29..289b2623 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp @@ -303,7 +303,7 @@ void plDXLightRef::UpdateD3DInfo( IDirect3DDevice9 *dev, plDXLightSettings *s fD3DInfo.Falloff = spotOwner->GetFalloff(); fD3DInfo.Theta = spotOwner->GetSpotInner() * 2; -// fD3DInfo.Phi = spotOwner->GetProjection() ? hsScalarPI : spotOwner->GetSpotOuter() * 2; +// fD3DInfo.Phi = spotOwner->GetProjection() ? M_PI : spotOwner->GetSpotOuter() * 2; // D3D doesn't seem to like a Phi of PI, even though that's supposed to be the // largest legal value. Symptom is an erratic, intermitant, unpredictable failure // of the light to light, with bizarreness like lighting one object but not the object diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h index 4e7d143b..2300646d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXLightRef.h @@ -70,7 +70,7 @@ class plDXLightRef : public plDXDeviceRef D3DLIGHT9 fD3DInfo; uint32_t fD3DIndex; - hsScalar fScale; + float fScale; plDXLightSettings *fParentSettings; IDirect3DDevice9 *fD3DDevice; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index 4e5fc830..de7e6941 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -260,7 +260,7 @@ static const enum _D3DTRANSFORMSTATETYPE sTextureStages[ 8 ] = static const float kPerspLayerScale = 0.00001f; static const float kPerspLayerScaleW = 0.001f; static const float kPerspLayerTrans = 0.00002f; -static const hsScalar kAvTexPoolShrinkThresh = 30.f; // seconds +static const float kAvTexPoolShrinkThresh = 30.f; // seconds // This caps the number of D3D lights we use. We'll use up to the max allowed // or this number, whichever is smaller. (This is to prevent us going haywire @@ -1255,12 +1255,12 @@ void plDXPipeline::IRestrictCaps( const hsG3DDeviceRecord& devRec ) //// Get/SetZBiasScale //////////////////////////////////////////////////////// // If the board really doesn't support Z-biasing, we adjust the perspective matrix in IGetCameraToNDC // The layer scale and translation are tailored to the current hardware. -hsScalar plDXPipeline::GetZBiasScale() const +float plDXPipeline::GetZBiasScale() const { return ( fTweaks.fPerspLayerScale / fTweaks.fDefaultPerspLayerScale ) - 1.0f; } -void plDXPipeline::SetZBiasScale( hsScalar scale ) +void plDXPipeline::SetZBiasScale( float scale ) { scale += 1.0f; fTweaks.fPerspLayerScale = fTweaks.fDefaultPerspLayerScale * scale; @@ -2655,7 +2655,7 @@ hsBool plDXPipeline::PreRender( plDrawable* drawable, hsTArray& visLis struct plSortFace { uint16_t fIdx[3]; - hsScalar fDist; + float fDist; }; struct plCompSortFace : public std::binary_function @@ -2743,8 +2743,8 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& vi uint16_t idx = *indices++; sortScratch[j].fIdx[0] = idx; hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride); - hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); - hsScalar minDist = dist; + float dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); + float minDist = dist; idx = *indices++; sortScratch[j].fIdx[1] = idx; @@ -2765,8 +2765,8 @@ hsBool plDXPipeline::IAvatarSort(plDrawableSpans* d, const hsTArray& vi uint16_t idx = *indices++; sortScratch[j].fIdx[0] = idx; hsPoint3 pos = *(hsPoint3*)(vdata + idx * stride); - hsScalar dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); - hsScalar maxDist = dist; + float dist = hsVector3(&pos, &viewPos).MagnitudeSquared(); + float maxDist = dist; idx = *indices++; sortScratch[j].fIdx[1] = idx; @@ -3178,7 +3178,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3226,7 +3226,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3273,7 +3273,7 @@ void plDXPipeline::ICheckLighting(plDrawableSpans* drawable, hsTArray& if( !(currProj && (span->fProps & plSpan::kPropSkipProjection)) ) { plDXLightRef *ref = (plDXLightRef *)light->GetDeviceRef(); - hsScalar strength, scale; + float strength, scale; light->GetStrengthAndScale(span->fWorldBounds, strength, scale); @@ -3343,7 +3343,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArray &spans = drawable->GetSpanArray(); @@ -3389,7 +3389,7 @@ void plDXPipeline::IGetVisibleSpans( plDrawableSpans* drawable, hsTArrayGetSubVisDists(tmpVis[i], minDist, maxDist) ) { const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(tmpVis[i]).fWorldBounds; @@ -4066,7 +4066,7 @@ hsBool plDXPipeline::EndRender() // SetGamma //////////////////////////////////////////////////////////// // Create and set a gamma table based on the input exponent values for // R, G, and B. Can also set explicit table using the other SetGamma(). -hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) +hsBool plDXPipeline::SetGamma(float eR, float eG, float eB) { if( fSettings.fNoGammaCorrect ) return false; @@ -4075,7 +4075,7 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) ramp.red[0] = ramp.green[0] = ramp.blue[0] = 0L; - plConst(hsScalar) kMinE(0.1f); + plConst(float) kMinE(0.1f); if( eR > kMinE ) eR = 1.f / eR; else @@ -4092,19 +4092,19 @@ hsBool plDXPipeline::SetGamma(hsScalar eR, hsScalar eG, hsScalar eB) int i; for( i = 1; i < 256; i++ ) { - hsScalar orig = hsScalar(i) / 255.f; + float orig = float(i) / 255.f; - hsScalar gamm; + float gamm; gamm = pow(orig, eR); - gamm *= hsScalar(uint16_t(-1)); + gamm *= float(uint16_t(-1)); ramp.red[i] = uint16_t(gamm); gamm = pow(orig, eG); - gamm *= hsScalar(uint16_t(-1)); + gamm *= float(uint16_t(-1)); ramp.green[i] = uint16_t(gamm); gamm = pow(orig, eB); - gamm *= hsScalar(uint16_t(-1)); + gamm *= float(uint16_t(-1)); ramp.blue[i] = uint16_t(gamm); } @@ -5166,7 +5166,7 @@ void plDXPipeline::ISetRenderTarget( plRenderTarget *target ) // SetClear ///////////////////////////////////////////////////////////////////// // Set the color and depth clear values. -void plDXPipeline::SetClear(const hsColorRGBA* col, const hsScalar* depth) +void plDXPipeline::SetClear(const hsColorRGBA* col, const float* depth) { if( col ) fView.fClearColor = inlGetD3DColor(*col); @@ -5183,7 +5183,7 @@ hsColorRGBA plDXPipeline::GetClearColor() const // GetClearDepth //////////////////////////////////////////////////////////////// // Return the current clear depth. -hsScalar plDXPipeline::GetClearDepth() const +float plDXPipeline::GetClearDepth() const { return fView.fClearDepth; } @@ -5263,12 +5263,12 @@ hsBool plDXPipeline::IGetClearViewPort(D3DRECT& r) // ClearRenderTarget ////////////////////////////////////////////////////////////////////////////// // Flat fill the current render target with the specified color and depth values. -void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const hsScalar* depth ) +void plDXPipeline::ClearRenderTarget( const hsColorRGBA *col, const float* depth ) { if( fView.fRenderState & (kRenderClearColor | kRenderClearDepth) ) { DWORD clearColor = inlGetD3DColor(col ? *col : GetClearColor()); - hsScalar clearDepth = depth ? *depth : fView.fClearDepth; + float clearDepth = depth ? *depth : fView.fClearDepth; DWORD dwFlags = 0;//fStencil.fDepth > 0 ? D3DCLEAR_STENCIL : 0; if( fView.fRenderState & kRenderClearColor ) @@ -5309,8 +5309,8 @@ void plDXPipeline::IGetVSFogSet(float* const set) const if( fCurrFog.fEnvPtr ) { hsColorRGBA colorTrash; - hsScalar start; - hsScalar end; + float start; + float end; fCurrFog.fEnvPtr->GetPipelineParams(&start, &end, &colorTrash); if( end > start ) { @@ -5405,7 +5405,7 @@ void plDXPipeline::ISetFogParameters(const plSpan* span, const plLayerInterface* fCurrFog.fIsShader = isShader; fCurrFog.fIsVertex = isVertex; - hsScalar startOrDensity, end; + float startOrDensity, end; hsColorRGBA color; /// Get params @@ -5922,7 +5922,7 @@ void plDXPipeline::IRestoreSpanLights() //// IScaleD3DLight /////////////////////////////////////////////////////////// // Scale the D3D light by the given scale factor, used for fading lights // in and out by importance. -void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, hsScalar scale ) +void plDXPipeline::IScaleD3DLight( plDXLightRef *ref, float scale ) { scale = int(scale * 1.e1f) * 1.e-1f; if( ref->fScale != scale ) @@ -6011,8 +6011,8 @@ static inline D3DCOLORVALUE ColorMul(const D3DCOLORVALUE& c0, const hsColorRGBA& void plDXPipeline::ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan ) { D3DMATERIAL9 mat; - static hsScalar diffScale = 1.f; - static hsScalar ambScale = 1.f; + static float diffScale = 1.f; + static float ambScale = 1.f; uint32_t props; @@ -7630,15 +7630,15 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* hsVector3 liDir(0,0,0); int i; const hsTArray& spanLights = span->GetLightList(false); - hsScalar maxStrength = 0; + float maxStrength = 0; for( i = 0; i < spanLights.GetCount(); i++ ) { - hsScalar liWgt = span->GetLightStrength(i, false); + float liWgt = span->GetLightStrength(i, false); // A light strength of 2.f means it's from a light group, and we haven't actually calculated // the strength. So calculate it now. if( liWgt == 2.f ) { - hsScalar scale; + float scale; spanLights[i]->GetStrengthAndScale(span->fWorldBounds, liWgt, scale); } if( liWgt > maxStrength ) @@ -7647,16 +7647,16 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* } hsFastMath::NormalizeAppr(liDir); - static hsScalar kUVWScale = 1.f; - hsScalar uvwScale = kUVWScale; + static float kUVWScale = 1.f; + float uvwScale = kUVWScale; if( fLayerState[0].fBlendFlags & hsGMatState::kBlendAdd ) { hsVector3 cam2span(&GetViewPositionWorld(), &spanPos); hsFastMath::NormalizeAppr(cam2span); liDir += cam2span; hsFastMath::NormalizeAppr(liDir); - static hsScalar kSpecularMax = 0.1f; - static hsScalar kSpecularMaxUV = 0.5f; + static float kSpecularMax = 0.1f; + static float kSpecularMaxUV = 0.5f; if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV)) uvwScale *= kSpecularMaxUV; else @@ -7680,11 +7680,11 @@ void plDXPipeline::ISetBumpMatrices(const plLayerInterface* layer, const plSpan* maxStrength = 1.f; liDir *= uvwScale * maxStrength; - const hsScalar kUVWOffset = 0.5f; + const float kUVWOffset = 0.5f; - hsScalar kOffsetToRed; - hsScalar kOffsetToGreen; - hsScalar kOffsetToBlue; + float kOffsetToRed; + float kOffsetToGreen; + float kOffsetToBlue; if (IsDebugFlagSet(plPipeDbg::kFlagBumpUV) || IsDebugFlagSet(plPipeDbg::kFlagBumpW)) { @@ -7807,7 +7807,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // This is just a rotation about X of Pi/2 (y = z, z = -y), // followed by flipping Z to reflect back towards us (z = -z). - hsScalar t = c2env.fMap[1][0]; + float t = c2env.fMap[1][0]; c2env.fMap[1][0] = c2env.fMap[2][0]; c2env.fMap[2][0] = t; @@ -7831,7 +7831,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // This is just a rotation about X of Pi/2 (y = z, z = -y), // followed by NOT flipping Z to reflect back towards us (z = -z). // In other words, same as reflection, but then c2env = c2env * scaleMatNegateZ. - hsScalar t = c2env.fMap[1][0]; + float t = c2env.fMap[1][0]; c2env.fMap[1][0] = c2env.fMap[2][0]; c2env.fMap[2][0] = t; @@ -7848,7 +7848,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer c2env.fMap[2][2] = -c2env.fMap[2][2]; #if 0 - const hsScalar kFishEyeScale = 0.5f; + const float kFishEyeScale = 0.5f; // You can adjust the fish-eye-ness of this by scaling // X and Y as well. Eventually, you wind up with the same // as c2env * scaleMatXYAndNegateZ, but this is shorter. @@ -7883,7 +7883,7 @@ void plDXPipeline::IHandleStageTransform( int stage, plLayerInterface *layer // The scale and trans move us from NDC to Screen space. We need to swap // the Z and W coordinates so that the texture projection will divide by W // and give us projected 2D coordinates. - hsScalar temp = p2s.fMap[2][2]; + float temp = p2s.fMap[2][2]; p2s.fMap[2][2] = p2s.fMap[3][2]; p2s.fMap[3][2] = temp; @@ -8251,7 +8251,7 @@ hsBool plDXPipeline::ICanEatLayer( plLayerInterface* lay ) return false; if( (lay->GetBlendFlags() & hsGMatState::kBlendAlpha ) - &&(lay->GetAmbientColor().a < hsScalar1) ) + &&(lay->GetAmbientColor().a < 1.f) ) return false; if( !(lay->GetZFlags() & hsGMatState::kZNoZWrite) ) @@ -9091,7 +9091,7 @@ void plDXPipeline::GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const //// GetFOV /////////////////////////////////////////////////////////////////// // Get the current FOV in degrees. -void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const +void plDXPipeline::GetFOV(float& fovX, float& fovY) const { fovX = GetViewTransform().GetFovXDeg(); fovY = GetViewTransform().GetFovYDeg(); @@ -9099,14 +9099,14 @@ void plDXPipeline::GetFOV(hsScalar& fovX, hsScalar& fovY) const //// SetFOV /////////////////////////////////////////////////////////////////// // Set the current FOV in degrees. Forces perspective rendering to be true. -void plDXPipeline::SetFOV( hsScalar fovX, hsScalar fovY ) +void plDXPipeline::SetFOV( float fovX, float fovY ) { IGetViewTransform().SetFovDeg(fovX, fovY); IGetViewTransform().SetPerspective(true); } // Get the orthogonal projection view size in world units (e.g. feet). -void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const +void plDXPipeline::GetSize( float& width, float& height ) const { width = GetViewTransform().GetScreenWidth(); height = GetViewTransform().GetScreenHeight(); @@ -9114,7 +9114,7 @@ void plDXPipeline::GetSize( hsScalar& width, hsScalar& height ) const // Set the orthogonal projection view size in world units (e.g. feet). // Forces projection to orthogonal if it wasn't. -void plDXPipeline::SetSize( hsScalar width, hsScalar height ) +void plDXPipeline::SetSize( float width, float height ) { IGetViewTransform().SetWidth(width); IGetViewTransform().SetHeight(height); @@ -9123,14 +9123,14 @@ void plDXPipeline::SetSize( hsScalar width, hsScalar height ) //// GetDepth ///////////////////////////////////////////////////////////////// // Get the current hither and yon. -void plDXPipeline::GetDepth(hsScalar& hither, hsScalar& yon) const +void plDXPipeline::GetDepth(float& hither, float& yon) const { GetViewTransform().GetDepth(hither, yon); } //// SetDepth ///////////////////////////////////////////////////////////////// // Set the current hither and yon. -void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon) +void plDXPipeline::SetDepth(float hither, float yon) { IGetViewTransform().SetDepth(hither, yon); } @@ -9141,7 +9141,7 @@ void plDXPipeline::SetDepth(hsScalar hither, hsScalar yon) // Obsolete since we don't support the Savage4 chipset any more. void plDXPipeline::ISavageYonHack() { - hsScalar yon = GetViewTransform().GetYon(); + float yon = GetViewTransform().GetYon(); if( ( yon > 128.f - 5.0f ) && ( yon < 128.f + 1.01f ) ) @@ -9284,7 +9284,7 @@ hsBool plDXPipeline::IIsViewLeftHanded() // Given a screen space pixel position, and a world space distance from the camera, return a // full world space position. I.e. cast a ray through a screen pixel dist feet, and where // is it. -void plDXPipeline::ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut ) +void plDXPipeline::ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, float dist, uint32_t strideOut, hsPoint3 *worldOut ) { while( n-- ) { @@ -9978,7 +9978,7 @@ hsBool plDXPipeline::OpenAccess(plAccessSpan& dst, plDrawableSpans* drawable, co { acc.SetNumWeights(numWgts); acc.WeightStream(ptr, (uint16_t)stride, offset); - ptr += numWgts * sizeof(hsScalar); + ptr += numWgts * sizeof(float); if( grp->GetVertexFormat() & plGBufferGroup::kSkinIndices ) { acc.WgtIndexStream(ptr, (uint16_t)stride, offset); @@ -10556,8 +10556,8 @@ void plDXPipeline::LoadResources() // inlTESTPOINT ///////////////////////////////////////// // Update mins and maxs if destP is outside. inline void inlTESTPOINT(const hsPoint3& destP, - hsScalar& minX, hsScalar& minY, hsScalar& minZ, - hsScalar& maxX, hsScalar& maxY, hsScalar& maxZ) + float& minX, float& minY, float& minZ, + float& maxX, float& maxY, float& maxZ) { if( destP.fX < minX ) minX = destP.fX; @@ -10607,13 +10607,13 @@ void plDXPipeline::IBlendVertsIntoBuffer( plSpan* span, //#define MF_RECALC_BOUNDS #ifdef MF_RECALC_BOUNDS - hsScalar minX = 1.e33f; - hsScalar minY = 1.e33f; - hsScalar minZ = 1.e33f; + float minX = 1.e33f; + float minY = 1.e33f; + float minZ = 1.e33f; - hsScalar maxX = -1.e33f; - hsScalar maxY = -1.e33f; - hsScalar maxZ = -1.e33f; + float maxX = -1.e33f; + float maxY = -1.e33f; + float maxZ = -1.e33f; #endif // MF_RECALC_BOUNDS // localUVWChans is bump mapping tangent space vectors, which need to @@ -12240,7 +12240,7 @@ void plDXPipeline::SubmitShadowSlave(plShadowSlave* slave) fShadows.Insert(i, slave); } -hsScalar blurScale = -1.f; +float blurScale = -1.f; static const int kL2NumSamples = 3; // Log2(4) // IBlurShadowMap ////////////////////////////////////////////////////////////////// @@ -12275,7 +12275,7 @@ static const int kL2NumSamples = 3; // Log2(4) void plDXPipeline::IBlurShadowMap(plShadowSlave* slave) { plRenderTarget* smap = (plRenderTarget*)slave->fPipeData; - hsScalar scale = slave->fBlurScale; + float scale = slave->fBlurScale; // Find a scratch rendertarget which matches the input. int which = IGetScratchRenderTarget(smap); @@ -12406,7 +12406,7 @@ void plDXPipeline::IBlurSetRenderTarget(plRenderTarget* rt) // Render a shadow map into a scratch render target multiple times offset slightly to create a blur // in the color, preserving alpha exactly. It's just rendering a single quad with slight offsets // in the UVW transform. -void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale) +void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale) { // Quad is set up in camera space. fD3DDevice->SetTransform(D3DTS_VIEW, &d3dIdentityMatrix); @@ -12416,7 +12416,7 @@ void plDXPipeline::IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderT // Figure out how many passes we'll need. // const int kNumSamples = 1 << kL2NumSamples; // HACKSAMPLE const int kNumSamples = mfCurrentTest > 101 ? 8 : 4; - int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); + int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); int nSamplesPerPass = kNumSamples / nPasses; // Attenuate by number of passes, to average as we sum. @@ -13121,7 +13121,7 @@ hsBool plDXPipeline::IPushShadowCastState(plShadowSlave* slave) if( slave->fBlurScale > 0 ) { const int kNumSamples = mfCurrentTest > 101 ? 8 : 4; - int nPasses = (int)hsCeil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); + int nPasses = (int)ceil(float(kNumSamples) / fSettings.fMaxLayersAtOnce); int nSamplesPerPass = kNumSamples / nPasses; DWORD k = int(128.f / float(nSamplesPerPass)); intens = (0xff << 24) @@ -13324,7 +13324,7 @@ void plDXPipeline::IMakeRenderTargetPools() // These numbers were set with multi-player in mind, so should be reconsidered. // But do keep in mind that there are many things in production assets that cast // shadows besides the avatar. - plConst(hsScalar) kCount[kMaxRenderTargetNext] = { + plConst(float) kCount[kMaxRenderTargetNext] = { 0, // 1x1 0, // 2x2 0, // 4x4 @@ -13645,8 +13645,8 @@ void plDXPipeline::IRenderShadowsOntoSpan(const plRenderPrimFunc& render, const // the surface casting the shadow (because they are the same object). if( selfShadowNow ) { - plConst(hsScalar) kMaxSelfPower = 0.3f; - hsScalar power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower; + plConst(float) kMaxSelfPower = 0.3f; + float power = fShadows[i]->fPower > kMaxSelfPower ? kMaxSelfPower : fShadows[i]->fPower; lRef->fD3DInfo.Diffuse.r = lRef->fD3DInfo.Diffuse.g = lRef->fD3DInfo.Diffuse.b @@ -14278,8 +14278,8 @@ void plDXPipeline::IPreprocessAvatarTextures() D3DVIEWPORT9 vp = {0, 0, rt->GetWidth(), rt->GetHeight(), 0.f, 1.f}; WEAK_ERROR_CHECK(fD3DDevice->SetViewport(&vp)); - hsScalar uOff = 0.5f / rt->GetWidth(); - hsScalar vOff = 0.5f / rt->GetHeight(); + float uOff = 0.5f / rt->GetWidth(); + float vOff = 0.5f / rt->GetHeight(); // Copy over the base fD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); @@ -14322,10 +14322,10 @@ void plDXPipeline::IPreprocessAvatarTextures() } fD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR, tint.ToARGB32()); fLayerState[0].fBlendFlags = uint32_t(-1); - hsScalar screenW = (hsScalar)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f; - hsScalar screenH = (hsScalar)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f; - hsScalar screenX = (hsScalar)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f; - hsScalar screenY = (1.f - (hsScalar)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH; + float screenW = (float)item->fElements[j]->fWidth / layout->fOrigWidth * 2.f; + float screenH = (float)item->fElements[j]->fHeight / layout->fOrigWidth * 2.f; + float screenX = (float)item->fElements[j]->fXPos / layout->fOrigWidth * 2.f - 1.f; + float screenY = (1.f - (float)item->fElements[j]->fYPos / layout->fOrigWidth) * 2.f - 1.f - screenH; IDrawClothingQuad(screenX, screenY, screenW, screenH, uOff, vOff, itemBufferTex); } } @@ -14340,8 +14340,8 @@ void plDXPipeline::IPreprocessAvatarTextures() fClothingOutfits.Swap(fPrevClothingOutfits); } -void plDXPipeline::IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, - hsScalar uOff, hsScalar vOff, plMipmap *tex) +void plDXPipeline::IDrawClothingQuad(float x, float y, float w, float h, + float uOff, float vOff, plMipmap *tex) { const uint32_t kVSize = sizeof(plAVTexVert); plDXTextureRef* ref = (plDXTextureRef*)tex->GetDeviceRef(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h index b9d9af1a..cdc4e2e4 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.h @@ -382,7 +382,7 @@ protected: // Lighting hsGDeviceRef *IMakeLightRef( plLightInfo *owner ); - void IScaleD3DLight( plDXLightRef *ref, hsScalar scale); + void IScaleD3DLight( plDXLightRef *ref, float scale); void ICalcLighting( const plLayerInterface *currLayer, const plSpan *currSpan ); void IDisableSpanLights(); void IRestoreSpanLights(); @@ -593,7 +593,7 @@ protected: // Postprocess (blurring) hsBool ISetBlurQuadToRender(plRenderTarget* smap); void IRenderBlurBackToShadowMap(plRenderTarget* smap, plRenderTarget* scratch, plRenderTarget* dst); - void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, hsScalar scale); + void IRenderBlurFromShadowMap(plRenderTarget* scratchRT, plRenderTarget* smap, float scale); void IBlurSetRenderTarget(plRenderTarget* rt); int IGetScratchRenderTarget(plRenderTarget* smap); void IBlurShadowMap(plShadowSlave* slave); @@ -609,7 +609,7 @@ protected: plRenderTarget* IGetNextAvRT(); void IFreeAvRT(plRenderTarget* tex); void IPreprocessAvatarTextures(); - void IDrawClothingQuad(hsScalar x, hsScalar y, hsScalar w, hsScalar h, hsScalar uOff, hsScalar vOff, plMipmap *tex); + void IDrawClothingQuad(float x, float y, float w, float h, float uOff, float vOff, plMipmap *tex); void IClearClothingOutfits(hsTArray* outfits); void IPrintDeviceInitError(); @@ -637,10 +637,10 @@ public: void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false ); virtual void ClearRenderTarget( plDrawable* d ); - virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const hsScalar* depth = nil ); - virtual void SetClear(const hsColorRGBA* col=nil, const hsScalar* depth=nil); + virtual void ClearRenderTarget( const hsColorRGBA* col = nil, const float* depth = nil ); + virtual void SetClear(const hsColorRGBA* col=nil, const float* depth=nil); virtual hsColorRGBA GetClearColor() const; - virtual hsScalar GetClearDepth() const; + virtual float GetClearDepth() const; virtual hsGDeviceRef* MakeRenderTargetRef( plRenderTarget *owner ); virtual hsGDeviceRef* SharedRenderTargetRef(plRenderTarget* sharer, plRenderTarget *owner); virtual void PushRenderTarget( plRenderTarget *target ); @@ -725,17 +725,17 @@ public: virtual hsVector3 GetViewDirWorld() const { return GetViewTransform().GetDirection(); } virtual void GetViewAxesWorld(hsVector3 axes[3] /* ac,up,at */ ) const; - virtual void GetFOV(hsScalar& fovX, hsScalar& fovY) const; - virtual void SetFOV(hsScalar fovX, hsScalar fovY); + virtual void GetFOV(float& fovX, float& fovY) const; + virtual void SetFOV(float fovX, float fovY); - virtual void GetSize(hsScalar& width, hsScalar& height) const; - virtual void SetSize(hsScalar width, hsScalar height); + virtual void GetSize(float& width, float& height) const; + virtual void SetSize(float width, float height); - virtual void GetDepth(hsScalar& hither, hsScalar& yon) const; - virtual void SetDepth(hsScalar hither, hsScalar yon); + virtual void GetDepth(float& hither, float& yon) const; + virtual void SetDepth(float hither, float yon); - virtual hsScalar GetZBiasScale() const; - virtual void SetZBiasScale(hsScalar scale); + virtual float GetZBiasScale() const; + virtual void SetZBiasScale(float scale); virtual const hsMatrix44& GetWorldToCamera() const; virtual const hsMatrix44& GetCameraToWorld() const; @@ -748,7 +748,7 @@ public: virtual const hsMatrix44& GetLocalToWorld() const; virtual void ScreenToWorldPoint( int n, uint32_t stride, int32_t *scrX, int32_t *scrY, - hsScalar dist, uint32_t strideOut, hsPoint3 *worldOut ); + float dist, uint32_t strideOut, hsPoint3 *worldOut ); virtual void RefreshMatrices(); virtual void RefreshScreenMatrices(); @@ -782,7 +782,7 @@ public: virtual void SubmitShadowSlave(plShadowSlave* slave); virtual void SubmitClothingOutfit(plClothingOutfit* co); - virtual hsBool SetGamma(hsScalar eR, hsScalar eG, hsScalar eB); + virtual hsBool SetGamma(float eR, float eG, float eB); virtual hsBool SetGamma(const uint16_t* const tabR, const uint16_t* const tabG, const uint16_t* const tabB); virtual hsBool CaptureScreen( plMipmap *dest, bool flipVertical = false, uint16_t desiredWidth = 0, uint16_t desiredHeight = 0 ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp index 15e8d89d..a8e0f562 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp @@ -155,17 +155,17 @@ void plDynamicEnvMap::IUpdatePosition() SetCameraMatrix(fPos); } -void plDynamicEnvMap::SetHither(hsScalar f) +void plDynamicEnvMap::SetHither(float f) { fHither = f; } -void plDynamicEnvMap::SetYon(hsScalar f) +void plDynamicEnvMap::SetYon(float f) { fYon = f; } -void plDynamicEnvMap::SetFogStart(hsScalar f) +void plDynamicEnvMap::SetFogStart(float f) { fFogStart = f; } @@ -175,7 +175,7 @@ void plDynamicEnvMap::SetColor(const hsColorRGBA& col) fColor = col; } -void plDynamicEnvMap::SetRefreshRate(hsScalar secs) +void plDynamicEnvMap::SetRefreshRate(float secs) { fRefreshRate = secs / 6.f; plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); @@ -539,7 +539,7 @@ void plDynamicCamMap::Init() plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); } -void plDynamicCamMap::SetRefreshRate(hsScalar secs) +void plDynamicCamMap::SetRefreshRate(float secs) { fRefreshRate = secs; plgDispatch::Dispatch()->RegisterForExactType(plRenderMsg::Index(), GetKey()); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h index 750a295b..63926d48 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.h @@ -72,12 +72,12 @@ protected: plSceneObject* fRootNode; hsPoint3 fPos; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; - hsScalar fRefreshRate; + float fRefreshRate; double fLastRefresh; int fLastRender; int fOutStanding; @@ -116,18 +116,18 @@ public: void Init(); void SetPosition(const hsPoint3& pos); - void SetHither(hsScalar f); - void SetYon(hsScalar f); - void SetFogStart(hsScalar f); + void SetHither(float f); + void SetYon(float f); + void SetFogStart(float f); void SetColor(const hsColorRGBA& col); - void SetRefreshRate(hsScalar secs); + void SetRefreshRate(float secs); hsPoint3 GetPosition() const; - hsScalar GetHither() const { return fHither; } - hsScalar GetYon() const { return fYon; } - hsScalar GetFogStart() const { return fFogStart; } + float GetHither() const { return fHither; } + float GetYon() const { return fYon; } + float GetFogStart() const { return fFogStart; } hsColorRGBA GetColor() const { return fColor; } - hsScalar GetRefreshRate() const { return 6.f * fRefreshRate; } + float GetRefreshRate() const { return 6.f * fRefreshRate; } void AddVisRegion(plVisRegion* reg); // Will just send a ref @@ -153,16 +153,16 @@ public: kRefMatLayer, }; - hsScalar fHither; - hsScalar fYon; - hsScalar fFogStart; + float fHither; + float fYon; + float fFogStart; hsColorRGBA fColor; protected: plRenderRequest fReq; plRenderRequestMsg* fReqMsg; - hsScalar fRefreshRate; + float fRefreshRate; double fLastRefresh; int fOutStanding; @@ -212,7 +212,7 @@ public: void Init(); void SetIncludeCharacters(hsBool b); - void SetRefreshRate(hsScalar secs); + void SetRefreshRate(float secs); void AddVisRegion(plVisRegion* reg); void SetVisRegionName(char *name){ fVisRegionNames.Push(name); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp index f074136b..381349ea 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.cpp @@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFogEnvironment.h" +#include #include "plTweak.h" //// Constructors & Destructor /////////////////////////////////////////////// @@ -56,12 +57,12 @@ plFogEnvironment::plFogEnvironment() fType = kNoFog; } -plFogEnvironment::plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color ) +plFogEnvironment::plFogEnvironment( float start, float end, float density, hsColorRGBA &color ) { Set( start, end, density, &color ); } -plFogEnvironment::plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color ) +plFogEnvironment::plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color ) { SetExp( type, end, density, &color ); } @@ -72,7 +73,7 @@ plFogEnvironment::~plFogEnvironment() //// Set ///////////////////////////////////////////////////////////////////// -void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color ) +void plFogEnvironment::Set( float start, float end, float density, const hsColorRGBA *color ) { if( density <= 0.f ) { @@ -92,7 +93,7 @@ void plFogEnvironment::Set( hsScalar start, hsScalar end, hsScalar density, c fColor = *color; } -void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color ) +void plFogEnvironment::SetExp( FogType type, float end, float density, const hsColorRGBA *color ) { hsAssert( type == kExpFog || type == kExp2Fog, "Invalid fog type passed to plFogEnvironment" ); if( density <= 0.f ) @@ -117,7 +118,7 @@ void plFogEnvironment::SetExp( FogType type, hsScalar end, hsScalar density, // Gets the parameters. Sets start to 0 if the type is not linear (can be // nil). -void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color ) +void plFogEnvironment::GetParameters( float *start, float *end, float *density, hsColorRGBA *color ) { hsAssert( fType != kLinearFog || start != nil, "Trying to get non-linear paramters on linear fog!" ); hsAssert( end != nil && density != nil && color != nil, "Bad pointer to plFogEnvironment::GetParameters()" ); @@ -138,7 +139,7 @@ void plFogEnvironment::GetParameters( hsScalar *start, hsScalar *end, hsScala // scale our end value out by the density. The whole formula is: // pipelineEnd = ( end - start ) / density + start -void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color ) +void plFogEnvironment::GetPipelineParams( float *start, float *end, hsColorRGBA *color ) { // hsAssert( fType == kLinearFog, "Getting linear pipeline params on non-linear fog!" ); @@ -173,7 +174,7 @@ void plFogEnvironment::GetPipelineParams( hsScalar *start, hsScalar *end, hsC // to modulate the density by the end value so that it actually ends at the // right spot. -void plFogEnvironment::GetPipelineParams( hsScalar *density, hsColorRGBA *color ) +void plFogEnvironment::GetPipelineParams( float *density, hsColorRGBA *color ) { const float ln256 = logf( 256.f ); const float sqrtLn256 = sqrtf( ln256 ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h index bffe474d..a0ca5dce 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plFogEnvironment.h @@ -63,8 +63,8 @@ class plFogEnvironment : public hsKeyedObject protected: uint8_t fType; - hsScalar fStart; // Used for linear fog only - hsScalar fEnd, fDensity; // Always used! + float fStart; // Used for linear fog only + float fEnd, fDensity; // Always used! hsColorRGBA fColor; public: @@ -81,15 +81,15 @@ class plFogEnvironment : public hsKeyedObject }; plFogEnvironment(); - plFogEnvironment( hsScalar start, hsScalar end, hsScalar density, hsColorRGBA &color ); - plFogEnvironment( FogType type, hsScalar end, hsScalar density, hsColorRGBA &color ); + plFogEnvironment( float start, float end, float density, hsColorRGBA &color ); + plFogEnvironment( FogType type, float end, float density, hsColorRGBA &color ); ~plFogEnvironment(); // Sets the parameters for linear fog - void Set( hsScalar start, hsScalar end, hsScalar density, const hsColorRGBA *color = nil ); + void Set( float start, float end, float density, const hsColorRGBA *color = nil ); // Sets the parameters for exp or exp^2 fog - void SetExp( FogType type, hsScalar end, hsScalar density, const hsColorRGBA *color = nil ); + void SetExp( FogType type, float end, float density, const hsColorRGBA *color = nil ); // Sets the color void SetColor( hsColorRGBA &color ) { fColor = color; } @@ -104,13 +104,13 @@ class plFogEnvironment : public hsKeyedObject hsColorRGBA &GetColor( void ) { return fColor; } // Gets the parameters. Sets start to 0 if the type is not linear (can be nil) - void GetParameters( hsScalar *start, hsScalar *end, hsScalar *density, hsColorRGBA *color ); + void GetParameters( float *start, float *end, float *density, hsColorRGBA *color ); // Gets linear pipeline (DX) specific parameters. - void GetPipelineParams( hsScalar *start, hsScalar *end, hsColorRGBA *color ); + void GetPipelineParams( float *start, float *end, hsColorRGBA *color ); // Gets exp or exp^2 pipeline (DX) specific parameters. - void GetPipelineParams( hsScalar *density, hsColorRGBA *color ); + void GetPipelineParams( float *density, hsColorRGBA *color ); virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Write(hsStream *s, hsResMgr *mgr); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp index b837b992..fbac6c24 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp @@ -107,7 +107,7 @@ plPlate::~plPlate() //// SetPosition ///////////////////////////////////////////////////////////// -void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z ) +void plPlate::SetPosition( float x, float y, float z ) { hsVector3 triple; @@ -130,14 +130,14 @@ void plPlate::SetPosition( hsScalar x, hsScalar y, hsScalar z ) //// SetSize ///////////////////////////////////////////////////////////////// -void plPlate::SetSize( hsScalar width, hsScalar height, bool adjustByAspectRation ) +void plPlate::SetSize( float width, float height, bool adjustByAspectRation ) { hsVector3 size; width *= fDepth / 1.0f; height *= fDepth / 1.0f; - size.fX = adjustByAspectRation ? (width * ((hsScalar)plPlateManager::Instance().GetPipeHeight() / (hsScalar)plPlateManager::Instance().GetPipeWidth())) : width; + size.fX = adjustByAspectRation ? (width * ((float)plPlateManager::Instance().GetPipeHeight() / (float)plPlateManager::Instance().GetPipeWidth())) : width; size.fY = height; size.fZ = 1.0f; @@ -183,7 +183,7 @@ void plPlate::SetTexture(plBitmap *texture) //// SetOpacity ////////////////////////////////////////////////////////////// -void plPlate::SetOpacity( hsScalar opacity ) +void plPlate::SetOpacity( float opacity ) { if( fMaterial != nil && fMaterial->GetLayer( 0 ) != nil ) { @@ -706,13 +706,13 @@ void plPlateManager::CreatePlate( plPlate **handle ) *handle = plate; } -void plPlateManager::CreatePlate( plPlate **handle, hsScalar width, hsScalar height ) +void plPlateManager::CreatePlate( plPlate **handle, float width, float height ) { CreatePlate( handle ); (*handle)->SetSize( width, height ); } -void plPlateManager::CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height ) +void plPlateManager::CreatePlate( plPlate **handle, float x, float y, float width, float height ) { CreatePlate( handle ); (*handle)->SetPosition( x, y ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h index 369ea361..236de871 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h @@ -77,7 +77,7 @@ class plPlate hsMatrix44 fXformMatrix; hsGMaterial *fMaterial; plMipmap *fMipmap; - hsScalar fDepth, fOpacity; + float fDepth, fOpacity; uint32_t fFlags; char fTitle[ 64 ]; @@ -131,16 +131,16 @@ class plPlate void SetVisible( hsBool vis ) { if( vis ) fFlags |= kFlagVisible; else fFlags &= ~kFlagVisible; } hsBool IsVisible( void ); - void SetOpacity( hsScalar opacity = 1.f ); + void SetOpacity( float opacity = 1.f ); plPlate *GetNext( void ) { return fNext; } /// Helper functions - void SetDepth( hsScalar depth) { fDepth = depth; } - void SetPosition( hsScalar x, hsScalar y, hsScalar z = -1.0f ); - void SetSize( hsScalar width, hsScalar height, bool adjustByAspectRatio = false ); + void SetDepth( float depth) { fDepth = depth; } + void SetPosition( float x, float y, float z = -1.0f ); + void SetSize( float width, float height, bool adjustByAspectRatio = false ); plMipmap *CreateMaterial( uint32_t width, uint32_t height, hsBool withAlpha, plMipmap* texture = NULL ); void CreateFromResource( const char *resName ); @@ -227,8 +227,8 @@ class plPlateManager static bool InstanceValid( void ) { return fInstance != nil; } void CreatePlate( plPlate **handle ); - void CreatePlate( plPlate **handle, hsScalar width, hsScalar height ); - void CreatePlate( plPlate **handle, hsScalar x, hsScalar y, hsScalar width, hsScalar height ); + void CreatePlate( plPlate **handle, float width, float height ); + void CreatePlate( plPlate **handle, float x, float y, float width, float height ); void CreateGraphPlate( plGraphPlate **handle ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp index 737259f8..211f5fdb 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.cpp @@ -116,7 +116,7 @@ uint32_t plRenderTarget::Read( hsStream *s ) fZDepth = s->ReadByte(); fStencilDepth = s->ReadByte(); - return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( uint16_t ) ) + sizeof( hsBool ); + return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool ); } uint32_t plRenderTarget::Write( hsStream *s ) @@ -145,7 +145,7 @@ uint32_t plRenderTarget::Write( hsStream *s ) s->WriteByte( fZDepth ); s->WriteByte( fStencilDepth ); - return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( hsScalar ) : sizeof( uint16_t ) ) + sizeof( hsBool ); + return total + 2 * 2 + 2 + 4 * ( fProportionalViewport ? sizeof( float ) : sizeof( uint16_t ) ) + sizeof( hsBool ); } /////////////////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h index 2006d3d9..32189a4d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plRenderTarget.h @@ -81,7 +81,7 @@ class plRenderTarget : public plBitmap } fAbsolute; struct { - hsScalar fLeft, fTop, fRight, fBottom; + float fLeft, fTop, fRight, fBottom; } fProportional; } fViewport; @@ -136,7 +136,7 @@ class plRenderTarget : public plBitmap } // Render-to-Screen constructor - plRenderTarget( uint16_t flags, hsScalar left, hsScalar top, hsScalar right, hsScalar bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff ) + plRenderTarget( uint16_t flags, float left, float top, float right, float bottom, uint8_t bitDepth, uint8_t zDepth = 0xff, uint8_t stencilDepth = 0xff ) { fWidth = 0; // Can't really set these, at least not yet fHeight = 0; @@ -166,7 +166,7 @@ class plRenderTarget : public plBitmap fViewport.fAbsolute.fBottom = bottom; } - virtual void SetViewport( hsScalar left, hsScalar top, hsScalar right, hsScalar bottom ) + virtual void SetViewport( float left, float top, float right, float bottom ) { ASSERT_PROPORTIONAL; fViewport.fProportional.fLeft = left; @@ -185,10 +185,10 @@ class plRenderTarget : public plBitmap uint16_t GetVPRight( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fRight; } uint16_t GetVPBottom( void ) { ASSERT_ABSOLUTE; return fViewport.fAbsolute.fBottom; } - hsScalar GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; } - hsScalar GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; } - hsScalar GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; } - hsScalar GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; } + float GetVPLeftProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fLeft; } + float GetVPTopProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fTop; } + float GetVPRightProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fRight; } + float GetVPBottomProp( void ) { ASSERT_PROPORTIONAL; return fViewport.fProportional.fBottom; } hsBool ViewIsProportional( void ) const { return fProportionalViewport; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp index 8e7d0dc8..ce63b564 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.cpp @@ -139,7 +139,7 @@ void plTransitionMgr::ICreatePlate( void ) //// IStartFadeOut /////////////////////////////////////////////////////////// -void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, uint8_t effect ) +void plTransitionMgr::IStartFadeOut( float lengthInSecs, uint8_t effect ) { fCurrentEffect = effect; // default - kFadeOut; fEffectLength = lengthInSecs; @@ -177,7 +177,7 @@ void plTransitionMgr::IStartFadeOut( hsScalar lengthInSecs, uint8_t effect ) //// IStartFadeIn //////////////////////////////////////////////////////////// -void plTransitionMgr::IStartFadeIn( hsScalar lengthInSecs, uint8_t effect ) +void plTransitionMgr::IStartFadeIn( float lengthInSecs, uint8_t effect ) { fCurrentEffect = effect; // default - kFadeIn; fEffectLength = lengthInSecs; @@ -265,17 +265,17 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg ) // So instead we don't start the clock until we get our first plTimeMsg. - fLastTime = (hsScalar)(time->DSeconds()); + fLastTime = (float)(time->DSeconds()); return false; } - fEffectLength -= (hsScalar)( time->DSeconds() - fLastTime );//*/time->DelSeconds(); + fEffectLength -= (float)( time->DSeconds() - fLastTime );//*/time->DelSeconds(); if( fEffectLength < 0 ) IStop(); else { // Grab the layer so we can set the opacity - fCurrOpacity += (hsScalar)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds(); + fCurrOpacity += (float)(fOpacDelta * ( time->DSeconds() - fLastTime ));//*/time->DelSeconds(); if( fEffectPlate == nil ) ICreatePlate(); @@ -290,7 +290,7 @@ hsBool plTransitionMgr::MsgReceive( plMessage* msg ) plgAudioSys::SetGlobalFadeVolume( 1.f - fCurrOpacity ); - fLastTime = (hsScalar)(time->DSeconds()); + fLastTime = (float)(time->DSeconds()); } return false; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h index 62f1c1c4..be0f1257 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTransitionMgr.h @@ -76,11 +76,11 @@ class plTransitionMgr : public hsKeyedObject uint8_t fCurrentEffect; hsBool fRegisteredForTime, fHoldAtEnd, fPlaying, fNoSoundFade; - hsScalar fEffectLength, fCurrOpacity, fOpacDelta; - hsScalar fLastTime; + float fEffectLength, fCurrOpacity, fOpacDelta; + float fLastTime; - void IStartFadeIn( hsScalar lengthInSecs, uint8_t effect = kFadeIn ); - void IStartFadeOut( hsScalar lengthInSecs, uint8_t effect = kFadeOut ); + void IStartFadeIn( float lengthInSecs, uint8_t effect = kFadeIn ); + void IStartFadeOut( float lengthInSecs, uint8_t effect = kFadeOut ); void ICreatePlate( void ); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp index 37afb775..f37e49c0 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp @@ -44,19 +44,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plVertCoder.h" #include "hsStream.h" - +#include #include "plGBufferGroup.h" -const hsScalar kPosQuantum = 1.f / hsScalar(1 << 10); -const hsScalar kWeightQuantum = 1.f / hsScalar(1 << 15); -const hsScalar kUVWQuantum = 1.f / hsScalar(1 << 16); +const float kPosQuantum = 1.f / float(1 << 10); +const float kWeightQuantum = 1.f / float(1 << 15); +const float kUVWQuantum = 1.f / float(1 << 16); uint32_t plVertCoder::fCodedVerts = 0; uint32_t plVertCoder::fCodedBytes = 0; uint32_t plVertCoder::fRawBytes = 0; uint32_t plVertCoder::fSkippedBytes = 0; -static const hsScalar kQuanta[plVertCoder::kNumFloatFields] = +static const float kQuanta[plVertCoder::kNumFloatFields] = { kPosQuantum, kWeightQuantum, @@ -73,24 +73,24 @@ static const hsScalar kQuanta[plVertCoder::kNumFloatFields] = }; -inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const hsScalar quant, const uint32_t stride, - hsScalar& lo, hsBool &allSame, uint16_t& count) +inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, + float& lo, hsBool &allSame, uint16_t& count) { - lo = *(hsScalar*)src; + lo = *(float*)src; lo = floor(lo / quant + 0.5f) * quant; allSame = false; - hsScalar hi = lo; + float hi = lo; count = 1; - const hsScalar maxRange = hsScalar(uint16_t(0xffff)) * quant; + const float maxRange = float(uint16_t(0xffff)) * quant; src += stride; maxCnt--; while( maxCnt-- ) { - hsScalar val = *(hsScalar*)src; + float val = *(float*)src; val = floor(val / quant + 0.5f) * quant; if( val < lo ) { @@ -110,12 +110,12 @@ inline void plVertCoder::ICountFloats(const uint8_t* src, uint16_t maxCnt, const allSame = (lo == hi); } -static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const hsScalar offset, const hsScalar quantum) +static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const float offset, const float quantum) { float fval = *(float*)src; fval -= offset; fval /= quantum; -// hsAssert(fval < hsScalar(uint16_t(0xffff)), "Bad offset?"); +// hsAssert(fval < float(uint16_t(0xffff)), "Bad offset?"); const uint16_t ival = uint16_t(floor(fval + 0.5f)); s->WriteLE16(ival); @@ -123,13 +123,13 @@ static inline void IWriteFloat(hsStream* s, const uint8_t*& src, const hsScalar src += 4; } -static inline void IReadFloat(hsStream* s, uint8_t*& dst, const hsScalar offset, const hsScalar quantum) +static inline void IReadFloat(hsStream* s, uint8_t*& dst, const float offset, const float quantum) { const uint16_t ival = s->ReadLE16(); float fval = float(ival) * quantum; fval += offset; - hsScalar* val = (hsScalar*)dst; + float* val = (float*)dst; *val = fval; dst += 4; @@ -167,7 +167,7 @@ inline void plVertCoder::IDecodeFloat(hsStream* s, const int field, const int ch IReadFloat(s, dst, fFloats[field][chan].fOffset, kQuanta[field]); else { - *((hsScalar*)dst) = fFloats[field][chan].fOffset; + *((float*)dst) = fFloats[field][chan].fOffset; dst += 4; } @@ -179,21 +179,21 @@ static inline int INumWeights(const uint8_t format) return (format & plGBufferGroup::kSkinWeightMask) >> 4; } -static const hsScalar kNormalScale(int16_t(0x7fff)); -static const hsScalar kInvNormalScale(1.f / kNormalScale); +static const float kNormalScale(int16_t(0x7fff)); +static const float kInvNormalScale(1.f / kNormalScale); inline void plVertCoder::IEncodeNormal(hsStream* s, const uint8_t*& src, const uint32_t stride) { - hsScalar x = *(hsScalar*)src; + float x = *(float*)src; s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; - x = *(hsScalar*)src; + x = *(float*)src; s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; - x = *(hsScalar*)src; + x = *(float*)src; s->WriteByte((uint8_t)((x / 2.f + .5f) * 255.9f)); src += 4; } @@ -202,17 +202,17 @@ inline void plVertCoder::IDecodeNormal(hsStream* s, uint8_t*& dst, const uint32_ { uint8_t ix = s->ReadByte(); - hsScalar* x = (hsScalar*)dst; + float* x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; ix = s->ReadByte(); - x = (hsScalar*)dst; + x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; ix = s->ReadByte(); - x = (hsScalar*)dst; + x = (float*)dst; *x = (ix / 255.9f - .5f) * 2.f; dst += 4; } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h index 7249e29a..b6b91d17 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h @@ -60,7 +60,7 @@ protected: class FloatCode { public: - hsScalar fOffset; + float fOffset; hsBool fAllSame; uint16_t fCount; }; @@ -82,7 +82,7 @@ protected: static uint32_t fRawBytes; static uint32_t fSkippedBytes; - inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const hsScalar quant, const uint32_t stride, hsScalar& lo, hsBool& allSame, uint16_t& count); + inline void ICountFloats(const uint8_t* src, uint16_t maxCnt, const float quant, const uint32_t stride, float& lo, hsBool& allSame, uint16_t& count); inline void IEncodeFloat(hsStream* s, const uint32_t vertsLeft, const int field, const int chan, const uint8_t*& src, const uint32_t stride); inline void IDecodeFloat(hsStream* s, const int field, const int chan, uint8_t*& dst, const uint32_t stride); diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp index cdaef91e..15df8689 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp @@ -107,17 +107,17 @@ plProgressMgr::~plProgressMgr() //// RegisterOperation /////////////////////////////////////////////////////// -plOperationProgress* plProgressMgr::RegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool alwaysDrawText) +plOperationProgress* plProgressMgr::RegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool alwaysDrawText) { return IRegisterOperation(length, title, staticTextType, isRetry, false, alwaysDrawText); } -plOperationProgress* plProgressMgr::RegisterOverallOperation(hsScalar length, const char *title, StaticText staticTextType, bool alwaysDrawText) +plOperationProgress* plProgressMgr::RegisterOverallOperation(float length, const char *title, StaticText staticTextType, bool alwaysDrawText) { return IRegisterOperation(length, title, staticTextType, false, true, alwaysDrawText); } -plOperationProgress* plProgressMgr::IRegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText) +plOperationProgress* plProgressMgr::IRegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText) { if (fOperations == nil) { @@ -259,7 +259,7 @@ const char* plProgressMgr::GetStaticTextID(StaticText staticTextType) //// plOperationProgress //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -plOperationProgress::plOperationProgress( hsScalar length ) : +plOperationProgress::plOperationProgress( float length ) : fMax(length), fValue(0), fNext(nil), @@ -292,10 +292,10 @@ void plOperationProgress::IUpdateStats() else elapsed = fStartTime - curTime; - hsScalar progress = GetProgress(); + float progress = GetProgress(); if (elapsed > 0) - fAmtPerSec = progress / hsScalar(elapsed); + fAmtPerSec = progress / float(elapsed); else fAmtPerSec = 0; fElapsedSecs = (uint32_t)elapsed; @@ -328,7 +328,7 @@ void plOperationProgress::IChildUpdateEnd(plOperationProgress* child) //// Increment /////////////////////////////////////////////////////////////// -void plOperationProgress::Increment( hsScalar byHowMuch ) +void plOperationProgress::Increment( float byHowMuch ) { fValue += byHowMuch; if( fValue > fMax ) @@ -340,7 +340,7 @@ void plOperationProgress::Increment( hsScalar byHowMuch ) //// SetHowMuch ////////////////////////////////////////////////////////////// -void plOperationProgress::SetHowMuch( hsScalar howMuch ) +void plOperationProgress::SetHowMuch( float howMuch ) { fValue = howMuch; if( fValue > fMax ) @@ -374,7 +374,7 @@ void plOperationProgress::SetTitle( const char *text ) //// SetLength /////////////////////////////////////////////////////////////// -void plOperationProgress::SetLength( hsScalar length ) +void plOperationProgress::SetLength( float length ) { fMax = length; if( fValue > fMax ) diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h index 7f24a9df..b0139148 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h @@ -73,14 +73,14 @@ class plOperationProgress protected: - hsScalar fValue, fMax; + float fValue, fMax; char fStatusText[ 256 ]; char fTitle[ 256 ]; uint32_t fContext; double fStartTime; uint32_t fElapsedSecs, fRemainingSecs; - hsScalar fAmtPerSec; + float fAmtPerSec; enum Flags { @@ -103,29 +103,29 @@ class plOperationProgress void IChildUpdateBegin(plOperationProgress* child); void IChildUpdateEnd(plOperationProgress* child); - plOperationProgress( hsScalar length ); + plOperationProgress( float length ); public: ~plOperationProgress(); - hsScalar GetMax( void ) const { return fMax; } - hsScalar GetProgress( void ) const { return fValue; } + float GetMax( void ) const { return fMax; } + float GetProgress( void ) const { return fValue; } const char * GetTitle( void ) const { return fTitle; } const char * GetStatusText( void ) const { return fStatusText; } uint32_t GetContext( void ) const { return fContext; } uint32_t GetElapsedSecs() { return fElapsedSecs; } uint32_t GetRemainingSecs() { return fRemainingSecs; } - hsScalar GetAmtPerSec() { return fAmtPerSec; } + float GetAmtPerSec() { return fAmtPerSec; } // Adds on to current value - void Increment( hsScalar byHowMuch ); + void Increment( float byHowMuch ); // Sets current value - void SetHowMuch( hsScalar byHowMuch ); + void SetHowMuch( float byHowMuch ); // Set the length - void SetLength( hsScalar length ); + void SetLength( float length ); // Sets the display text above the bar (nil for nothing) void SetStatusText( const char *text ); @@ -215,7 +215,7 @@ class plProgressMgr void IUpdateFlags(plOperationProgress* progress); - plOperationProgress* IRegisterOperation(hsScalar length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText); + plOperationProgress* IRegisterOperation(float length, const char *title, StaticText staticTextType, bool isRetry, bool isOverall, bool alwaysDrawText); // Called by the operation void IUnregisterOperation(plOperationProgress* op); @@ -234,8 +234,8 @@ class plProgressMgr virtual void Draw( plPipeline *p ) { } - plOperationProgress* RegisterOperation(hsScalar length, const char *title = nil, StaticText staticTextType = kNone, bool isRetry = false, bool alwaysDrawText = false); - plOperationProgress* RegisterOverallOperation(hsScalar length, const char *title = nil, StaticText staticTextType = kNone, bool alwaysDrawText = false); + plOperationProgress* RegisterOperation(float length, const char *title = nil, StaticText staticTextType = kNone, bool isRetry = false, bool alwaysDrawText = false); + plOperationProgress* RegisterOverallOperation(float length, const char *title = nil, StaticText staticTextType = kNone, bool alwaysDrawText = false); plProgressMgrCallbackProc SetCallbackProc( plProgressMgrCallbackProc proc ); diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 1e42b69f..9e782ca4 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -1834,9 +1834,7 @@ bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx, if (timeConvert != 0.0) { double utDouble=fT[j+i].GetSecsDouble(); - hsDoublePrecBegin utDouble += timeConvert; - hsDoublePrecEnd plUnifiedTime ut(utDouble); ut.Write(s); } @@ -1911,9 +1909,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, u fT[j+i].Read(s); if (timeConvert != 0.0) { - hsDoublePrecBegin double newUt = (fT[j+i].GetSecsDouble() + timeConvert); - hsDoublePrecEnd hsAssert(newUt>=0, "negative unified time"); fT[j+i].SetSecsDouble(newUt); } diff --git a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp index 05cb9d3b..4d252352 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.cpp @@ -66,20 +66,20 @@ plCullPoly& plCullPoly::InitFromVerts(uint32_t f) { fCenter += fVerts[i]; } - fCenter *= 1.f / hsScalar(fVerts.GetCount()); + fCenter *= 1.f / float(fVerts.GetCount()); fRadius = ICalcRadius(); return *this; } -hsScalar plCullPoly::ICalcRadius() const +float plCullPoly::ICalcRadius() const { - hsScalar radSq = 0; + float radSq = 0; int i; for( i = 0; i < fVerts.GetCount(); i++ ) { - hsScalar tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared(); + float tmpSq = hsVector3(&fVerts[i], &fCenter).MagnitudeSquared(); if( tmpSq > radSq ) radSq = tmpSq; } @@ -169,8 +169,8 @@ void plCullPoly::Write(hsStream* s, hsResMgr* mgr) #ifdef MF_VALIDATE_POLYS hsBool plCullPoly::Validate() const { - const hsScalar kMinMag = 1.e-8f; - hsScalar magSq = fNorm.MagnitudeSquared(); + const float kMinMag = 1.e-8f; + float magSq = fNorm.MagnitudeSquared(); if( magSq < kMinMag ) return false; if( fVerts.GetCount() < 3 ) diff --git a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h index 2e541671..7af6ec62 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h +++ b/Sources/Plasma/PubUtilLib/plScene/plCullPoly.h @@ -51,7 +51,7 @@ class hsStream; class hsResMgr; struct hsMatrix44; -const hsScalar kCullPolyDegen = 1.e-4f; +const float kCullPolyDegen = 1.e-4f; class plCullPoly { @@ -67,12 +67,12 @@ public: hsTArray fVerts; hsVector3 fNorm; - hsScalar fDist; + float fDist; hsPoint3 fCenter; - hsScalar fRadius; + float fRadius; const hsPoint3& GetCenter() const { return fCenter; } - hsScalar GetRadius() const { return fRadius; } + float GetRadius() const { return fRadius; } void SetHole(hsBool on) { if( on )fFlags |= kHole; else fFlags &= ~kHole; } void SetTwoSided(hsBool on) { if( on )fFlags |= kTwoSided; else fFlags &= ~kTwoSided; } @@ -83,7 +83,7 @@ public: plCullPoly& Init(const plCullPoly& p) { fClipped.Clear(); fVerts.SetCount(0); fFlags = p.fFlags; fNorm = p.fNorm; fDist = p.fDist; fCenter = p.fCenter; return *this; } plCullPoly& Flip(const plCullPoly& p); plCullPoly& InitFromVerts(uint32_t f=kNone); - hsScalar ICalcRadius() const; + float ICalcRadius() const; plCullPoly& Transform(const hsMatrix44& l2w, const hsMatrix44& w2l, plCullPoly& dst) const; diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp b/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp index 33c2f9c7..b8ef2491 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluder.cpp @@ -238,9 +238,9 @@ void plOccluder::IComputeBounds() } } -hsScalar plOccluder::IComputeSurfaceArea() +float plOccluder::IComputeSurfaceArea() { - hsScalar area = 0; + float area = 0; const hsTArray& polys = GetLocalPolyList(); int i; for( i =0 ; i < polys.GetCount(); i++ ) diff --git a/Sources/Plasma/PubUtilLib/plScene/plOccluder.h b/Sources/Plasma/PubUtilLib/plScene/plOccluder.h index 4ea73961..dc4e0efb 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plOccluder.h +++ b/Sources/Plasma/PubUtilLib/plScene/plOccluder.h @@ -75,12 +75,12 @@ protected: hsTArray fVisRegions; hsBitVector fVisNot; - hsScalar fPriority; + float fPriority; hsBounds3Ext fWorldBounds; plKey fSceneNode; - virtual hsScalar IComputeSurfaceArea(); + virtual float IComputeSurfaceArea(); virtual void IComputeBounds(); virtual hsTArray& IGetLocalPolyList() { return fPolys; } @@ -99,7 +99,7 @@ public: virtual hsBool MsgReceive(plMessage* msg); - virtual hsScalar GetPriority() const { return fPriority; } + virtual float GetPriority() const { return fPriority; } hsBool InVisSet(const hsBitVector& visSet) const { return fVisSet.Overlap(visSet); } hsBool InVisNot(const hsBitVector& visNot) const { return fVisNot.Overlap(visNot); } diff --git a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp index 8222fcb2..4d5b4cc9 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plPageTreeMgr.cpp @@ -360,8 +360,8 @@ hsBool plPageTreeMgr::IRenderSortingSpans(plPipeline* pipe, hsTArrayGetNativeProperty(plDrawable::kPropSortAsOne) ) { const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(drawable->GetSpaceTree()->GetRoot()).fWorldBounds; - plConst(hsScalar) kDistFudge(1.e-1f); - listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + hsScalar(pairs[i].fSpan) * kDistFudge; + plConst(float) kDistFudge(1.e-1f); + listTrav->fKey.fFloat = -(bnd.GetCenter() - viewPos).MagnitudeSquared() + float(pairs[i].fSpan) * kDistFudge; } else { @@ -632,7 +632,7 @@ hsBool plPageTreeMgr::IGetCullPolys(plPipeline* pipe) { if( pipe->TestVisibleWorld(fOccluders[i]->GetWorldBounds()) ) { - hsScalar invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared()); + float invDist = -hsFastMath::InvSqrtAppr((viewPos - fOccluders[i]->GetWorldBounds().GetCenter()).MagnitudeSquared()); listTrav = &scratchList[numSubmit++]; listTrav->fBody = (void*)fOccluders[i]; listTrav->fNext = listTrav+1; diff --git a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp index f9a28262..1e246ccd 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.cpp @@ -64,8 +64,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plPostEffectMod::plPostEffectMod() : fHither(1.f), fYon(100.f), - fFovX(hsScalarPI * 0.25f), - fFovY(hsScalarPI * 0.25f * 0.75f), + fFovX(M_PI * 0.25f), + fFovY(M_PI * 0.25f * 0.75f), fPageMgr(nil), fRenderTarget(nil), fRenderRequest(nil) @@ -157,7 +157,7 @@ hsBool plPostEffectMod::IIsEnabled() const return /*GetTarget() &&*/ !fPageMgr->Empty() && fState.IsBitSet(kEnabled); } -hsBool plPostEffectMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plPostEffectMod::IEval(double secs, float del, uint32_t dirty) { return false; } diff --git a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h index 99e87b12..fb3f315e 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h +++ b/Sources/Plasma/PubUtilLib/plScene/plPostEffectMod.h @@ -69,11 +69,11 @@ protected: hsBitVector fState; - hsScalar fHither; - hsScalar fYon; + float fHither; + float fYon; - hsScalar fFovX; - hsScalar fFovY; + float fFovX; + float fFovY; plKey fNodeKey; plPageTreeMgr* fPageMgr; @@ -84,7 +84,7 @@ protected: hsMatrix44 fDefaultW2C, fDefaultC2W; - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); // called only by owner object's Eval() + virtual hsBool IEval(double secs, float del, uint32_t dirty); // called only by owner object's Eval() void ISetupRenderRequest(); void IDestroyRenderRequest(); @@ -118,15 +118,15 @@ public: void SetNodeKey(plKey key) { fNodeKey = key; } plKey GetNodeKey() const { return fNodeKey; } - void SetHither(hsScalar h) { fHither = h; } - void SetYon(hsScalar y) { fYon = y; } - void SetFovX(hsScalar f) { fFovX = f; } - void SetFovY(hsScalar f) { fFovY = f; } + void SetHither(float h) { fHither = h; } + void SetYon(float y) { fYon = y; } + void SetFovX(float f) { fFovX = f; } + void SetFovY(float f) { fFovY = f; } - hsScalar GetHither() const { return fHither; } - hsScalar GetYon() const { return fYon; } - hsScalar GetFovX() const { return fFovX; } - hsScalar GetFovY() const { return fFovY; } + float GetHither() const { return fHither; } + float GetYon() const { return fYon; } + float GetFovX() const { return fFovX; } + float GetFovY() const { return fFovY; } plPageTreeMgr* GetPageMgr() const { return fPageMgr; } diff --git a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h index fe589d29..4d3c8724 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h +++ b/Sources/Plasma/PubUtilLib/plScene/plRenderRequest.h @@ -75,15 +75,15 @@ protected: plKey fAck; - hsScalar fPriority; + float fPriority; uint32_t fDrawableMask; uint32_t fSubDrawableMask; hsColorRGBA fClearColor; - hsScalar fClearDepth; + float fClearDepth; - hsScalar fFogStart; + float fFogStart; hsMatrix44 fLocalToWorld; hsMatrix44 fWorldToLocal; @@ -139,28 +139,28 @@ public: const plViewTransform& GetViewTransform() const { return fViewTransform; } - hsScalar GetHither() const { return fViewTransform.GetHither(); } - hsScalar GetYon() const { return fViewTransform.GetYon(); } + float GetHither() const { return fViewTransform.GetHither(); } + float GetYon() const { return fViewTransform.GetYon(); } - hsScalar GetFovX() const { return fViewTransform.GetFovXDeg(); } - hsScalar GetFovY() const { return fViewTransform.GetFovYDeg(); } + float GetFovX() const { return fViewTransform.GetFovXDeg(); } + float GetFovY() const { return fViewTransform.GetFovYDeg(); } - hsScalar GetSizeX() const { return fViewTransform.GetOrthoWidth(); } - hsScalar GetSizeY() const { return fViewTransform.GetOrthoHeight(); } + float GetSizeX() const { return fViewTransform.GetOrthoWidth(); } + float GetSizeY() const { return fViewTransform.GetOrthoHeight(); } uint16_t GetScreenWidth() const { return fViewTransform.GetScreenWidth(); } uint16_t GetScreenHeight() const { return fViewTransform.GetScreenHeight(); } const hsColorRGBA& GetClearColor() const { return fClearColor; } - hsScalar GetClearDepth() const { return fClearDepth; } + float GetClearDepth() const { return fClearDepth; } // FogStart // negative => use current settings (default) // 0 => no fog == fog starts at yon // 1 => fog starts at camera. // Fog start greater than 1 is legal. Fog always linear. - hsScalar GetFogStart() const { return fFogStart; } + float GetFogStart() const { return fFogStart; } - hsScalar GetPriority() const { return fPriority; } + float GetPriority() const { return fPriority; } void SetLocalTransform(const hsMatrix44& l2w, const hsMatrix44& w2l); @@ -171,25 +171,25 @@ public: void SetPerspective(hsBool on=true) { fViewTransform.SetPerspective(on); } void SetOrthogonal(hsBool on=true) { fViewTransform.SetOrthogonal(on); } - void SetHither(hsScalar f) { fViewTransform.SetHither(f); } - void SetYon(hsScalar f) { fViewTransform.SetYon(f); } + void SetHither(float f) { fViewTransform.SetHither(f); } + void SetYon(float f) { fViewTransform.SetYon(f); } - void SetFovX(hsScalar f) { fViewTransform.SetFovXDeg(f); } - void SetFovY(hsScalar f) { fViewTransform.SetFovYDeg(f); } + void SetFovX(float f) { fViewTransform.SetFovXDeg(f); } + void SetFovY(float f) { fViewTransform.SetFovYDeg(f); } - void SetSizeX(hsScalar f) { fViewTransform.SetWidth(f); } - void SetSizeY(hsScalar f) { fViewTransform.SetHeight(f); } + void SetSizeX(float f) { fViewTransform.SetWidth(f); } + void SetSizeY(float f) { fViewTransform.SetHeight(f); } void SetClearColor(const hsColorRGBA& c) { fClearColor = c; } - void SetClearDepth(hsScalar d) { fClearDepth = d; } + void SetClearDepth(float d) { fClearDepth = d; } // FogStart // negative => use current settings (default) // 0 => no fog == fog starts at yon // 1 => fog starts at camera. // Fog start greater than 1 is legal. Fog always linear. - void SetFogStart(hsScalar d) { fFogStart = d; } + void SetFogStart(float d) { fFogStart = d; } - void SetPriority(hsScalar p) { fPriority = p; } + void SetPriority(float p) { fPriority = p; } virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h index 65aa13b3..0fc5b72f 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h +++ b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.h @@ -88,7 +88,7 @@ protected: uint32_t fCompFlags; uint32_t fLoadFlags; - hsScalar fLastUpdateTime; + float fLastUpdateTime; void IClearLayers(); uint32_t IMakeExtraLayer(); @@ -120,9 +120,9 @@ public: uint32_t GetCompositeFlags() const { return fCompFlags; } uint32_t GetLoadFlags() const { return fLoadFlags; } - hsScalar GetLastUpdateTime() const { return fLastUpdateTime; } - void SetLastUpdateTime(hsScalar f) { fLastUpdateTime = f; } - hsBool IShouldUpdate(hsScalar secs, uint32_t flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); } + float GetLastUpdateTime() const { return fLastUpdateTime; } + void SetLastUpdateTime(float f) { fLastUpdateTime = f; } + hsBool IShouldUpdate(float secs, uint32_t flags) { return GetLastUpdateTime() != secs || (flags & kUpdateAgain); } hsBool IsDynamic() const { return (fCompFlags & kCompDynamic); } hsBool IsDecal() const { return (fCompFlags & kCompDecal); } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp index a81c8b76..981f138e 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp @@ -211,7 +211,7 @@ void plGrassShaderMod::Read(hsStream *stream, hsResMgr *mgr) plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), GetKey()); } -hsBool plGrassShaderMod::IEval(double secs, hsScalar del, uint32_t dirty) +hsBool plGrassShaderMod::IEval(double secs, float del, uint32_t dirty) { if (fVShader) { @@ -235,7 +235,7 @@ void plGrassShaderMod::ISetupShaders() vShader->SetNumConsts(plGrassVS::kNumConsts); vShader->SetVector(plGrassVS::kNumericConsts, 0.f, 0.5f, 1.f, 2.f); - vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*hsScalarPI*4.f*4.f), hsScalarPI/2.f, hsScalarPI, hsScalarPI*2.f); + vShader->SetVector(plGrassVS::kPiConsts, 1.f / (8.f*M_PI*4.f*4.f), M_PI/2.f, M_PI, M_PI*2.f); vShader->SetVector(plGrassVS::kSinConsts, -1.f/6.f, 1.f/120.f, -1.f/5040.f, 1.f/362880.f); IRefreshWaves(vShader); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h index 52962a01..fda56818 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.h @@ -53,12 +53,12 @@ class plGrassWave public: plGrassWave() : fDistX(0.F), fDistY(0.F), fDistZ(0.F), fDirX(0.F), fDirY(0.F), fSpeed(0.F) {} - hsScalar fDistX; - hsScalar fDistY; - hsScalar fDistZ; - hsScalar fDirX; - hsScalar fDirY; - hsScalar fSpeed; + float fDistX; + float fDistY; + float fDistZ; + float fDirX; + float fDirY; + float fSpeed; void Write(hsStream *s); void Read(hsStream *s); @@ -99,7 +99,7 @@ public: plGrassWave fWaves[kNumWaves]; protected: - virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty); + virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual void IApplyDynamic() {}; // dummy function required by base class void ISetupShaders(); void IRefreshWaves(plShader *vShader); diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp index e9463d96..10068804 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp @@ -80,14 +80,14 @@ plLayer::plLayer() fRuntimeColor = TRACKED_NEW hsColorRGBA; fAmbientColor = TRACKED_NEW hsColorRGBA; fSpecularColor = TRACKED_NEW hsColorRGBA; - fOpacity = TRACKED_NEW hsScalar; + fOpacity = TRACKED_NEW float; fState = TRACKED_NEW hsGMatState; fState->Reset(); fUVWSrc = TRACKED_NEW uint32_t; - fLODBias = TRACKED_NEW hsScalar; - fSpecularPower = TRACKED_NEW hsScalar; + fLODBias = TRACKED_NEW float; + fSpecularPower = TRACKED_NEW float; fTexture = TRACKED_NEW plBitmap*; *fTexture = nil; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayer.h b/Sources/Plasma/PubUtilLib/plSurface/plLayer.h index c8db8505..924c51ba 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayer.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayer.h @@ -79,11 +79,11 @@ public: void SetRuntimeColor( const hsColorRGBA& col ) { *fRuntimeColor = col; } void SetAmbientColor(const hsColorRGBA& col) { *fAmbientColor = col; } void SetSpecularColor(const hsColorRGBA& col) { *fSpecularColor = col; } - void SetOpacity(hsScalar a) { *fOpacity = a; } + void SetOpacity(float a) { *fOpacity = a; } void SetTransform(const hsMatrix44& xfm); void SetUVWSrc(uint32_t chan) { *fUVWSrc = chan; } - void SetLODBias(hsScalar f) { *fLODBias = f; } - void SetSpecularPower(hsScalar f) { *fSpecularPower = f; } + void SetLODBias(float f) { *fLODBias = f; } + void SetSpecularPower(float f) { *fSpecularPower = f; } void SetVertexShader(plShader* shader) { *fVertexShader = shader; } void SetPixelShader(plShader* shader) { *fPixelShader = shader; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp index 1c5d8d63..a81fefef 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp @@ -98,7 +98,7 @@ void plLayerAnimationBase::Read(hsStream* s, hsResMgr* mgr) if( fOpacityCtl ) { fOwnedChannels |= kOpacity; - fOpacity = TRACKED_NEW hsScalar; + fOpacity = TRACKED_NEW float; } if( fPreshadeColorCtl ) { @@ -145,7 +145,7 @@ plLayerInterface* plLayerAnimationBase::Attach(plLayerInterface* prev) return plLayerInterface::Attach(prev); } -void plLayerAnimationBase::IEvalConvertedTime(hsScalar secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty) +void plLayerAnimationBase::IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty) { if( evalChans & kPreshadeColor ) { @@ -264,7 +264,7 @@ void plLayerAnimationBase::SetOpacityCtl(plController* opaCtl) if( fOpacityCtl ) delete fOpacityCtl; else - fOpacity = TRACKED_NEW hsScalar; + fOpacity = TRACKED_NEW float; fOwnedChannels |= kOpacity; fOpacityCtl = opaCtl; @@ -281,7 +281,7 @@ void plLayerAnimationBase::SetTransformCtl(plController* xfmCtl) fTransformCtl = xfmCtl; } -hsScalar plLayerAnimationBase::IMakeUniformLength() +float plLayerAnimationBase::IMakeUniformLength() { fLength = 0; if( fPreshadeColorCtl && (fPreshadeColorCtl->GetLength() > fLength) ) @@ -356,7 +356,7 @@ uint32_t plLayerAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore) { uint32_t evalChans = 0; uint32_t passChans = dirty | fPassThruChannels; - hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs); + float secs = fTimeConvert.WorldToAnimTime(wSecs); if( secs != fCurrentTime ) { evalChans = fOwnedChannels & ~ignore & ~fPassThruChannels; @@ -470,19 +470,19 @@ uint32_t plLayerLinkAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignor { uint32_t evalChans = 0; uint32_t passChans = dirty | fPassThruChannels; - hsScalar oldAnimTime = fTimeConvert.CurrentAnimTime(); - hsScalar secs = oldAnimTime; + float oldAnimTime = fTimeConvert.CurrentAnimTime(); + float secs = oldAnimTime; if (fFadeFlagsDirty) { - hsScalar goal = 0.f; + float goal = 0.f; if (fFadeFlags & kFadeLinkPrep) secs = goal = fLength; else { - hsScalar rate = 0.f; - hsScalar delta = (hsScalar)(wSecs - fEvalTime); + float rate = 0.f; + float delta = (float)(wSecs - fEvalTime); if (fFadeFlags & kFadeLinking) { @@ -703,7 +703,7 @@ uint32_t plLayerSDLAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore } } } - hsScalar secs; + float secs; if (fVar) fVar->Get(&secs); else diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h index 3e779397..6e30079b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h @@ -62,8 +62,8 @@ class plLayerAnimationBase : public plLayerInterface protected: char* fSegmentID; double fEvalTime; - hsScalar fCurrentTime; - hsScalar fLength; + float fCurrentTime; + float fLength; plController* fPreshadeColorCtl; plController* fRuntimeColorCtl; @@ -72,8 +72,8 @@ protected: plController* fOpacityCtl; plController* fTransformCtl; - hsScalar IMakeUniformLength(); - void IEvalConvertedTime(hsScalar secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty); + float IMakeUniformLength(); + void IEvalConvertedTime(float secs, uint32_t passChans, uint32_t evalChans, uint32_t &dirty); public: plLayerAnimationBase(); @@ -91,7 +91,7 @@ public: virtual void Write(hsStream* s, hsResMgr* mgr); // Specialized - hsScalar GetLength() const { return fLength; } + float GetLength() const { return fLength; } char *GetSegmentID() const { return fSegmentID; } void SetSegmentID(char *ID) { delete fSegmentID; fSegmentID = hsStrcpy(ID); } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h index 77f5daf3..e82c634c 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerInterface.h @@ -114,7 +114,7 @@ protected: hsColorRGBA* fRuntimeColor; // Diffuse color to be used with runtime lights vs. static preshading hsColorRGBA* fAmbientColor; hsColorRGBA* fSpecularColor; - hsScalar* fOpacity; + float* fOpacity; // Would like to abstract out the mipmap, but we'll bring it // along for now. @@ -123,8 +123,8 @@ protected: // (Currently) unanimatables. hsGMatState* fState; uint32_t* fUVWSrc; - hsScalar* fLODBias; - hsScalar* fSpecularPower; + float* fLODBias; + float* fSpecularPower; plShader** fVertexShader; plShader** fPixelShader; @@ -153,14 +153,14 @@ public: const hsColorRGBA& GetRuntimeColor() const { return *fRuntimeColor; } const hsColorRGBA& GetAmbientColor() const { return *fAmbientColor; } const hsColorRGBA& GetSpecularColor() const { return *fSpecularColor; } - hsScalar GetOpacity() const { return *fOpacity; } + float GetOpacity() const { return *fOpacity; } plBitmap* GetTexture() const { return *fTexture; } // (Currently) unanimatables uint32_t GetUVWSrc() const { return *fUVWSrc; } - hsScalar GetLODBias() const { return *fLODBias; } - hsScalar GetSpecularPower() const { return *fSpecularPower; } + float GetLODBias() const { return *fLODBias; } + float GetSpecularPower() const { return *fSpecularPower; } const hsGMatState& GetState() const { return *fState; } uint32_t GetBlendFlags() const { return fState->fBlendFlags; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp index 633c7adc..e8ef38b5 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.cpp @@ -60,7 +60,7 @@ void plLayerMultiply::Read(hsStream* s, hsResMgr* mgr) fOwnedChannels = s->ReadLE32(); if (fOwnedChannels & kOpacity) { - fOpacity = TRACKED_NEW hsScalar; + fOpacity = TRACKED_NEW float; *fOpacity = fSrcOpacity = s->ReadLEScalar(); fDirtyChannels |= kOpacity; } @@ -171,7 +171,7 @@ void plLayerMultiply::SetAmbientColor(const hsColorRGBA& col) fDirtyChannels |= kAmbientColor; } -void plLayerMultiply::SetOpacity(hsScalar a) +void plLayerMultiply::SetOpacity(float a) { fSrcOpacity = a; fDirtyChannels |= kOpacity; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h index c60de859..924b34bc 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerMultiply.h @@ -65,7 +65,7 @@ public: void SetPreshadeColor(const hsColorRGBA& col); void SetRuntimeColor(const hsColorRGBA& col); void SetAmbientColor(const hsColorRGBA& col); - void SetOpacity(hsScalar a); + void SetOpacity(float a); void SetTransform(const hsMatrix44& xfm); protected: @@ -73,7 +73,7 @@ protected: hsColorRGBA fSrcPreshadeColor; hsColorRGBA fSrcRuntimeColor; hsColorRGBA fSrcAmbientColor; - hsScalar fSrcOpacity; + float fSrcOpacity; hsMatrix44 fSrcTransform; }; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp index 94a3d385..479d848d 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp @@ -147,7 +147,7 @@ void plShader::SetVector(int i, const hsScalarTriple& vec) fConsts[i].fZ = vec.fZ; } -void plShader::SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w) +void plShader::SetVector(int i, float x, float y, float z, float w) { fConsts[i].x = x; fConsts[i].y = y; @@ -263,7 +263,7 @@ hsVector3 plShader::GetVector(int i) const return hsVector3(fConsts[i].fX, fConsts[i].fY, fConsts[i].fZ); } -void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const +void plShader::GetVector(int i, float& x, float& y, float& z, float& w) const { x = fConsts[i].x; y = fConsts[i].y; @@ -271,7 +271,7 @@ void plShader::GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w = fConsts[i].w; } -hsScalar plShader::GetFloat(int i, int chan) const +float plShader::GetFloat(int i, int chan) const { return fConsts[i].fArray[chan]; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.h b/Sources/Plasma/PubUtilLib/plSurface/plShader.h index 7738e51f..9aa68578 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.h @@ -225,8 +225,8 @@ public: hsColorRGBA GetColor(int i) const; hsPoint3 GetPosition(int i) const; hsVector3 GetVector(int i) const; - void GetVector(int i, hsScalar& x, hsScalar& y, hsScalar& z, hsScalar& w) const; - hsScalar GetFloat(int i, int chan) const; + void GetVector(int i, float& x, float& y, float& z, float& w) const; + float GetFloat(int i, int chan) const; const float* const GetFloat4(int i) const; void SetMatrix(int i, const plFloat44& xfm); // Will transpose @@ -236,8 +236,8 @@ public: void SetMatrix24(int i, const hsMatrix44& xfm); void SetColor(int i, const hsColorRGBA& col); void SetVector(int i, const hsScalarTriple& vec); /* Doesn't touch .fW */ - void SetVectorW(int i, const hsScalarTriple& vec, hsScalar w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); } - void SetVector(int i, hsScalar x, hsScalar y, hsScalar z, hsScalar w); + void SetVectorW(int i, const hsScalarTriple& vec, float w=1.f) { SetVector(i, vec.fX, vec.fY, vec.fZ, w); } + void SetVector(int i, float x, float y, float z, float w); void SetFloat(int i, int chan, float v); void SetFloat4(int i, const float* const f); diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp b/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp index 9ee5c99e..1895b291 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp +++ b/Sources/Plasma/PubUtilLib/plTransform/hsAffineParts.cpp @@ -244,7 +244,7 @@ void hsAffineParts::ComposeMatrix(hsMatrix44 *out) const hsVector3 R[3]; QuatTo3Vectors(fQ, R); - hsScalar f = fF < 0 ? -1.f : 1.f; + float f = fF < 0 ? -1.f : 1.f; for( i = 0; i < 3; i++ ) { for( j = 0; j < 3; j++ ) @@ -274,7 +274,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const // Build scale factor matrix hsMatrix44 K; hsVector3 invK; - invK.Set(hsScalarInvert(fK.fX),hsScalarInvert(fK.fY),hsScalarInvert(fK.fZ)); + invK.Set(hsInvert(fK.fX),hsInvert(fK.fY),hsInvert(fK.fZ)); K.MakeScaleMat(&invK); // Build Utranspose matrix @@ -357,7 +357,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const int i, j; hsVector3 invK; - invK.Set(hsScalarInvert(fK.fX),hsScalarInvert(fK.fY),hsScalarInvert(fK.fZ)); + invK.Set(hsInvert(fK.fX),hsInvert(fK.fY),hsInvert(fK.fZ)); hsVector3 UK[3]; for( i = 0; i < 3; i++ ) { @@ -378,7 +378,7 @@ void hsAffineParts::ComposeInverseMatrix(hsMatrix44 *out) const hsVector3 Rt[3]; QuatTo3VectorsTranspose(fQ.Conjugate(), Rt); - hsScalar f = fF < 0 ? -1.f : 1.f; + float f = fF < 0 ? -1.f : 1.f; for( i = 0; i < 3; i++ ) { for( j = 0; j < 3; j++ ) diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp index 96a2448a..5ec7471d 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp +++ b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.cpp @@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////////// // #include // for FLT_EPSILON +#include #include "hsEuler.h" #include "hsQuat.h" #include "hsMatrix44.h" @@ -67,7 +68,7 @@ void hsEuler::GetQuat(hsQuat* qu) EulGetOrd(ea.fOrder,i,j,k,h,n,s,f); if (f==EulFrmR) { - hsScalar t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; + float t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; } if (n==EulParOdd) ea.fY = -ea.fY; @@ -108,7 +109,7 @@ void hsEuler::GetMatrix44(hsMatrix44* mat) EulGetOrd(ea.fOrder,i,j,k,h,n,s,f); if (f==EulFrmR) { - hsScalar t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; + float t = ea.fX; ea.fX = ea.fZ; ea.fZ = t; } if (n==EulParOdd) { @@ -195,7 +196,7 @@ void hsEuler::SetFromMatrix44(const hsMatrix44* mat, uint32_t order) } if (f==EulFrmR) { - hsScalar t = fX; fX = fZ; fZ = t; + float t = fX; fX = fZ; fZ = t; } fOrder = order; } diff --git a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h index a48c045a..64f34c5c 100644 --- a/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h +++ b/Sources/Plasma/PubUtilLib/plTransform/hsEuler.h @@ -115,10 +115,10 @@ class hsQuat; class hsEuler { public: - hsScalar fX,fY,fZ; + float fX,fY,fZ; uint32_t fOrder; - hsEuler(hsScalar ai, hsScalar aj, hsScalar ah, uint32_t order) : fX(ai),fY(aj),fZ(ah),fOrder(order) {} + hsEuler(float ai, float aj, float ah, uint32_t order) : fX(ai),fY(aj),fZ(ah),fOrder(order) {} // getters, converters void GetQuat(hsQuat* res ); diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp index 9610e861..1c1a90f0 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp @@ -70,11 +70,9 @@ void plClientUnifiedTime::SetSysTime() #pragma optimize( "g", off ) // disable global optimizations void plClientUnifiedTime::SetFromGameTime(double gameTime, double curGameSecs) { - hsDoublePrecBegin; //double gameTimeOff = curGameSecs-gameTime; // when did this happen relative to our currrent sysTime //*this = GetFrameStartTime() - plUnifiedTime(gameTimeOff); SetSecsDouble(gameTime - fSysTimeOffset); - hsDoublePrecEnd; #if 0 extern bool gMooseDump; @@ -96,11 +94,9 @@ void plClientUnifiedTime::SetFromGameTime(double gameTime, double curGameSecs) // void plClientUnifiedTime::ConvertToGameTime(double* gameTimeOut, double curGameSecs) { - hsDoublePrecBegin; //plUnifiedTime utOff = GetFrameStartTime() - GetAsUnifiedTime(); // compute offset relative to current startFrame time //*gameTimeOut = curGameSecs - utOff.GetSecsDouble(); *gameTimeOut = GetSecsDouble() + fSysTimeOffset; - hsDoublePrecEnd; #if 0 extern bool gMooseDump; diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp index 4d3b05da..b4fdd789 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp @@ -370,9 +370,7 @@ int plUnifiedTime::GetMillis() const #pragma optimize( "g", off ) // disable global optimizations double plUnifiedTime::GetSecsDouble() const { - hsDoublePrecBegin double ret = GetSecs() + GetMicros() / 1000000.0; - hsDoublePrecEnd return ret; } #pragma optimize( "", on ) // restore optimizations to their defaults diff --git a/Sources/Tools/MaxComponent/plAGComponents.cpp b/Sources/Tools/MaxComponent/plAGComponents.cpp index 204fa5c4..51b00a3b 100644 --- a/Sources/Tools/MaxComponent/plAGComponents.cpp +++ b/Sources/Tools/MaxComponent/plAGComponents.cpp @@ -229,8 +229,8 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg) if (loopName) { anim->SetLoop(true); - hsScalar loopStart = info.GetLoopStart(loopName); - hsScalar loopEnd = info.GetLoopEnd(loopName); + float loopStart = info.GetLoopStart(loopName); + float loopEnd = info.GetLoopEnd(loopName); anim->SetLoopStart(loopStart == -1 ? anim->GetStart() : loopStart); anim->SetLoopEnd(loopEnd == -1 ? anim->GetEnd() : loopEnd); } diff --git a/Sources/Tools/MaxComponent/plAnimComponent.cpp b/Sources/Tools/MaxComponent/plAnimComponent.cpp index eb0c30c3..46ef67e7 100644 --- a/Sources/Tools/MaxComponent/plAnimComponent.cpp +++ b/Sources/Tools/MaxComponent/plAnimComponent.cpp @@ -735,9 +735,9 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) plAnimInfo info = noteAnim.GetAnimInfo(animName); ATCAnim->SetAutoStart(fCompPB->GetInt(kAnimAutoStart)); - hsScalar start = info.GetAnimStart(); - hsScalar end = info.GetAnimEnd(); - hsScalar initial = info.GetAnimInitial(); + float start = info.GetAnimStart(); + float end = info.GetAnimEnd(); + float initial = info.GetAnimInitial(); if (start != -1) ATCAnim->SetStart(start); if (end != -1) @@ -749,8 +749,8 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) { ATCAnim->SetLoop(true); const char *loopName = fCompPB->GetStr(kAnimLoopName); - hsScalar loopStart = info.GetLoopStart(loopName); - hsScalar loopEnd = info.GetLoopEnd(loopName); + float loopStart = info.GetLoopStart(loopName); + float loopEnd = info.GetLoopEnd(loopName); ATCAnim->SetLoopStart(loopStart == -1 ? ATCAnim->GetStart() : loopStart); ATCAnim->SetLoopEnd(loopEnd == -1 ? ATCAnim->GetEnd() : loopEnd); diff --git a/Sources/Tools/MaxComponent/plAudioComponents.cpp b/Sources/Tools/MaxComponent/plAudioComponents.cpp index c203ec8c..e3668d34 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.cpp +++ b/Sources/Tools/MaxComponent/plAudioComponents.cpp @@ -509,7 +509,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) // Fade in is enabled; set the params plSound::plFadeParams::Type type; - hsScalar len = (hsScalar)fCompPB->GetFloat( (ParamID)kSndFadeInLength, 0 ); + float len = (float)fCompPB->GetFloat( (ParamID)kSndFadeInLength, 0 ); switch( fCompPB->GetInt( (ParamID)kSndFadeInType, 0 ) ) { @@ -526,7 +526,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) // Fade out is enabled; set the params plSound::plFadeParams::Type type; - hsScalar len = (hsScalar)fCompPB->GetFloat( (ParamID)kSndFadeOutLength, 0 ); + float len = (float)fCompPB->GetFloat( (ParamID)kSndFadeOutLength, 0 ); switch( fCompPB->GetInt( (ParamID)kSndFadeOutType, 0 ) ) { @@ -538,7 +538,7 @@ void plBaseSoundEmitterComponent::IGrabFadeValues( plSound *sound ) sound->SetFadeOutEffect( type, len ); } -// sound->SetFadedVolume( (hsScalar)fCompPB->GetFloat( kSndFadedVolume, 0 ) ); +// sound->SetFadedVolume( (float)fCompPB->GetFloat( kSndFadedVolume, 0 ) ); } void plBaseSoundEmitterComponent::IGrabSoftRegion( plSound *sound, plErrorMsg *pErrMsg ) @@ -790,7 +790,7 @@ void plBaseSoundEmitterComponent::UpdateSoundFileSelection( void ) delete baseBuffer; } -hsScalar plBaseSoundEmitterComponent::GetSoundVolume( void ) const +float plBaseSoundEmitterComponent::GetSoundVolume( void ) const { return IGetDigitalVolume(); } @@ -914,7 +914,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node plController *ctl; hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar start, end; + float start, end; if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) { start = end = -1; @@ -2233,7 +2233,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray // Also also also build up a volume array parallel to startPoses that represents the individual volume // setting for each sound in the group hsTArray startPoses; - hsTArray volumes; + hsTArray volumes; hsLargeArray mergedData; int i; plWAVHeader mergedHeader; diff --git a/Sources/Tools/MaxComponent/plAudioComponents.h b/Sources/Tools/MaxComponent/plAudioComponents.h index 161a697f..beee84c4 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.h +++ b/Sources/Tools/MaxComponent/plAudioComponents.h @@ -128,7 +128,7 @@ class plBaseSoundEmitterComponent : public plComponent void SetCreateGrouped( plMaxNode *baseNode, int commonSoundIdx ); // Grabs the current sound volume - virtual hsScalar GetSoundVolume( void ) const; + virtual float GetSoundVolume( void ) const; protected: #ifdef MAXASS_AVAILABLE diff --git a/Sources/Tools/MaxComponent/plAutoUIBase.cpp b/Sources/Tools/MaxComponent/plAutoUIBase.cpp index c12369e3..ff91e390 100644 --- a/Sources/Tools/MaxComponent/plAutoUIBase.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIBase.cpp @@ -137,7 +137,7 @@ void plAutoUIBase::AddCheckBox(int16_t id, const char *scriptName, const char *n fParams.push_back(param); } -void plAutoUIBase::AddFloatSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsScalar def, hsScalar min, hsScalar max) +void plAutoUIBase::AddFloatSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, float def, float min, float max) { char *scriptNameNew = scriptName ? hsStrcpy(scriptName) : IMakeScriptName(name); diff --git a/Sources/Tools/MaxComponent/plAutoUIBase.h b/Sources/Tools/MaxComponent/plAutoUIBase.h index bf349983..92b9ec00 100644 --- a/Sources/Tools/MaxComponent/plAutoUIBase.h +++ b/Sources/Tools/MaxComponent/plAutoUIBase.h @@ -91,7 +91,7 @@ public: void AddCheckBox (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, hsBool def=false); void AddFloatSpinner(int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, - hsScalar def=0.f, hsScalar min=0.f, hsScalar max=1.f); + float def=0.f, float min=0.f, float max=1.f); void AddIntSpinner (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, int def=1, int min=0, int max=1); void AddEditBox (int16_t id, const char *scriptName, const char *name, int vid, std::vector* vstates, diff --git a/Sources/Tools/MaxComponent/plAutoUIComp.cpp b/Sources/Tools/MaxComponent/plAutoUIComp.cpp index d2483b9a..fd3a939a 100644 --- a/Sources/Tools/MaxComponent/plAutoUIComp.cpp +++ b/Sources/Tools/MaxComponent/plAutoUIComp.cpp @@ -66,7 +66,7 @@ hsBool plAutoUIComp::GetCheckBox(int16_t id, plComponentBase *comp) return pblock->GetInt(id); } -hsScalar plAutoUIComp::GetFloatSpinner(int16_t id, plComponentBase *comp) +float plAutoUIComp::GetFloatSpinner(int16_t id, plComponentBase *comp) { IParamBlock2 *pblock = comp->GetParamBlockByID(plComponentBase::kBlkComp); return pblock->GetFloat(id); diff --git a/Sources/Tools/MaxComponent/plAutoUIComp.h b/Sources/Tools/MaxComponent/plAutoUIComp.h index de72d695..6672f330 100644 --- a/Sources/Tools/MaxComponent/plAutoUIComp.h +++ b/Sources/Tools/MaxComponent/plAutoUIComp.h @@ -54,7 +54,7 @@ public: // Get the value of a control. Pass in the id and your 'this' pointer. // hsBool GetCheckBox(int16_t id, plComponentBase *comp); - hsScalar GetFloatSpinner(int16_t id, plComponentBase *comp); + float GetFloatSpinner(int16_t id, plComponentBase *comp); int GetIntSpinner(int16_t id, plComponentBase *comp); TSTR GetEditBox(int16_t id, plComponentBase *comp); INode* GetPickNode(int16_t id, plComponentBase *comp, int idx); diff --git a/Sources/Tools/MaxComponent/plBipedKiller.cpp b/Sources/Tools/MaxComponent/plBipedKiller.cpp index 4d2aa211..5bbef4d0 100644 --- a/Sources/Tools/MaxComponent/plBipedKiller.cpp +++ b/Sources/Tools/MaxComponent/plBipedKiller.cpp @@ -660,7 +660,7 @@ Quat GetRotKey(int32_t i, std::vector& mat3Array, hsAffineParts* p Point3 ax; float ang; AngAxisFromQ(q, &ang, ax); - //ang -= hsScalarPI; + //ang -= M_PI; ax = -ax; q = QFromAngAxis(ang, ax); } diff --git a/Sources/Tools/MaxComponent/plCameraComponents.cpp b/Sources/Tools/MaxComponent/plCameraComponents.cpp index 99d22339..86ff2ca1 100644 --- a/Sources/Tools/MaxComponent/plCameraComponents.cpp +++ b/Sources/Tools/MaxComponent/plCameraComponents.cpp @@ -125,12 +125,12 @@ struct PreTrans hsBool fCutPos; hsBool fCutPOA; hsBool fIgnore; - hsScalar fAccel; - hsScalar fDecel; - hsScalar fVelocity; - hsScalar fPOAAccel; - hsScalar fPOADecel; - hsScalar fPOAVelocity; + float fAccel; + float fDecel; + float fVelocity; + float fPOAAccel; + float fPOADecel; + float fPOAVelocity; }; @@ -853,7 +853,7 @@ plCameraModifier1* plCameraBaseComponent::ICreateCameraModifier(plMaxNode* pNode // convert FOVvalue = FOVvalue*(180/3.141592); int FOVType = theCam->GetFOVType(); - hsScalar wDeg, hDeg; + float wDeg, hDeg; switch(FOVType) { case 0: // FOV_W @@ -893,14 +893,14 @@ void plCameraBaseComponent::ISetLimitPan(plMaxNode* pNode, plCameraBrain1* pBrai IParamBlock2* pBlk = LimitPanComp->GetParamBlock(plComponentBase::kRefComp); if ( pBlk && pBlk->GetInt(kLimitPanX) ) { - hsScalar deg = pBlk->GetFloat(kPanZDeg); - hsScalar rad = hsScalarDegToRad(deg); + float deg = pBlk->GetFloat(kPanZDeg); + float rad = hsDegreesToRadians(deg); pBrain->SetXPanLimit( rad * 0.5f ); } if ( pBlk && pBlk->GetInt(kLimitPanZ) ) { - hsScalar deg = pBlk->GetFloat(kPanXDeg); - hsScalar rad = hsScalarDegToRad(deg); + float deg = pBlk->GetFloat(kPanXDeg); + float rad = hsDegreesToRadians(deg); pBrain->SetZPanLimit( rad * 0.5f ); } } @@ -920,9 +920,9 @@ void plCameraBaseComponent::ISetLimitZoom(plMaxNode* pNode, plCameraBrain1* pBra { // set this camera to limit panning x degrees IParamBlock2* pBlk = LimitZoomComp->GetParamBlock(plComponentBase::kRefComp); - hsScalar max = pBlk->GetFloat(kZoomMaxDeg); - hsScalar min = pBlk->GetFloat(kZoomMinDeg); - hsScalar rate = pBlk->GetFloat(kZoomRate); + float max = pBlk->GetFloat(kZoomMaxDeg); + float min = pBlk->GetFloat(kZoomMinDeg); + float rate = pBlk->GetFloat(kZoomRate); pBrain->SetZoomParams(max / 1.33333333, min / 1.33333333, rate); } } diff --git a/Sources/Tools/MaxComponent/plClickDragComponent.cpp b/Sources/Tools/MaxComponent/plClickDragComponent.cpp index 721115b3..198732b9 100644 --- a/Sources/Tools/MaxComponent/plClickDragComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickDragComponent.cpp @@ -583,8 +583,8 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) int deg = fCompPB->GetInt(kClickDragDegrees); if (deg > 180) deg = 180; - hsScalar rad = hsScalarDegToRad(deg); - facingCond->SetTolerance(hsCosine(rad)); + float rad = hsDegreesToRadians(deg); + facingCond->SetTolerance(cos(rad)); plKey facingKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), facingCond, loc); diff --git a/Sources/Tools/MaxComponent/plClickableComponent.cpp b/Sources/Tools/MaxComponent/plClickableComponent.cpp index e290dcdc..14611940 100644 --- a/Sources/Tools/MaxComponent/plClickableComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickableComponent.cpp @@ -365,8 +365,8 @@ hsBool plClickableComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) int deg = fCompPB->GetInt(kClickableDegrees); if (deg > 180) deg = 180; - hsScalar rad = hsScalarDegToRad(deg); - facingCond->SetTolerance(hsCosine(rad)); + float rad = hsDegreesToRadians(deg); + facingCond->SetTolerance(cos(rad)); plKey facingKey = hsgResMgr::ResMgr()->NewKey(IGetUniqueName(node), facingCond, loc); detector->AddLogicObj(logicKey); // send messages to this logic component diff --git a/Sources/Tools/MaxComponent/plFootPrintComponent.cpp b/Sources/Tools/MaxComponent/plFootPrintComponent.cpp index e9503271..238a52fe 100644 --- a/Sources/Tools/MaxComponent/plFootPrintComponent.cpp +++ b/Sources/Tools/MaxComponent/plFootPrintComponent.cpp @@ -377,7 +377,7 @@ hsBool plFootPrintComponent::ISetupDecalMgr(plMaxNode* node, plErrorMsg* pErrMsg float intensity = fCompPB->GetFloat(kIntensity) * 1.e-2f; float partyTime = fCompPB->GetFloat(kPartyTime); - const hsScalar kHeightHack = 1.f; + const float kHeightHack = 1.f; fDecalMgr->SetScale(hsVector3(width, length, kHeightHack)); const float kMinFadeOut = 1.e-2f; diff --git a/Sources/Tools/MaxComponent/plGUIComponents.cpp b/Sources/Tools/MaxComponent/plGUIComponents.cpp index c2c46824..f75b6017 100644 --- a/Sources/Tools/MaxComponent/plGUIComponents.cpp +++ b/Sources/Tools/MaxComponent/plGUIComponents.cpp @@ -1281,7 +1281,7 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fov = cam->GetFOV(timeVal); // convert int FOVType = cam->GetFOVType(); - hsScalar fovX, fovY; + float fovX, fovY; switch(FOVType) { case 0: // FOV_W @@ -1297,8 +1297,8 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } break; } - fovX *= 180.f / hsScalarPI; - fovY *= 180.f / hsScalarPI; + fovX *= 180.f / M_PI; + fovY *= 180.f / M_PI; mod->SetFovX(fovX); mod->SetFovY(fovY); @@ -2651,7 +2651,7 @@ hsBool plGUIKnobCtrlComponent::IGrabAnimationRange( plMaxNode *node, plErrorMsg { plMatrixControllerChannel *channel = TRACKED_NEW plMatrixControllerChannel(tmc, parts); - hsScalar length = tmc->GetLength(); + float length = tmc->GetLength(); startL2W = channel->Value( 0.f ); endL2W = channel->Value( length ); @@ -4988,8 +4988,8 @@ hsBool plGUIMenuComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fovX = atan( scrnWidth / ( 2.f * 100.f ) ) * 2.f; float fovY = fovX;// * 3.f / 4.f; - renderMod->SetFovX( fovX * 180.f / hsScalarPI ); - renderMod->SetFovY( fovY * 180.f / hsScalarPI ); + renderMod->SetFovX( fovX * 180.f / M_PI ); + renderMod->SetFovY( fovY * 180.f / M_PI ); hsgResMgr::ResMgr()->AddViaNotify( renderMod->GetKey(), TRACKED_NEW plNodeRefMsg( fConvertedNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); diff --git a/Sources/Tools/MaxComponent/plLineFollowComp.cpp b/Sources/Tools/MaxComponent/plLineFollowComp.cpp index 2ee206ce..cc27f640 100644 --- a/Sources/Tools/MaxComponent/plLineFollowComp.cpp +++ b/Sources/Tools/MaxComponent/plLineFollowComp.cpp @@ -588,10 +588,10 @@ hsBool plStereizeComp::Convert(plMaxNode* node, plErrorMsg* pErrMsg) stereo->SetAmbientDist(fCompPB->GetFloat(kAmbientDist)); stereo->SetTransition(fCompPB->GetFloat(kTransition)); - hsScalar ang = fCompPB->GetFloat(kSepAngle); + float ang = fCompPB->GetFloat(kSepAngle); if( ang > 80.f ) ang = 80.f; - stereo->SetSepAngle(hsScalarDegToRad(ang)); + stereo->SetSepAngle(hsDegreesToRadians(ang)); stereo->SetMaxSepDist(fCompPB->GetFloat(kMaxDist)); stereo->SetMinSepDist(fCompPB->GetFloat(kMinDist)); diff --git a/Sources/Tools/MaxComponent/plMiscComponents.cpp b/Sources/Tools/MaxComponent/plMiscComponents.cpp index df71311c..16b2c30d 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.cpp +++ b/Sources/Tools/MaxComponent/plMiscComponents.cpp @@ -176,7 +176,7 @@ hsBool plInterestingComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plInterestingModifier* pMod = TRACKED_NEW plInterestingModifier; - hsScalar loader = fCompPB->GetFloat(kCamInterestRadius); + float loader = fCompPB->GetFloat(kCamInterestRadius); pMod->SetInterestRadius(loader); loader = fCompPB->GetFloat(kCamInterestWeight); pMod->SetInterestWeight(loader); @@ -1398,7 +1398,7 @@ hsBool plCamViewComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) float fov = cam->GetFOV(timeVal); // convert int FOVType = cam->GetFOVType(); - hsScalar fovX, fovY; + float fovX, fovY; switch(FOVType) { case 0: // FOV_W @@ -1414,8 +1414,8 @@ hsBool plCamViewComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } break; } - fovX *= 180.f / hsScalarPI; - fovY *= 180.f / hsScalarPI; + fovX *= 180.f / M_PI; + fovY *= 180.f / M_PI; mod->SetFovX(fovX); mod->SetFovY(fovY); diff --git a/Sources/Tools/MaxComponent/plParticleComponents.cpp b/Sources/Tools/MaxComponent/plParticleComponents.cpp index 035cc588..0ed5cd52 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.cpp +++ b/Sources/Tools/MaxComponent/plParticleComponents.cpp @@ -196,24 +196,24 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) heightCtl = cc.MakeScalarController(particleMtl->GetHeightController(), node); } - hsScalar genLife = -1; - hsScalar partLifeMin, partLifeMax; - hsScalar pps = fUserInput.fPPS; + float genLife = -1; + float partLifeMin, partLifeMax; + float pps = fUserInput.fPPS; hsPoint3 pos(0, 0, 0); - hsScalar pitch = PI; - hsScalar yaw = 0; - hsScalar angleRange = fUserInput.fConeAngle * PI / 180.f; - hsScalar velMin = fUserInput.fVelocityMin; - hsScalar velMax = fUserInput.fVelocityMax; - hsScalar xSize = fUserInput.fHSize; - hsScalar ySize = fUserInput.fVSize; - hsScalar scaleMin = fUserInput.fScaleMin / 100.0f; - hsScalar scaleMax = fUserInput.fScaleMax / 100.0f; - hsScalar gravity = fUserInput.fGravity / 100.0f; - hsScalar drag = fUserInput.fDrag / 100.f; - hsScalar windMult = fUserInput.fWindMult / 100.f; - hsScalar massRange = fUserInput.fMassRange; - hsScalar rotRange = fUserInput.fRotRange * PI / 180.f; + float pitch = PI; + float yaw = 0; + float angleRange = fUserInput.fConeAngle * PI / 180.f; + float velMin = fUserInput.fVelocityMin; + float velMax = fUserInput.fVelocityMax; + float xSize = fUserInput.fHSize; + float ySize = fUserInput.fVSize; + float scaleMin = fUserInput.fScaleMin / 100.0f; + float scaleMax = fUserInput.fScaleMax / 100.0f; + float gravity = fUserInput.fGravity / 100.0f; + float drag = fUserInput.fDrag / 100.f; + float windMult = fUserInput.fWindMult / 100.f; + float massRange = fUserInput.fMassRange; + float rotRange = fUserInput.fRotRange * PI / 180.f; uint32_t xTiles = fUserInput.fXTiles; uint32_t yTiles = fUserInput.fYTiles; @@ -227,11 +227,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (ppsCtl != nil && ppsCtl->GetLength() > 0) { // Simulate just the birth across the curve and record the max - hsScalar frameDelta = (1.f / MAX_FRAMES_PER_SEC); - hsScalar avgLife = (partLifeMax + partLifeMin) / 2; + float frameDelta = (1.f / MAX_FRAMES_PER_SEC); + float avgLife = (partLifeMax + partLifeMin) / 2; uint32_t count = node->NumAttachedComponents(); uint32_t lifeTicks = avgLife / frameDelta; - hsScalar *birth = TRACKED_NEW hsScalar[lifeTicks]; + float *birth = TRACKED_NEW float[lifeTicks]; // Find any anim components attached to the same node. for (i = 0; i < count; i++) @@ -239,7 +239,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) if (!plAnimComponentBase::IsAnimComponent(node->GetAttachedComponent(i))) continue; - hsScalar maxAnimParticles = 0; + float maxAnimParticles = 0; plAnimComponentBase *comp = (plAnimComponentBase *)node->GetAttachedComponent(i); plATCAnim *anim = plATCAnim::ConvertNoRef(comp->fAnims[node]); @@ -247,9 +247,9 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // If it's an ATC anim, we can be aggressive in determining the max if (anim) { - hsScalar curAnimParticles = 0; + float curAnimParticles = 0; - hsScalar loopStart, loopEnd; + float loopStart, loopEnd; for (j = -1; j < (int32_t)anim->GetNumLoops(); j++) { @@ -265,7 +265,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) else anim->GetLoop(j, loopStart, loopEnd); - hsScalar loopLength = loopEnd - loopStart; + float loopLength = loopEnd - loopStart; if (loopLength == 0) // It's the default "(Entire Animation)" loopLength = ppsCtl->GetLength(); @@ -277,8 +277,8 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) for (tick = 0; tick < loopTicks + lifeTicks; tick++) { curAnimParticles -= birth[tick % lifeTicks] * frameDelta; - hsScalar birthStart = 0.f; - hsScalar birthEnd = 0.f; + float birthStart = 0.f; + float birthEnd = 0.f; ppsCtl->Interp(((tick % loopTicks) + startTick) * frameDelta, &birthStart); ppsCtl->Interp(((tick % loopTicks) + startTick + 1) * frameDelta, &birthEnd); birth[tick % lifeTicks] = (birthStart + birthEnd) / 2; @@ -290,11 +290,11 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) } else // No info on the animation. Assume the worst. { - hsScalar maxPps = 0; + float maxPps = 0; int i; for (i = 1; i < ppsCtl->GetNumKeys(); i++) { - hsScalar curVal = 0; + float curVal = 0; hsScalarKey *key = ppsCtl->GetScalarKey(i); if (key) curVal = key->fValue; @@ -351,15 +351,15 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Figure out the appropriate generator to add plParticleGenerator *generator = nil; uint32_t sources; - hsScalar *pitchArray; - hsScalar *yawArray; + float *pitchArray; + float *yawArray; hsPoint3 *pointArray; hsVector3 *dirArray; if (fUserInput.fGenType == kGenPoint) { sources = 1; - pitchArray = TRACKED_NEW hsScalar[sources]; - yawArray = TRACKED_NEW hsScalar[sources]; + pitchArray = TRACKED_NEW float[sources]; + yawArray = TRACKED_NEW float[sources]; pointArray = TRACKED_NEW hsPoint3[sources]; pitchArray[0] = pitch; yawArray[0] = yaw; @@ -375,8 +375,8 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsTArray pos; plMeshConverter::Instance().StuffPositionsAndNormals(node, &pos, &normals); sources = normals.GetCount(); - pitchArray = TRACKED_NEW hsScalar[sources]; - yawArray = TRACKED_NEW hsScalar[sources]; + pitchArray = TRACKED_NEW float[sources]; + yawArray = TRACKED_NEW float[sources]; pointArray = TRACKED_NEW hsPoint3[sources]; int i; for (i = 0; i < sources; i++) @@ -517,7 +517,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) plController *ctl; hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar start, end; + float start, end; if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) { start = end = -1; @@ -1156,7 +1156,7 @@ static hsVector3 IGetRefDir(plMaxNode* node, INode* refNode, float clampAngDeg) float vecLen = 100.f; if( clampAngDeg > 1.f ) { - float rads = hsScalarDegToRad(clampAngDeg); + float rads = hsDegreesToRadians(clampAngDeg); float sinAng = sinf(rads); hsAssert(sinAng > 0.01, "Trig confusion?"); @@ -1492,8 +1492,8 @@ void plParticleFlockComponent::AddToParticleSystem(plParticleSystem *sys, plMaxN effect->SetInfluenceAvgRadius(fCompPB->GetFloat(ParamID(kInfAvgDist))); effect->SetInfluenceRepelRadius(fCompPB->GetFloat(ParamID(kInfRepDist))); - hsScalar goalDist = fCompPB->GetFloat(ParamID(kGoalDist)); - hsScalar fcDist = fCompPB->GetFloat(ParamID(kFullChaseDist)); + float goalDist = fCompPB->GetFloat(ParamID(kGoalDist)); + float fcDist = fCompPB->GetFloat(ParamID(kFullChaseDist)); effect->SetGoalRadius(goalDist); effect->SetFullChaseRadius(goalDist > fcDist ? goalDist : fcDist); // Fix old data diff --git a/Sources/Tools/MaxComponent/plParticleComponents.h b/Sources/Tools/MaxComponent/plParticleComponents.h index 9300869d..8757b8fb 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.h +++ b/Sources/Tools/MaxComponent/plParticleComponents.h @@ -58,22 +58,22 @@ class ParticleStats { public: - hsScalar fConeAngle; - hsScalar fVelocityMin; - hsScalar fVelocityMax; - hsScalar fLifeMin; - hsScalar fLifeMax; - hsScalar fPPS; - hsScalar fScaleMin; - hsScalar fScaleMax; - hsScalar fGravity; - hsScalar fDrag; - hsScalar fWindMult; - hsScalar fMassRange; - hsScalar fRotRange; - hsScalar fPreSim; - hsScalar fHSize; - hsScalar fVSize; + float fConeAngle; + float fVelocityMin; + float fVelocityMax; + float fLifeMin; + float fLifeMax; + float fPPS; + float fScaleMin; + float fScaleMax; + float fGravity; + float fDrag; + float fWindMult; + float fMassRange; + float fRotRange; + float fPreSim; + float fHSize; + float fVSize; uint32_t fGenType; uint32_t fXTiles; uint32_t fYTiles; diff --git a/Sources/Tools/MaxComponent/plResponderMtl.cpp b/Sources/Tools/MaxComponent/plResponderMtl.cpp index 6cc168f9..58604495 100644 --- a/Sources/Tools/MaxComponent/plResponderMtl.cpp +++ b/Sources/Tools/MaxComponent/plResponderMtl.cpp @@ -337,8 +337,8 @@ plMessage *plResponderCmdMtl::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IP throw "No material specified"; const char *animName = pb->GetStr(kMtlAnim); - hsScalar begin=-1.f; - hsScalar end = -1.f; + float begin=-1.f; + float end = -1.f; SegmentMap *segMap = GetAnimSegmentMap(maxMtl, pErrMsg); diff --git a/Sources/Tools/MaxComponent/plWaterComponent.cpp b/Sources/Tools/MaxComponent/plWaterComponent.cpp index a7979ba1..73c17b87 100644 --- a/Sources/Tools/MaxComponent/plWaterComponent.cpp +++ b/Sources/Tools/MaxComponent/plWaterComponent.cpp @@ -71,7 +71,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plScene/plVisRegion.h" static const float kPercentToFrac(1.e-2f); -static const float kDegreeToRad(hsScalarPI/180.f); +static const float kDegreeToRad(M_PI/180.f); // Preliminary setup bookkeeping @@ -411,17 +411,17 @@ void plWaterComponent::CheckForObsoleteParams() // SpecEnd = kEnvRadius * 2.f // Okay, here we go. - hsScalar dispersion = fCompPB->GetFloat(kDispersion) / 100.f; - plConst(hsScalar) kMinAng(5.f); - plConst(hsScalar) kMaxAng(180.f); + float dispersion = fCompPB->GetFloat(kDispersion) / 100.f; + plConst(float) kMinAng(5.f); + plConst(float) kMaxAng(180.f); - hsScalar angleDev = kMinAng + dispersion * (kMaxAng - kMinAng); + float angleDev = kMinAng + dispersion * (kMaxAng - kMinAng); fCompPB->SetValue(kGeoAngleDev, TimeValue(0), angleDev); fCompPB->SetValue(kTexAngleDev, TimeValue(0), angleDev); - hsScalar windSpeed = fCompPB->GetFloat(kWindSpeed); - const hsScalar kGravConst(32.f); // ft/s^2 - hsScalar waveLen = windSpeed * windSpeed / kGravConst; + float windSpeed = fCompPB->GetFloat(kWindSpeed); + const float kGravConst(32.f); // ft/s^2 + float waveLen = windSpeed * windSpeed / kGravConst; waveLen /= 2.f; if( waveLen < 1.f ) waveLen = 1.f; @@ -429,14 +429,14 @@ void plWaterComponent::CheckForObsoleteParams() fCompPB->SetValue(kGeoMaxLen, TimeValue(0), waveLen*2.f); fCompPB->SetValue(kGeoAmpOverLen, TimeValue(0), 10.f); - hsScalar rippleScale = fCompPB->GetFloat(kRippleScale); + float rippleScale = fCompPB->GetFloat(kRippleScale); fCompPB->SetValue(kTexMinLen, TimeValue(0), 4.f / 256.f * rippleScale); fCompPB->SetValue(kTexMaxLen, TimeValue(0), 32.f / 256.f * rippleScale); - hsScalar amp = 0.01f; - hsScalar specMute = 0.5f; + float amp = 0.01f; + float specMute = 0.5f; if( windSpeed < 15.f ) { - hsScalar p = windSpeed / 15.f; + float p = windSpeed / 15.f; amp += p * (0.1f - 0.01f); specMute += (1-p)* 0.5f; @@ -446,9 +446,9 @@ void plWaterComponent::CheckForObsoleteParams() fCompPB->SetValue(kNoise, TimeValue(0), 50.f); - hsScalar envRad = fCompPB->GetFloat(kEnvRadius); - hsScalar specStart = envRad / 2.f; - hsScalar specEnd = envRad * 2.f; + float envRad = fCompPB->GetFloat(kEnvRadius); + float specStart = envRad / 2.f; + float specEnd = envRad * 2.f; fCompPB->SetValue(kSpecStart, TimeValue(0), specStart); fCompPB->SetValue(kSpecEnd, TimeValue(0), specEnd); @@ -685,7 +685,7 @@ hsBool plWaterComponent::IMakeWaveSet(plMaxNode* node, plErrorMsg* pErrMsg) return true; } -hsScalar plWaterComponent::IGetWaterHeight() +float plWaterComponent::IGetWaterHeight() { plMaxNodeBase* node = nil; @@ -703,7 +703,7 @@ hsScalar plWaterComponent::IGetWaterHeight() return ws.fWaterHeight; } -hsScalar plWaterComponent::GetWaterHeight(INode* node) +float plWaterComponent::GetWaterHeight(INode* node) { if( !node ) return 0.f; diff --git a/Sources/Tools/MaxComponent/plWaterComponent.h b/Sources/Tools/MaxComponent/plWaterComponent.h index 723f976d..85b0a244 100644 --- a/Sources/Tools/MaxComponent/plWaterComponent.h +++ b/Sources/Tools/MaxComponent/plWaterComponent.h @@ -141,7 +141,7 @@ protected: plWaveSetBase* IGetWaveSet() const { return (plWaveSetBase*)fWaveSet; } // fWaveSet set in SetupProperties pass. - hsScalar IGetWaterHeight(); + float IGetWaterHeight(); public: plWaterComponent(); @@ -157,7 +157,7 @@ public: virtual int GetMinCap() { return plQuality::kPS_1_1; } // This works anytime. - static hsScalar GetWaterHeight(INode* node); // node is component node. + static float GetWaterHeight(INode* node); // node is component node. // These only work after PreConvert pass static plWaveSetBase* GetWaveSet(INode* node); // Node is the component node diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index 69cb8cbd..057ee839 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -121,7 +121,7 @@ class KRStatus : public KeyReduceStatus int Progress(int p) { return KEYREDUCE_CONTINUE; } }; -void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) +void hsControlConverter::ReduceKeys(Control *control, float threshold) { if (control == nil || threshold <= 0) return; @@ -172,7 +172,7 @@ void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold) } plController *hsControlConverter::ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { Control* maxTm = node->GetTMController(); plController *tmc = hsControlConverter::Instance().MakeTransformController(maxTm, node, start, end); @@ -249,7 +249,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(StdUVGen* uvGen, co CompositeKeyTimes(vAngCtl, kTimes); CompositeKeyTimes(wAngCtl, kTimes); - const float kMaxRads = 30.f * hsScalarPI / 180.f; + const float kMaxRads = 30.f * M_PI / 180.f; MaxSampleAngles(nodeName, uAngCtl, kTimes, kMaxRads); MaxSampleAngles(nodeName, vAngCtl, kTimes, kMaxRads); MaxSampleAngles(nodeName, wAngCtl, kTimes, kMaxRads); @@ -339,7 +339,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(Control* prsControl // Create a plScalarController and store the nodes parm behavior in it. // plLeafController* hsControlConverter::MakeScalarController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakeScalarController"); @@ -354,7 +354,7 @@ plLeafController* hsControlConverter::MakeScalarController(Control* control, plM } plController* hsControlConverter::MakeColorController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { return MakePosController(control, node, start, end); } @@ -362,7 +362,7 @@ plController* hsControlConverter::MakeColorController(Control* control, plMaxNod // Create a plPosController and store the nodes parm behavior in it. // plController* hsControlConverter::MakePosController(Control* control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakePosController"); @@ -412,7 +412,7 @@ plController* hsControlConverter::MakePosController(Control* control, plMaxNode* } plController *hsControlConverter::MakeScaleController(Control *control, plMaxNode* node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { ISetSegRange(start, end); @@ -435,7 +435,7 @@ plController *hsControlConverter::MakeScaleController(Control *control, plMaxNod } plController *hsControlConverter::MakeRotController(Control *control, plMaxNode *node, hsBool camRot /* = false */, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { ISetSegRange(start, end); @@ -532,7 +532,7 @@ plController *hsControlConverter::MakeRotController(Control *control, plMaxNode return NULL; } -void hsControlConverter::ScalePositionController(plController* ctl, hsScalar scale) +void hsControlConverter::ScalePositionController(plController* ctl, float scale) { plLeafController* simp = plLeafController::ConvertNoRef(ctl); plCompoundController* comp; @@ -565,7 +565,7 @@ void hsControlConverter::ScalePositionController(plController* ctl, hsScalar sca } } -void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, hsScalar maxRads) +void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, float maxRads) { hsGuardBegin("hsControlConverter::MaxSampleAngles"); @@ -596,7 +596,7 @@ void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab } plCompoundController *hsControlConverter::MakeTransformController(Control *control, plMaxNode *node, - hsScalar start /* = -1 */, hsScalar end /* = -1 */) + float start /* = -1 */, float end /* = -1 */) { hsGuardBegin("hsControlConverter::MakeTransformController"); @@ -658,7 +658,7 @@ plCompoundController *hsControlConverter::MakeTransformController(Control *contr hsGuardEnd; } -void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end) +void hsControlConverter::ISetSegRange(float start, float end) { fSegStart = (start >= 0 ? fTicksPerSec * start : fInterface->GetAnimRange().Start()); fSegEnd = (end >= 0 ? fTicksPerSec * end : fInterface->GetAnimRange().End()); @@ -666,7 +666,7 @@ void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end) void hsControlConverter::IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, - hsScalar start, hsScalar end) + float start, float end) { if (control) { @@ -776,7 +776,7 @@ plLeafController* hsControlConverter::ICreateQuatController(plMaxNode* node, Con { // Get key ikeys->GetKey(i, key); - const float kMaxRads = hsScalarPI* 0.5f; + const float kMaxRads = M_PI* 0.5f; Tab kTimes; kTimes.ZeroCount(); if( rotation ) @@ -985,7 +985,7 @@ int hsControlConverter::IAddPartsKeys(Control* control, { // Get key ikeys->GetKey(i, key); - hsScalar frameTime = key->time / GetTicksPerSec(); + float frameTime = key->time / GetTicksPerSec(); int frameNum = key->time / GetTicksPerFrame(); hsAssert(frameNum <= hsKeyFrame::kMaxFrameNumber, "Anim is too long."); @@ -1067,7 +1067,7 @@ bool hsControlConverter::StdUVGenToHsMatrix44(hsMatrix44* hsMat, StdUVGen* uvGen for( i = 0; i < 2; i++ ) { if( fabsf(hsMat->fMap[i][3]) > 1.f ) - hsMat->fMap[i][3] -= hsScalar(int(hsMat->fMap[i][3])); + hsMat->fMap[i][3] -= float(int(hsMat->fMap[i][3])); } } @@ -2095,8 +2095,8 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray EvalWorldState(hsConverterUtils::Instance().GetTime(node->GetInterface())).obj; GenCamera* theCam; - hsTArray fovW; - hsTArray fovH; + hsTArray fovW; + hsTArray fovH; for (i=0; i < kfArray->Count(); i++) { TimeValue t = TimeValue(GetTicksPerFrame() * (kfArray[0][i].fFrame)); @@ -2107,7 +2107,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray GetFOVType(); - hsScalar wDeg, hDeg; + float wDeg, hDeg; switch(FOVType) { case 0: // FOV_W diff --git a/Sources/Tools/MaxConvert/hsControlConverter.h b/Sources/Tools/MaxConvert/hsControlConverter.h index 87a36793..82592b29 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.h +++ b/Sources/Tools/MaxConvert/hsControlConverter.h @@ -106,17 +106,17 @@ public: // (ISetSegRange(-1, -1) will give you the entire anim.) plLeafController* MakeMatrix44Controller(StdUVGen* uvGen, const char* nodeName); plLeafController* MakeMatrix44Controller(Control* prsControl); - plLeafController* MakeScalarController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1); - plController* MakeColorController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1); - plController* MakePosController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1); - plController* MakeScaleController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1); - plController* MakeRotController(Control* control, plMaxNode* node, hsBool camRot = false, hsScalar start = -1, hsScalar end = -1); - plCompoundController* MakeTransformController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1); + plLeafController* MakeScalarController(Control* control, plMaxNode* node, float start = -1, float end = -1); + plController* MakeColorController(Control* control, plMaxNode* node, float start = -1, float end = -1); + plController* MakePosController(Control* control, plMaxNode* node, float start = -1, float end = -1); + plController* MakeScaleController(Control* control, plMaxNode* node, float start = -1, float end = -1); + plController* MakeRotController(Control* control, plMaxNode* node, hsBool camRot = false, float start = -1, float end = -1); + plCompoundController* MakeTransformController(Control* control, plMaxNode* node, float start = -1, float end = -1); // This last one was in tempAnim.cpp on its own for some time, apparently created // as an initial attempt to get anims working in Max. It's still used, so I don't want // to nuke it, but it made sense to move it here. - plController* ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, hsScalar start = -1, hsScalar end = -1); + plController* ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, float start = -1, float end = -1); // // ////////////////////////////////////////////////////////////////////////// @@ -124,10 +124,10 @@ public: void Matrix3ToHsMatrix44(Matrix3* m3, hsMatrix44* hsM); Matrix3 StdUVGenToMatrix3(StdUVGen* uvGen); bool StdUVGenToHsMatrix44(hsMatrix44* hsMat, StdUVGen* uvGen, bool preserveOffset=false); - void MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, hsScalar maxRads); - void ScalePositionController(plController* ctl, hsScalar scale); + void MaxSampleAngles(const char* nodeName, Control* ctl, Tab& kTimes, float maxRads); + void ScalePositionController(plController* ctl, float scale); - void ReduceKeys(Control *control, hsScalar threshold); + void ReduceKeys(Control *control, float threshold); hsBool HasKeyTimes(Control* ctl); uint8_t GetKeyType(Control* ctl, hsBool rotQuat = false); @@ -150,8 +150,8 @@ public: float GetAnimLength() { return fAnimLength; } private: - void ISetSegRange(hsScalar start, hsScalar end); - void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, hsScalar start, hsScalar end); + void ISetSegRange(float start, float end); + void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, float start, float end); plLeafController* ICreateSimpleRotController(plMaxNode* node, Control* control, hsBool camRot = false); plLeafController* ICreateSimpleScaleController(plMaxNode* node, Control* control); @@ -189,7 +189,7 @@ private: int32_t fStartFrame; int32_t fEndFrame; int32_t fNumFrames; - hsScalar fAnimLength; + float fAnimLength; hsBool fWarned; hsBool fForceLocal; diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp index 8a3c3cb3..d4cb7007 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp @@ -287,8 +287,8 @@ hsBool hsMaterialConverter::PreserveUVOffset(Mtl* mtl) void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat) { const int numKeys = 2; - hsScalar times[] = {0.f, 1.5f}; - hsScalar values[numKeys] = {100.f, 0.f}; + float times[] = {0.f, 1.5f}; + float values[numKeys] = {100.f, 0.f}; hsBool leaving[] = {true, false}; char *animName = "_link_anim"; @@ -304,7 +304,7 @@ void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat) sprintf(suff, "%d", k); opaCtl = TRACKED_NEW plLeafController; - opaCtl->QuickScalarController(numKeys, times, values, sizeof(hsScalar)); + opaCtl->QuickScalarController(numKeys, times, values, sizeof(float)); animLayer = TRACKED_NEW plLayerLinkAnimation; animLayer->SetLinkKey(node->GetAvatarSO()->GetKey()); //animLayer->fLeavingAge = leaving[x]; @@ -1344,9 +1344,9 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node) hsgResMgr::ResMgr()->NewKey(TSTR(hMat->GetKeyName()) + TSTR("_DefLay"), layer, loc); DWORD color = node->GetWireColor(); - hsScalar r = hsScalar(GetRValue(color)) / 255.f; - hsScalar g = hsScalar(GetGValue(color)) / 255.f; - hsScalar b = hsScalar(GetBValue(color)) / 255.f; + float r = float(GetRValue(color)) / 255.f; + float g = float(GetGValue(color)) / 255.f; + float b = float(GetBValue(color)) / 255.f; layer->SetRuntimeColor(hsColorRGBA().Set(r, g, b, 1.f)); layer->SetPreshadeColor(hsColorRGBA().Set(r, g, b, 1.f)); layer->SetOpacity(1.f); @@ -1793,8 +1793,8 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, baseLay->SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f) ); baseLay->SetSpecularPower( 0 ); - baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); + baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); baseLay->SetPreshadeColor(hsColorRGBA().Set(0.f,0.f,0.f,1.f)); baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later @@ -1870,8 +1870,8 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM if (mtl->GetLoop()) { // Default to the entire anim - hsScalar loopStart = tc.GetBegin(); - hsScalar loopEnd = tc.GetEnd(); + float loopStart = tc.GetBegin(); + float loopEnd = tc.GetEnd(); // If there's a loop, use it const char *loopName = mtl->GetAnimLoopName(); @@ -1885,7 +1885,7 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM tc.Loop(false); } -void StuffStopPoints(SegmentMap *segMap, hsTArray &out) +void StuffStopPoints(SegmentMap *segMap, hsTArray &out) { if (segMap == nil) return; @@ -2111,7 +2111,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c { hsControlConverter& cc = hsControlConverter::Instance(); - hsScalar maxLength = 0; + float maxLength = 0; // // Look for animations. These will get tacked onto the base pass layer Control *maxColCtl = mtl->GetPreshadeColorController(); @@ -2451,13 +2451,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs if (baseLay->GetShadeFlags() & hsGMatState::kShadeSpecular) { - baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) ); + baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) ); baseLay->SetSpecularPower(shine); } - baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); - baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1)); + baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); + baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f)); baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later uint32_t blendType = 0; @@ -2550,13 +2550,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs if (hLay->GetShadeFlags() & hsGMatState::kShadeSpecular) { - hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) ); + hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) ); hLay->SetSpecularPower(shine); } - hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1)); - hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1)); - hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1)); + hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f)); + hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f)); + hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f)); hLay->SetOpacity( opac ); if( IsBumpLayer(texMap) || IsBumpMtl( mtl ) ) @@ -2713,7 +2713,7 @@ hsBool hsMaterialConverter::IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvG hsGuardEnd; } -void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale) +void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, float scale) { hsGuardBegin("hsMaterialConverter::IScaleLayerOpacity"); @@ -2724,7 +2724,7 @@ void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale) hLay->SetBlendFlags(hLay->GetBlendFlags() | hsGMatState::kBlendAlpha); } - hsScalar opac = hLay->GetOpacity(); + float opac = hLay->GetOpacity(); opac *= scale; hLay->SetOpacity(scale); } @@ -2894,7 +2894,7 @@ static float IClampToRange(float v, float lo, float hi) return v; } -uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1) +uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1) { if( node->HasFade() ) { @@ -2984,7 +2984,7 @@ uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, } if( tr0 > tr1 ) { - hsScalar t; + float t; t = tr0; tr0 = tr1; tr1 = t; @@ -3010,16 +3010,16 @@ uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, break; case kFunkyNormal: case kFunkyUp: - tr0 = hsCosine(hsScalarDegToRad(tr0)); - op0 = hsCosine(hsScalarDegToRad(op0)); - op1 = hsCosine(hsScalarDegToRad(op1)); - tr1 = hsCosine(hsScalarDegToRad(tr1)); + tr0 = cos(hsDegreesToRadians(tr0)); + op0 = cos(hsDegreesToRadians(op0)); + op1 = cos(hsDegreesToRadians(op1)); + tr1 = cos(hsDegreesToRadians(tr1)); break; case kFunkyReflect: - tr0 = hsCosine(hsScalarDegToRad(tr0)); - op0 = hsCosine(hsScalarDegToRad(op0)); - op1 = hsCosine(hsScalarDegToRad(op1)); - tr1 = hsCosine(hsScalarDegToRad(tr1)); + tr0 = cos(hsDegreesToRadians(tr0)); + op0 = cos(hsDegreesToRadians(op0)); + op1 = cos(hsDegreesToRadians(op1)); + tr1 = cos(hsDegreesToRadians(tr1)); break; } return funkyType; @@ -3267,14 +3267,14 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat) } -hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist) +hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist) { const char* dbgNodeName = node->GetName(); const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno"; if( node->HasFade() ) { - const hsScalar kMaxMaxDist = 1.e10f; + const float kMaxMaxDist = 1.e10f; Box3 fade = node->GetFade(); minDist = maxDist = 0; if( fade.Min()[2] < 0 ) @@ -3300,7 +3300,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& return HasVisDists(node, mtl, minDist, maxDist); } -hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& minDist, hsScalar& maxDist) +hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, float& minDist, float& maxDist) { const char* dbgNodeName = node->GetName(); const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno"; @@ -3328,7 +3328,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min hsBool baseFunky = false; hsBool topFunky = true; plPassMtl* passMtl = (plPassMtl*)mtl; - hsScalar tr0, op0, op1, tr1; + float tr0, op0, op1, tr1; uint32_t funkyType = IGetOpacityRanges(node, mtl->GetSubTexmap(0), tr0, op0, op1, tr1); if( kFunkyDistance == (funkyType & kFunkyMask) ) @@ -3375,7 +3375,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min int i; for( i = 0; i < mtl->NumSubMtls(); i++ ) { - hsScalar minD, maxD; + float minD, maxD; if( !HasVisDists(node, mtl->GetSubMtl(i), minD, maxD) ) return false; @@ -3995,22 +3995,22 @@ BMM_Color_64 hsMaterialConverter::ICubeSample(Bitmap *bitmap[6], double phi, dou } else { - if( (theta <= (hsScalarPI / 2.0 - hsScalarPI/4.0)) - ||(theta >= (hsScalarPI * 2.0 - hsScalarPI/4.0)) ) + if( (theta <= (M_PI / 2.0 - M_PI/4.0)) + ||(theta >= (M_PI * 2.0 - M_PI/4.0)) ) { map = bitmap[VIEW_FR]; xMap = x / y; yMap = -z / y; } else - if( theta <= (hsScalarPI - hsScalarPI/4.0) ) + if( theta <= (M_PI - M_PI/4.0) ) { map = bitmap[VIEW_LF]; xMap = -y / x; yMap = -z / x; } else - if( theta <= (hsScalarPI * 3.0/2.0 - hsScalarPI/4.0) ) + if( theta <= (M_PI * 3.0/2.0 - M_PI/4.0) ) { map = bitmap[VIEW_BK]; xMap = x / y; diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.h b/Sources/Tools/MaxConvert/hsMaterialConverter.h index 9dfa9761..492d3ff5 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.h +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.h @@ -150,8 +150,8 @@ public: static hsBool HasBumpLayer(plMaxNode* node, Mtl* mtl); static BitmapTex* GetBumpLayer(plMaxNode* node, Mtl* mtl); - static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, hsScalar& minDist, hsScalar& maxDist); - static hsBool HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist); + static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, float& minDist, float& maxDist); + static hsBool HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist); static hsBool IMustBeUniqueMaterial( Mtl *mtl ); static hsBool IMustBeUniqueLayer( Texmap *layer ); @@ -303,7 +303,7 @@ private: #endif // ... and so forth hsBool IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvGen); - void IScaleLayerOpacity(plLayer* hLay, hsScalar scale); + void IScaleLayerOpacity(plLayer* hLay, float scale); hsGMaterial *ICheckForProjectedTexture(plMaxNode *node); hsGMaterial *IWrapTextureInMaterial(Texmap *texMap, plMaxNode *node); @@ -329,7 +329,7 @@ private: static void IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsGMaterial* mat); static hsBool IHasFunkyOpacity(plMaxNode* node, Texmap* texMap); static uint32_t IGetFunkyType(Texmap* texMap); - static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1); + static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1); Interface *fInterface; hsConverterUtils& fConverterUtils; diff --git a/Sources/Tools/MaxConvert/plBitmapCreator.h b/Sources/Tools/MaxConvert/plBitmapCreator.h index 027d15b1..3c5f198e 100644 --- a/Sources/Tools/MaxConvert/plBitmapCreator.h +++ b/Sources/Tools/MaxConvert/plBitmapCreator.h @@ -63,10 +63,10 @@ public: const char *fileName; uint32_t texFlags; uint32_t createFlags; - hsScalar detailDropoffStart; - hsScalar detailDropoffStop; - hsScalar detailMax; - hsScalar detailMin; + float detailDropoffStart; + float detailDropoffStop; + float detailMax; + float detailMin; float sig; hsBool isStaticCubicEnvMap; hsBool invertAlpha; diff --git a/Sources/Tools/MaxConvert/plClusterUtil.cpp b/Sources/Tools/MaxConvert/plClusterUtil.cpp index 6073f46c..8dba0000 100644 --- a/Sources/Tools/MaxConvert/plClusterUtil.cpp +++ b/Sources/Tools/MaxConvert/plClusterUtil.cpp @@ -85,7 +85,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com plConst(int) kDefMinFaces(200); plConst(int) kDefMaxFaces(1000); -plConst(hsScalar) kDefMinSize(50.f); +plConst(float) kDefMinSize(50.f); plClusterUtil::plClusterUtil() : fGroup(nil), @@ -159,11 +159,11 @@ void plClusterUtil::ISetupGroupFromTemplate(plMaxNode* templ) } if( templ->HasFade() ) { - hsScalar maxDist = 0; - hsScalar minDist = 0; + float maxDist = 0; + float minDist = 0; Box3 fade = templ->GetFade(); - const hsScalar kMaxMaxDist = 1.e10f; + const float kMaxMaxDist = 1.e10f; if( fade.Min()[2] < 0 ) { minDist = fade.Min()[0]; @@ -197,10 +197,10 @@ public: uint16_t fIdx0; uint16_t fIdx1; uint16_t fIdx2; - hsScalar fDist; + float fDist; sortData() {} - sortData(uint16_t idx0, uint16_t idx1, uint16_t idx2, hsScalar dist) + sortData(uint16_t idx0, uint16_t idx1, uint16_t idx2, float dist) : fIdx0(idx0), fIdx1(idx1), fIdx2(idx2), fDist(dist) { } @@ -520,19 +520,19 @@ void plClusterUtil::IFreeClustersRecur(plL2WTabTab& dst) const delete dst[i]; } -inline hsScalar inlGetAlpha(uint32_t* color) +inline float inlGetAlpha(uint32_t* color) { - return hsScalar(*color >> 24) / 255.99f; + return float(*color >> 24) / 255.99f; } plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColorTabTab& colorsTab) { hsBool hasColor = false; hsBool hasAlpha = false; - hsScalar maxLenSq = 0; - hsScalar maxX = 0; - hsScalar maxY = 0; - hsScalar maxZ = 0; + float maxLenSq = 0; + float maxX = 0; + float maxY = 0; + float maxZ = 0; int i; for( i = 0; i < delPosTab.Count(); i++ ) { @@ -542,10 +542,10 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor plPoint3Tab& delPos = *delPosTab[i]; for( j = 0; j < delPos.Count(); j++ ) { - hsScalar lenSq = delPos[j].MagnitudeSquared(); + float lenSq = delPos[j].MagnitudeSquared(); if( lenSq > maxLenSq ) maxLenSq = lenSq; - hsScalar d = fabs(delPos[j].fX); + float d = fabs(delPos[j].fX); if( d > maxX ) maxX = d; d = fabs(delPos[j].fY); @@ -573,7 +573,7 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor } uint32_t code = 0; - hsScalar posScale = 1.f; + float posScale = 1.f; if( hasColor && hasAlpha ) code |= plSpanEncoding::kColAI88; @@ -582,8 +582,8 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor else if( hasAlpha ) code |= plSpanEncoding::kColA8; - plConst(hsScalar) kPosQuantum(0.5 / 12.f); // 1/2 inch. - hsScalar maxLen = hsSquareRoot(maxLenSq); + plConst(float) kPosQuantum(0.5 / 12.f); // 1/2 inch. + float maxLen = sqrt(maxLenSq); if( maxLen > kPosQuantum ) { if( (maxX < kPosQuantum) && (maxY < kPosQuantum) ) @@ -596,15 +596,15 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor code |= plSpanEncoding::kPos888; posScale = maxLen / 255.9f; } - else if( (maxLen / hsScalar(1 << 10)) < kPosQuantum ) + else if( (maxLen / float(1 << 10)) < kPosQuantum ) { code |= plSpanEncoding::kPos101010; - posScale = maxLen / hsScalar(1 << 10); + posScale = maxLen / float(1 << 10); } else { code |= plSpanEncoding::kPos161616; - posScale = maxLen / hsScalar(1 << 16); + posScale = maxLen / float(1 << 16); } } return plSpanEncoding(code, posScale); @@ -615,8 +615,8 @@ static int CompTemplates(const void *elem1, const void *elem2) plSpanTemplateB* templA = *((plSpanTemplateB**)elem1); plSpanTemplateB* templB = *((plSpanTemplateB**)elem2); - hsScalar hA = templA->GetLocalBounds().GetMaxs().fZ; - hsScalar hB = templB->GetLocalBounds().GetMaxs().fZ; + float hA = templA->GetLocalBounds().GetMaxs().fZ; + float hB = templB->GetLocalBounds().GetMaxs().fZ; if( hA < hB ) return -1; diff --git a/Sources/Tools/MaxConvert/plClusterUtil.h b/Sources/Tools/MaxConvert/plClusterUtil.h index 999a1496..ef86ff12 100644 --- a/Sources/Tools/MaxConvert/plClusterUtil.h +++ b/Sources/Tools/MaxConvert/plClusterUtil.h @@ -99,7 +99,7 @@ protected: int fMinFaces; int fMaxFaces; - hsScalar fMinSize; + float fMinSize; int fMinInsts; int fMaxInsts; diff --git a/Sources/Tools/MaxConvert/plDistributor.cpp b/Sources/Tools/MaxConvert/plDistributor.cpp index de84cf5a..8408405a 100644 --- a/Sources/Tools/MaxConvert/plDistributor.cpp +++ b/Sources/Tools/MaxConvert/plDistributor.cpp @@ -140,7 +140,7 @@ void plDistributor::IClear() fPolarRange = 0; fTanPolarRange = 0; - fAzimuthRange = hsScalarPI; + fAzimuthRange = M_PI; fOverallProb = 1.f; @@ -219,26 +219,26 @@ void plDistributor::ISetAngProbCosines() const float maxAng, minAng; if( fAngProbHi > fAngProbLo ) { - maxAng = hsScalarDegToRad(fAngProbHi); - minAng = hsScalarDegToRad(fAngProbLo); + maxAng = hsDegreesToRadians(fAngProbHi); + minAng = hsDegreesToRadians(fAngProbLo); } else { - maxAng = hsScalarDegToRad(fAngProbLo); - minAng = hsScalarDegToRad(fAngProbHi); + maxAng = hsDegreesToRadians(fAngProbLo); + minAng = hsDegreesToRadians(fAngProbHi); } - float transAng = hsScalarDegToRad(fAngProbTrans); + float transAng = hsDegreesToRadians(fAngProbTrans); if( transAng > (maxAng - minAng) * 0.5f ) transAng = (maxAng - minAng) * 0.5f; - float transAngMax = maxAng < hsScalarPI ? transAng : 0; + float transAngMax = maxAng < M_PI ? transAng : 0; float transAngMin = minAng > 0 ? transAng : 0; - fCosAngProbHi = hsCosine(minAng); - fCosAngProbLo = hsCosine(maxAng); - fCosAngProbHiTrans = hsCosine(minAng + transAngMin); - fCosAngProbLoTrans = hsCosine(maxAng - transAngMax); + fCosAngProbHi = cos(minAng); + fCosAngProbLo = cos(maxAng); + fCosAngProbHiTrans = cos(minAng + transAngMin); + fCosAngProbLoTrans = cos(maxAng - transAngMax); } BOOL plDistributor::ISetSurfaceNode(INode* surfNode) const @@ -375,15 +375,15 @@ Box3 plDistributor::ISetupGrid(const Point3& p0, const Point3& p1, const Point3& int i; for( i = 0; i < 3; i++ ) { - hsScalar t = box.Min()[i]; + float t = box.Min()[i]; t /= fSpacing; - t = hsFloor(t); + t = floor(t); t *= fSpacing; mins[i] = t; t = box.Max()[i]; t /= fSpacing; - t = hsCeil(t); + t = ceil(t); t *= fSpacing; maxs[i] = t + fSpacing*0.5f; } @@ -643,7 +643,7 @@ hsBool plDistributor::IProbablyDoIt(int iFace, Point3& del, const Point3& bary) Point3 plDistributor::IPerpAxis(const Point3& p) const { - const hsScalar kMinLengthSquared = 1.e-1f; + const float kMinLengthSquared = 1.e-1f; int minAx = p.MinComponent(); Point3 ax(0,0,0); @@ -721,7 +721,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3& Point3 rndDir = IPerpAxis(norm); Point3 rndOut = rndDir ^ norm; rndDir *= fRand.RandMinusOneToOne(); - float len = hsSquareRoot(1.f - rndDir.LengthSquared()); + float len = sqrt(1.f - rndDir.LengthSquared()); rndOut *= len; if( fRand.RandMinusOneToOne() < 0 ) rndOut *= -1.f; @@ -742,7 +742,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3& Point3 out = dir ^ norm; if( out.LengthSquared() < kMinVecLengthSq ) { - if( fAzimuthRange < hsScalarPI * 0.5f ) + if( fAzimuthRange < M_PI * 0.5f ) { l2w.IdentityMatrix(); return l2w; @@ -1311,9 +1311,9 @@ void plDistributor::IDistributeOverFace(int iFace, plDistribInstTab& reps, plMes Box3 grid = ISetupGrid(p0, p1, p2); - hsScalar delta = fSpacing; + float delta = fSpacing; - hsScalar x, y, z; + float x, y, z; for( x = grid.Min().x; x < grid.Max().x; x += delta ) { for( y = grid.Min().y; y < grid.Max().y; y += delta ) @@ -1464,7 +1464,7 @@ void plDistributor::SetRandSeed(int seed) void plDistributor::SetPolarRange(float deg) { - fPolarRange = hsScalarDegToRad(deg); + fPolarRange = hsDegreesToRadians(deg); fTanPolarRange = tan(fPolarRange); } diff --git a/Sources/Tools/MaxConvert/plDistributor.h b/Sources/Tools/MaxConvert/plDistributor.h index 5b79efac..23143474 100644 --- a/Sources/Tools/MaxConvert/plDistributor.h +++ b/Sources/Tools/MaxConvert/plDistributor.h @@ -325,10 +325,10 @@ public: float GetAlignmentWeight() const { return fAlignWgt * 100.f; } void SetPolarRange(float deg); - float GetPolarRange() const { return hsScalarRadToDeg(fPolarRange); } + float GetPolarRange() const { return hsRadiansToDegrees(fPolarRange); } - void SetAzimuthRange(float deg) { fAzimuthRange = hsScalarDegToRad(deg); } - float GetAzimuthRange() const { return hsScalarRadToDeg(fAzimuthRange); } + void SetAzimuthRange(float deg) { fAzimuthRange = hsDegreesToRadians(deg); } + float GetAzimuthRange() const { return hsRadiansToDegrees(fAzimuthRange); } void SetOverallProb(float percent) { fOverallProb = percent/100.f; } float GetOverallProb() const { return fOverallProb * 100.f; } diff --git a/Sources/Tools/MaxConvert/plLightMapGen.cpp b/Sources/Tools/MaxConvert/plLightMapGen.cpp index ac30fd6f..d80ed830 100644 --- a/Sources/Tools/MaxConvert/plLightMapGen.cpp +++ b/Sources/Tools/MaxConvert/plLightMapGen.cpp @@ -101,7 +101,7 @@ void getRGC(void* param, NotifyInfo* info) class LMGScanPoint { public: - hsScalar fU; + float fU; hsPoint3 fBary; }; @@ -191,7 +191,7 @@ hsBool plLightMapGen::Open(Interface* ip, TimeValue t, bool forceRegen) vp.yon = 30.f; vp.distance = 1.f; vp.zoom = 1.f; - vp.fov = hsScalarPI / 4.f; + vp.fov = M_PI / 4.f; vp.nearRange = 1.f; vp.farRange = 30.f; @@ -344,7 +344,7 @@ hsBool plLightMapGen::ICompressLightMaps() if( orig ) { - const hsScalar kFilterSigma = 1.0f; + const float kFilterSigma = 1.0f; if( IsFresh(orig) ) { @@ -478,7 +478,7 @@ hsBool plLightMapGen::IShadeSpan(plMaxNode* node, const hsMatrix44& l2w, const h if( !(span.fProps & plGeometrySpan::kDiffuseFoldedIn) ) { hsBool foldin = 0 != (span.fProps & plGeometrySpan::kLiteVtxNonPreshaded); - hsScalar opacity = 1.f; + float opacity = 1.f; hsColorRGBA dif = hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f); if( foldin ) { @@ -584,7 +584,7 @@ hsBool plLightMapGen::IAddToLightMap(plLayerInterface* lay, plMipmap* src) const dst->SetCurrLevel( 0 ); // BLURLATER -// static hsScalar kFilterSigma = 0.5f; +// static float kFilterSigma = 0.5f; // src->Filter(kFilterSigma); // What we really want to do here is antialias our rasterization, so we can @@ -711,8 +711,8 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons i1 = i0 == 2 ? 0 : i0+1; i2 = i1 == 2 ? 0 : i1+1; - hsScalar v0 = uv[i0].fY; - hsScalar v1 = uv[i1].fY; + float v0 = uv[i0].fY; + float v1 = uv[i1].fY; int vStart = int(v0); int vEnd = int(v1); @@ -731,7 +731,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons bary[i0] = (v1 - float(vMid)) / (v1 - v0); bary[i1] = 1.f - bary[i0]; bary[i2] = 0; - hsScalar u = uv[i0].fX * bary[i0] + float u = uv[i0].fX * bary[i0] + uv[i1].fX * bary[i1]; if( scanline[vMid].fEmpty ) { @@ -776,7 +776,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons int uMid; for( uMid = uStart; uMid <= uEnd; uMid++ ) { - hsScalar t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU); + float t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU); hsPoint3 bary = scanline[i].fNear.fBary * t; bary += scanline[i].fFar.fBary * (1.f - t); @@ -931,8 +931,8 @@ hsBool plLightMapGen::IDirAffectsNode(plLightMapInfo* liInfo, LightObject* liObj LightState ls; liObj->EvalLightState(TimeValue(0), FOREVER, &ls); - hsScalar radX = ls.fallsize; - hsScalar radY = radX; + float radX = ls.fallsize; + float radY = radX; if( ls.shape == RECT_LIGHT ) radY /= ls.aspect; @@ -968,8 +968,8 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb LightState ls; liObj->EvalLightState(TimeValue(0), FOREVER, &ls); - hsScalar coneRad[2]; - coneRad[0] = ls.fallsize * hsScalarPI / 180.f; + float coneRad[2]; + coneRad[0] = ls.fallsize * M_PI / 180.f; coneRad[1] = coneRad[0]; if( ls.shape == RECT_LIGHT ) coneRad[1] /= ls.aspect; @@ -981,13 +981,13 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb int j; for( j = 0; j < 8; j++ ) { - hsScalar rad; - rad = hsScalar(atan2(corners[j].fX, -corners[j].fZ)); + float rad; + rad = float(atan2(corners[j].fX, -corners[j].fZ)); if( rad > coneRad[0] ) numPos[0]++; if( rad < -coneRad[0] ) numPos[2]++; - rad = hsScalar(atan2(corners[j].fY, -corners[j].fZ)); + rad = float(atan2(corners[j].fY, -corners[j].fZ)); if( rad > coneRad[1] ) numPos[1]++; if( rad < -coneRad[1] ) @@ -1021,7 +1021,7 @@ hsBool plLightMapGen::IOmniAffectsNode(plLightMapInfo* liInfo, LightObject* liOb if( bnd.GetType() != kBoundsNormal ) return false; - hsScalar radius = ls.attenEnd; + float radius = ls.attenEnd; int i; for( i = 0; i < 3; i++ ) diff --git a/Sources/Tools/MaxConvert/plMeshConverter.cpp b/Sources/Tools/MaxConvert/plMeshConverter.cpp index c84ad127..d6882f18 100644 --- a/Sources/Tools/MaxConvert/plMeshConverter.cpp +++ b/Sources/Tools/MaxConvert/plMeshConverter.cpp @@ -621,7 +621,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayGetHasWaterHeight() ) { sharedSpanProps |= plGeometrySpan::kWaterHeight; @@ -1214,7 +1214,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArrayEndCreate(); - hsScalar minDist, maxDist; + float minDist, maxDist; if( hsMaterialConverter::HasVisDists(node, i, minDist, maxDist) ) { span->fMinDist = (minDist); @@ -2177,8 +2177,8 @@ void plMAXVertexAccumulator::StuffMyData( plMaxNode* maxNode, plGeometrySpan } } - hsScalar maxWgt = 0; - hsScalar penWgt = 0; + float maxWgt = 0; + float penWgt = 0; int16_t maxIdx = -1; int16_t penIdx = -1; // Find the highest two weighted bones. We'll use just these two to calculate our bounds. @@ -2327,7 +2327,7 @@ void plMAXVertexAccumulator::IFindSkinWeights( ISkinContextData *skinData, if( boneCount ) { - hsScalar defWgt = 1.f; + float defWgt = 1.f; for( i = 0; i < boneCount; i++ ) { /// Grab the weight and index for this bone @@ -2444,12 +2444,12 @@ void SetWaterColor(plGeometrySpan* span) const int nVerts = tri.VertCount(); // Now, set up our accumulators - hsTArray lens; + hsTArray lens; lens.SetCount(nVerts); - memset(lens.AcquireArray(), 0, nVerts * sizeof(hsScalar)); - hsTArray wgts; + memset(lens.AcquireArray(), 0, nVerts * sizeof(float)); + hsTArray wgts; wgts.SetCount(nVerts); - memset(wgts.AcquireArray(), 0, nVerts * sizeof(hsScalar)); + memset(wgts.AcquireArray(), 0, nVerts * sizeof(float)); // For each triangle for( triIter.Begin(); triIter.More(); triIter.Advance() ) @@ -2461,15 +2461,15 @@ void SetWaterColor(plGeometrySpan* span) // Actually, I just realized that the area way kind of sucks, because, // as a parallelogram gets less and less rectangular, the area goes down // even as the longest edge (the diagonal) gets longer. - hsScalar lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared(); - hsScalar lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared(); - hsScalar lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared(); - hsScalar len = lenSq20; + float lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared(); + float lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared(); + float lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared(); + float len = lenSq20; if( len < lenSq10 ) len = lenSq10; if( len < lenSq21 ) len = lenSq21; - len = hsSquareRoot(len); + len = sqrt(len); lens[triIter.RawIndex(0)] += len; wgts[triIter.RawIndex(0)] += 1.f; @@ -2492,9 +2492,9 @@ void SetWaterColor(plGeometrySpan* span) } // Now we might want to smooth this out some // This can be repeated for any degree of smoothing - hsTArray smLens; + hsTArray smLens; smLens.SetCount(nVerts); - memset(smLens.AcquireArray(), 0, nVerts * sizeof(hsScalar)); + memset(smLens.AcquireArray(), 0, nVerts * sizeof(float)); // For each triangle for( triIter.Begin(); triIter.More(); triIter.Advance() ) { @@ -2508,7 +2508,7 @@ void SetWaterColor(plGeometrySpan* span) smLens[iVert] += lens[iVert]; wgts[iVert] += 1.f; - const hsScalar kSmooth(8.f); + const float kSmooth(8.f); smLens[iVertNext] += lens[iVert] * kSmooth; wgts[iVertNext] += kSmooth; @@ -2526,7 +2526,7 @@ void SetWaterColor(plGeometrySpan* span) wgts[iVert] = 0.f; // We'll use them again on smoothing. } - plConst(hsScalar) kNumLens(4.f); + plConst(float) kNumLens(4.f); // Okay, we have smoothed lengths. We just need to // iterate over the vertices and stuff 1/len into the alpha channel // For each vert diff --git a/Sources/Tools/MaxConvert/plRenderInstance.cpp b/Sources/Tools/MaxConvert/plRenderInstance.cpp index e13484b1..0cd6c6da 100644 --- a/Sources/Tools/MaxConvert/plRenderInstance.cpp +++ b/Sources/Tools/MaxConvert/plRenderInstance.cpp @@ -55,7 +55,7 @@ public: plNilView() { projType = 1; - fov = hsScalarPI * 0.25f; + fov = M_PI * 0.25f; pixelSize = 1.f; affineTM.IdentityMatrix(); worldToView.IdentityMatrix(); diff --git a/Sources/Tools/MaxExport/SimpleExport.h b/Sources/Tools/MaxExport/SimpleExport.h index 3fa244f8..29094ae4 100644 --- a/Sources/Tools/MaxExport/SimpleExport.h +++ b/Sources/Tools/MaxExport/SimpleExport.h @@ -79,7 +79,7 @@ public: const char* GetName() { return fName; } private: - static hsBool IProgressCallback(hsScalar percent); + static hsBool IProgressCallback(float percent); static DWORD WINAPI IProgressDummyFunc(LPVOID arg); char fName[128]; diff --git a/Sources/Tools/MaxExport/plProgressBar.h b/Sources/Tools/MaxExport/plProgressBar.h index 18c133ef..fa0363ba 100644 --- a/Sources/Tools/MaxExport/plProgressBar.h +++ b/Sources/Tools/MaxExport/plProgressBar.h @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define plProgressBar_inc #include "hsTypes.h" -#include "hsScalar.h" + // The progress bar displays an amount that's *fraction* of the distance between min and max. // i.e., if min is 0.2 and max is 0.7, the bar will run the gamut from min to max; at fraction @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plProgressBar { public: - plProgressBar(hsScalar min, hsScalar max) : fMin(min), fMax(max) + plProgressBar(float min, float max) : fMin(min), fMax(max) { hsAssert(min >= 0, "Min too small."); hsAssert(min <= 1, "Min too big."); @@ -63,13 +63,13 @@ public: hsAssert(min <= max, "Min and max out of order."); } - virtual hsBool32 Update(hsScalar fraction) = 0; + virtual hsBool32 Update(float fraction) = 0; - hsScalar GetTotalFraction(hsScalar f) const { return fMin + f * (fMax - fMin); } + float GetTotalFraction(float f) const { return fMin + f * (fMax - fMin); } private: - hsScalar fMin; - hsScalar fMax; + float fMin; + float fMax; }; #endif // plProgressBar_inc \ No newline at end of file diff --git a/Sources/Tools/MaxMain/plMaxNode.cpp b/Sources/Tools/MaxMain/plMaxNode.cpp index a38d7dc7..9ea697ad 100644 --- a/Sources/Tools/MaxMain/plMaxNode.cpp +++ b/Sources/Tools/MaxMain/plMaxNode.cpp @@ -975,15 +975,15 @@ hsBool plMaxNode::MakeModifiers(plErrorMsg *pErrMsg, plConvertSettings *settings switch( nGot ) { case 0: - scale.fZ = hsScalar(atof(token)); + scale.fZ = float(atof(token)); break; case 1: scale.fX = scale.fZ; - scale.fY = hsScalar(atof(token)); + scale.fY = float(atof(token)); scale.fZ = 1.f; break; case 2: - scale.fZ = hsScalar(atof(token)); + scale.fZ = float(atof(token)); break; } nGot++; @@ -1114,7 +1114,7 @@ int IsGeoSpanConvexExhaust(const plGeometrySpan* span) hsVector3 faceNorm = edge01 % edge02; hsFastMath::NormalizeAppr(faceNorm); - hsScalar faceDist = faceNorm.InnerProduct(pos[0]); + float faceDist = faceNorm.InnerProduct(pos[0]); int j; for( j = 0; j < numVerts; j++ ) @@ -1122,9 +1122,9 @@ int IsGeoSpanConvexExhaust(const plGeometrySpan* span) hsPoint3* p = (hsPoint3*)(vertData + idx[0] * stride); - hsScalar dist = p->InnerProduct(faceNorm) - faceDist; + float dist = p->InnerProduct(faceNorm) - faceDist; - const hsScalar kSmall = 1.e-3f; + const float kSmall = 1.e-3f; if( dist < -kSmall ) someIn = true; else if( dist > kSmall ) @@ -1171,7 +1171,7 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) hsTArray* vertList = TRACKED_NEW hsTArray [numVerts]; hsTArray* normList = TRACKED_NEW hsTArray [numVerts]; - hsTArray* distList = TRACKED_NEW hsTArray [numVerts]; + hsTArray* distList = TRACKED_NEW hsTArray [numVerts]; uint16_t* idx = span->fIndexData; @@ -1194,7 +1194,7 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) hsVector3 faceNorm = edge01 % edge02; hsFastMath::NormalizeAppr(faceNorm); - hsScalar faceDist = faceNorm.InnerProduct(pos[0]); + float faceDist = faceNorm.InnerProduct(pos[0]); // For each vert @@ -1230,9 +1230,9 @@ int IsGeoSpanConvex(plMaxNode* node, const plGeometrySpan* span) for( j = 0; j < vertList[i].GetCount(); j++ ) { hsPoint3* pos = (hsPoint3*)(vertData + vertList[i][j] * stride); - hsScalar dist = pos->InnerProduct(normList[i][k]) - distList[i][k]; + float dist = pos->InnerProduct(normList[i][k]) - distList[i][k]; - const hsScalar kSmall = 1.e-3f; + const float kSmall = 1.e-3f; if( dist < -kSmall ) someIn = true; else if( dist > kSmall ) @@ -1806,7 +1806,7 @@ hsBool plMaxNode::IMakeInstanceSpans( plMaxNode *node, hsTArraymesh); - const float kNormThresh = hsScalarPI / 20.f; - const float kEdgeThresh = hsScalarPI / 20.f; + const float kNormThresh = M_PI / 20.f; + const float kEdgeThresh = M_PI / 20.f; const float kBias = 0.1f; const float kMaxEdge = -1.f; const DWORD kOptFlags = OPTIMIZE_SAVESMOOTHBOUNDRIES; @@ -2137,7 +2137,7 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool // mnMesh.MakeConvexPolyMesh(); mnMesh.MakePolyMesh(); mnMesh.MakeConvex(); -// mnMesh.MakePlanar(1.f * hsScalarPI / 180.f); // Completely ineffective. Winding up with majorly non-planar polys. +// mnMesh.MakePlanar(1.f * M_PI / 180.f); // Completely ineffective. Winding up with majorly non-planar polys. mnMesh.Transform(maxV2L); @@ -2204,13 +2204,13 @@ hsBool plMaxNode::ConvertToOccluder(plErrorMsg* pErrMsg, hsBool twoSided, hsBool hsFastMath::Normalize(bXc); - hsScalar dotSq = aXb.InnerProduct(bXc); + float dotSq = aXb.InnerProduct(bXc); dotSq *= dotSq; - const hsScalar kMinLenSq = 1.e-8f; - const hsScalar kMinDotFracSq = 0.998f * 0.998f; + const float kMinLenSq = 1.e-8f; + const float kMinDotFracSq = 0.998f * 0.998f; - hsScalar lenSq = aXb.MagnitudeSquared() * bXc.MagnitudeSquared(); + float lenSq = aXb.MagnitudeSquared() * bXc.MagnitudeSquared(); if( lenSq < kMinLenSq ) continue; @@ -2358,7 +2358,7 @@ void plMaxNode::IGetLightAttenuation(plOmniLightInfo* liInfo, LightObject* light { TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); - hsScalar attenConst, attenLinear, attenQuadratic; + float attenConst, attenLinear, attenQuadratic; float intens = ls.intens >= 0 ? ls.intens : -ls.intens; float attenEnd = ls.attenEnd; @@ -2399,7 +2399,7 @@ void plMaxNode::IGetLightAttenuation(plOmniLightInfo* liInfo, LightObject* light } -hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& attenConst, hsScalar& attenLinear, hsScalar& attenQuadratic, hsScalar &attenCutoff ) +hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, float& attenConst, float& attenLinear, float& attenQuadratic, float &attenCutoff ) { TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); @@ -2455,7 +2455,7 @@ hsBool plMaxNode::IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& atten void plMaxNode::IGetRTLightAttenuation(plOmniLightInfo* liInfo, IParamBlock2* ProperPB) { - hsScalar attenConst, attenLinear, attenQuadratic, attenCutoff; + float attenConst, attenLinear, attenQuadratic, attenCutoff; if( IGetRTLightAttenValues(ProperPB, attenConst, attenLinear, attenQuadratic, attenCutoff) ) { @@ -2513,8 +2513,8 @@ void plMaxNode::IGetRTLightColors(plLightInfo* liInfo, IParamBlock2* ProperPB) void plMaxNode::IGetCone(plSpotLightInfo* liInfo, LightObject* light, LightState& ls) { - hsScalar inner = hsScalarDegToRad(ls.hotsize); - hsScalar outer = hsScalarDegToRad(ls.fallsize); + float inner = hsDegreesToRadians(ls.hotsize); + float outer = hsDegreesToRadians(ls.fallsize); /// 4.26.2001 mcn - MAX gives us full angles, but we want to store half angles liInfo->SetSpotInner( inner / 2.0f ); @@ -2527,10 +2527,10 @@ void plMaxNode::IGetRTCone(plSpotLightInfo* liInfo, IParamBlock2* ProperPB) //TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); TimeValue timeVal = hsConverterUtils::Instance().GetTime(GetInterface()); - hsScalar inner, outer; + float inner, outer; - inner = hsScalarDegToRad(ProperPB->GetFloat(plRTLightBase::kHotSpot, timeVal)); //ls.hotsize); - outer = hsScalarDegToRad(ProperPB->GetFloat(plRTLightBase::kFallOff, timeVal)); //ls.fallsize); + inner = hsDegreesToRadians(ProperPB->GetFloat(plRTLightBase::kHotSpot, timeVal)); //ls.hotsize); + outer = hsDegreesToRadians(ProperPB->GetFloat(plRTLightBase::kFallOff, timeVal)); //ls.fallsize); /// 4.26.2001 mcn - MAX gives us full angles, but we want to store half angles liInfo->SetSpotInner( inner / 2.0f ); @@ -3015,10 +3015,10 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) hsScalarKey *key = subCtl->GetScalarKey(i); if (key) { - hsScalar attenEnd = key->fValue; + float attenEnd = key->fValue; TimeValue tv = key->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); - hsScalar newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; if( distSq ) newVal /= attenEnd; @@ -3027,10 +3027,10 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) hsBezScalarKey *bezKey = subCtl->GetBezScalarKey(i); if (bezKey) { - hsScalar attenEnd = bezKey->fValue; + float attenEnd = bezKey->fValue; TimeValue tv = bezKey->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); - hsScalar newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float newVal = (intens * plSillyLightKonstants::GetFarPowerKonst() - 1.f) / attenEnd; if( distSq ) newVal /= attenEnd; @@ -3059,7 +3059,7 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) anim->ExtendToLength(subCtl->GetLength()); - hsScalar attenConst, attenLinear, attenQuadratic, attenCutoff; + float attenConst, attenLinear, attenQuadratic, attenCutoff; IGetRTLightAttenValues(ProperPB, attenConst, attenLinear, attenQuadratic, attenCutoff); plOmniLightInfo *info = plOmniLightInfo::ConvertNoRef(GetSceneObject()->GetGenericInterface(plOmniLightInfo::Index())); @@ -3091,14 +3091,14 @@ void plMaxNode::IAdjustRTColorByIntensity(plController* ctl, IParamBlock2* Prope if (key) { TimeValue tv = key->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); key->fValue *= intens; } hsBezPoint3Key* bezKey = simp->GetBezPoint3Key(i); if (bezKey) { TimeValue tv = bezKey->fFrame * MAX_TICKS_PER_FRAME; - hsScalar intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); + float intens = ProperPB->GetFloat(plRTLightBase::kIntensity, tv); bezKey->fInTan *= intens; bezKey->fOutTan *= intens; bezKey->fValue *= intens; diff --git a/Sources/Tools/MaxMain/plMaxNode.h b/Sources/Tools/MaxMain/plMaxNode.h index f18a7497..34cfb5e5 100644 --- a/Sources/Tools/MaxMain/plMaxNode.h +++ b/Sources/Tools/MaxMain/plMaxNode.h @@ -206,7 +206,7 @@ protected: void IGetRTLightColors(plLightInfo* liInfo, IParamBlock2* ProperPB); void IGetRTLightAttenuation(plOmniLightInfo* liInfo, IParamBlock2* ProperPB); // RunTime Light animation builders - hsBool IGetRTLightAttenValues(IParamBlock2* ProperPB, hsScalar& attenConst, hsScalar& attenLinear, hsScalar& attenQuadratic,hsScalar &attenCutoff); + hsBool IGetRTLightAttenValues(IParamBlock2* ProperPB, float& attenConst, float& attenLinear, float& attenQuadratic,float &attenCutoff); void IAdjustRTColorByIntensity(plController* ctl, IParamBlock2* ProperPB); hsBool IAttachRTLightModifier(plLightModifier* liMod); diff --git a/Sources/Tools/MaxMain/plMaxNodeBase.cpp b/Sources/Tools/MaxMain/plMaxNodeBase.cpp index acc97298..ac8e7bc9 100644 --- a/Sources/Tools/MaxMain/plMaxNodeBase.cpp +++ b/Sources/Tools/MaxMain/plMaxNodeBase.cpp @@ -130,7 +130,7 @@ hsBool plMaxNodeBase::GetReverseSort() { GetMD; return (pMD) ? hsBool plMaxNodeBase::GetSortAsOpaque() { GetMD; return (pMD) ? pMD->GetSortAsOpaque() : nil;} hsBool plMaxNodeBase::GetVS() { GetMD; return (pMD) ? pMD->GetVS() : nil;} hsBool plMaxNodeBase::GetHasWaterHeight() { GetMD; return (pMD) ? pMD->GetHasWaterHeight() : nil; } -hsScalar plMaxNodeBase::GetWaterHeight() { GetMD; return (pMD) ? pMD->GetWaterHeight() : nil; } +float plMaxNodeBase::GetWaterHeight() { GetMD; return (pMD) ? pMD->GetWaterHeight() : nil; } hsBool plMaxNodeBase::GetSmoothAll() { GetMD; return (pMD) ? pMD->GetSmoothAll() : nil;} hsBool plMaxNodeBase::GetForceSortable() { GetMD; return (pMD) ? pMD->GetForceSortable() : nil;} hsBool plMaxNodeBase::GetConcave() { GetMD; return (pMD) ? pMD->GetConcave() : nil;} @@ -178,7 +178,7 @@ uint32_t plMaxNodeBase::GetSwappableGeomTarget() { GetMD; return (p plMaxBoneMap* plMaxNodeBase::GetBoneMap() { GetMD; return (pMD) ? pMD->GetBoneMap() : nil; } hsBool plMaxNodeBase::GetOverrideHighLevelSDL() { GetMD; return (pMD) ? pMD->GetOverrideHighLevelSDL() : false; } uint8_t plMaxNodeBase::GetAnimCompress() { GetMD; return (pMD) ? pMD->GetAnimCompress() : false; } -hsScalar plMaxNodeBase::GetKeyReduceThreshold() { GetMD; return (pMD) ? pMD->GetKeyReduceThreshold() : 0; } +float plMaxNodeBase::GetKeyReduceThreshold() { GetMD; return (pMD) ? pMD->GetKeyReduceThreshold() : 0; } int plMaxNodeBase::NumRenderDependencies() { GetMD; return (pMD) ? pMD->NumRenderDependencies() : 0; } plMaxNodeBase* plMaxNodeBase::GetRenderDependency(int i) { GetMD; return (pMD) ? pMD->GetRenderDependency(i) : nil; } @@ -203,7 +203,7 @@ void plMaxNodeBase::SetReverseSort(hsBool b) { GetMD; pMD void plMaxNodeBase::SetSortAsOpaque(hsBool b) { GetMD; pMD->SetSortAsOpaque(b); } void plMaxNodeBase::SetVS(hsBool b) { GetMD; pMD->SetVS(b); } void plMaxNodeBase::SetHasWaterHeight(hsBool b) { GetMD; pMD->SetHasWaterHeight(b); } -void plMaxNodeBase::SetWaterHeight(hsScalar h) { GetMD; pMD->SetWaterHeight(h); } +void plMaxNodeBase::SetWaterHeight(float h) { GetMD; pMD->SetWaterHeight(h); } void plMaxNodeBase::SetSmoothAll(hsBool b) { GetMD; pMD->SetSmoothAll(b); } void plMaxNodeBase::SetForceSortable(hsBool b) { GetMD; pMD->SetForceSortable(b); } void plMaxNodeBase::SetConcave(hsBool b) { GetMD; pMD->SetConcave(b); } @@ -242,7 +242,7 @@ void plMaxNodeBase::SetSwappableGeomTarget(uint32_t id) { GetMD; p void plMaxNodeBase::SetBoneMap(plMaxBoneMap *bones) { GetMD; pMD->SetBoneMap(bones); } void plMaxNodeBase::SetOverrideHighLevelSDL(hsBool b) { GetMD; pMD->SetOverrideHighLevelSDL(b); } void plMaxNodeBase::SetAnimCompress(uint8_t v) { GetMD; pMD->SetAnimCompress(v); } -void plMaxNodeBase::SetKeyReduceThreshold(hsScalar v) { GetMD; pMD->SetKeyReduceThreshold(v); } +void plMaxNodeBase::SetKeyReduceThreshold(float v) { GetMD; pMD->SetKeyReduceThreshold(v); } void plMaxNodeBase::ClearRenderDependencies() { GetMD; pMD->ClearRenderDependencies(); } void plMaxNodeBase::AddBone(plMaxNodeBase* m) { GetMD; if(pMD) pMD->AddBone(m); } @@ -877,7 +877,7 @@ hsBool plMaxNodeBase::Contains(const Box3& bnd, const Matrix3& l2w) return true; } -hsScalar plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) +float plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) { Point3 corner = l2w * bnd[0]; // min, min, min float len[3]; @@ -889,7 +889,7 @@ hsScalar plMaxNodeBase::BoxVolume(const Box3& bnd, const Matrix3& l2w) return len[0] * len[1] * len[2]; } -hsScalar plMaxNodeBase::RegionPriority() +float plMaxNodeBase::RegionPriority() { TimeValue currTime = 0;//hsConverterUtils::Instance().GetTime(GetInterface()); Object *obj = EvalWorldState(currTime).obj; diff --git a/Sources/Tools/MaxMain/plMaxNodeBase.h b/Sources/Tools/MaxMain/plMaxNodeBase.h index 26ff4a5c..bab699e2 100644 --- a/Sources/Tools/MaxMain/plMaxNodeBase.h +++ b/Sources/Tools/MaxMain/plMaxNodeBase.h @@ -101,7 +101,7 @@ public: hsBool GetWaterDecEnv(); hsBool GetVS(); hsBool GetHasWaterHeight(); - hsScalar GetWaterHeight(); + float GetWaterHeight(); hsBool GetSmoothAll(); hsBool GetForceSortable(); hsBool GetConcave(); @@ -144,7 +144,7 @@ public: plMaxBoneMap* GetBoneMap(); hsBool GetOverrideHighLevelSDL(); uint8_t GetAnimCompress(); - hsScalar GetKeyReduceThreshold(); + float GetKeyReduceThreshold(); int NumRenderDependencies(); plMaxNodeBase* GetRenderDependency(int i); @@ -170,7 +170,7 @@ public: void SetSortAsOpaque(hsBool b); void SetVS(hsBool b); void SetHasWaterHeight(hsBool b); - void SetWaterHeight(hsScalar h); + void SetWaterHeight(float h); void SetSmoothAll(hsBool b); void SetForceSortable(hsBool b); void SetConcave(hsBool b); @@ -208,7 +208,7 @@ public: void SetBoneMap(plMaxBoneMap *bones); void SetOverrideHighLevelSDL(hsBool b); void SetAnimCompress(uint8_t v); - void SetKeyReduceThreshold(hsScalar v); + void SetKeyReduceThreshold(float v); hsBool AddRenderDependency(plMaxNodeBase* m); hsBool RenderDependsOn(plMaxNodeBase* m); void ClearRenderDependencies(); @@ -253,8 +253,8 @@ public: hsBool Contains(const Point3& worldPt); // is the world space point inside my (CONVEX) geometry or dummy box? hsBool Contains(const Box3& bnd, const Matrix3& l2w); // is the box contained entirely inside my (CONVEX) geometry or dummy box? - hsScalar BoxVolume(const Box3& bnd, const Matrix3& l2w); - hsScalar RegionPriority(); // returns a dominance factor. If a point is in more than one environmental + float BoxVolume(const Box3& bnd, const Matrix3& l2w); + float RegionPriority(); // returns a dominance factor. If a point is in more than one environmental // region, the region with highest priority wins. Interface *GetInterface() { return ::GetCOREInterface(); } diff --git a/Sources/Tools/MaxMain/plMaxNodeData.h b/Sources/Tools/MaxMain/plMaxNodeData.h index af932851..3190b8b1 100644 --- a/Sources/Tools/MaxMain/plMaxNodeData.h +++ b/Sources/Tools/MaxMain/plMaxNodeData.h @@ -305,8 +305,8 @@ public: hsBool GetHasWaterHeight() { return MaxDatBF.CanBF(MaxDatBF.kWaterHeight); } void SetHasWaterHeight(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kWaterHeight); } - hsScalar GetWaterHeight() { return fWaterHeight; } - void SetWaterHeight(hsScalar f) { SetHasWaterHeight(true); fWaterHeight = f; } + float GetWaterHeight() { return fWaterHeight; } + void SetWaterHeight(float f) { SetHasWaterHeight(true); fWaterHeight = f; } hsBool GetSmoothAll() {return MaxDatBF.CanBF(MaxDatBF.kSmoothAll); } void SetSmoothAll(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kSmoothAll); } @@ -414,8 +414,8 @@ public: void SetOverrideHighLevelSDL(hsBool b) { MaxDatBF.SetBF(b, MaxDatBF.kOverrideHighLevelSDL); } uint8_t GetAnimCompress() { return fAnimCompression; } void SetAnimCompress(uint8_t v) { fAnimCompression = v; } - hsScalar GetKeyReduceThreshold() { return fKeyReduceThreshold; } - void SetKeyReduceThreshold(hsScalar v) { fKeyReduceThreshold = v; } + float GetKeyReduceThreshold() { return fKeyReduceThreshold; } + void SetKeyReduceThreshold(float v) { fKeyReduceThreshold = v; } protected: plKey fpKey; @@ -441,9 +441,9 @@ protected: plSharedMesh *fSwapMesh; plMaxBoneMap *fBoneMap; plLoadMask fLoadMask; - hsScalar fWaterHeight; + float fWaterHeight; uint8_t fAnimCompression; - hsScalar fKeyReduceThreshold; + float fKeyReduceThreshold; DataBF MaxDatBF; }; diff --git a/Sources/Tools/MaxMain/plPhysXCooking.cpp b/Sources/Tools/MaxMain/plPhysXCooking.cpp index 7e544df5..69fd6a62 100644 --- a/Sources/Tools/MaxMain/plPhysXCooking.cpp +++ b/Sources/Tools/MaxMain/plPhysXCooking.cpp @@ -64,11 +64,11 @@ hsBool ThreePlaneIntersect(const NxVec3& norm0, const NxVec3& point0, //need to make sure these planes aren't parallel hsBool suc=0; NxVec3 cross=norm1.cross( norm2); - hsScalar denom=norm0.dot(cross); + float denom=norm0.dot(cross); if(abs(denom)<0.0001) return 0;//basically paralell // if we are here there must be a point in 3 space try{ - hsScalar d1,d2,d3; + float d1,d2,d3; d1=norm0.dot(point0); d2=norm1.dot(point1); d3=norm2.dot(point2); @@ -290,7 +290,7 @@ void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box) hsPoint3* pVertices = TRACKED_NEW hsPoint3[nVertices]; stream->ReadLEScalar(nVertices*3, (float*)pVertices); - hsScalar minX, minY, minZ, maxX, maxY, maxZ; + float minX, minY, minZ, maxX, maxY, maxZ; minX = minY = minZ = FLT_MAX; maxX = maxY = maxZ = -FLT_MAX; for (int i = 0; i < nVertices; i++) @@ -320,7 +320,7 @@ void ReadBoxFromHull(hsStream* stream, NxBoxShapeDesc& box) // box.localPose.setRowMajor44(&mat.fMap[0][0]); } */ -hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,hsScalar& d0, +hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,float& d0, const hsVector3 pointToProject, hsPoint3& res) { @@ -337,21 +337,21 @@ hsBool ProjectPointOnToPlane(const hsVector3& planeNormal,hsScalar& d0, void plPhysXCooking::PCA(const NxVec3* points,int numPoints, NxMat33& out) { NxVec3 mean(0.f,0.f,0.f); - hsScalar Cov[3][3]; - memset(Cov,0,9* sizeof hsScalar); + float Cov[3][3]; + memset(Cov,0,9* sizeof(float)); for(int i=0; i 0.f ) return false; diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp index f58d0292..38145092 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp @@ -144,7 +144,7 @@ SegmentSpec *plAnimStealthNode::IGetSegmentSpec( void ) const } -hsScalar plAnimStealthNode::GetSegStart( void ) const +float plAnimStealthNode::GetSegStart( void ) const { SegmentSpec *spec = IGetSegmentSpec(); if( spec != nil ) @@ -153,7 +153,7 @@ hsScalar plAnimStealthNode::GetSegStart( void ) const return 0.f; } -hsScalar plAnimStealthNode::GetSegEnd( void ) const +float plAnimStealthNode::GetSegEnd( void ) const { SegmentSpec *spec = IGetSegmentSpec(); if( spec != nil ) @@ -162,7 +162,7 @@ hsScalar plAnimStealthNode::GetSegEnd( void ) const return 0.f; } -void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const +void plAnimStealthNode::GetLoopPoints( float &start, float &end ) const { start = GetSegStart(); end = GetSegEnd(); @@ -172,7 +172,7 @@ void plAnimStealthNode::GetLoopPoints( hsScalar &start, hsScalar &end ) const GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end ); } -void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) +void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) { if( fCachedSegMap == nil ) return; @@ -191,7 +191,7 @@ void plAnimStealthNode::GetAllStopPoints( hsTArray &out ) // Handles converting all the settings we have that are applicable for an // animTimeConvert and stuffing it into said ATC. -void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength ) +void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength ) { const char *segName = GetSegmentName(); bool isEntire = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false; @@ -214,7 +214,7 @@ void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, hsSca convert.SetLoopPoints( 0, maxLength ); else { - hsScalar loopStart, loopEnd; + float loopStart, loopEnd; GetLoopPoints( loopStart, loopEnd ); convert.SetLoopPoints( loopStart, loopEnd ); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp index 626492d0..a5508a81 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp @@ -904,10 +904,10 @@ void plAnimStealthNode::SetLoop( bool b, const char *name ) } uint8_t plAnimStealthNode::GetEaseInType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseInType ); } -hsScalar plAnimStealthNode::GetEaseInLength( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInLength ); } -hsScalar plAnimStealthNode::GetEaseInMin( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInMin ); } -hsScalar plAnimStealthNode::GetEaseInMax( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseInMax ); } -void plAnimStealthNode::SetEaseIn( uint8_t type, hsScalar length, hsScalar min, hsScalar max ) +float plAnimStealthNode::GetEaseInLength( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInLength ); } +float plAnimStealthNode::GetEaseInMin( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInMin ); } +float plAnimStealthNode::GetEaseInMax( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseInMax ); } +void plAnimStealthNode::SetEaseIn( uint8_t type, float length, float min, float max ) { fParamBlock->SetValue( (ParamID)kPBEaseInType, 0, (int)type ); fParamBlock->SetValue( (ParamID)kPBEaseInLength, 0, (float)length ); @@ -916,10 +916,10 @@ void plAnimStealthNode::SetEaseIn( uint8_t type, hsScalar length, hsScala } uint8_t plAnimStealthNode::GetEaseOutType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseOutType ); } -hsScalar plAnimStealthNode::GetEaseOutLength( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutLength ); } -hsScalar plAnimStealthNode::GetEaseOutMin( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutMin ); } -hsScalar plAnimStealthNode::GetEaseOutMax( void ) const { return (hsScalar)fParamBlock->GetFloat( (ParamID)kPBEaseOutMax ); } -void plAnimStealthNode::SetEaseOut( uint8_t type, hsScalar length, hsScalar min, hsScalar max ) +float plAnimStealthNode::GetEaseOutLength( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutLength ); } +float plAnimStealthNode::GetEaseOutMin( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutMin ); } +float plAnimStealthNode::GetEaseOutMax( void ) const { return (float)fParamBlock->GetFloat( (ParamID)kPBEaseOutMax ); } +void plAnimStealthNode::SetEaseOut( uint8_t type, float length, float min, float max ) { fParamBlock->SetValue( (ParamID)kPBEaseOutType, 0, (int)type ); fParamBlock->SetValue( (ParamID)kPBEaseOutLength, 0, (float)length ); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h index c53d72b2..3968a7c9 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.h @@ -207,23 +207,23 @@ public: void SetLoop( bool b, const char *name ); uint8_t GetEaseInType( void ) const; - hsScalar GetEaseInLength( void ) const; - hsScalar GetEaseInMin( void ) const; - hsScalar GetEaseInMax( void ) const; - void SetEaseIn( uint8_t type, hsScalar length, hsScalar min, hsScalar max ); + float GetEaseInLength( void ) const; + float GetEaseInMin( void ) const; + float GetEaseInMax( void ) const; + void SetEaseIn( uint8_t type, float length, float min, float max ); uint8_t GetEaseOutType( void ) const; - hsScalar GetEaseOutLength( void ) const; - hsScalar GetEaseOutMin( void ) const; - hsScalar GetEaseOutMax( void ) const; - void SetEaseOut( uint8_t type, hsScalar length, hsScalar min, hsScalar max ); + float GetEaseOutLength( void ) const; + float GetEaseOutMin( void ) const; + float GetEaseOutMax( void ) const; + void SetEaseOut( uint8_t type, float length, float min, float max ); // Conversion stuff - void GetAllStopPoints( hsTArray &out ); - hsScalar GetSegStart( void ) const; - hsScalar GetSegEnd( void ) const; - void GetLoopPoints( hsScalar &start, hsScalar &end ) const; - void StuffToTimeConvert( plAnimTimeConvert &convert, hsScalar maxLength ); + void GetAllStopPoints( hsTArray &out ); + float GetSegStart( void ) const; + float GetSegEnd( void ) const; + void GetLoopPoints( float &start, float &end ) const; + void StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength ); // plAnimObjInterface functions virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID ); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp index c93ab503..4364c7c8 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp @@ -537,13 +537,13 @@ void plPassMtlBase::PostLoadAnimPBFixup( void ) myNew->SetLoop( (bool)fAnimPB->GetInt( (ParamID)kPBAnimLoop ), (char *)fAnimPB->GetStr( (ParamID)kPBAnimLoopName ) ); myNew->SetEaseIn( (uint8_t)fAnimPB->GetInt( (ParamID)kPBAnimEaseInType ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInLength ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMin ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMax ) ); + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInLength ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMin ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMax ) ); myNew->SetEaseOut( (uint8_t)fAnimPB->GetInt( (ParamID)kPBAnimEaseOutType ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutLength ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMin ), - (hsScalar)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMax ) ); + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutLength ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMin ), + (float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseOutMax ) ); #pragma warning( pop ) } } diff --git a/Sources/Tools/plFontConverter/plFontFreeType.cpp b/Sources/Tools/plFontConverter/plFontFreeType.cpp index 785bc977..c6f7cb40 100644 --- a/Sources/Tools/plFontConverter/plFontFreeType.cpp +++ b/Sources/Tools/plFontConverter/plFontFreeType.cpp @@ -225,8 +225,8 @@ hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, } // Set these now, since setting them before would've changed the IGetFreeCharData results - ch->fLeftKern = (hsScalar)ftBitmap->left; - ch->fRightKern = (hsScalar)ftAdvances[ i ].x / 64.f - (hsScalar)fWidth - ch->fLeftKern;//ftBitmap->bitmap.width; + ch->fLeftKern = (float)ftBitmap->left; + ch->fRightKern = (float)ftAdvances[ i ].x / 64.f - (float)fWidth - ch->fLeftKern;//ftBitmap->bitmap.width; ch->fBaseline = ftBitmap->top; ch->fHeight = ftBitmap->bitmap.rows;