[Scummvm-git-logs] scummvm master -> 05fea756aed8a47f12781dc2cc0e6228090f5af5
grisenti
noreply at scummvm.org
Thu Jan 26 09:17:42 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
05fea756ae HPL1: remove haptics related code
Commit: 05fea756aed8a47f12781dc2cc0e6228090f5af5
https://github.com/scummvm/scummvm/commit/05fea756aed8a47f12781dc2cc0e6228090f5af5
Author: grisenti (emanuele at grisenti.net)
Date: 2023-01-26T10:17:22+01:00
Commit Message:
HPL1: remove haptics related code
Changed paths:
R engines/hpl1/engine/haptic/Haptic.cpp
R engines/hpl1/engine/haptic/Haptic.h
R engines/hpl1/engine/haptic/HapticForce.h
R engines/hpl1/engine/haptic/HapticShape.h
R engines/hpl1/engine/haptic/HapticSurface.h
R engines/hpl1/engine/haptic/HapticTypes.h
R engines/hpl1/engine/haptic/LowLevelHaptic.cpp
R engines/hpl1/engine/haptic/LowLevelHaptic.h
R engines/hpl1/engine/input/ActionHaptic.cpp
R engines/hpl1/engine/input/ActionHaptic.h
R engines/hpl1/penumbra-overture/HapticGameCamera.cpp
R engines/hpl1/penumbra-overture/HapticGameCamera.h
R engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
R engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
R engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
R engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
R engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
R engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
engines/hpl1/engine/engine.h
engines/hpl1/engine/game/Game.cpp
engines/hpl1/engine/game/Game.h
engines/hpl1/engine/game/low_level_game_setup.cpp
engines/hpl1/engine/game/low_level_game_setup.h
engines/hpl1/engine/impl/MeshLoaderCollada.cpp
engines/hpl1/engine/physics/Physics.cpp
engines/hpl1/engine/physics/Physics.h
engines/hpl1/engine/physics/PhysicsBody.cpp
engines/hpl1/engine/physics/PhysicsBody.h
engines/hpl1/engine/physics/SurfaceData.cpp
engines/hpl1/engine/physics/SurfaceData.h
engines/hpl1/engine/resources/EntityLoader_Object.cpp
engines/hpl1/engine/resources/EntityLoader_Object.h
engines/hpl1/engine/scene/Scene.cpp
engines/hpl1/engine/scene/Scene.h
engines/hpl1/engine/scene/World3D.cpp
engines/hpl1/engine/scene/World3D.h
engines/hpl1/module.mk
engines/hpl1/penumbra-overture/ButtonHandler.cpp
engines/hpl1/penumbra-overture/ButtonHandler.h
engines/hpl1/penumbra-overture/Credits.cpp
engines/hpl1/penumbra-overture/DeathMenu.cpp
engines/hpl1/penumbra-overture/DemoEndText.cpp
engines/hpl1/penumbra-overture/EffectHandler.cpp
engines/hpl1/penumbra-overture/EffectHandler.h
engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
engines/hpl1/penumbra-overture/GameEntity.cpp
engines/hpl1/penumbra-overture/GameEntity.h
engines/hpl1/penumbra-overture/GameItem.cpp
engines/hpl1/penumbra-overture/GameItemType.cpp
engines/hpl1/penumbra-overture/GameItemType.h
engines/hpl1/penumbra-overture/GameLamp.cpp
engines/hpl1/penumbra-overture/GameObject.cpp
engines/hpl1/penumbra-overture/GameSwingDoor.cpp
engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
engines/hpl1/penumbra-overture/HudModel_Weapon.h
engines/hpl1/penumbra-overture/Init.cpp
engines/hpl1/penumbra-overture/Init.h
engines/hpl1/penumbra-overture/Inventory.cpp
engines/hpl1/penumbra-overture/MainMenu.cpp
engines/hpl1/penumbra-overture/MapHandler.cpp
engines/hpl1/penumbra-overture/MapLoadText.cpp
engines/hpl1/penumbra-overture/Notebook.cpp
engines/hpl1/penumbra-overture/NumericalPanel.cpp
engines/hpl1/penumbra-overture/Player.cpp
engines/hpl1/penumbra-overture/Player.h
engines/hpl1/penumbra-overture/PreMenu.cpp
engines/hpl1/serialize.cpp
diff --git a/engines/hpl1/engine/engine.h b/engines/hpl1/engine/engine.h
index 68aea369b46..66bb7ca24a1 100644
--- a/engines/hpl1/engine/engine.h
+++ b/engines/hpl1/engine/engine.h
@@ -117,15 +117,8 @@
#include "hpl1/engine/gui/WidgetSlider.h"
#include "hpl1/engine/gui/WidgetTextBox.h"
#include "hpl1/engine/gui/WidgetWindow.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/HapticForce.h"
-#include "hpl1/engine/haptic/HapticShape.h"
-#include "hpl1/engine/haptic/HapticSurface.h"
-#include "hpl1/engine/haptic/HapticTypes.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/input/Action.h"
-#include "hpl1/engine/input/ActionHaptic.h"
#include "hpl1/engine/input/ActionKeyboard.h"
#include "hpl1/engine/input/ActionMouseButton.h"
#include "hpl1/engine/input/Input.h"
diff --git a/engines/hpl1/engine/game/Game.cpp b/engines/hpl1/engine/game/Game.cpp
index 79babf62d31..015c67b76a0 100644
--- a/engines/hpl1/engine/game/Game.cpp
+++ b/engines/hpl1/engine/game/Game.cpp
@@ -198,15 +198,8 @@ void cGame::GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
Log(" Creating gui module\n");
mpGui = hplNew(cGui, ());
- Log(" Creating haptic module\n");
-#ifdef INCLUDE_HAPTIC
- mpHaptic = mpGameSetup->CreateHaptic();
-#else
- mpHaptic = NULL;
-#endif
-
Log(" Creating scene module\n");
- mpScene = mpGameSetup->createScene(mpGraphics, mpResources, mpSound, mpPhysics, mpSystem, mpAI, mpHaptic);
+ mpScene = mpGameSetup->createScene(mpGraphics, mpResources, mpSound, mpPhysics, mpSystem, mpAI);
Log("--------------------------------------------------------\n\n");
@@ -246,10 +239,6 @@ void cGame::GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
// Init Gui
mpGui->Init(mpResources, mpGraphics, mpSound, mpScene);
- // Init haptic
- if (mpHaptic)
- mpHaptic->Init(mpResources);
-
Log("Initializing Game Module\n");
Log("--------------------------------------------------------\n");
// Create the updatehandler
@@ -264,8 +253,6 @@ void cGame::GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars)
mpUpdater->AddGlobalUpdate(mpAI);
mpUpdater->AddGlobalUpdate(mpGui);
mpUpdater->AddGlobalUpdate(mpResources);
- if (mpHaptic)
- mpUpdater->AddGlobalUpdate(mpHaptic);
// Setup the "default" updater container
mpUpdater->AddContainer("Default");
@@ -307,8 +294,6 @@ cGame::~cGame() {
hplDelete(mpGui);
hplDelete(mpScene);
- if (mpHaptic)
- hplDelete(mpHaptic);
hplDelete(mpInput);
hplDelete(mpSound);
hplDelete(mpGraphics);
@@ -534,12 +519,6 @@ cGui *cGame::GetGui() {
//-----------------------------------------------------------------------
-cHaptic *cGame::GetHaptic() {
- return mpHaptic;
-}
-
-//-----------------------------------------------------------------------
-
cUpdater *cGame::GetUpdater() {
return mpUpdater;
}
diff --git a/engines/hpl1/engine/game/Game.h b/engines/hpl1/engine/game/Game.h
index ef14166f7df..adf79cc3f64 100644
--- a/engines/hpl1/engine/game/Game.h
+++ b/engines/hpl1/engine/game/Game.h
@@ -45,7 +45,6 @@ class cScene;
class cSound;
class cPhysics;
class cAI;
-class cHaptic;
class cGui;
class cFPSCounter {
@@ -167,12 +166,6 @@ public:
*/
cGui *GetGui();
- /**
- *
- * \return A pointer to the haptic
- */
- cHaptic *GetHaptic();
-
void ResetLogicTimer();
void SetUpdatesPerSec(int alUpdatesPerSec);
int GetUpdatesPerSec();
@@ -224,7 +217,6 @@ private:
cSound *mpSound;
cPhysics *mpPhysics;
cAI *mpAI;
- cHaptic *mpHaptic;
cGui *mpGui;
};
diff --git a/engines/hpl1/engine/game/low_level_game_setup.cpp b/engines/hpl1/engine/game/low_level_game_setup.cpp
index 45eb63136da..76256dd73c5 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.cpp
+++ b/engines/hpl1/engine/game/low_level_game_setup.cpp
@@ -29,7 +29,6 @@
#include "hpl1/engine/resources/low_level_resources.h"
#include "hpl1/engine/impl/LowLevelSoundOpenAL.h"
#include "hpl1/engine/impl/MouseSDL.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
#include "hpl1/graphics.h"
namespace hpl {
@@ -54,7 +53,6 @@ LowLevelGameSetup::LowLevelGameSetup() {
_lowLevelResources = hplNew(LowLevelResources, (_lowLevelGraphics));
_lowLevelSound = hplNew(cLowLevelSoundOpenAL, ());
_lowLevelPhysics = hplNew(cLowLevelPhysicsNewton, ());
- _lowLevelHaptic = nullptr;
}
LowLevelGameSetup::~LowLevelGameSetup() {
@@ -72,14 +70,11 @@ LowLevelGameSetup::~LowLevelGameSetup() {
hplDelete(_lowLevelSystem);
Log("Graphics\n");
hplDelete(_lowLevelGraphics);
- Log("Haptic\n");
- if (_lowLevelHaptic)
- hplDelete(_lowLevelHaptic);
}
cScene *LowLevelGameSetup::createScene(cGraphics *graphics, cResources *resources, cSound *sound,
- cPhysics *physics, cSystem *system, cAI *ai, cHaptic *haptic) {
- return hplNew(cScene, (graphics, resources, sound, physics, system, ai, haptic));
+ cPhysics *physics, cSystem *system, cAI *ai) {
+ return hplNew(cScene, (graphics, resources, sound, physics, system, ai));
}
cResources *LowLevelGameSetup::createResources(cGraphics *graphics) {
@@ -110,8 +105,4 @@ cAI *LowLevelGameSetup::createAi() {
return hplNew(cAI, ());
}
-cHaptic *LowLevelGameSetup::createHaptic() {
- return hplNew(cHaptic, (_lowLevelHaptic));
-}
-
} // namespace hpl
diff --git a/engines/hpl1/engine/game/low_level_game_setup.h b/engines/hpl1/engine/game/low_level_game_setup.h
index c2144c26e5d..89f50d67443 100644
--- a/engines/hpl1/engine/game/low_level_game_setup.h
+++ b/engines/hpl1/engine/game/low_level_game_setup.h
@@ -30,7 +30,6 @@
#include "hpl1/engine/ai/AI.h"
#include "hpl1/engine/graphics/Graphics.h"
-#include "hpl1/engine/haptic/Haptic.h"
#include "hpl1/engine/input/Input.h"
#include "hpl1/engine/physics/Physics.h"
#include "hpl1/engine/resources/Resources.h"
@@ -50,11 +49,10 @@ public:
cGraphics *createGraphics();
cResources *createResources(cGraphics *graphics);
cScene *createScene(cGraphics *graphics, cResources *resources, cSound *sound,
- cPhysics *physics, cSystem *system, cAI *ai, cHaptic *haptic);
+ cPhysics *physics, cSystem *system, cAI *ai);
cSound *createSound();
cPhysics *createPhysics();
cAI *createAi();
- cHaptic *createHaptic();
private:
LowLevelSystem *_lowLevelSystem;
iLowLevelGraphics *_lowLevelGraphics;
@@ -62,7 +60,6 @@ private:
LowLevelResources *_lowLevelResources;
iLowLevelSound *_lowLevelSound;
iLowLevelPhysics *_lowLevelPhysics;
- iLowLevelHaptic *_lowLevelHaptic;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/haptic/Haptic.cpp b/engines/hpl1/engine/haptic/Haptic.cpp
deleted file mode 100644
index 826a1e8d593..00000000000
--- a/engines/hpl1/engine/haptic/Haptic.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-#include "hpl1/engine/system/low_level_system.h"
-
-namespace hpl {
-
-bool cHaptic::mbIsUsed = false;
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cHaptic::cHaptic(iLowLevelHaptic *apLowLevelHaptic) : iUpdateable("HPL_Haptic") {
- mpLowLevelHaptic = apLowLevelHaptic;
-}
-
-//-----------------------------------------------------------------------
-
-cHaptic::~cHaptic() {
- Log("Exiting Haptic Module\n");
- Log("--------------------------------------------------------\n");
-
- Log("--------------------------------------------------------\n\n");
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-void cHaptic::Update(float afTimeStep) {
- if (mbIsUsed == false)
- return;
-
- mpLowLevelHaptic->Update(afTimeStep);
-}
-
-//-----------------------------------------------------------------------
-
-void cHaptic::Init(cResources *apResources) {
- if (mbIsUsed == false)
- return;
-
- Log("Initializing Haptic Module\n");
- Log("--------------------------------------------------------\n");
-
- if (mpLowLevelHaptic->Init(apResources) == false) {
- SetIsUsed(false);
- }
-
- Log("--------------------------------------------------------\n\n");
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/haptic/Haptic.h b/engines/hpl1/engine/haptic/Haptic.h
deleted file mode 100644
index 246ae8cae84..00000000000
--- a/engines/hpl1/engine/haptic/Haptic.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_HAPTIC_H
-#define HPL_HAPTIC_H
-
-#include "hpl1/engine/game/Updateable.h"
-#include "hpl1/engine/haptic/HapticTypes.h"
-
-namespace hpl {
-
-class iLowLevelHaptic;
-class cResources;
-
-class cHaptic : public iUpdateable {
-public:
- cHaptic(iLowLevelHaptic *apLowLevelHaptic);
- ~cHaptic();
-
- static void SetIsUsed(bool abX) { cHaptic::mbIsUsed = abX; }
- static bool GetIsUsed() { return cHaptic::mbIsUsed; }
-
- void Init(cResources *apResources);
-
- void Update(float afTimeStep);
-
- iLowLevelHaptic *GetLowLevel() { return mpLowLevelHaptic; }
-
-private:
- iLowLevelHaptic *mpLowLevelHaptic;
-
- static bool mbIsUsed;
-};
-
-} // namespace hpl
-
-#endif // HPL_HAPTIC_H
diff --git a/engines/hpl1/engine/haptic/HapticForce.h b/engines/hpl1/engine/haptic/HapticForce.h
deleted file mode 100644
index 4944577084f..00000000000
--- a/engines/hpl1/engine/haptic/HapticForce.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_HAPTIC_FORCE_H
-#define HPL_HAPTIC_FORCE_H
-
-#include "hpl1/engine/haptic/HapticTypes.h"
-#include "hpl1/engine/math/MathTypes.h"
-
-namespace hpl {
-
-class iHapticForce {
-public:
- iHapticForce(eHapticForceType aType) : mType(aType) {}
- virtual ~iHapticForce() {}
-
- eHapticForceType GetType() { return mType; }
-
- virtual void SetActive(bool abX) = 0;
- virtual bool IsActive() = 0;
-
- virtual void SetForce(const cVector3f &avForce) = 0;
- virtual void SetRelativeForce(const cVector3f &avForce) = 0;
-
- virtual void SetDirection(const cVector3f &avDir) = 0;
- virtual void SetFreq(float afFreq) = 0;
- virtual void SetAmp(float afAmp) = 0;
-
- virtual void SetTimeControl(bool abLoop, float afTime, float afIdleTime,
- float afFadeInTime, float afFadeOutTime) = 0;
-
-protected:
- eHapticForceType mType;
-};
-
-} // namespace hpl
-
-#endif // HPL_HAPTIC_FORCE_H
diff --git a/engines/hpl1/engine/haptic/HapticShape.h b/engines/hpl1/engine/haptic/HapticShape.h
deleted file mode 100644
index 93d7053be8e..00000000000
--- a/engines/hpl1/engine/haptic/HapticShape.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_HAPTIC_SHAPE_H
-#define HPL_HAPTIC_SHAPE_H
-
-#include "hpl1/engine/graphics/GraphicsTypes.h"
-#include "hpl1/engine/haptic/HapticTypes.h"
-#include "hpl1/engine/math/MathTypes.h"
-
-namespace hpl {
-
-class iHapticSurface;
-class iLowLevelGraphics;
-class iPhysicsBody;
-class cSubMeshEntity;
-
-class iHapticShape {
-public:
- iHapticShape(const tString &asName, eHapticShapeType aType) : mpSurface(NULL), mType(aType), msName(asName),
- mpBody(NULL), mpSubMeshEntity(NULL), mlTransformCount(-1) {}
- virtual ~iHapticShape() {}
-
- eHapticShapeType GetType() { return mType; }
- const tString &GetName() { return msName; }
-
- virtual void SetEnabled(bool abX) = 0;
- virtual bool GetEnabled() = 0;
-
- virtual void SetTransform(const cMatrixf &a_mtxTransform) = 0;
- virtual cMatrixf GetTransform() = 0;
-
- virtual cVector3f GetAppliedForce() = 0;
-
- virtual void SetSurface(iHapticSurface *apSurface) = 0;
-
- virtual void RenderDebug(iLowLevelGraphics *apLowLevel, const cColor &aColor) = 0;
-
- iHapticSurface *GetSurface() const { return mpSurface; }
-
- cVector3f GetSize() const { return mvSize; }
-
- iPhysicsBody *GetBody() const { return mpBody; }
- void SetBody(iPhysicsBody *apBody) { mpBody = apBody; }
-
- cSubMeshEntity *GetSubMeshEntity() const { return mpSubMeshEntity; }
- void SetSubMeshEntity(cSubMeshEntity *apSubMeshEntity) { mpSubMeshEntity = apSubMeshEntity; }
-
- int GetTransformCount() const { return mlTransformCount; }
- void SetTransformCount(int alX) { mlTransformCount = alX; }
-
-protected:
- tString msName;
- iHapticSurface *mpSurface;
- eHapticShapeType mType;
- cVector3f mvSize;
-
- iPhysicsBody *mpBody;
- cSubMeshEntity *mpSubMeshEntity;
- int mlTransformCount;
-};
-
-} // namespace hpl
-
-#endif // HPL_HAPTIC_SHAPE_H
diff --git a/engines/hpl1/engine/haptic/HapticSurface.h b/engines/hpl1/engine/haptic/HapticSurface.h
deleted file mode 100644
index 9d850005409..00000000000
--- a/engines/hpl1/engine/haptic/HapticSurface.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_HAPTIC_SURFACE_H
-#define HPL_HAPTIC_SURFACE_H
-
-#include "hpl1/engine/haptic/HapticTypes.h"
-#include "hpl1/engine/math/MathTypes.h"
-#include "hpl1/engine/system/SystemTypes.h"
-
-namespace hpl {
-
-class iHapticSurface {
-public:
- iHapticSurface(const tString &asName, eHapticSurfaceType aType) : mType(aType) {}
- virtual ~iHapticSurface() {}
-
- eHapticSurfaceType GetType() { return mType; }
- tString &GetName() { return msName; }
-
-private:
- eHapticSurfaceType mType;
- tString msName;
-};
-
-} // namespace hpl
-
-#endif // HPL_HAPTIC_SURFACE_H
diff --git a/engines/hpl1/engine/haptic/HapticTypes.h b/engines/hpl1/engine/haptic/HapticTypes.h
deleted file mode 100644
index 30cd508bf23..00000000000
--- a/engines/hpl1/engine/haptic/HapticTypes.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_HAPTIC_TYPES_H
-#define HPL_HAPTIC_TYPES_H
-
-#include "hpl1/engine/system/SystemTypes.h"
-#include "common/list.h"
-#include "common/array.h"
-#include "hpl1/std/map.h"
-
-namespace hpl {
-
-//----------------------------------------------
-
-enum eHapticShapeType {
- eHapticShapeType_Box,
- eHapticShapeType_Sphere,
- eHapticShapeType_Cylinder,
- eHapticShapeType_Capsule,
- eHapticShapeType_Mesh,
- eHapticShapeType_Compund,
- eHapticShapeType_LastEnum
-};
-
-//----------------------------------------------
-
-enum eHapticForceType {
- eHapticForceType_Impulse,
- eHapticForceType_Spring,
- eHapticForceType_SineWave,
- eHapticForceType_SawWave,
- eHapticForceType_Viscosity,
- eHapticForceType_LastEnum
-};
-
-//----------------------------------------------
-
-enum eHapticSurfaceType {
- eHapticSurfaceType_Simple,
- eHapticSurfaceType_Rough,
- eHapticSurfaceType_Frictional,
- eHapticSurfaceType_Sticky,
- eHapticSurfaceType_LastEnum
-};
-
-//----------------------------------------------
-
-class iHapticShape;
-class iHapticForce;
-class iHapticSurface;
-
-//----------------------------------------------
-
-typedef Common::Array<iHapticShape *> tHapticShapeVec;
-typedef tHapticShapeVec::iterator tHapticShapeVecIt;
-
-typedef Common::List<iHapticShape *> tHapticShapeList;
-typedef tHapticShapeList::iterator tHapticShapeListIt;
-
-typedef Common::List<iHapticForce *> tHapticForceList;
-typedef tHapticForceList::iterator tHapticForceListIt;
-
-typedef Common::List<iHapticSurface *> tHapticSurfaceList;
-typedef tHapticSurfaceList::iterator tHapticSurfaceListIt;
-
-typedef Hpl1::Std::map<tString, iHapticSurface *> tHapticSurfaceMap;
-typedef tHapticSurfaceMap::iterator tHapticSurfaceMapIt;
-
-typedef cSTLIterator<iHapticShape *, tHapticShapeList, tHapticShapeListIt> cHapticShapeIterator;
-
-//----------------------------------------------
-
-} // namespace hpl
-
-#endif // HPL_HAPTIC_TYPES_H
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp b/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
deleted file mode 100644
index f6ee4a887e2..00000000000
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-
-#include "hpl1/engine/haptic/HapticForce.h"
-#include "hpl1/engine/haptic/HapticShape.h"
-#include "hpl1/engine/haptic/HapticSurface.h"
-
-#include "hpl1/engine/system/low_level_system.h"
-#include "hpl1/engine/system/SystemTypes.h"
-
-#include "hpl1/engine/math/Math.h"
-#include "hpl1/engine/physics/PhysicsBody.h"
-#include "hpl1/engine/scene/Camera3D.h"
-#include "hpl1/engine/scene/SubMeshEntity.h"
-
-namespace hpl {
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-iLowLevelHaptic::iLowLevelHaptic() {
- mpCamera = NULL;
- mvCameraOffset = 0;
-
- mvMinMousePos = cVector2f(-50, -50);
- mvMaxMousePos = cVector2f(50, 50);
- mvScreenSize = cVector2f(800, 600);
-
- mbUpdateShapes = true;
-}
-
-//-----------------------------------------------------------------------
-
-iLowLevelHaptic::~iLowLevelHaptic() {
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-iHapticSurface *iLowLevelHaptic::GetSurfaceFromName(const tString &asName) {
- tHapticSurfaceMapIt it = m_mapSurfaces.find(asName);
- if (it == m_mapSurfaces.end()) {
- return NULL;
- }
-
- iHapticSurface *pSurface = it->second;
-
- return pSurface;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-bool iLowLevelHaptic::Init(cResources *apResources) {
- mpResources = apResources;
-
- if (InitLowLevel() == false)
- return false;
-
- /////////////////////////////////////
- // Init variables
- mvCurrentHardwarePos = GetHardwarePosition();
- mvPreviousHardwarePos = mvCurrentHardwarePos;
- mbScreenPosFirstTime = true;
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void iLowLevelHaptic::Update(float afTimeStep) {
- UpdateLowLevel(afTimeStep);
-
- /////////////////////////////////////
- // Hardware position calculations
- static bool bHardwareSet = false;
-
- mvPreviousHardwarePos = mvCurrentHardwarePos;
- mvCurrentHardwarePos = GetHardwarePosition();
- if (bHardwareSet == false) {
- mvPreviousHardwarePos = mvCurrentHardwarePos;
- bHardwareSet = true;
- }
-
- /////////////////////////////////////
- // Proxy screen postion calculations
- if (mpCamera) {
- mvPreviousScreenPos = mvCurrentScreenPos;
-
- cVector3f vProjPos = cMath::MatrixMul(mpCamera->GetViewMatrix(), GetProxyPosition());
- vProjPos = cMath::MatrixMulDivideW(mpCamera->GetProjectionMatrix(), vProjPos);
-
- cVector2f vPos2D((vProjPos.x + 1) * 0.5f, (-vProjPos.y + 1) * 0.5f);
-
- mvCurrentScreenPos = vPos2D;
-
- if (mbScreenPosFirstTime) {
- mvPreviousScreenPos = mvCurrentScreenPos;
- mbScreenPosFirstTime = false;
- }
- }
-
- /////////////////////////////////////
- // Update shape transforms
- if (mbUpdateShapes) {
- tHapticShapeListIt it = mlstShapes.begin();
- for (; it != mlstShapes.end(); ++it) {
- iHapticShape *pShape = *it;
-
- // If a body is attached, use it to update shape
- if (pShape->GetBody()) {
- iPhysicsBody *pBody = pShape->GetBody();
- if (pBody->GetTransformUpdateCount() != pShape->GetTransformCount()) {
- pShape->SetTransformCount(pBody->GetTransformUpdateCount());
- pShape->SetTransform(pBody->GetLocalMatrix());
- }
- } else if (pShape->GetSubMeshEntity()) {
- cSubMeshEntity *pSubEntity = pShape->GetSubMeshEntity();
- if (pSubEntity->GetTransformUpdateCount() != pShape->GetTransformCount()) {
- pShape->SetTransformCount(pSubEntity->GetTransformUpdateCount());
- pShape->SetTransform(pSubEntity->GetWorldMatrix());
- }
- }
- }
- }
-}
-
-//-----------------------------------------------------------------------
-
-cVector3f iLowLevelHaptic::GetHardwarePosDelta() {
- return mvCurrentHardwarePos - mvPreviousHardwarePos;
-}
-
-//-----------------------------------------------------------------------
-
-cVector2f iLowLevelHaptic::GetProxyScreenPos(const cVector2f &avScreenSize) {
- return mvCurrentScreenPos * avScreenSize;
-}
-
-cVector2f iLowLevelHaptic::GetProxyScreenDeltaPos(const cVector2f &avScreenSize) {
- return (mvCurrentScreenPos - mvPreviousScreenPos) * avScreenSize;
-}
-
-//-----------------------------------------------------------------------
-
-cVector2f iLowLevelHaptic::GetRelativeVirtualMousePos() {
- cVector3f vRel = GetHardwarePosDelta();
- cVector2f vPos = cVector2f(vRel.x, vRel.y) / (mvMaxMousePos - mvMinMousePos);
- vPos.y = -vPos.y;
- vPos = vPos * mvScreenSize;
- return vPos;
-}
-
-//-----------------------------------------------------------------------
-
-cVector2f iLowLevelHaptic::GetVirtualMousePos() {
- // Log("Pos: %f %f\n", mvCurrentHardwarePos.x,mvCurrentHardwarePos.y);
- cVector2f vPos = (cVector2f(mvCurrentHardwarePos.x, mvCurrentHardwarePos.y) - mvMinMousePos) /
- (mvMaxMousePos - mvMinMousePos);
- vPos.y = 1 - vPos.y;
- vPos = vPos * mvScreenSize;
- return vPos;
-}
-void iLowLevelHaptic::SetVirtualMousePosBounds(const cVector2f &avMin, const cVector2f &avMax,
- const cVector2f &avScreenSize) {
- mvMinMousePos = avMin;
- mvMaxMousePos = avMax;
- mvScreenSize = avScreenSize;
-}
-
-//-----------------------------------------------------------------------
-
-void iLowLevelHaptic::DestroyShape(iHapticShape *apShape) {
- STLFindAndDelete(mlstShapes, apShape);
-}
-
-bool iLowLevelHaptic::ShapeExists(iHapticShape *apShape) {
- tHapticShapeListIt it = mlstShapes.begin();
- for (; it != mlstShapes.end(); ++it) {
- if (apShape == *it)
- return true;
- }
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-cHapticShapeIterator iLowLevelHaptic::GetShapeIterator() {
- return cHapticShapeIterator(&mlstShapes);
-}
-
-//-----------------------------------------------------------------------
-
-void iLowLevelHaptic::DestroyForce(iHapticForce *apForce) {
- STLFindAndDelete(mlstForces, apForce);
-}
-
-//-----------------------------------------------------------------------
-
-void iLowLevelHaptic::StopAllForces() {
- tHapticForceListIt it = mlstForces.begin();
- for (; it != mlstForces.end(); ++it) {
- iHapticForce *pForce = *it;
- pForce->SetActive(false);
- }
-}
-
-//-----------------------------------------------------------------------
-
-void iLowLevelHaptic::DestroyAllShapes() {
- STLDeleteAll(mlstShapes);
-
- // Log("Destroying all shapes!\n");
-}
-
-void iLowLevelHaptic::DestroyAll() {
- STLMapDeleteAll(m_mapSurfaces);
- STLDeleteAll(mlstForces);
- STLDeleteAll(mlstShapes);
-}
-
-//-----------------------------------------------------------------------
-
-} // namespace hpl
diff --git a/engines/hpl1/engine/haptic/LowLevelHaptic.h b/engines/hpl1/engine/haptic/LowLevelHaptic.h
deleted file mode 100644
index 641cf7b3a34..00000000000
--- a/engines/hpl1/engine/haptic/LowLevelHaptic.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_LOW_LEVEL_HAPTIC_H
-#define HPL_LOW_LEVEL_HAPTIC_H
-
-#include "hpl1/engine/haptic/HapticTypes.h"
-#include "hpl1/engine/math/MathTypes.h"
-
-namespace hpl {
-
-class iHapticShape;
-class iHapticForce;
-class iHapticSurface;
-
-class iVertexBuffer;
-class cCamera3D;
-class cResources;
-class iPhysicsBody;
-
-class iLowLevelHaptic {
-public:
- iLowLevelHaptic();
- virtual ~iLowLevelHaptic();
-
- //########################################################################################
- //! \name General
- //########################################################################################
- //! @{
-
- void Update(float afTimeStep);
- bool Init(cResources *apResources);
-
- void DestroyAllShapes();
- void DestroyAll();
-
- virtual float GetMaxForce() = 0;
-
- virtual void SetWorldScale(float afScale) = 0;
- virtual float GetWorldScale() = 0;
-
- virtual void SetRenderingActive(bool abX) = 0;
- virtual bool IsRenderingActive() = 0;
-
- virtual bool ShapeIsInContact(iHapticShape *apShape) = 0;
-
- void SetCamera(cCamera3D *apCamera) { mpCamera = apCamera; }
- cCamera3D *GetCamera() { return mpCamera; }
- void SetCameraOffset(const cVector3f &avOffset) { mvCameraOffset = avOffset; }
- cVector3f GetCameraOffset() { return mvCameraOffset; }
-
- void SetUpdateShapes(bool abX) { mbUpdateShapes = abX; }
- bool GetUpdateShapes() { return mbUpdateShapes; }
-
- void SetForceMul(float afX) { mfForceMul = afX; }
- float GetForceMul() { return mfForceMul; }
-
- //! @}
-
- //########################################################################################
- //! \name Input
- //########################################################################################
- //! @{
-
- virtual bool ButtonIsPressed(int alNum) = 0;
-
- virtual cVector3f GetHardwarePosition() = 0;
- virtual cVector3f GetHardwareRotation() = 0;
-
- cVector3f GetHardwarePosDelta();
-
- cVector2f GetProxyScreenPos(const cVector2f &avScreenSize);
- cVector2f GetProxyScreenDeltaPos(const cVector2f &avScreenSize);
-
- cVector2f GetRelativeVirtualMousePos();
- cVector2f GetVirtualMousePos();
- void SetVirtualMousePosBounds(const cVector2f &avMin, const cVector2f &avMax,
- const cVector2f &avScreenSize);
-
- virtual cVector3f GetProxyPosition() = 0;
- virtual void SetProxyRadius(float afRadius) = 0;
- virtual float GetProxyRadius() = 0;
-
- virtual int GetNumberOfButtons() = 0;
-
- //! @}
-
- //########################################################################################
- //! \name Surfaces
- //########################################################################################
- //! @{
-
- virtual iHapticSurface *CreateSimpleSurface(const tString &asName,
- float afDamping = 0.0f, float afStiffness = 0.9f) = 0;
-
- virtual iHapticSurface *CreateFrictionalSurface(const tString &asName,
- float afDamping = 0.0f, float afStiffness = 0.9f,
- float afDynamicFriction = 0.2f, float afStartingFriction = 0.3f,
- float afTangentStiffness = 0.7f, float afStoppingFriction = 0.1f) = 0;
-
- virtual iHapticSurface *CreateRoughSurface(const tString &asName,
- float afDeviation = 0.1f, float afMean = 0.5f,
- float afDamping = 0.0f, float afStiffness = 0.9f,
- float afDynamicFriction = 0.2f, float afStartingFriction = 0.3f,
- float afTangentStiffness = 0.7f, float afStoppingFriction = 0.1f) = 0;
-
- virtual iHapticSurface *CreateStickySurface(const tString &asName,
- float afDeadHeight = 0.004f, float afStickyStiffness = 0.6f,
- float afDamping = 0.0f, float afStiffness = 0.9f,
- float afDynamicFriction = 0.2f, float afStartingFriction = 0.3f,
- float afTangentStiffness = 0.7f, float afStoppingFriction = 0.1f) = 0;
-
- iHapticSurface *GetSurfaceFromName(const tString &asName);
-
- //! @}
-
- //########################################################################################
- //! \name Shapes
- //########################################################################################
- //! @{
-
- virtual iHapticShape *CreateBoxShape(const tString &asName, const cVector3f &avSize, cMatrixf *apOffsetMtx) = 0;
- virtual iHapticShape *CreateSphereShape(const tString &asName, const cVector3f &avRadii, cMatrixf *apOffsetMtx) = 0;
- virtual iHapticShape *CreateCylinderShape(const tString &asName, float afRadius, float afHeight, cMatrixf *apOffsetMtx) = 0;
- virtual iHapticShape *CreateCapsuleShape(const tString &asName, float afRadius, float afHeight, cMatrixf *apOffsetMtx) = 0;
- virtual iHapticShape *CreateMeshShape(const tString &asName, iVertexBuffer *apVtxBuffer) = 0;
- virtual iHapticShape *CreateCompundShape(const tString &asName, tHapticShapeVec &avShapes) = 0;
-
- virtual iHapticShape *CreateShapeFromPhysicsBody(const tString &asName, iPhysicsBody *apBody) = 0;
-
- void DestroyShape(iHapticShape *apShape);
- bool ShapeExists(iHapticShape *apShape);
-
- cHapticShapeIterator GetShapeIterator();
-
- //! @}
-
- //########################################################################################
- //! \name Forces
- //########################################################################################
- //! @{
-
- virtual iHapticForce *CreateImpulseForce(const cVector3f &avForce) = 0;
- virtual iHapticForce *CreateSinusWaveForce(const cVector3f &avDirection, float afAmp, float afFreq) = 0;
- virtual iHapticForce *CreateSawWaveForce(const cVector3f &avDirection, float afAmp, float afFreq) = 0;
- virtual iHapticForce *CreateSpringForce(const cVector3f &avPostition, float afStiffness, float afDamping) = 0;
- virtual iHapticForce *CreateViscosityForce(const cVector3f &avVelocity, float afMass, float afStiffness, float afDamping) = 0;
-
- void DestroyForce(iHapticForce *apForce);
-
- void StopAllForces();
-
- //! @}
-
-protected:
- virtual bool InitLowLevel() = 0;
- virtual void UpdateLowLevel(float afTimeStep) = 0;
-
- cResources *mpResources;
-
- cCamera3D *mpCamera;
- cVector3f mvCameraOffset;
-
- tHapticSurfaceMap m_mapSurfaces;
- tHapticForceList mlstForces;
- tHapticShapeList mlstShapes;
-
- float mfForceMul;
-
- cVector3f mvPreviousHardwarePos;
- cVector3f mvCurrentHardwarePos;
-
- cVector2f mvPreviousScreenPos;
- cVector2f mvCurrentScreenPos;
- bool mbScreenPosFirstTime;
-
- cVector2f mvMinMousePos;
- cVector2f mvMaxMousePos;
- cVector2f mvScreenSize;
-
- bool mbUpdateShapes;
-};
-
-} // namespace hpl
-
-#endif // HPL_LOW_LEVEL_HAPTIC_H
diff --git a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
index 1a43a431ae2..3574ac7a682 100644
--- a/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
+++ b/engines/hpl1/engine/impl/MeshLoaderCollada.cpp
@@ -67,11 +67,6 @@
#include "hpl1/engine/physics/PhysicsWorld.h"
#include "hpl1/engine/physics/SurfaceData.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/HapticShape.h"
-#include "hpl1/engine/haptic/HapticSurface.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
#include "hpl1/engine/math/Math.h"
@@ -1446,24 +1441,6 @@ cMeshEntity *cMeshLoaderCollada::CreateStaticMeshEntity(cColladaNode *apNode, cW
pBody->SetMaterial(pPhysicsMat);
}
- // Haptic creation
- if (cHaptic::GetIsUsed()) {
- cHaptic *pHaptic = apWorld->GetHaptic();
- iHapticShape *pHShape = NULL;
-
- pHShape = pHaptic->GetLowLevel()->CreateMeshShape(pBody->GetName(), pVtxBuffer);
- if (bDrawn)
- pHShape->SetSubMeshEntity(pEntity->GetSubMeshEntity(0));
-
- pBody->SetHapticShape(pHShape);
-
- if (pPhysicsMat) {
- iHapticSurface *pHapticSurface = pPhysicsMat->GetSurfaceData()->GetHapticSurface();
- if (pHapticSurface)
- pHShape->SetSurface(pHapticSurface);
- }
- }
-
if (bDrawn == false) {
hplDelete(pVtxBuffer);
}
@@ -1582,12 +1559,6 @@ cColliderEntity *cMeshLoaderCollada::CreateStaticCollider(cColladaNode *apNode,
else
pBody->SetCollide(true);
- // Haptic creation
- if (cHaptic::GetIsUsed()) {
- cHaptic *pHaptic = apWorld->GetHaptic();
- /* iHapticShape *pHShape = */(void)pHaptic->GetLowLevel()->CreateShapeFromPhysicsBody(apNode->msName, pBody);
- }
-
return apWorld->CreateColliderEntity(apNode->msName, pBody);
}
diff --git a/engines/hpl1/engine/input/ActionHaptic.cpp b/engines/hpl1/engine/input/ActionHaptic.cpp
deleted file mode 100644
index 695e3987ae9..00000000000
--- a/engines/hpl1/engine/input/ActionHaptic.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#include "hpl1/engine/input/ActionHaptic.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-#include "hpl1/engine/input/Input.h"
-
-namespace hpl {
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cActionHaptic::cActionHaptic(tString asName, cHaptic *apHaptic, int alButton) : iAction(asName) {
- mlButton = alButton;
- mpHaptic = apHaptic;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-bool cActionHaptic::IsTriggerd() {
- if (mlButton >= mpHaptic->GetLowLevel()->GetNumberOfButtons())
- return false;
-
- return mpHaptic->GetLowLevel()->ButtonIsPressed(mlButton);
-}
-
-//-----------------------------------------------------------------------
-
-float cActionHaptic::GetValue() {
- if (IsTriggerd())
- return 1.0;
- else
- return 0.0;
-}
-
-//-----------------------------------------------------------------------
-
-tString cActionHaptic::GetInputName() {
- switch (mlButton) {
- case 0:
- return "centre Controller button";
- case 1:
- return "left Controller button";
- case 2:
- return "forward Controller button";
- case 3:
- return "right Controller button";
- }
- return "unknown Controller button";
-}
-
-//-----------------------------------------------------------------------
-} // namespace hpl
diff --git a/engines/hpl1/engine/input/ActionHaptic.h b/engines/hpl1/engine/input/ActionHaptic.h
deleted file mode 100644
index 97dda2f98da..00000000000
--- a/engines/hpl1/engine/input/ActionHaptic.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of HPL1 Engine.
- */
-
-#ifndef HPL_ACTION_HAPTIC_H
-#define HPL_ACTION_HAPTIC_H
-
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/input/Action.h"
-#include "hpl1/engine/input/InputTypes.h"
-
-namespace hpl {
-
-class cHaptic;
-
-class cActionHaptic : public iAction {
-public:
- cActionHaptic(tString asName, cHaptic *apHaptic, int mlButton);
-
- bool IsTriggerd();
- float GetValue();
-
- tString GetInputName();
-
- tString GetInputType() { return "HapticDeviceButton"; }
-
- int GetButton() { return mlButton; }
-
-private:
- int mlButton;
- cHaptic *mpHaptic;
-};
-
-} // namespace hpl
-
-#endif // HPL_ACTIONMOUSEBUTTON_H
diff --git a/engines/hpl1/engine/physics/Physics.cpp b/engines/hpl1/engine/physics/Physics.cpp
index 6b17b4b5fc3..3ad2755096b 100644
--- a/engines/hpl1/engine/physics/Physics.cpp
+++ b/engines/hpl1/engine/physics/Physics.cpp
@@ -33,10 +33,6 @@
#include "hpl1/engine/system/low_level_system.h"
#include "hpl1/engine/system/String.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/HapticSurface.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
namespace hpl {
@@ -144,7 +140,7 @@ cSurfaceData *cPhysics::GetSurfaceData(const tString &asName) {
//-----------------------------------------------------------------------
-bool cPhysics::LoadSurfaceData(const tString &asFile, cHaptic *apHaptic) {
+bool cPhysics::LoadSurfaceData(const tString &asFile) {
//////////////////////////////////
// Open document
TiXmlDocument *pXmlDoc = hplNew(TiXmlDocument, (asFile.c_str()));
@@ -241,45 +237,6 @@ bool cPhysics::LoadSurfaceData(const tString &asFile, cHaptic *apHaptic) {
pHitData->SetPSPrio(cString::ToInt(pHitElem->Attribute("PSPrio"), 10));
}
- /////////////////////////
- // Get Haptic Data
- if (cHaptic::GetIsUsed() && apHaptic) {
- eHapticSurfaceType surfaceType = GetHapticSurface(pChildElem->Attribute("HapticType"));
-
- float fDeadHeight = cString::ToFloat(pChildElem->Attribute("HapticDeadHeight"), 0.004f);
- float fStickyStiffness = cString::ToFloat(pChildElem->Attribute("HapticStickyStiffness"), 0.6f);
- //float fDeviation = cString::ToFloat(pChildElem->Attribute("HapticDeviation"), 0.1f);
- float fMean = cString::ToFloat(pChildElem->Attribute("HapticMean"), 0.5f);
- float fDamping = cString::ToFloat(pChildElem->Attribute("HapticDamping"), 0.0f);
- float fStiffness = cString::ToFloat(pChildElem->Attribute("HapticStiffness"), 0.9f);
- float fDynamicFriction = cString::ToFloat(pChildElem->Attribute("HapticDynamicFriction"), 0.2f);
- float fStartingFriction = cString::ToFloat(pChildElem->Attribute("HapticStartingFriction"), 0.3f);
- float fTangentStiffness = cString::ToFloat(pChildElem->Attribute("HapticTangentStiffness"), 0.7f);
- float fStoppingFriction = cString::ToFloat(pChildElem->Attribute("HapticStoppingFriction"), 0.1f);
-
- iHapticSurface *pSurface = NULL;
-
- if (surfaceType == eHapticSurfaceType_Simple) {
- pSurface = apHaptic->GetLowLevel()->CreateSimpleSurface(sName, fDamping, fStiffness);
- } else if (surfaceType == eHapticSurfaceType_Frictional) {
- pSurface = apHaptic->GetLowLevel()->CreateFrictionalSurface(sName, fDamping, fStiffness,
- fDynamicFriction, fStartingFriction,
- fTangentStiffness, fStoppingFriction);
- } else if (surfaceType == eHapticSurfaceType_Rough) {
- pSurface = apHaptic->GetLowLevel()->CreateRoughSurface(sName, fStickyStiffness, fMean,
- fDamping, fStiffness,
- fDynamicFriction, fStartingFriction,
- fTangentStiffness, fStoppingFriction);
- } else if (surfaceType == eHapticSurfaceType_Sticky) {
- pSurface = apHaptic->GetLowLevel()->CreateStickySurface(sName, fDeadHeight, fStickyStiffness,
- fDamping, fStiffness,
- fDynamicFriction, fStartingFriction,
- fTangentStiffness, fStoppingFriction);
- }
-
- pData->SetHapticSurface(pSurface);
- }
-
/*Log("Added %s e: %f sf: %f kf: %f emode: %d fmode: %d\n", pData->GetName().c_str(),
pData->GetElasticity(), pData->GetStaticFriction(), pData->GetKineticFriction(),
pData->GetElasticityCombMode(), pData->GetFrictionCombMode());*/
@@ -298,27 +255,6 @@ bool cPhysics::LoadSurfaceData(const tString &asFile, cHaptic *apHaptic) {
//-----------------------------------------------------------------------
-eHapticSurfaceType cPhysics::GetHapticSurface(const char *apName) {
- if (apName == NULL)
- return eHapticSurfaceType_Simple;
-
- tString sMode = cString::ToLowerCase(apName);
-
- if (sMode == "simple")
- return eHapticSurfaceType_Simple;
- if (sMode == "frictional")
- return eHapticSurfaceType_Frictional;
- if (sMode == "rough")
- return eHapticSurfaceType_Rough;
- if (sMode == "sticky")
- return eHapticSurfaceType_Sticky;
- Warning("Could not find haptic surface type '%s'\n", apName);
-
- return eHapticSurfaceType_Simple;
-}
-
-//-----------------------------------------------------------------------
-
ePhysicsMaterialCombMode cPhysics::GetCombMode(const char *apName) {
if (apName == NULL)
return ePhysicsMaterialCombMode_Average;
diff --git a/engines/hpl1/engine/physics/Physics.h b/engines/hpl1/engine/physics/Physics.h
index 204da5e5f4b..a4852264416 100644
--- a/engines/hpl1/engine/physics/Physics.h
+++ b/engines/hpl1/engine/physics/Physics.h
@@ -29,7 +29,6 @@
#define HPL_Physics_H
#include "hpl1/engine/game/Updateable.h"
-#include "hpl1/engine/haptic/HapticTypes.h"
#include "hpl1/engine/physics/PhysicsMaterial.h"
#include "hpl1/engine/system/SystemTypes.h"
#include "common/list.h"
@@ -42,8 +41,6 @@ class iPhysicsWorld;
class cSurfaceData;
class cWorld3D;
class cResources;
-class iHapticSurface;
-class cHaptic;
//------------------------------------------------
@@ -81,7 +78,7 @@ public:
cSurfaceData *CreateSurfaceData(const tString &asName);
cSurfaceData *GetSurfaceData(const tString &asName);
- bool LoadSurfaceData(const tString &asFile, cHaptic *apHaptic = NULL);
+ bool LoadSurfaceData(const tString &asFile);
iLowLevelPhysics *GetLowLevel() { return mpLowLevelPhysics; }
@@ -102,8 +99,6 @@ public:
bool GetDebugLog() { return mbLog; }
private:
- eHapticSurfaceType GetHapticSurface(const char *apName);
-
ePhysicsMaterialCombMode GetCombMode(const char *apName);
void UpdateImpactCounts(float afTimeStep);
diff --git a/engines/hpl1/engine/physics/PhysicsBody.cpp b/engines/hpl1/engine/physics/PhysicsBody.cpp
index 94b8a44afed..e7f47aa6067 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.cpp
+++ b/engines/hpl1/engine/physics/PhysicsBody.cpp
@@ -90,8 +90,6 @@ iPhysicsBody::iPhysicsBody(const tString &asName, iPhysicsWorld *apWorld, iColli
mpUserData = NULL;
- mpHapticShape = NULL;
-
mbPushedByCharacterGravity = false;
mbIsCharacter = false;
diff --git a/engines/hpl1/engine/physics/PhysicsBody.h b/engines/hpl1/engine/physics/PhysicsBody.h
index 6e2373f0045..81d98a64f99 100644
--- a/engines/hpl1/engine/physics/PhysicsBody.h
+++ b/engines/hpl1/engine/physics/PhysicsBody.h
@@ -42,7 +42,6 @@ class cSoundEntity;
class iPhysicsJoint;
class cPhysicsContactData;
class iCharacterBody;
-class iHapticShape;
//------------------------------------------
@@ -264,9 +263,6 @@ public:
void AddAttachedCharacter(iCharacterBody *apChar);
void RemoveAttachedCharacter(iCharacterBody *apChar);
- iHapticShape *GetHapticShape() { return mpHapticShape; }
- void SetHapticShape(iHapticShape *apShape) { mpHapticShape = apShape; }
-
iPhysicsWorld *GetWorld() { return mpWorld; }
void DisableAfterSimulation() { mbDisableAfterSimulation = true; }
@@ -326,8 +322,6 @@ protected:
tPhysicsBodyCallbackList mlstBodyCallbacks;
- iHapticShape *mpHapticShape;
-
void *mpUserData;
bool mbCollide;
diff --git a/engines/hpl1/engine/physics/SurfaceData.cpp b/engines/hpl1/engine/physics/SurfaceData.cpp
index ab52f30b160..e4ba190ea6c 100644
--- a/engines/hpl1/engine/physics/SurfaceData.cpp
+++ b/engines/hpl1/engine/physics/SurfaceData.cpp
@@ -73,8 +73,6 @@ cSurfaceData::cSurfaceData(const tString &asName, cPhysics *apPhysics, cResource
mfMaxScrapeFreqSpeed = 3;
mfMiddleScrapeSpeed = 2;
msScrapeSoundName = "";
-
- mpHapticSurface = NULL;
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/engine/physics/SurfaceData.h b/engines/hpl1/engine/physics/SurfaceData.h
index 9edcb40ef4b..e68fdcd08ce 100644
--- a/engines/hpl1/engine/physics/SurfaceData.h
+++ b/engines/hpl1/engine/physics/SurfaceData.h
@@ -41,7 +41,6 @@ class cPhysics;
class iPhysicsWorld;
class iPhysicsBody;
class cResources;
-class iHapticSurface;
//----------------------------------------
@@ -155,9 +154,6 @@ public:
*/
cSurfaceImpactData *GetHitDataFromSpeed(float afSpeed);
- iHapticSurface *GetHapticSurface() { return mpHapticSurface; }
- void SetHapticSurface(iHapticSurface *apSurface) { mpHapticSurface = apSurface; }
-
protected:
cResources *mpResources;
cPhysics *mpPhysics;
@@ -199,8 +195,6 @@ protected:
tSurfaceImpactDataVec mvImpactData;
tSurfaceImpactDataVec mvHitData;
-
- iHapticSurface *mpHapticSurface;
};
} // namespace hpl
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.cpp b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
index f465aa826ad..3f5e2447e87 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.cpp
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.cpp
@@ -59,10 +59,6 @@
#include "hpl1/engine/scene/Light3DSpot.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/HapticShape.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -86,8 +82,6 @@ iEntity3D *cEntityLoader_Object::Load(const tString &asName, TiXmlElement *apRoo
mvBodies.clear();
mvJoints.clear();
- mvHapticShapes.clear();
-
mvParticleSystems.clear();
mvBillboards.clear();
mvSoundEntities.clear();
@@ -425,37 +419,6 @@ iEntity3D *cEntityLoader_Object::Load(const tString &asName, TiXmlElement *apRoo
}
}
- ////////////////////////////////////////
- // Create Haptic
- if (cHaptic::GetIsUsed()) {
- iLowLevelHaptic *pLowLevelHaptic = apWorld->GetHaptic()->GetLowLevel();
-
- for (size_t i = 0; i < mvBodies.size(); ++i) {
- iPhysicsBody *pBody = mvBodies[i];
-
- // Not Mesh
- if (pBody->GetShape()->GetType() != eCollideShapeType_Mesh) {
- iHapticShape *pHShape = pLowLevelHaptic->CreateShapeFromPhysicsBody(
- pBody->GetName(), pBody);
- mvHapticShapes.push_back(pHShape);
- }
- // Mesh
- else {
- cSubMeshEntity *pSubEnt = mpEntity->GetSubMeshEntityName(pBody->GetName());
-
- if (pSubEnt) {
- iHapticShape *pHShape = pLowLevelHaptic->CreateMeshShape(pBody->GetName(),
- pSubEnt->GetSubMesh()->GetVertexBuffer());
- pHShape->SetSubMeshEntity(pSubEnt);
- mvHapticShapes.push_back(pHShape);
- } else {
- Error("Could not find sub mesh '%s' in '%s'\n", pBody->GetName().c_str(),
- asFileName.c_str());
- }
- }
- }
- }
-
////////////////////////////////////////
// Create lights
for (int i = 0; i < mpMesh->GetLightNum(); i++) {
diff --git a/engines/hpl1/engine/resources/EntityLoader_Object.h b/engines/hpl1/engine/resources/EntityLoader_Object.h
index 135e4b11eba..aa1f8af1f33 100644
--- a/engines/hpl1/engine/resources/EntityLoader_Object.h
+++ b/engines/hpl1/engine/resources/EntityLoader_Object.h
@@ -48,7 +48,6 @@ class cBillboard;
class cBeam;
class cSoundEntity;
class iLight3D;
-class iHapticShape;
class cEntityLoader_Object : public iEntity3DLoader {
public:
@@ -77,8 +76,6 @@ protected:
Common::Array<iPhysicsBody *> mvBodies;
Common::Array<iPhysicsJoint *> mvJoints;
- Common::Array<iHapticShape *> mvHapticShapes;
-
Common::Array<iLight3D *> mvLights;
Common::Array<cParticleSystem3D *> mvParticleSystems;
Common::Array<cBillboard *> mvBillboards;
diff --git a/engines/hpl1/engine/scene/Scene.cpp b/engines/hpl1/engine/scene/Scene.cpp
index 5f6273bdcd8..49c661674fe 100644
--- a/engines/hpl1/engine/scene/Scene.cpp
+++ b/engines/hpl1/engine/scene/Scene.cpp
@@ -61,7 +61,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cScene::cScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound, cPhysics *apPhysics,
- cSystem *apSystem, cAI *apAI, cHaptic *apHaptic)
+ cSystem *apSystem, cAI *apAI)
: iUpdateable("HPL_Scene") {
mpGraphics = apGraphics;
mpResources = apResources;
@@ -69,7 +69,6 @@ cScene::cScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound,
mpPhysics = apPhysics;
mpSystem = apSystem;
mpAI = apAI;
- mpHaptic = apHaptic;
mpCollider2D = hplNew(cCollider2D, ());
mpCurrentWorld2D = NULL;
@@ -416,7 +415,7 @@ cWorld3D *cScene::LoadWorld3D(const tString &asFile, bool abLoadScript, tWorldLo
cWorld3D *cScene::CreateWorld3D(const tString &asName) {
cWorld3D *pWorld = hplNew(cWorld3D, (asName, mpGraphics, mpResources, mpSound, mpPhysics, this,
- mpSystem, mpAI, mpHaptic));
+ mpSystem, mpAI));
mlstWorld3D.push_back(pWorld);
diff --git a/engines/hpl1/engine/scene/Scene.h b/engines/hpl1/engine/scene/Scene.h
index 581690985b5..2cf65100129 100644
--- a/engines/hpl1/engine/scene/Scene.h
+++ b/engines/hpl1/engine/scene/Scene.h
@@ -45,7 +45,6 @@ class cResources;
class cSystem;
class cSound;
class cPhysics;
-class cHaptic;
class cCollider2D;
class iCamera;
class cCamera2D;
@@ -62,7 +61,7 @@ typedef tWorld3DList::iterator tWorld3DListIt;
class cScene : public iUpdateable {
public:
cScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound, cPhysics *apPhysics,
- cSystem *apSystem, cAI *apAI, cHaptic *apHaptic);
+ cSystem *apSystem, cAI *apAI);
~cScene();
void Reset();
@@ -141,7 +140,6 @@ private:
cPhysics *mpPhysics;
cSystem *mpSystem;
cAI *mpAI;
- cHaptic *mpHaptic;
cCollider2D *mpCollider2D;
diff --git a/engines/hpl1/engine/scene/World3D.cpp b/engines/hpl1/engine/scene/World3D.cpp
index bec12115857..ed94e05e508 100644
--- a/engines/hpl1/engine/scene/World3D.cpp
+++ b/engines/hpl1/engine/scene/World3D.cpp
@@ -80,9 +80,6 @@
#include "hpl1/engine/ai/AINodeGenerator.h"
#include "hpl1/engine/ai/AStar.h"
-#include "hpl1/engine/haptic/Haptic.h"
-#include "hpl1/engine/haptic/LowLevelHaptic.h"
-
namespace hpl {
//////////////////////////////////////////////////////////////////////////
@@ -92,8 +89,7 @@ namespace hpl {
//-----------------------------------------------------------------------
cWorld3D::cWorld3D(tString asName, cGraphics *apGraphics, cResources *apResources, cSound *apSound,
- cPhysics *apPhysics, cScene *apScene, cSystem *apSystem, cAI *apAI,
- cHaptic *apHaptic) {
+ cPhysics *apPhysics, cScene *apScene, cSystem *apSystem, cAI *apAI) {
mpGraphics = apGraphics;
mpResources = apResources;
mpSound = apSound;
@@ -101,7 +97,6 @@ cWorld3D::cWorld3D(tString asName, cGraphics *apGraphics, cResources *apResource
mpScene = apScene;
mpSystem = apSystem;
mpAI = apAI;
- mpHaptic = apHaptic;
mpRootNode = hplNew(cNode3D, ());
@@ -122,11 +117,6 @@ cWorld3D::cWorld3D(tString asName, cGraphics *apGraphics, cResources *apResource
//-----------------------------------------------------------------------
cWorld3D::~cWorld3D() {
- if (cHaptic::GetIsUsed()) {
- // mpHaptic->GetLowLevel()->DestroyAllShapes();
- // Not so good to do it here..
- }
-
STLDeleteAll(mlstMeshEntities);
STLDeleteAll(mlstLights);
STLDeleteAll(mlstBillboards);
diff --git a/engines/hpl1/engine/scene/World3D.h b/engines/hpl1/engine/scene/World3D.h
index 0e798f49e18..f4865d5b008 100644
--- a/engines/hpl1/engine/scene/World3D.h
+++ b/engines/hpl1/engine/scene/World3D.h
@@ -50,7 +50,6 @@ class cPhysics;
class cScene;
class cSystem;
class cAI;
-class cHaptic;
class iCamera;
class cCamera3D;
@@ -180,8 +179,7 @@ kSaveData_BaseClass(cWorld3D) {
class cWorld3D {
public:
cWorld3D(tString asName, cGraphics *apGraphics, cResources *apResources, cSound *apSound,
- cPhysics *apPhysics, cScene *apScene, cSystem *apSystem, cAI *apAI,
- cHaptic *apHaptic);
+ cPhysics *apPhysics, cScene *apScene, cSystem *apSystem, cAI *apAI);
~cWorld3D();
tString GetName() { return msName; }
@@ -207,7 +205,6 @@ public:
cResources *GetResources() { return mpResources; }
cSound *GetSound() { return mpSound; }
cSystem *GetSystem() { return mpSystem; }
- cHaptic *GetHaptic() { return mpHaptic; }
iEntity3D *CreateEntity(const tString &asName, const cMatrixf &a_mtxTransform,
const tString &asFile, bool abLoadReferences);
@@ -339,7 +336,6 @@ private:
cScene *mpScene;
cSystem *mpSystem;
cAI *mpAI;
- cHaptic *mpHaptic;
iPhysicsWorld *mpPhysicsWorld;
bool mbAutoDeletePhysicsWorld;
diff --git a/engines/hpl1/module.mk b/engines/hpl1/module.mk
index 5089b27358f..7528d7827a6 100644
--- a/engines/hpl1/module.mk
+++ b/engines/hpl1/module.mk
@@ -91,8 +91,6 @@ MODULE_OBJS := \
engine/gui/WidgetSlider.o \
engine/gui/WidgetTextBox.o \
engine/gui/WidgetWindow.o \
- engine/haptic/Haptic.o \
- engine/haptic/LowLevelHaptic.o \
engine/impl/CGProgram.o \
engine/impl/CharacterBodyNewton.o \
engine/impl/CollideShapeNewton.o \
@@ -129,7 +127,6 @@ MODULE_OBJS := \
engine/impl/tinyXML/tinyxmlerror.o \
engine/impl/tinyXML/tinyxmlparser.o \
engine/input/Action.o \
- engine/input/ActionHaptic.o \
engine/input/ActionKeyboard.o \
engine/input/ActionMouseButton.o \
engine/input/Input.o \
@@ -263,7 +260,6 @@ MODULE_OBJS := \
penumbra-overture/GameSwingDoor.o \
penumbra-overture/GameTypes.o \
penumbra-overture/GraphicsHelper.o \
- penumbra-overture/HapticGameCamera.o \
penumbra-overture/HudModel_Throw.o \
penumbra-overture/HudModel_Weapon.o \
penumbra-overture/Init.o \
@@ -278,11 +274,8 @@ MODULE_OBJS := \
penumbra-overture/PlayerHands.o \
penumbra-overture/PlayerHelper.o \
penumbra-overture/PlayerState_Interact.o \
- penumbra-overture/PlayerState_InteractHaptX.o \
penumbra-overture/PlayerState_Misc.o \
- penumbra-overture/PlayerState_MiscHaptX.o \
penumbra-overture/PlayerState_Weapon.o \
- penumbra-overture/PlayerState_WeaponHaptX.o \
penumbra-overture/PreMenu.o \
penumbra-overture/RadioHandler.o \
penumbra-overture/SaveHandler.o \
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.cpp b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
index 067aef2856b..1bdc427f3b7 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.cpp
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.cpp
@@ -129,10 +129,6 @@ cButtonHandler::cButtonHandler(cInit *apInit) : iUpdateable("ButtonHandler") {
mpInput = mpInit->mpGame->GetInput();
mpLowLevelGraphics = mpInit->mpGame->GetGraphics()->GetLowLevel();
- if (mpInit->mbHasHaptics)
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
- else
- mpLowLevelHaptic = NULL;
mState = eButtonHandlerState_Game;
@@ -274,8 +270,7 @@ void cButtonHandler::Update(float afTimeStep) {
mpInit->mpMainMenu->Exit();
}
- if (mpInput->BecameTriggerd("RightClick") ||
- (mpInit->mbHasHaptics && mpInput->BecameTriggerd("MouseClickRight"))) {
+ if (mpInput->BecameTriggerd("RightClick")) {
mpInit->mpMainMenu->OnMouseDown(eMButton_Right);
mpInput->BecameTriggerd("Examine");
}
@@ -286,8 +281,7 @@ void cButtonHandler::Update(float afTimeStep) {
mpInit->mpMainMenu->OnMouseDoubleClick(eMButton_Right);
}
- if (mpInput->BecameTriggerd("LeftClick") ||
- (mpInit->mbHasHaptics && mpInput->BecameTriggerd("MouseClick"))) {
+ if (mpInput->BecameTriggerd("LeftClick")) {
mpInit->mpMainMenu->OnMouseDown(eMButton_Left);
mpInput->BecameTriggerd("Interact");
}
@@ -297,17 +291,9 @@ void cButtonHandler::Update(float afTimeStep) {
if (mpInput->DoubleTriggerd("LeftClick", 0.15f)) {
mpInit->mpMainMenu->OnMouseDoubleClick(eMButton_Left);
}
-
- if (mpInit->mbHasHaptics) {
- mpInit->mpMainMenu->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
-
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
- } else {
- /// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
- }
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpMainMenu->AddMousePos(vRel * mfMouseSensitivity);
}
///////////////////////////////////
@@ -363,14 +349,9 @@ void cButtonHandler::Update(float afTimeStep) {
if (mpInput->WasTriggerd("LeftClick")) {
mpInit->mpDeathMenu->OnMouseUp(eMButton_Left);
}
-
- if (mpInit->mbHasHaptics) {
- mpInit->mpDeathMenu->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
- } else {
- /// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpDeathMenu->AddMousePos(vRel * mfMouseSensitivity);
- }
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpDeathMenu->AddMousePos(vRel * mfMouseSensitivity);
}
///////////////////////////////////////
// Death ////////////////////
@@ -396,14 +377,9 @@ void cButtonHandler::Update(float afTimeStep) {
if (mpInput->WasTriggerd("LeftClick")) {
mpInit->mpNumericalPanel->OnMouseUp(eMButton_Left);
}
-
- if (mpInit->mbHasHaptics) {
- mpInit->mpNumericalPanel->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
- } else {
- /// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpNumericalPanel->AddMousePos(vRel * mfMouseSensitivity);
- }
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpNumericalPanel->AddMousePos(vRel * mfMouseSensitivity);
}
///////////////////////////////////////
// Notebook ////////////////////
@@ -430,14 +406,9 @@ void cButtonHandler::Update(float afTimeStep) {
pStateMachine->ChangeState(eNotebookState_TaskList);
}
}
-
- if (mpInit->mbHasHaptics) {
- mpInit->mpNotebook->AddMousePos(mpLowLevelHaptic->GetRelativeVirtualMousePos() * mfMouseSensitivity);
- } else {
- /// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpNotebook->AddMousePos(vRel * mfMouseSensitivity);
- }
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpNotebook->AddMousePos(vRel * mfMouseSensitivity);
}
///////////////////////////////////////
// Inventory ////////////////////
@@ -490,15 +461,9 @@ void cButtonHandler::Update(float afTimeStep) {
mpInit->mpInventory->OnShortcutDown(7);
if (mpInput->BecameTriggerd("Nine"))
mpInit->mpInventory->OnShortcutDown(8);
-
- if (mpInit->mbHasHaptics) {
- cVector2f vRel = mpLowLevelHaptic->GetRelativeVirtualMousePos();
- mpInit->mpInventory->AddMousePos(vRel * mfMouseSensitivity);
- } else {
- /// Mouse Movement
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- mpInit->mpInventory->AddMousePos(vRel * mfMouseSensitivity);
- }
+ /// Mouse Movement
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ mpInit->mpInventory->AddMousePos(vRel * mfMouseSensitivity);
} else {
bPlayerStateIsActive = true;
@@ -596,21 +561,13 @@ void cButtonHandler::Update(float afTimeStep) {
}
if (mpInput->BecameTriggerd("InteractMode")) {
- if (mpInit->mbHasHaptics == false) {
- mpPlayer->StartInteractMode();
- } else {
- // DO nothing for the time being.
- }
+ mpPlayer->StartInteractMode();
}
+ cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
+ vRel /= mpLowLevelGraphics->GetVirtualSize();
- // Get the mouse pos and convert it to 0 - 1
- if (mpInit->mbHasHaptics == false) {
- cVector2f vRel = mpInput->GetMouse()->GetRelPosition();
- vRel /= mpLowLevelGraphics->GetVirtualSize();
-
- mpPlayer->AddYaw(vRel.x * mfMouseSensitivity);
- mpPlayer->AddPitch(vRel.y * mfMouseSensitivity);
- }
+ mpPlayer->AddYaw(vRel.x * mfMouseSensitivity);
+ mpPlayer->AddPitch(vRel.y * mfMouseSensitivity);
}
///////////////////////////////////////
@@ -751,16 +708,7 @@ iAction *cButtonHandler::ActionFromTypeAndVal(const tString &asName, const tStri
if (asType == "Keyboard") {
return hplNew(cActionKeyboard, (asName, mpInit->mpGame->GetInput(), (eKey)cString::ToInt(asVal.c_str(), 0)));
} else if (asType == "MouseButton" || asType == "HapticDeviceButton") {
- if (mpInit->mbHasHaptics && asName != "MouseClick") {
- int lNum = cString::ToInt(asVal.c_str(), 0);
- if (lNum == 2)
- lNum = 2;
- else if (lNum == 1)
- lNum = 1;
- return hplNew(cActionHaptic, (asName, mpInit->mpGame->GetHaptic(), lNum));
- } else {
- return hplNew(cActionMouseButton, (asName, mpInit->mpGame->GetInput(), (eMButton)cString::ToInt(asVal.c_str(), 0)));
- }
+ return hplNew(cActionMouseButton, (asName, mpInit->mpGame->GetInput(), (eMButton)cString::ToInt(asVal.c_str(), 0)));
}
return NULL;
@@ -777,17 +725,8 @@ void cButtonHandler::TypeAndValFromAction(iAction *apAction, tString *apType, tS
*apVal = cString::ToString((int)pKeyAction->GetKey() | (int)pKeyAction->GetModifier());
} else if (apAction->GetInputType() == "MouseButton" ||
apAction->GetInputType() == "HapticDeviceButton") {
- if (mpInit->mbHasHaptics && apAction->GetName() != "MouseClick") {
- cActionHaptic *pHapticAction = static_cast<cActionHaptic *>(apAction);
- *apVal = cString::ToString(pHapticAction->GetButton());
- if (*apVal == "2")
- *apVal = "2";
- else if (*apVal == "1")
- *apVal = "1";
- } else {
- cActionMouseButton *pMouseAction = static_cast<cActionMouseButton *>(apAction);
- *apVal = cString::ToString((int)pMouseAction->GetButton());
- }
+ cActionMouseButton *pMouseAction = static_cast<cActionMouseButton *>(apAction);
+ *apVal = cString::ToString((int)pMouseAction->GetButton());
}
} else {
*apVal = "";
diff --git a/engines/hpl1/penumbra-overture/ButtonHandler.h b/engines/hpl1/penumbra-overture/ButtonHandler.h
index a026f7ed509..0f1e1eb2598 100644
--- a/engines/hpl1/penumbra-overture/ButtonHandler.h
+++ b/engines/hpl1/penumbra-overture/ButtonHandler.h
@@ -73,7 +73,6 @@ private:
cInput *mpInput;
iLowLevelGraphics *mpLowLevelGraphics;
- iLowLevelHaptic *mpLowLevelHaptic;
cPlayer *mpPlayer;
diff --git a/engines/hpl1/penumbra-overture/Credits.cpp b/engines/hpl1/penumbra-overture/Credits.cpp
index 4642d205276..d7d5ad82726 100644
--- a/engines/hpl1/penumbra-overture/Credits.cpp
+++ b/engines/hpl1/penumbra-overture/Credits.cpp
@@ -31,7 +31,6 @@
#include "hpl1/penumbra-overture/GameMessageHandler.h"
#include "hpl1/penumbra-overture/GameMusicHandler.h"
#include "hpl1/penumbra-overture/GraphicsHelper.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/MainMenu.h"
#include "hpl1/penumbra-overture/MapHandler.h"
@@ -121,11 +120,6 @@ void cCredits::OnDraw() {
//-----------------------------------------------------------------------
void cCredits::Update(float afTimeStep) {
- // Make sure haptics is off
- if (mpInit->mbHasHaptics) {
- mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
- }
-
mfYPos -= afTimeStep * 30;
cMusicHandler *pMusicHandler = mpInit->mpGame->GetSound()->GetMusicHandler();
@@ -175,11 +169,6 @@ void cCredits::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("Credits");
mpInit->mpGame->GetScene()->SetDrawScene(false);
mpInit->mpGame->GetScene()->SetUpdateMap(false);
- if (mpInit->mbHasHaptics) {
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
- mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
- }
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_Credits);
mpInit->mpGame->GetSound()->GetMusicHandler()->Play("penumbra_music_E1_E", 1, 0.3f, false);
diff --git a/engines/hpl1/penumbra-overture/DeathMenu.cpp b/engines/hpl1/penumbra-overture/DeathMenu.cpp
index 2aed88571d6..503dce5953b 100644
--- a/engines/hpl1/penumbra-overture/DeathMenu.cpp
+++ b/engines/hpl1/penumbra-overture/DeathMenu.cpp
@@ -28,7 +28,6 @@
#include "hpl1/penumbra-overture/DeathMenu.h"
#include "hpl1/penumbra-overture/GraphicsHelper.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/MainMenu.h"
#include "hpl1/penumbra-overture/MapHandler.h"
@@ -290,9 +289,6 @@ void cDeathMenu::SetActive(bool abX) {
mbActive = abX;
if (mbActive) {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
-
mLastCrossHairState = mpInit->mpPlayer->GetCrossHairState();
mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
@@ -309,9 +305,6 @@ void cDeathMenu::SetActive(bool abX) {
// Back to Main
mlstButtons.push_back(hplNew(cDeathMenuButton_BackToMain, (mpInit, cVector2f(400, 350), kTranslate("DeathMenu", "BackToMainMenu"))));
} else {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
-
mpInit->mpPlayer->SetCrossHairState(mLastCrossHairState);
mpInit->mpPlayer->SetCrossHairPos(cVector2f(400, 300));
}
diff --git a/engines/hpl1/penumbra-overture/DemoEndText.cpp b/engines/hpl1/penumbra-overture/DemoEndText.cpp
index 12607ab2296..85587145246 100644
--- a/engines/hpl1/penumbra-overture/DemoEndText.cpp
+++ b/engines/hpl1/penumbra-overture/DemoEndText.cpp
@@ -139,8 +139,6 @@ void cDemoEndText::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("DemoEndText");
mpInit->mpGame->GetScene()->SetDrawScene(false);
mpInit->mpGame->GetScene()->SetUpdateMap(false);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_DemoEndText);
for (int i = 0; i < 3; ++i) {
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.cpp b/engines/hpl1/penumbra-overture/EffectHandler.cpp
index ea3beab9486..dd085162198 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.cpp
+++ b/engines/hpl1/penumbra-overture/EffectHandler.cpp
@@ -93,13 +93,6 @@ void cEffect_Underwater::Reset() {
cEffect_ShakeScreen::cEffect_ShakeScreen(cInit *apInit) {
mpInit = apInit;
-
- if (mpInit->mbHasHaptics) {
- mpForce = mpInit->mpGame->GetHaptic()->GetLowLevel()->CreateSinusWaveForce(
- cVector3f(0, 1, 0), 0.1f, 5);
- } else {
- mpForce = NULL;
- }
}
cEffect_ShakeScreen::~cEffect_ShakeScreen() {
@@ -159,15 +152,6 @@ void cEffect_ShakeScreen::Update(float afTimeStep) {
mvAdd.x = cMath::RandRectf(-fLargest, fLargest);
mvAdd.y = cMath::RandRectf(-fLargest, fLargest);
mvAdd.z = cMath::RandRectf(-fLargest, fLargest);
-
- if (mpForce) {
- if (mlstShakes.empty() == false) {
- mpForce->SetActive(true);
- mpForce->SetAmp(fLargest * 12);
- } else {
- mpForce->SetActive(false);
- }
- }
}
void cEffect_ShakeScreen::Reset() {
diff --git a/engines/hpl1/penumbra-overture/EffectHandler.h b/engines/hpl1/penumbra-overture/EffectHandler.h
index 083902de0ab..5c4e65b08a0 100644
--- a/engines/hpl1/penumbra-overture/EffectHandler.h
+++ b/engines/hpl1/penumbra-overture/EffectHandler.h
@@ -91,8 +91,6 @@ private:
cVector3f mvAdd;
- iHapticForce *mpForce;
-
Common::List<cEffect_ShakeScreen_Shake> mlstShakes;
};
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
index eb055e14ffe..d6831b2b0b2 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Dog.cpp
@@ -339,8 +339,6 @@ void cGameEnemyState_Dog_Attention::OnEnterState(iGameEnemyState *apPrevState) {
#ifndef DEMO_VERSION
if (mpInit->mDifficulty == eGameDifficulty_Easy)
mfTime *= 1.7f;
- if (mpInit->mbHasHaptics)
- mfTime *= 1.3f;
#endif
}
@@ -650,8 +648,6 @@ void cGameEnemyState_Dog_Hunt::OnEnterState(iGameEnemyState *apPrevState) {
#ifndef DEMO_VERSION
float fMul = 1.0f;
- if (mpInit->mbHasHaptics)
- fMul = 0.6f;
if (mpInit->mDifficulty == eGameDifficulty_Easy)
mpMover->GetCharBody()->SetMaxPositiveMoveSpeed(eCharDir_Forward, mpEnemyDog->mfHuntSpeed * 0.7f * fMul);
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
index ad7c9d43377..7f3fef4b841 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Spider.cpp
@@ -179,8 +179,6 @@ void cGameEnemyState_Spider_Hunt::OnEnterState(iGameEnemyState *apPrevState) {
// Setup body
float fMul = 1.0f;
- if (mpInit->mbHasHaptics)
- fMul = 0.6f;
mpEnemy->SetupBody();
if (mpInit->mDifficulty == eGameDifficulty_Easy)
diff --git a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
index 69c85e32802..573b2818b5a 100644
--- a/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
+++ b/engines/hpl1/penumbra-overture/GameEnemy_Worm.cpp
@@ -168,8 +168,6 @@ void cGameEnemyState_Worm_Hunt::OnEnterState(iGameEnemyState *apPrevState) {
mpEnemy->PlayAnim("Idle", true, 0.2f);
float fMul = 1.0f;
- if (mpInit->mbHasHaptics)
- fMul = 0.6f;
// Setup body
mpEnemy->SetupBody();
diff --git a/engines/hpl1/penumbra-overture/GameEntity.cpp b/engines/hpl1/penumbra-overture/GameEntity.cpp
index 5e34d7f8d2d..f1ba3b6651c 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.cpp
+++ b/engines/hpl1/penumbra-overture/GameEntity.cpp
@@ -73,8 +73,6 @@ iGameEntity::iGameEntity(cInit *apInit, const tString &asName) {
mfMaxExamineDist = 6.0f;
mfMaxInteractDist = 1.5f;
- if (mpInit->mbHasHaptics)
- mfMaxInteractDist = mpInit->mfHapticMaxInteractDist;
mbHasInteraction = false;
@@ -118,14 +116,6 @@ iGameEntity::~iGameEntity() {
}
}
- ////////////////////////////////////////////
- // Destroy haptic
- for (size_t i = 0; i < mvHapticShapes.size(); ++i) {
- if (mvHapticShapes[i]) {
- mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyShape(mvHapticShapes[i]);
- }
- }
-
//////////////////////////////////////////////
// Destroy all graphics in the entity!
if (pWorld && mpInit->mbDestroyGraphics) {
@@ -318,9 +308,7 @@ void iGameEntity::PlayerPick() {
void iGameEntity::PlayerInteract() {
//////////////////////
// Script stuff
- if (GetPickedDistance() <= mfMaxInteractDist &&
- (mpInit->mbHasHaptics == false || mpInit->mpPlayer->mbProxyTouching ||
- mType == eGameEntityType_Area)) {
+ if (GetPickedDistance() <= mfMaxInteractDist) {
/*cWorld3D *pWorld = */mpInit->mpGame->GetScene()->GetWorld3D();
if (mvCallbackScripts[eGameEntityScriptType_PlayerInteract]) {
tString sCommand = GetScriptCommand(eGameEntityScriptType_PlayerInteract);
@@ -371,8 +359,6 @@ void iGameEntity::Damage(float afDamage, int alStrength) {
// if(mpInit->mDifficulty== eGameDifficulty_Easy) afDamage *= 2.0f;
if (mpInit->mDifficulty == eGameDifficulty_Hard)
afDamage /= 2.0f;
- if (mpInit->mbHasHaptics)
- afDamage *= 2.0f;
}
int lDiff = mlToughness - alStrength;
diff --git a/engines/hpl1/penumbra-overture/GameEntity.h b/engines/hpl1/penumbra-overture/GameEntity.h
index 81f6a2070ee..4cbdbc79389 100644
--- a/engines/hpl1/penumbra-overture/GameEntity.h
+++ b/engines/hpl1/penumbra-overture/GameEntity.h
@@ -179,10 +179,6 @@ public:
void SetBeams(Common::Array<cBeam *> &avBeams) { mvBeams = avBeams; }
void SetSoundEntities(Common::Array<cSoundEntity *> &avSoundEntities) { mvSoundEntities = avSoundEntities; }
- size_t GetHapticShapeNum() { return mvHapticShapes.size(); }
- iHapticShape *GetHapticShape(size_t alNum) { return mvHapticShapes[alNum]; }
- void SetHapticShapes(Common::Array<iHapticShape *> &avShapes) { mvHapticShapes = avShapes; }
-
void DestroyLight(iLight3D *apLight);
void DestroyParticleSystem(cParticleSystem3D *apPS);
void DestroyBillboard(cBillboard *apBillboard);
@@ -319,8 +315,6 @@ protected:
Common::Array<iPhysicsBody *> mvBodies;
Common::Array<iPhysicsJoint *> mvJoints;
- Common::Array<iHapticShape *> mvHapticShapes;
-
Common::Array<iLight3D *> mvLights;
Common::Array<cParticleSystem3D *> mvParticleSystems;
Common::Array<cBillboard *> mvBillboards;
diff --git a/engines/hpl1/penumbra-overture/GameItem.cpp b/engines/hpl1/penumbra-overture/GameItem.cpp
index 6f62ec966ec..7c7cc00f908 100644
--- a/engines/hpl1/penumbra-overture/GameItem.cpp
+++ b/engines/hpl1/penumbra-overture/GameItem.cpp
@@ -100,7 +100,6 @@ void cEntityLoader_GameItem::AfterLoad(TiXmlElement *apRootElem, const cMatrixf
// Set the engine objects to the object
pObject->SetBodies(mvBodies);
pObject->SetMeshEntity(mpEntity);
- pObject->SetHapticShapes(mvHapticShapes);
///////////////////////////////////
// Add a the object as user data to the body, to get the obejct later on.
diff --git a/engines/hpl1/penumbra-overture/GameItemType.cpp b/engines/hpl1/penumbra-overture/GameItemType.cpp
index 983b1c4be40..207ed24b364 100644
--- a/engines/hpl1/penumbra-overture/GameItemType.cpp
+++ b/engines/hpl1/penumbra-overture/GameItemType.cpp
@@ -40,7 +40,6 @@
#include "hpl1/penumbra-overture/HudModel_Throw.h"
#include "hpl1/penumbra-overture/HudModel_Weapon.h"
#include "hpl1/penumbra-overture/PlayerState_Weapon.h"
-#include "hpl1/penumbra-overture/PlayerState_WeaponHaptX.h"
//////////////////////////////////////////////////////////////////////////
// BASE ITEM CLASS
@@ -341,8 +340,7 @@ bool cGameItemType_WeaponMelee::OnAction(cInventoryItem *apItem, int alActionNum
return true;
}
- if (mpInit->mbHasHaptics == false)
- mpInit->mpPlayerHands->SetCurrentModel(1, apItem->GetHudModelName());
+ mpInit->mpPlayerHands->SetCurrentModel(1, apItem->GetHudModelName());
//////////////////////////
// Set up the melee state
@@ -363,71 +361,6 @@ bool cGameItemType_WeaponMelee::OnAction(cInventoryItem *apItem, int alActionNum
//-----------------------------------------------------------------------
-//////////////////////////////////////////////////////////////////////////
-// WEAPON MELEE HAPTX
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cGameItemType_WeaponMeleeHaptX::cGameItemType_WeaponMeleeHaptX(cInit *apInit)
- : cGameItemType(apInit) {
- mvActions.resize(1);
- mvActions[0] = kTranslate("Inventory", "Equip");
-
- mvNonDropActions.resize(1);
- mvNonDropActions[0] = kTranslate("Inventory", "Equip");
-}
-
-//-----------------------------------------------------------------------
-
-bool cGameItemType_WeaponMeleeHaptX::OnAction(cInventoryItem *apItem, int alActionNum) {
- //////////////
- // Equip
- if (alActionNum == 0) {
- // Make sure the model is loaded
- if (mpInit->mpPlayerHands->GetModel(apItem->GetHudModelName()) == NULL)
- mpInit->mpPlayerHands->AddModelFromFile(apItem->GetHudModelFile());
-
- iHudModel *pHudModel = mpInit->mpPlayerHands->GetModel(apItem->GetHudModelName());
- if (pHudModel == NULL) {
- Error("Hud model with name '%s' does not exist!\n", apItem->GetHudModelName().c_str());
- return true;
- }
- cHudModel_WeaponMelee *pMeleeHud = static_cast<cHudModel_WeaponMelee *>(pHudModel);
-
- iPlayerState *pState = mpInit->mpPlayer->GetStateData(ePlayerState_WeaponMelee);
- cPlayerState_WeaponMeleeHaptX *pMeleeState = static_cast<cPlayerState_WeaponMeleeHaptX *>(pState);
-
- if (mpInit->mpPlayer->GetState() == ePlayerState_WeaponMelee && pMeleeState->GetHudWeapon() == pMeleeHud) {
- mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
- // pMeleeState->SetHudWeapon(NULL);
- } else {
- if (mpInit->mbHasHaptics == false)
- mpInit->mpPlayerHands->SetCurrentModel(1, apItem->GetHudModelName());
-
- if (mpInit->mpPlayer->GetState() == ePlayerState_WeaponMelee) {
- mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
- }
-
- //////////////////////////
- // Set up the melee state
- iPlayerState *pState2 = mpInit->mpPlayer->GetStateData(ePlayerState_WeaponMelee);
-
- cPlayerState_WeaponMeleeHaptX *pMeleeState2 = static_cast<cPlayerState_WeaponMeleeHaptX *>(pState2);
- pMeleeState2->SetHudWeapon(pMeleeHud);
-
- // change state to melee
- mpInit->mpPlayer->ChangeState(ePlayerState_WeaponMelee);
-
- mpInit->mpInventory->SetActive(false);
- }
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
//////////////////////////////////////////////////////////////////////////
// THROW
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/penumbra-overture/GameItemType.h b/engines/hpl1/penumbra-overture/GameItemType.h
index 8b4bff23801..08aca08dc7e 100644
--- a/engines/hpl1/penumbra-overture/GameItemType.h
+++ b/engines/hpl1/penumbra-overture/GameItemType.h
@@ -144,17 +144,6 @@ public:
//----------------------------------------------
-// WEAPON MELEE HAPTX
-
-class cGameItemType_WeaponMeleeHaptX : public cGameItemType {
-public:
- cGameItemType_WeaponMeleeHaptX(cInit *apInit);
-
- bool OnAction(cInventoryItem *apItem, int alActionNum);
-};
-
-//----------------------------------------------
-
// THROW
class cGameItemType_Throw : public cGameItemType {
diff --git a/engines/hpl1/penumbra-overture/GameLamp.cpp b/engines/hpl1/penumbra-overture/GameLamp.cpp
index c84be37de80..8d61f5cf6fe 100644
--- a/engines/hpl1/penumbra-overture/GameLamp.cpp
+++ b/engines/hpl1/penumbra-overture/GameLamp.cpp
@@ -72,7 +72,6 @@ void cEntityLoader_GameLamp::AfterLoad(TiXmlElement *apRootElem, const cMatrixf
pObject->SetParticleSystems(mvParticleSystems);
pObject->SetBillboards(mvBillboards);
pObject->SetSoundEntities(mvSoundEntities);
- pObject->SetHapticShapes(mvHapticShapes);
///////////////////////////////////
// Load game properties
@@ -81,8 +80,7 @@ void cEntityLoader_GameLamp::AfterLoad(TiXmlElement *apRootElem, const cMatrixf
pObject->mfTurnOnTime = cString::ToFloat(pGameElem->Attribute("TurnOnTime"), 0);
pObject->mfTurnOffTime = cString::ToFloat(pGameElem->Attribute("TurnOffTime"), 0);
- if (mpInit->mbHasHaptics == false)
- pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("InteractDist"), 1.8f);
+ pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("InteractDist"), 1.8f);
pObject->mbInteractOff = cString::ToBool(pGameElem->Attribute("InteractOff"), true);
pObject->mbInteractOn = cString::ToBool(pGameElem->Attribute("InteractOn"), true);
@@ -220,9 +218,6 @@ void cGameLamp::OnPlayerInteract() {
// If no interaction, use grab mode
if (mpInit->mpPlayer->GetPickedBody()->GetMass() != 0 &&
bInteracted == false && ((mbLit && mbInteractOff) || (!mbLit && mbInteractOn))) {
- if (mpInit->mbHasHaptics && mpInit->mpPlayer->mbProxyTouching == false)
- return;
-
mpInit->mpPlayer->mbPickAtPoint = false;
mpInit->mpPlayer->mbRotateWithPlayer = true;
mpInit->mpPlayer->mbUseNormalMass = false;
diff --git a/engines/hpl1/penumbra-overture/GameObject.cpp b/engines/hpl1/penumbra-overture/GameObject.cpp
index c5c7baffda8..e2d979e0f43 100644
--- a/engines/hpl1/penumbra-overture/GameObject.cpp
+++ b/engines/hpl1/penumbra-overture/GameObject.cpp
@@ -212,7 +212,6 @@ void cEntityLoader_GameObject::AfterLoad(TiXmlElement *apRootElem, const cMatrix
pObject->SetParticleSystems(mvParticleSystems);
pObject->SetSoundEntities(mvSoundEntities);
pObject->SetLights(mvLights);
- pObject->SetHapticShapes(mvHapticShapes);
///////////////////////////////////
// Load game properties
@@ -321,29 +320,17 @@ void cEntityLoader_GameObject::AfterLoad(TiXmlElement *apRootElem, const cMatrix
// Push mode
if (pObject->mInteractMode == eObjectInteractMode_Push) {
- if (mpInit->mbHasHaptics == false)
- pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxPushDist());
+ pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxPushDist());
pObject->mbHasInteraction = true;
}
// Move Mode
else if (pObject->mInteractMode == eObjectInteractMode_Move) {
- if (mpInit->mbHasHaptics) {
- pObject->mInteractMode = eObjectInteractMode_Grab;
- pObject->mbPickAtPoint = true;
- if (mpInit->mbHasHaptics == false)
- pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxGrabDist());
- pObject->mbHasInteraction = true;
- pObject->mbIsMover = true;
- } else {
- if (mpInit->mbHasHaptics == false)
- pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxMoveDist());
- pObject->mbHasInteraction = true;
- }
+ pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxMoveDist());
+ pObject->mbHasInteraction = true;
}
// Grab Mode
else if (pObject->mInteractMode == eObjectInteractMode_Grab) {
- if (mpInit->mbHasHaptics == false)
- pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxGrabDist());
+ pObject->mfMaxInteractDist = cString::ToFloat(pGameElem->Attribute("MaxInteractDist"), mpInit->mpPlayer->GetMaxGrabDist());
pObject->mbHasInteraction = true;
}
@@ -473,9 +460,6 @@ void cGameObject::OnPlayerInteract() {
return;
}
- if (mpInit->mbHasHaptics && mpInit->mpPlayer->mbProxyTouching == false)
- return;
-
switch (mInteractMode) {
case eObjectInteractMode_Push:
PushObject();
diff --git a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
index 09bbe250077..a6fa6ff1bec 100644
--- a/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
+++ b/engines/hpl1/penumbra-overture/GameSwingDoor.cpp
@@ -68,7 +68,6 @@ void cEntityLoader_GameSwingDoor::AfterLoad(TiXmlElement *apRootElem, const cMat
pObject->SetBodies(mvBodies);
pObject->SetJoints(mvJoints);
pObject->SetMeshEntity(mpEntity);
- pObject->SetHapticShapes(mvHapticShapes);
///////////////////////////////////
// Load game properties
@@ -194,8 +193,6 @@ void cGameSwingDoor::OnPlayerInteract() {
if (fDist > mfMaxInteractDist)
return;
- if (mpInit->mbHasHaptics && mpInit->mpPlayer->mbProxyTouching == false)
- return;
// Set some properties
mpInit->mpPlayer->mfForwardUpMul = 1.0f;
@@ -206,23 +203,8 @@ void cGameSwingDoor::OnPlayerInteract() {
mpInit->mpPlayer->mfCurrentMaxInteractDist = mfMaxInteractDist;
- if (!mpInit->mbHasHaptics) {
- mpInit->mpPlayer->SetPushBody(mpInit->mpPlayer->GetPickedBody());
- mpInit->mpPlayer->ChangeState(ePlayerState_Move);
- } else {
- mpInit->mpPlayer->mbPickAtPoint = true;
- mpInit->mpPlayer->mbRotateWithPlayer = false;
- mpInit->mpPlayer->mbUseNormalMass = false;
- mpInit->mpPlayer->mfGrabMassMul = 1;
-
- mpInit->mpPlayer->mfHapticTorqueMul = 1.0f;
-
- mpInit->mpPlayer->mbCanBeThrown = true;
- mpInit->mpPlayer->mbGrabbingMoveBody = true;
-
- mpInit->mpPlayer->SetPushBody(mpInit->mpPlayer->GetPickedBody());
- mpInit->mpPlayer->ChangeState(ePlayerState_Grab);
- }
+ mpInit->mpPlayer->SetPushBody(mpInit->mpPlayer->GetPickedBody());
+ mpInit->mpPlayer->ChangeState(ePlayerState_Move);
}
//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp b/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
deleted file mode 100644
index 49c1fc5d237..00000000000
--- a/engines/hpl1/penumbra-overture/HapticGameCamera.cpp
+++ /dev/null
@@ -1,658 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
-
-#include "hpl1/penumbra-overture/Init.h"
-#include "hpl1/penumbra-overture/Player.h"
-#include "hpl1/penumbra-overture/MapHandler.h"
-#include "hpl1/penumbra-overture/GameEntity.h"
-#include "hpl1/penumbra-overture/GameLiquidArea.h"
-#include "hpl1/penumbra-overture/ButtonHandler.h"
-
-//////////////////////////////////////////////////////////////////////////
-// CONSTRUCTORS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cHapticGameCamera::cHapticGameCamera(cInit *apInit, cPlayer *apPlayer)
-{
- mpInit = apInit;
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
- mpScene = mpInit->mpGame->GetScene();
-
- mfFrameW = 200;
- mfFrameH = 180;
-
- mbUseFrame = true;
-
- mfFrameForceStrength = 0.0002f;
- mfFrameMoveSpeedX = 0.00033f;
- mfFrameMoveSpeedY = 0.0002f;
-
- mfInteractModeCameraSpeed = 1;
- mfActionModeCameraSpeed = 1;
-
- mfFrameMaxForce = 0.3f;//1;
- mfFrameMaxMoveSpeed = 0.1f;
-
- mvCentrePos = cVector3f(0,-25,0);
-
- mpForce = apInit->mpGame->GetHaptic()->GetLowLevel()->CreateImpulseForce(0);
- mpForce->SetForce(0);
-
- mpVtxProgram = mpInit->mpGame->GetResources()->GetGpuProgramManager()->CreateProgram(
- "Diffuse_Color_vp.cg","main",
- eGpuProgramType_Vertex);
-
- mpPlayer = apPlayer;
-
- Reset();
-}
-
-//-----------------------------------------------------------------------
-
-cHapticGameCamera::~cHapticGameCamera()
-{
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUBLIC METHODS
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::OnWorldLoad()
-{
- cMesh *pMesh = mpInit->mpGame->GetResources()->GetMeshManager()->CreateMesh("player_gui_hand.dae");
- mpHandEntity = mpScene->GetWorld3D()->CreateMeshEntity("Hand",pMesh);
-
- float fRadius = mpLowLevelHaptic->GetProxyRadius();
- mpHandEntity->SetMatrix(cMath::MatrixScale(fRadius));
- mpHandEntity->SetVisible(mbHandVisible);
- mpHandEntity->SetCastsShadows(true);
-
- mpHandShape = mpScene->GetWorld3D()->GetPhysicsWorld()->CreateSphereShape(GetHandReachRadius(),NULL);
-
- mvPrevPrxoyPos = mpLowLevelHaptic->GetProxyPosition();
-
- //Disable all shapes
- cHapticShapeIterator it = mpLowLevelHaptic->GetShapeIterator();
- while(it.HasNext())
- {
- iHapticShape *pShape = it.Next();
- pShape->SetEnabled(false);
- }
-}
-
-void cHapticGameCamera::OnWorldExit()
-{
- mpHandShape = NULL;
- mpHandEntity = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::Reset()
-{
- mpHandShape = NULL;
- mpHandEntity = NULL;
-
- mbIsTurning = false;
-
- mbActive = true;
- mbCamMove = true;
-
- mbHandVisible = true;
-
- mbRenderActive = true;
-
- mlContactCount =0;
-
- mbAtEdge = false;
-
- mType = eHapticGameCameraType_Frame;
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::SetActive(bool abX)
-{
- if(mbActive == abX) return;
-
- mbActive = abX;
-
- if(mbActive)
- {
- if(mpHandEntity) mpHandEntity->SetVisible(mbHandVisible);
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetRenderingActive(mbRenderActive);
- }
- else
- {
- mpForce->SetActive(false);
- if(mpHandEntity)mpHandEntity->SetVisible(false);
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetRenderingActive(false);
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::SetType(eHapticGameCameraType aType)
-{
- mType = aType;
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::Update(float afTimeStep)
-{
- if( mpPlayer->IsActive() == false ||
- mpInit->mpButtonHandler->GetState() != eButtonHandlerState_Game)
- {
- //Log("Player is not active!!\n");
- mpForce->SetActive(false);
- mpLowLevelHaptic->SetRenderingActive(false);
- if(mpHandEntity) mpHandEntity->SetActive(false);
- return;
- }
-
- if(mbActive==false){
- mpLowLevelHaptic->SetRenderingActive(false);
- return;
- }
-
- if(mpHandEntity) mpHandEntity->SetActive(mbHandVisible);
- if(mbHandVisible && mbAtEdge==false)
- mpLowLevelHaptic->SetRenderingActive(mbRenderActive);
- else
- mpLowLevelHaptic->SetRenderingActive(false);
-
-
- UpdateCameraOrientation(afTimeStep);
- UpdateHand(afTimeStep);
- UpdateProxyCovered(afTimeStep);
- UpdateProxyInteraction(afTimeStep);
-
- cInput *pInput = mpInit->mpGame->GetInput();
- if(pInput->IsTriggerd("InteractMode"))
- {
- mpLowLevelHaptic->SetRenderingActive(false);
- }
-}
-
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::OnPostSceneDraw()
-{
- if(mpHandEntity==NULL) return;
- if(mbHandVisible==false) return;
- if(mbActive==false) return;
- if(mpHandEntity->IsVisible()==false) return;
-
- cCamera3D *pCam = static_cast<cCamera3D*>(mpScene->GetCamera());
- iLowLevelGraphics *pLowGfx = mpInit->mpGame->GetGraphics()->GetLowLevel();
- eCrossHairState crossHairState = mpPlayer->GetCrossHairState();
-
- if( crossHairState != eCrossHairState_Inactive &&
- crossHairState != eCrossHairState_None)
- {
- pLowGfx->SetMatrix(eMatrix_ModelView,cMath::MatrixMul( pCam->GetViewMatrix(),
- mpHandEntity->GetWorldMatrix()));
- cSubMesh *pSubMesh = mpHandEntity->GetMesh()->GetSubMesh(0);
- iVertexBuffer *pVtxBuff = pSubMesh->GetVertexBuffer();
-
- pLowGfx->SetDepthTestActive(true);
- pLowGfx->SetDepthTestFunc(eDepthTestFunc_LessOrEqual);
- pLowGfx->SetBlendActive(true);
- pLowGfx->SetBlendFunc(eBlendFunc_One,eBlendFunc_One);
- pLowGfx->SetTexture(0, pSubMesh->GetMaterial()->GetTexture(eMaterialTexture_Diffuse));
-
- mpVtxProgram->Bind();
- mpVtxProgram->SetMatrixf( "worldViewProj",eGpuProgramMatrix_ViewProjection,
- eGpuProgramMatrixOp_Identity);
-
- pVtxBuff->Bind();
- pVtxBuff->Draw();
- pVtxBuff->Draw();
- pVtxBuff->UnBind();
-
- mpVtxProgram->UnBind();
-
- pLowGfx->SetTexture(0, NULL);
- pLowGfx->SetBlendActive(false);
- pLowGfx->SetDepthTestActive(true);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cHapticGameCamera::ShowCrosshair()
-{
- if(mbActive==false) return true;
-
- if(mbHandVisible==false) return true;
-
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::SetHandVisible(bool abX)
-{
- if(mbHandVisible == abX) return;
-
- mbHandVisible = abX;
-
- if(mpHandEntity)
- {
- mpHandEntity->SetVisible(mbHandVisible);
- }
-}
-
-bool cHapticGameCamera::GetHandVisible()
-{
- return mbHandVisible;
-}
-
-
-/**
- * The radius from proxy center that will be able to affect entities.
- */
-float cHapticGameCamera::GetHandReachRadius()
-{
- return mpLowLevelHaptic->GetProxyRadius()*7.0f;
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::SetRenderActive(bool abX)
-{
- if(mbRenderActive == abX) return;
-
- mbRenderActive = abX;
-
- if(mbActive) mpLowLevelHaptic->SetRenderingActive(mbRenderActive);
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::SetInteractModeCameraSpeed(float afSpeed)
-{
- mfInteractModeCameraSpeed = afSpeed;
- mfFrameMoveSpeedX = 0.00033f * mfInteractModeCameraSpeed;
- mfFrameMoveSpeedY = 0.0002f * mfInteractModeCameraSpeed;
-}
-void cHapticGameCamera::SetActionModeCameraSpeed(float afSpeed)
-{
- mfActionModeCameraSpeed = afSpeed;
-}
-
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE METHODS
-//////////////////////////////////////////////////////////////////////////
-
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::UpdateCameraOrientation(float afTimeStep)
-{
- cCamera3D *pCamera = static_cast<cCamera3D*>(mpScene->GetCamera());
- cVector3f vLocalPoxy = cMath::MatrixMul(pCamera->GetViewMatrix(),
- mpLowLevelHaptic->GetProxyPosition());
- //Log("Local %s\n",vLocalPoxy.ToString().c_str());
- if(vLocalPoxy.z >-0.34){
- //mpLowLevelHaptic->SetRenderingActive(false);
- return;
- }
-
- mbAtEdge = false;
-
- ///////////////////////////
- // Frame Type
- cVector3f vForce(0);
- cVector2f vSpeed(0);
- if(mType == eHapticGameCameraType_Frame)
- {
- if(mbUseFrame==false) return;
-
- ///////////////////////////////////
- //Get force and movement
- cVector2f vPos = mpLowLevelHaptic->GetProxyScreenPos(cVector2f(800,600));
- if(vPos.x < mfFrameW){
- vSpeed.x = (mfFrameW - vPos.x) * -mfFrameMoveSpeedX;
- vForce.x = (mfFrameW - vPos.x)*mfFrameForceStrength;
- }
- if(vPos.x > (800 - mfFrameW)){
- vSpeed.x = (vPos.x - (800 - mfFrameW)) * mfFrameMoveSpeedX;
- vForce.x = (vPos.x - (800 - mfFrameW))*-mfFrameForceStrength;
- }
- if(vPos.y < mfFrameH){
- vSpeed.y = (mfFrameH - vPos.y) * -mfFrameMoveSpeedY;
- vForce.y = (mfFrameH - vPos.y)*-mfFrameForceStrength;
- }
- if(vPos.y > (600-mfFrameW)){
- vSpeed.y = (vPos.y - (600-mfFrameW)) * mfFrameMoveSpeedY;
- vForce.y = (vPos.y - (600-mfFrameW))*mfFrameForceStrength;
- }
-
- ///////////////////////////////////
- //Set Max speed
- if(vSpeed.x > mfFrameMaxMoveSpeed) vSpeed.x = mfFrameMaxMoveSpeed;
- if(vSpeed.x < -mfFrameMaxMoveSpeed) vSpeed.x = -mfFrameMaxMoveSpeed;
- if(vSpeed.y > mfFrameMaxMoveSpeed) vSpeed.y = mfFrameMaxMoveSpeed;
- if(vSpeed.y < -mfFrameMaxMoveSpeed) vSpeed.y = -mfFrameMaxMoveSpeed;
-
- if(mbCamMove)
- {
- mpPlayer->AddYaw(vSpeed.x * mpInit->mfHapticMoveScreenSpeedMul);
- mpPlayer->AddPitch(vSpeed.y * mpInit->mfHapticMoveScreenSpeedMul);
- }
-
-
- ///////////////////////////////////
- //Set Max Force
- if(vForce.x > mfFrameMaxForce) vForce.x = mfFrameMaxForce;
- if(vForce.x < -mfFrameMaxForce) vForce.x = -mfFrameMaxForce;
- if(vForce.y > mfFrameMaxForce) vForce.y = mfFrameMaxForce;
- if(vForce.y < -mfFrameMaxForce) vForce.y = -mfFrameMaxForce;
-
- ////////////////////////////////////
- //Turn on Force
- if(vForce != 0)
- {
- mpForce->SetActive(true);
- mpForce->SetForce(vForce);
-
- //Do this better.
- mbHapticWasActive = mpLowLevelHaptic->IsRenderingActive();
- mbIsTurning = true;
- }
- else
- {
- mpForce->SetActive(false);
-
- mbIsTurning = false;
- }
-
- //////////////////////////////////////////
- //Turn off rendering
- bool bAtEdge = false;
- if(vPos.x < mfFrameW*.1f){
- bAtEdge = true;
- }
- if(vPos.x > (800 - mfFrameW*.1f)){
- bAtEdge = true;
- }
- if(vPos.y < mfFrameH*.1f){
- bAtEdge = true;
- }
- if(vPos.y > (600-mfFrameH*.1f)){
- bAtEdge = true;
- }
-
- mbAtEdge = bAtEdge;
-
- /*if(bAtEdge)
- {
- mpLowLevelHaptic->SetRenderingActive(false);
- }
- else
- {
- mpLowLevelHaptic->SetRenderingActive(mbRenderActive);
- }*/
- }
- ///////////////////////////
- // Centre Type
- else if(mType == eHapticGameCameraType_Centre)
- {
- cVector3f vDevicePos = mpLowLevelHaptic->GetHardwarePosition();
- cVector3f vDeltaPos = mvCentrePos - vDevicePos;
-
- float fLength = vDeltaPos.Length() -0.9f;
-
-
- if(fLength > 0.0f)
- {
- cVector3f vDir = cMath::Vector3Normalize(vDeltaPos);
-
- //Force
- cVector3f vForce2 = vDir * fLength * 0.012f;
- mpForce->SetActive(true);
- mpForce->SetForce(vForce2);
-
- //Movement
- if(mbCamMove)
- {
- cVector3f vMov = vDir * fLength * 0.0015f * mfActionModeCameraSpeed;
- mpPlayer->AddPitch(vMov.y);
- mpPlayer->AddYaw(-vMov.x);
- }
- }
- else
- {
- mpForce->SetActive(false);
- }
- }
-}
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::UpdateHand(float afTimeStep)
-{
- ///////////////////////////
- // GUI Hand
- cVector3f vProxyPos = mpLowLevelHaptic->GetProxyPosition();
-
- mlstProxyPos.push_back(vProxyPos);
- if(mlstProxyPos.size() > 8) mlstProxyPos.pop_front();
-
- vProxyPos =0;
- Common::List<cVector3f>::iterator it = mlstProxyPos.begin();
- for(; it != mlstProxyPos.end(); ++it)
- {
- vProxyPos += *it;
- }
- vProxyPos = vProxyPos / (float)mlstProxyPos.size();
-
- mpHandEntity->SetPosition(vProxyPos);
-
-}
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::UpdateProxyCovered(float afTimeStep)
-{
- /////////////////////////////////////
- // Check if proxy is covered
- /*if(false)//cHaptic::GetIsUsed())
- {
- if(mState == ePlayerState_Normal && mpHapticCamera->IsTurning()==false)
- {
- cVector3f vStart = mpCamera->GetPosition();
- cVector3f vEnd = mpHandEntity->GetWorldPosition();
-
- //Log("Casting ray!\n");
- gTempCheckProxy.mbCollided =false;
- pPhysicsWorld->CastRay(&gTempCheckProxy,vStart,vEnd,false,false,false);
-
- if(gTempCheckProxy.mbCollided)
- {
- //Log("Disable!\n");
- mpLowLevelHaptic->SetRenderingActive(false);
- }
- else
- {
- //Log("Enabel!\n");
- mpLowLevelHaptic->SetRenderingActive(true);
- }
- }
- }*/
-}
-
-//-----------------------------------------------------------------------
-
-void cHapticGameCamera::UpdateProxyInteraction(float afTimeStep)
-{
- cVector3f vProxyPos = mpLowLevelHaptic->GetProxyPosition();
- cVector3f vProxyVel = (vProxyPos - mvPrevPrxoyPos) / afTimeStep;
- float fProxySpeed = vProxyVel.Length();
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
-
- bool bHadContact = false;
-
- /////////////////////////////////
- //Disable previously enabled
- cHapticShapeIterator shapeIt = mpLowLevelHaptic->GetShapeIterator();
- while(shapeIt.HasNext())
- {
- iHapticShape *pShape = shapeIt.Next();
- pShape->SetEnabled(false);
- }
-
- //////////////////////////////////
- // Iterate physics bodies
- cBoundingVolume bv;
- bv.SetSize(GetHandReachRadius()*2);
- bv.SetPosition(vProxyPos);
-
- cPortalContainerEntityIterator it = pWorld->GetPortalContainer()->GetEntityIterator(&bv);
- while(it.HasNext())
- {
- iPhysicsBody *pBody = static_cast<iPhysicsBody*>(it.Next());
-
- if(pBody->IsCharacter()) continue;
- if(pBody->IsActive()==false) continue;
-
- if(pBody->GetHapticShape()==NULL)
- {
- if(cMath::PointBVCollision(vProxyPos,*pBody->GetBV())==false) continue;
-
- /////////////////////////////////
- //Special case for water
- iGameEntity *pEntity = (iGameEntity*)pBody->GetUserData();
- if(pEntity==NULL || pEntity->GetType() != eGameEntityType_LiquidArea) continue;
-
- cGameLiquidArea *pLiquid = static_cast<cGameLiquidArea*>(pEntity);
-
- bHadContact = true;
-
- if( mlContactCount <=0)
- {
- float fY = pBody->GetWorldPosition().y +
- pBody->GetShape()->GetSize().y/2;
-
- cVector3f vWaterPos = vProxyPos; vProxyPos.y = fY;
-
- cSurfaceData *pSurface = pLiquid->GetPhysicsMaterial()->GetSurfaceData();
- cSurfaceImpactData *pImpact = pSurface->GetImpactDataFromSpeed(fProxySpeed * 0.3f);
- if(pImpact == NULL) continue;
-
- if(pImpact->GetPSName() != "")
- {
- pWorld->CreateParticleSystem( "Splash", pImpact->GetPSName(),1,
- cMath::MatrixTranslate(vWaterPos));
- }
-
- if(pImpact->GetSoundName() != "")
- {
- cSoundEntity *pSound = pWorld->CreateSoundEntity("Splash",
- pImpact->GetSoundName(),true);
- if(pSound) pSound->SetPosition(vWaterPos);
- }
- }
- continue;
- }
-
- /////////////////////////////////////
- //Get Shape
- iHapticShape *pContactShape = pBody->GetHapticShape();
-
- pContactShape->SetEnabled(true);
- //mlstActiveShapes.push_back(pContactShape);
-
- //////////////////////////////////////
- //Check if any of the haptic shapes are touched.
- if(mpLowLevelHaptic->ShapeIsInContact(pContactShape))
- {
- bHadContact = true;
- }
- else
- {
- continue;
- }
-
- /////////////////////////////////////////
- // Add force to body and play material effects
-
- //Log("Body: %s Force: %s\n", pBody->GetName().c_str(),
- // pContactShape->GetAppliedForce().ToString().c_str());
-
-
- //Force
- pBody->AddForceAtPosition( pContactShape->GetAppliedForce() * 60.0f,//33.0f,
- vProxyPos);
-
- //Effects
- cSurfaceData *pSurface = pBody->GetMaterial()->GetSurfaceData();
- if(mlContactCount <=0 && pSurface)
- {
- //Sound
- cSurfaceImpactData* pImpact = pSurface->GetImpactDataFromSpeed(fProxySpeed*0.3f);
- if(pImpact)
- {
- cSoundEntity *pSound = pWorld->CreateSoundEntity( "Hit",pImpact->GetSoundName(),
- true);
- pSound->SetWorldPosition(vProxyPos);
- }
-
- //Particle system (and other effects)
- pSurface->CreateImpactEffect(fProxySpeed*0.3f,vProxyPos,1,NULL);
- }
- }
-
- ////////////////////////////
- //Update contact count
- if(bHadContact)
- {
- mlContactCount = 10;
- }
- else
- {
- mlContactCount--;
- if(mlContactCount<=0) mlContactCount=0;
- }
-
- mvPrevPrxoyPos = vProxyPos;
-}
-
-//-----------------------------------------------------------------------
-
diff --git a/engines/hpl1/penumbra-overture/HapticGameCamera.h b/engines/hpl1/penumbra-overture/HapticGameCamera.h
deleted file mode 100644
index 9e39534cf20..00000000000
--- a/engines/hpl1/penumbra-overture/HapticGameCamera.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#ifndef GAME_HAPTIC_GAME_CAMERA_H
-#define GAME_HAPTIC_GAME_CAMERA_H
-
-#include "hpl1/engine/engine.h"
-
-#include "hpl1/penumbra-overture/GameTypes.h"
-#include "common/list.h"
-
-using namespace hpl;
-
-class cInit;
-class cPlayer;
-
-enum eHapticGameCameraType {
- eHapticGameCameraType_Frame,
- eHapticGameCameraType_Centre,
- eHapticGameCameraType_LastEnum
-};
-
-//----------------------------------------
-
-class cHapticGameCamera {
-public:
- cHapticGameCamera(cInit *apInit, cPlayer *apPlayer);
- ~cHapticGameCamera();
-
- void Update(float afTimeStep);
-
- void OnWorldLoad();
- void OnWorldExit();
- void Reset();
-
- void OnPostSceneDraw();
-
- bool IsTurning() { return mbIsTurning; }
-
- void SetActive(bool abX);
- void SetCamMoveActive(bool abX) { mbCamMove = abX; }
-
- bool ShowCrosshair();
-
- void SetType(eHapticGameCameraType aType);
-
- cMeshEntity *GetHandEntity() { return mpHandEntity; }
- iCollideShape *GetHandShape() { return mpHandShape; }
-
- void SetHandVisible(bool abX);
- bool GetHandVisible();
-
- float GetHandReachRadius();
-
- void SetRenderActive(bool abX);
-
- void SetInteractModeCameraSpeed(float afSpeed);
- void SetActionModeCameraSpeed(float afSpeed);
- float GetInteractModeCameraSpeed() { return mfInteractModeCameraSpeed; }
- float GetActionModeCameraSpeed() { return mfActionModeCameraSpeed; }
-
- void SetUseFrame(bool abX) { mbUseFrame = abX; }
-
-private:
- void UpdateCameraOrientation(float afTimeStep);
- void UpdateHand(float afTimeStep);
- void UpdateProxyCovered(float afTimeStep);
- void UpdateProxyInteraction(float afTimeStep);
-
- bool mbActive;
-
- bool mbRenderActive;
-
- cVector3f mvPrevPrxoyPos;
-
- int mlContactCount;
-
- bool mbUseFrame;
-
- bool mbHandVisible;
-
- cVector3f mvCentrePos;
-
- tHapticShapeList mlstActiveShapes;
-
- float mfInteractModeCameraSpeed;
- float mfActionModeCameraSpeed;
-
- float mfFrameW;
- float mfFrameH;
-
- float mfFrameForceStrength;
- float mfFrameMaxForce;
- float mfFrameMoveSpeedX;
- float mfFrameMoveSpeedY;
- float mfFrameMaxMoveSpeed;
-
- bool mbCamMove;
-
- eHapticGameCameraType mType;
-
- cInit *mpInit;
- cPlayer *mpPlayer;
- iLowLevelHaptic *mpLowLevelHaptic;
- cScene *mpScene;
-
- bool mbHapticWasActive;
- bool mbIsTurning;
- bool mbAtEdge;
-
- iHapticForce *mpForce;
-
- cMeshEntity *mpHandEntity;
- iCollideShape *mpHandShape;
-
- iGpuProgram *mpVtxProgram;
-
- Common::List<cVector3f> mlstProxyPos;
-};
-//----------------------------------------
-
-#endif // GAME_HAPTIC_GAME_CAMERA_H
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
index f83a8578478..81931e0edf9 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.cpp
@@ -76,14 +76,6 @@ bool cMeleeRayCallback::OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apPa
cHudModel_WeaponMelee::cHudModel_WeaponMelee() : iHudModel(ePlayerHandType_WeaponMelee) {
ResetExtraData();
-
- if (gpInit->mbHasHaptics) {
- mpLowLevelHaptic = gpInit->mpGame->GetHaptic()->GetLowLevel();
- mpHHitForce = mpLowLevelHaptic->CreateSinusWaveForce(cVector3f(0, 1, 0), 0.63f, 5);
- mpHHitForce->SetActive(false);
- } else {
- mpLowLevelHaptic = NULL;
- }
}
//-----------------------------------------------------------------------
@@ -696,14 +688,6 @@ void cHudModel_WeaponMelee::Attack() {
// Play hit sound
if (bHit) {
PlaySound(mvAttacks[mlCurrentAttack].msHitSound);
-
- if (mpInit->mbHasHaptics) {
- if (mpHHitForce->IsActive())
- mpHHitForce->SetActive(false);
-
- mpHHitForce->SetActive(true);
- mpHHitForce->SetTimeControl(false, 0.3f, 0.2f, 0, 0.1f);
- }
}
mpInit->mbWeaponAttacking = false;
diff --git a/engines/hpl1/penumbra-overture/HudModel_Weapon.h b/engines/hpl1/penumbra-overture/HudModel_Weapon.h
index 8d1336f9138..d61e6767b2b 100644
--- a/engines/hpl1/penumbra-overture/HudModel_Weapon.h
+++ b/engines/hpl1/penumbra-overture/HudModel_Weapon.h
@@ -146,9 +146,6 @@ private:
cMeleeRayCallback mRayCallback;
Common::Array<cMeleeWeaponAttack> mvAttacks;
-
- iLowLevelHaptic *mpLowLevelHaptic;
- iHapticForce *mpHHitForce;
};
//-------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/Init.cpp b/engines/hpl1/penumbra-overture/Init.cpp
index f77deda7437..35043bb0a2e 100644
--- a/engines/hpl1/penumbra-overture/Init.cpp
+++ b/engines/hpl1/penumbra-overture/Init.cpp
@@ -54,7 +54,6 @@
#include "hpl1/penumbra-overture/FadeHandler.h"
#include "hpl1/penumbra-overture/GameMusicHandler.h"
#include "hpl1/penumbra-overture/GraphicsHelper.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Inventory.h"
#include "hpl1/penumbra-overture/MapLoadText.h"
#include "hpl1/penumbra-overture/Notebook.h"
@@ -102,8 +101,6 @@ cInit::cInit() : iUpdateable("Init") {
mlMaxSoundDataNum = 120;
mlMaxPSDataNum = 12;
mbShowCrossHair = false;
- mbHasHaptics = false;
- mbHasHapticsOnRestart = false;
gpInit = this;
}
@@ -176,15 +173,6 @@ bool cInit::Init(tString saveToLoad) {
mbFlashItems = getBoolConfig("flash_items", true);
mbShowCrossHair = getBoolConfig("show_crosshair", false);
- mbHapticsAvailable = false;
- mbHasHaptics = false;
- mfHapticForceMul = 1.0f;
- mfHapticMoveScreenSpeedMul = 1.0f;
- mfHapticScale = 0.04f;
- mfHapticProxyRadius = 0.019f;
- mfHapticOffsetZ = 1.9f;
- mfHapticMaxInteractDist = 2;
-
mbSimpleSwingInOptions = false;
msGlobalScriptFile = getStringConfig("global_script", "global_script.hps");
@@ -245,12 +233,6 @@ bool cInit::Init(tString saveToLoad) {
CheckTimeLimit();
#endif
- // Make sure there really is haptic support!
- if (mbHasHaptics && cHaptic::GetIsUsed() == false) {
- // CreateMessageBoxW(_W("Error!"), _W("No haptic support found. Mouse will be used instead!\n"));
- mbHasHaptics = false;
- }
-
// Make sure hardware is really used.
mbUseSoundHardware = mpGame->GetSound()->GetLowLevel()->IsHardwareAccelerated();
@@ -298,7 +280,7 @@ bool cInit::Init(tString saveToLoad) {
mpGame->GetSound()->GetLowLevel()->SetVolume(1);
// PHYSICS INIT /////////////////////
- mpGame->GetPhysics()->LoadSurfaceData("materials.cfg", mpGame->GetHaptic());
+ mpGame->GetPhysics()->LoadSurfaceData("materials.cfg");
// EARLY GAME INIT /////////////////////
mpEffectHandler = hplNew(cEffectHandler, (this));
@@ -325,14 +307,6 @@ bool cInit::Init(tString saveToLoad) {
mpGame->SetLimitFPS(getBoolConfig("limit_fps", true));
- // HAPTIC INIT ////////////////////
- if (mbHasHaptics) {
- mpGame->GetHaptic()->GetLowLevel()->SetWorldScale(mfHapticScale);
- mpGame->GetHaptic()->GetLowLevel()->SetVirtualMousePosBounds(cVector2f(-60, -60),
- cVector2f(25, 25), cVector2f(800, 600));
- mpGame->GetHaptic()->GetLowLevel()->SetProxyRadius(mfHapticProxyRadius);
- }
-
// BASE GAME INIT /////////////////////
mpMusicHandler = hplNew(cGameMusicHandler, (this));
mpPlayerHands = hplNew(cPlayerHands, (this));
diff --git a/engines/hpl1/penumbra-overture/Init.h b/engines/hpl1/penumbra-overture/Init.h
index 6b25509f6ba..3657cb63327 100644
--- a/engines/hpl1/penumbra-overture/Init.h
+++ b/engines/hpl1/penumbra-overture/Init.h
@@ -110,16 +110,6 @@ public:
int mlFSAA;
eGameDifficulty mDifficulty;
- bool mbHasHaptics;
- bool mbHasHapticsOnRestart;
- bool mbHapticsAvailable;
- float mfHapticForceMul;
- float mfHapticMoveScreenSpeedMul;
- float mfHapticScale;
- float mfHapticProxyRadius;
- float mfHapticOffsetZ;
- float mfHapticMaxInteractDist;
-
int mlMaxSoundChannels;
int mlStreamUpdateFreq;
bool mbUseSoundHardware;
diff --git a/engines/hpl1/penumbra-overture/Inventory.cpp b/engines/hpl1/penumbra-overture/Inventory.cpp
index 081d9be27a3..6c42d3c1a88 100644
--- a/engines/hpl1/penumbra-overture/Inventory.cpp
+++ b/engines/hpl1/penumbra-overture/Inventory.cpp
@@ -31,7 +31,6 @@
#include "hpl1/penumbra-overture/GameItem.h"
#include "hpl1/penumbra-overture/GameItemType.h"
#include "hpl1/penumbra-overture/GameMessageHandler.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/Notebook.h"
#include "hpl1/penumbra-overture/Player.h"
@@ -126,10 +125,7 @@ cInventory::cInventory(cInit *apInit) : iUpdateable("Inventory") {
mvItemTypes[eGameItemType_GlowStick] = hplNew(cGameItemType_GlowStick, (mpInit));
mvItemTypes[eGameItemType_Flare] = hplNew(cGameItemType_Flare, (mpInit));
mvItemTypes[eGameItemType_Painkillers] = hplNew(cGameItemType_Painkillers, (mpInit));
- if (mpInit->mbHasHaptics)
- mvItemTypes[eGameItemType_WeaponMelee] = hplNew(cGameItemType_WeaponMeleeHaptX, (mpInit));
- else
- mvItemTypes[eGameItemType_WeaponMelee] = hplNew(cGameItemType_WeaponMelee, (mpInit));
+ mvItemTypes[eGameItemType_WeaponMelee] = hplNew(cGameItemType_WeaponMelee, (mpInit));
mvItemTypes[eGameItemType_Throw] = hplNew(cGameItemType_Throw, (mpInit));
Reset();
@@ -1041,18 +1037,12 @@ void cInventory::SetActive(bool abX) {
mbActive = abX;
if (mbActive) {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
-
mLastCrossHairState = mpInit->mpPlayer->GetCrossHairState();
mvMousePos = cVector2f(400, 300);
mpInit->mpPlayer->SetCrossHairPos(mvMousePos);
mpInit->mpPlayer->SetCrossHairState(eCrossHairState_Pointer);
} else {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
-
mpInit->mpPlayer->SetCrossHairState(mLastCrossHairState);
mbMessageActive = false;
}
diff --git a/engines/hpl1/penumbra-overture/MainMenu.cpp b/engines/hpl1/penumbra-overture/MainMenu.cpp
index fbd67beedde..0557e52eecf 100644
--- a/engines/hpl1/penumbra-overture/MainMenu.cpp
+++ b/engines/hpl1/penumbra-overture/MainMenu.cpp
@@ -30,7 +30,6 @@
#include "hpl1/penumbra-overture/ButtonHandler.h"
#include "hpl1/penumbra-overture/EffectHandler.h"
#include "hpl1/penumbra-overture/GraphicsHelper.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/IntroStory.h"
#include "hpl1/penumbra-overture/MapHandler.h"
@@ -805,109 +804,12 @@ public:
cMainMenuWidget_Text *gpInvertMouseYText = NULL;
cMainMenuWidget_Text *gpMouseSensitivityText = NULL;
cMainMenuWidget_Text *gpToggleCrouchText = NULL;
-cMainMenuWidget_Text *gpUseHapticsText = NULL;
cMainMenuWidget_Text *gpWidgetInteractModeCameraSpeedText = NULL;
cMainMenuWidget_Text *gpWidgetActionModeCameraSpeedText = NULL;
cMainMenuWidget_Text *gpWidgetWeightForceScaleText = NULL;
//-----------------------------------------------------------------------
-class cMainMenuWidget_UseHaptics : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_UseHaptics(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) { msTip = _W(""); }
-
- void OnMouseDown(eMButton aButton) {
- mpInit->mbHasHapticsOnRestart = !mpInit->mbHasHapticsOnRestart;
-
- gpUseHapticsText->msText = mpInit->mbHasHapticsOnRestart ? kTranslate("MainMenu", "On") : kTranslate("MainMenu", "Off");
- gbMustRestart = true;
- }
-};
-
-//-----------------------------------------------------------------------
-
-class cMainMenuWidget_WeightForceScale : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_WeightForceScale(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) { msTip = _W(""); }
-
- void OnMouseDown(eMButton aButton) {
- float afX = mpInit->mfHapticForceMul;
- if (aButton == eMButton_Left) {
- afX += 0.1f;
- if (afX > 3.0f)
- afX = 3.0f;
- } else if (aButton == eMButton_Right) {
- afX -= 0.1f;
- if (afX < 0.0f)
- afX = 0.0f;
- }
-
- char sTempVec[256];
- snprintf(sTempVec, 256, "%.1f", afX);
- gpWidgetWeightForceScaleText->msText = cString::To16Char(sTempVec);
-
- mpInit->mfHapticForceMul = afX;
- }
-};
-
-//-----------------------------------------------------------------------
-
-class cMainMenuWidget_InteractModeCameraSpeed : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_InteractModeCameraSpeed(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) { msTip = _W(""); }
-
- void OnMouseDown(eMButton aButton) {
- float afX = mpInit->mpPlayer->GetHapticCamera()->GetInteractModeCameraSpeed();
- if (aButton == eMButton_Left) {
- afX += 0.1f;
- if (afX > 3.0f)
- afX = 3.0f;
- } else if (aButton == eMButton_Right) {
- afX -= 0.1f;
- if (afX < 0.1f)
- afX = 0.1f;
- }
-
- char sTempVec[256];
- snprintf(sTempVec, 256, "%.1f", afX);
- gpWidgetInteractModeCameraSpeedText->msText = cString::To16Char(sTempVec);
-
- mpInit->mpPlayer->GetHapticCamera()->SetInteractModeCameraSpeed(afX);
- }
-};
-
-//-----------------------------------------------------------------------
-
-class cMainMenuWidget_ActionModeCameraSpeed : public cMainMenuWidget_Button {
-public:
- cMainMenuWidget_ActionModeCameraSpeed(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
- : cMainMenuWidget_Button(apInit, avPos, asText, eMainMenuState_LastEnum, avFontSize, aAlignment) { msTip = _W(""); }
-
- void OnMouseDown(eMButton aButton) {
- float afX = mpInit->mpPlayer->GetHapticCamera()->GetActionModeCameraSpeed();
- if (aButton == eMButton_Left) {
- afX += 0.1f;
- if (afX > 3.0f)
- afX = 3.0f;
- } else if (aButton == eMButton_Right) {
- afX -= 0.1f;
- if (afX < 0.1f)
- afX = 0.1f;
- }
-
- char sTempVec[256];
- snprintf(sTempVec, 256, "%.1f", afX);
- gpWidgetActionModeCameraSpeedText->msText = cString::To16Char(sTempVec);
-
- mpInit->mpPlayer->GetHapticCamera()->SetActionModeCameraSpeed(afX);
- }
-};
-
-//-----------------------------------------------------------------------
-
class cMainMenuWidget_InvertMouseY : public cMainMenuWidget_Button {
public:
cMainMenuWidget_InvertMouseY(cInit *apInit, const cVector3f &avPos, const tWString &asText, cVector2f avFontSize, eFontAlign aAlignment)
@@ -2068,9 +1970,6 @@ void cMainMenu::SetActive(bool abX) {
mbActive = abX;
if (mbActive) {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
-
if (!mpInit->mbFullScreen) {
mpInit->mpGame->GetInput()->GetLowLevel()->LockInput(false);
}
@@ -2078,10 +1977,6 @@ void cMainMenu::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("MainMenu");
mpInit->mpGame->GetScene()->SetDrawScene(false);
mpInit->mpGame->GetScene()->SetUpdateMap(false);
- if (mpInit->mbHasHaptics) {
- mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
- }
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_MainMenu);
@@ -2133,9 +2028,6 @@ void cMainMenu::SetActive(bool abX) {
mpInit->mpGame->GetInput()->GetLowLevel()->LockInput(true);
}
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
-
cSoundHandler *pSoundHandler = mpInit->mpGame->GetSound()->GetSoundHandler();
if (mpInit->mpMapHandler->GetCurrentMapName() != "") {
@@ -2153,8 +2045,6 @@ void cMainMenu::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("Default");
mpInit->mpGame->GetScene()->SetDrawScene(true);
mpInit->mpGame->GetScene()->SetUpdateMap(true);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(true);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_Game);
if (mpLogo)
@@ -2558,46 +2448,6 @@ void cMainMenu::CreateWidgets() {
cMainMenuWidget *pWidgetToggleCrouch = hplNew(cMainMenuWidget_ToggleCrouch, (mpInit, vPos, kTranslate("MainMenu", "Toggle Crouch:"), 20, eFontAlign_Right));
AddWidgetToState(eMainMenuState_OptionsControls, pWidgetToggleCrouch);
vPos.y += 29;
- cMainMenuWidget *pWidgetUseHaptics = NULL;
- cMainMenuWidget *pWidgetInteractModeCameraSpeed = NULL;
- cMainMenuWidget *pWidgetActionModeCameraSpeed = NULL;
- cMainMenuWidget *pWidgetWeightForceScale = NULL;
- if (mpInit->mbHapticsAvailable) {
- vPos.y += 5;
- // Use haptics
- tWString sText2 = kTranslate("MainMenu", "Use Haptics:");
- if (sText2 == _W(""))
- sText2 = _W("Use Haptics:");
- pWidgetUseHaptics = hplNew(cMainMenuWidget_UseHaptics, (mpInit, vPos, sText2, 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsControls, pWidgetUseHaptics);
- vPos.y += 29;
-
- // Weight Force Scale
- sText2 = kTranslate("MainMenu", "Weight Force Scale:");
- if (sText2 == _W(""))
- sText2 = _W("Weight Force Scale:");
- pWidgetWeightForceScale = hplNew(cMainMenuWidget_WeightForceScale, (mpInit, vPos, sText2, 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsControls, pWidgetWeightForceScale);
- vPos.y += 29;
-
- // InteractMode camera speed
- sText2 = kTranslate("MainMenu", "InteractMode Camera Speed:");
- if (sText2 == _W(""))
- sText2 = _W("InteractMode Camera Speed:");
- pWidgetInteractModeCameraSpeed = hplNew(cMainMenuWidget_InteractModeCameraSpeed, (mpInit, vPos, sText2, 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsControls, pWidgetInteractModeCameraSpeed);
- vPos.y += 29;
-
- // ActionMode camera speed
- sText2 = kTranslate("MainMenu", "ActionMode Camera Speed:");
- if (sText2 == _W(""))
- sText2 = _W("ActionMode Camera Speed:");
- pWidgetActionModeCameraSpeed = hplNew(cMainMenuWidget_ActionModeCameraSpeed, (mpInit, vPos, sText2, 20, eFontAlign_Right));
- AddWidgetToState(eMainMenuState_OptionsControls, pWidgetActionModeCameraSpeed);
- vPos.y += 29;
-
- vPos.y += 5;
- }
// cMainMenuWidget *pWidgetChangeKeyConf = hplNew(cMainMenuWidget_Button, (mpInit, vPos, kTranslate("MainMenu", "Change Key Mapping"), eMainMenuState_OptionsKeySetupMove, 20, eFontAlign_Center));
// AddWidgetToState(eMainMenuState_OptionsControls, pWidgetChangeKeyConf);
// vPos.y += 35;
@@ -2621,33 +2471,6 @@ void cMainMenu::CreateWidgets() {
gpToggleCrouchText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetToggleCrouch));
AddWidgetToState(eMainMenuState_OptionsControls, gpToggleCrouchText);
- if (mpInit->mbHapticsAvailable) {
- vPos.y += 5;
- vPos.y += 29;
- sText = mpInit->mbHasHapticsOnRestart ? kTranslate("MainMenu", "On") : kTranslate("MainMenu", "Off");
- gpUseHapticsText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left));
- AddWidgetToState(eMainMenuState_OptionsControls, gpUseHapticsText);
- gpUseHapticsText->SetExtraWidget(pWidgetUseHaptics);
-
- vPos.y += 29;
- snprintf(sTempVec, 256, "%.1f", mpInit->mfHapticForceMul);
- sText = cString::To16Char(sTempVec);
- gpWidgetWeightForceScaleText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetWeightForceScale));
- AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetWeightForceScaleText);
-
- vPos.y += 29;
- snprintf(sTempVec, 256, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetInteractModeCameraSpeed());
- sText = cString::To16Char(sTempVec);
- gpWidgetInteractModeCameraSpeedText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetInteractModeCameraSpeed));
- AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetInteractModeCameraSpeedText);
-
- vPos.y += 29;
- snprintf(sTempVec, 256, "%.1f", mpInit->mpPlayer->GetHapticCamera()->GetActionModeCameraSpeed());
- sText = cString::To16Char(sTempVec);
- gpWidgetActionModeCameraSpeedText = hplNew(cMainMenuWidget_Text, (mpInit, vPos, sText, 20, eFontAlign_Left, pWidgetActionModeCameraSpeed));
- AddWidgetToState(eMainMenuState_OptionsControls, gpWidgetActionModeCameraSpeedText);
- }
-
///////////////////////////////////
// Options Key Setup General stuff
///////////////////////////////////
diff --git a/engines/hpl1/penumbra-overture/MapHandler.cpp b/engines/hpl1/penumbra-overture/MapHandler.cpp
index baa493f7f28..278740cefa8 100644
--- a/engines/hpl1/penumbra-overture/MapHandler.cpp
+++ b/engines/hpl1/penumbra-overture/MapHandler.cpp
@@ -391,10 +391,6 @@ bool cMapHandler::Load(const tString &asFile, const tString &asStartPos) {
mpInit->mpGame->GetSound()->GetSoundHandler()->StopAll(eSoundDest_World);
mpInit->mpGame->GetSound()->Update(1.0f / 60.0f);
- // Destroy Haptic shapes
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();
-
////////////////////////////////////////
// LOAD THE MAP ////////////////////////
@@ -530,10 +526,6 @@ bool cMapHandler::LoadSimple(const tString &asFile, bool abLoadEntities) {
cWorld3D *pOldWorld = mpScene->GetWorld3D();
- // Haptic
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();
-
// Delete all sound entities
if (pOldWorld) {
pOldWorld->DestroyAllSoundEntities();
@@ -1316,12 +1308,6 @@ void cMapHandler::Reset() {
DestroyAll();
- // Haptic
- if (mpInit->mbHasHaptics) {
- mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();
- mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
- }
-
// World3D
if (mpScene->GetWorld3D())
mpScene->DestroyWorld3D(mpScene->GetWorld3D());
diff --git a/engines/hpl1/penumbra-overture/MapLoadText.cpp b/engines/hpl1/penumbra-overture/MapLoadText.cpp
index 8fdfae8f9e9..df5b7138f09 100644
--- a/engines/hpl1/penumbra-overture/MapLoadText.cpp
+++ b/engines/hpl1/penumbra-overture/MapLoadText.cpp
@@ -157,8 +157,6 @@ void cMapLoadText::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("MapLoadText");
mpInit->mpGame->GetScene()->SetDrawScene(false);
mpInit->mpGame->GetScene()->SetUpdateMap(false);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_MapLoadText);
mpBack = mpInit->mpGame->GetResources()->GetTextureManager()->Create2D("other_load_text_back.jpg", false);
@@ -178,8 +176,6 @@ void cMapLoadText::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("Default");
mpInit->mpGame->GetScene()->SetDrawScene(true);
mpInit->mpGame->GetScene()->SetUpdateMap(true);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(true);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_Game);
}
}
diff --git a/engines/hpl1/penumbra-overture/Notebook.cpp b/engines/hpl1/penumbra-overture/Notebook.cpp
index b77336c6351..522e6590057 100644
--- a/engines/hpl1/penumbra-overture/Notebook.cpp
+++ b/engines/hpl1/penumbra-overture/Notebook.cpp
@@ -28,7 +28,6 @@
#include "hpl1/penumbra-overture/Notebook.h"
#include "hpl1/penumbra-overture/EffectHandler.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/Inventory.h"
#include "hpl1/penumbra-overture/Player.h"
@@ -1051,9 +1050,6 @@ void cNotebook::SetBookType(eNotebookType aType) {
void cNotebook::SetActive(bool abX) {
mbActive = abX;
if (mbActive) {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
-
mLastCrossHairState = mpInit->mpPlayer->GetCrossHairState();
if (mpInit->mpInventory->IsActive()) {
@@ -1070,9 +1066,6 @@ void cNotebook::SetActive(bool abX) {
mStateMachine.ChangeState(eNotebookState_Front);
mvBookTypes[0].mfAlpha = 1;
} else {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
-
if (mbInventoryWasActive) {
mpInit->mpInventory->SetActive(true);
mpInit->mpInventory->SetMousePos(mvMousePos);
diff --git a/engines/hpl1/penumbra-overture/NumericalPanel.cpp b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
index 703fb4529ee..1374c801126 100644
--- a/engines/hpl1/penumbra-overture/NumericalPanel.cpp
+++ b/engines/hpl1/penumbra-overture/NumericalPanel.cpp
@@ -27,7 +27,6 @@
#include "hpl1/penumbra-overture/NumericalPanel.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Init.h"
#include "hpl1/penumbra-overture/Player.h"
@@ -301,9 +300,6 @@ void cNumericalPanel::SetActive(bool abX) {
mbActive = abX;
if (mbActive) {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(false);
-
mpInit->mpGame->GetInput()->BecameTriggerd("RightClick");
mpInit->mpGame->GetInput()->BecameTriggerd("LeftClick");
@@ -314,9 +310,6 @@ void cNumericalPanel::SetActive(bool abX) {
mvDigits.clear();
} else {
- if (mpInit->mbHasHaptics)
- mpInit->mpPlayer->GetHapticCamera()->SetActive(true);
-
mpInit->mpPlayer->SetCrossHairState(mLastCrossHairState);
mpInit->mpPlayer->SetCrossHairPos(cVector2f(400, 300));
}
diff --git a/engines/hpl1/penumbra-overture/Player.cpp b/engines/hpl1/penumbra-overture/Player.cpp
index 4f5c801ce2a..bf030c4a2c9 100644
--- a/engines/hpl1/penumbra-overture/Player.cpp
+++ b/engines/hpl1/penumbra-overture/Player.cpp
@@ -33,10 +33,6 @@
#include "hpl1/penumbra-overture/PlayerHelper.h"
#include "hpl1/penumbra-overture/PlayerMoveStates.h"
-#include "hpl1/penumbra-overture/PlayerState_InteractHaptX.h"
-#include "hpl1/penumbra-overture/PlayerState_MiscHaptX.h"
-#include "hpl1/penumbra-overture/PlayerState_WeaponHaptX.h"
-
#include "hpl1/penumbra-overture/PlayerState_Interact.h"
#include "hpl1/penumbra-overture/PlayerState_Misc.h"
#include "hpl1/penumbra-overture/PlayerState_Weapon.h"
@@ -47,8 +43,6 @@
#include "hpl1/penumbra-overture/Notebook.h"
#include "hpl1/penumbra-overture/SaveHandler.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
-
#include "hpl1/penumbra-overture/TriggerHandler.h"
#include "hpl1/penumbra-overture/Triggers.h"
@@ -106,30 +100,16 @@ cPlayer::cPlayer(cInit *apInit) : iUpdateable("Player") {
mState = ePlayerState_Normal;
mvStates.resize(ePlayerState_LastEnum);
-
- if (mpInit->mbHasHaptics) {
- mvStates[ePlayerState_Normal] = hplNew(cPlayerState_NormalHaptX, (mpInit, this));
- mvStates[ePlayerState_Push] = hplNew(cPlayerState_PushHaptX, (mpInit, this));
- mvStates[ePlayerState_Move] = hplNew(cPlayerState_MoveHaptX, (mpInit, this));
- mvStates[ePlayerState_InteractMode] = hplNew(cPlayerState_InteractModeHaptX, (mpInit, this));
- mvStates[ePlayerState_Grab] = hplNew(cPlayerState_GrabHaptX, (mpInit, this));
- mvStates[ePlayerState_WeaponMelee] = hplNew(cPlayerState_WeaponMeleeHaptX, (mpInit, this));
- mvStates[ePlayerState_UseItem] = hplNew(cPlayerState_UseItemHaptX, (mpInit, this));
- mvStates[ePlayerState_Message] = hplNew(cPlayerState_MessageHaptX, (mpInit, this));
- mvStates[ePlayerState_Throw] = hplNew(cPlayerState_ThrowHaptX, (mpInit, this));
- mvStates[ePlayerState_Climb] = hplNew(cPlayerState_ClimbHaptX, (mpInit, this));
- } else {
- mvStates[ePlayerState_Normal] = hplNew(cPlayerState_Normal, (mpInit, this));
- mvStates[ePlayerState_Push] = hplNew(cPlayerState_Push, (mpInit, this));
- mvStates[ePlayerState_Move] = hplNew(cPlayerState_Move, (mpInit, this));
- mvStates[ePlayerState_InteractMode] = hplNew(cPlayerState_InteractMode, (mpInit, this));
- mvStates[ePlayerState_Grab] = hplNew(cPlayerState_Grab, (mpInit, this));
- mvStates[ePlayerState_WeaponMelee] = hplNew(cPlayerState_WeaponMelee, (mpInit, this));
- mvStates[ePlayerState_UseItem] = hplNew(cPlayerState_UseItem, (mpInit, this));
- mvStates[ePlayerState_Message] = hplNew(cPlayerState_Message, (mpInit, this));
- mvStates[ePlayerState_Throw] = hplNew(cPlayerState_Throw, (mpInit, this));
- mvStates[ePlayerState_Climb] = hplNew(cPlayerState_Climb, (mpInit, this));
- }
+ mvStates[ePlayerState_Normal] = hplNew(cPlayerState_Normal, (mpInit, this));
+ mvStates[ePlayerState_Push] = hplNew(cPlayerState_Push, (mpInit, this));
+ mvStates[ePlayerState_Move] = hplNew(cPlayerState_Move, (mpInit, this));
+ mvStates[ePlayerState_InteractMode] = hplNew(cPlayerState_InteractMode, (mpInit, this));
+ mvStates[ePlayerState_Grab] = hplNew(cPlayerState_Grab, (mpInit, this));
+ mvStates[ePlayerState_WeaponMelee] = hplNew(cPlayerState_WeaponMelee, (mpInit, this));
+ mvStates[ePlayerState_UseItem] = hplNew(cPlayerState_UseItem, (mpInit, this));
+ mvStates[ePlayerState_Message] = hplNew(cPlayerState_Message, (mpInit, this));
+ mvStates[ePlayerState_Throw] = hplNew(cPlayerState_Throw, (mpInit, this));
+ mvStates[ePlayerState_Climb] = hplNew(cPlayerState_Climb, (mpInit, this));
// The max distance you can be from something to grab it.
mfMaxGrabDist = mpInit->mpGameConfig->GetFloat("Player", "MaxGrabDist", 0);
@@ -237,26 +217,6 @@ cPlayer::cPlayer(cInit *apInit) : iUpdateable("Player") {
mvCrossHairs[eCrossHairState_Ladder] = mpGfxDrawer->CreateGfxObject("player_crosshair_ladder", "diffalpha2d");
mvCrossHairs[eCrossHairState_Cross] = mpGfxDrawer->CreateGfxObject("player_crosshair_cross", "diffalpha2d");
- ///////////////////////////////
- // Haptic Init
- if (mpInit->mbHasHaptics) {
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
-
- mpLowLevelHaptic->SetCamera(mpCamera);
- mpLowLevelHaptic->SetCameraOffset(cVector3f(0, 0.7f, mpInit->mfHapticOffsetZ));
-
- mpHapticCamera = hplNew(cHapticGameCamera, (mpInit, this));
-
- mpDamageForce = mpInit->mpGame->GetHaptic()->GetLowLevel()->CreateSinusWaveForce(
- cVector3f(0, 1, 0), 0.1f, 3);
-
- mpDamageDirForce = mpLowLevelHaptic->CreateImpulseForce(0);
- mpDamageDirForce->SetActive(false);
-
- mpHapticCamera->SetInteractModeCameraSpeed(mpInit->mpConfig->GetFloat("Haptics", "InteractModeCameraSpeed", 0.5f));
- mpHapticCamera->SetActionModeCameraSpeed(mpInit->mpConfig->GetFloat("Haptics", "ActionModeCameraSpeed", 1.0f));
- }
-
// Set up variable values
Reset();
}
@@ -264,8 +224,6 @@ cPlayer::cPlayer(cInit *apInit) : iUpdateable("Player") {
//-----------------------------------------------------------------------
cPlayer::~cPlayer(void) {
- if (mpInit->mbHasHaptics)
- hplDelete(mpHapticCamera);
hplDelete(mpGroundRayCallback);
hplDelete(mpPickRayCallback);
hplDelete(mpHeadMove);
@@ -615,9 +573,6 @@ void cPlayer::Damage(float afDamage, ePlayerDamageType aType) {
if (mpInit->mDifficulty == eGameDifficulty_Hard)
afDamage *= 2.0f;
- if (mpInit->mbHasHaptics)
- afDamage /= 4.0f;
-
if (mpDeath->IsActive())
return;
@@ -633,33 +588,6 @@ void cPlayer::Damage(float afDamage, ePlayerDamageType aType) {
mpDamage->Start(fSize, aType);
AddHealth(-afDamage);
-
- if (mpInit->mbHasHaptics && aType == ePlayerDamageType_BloodSplash) {
- if (mbDamageFromPos) {
- mbDamageFromPos = false;
-
- cVector3f vDir = cMath::Vector3Normalize(mpCharBody->GetPosition() - mvDamagePos);
-
- if (mpDamageDirForce->IsActive())
- mpDamageDirForce->SetActive(false);
- mpDamageDirForce->SetActive(true);
-
- cMatrixf mtxProxy = cMath::MatrixRotate(cVector3f(-mpCamera->GetPitch(), -mpCamera->GetYaw(),
- -mpCamera->GetRoll()),
- eEulerRotationOrder_YXZ);
- vDir = cMath::MatrixMul(mtxProxy, vDir);
-
- mpDamageDirForce->SetForce(vDir * fSize * 2.2f);
- mpDamageDirForce->SetTimeControl(false, 0.2f, 0.5f, 0.0f, 0.15f);
- } else {
- mpDamageForce->SetAmp(fSize * 0.15f);
-
- if (mpDamageForce->IsActive())
- mpDamageForce->SetActive(false);
- mpDamageForce->SetActive(true);
- mpDamageForce->SetTimeControl(false, 0.3f, 0.0f, 0.05f, 0.25f);
- }
- }
}
//-----------------------------------------------------------------------
@@ -931,8 +859,6 @@ void cPlayer::OnWorldLoad() {
mpFlare->OnWorldLoad();
mpHidden->OnWorldLoad();
mpLean->OnWorldLoad();
- if (mpInit->mbHasHaptics)
- mpHapticCamera->OnWorldLoad();
}
//-----------------------------------------------------------------------
@@ -943,8 +869,6 @@ void cPlayer::OnWorldExit() {
mpGroundRayCallback->OnWorldExit();
mpPickRayCallback->OnWorldExit();
mpHidden->OnWorldExit();
- if (mpInit->mbHasHaptics)
- mpHapticCamera->OnWorldExit();
}
//-----------------------------------------------------------------------
@@ -977,12 +901,6 @@ void cPlayer::Update(float afTimeStep) {
//unsigned int lTime = pSystem->GetLowLevel()->getTime();
iPhysicsWorld *pPhysicsWorld = mpScene->GetWorld3D()->GetPhysicsWorld();
- /////////////////////////////////////
- // HaptX camera
- if (cHaptic::GetIsUsed()) {
- mpHapticCamera->Update(afTimeStep);
- }
-
// LogUpdate(" Death\n");
////////////////////////////////////////
// Make sure player is dead if he should be
@@ -1314,8 +1232,6 @@ void cPlayer::Reset() {
mpHealth->Reset();
mpHidden->Reset();
mpGroundRayCallback->Reset();
- if (mpInit->mbHasHaptics)
- mpHapticCamera->Reset();
}
//-----------------------------------------------------------------------
@@ -1347,22 +1263,6 @@ void cPlayer::OnDraw() {
// Cross hair
if (IsActive() == false) {
// Do noting...
- } else if (mpInit->mbHasHaptics && mpHapticCamera->ShowCrosshair() == false) {
- if (mCrossHairState != eCrossHairState_None) {
- cVector3f vProjPos = cMath::MatrixMul(mpCamera->GetViewMatrix(),
- mpHapticCamera->GetHandEntity()->GetWorldPosition());
- vProjPos = cMath::MatrixMulDivideW(mpCamera->GetProjectionMatrix(), vProjPos);
-
- cVector2f vPos((vProjPos.x + 1) * 0.5f, (-vProjPos.y + 1) * 0.5f);
- vPos *= cVector2f(800, 600);
-
- vPos += cVector2f(10, 10);
- cResourceImage *pImage = mvCrossHairs[mCrossHairState]->GetMaterial()->GetImage(eMaterialTexture_Diffuse);
- cVector2l vSize = pImage->GetSize();
- cVector2f vPosAdd(((float)vSize.x) / 2.0f, ((float)vSize.y) / 2.0f);
- mpGfxDrawer->DrawGfxObject(mvCrossHairs[mCrossHairState],
- cVector3f(0, 0, 100) + (vPos - vPosAdd));
- }
} else if (mCrossHairState == eCrossHairState_Item) {
cGfxObject *pObject = mpCurrentItem->GetGfxObject();
cGfxObject *pAdditive = mpCurrentItem->GetGfxObjectAdditive();
@@ -1417,23 +1317,6 @@ void cPlayer::OnDraw() {
// pMouse->ButtonIsDown(eMButton_Left),
// pMouse->ButtonIsDown(eMButton_Right));
- // DEBUG: State
- if (mpInit->mbHasHaptics) {
- /*tWString sState =_W("Unknown");
- if(mState == ePlayerState_Normal) sState = _W("Normal");
- else if(mState == ePlayerState_Push) sState = _W("Push");
- else if(mState == ePlayerState_Move) sState = _W("Move");
- else if(mState == ePlayerState_InteractMode) sState = _W("InteractMode");
- else if(mState == ePlayerState_UseItem) sState = _W("UseItem");
- else if(mState == ePlayerState_Message) sState = _W("Message");
- else if(mState == ePlayerState_Grab) sState = _W("Grab");
- else if(mState == ePlayerState_WeaponMelee) sState = _W("WeaponMelee");
- else if(mState == ePlayerState_Throw) sState = _W("Throw");
- else if(mState == ePlayerState_Climb) sState = _W("Climb");
-
- mpFont->Draw(cVector3f(5,5,0),12,cColor(1,1,1,1),eFontAlign_Left,_W("State: %s"),
- sState.c_str());*/
- }
// DEBUG: MoveState
/*tString sState ="";
if(mMoveState == ePlayerMoveState_Jump) sState = "Jump";
@@ -1609,12 +1492,6 @@ void cPlayer::OnPostSceneDraw() {
mpFlashLight->OnPostSceneDraw();
mvStates[mState]->OnPostSceneDraw();
-
- ///////////////////////////////
- // Gui Hand effects
- if (mpInit->mbHasHaptics) {
- mpHapticCamera->OnPostSceneDraw();
- }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/hpl1/penumbra-overture/Player.h b/engines/hpl1/penumbra-overture/Player.h
index e7ed3c363c2..25233f2ce55 100644
--- a/engines/hpl1/penumbra-overture/Player.h
+++ b/engines/hpl1/penumbra-overture/Player.h
@@ -59,8 +59,6 @@ class cPlayerAmbientLight;
class cPlayerBodyCallback;
-class cHapticGameCamera;
-
typedef Common::Array<iPlayerState *> tPlayerStateVec;
typedef tPlayerStateVec::iterator tPlayerStateVecIt;
@@ -312,8 +310,6 @@ public:
cPlayerHidden *GetHidden() { return mpHidden; }
- cHapticGameCamera *GetHapticCamera() { return mpHapticCamera; }
-
float GetHeightAdd() { return mfHeightAdd; }
void SetHeightAdd(float afX) { mfHeightAdd = afX; }
@@ -383,7 +379,6 @@ private:
cGraphics *mpGraphics;
cResources *mpResources;
cGraphicsDrawer *mpGfxDrawer;
- iLowLevelHaptic *mpLowLevelHaptic;
FontData *mpFont;
@@ -395,8 +390,6 @@ private:
float mfLookSpeed;
float mfCameraHeightAdd;
- cHapticGameCamera *mpHapticCamera;
-
cVector3f mvSize;
float mfCrouchHeight;
@@ -430,9 +423,6 @@ private:
Common::Array<cGfxObject *> mvCrossHairs;
- iHapticForce *mpDamageForce;
- iHapticForce *mpDamageDirForce;
-
cVector2f mvMaxPushHeadMovement;
cVector2f mvMinPushHeadMovement;
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
deleted file mode 100644
index 610694c1a2b..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.cpp
+++ /dev/null
@@ -1,1214 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#include "hpl1/penumbra-overture/PlayerState_InteractHaptX.h"
-#include "hpl1/engine/engine.h"
-
-#include "hpl1/penumbra-overture/GameStickArea.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
-#include "hpl1/penumbra-overture/Init.h"
-#include "hpl1/penumbra-overture/MapHandler.h"
-#include "hpl1/penumbra-overture/Player.h"
-
-//////////////////////////////////////////////////////////////////////////
-// GRAB STATE
-//////////////////////////////////////////////////////////////////////////
-
-float cPlayerState_GrabHaptX::mfMassDiv = 5.0f;
-
-cPlayerState_GrabHaptX::cPlayerState_GrabHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Grab) {
- mpPushBody = NULL;
-
- // Init controllers
- mGrabPid.SetErrorNum(10);
- mRotatePid.SetErrorNum(10);
-
- // Get variables
- mfMaxPidForce = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MaxPidForce", 0);
-
- mfMinThrowMass = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MinThrowMass", 0);
- mfMaxThrowMass = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MaxThrowMass", 0);
-
- mfMinThrowImpulse = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MinThrowImpulse", 0);
- mfMaxThrowImpulse = mpInit->mpGameConfig->GetFloat("Interaction_Grab", "MaxThrowImpulse", 0);
-
- // Get font
- mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt");
-
- // Haptic Force models
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
- mpHGravityForce = mpLowLevelHaptic->CreateImpulseForce(0);
- mpHGravityForce->SetActive(false);
-
- mpHAlignForce = mpLowLevelHaptic->CreateImpulseForce(0);
- mpHAlignForce->SetActive(false);
-
- mAlignPid.SetErrorNum(10);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnUpdate(float afTimeStep) {
- /////////////////////////////////
- // Get needed varaibles
- cCamera3D *pCamera = mpPlayer->GetCamera();
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- /*cInput *pInput = */mpInit->mpGame->GetInput();
-
- cVector3f vProxyPos = mpLowLevelHaptic->GetProxyPosition();
-
- // cVector3f vToCharDir =
-
- ///////////////////////////////////
- // Check wheel input NOT NEEDED!
- /*if(pInput->IsTriggerd("WheelUp"))
- {
- if(mfGrabDist < mpPlayer->mfCurrentMaxInteractDist*0.8f)
- mfGrabDist += 0.1f;
- }
- if(pInput->IsTriggerd("WheelDown"))
- {
- if(mfGrabDist > mpPlayer->GetSize().x/2.0f + 0.25f)
- {
- //TODO: Collison check? (might be a bit complex)
- mfGrabDist -= 0.1f;
- }
- }*/
-
- ///////////////////////////////////
- // Get the current position.
- float fAngleDist = cMath::GetAngleDistanceRad(mfStartYaw, mpPlayer->GetCamera()->GetYaw());
-
- // Det the desired position
- cVector3f vCurrentPoint;
- if (mbPickAtPoint) {
- vCurrentPoint = cMath::MatrixMul(mpPushBody->GetLocalMatrix(), mvRelPickPoint);
- } else {
- vCurrentPoint = cMath::MatrixMul(cMath::MatrixRotateY(fAngleDist), mvRelPickPoint);
- vCurrentPoint = cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mpPushBody->GetMassCentre()) + vCurrentPoint;
- }
-
- //////////////////////////////////////
- // Check if player is close enough
- cVector3f vEnd = vCurrentPoint;
- cVector3f vStart = mpPlayer->GetCamera()->GetPosition();
-
- float fDistance = cMath::Vector3Dist(vStart, vEnd);
- if (fDistance > mpPlayer->mfCurrentMaxInteractDist * 1.4f) {
- mpPlayer->ChangeState(mPrevState);
- return;
- }
-
- //////////////////////////////////////
- // Move the object into position.
-
- // Setup PID
- if (mbPickAtPoint) {
- mGrabPid.p = 80.0f;
- mGrabPid.i = 0.0f;
- mGrabPid.d = 8.0f;
- } else {
- mGrabPid.p = 180.0f;
- mGrabPid.i = 0.0f;
- mGrabPid.d = 40.0f;
- }
-
- ///////////////////////////////////////
- // Get the desired position
- /*cVector3f vForward = */cMath::Vector3Normalize(vProxyPos - pCamera->GetPosition());
- /*pCamera->UnProject(mpPlayer->GetCrossHairPos(),
- mpInit->mpGame->GetGraphics()->GetLowLevel());*/
-
- cVector3f vDesired = vProxyPos; // pCamera->GetPosition() + vForward * mfGrabDist;
-
- ///////////////////////////////////////
- // Get the proxy alignment force
- cMatrixf mtxProxy = cMath::MatrixRotate(cVector3f(-pCamera->GetPitch(), -pCamera->GetYaw(),
- -pCamera->GetRoll()),
- eEulerRotationOrder_YXZ);
- // Alignment
- mAlignPid.p = 1.2f;
- mAlignPid.i = 0;
- mAlignPid.d = 0;
-
- cVector3f vAlignError = vCurrentPoint - vProxyPos;
- cVector3f vAlignForce = mAlignPid.Output(vAlignError, afTimeStep);
-
- vAlignForce = cMath::MatrixMul(mtxProxy, vAlignForce);
- mpHAlignForce->SetForce(vAlignForce * 2.0f * 1.5f); // USe some other number here!//mpInit->mfHapticForceMul);
-
- cVector3f vGravForce = cMath::MatrixMul(mtxProxy, mvGravityForce);
- mpHGravityForce->SetForce(vGravForce * 2.0f * mpInit->mfHapticForceMul);
-
- ///////////////////////////////////////
- // Calculate the force to add.
- cVector3f vForce(0, 0, 0);
-
- // Remove gravity
- if (mpPushBody->GetGravity())
- vForce = pPhysicsWorld->GetGravity() * -1.0f;
-
- // get force from PID
- vForce += mGrabPid.Output(vDesired - vCurrentPoint, afTimeStep);
-
- float fForceSize = vForce.Length();
- if (fForceSize > mfMaxPidForce) {
- vForce = (vForce / fForceSize) * mfMaxPidForce;
- }
- if (mbPickAtPoint) {
- // mpPushBody->AddForceAtPosition(vForce * mpPushBody->GetMass()*mpPlayer->mfGrabMassMul, vCurrentPoint);
-
- // TODO: User intertia instead.
- cVector3f vLocalPos = vCurrentPoint - mpPushBody->GetLocalPosition();
- cVector3f vMassCentre = mpPushBody->GetMassCentre();
- vMassCentre = cMath::MatrixMul(mpPushBody->GetLocalMatrix().GetRotation(), vMassCentre);
- vLocalPos -= vMassCentre;
-
- mpPushBody->AddForce(vForce * mpPushBody->GetMass() * mpPlayer->mfGrabMassMul);
-
- cVector3f vTorque = cMath::Vector3Cross(vLocalPos, vForce);
- vTorque = cMath::MatrixMul(mpPushBody->GetInertiaMatrix(), vTorque) * mfHapticTorqueMul;
- mpPushBody->AddTorque(vTorque);
- } else {
- mpPushBody->AddForce(vForce * mpPushBody->GetMass() * mpPlayer->mfGrabMassMul);
- }
-
- ////////////////////////////
- // The rotation
- cVector3f vOmega = mpPushBody->GetAngularVelocity();
-
- // Set speed to 0
- if (ABS(mfYRotation) < 0.001f || mbRotateWithPlayer == false) {
- mRotatePid.p = 0.8f;
- mRotatePid.i = 0.0f;
- mRotatePid.d = 0.0f;
-
- cVector3f vTorque = mRotatePid.Output(cVector3f(0, 0, 0) - vOmega, afTimeStep);
- vTorque = vTorque - vOmega * 0.1f;
-
- mpPushBody->AddTorque(vTorque * mpPushBody->GetMass());
- // vTorque = cMath::MatrixMul(mpPushBody->GetInertiaMatrix(),vTorque);
- // mpPushBody->AddTorque(vTorque);
- } else {
- mRotatePid.p = 0.8f;
- mRotatePid.i = 0.0f;
- mRotatePid.d = 0.0f;
-
- float fWantedSpeed = mfYRotation * 6;
-
- cVector3f vTorque = mRotatePid.Output(cVector3f(0, fWantedSpeed, 0) - vOmega, afTimeStep);
-
- mpPushBody->AddTorque(vTorque * mpPushBody->GetMass());
- // vTorque = cMath::MatrixMul(mpPushBody->GetInertiaMatrix(),vTorque);
- // mpPushBody->AddTorque(vTorque);
-
- mfYRotation -= vOmega.y * afTimeStep;
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnDraw() {
- // mpFont->Draw(cVector3f(5,30,0),12,cColor(1,1),eFontAlign_Left,"YRotate: %f",mfYRotation);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnPostSceneDraw() {
- /*iLowLevelGraphics *pLowGfx = */mpInit->mpGame->GetGraphics()->GetLowLevel();
-
- /*cVector3f vPickPoint = */cMath::MatrixMul(mpPushBody->GetWorldMatrix(), mvRelPickPoint);
-
- // pLowGfx->DrawSphere(vPickPoint, 0.2f, cColor(1,1,1,1));
- // pLowGfx->DrawSphere(mvCurrentDisered, 0.2f, cColor(1,1,1,1));
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnJump() {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnStartInteractMode() {
- mbMoveHand = !mbMoveHand;
-
- if (mbMoveHand) {
- mPrevState = ePlayerState_InteractMode;
- } else {
- mPrevState = ePlayerState_Normal;
- mpPlayer->ResetCrossHairPos();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnStartInteract() {
-}
-
-void cPlayerState_GrabHaptX::OnStopInteract() {
- // Log("RELEASED BUTTON!\n");
- mpPlayer->ChangeState(mPrevState);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnStartExamine() {
- mpPlayer->ChangeState(mPrevState);
-
- if (mpPlayer->mbCanBeThrown == false)
- return;
-
- // Reset linear and angular speed.
- mpPushBody->SetLinearVelocity(0);
- mpPushBody->SetAngularVelocity(0);
-
- // Get the forward vector
- cVector3f vForward = mpPlayer->GetCamera()->UnProject(mpPlayer->GetCrossHairPos(),
- mpInit->mpGame->GetGraphics()->GetLowLevel());
- // Get the point which you hare grabbing at.
- cVector3f vPickPoint = cMath::MatrixMul(mpPushBody->GetLocalMatrix(), mvRelPickPoint);
-
- // Calculate the impulse
- float fT = 0;
- float fMass = mpPushBody->GetMass();
- if (fMass <= mfMinThrowMass)
- fT = 1;
- else if (fMass >= mfMaxThrowMass)
- fT = 0;
- else
- fT = 1 - (fMass - mfMinThrowMass) / (mfMaxThrowMass - mfMinThrowMass);
-
- float fImpulse = mfMinThrowImpulse * (1 - fT) + mfMaxThrowImpulse * fT;
-
- // Log("Mass: %f Impulse: %f\n",fMass,fImpulse);
-
- // Add the impulse
- if (mbPickAtPoint) {
- mpPushBody->AddImpulseAtPosition(vForward * fImpulse, vPickPoint);
- } else {
- mpPushBody->AddImpulse(vForward * fImpulse);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnAddYaw(float afVal) {
- afVal *= mfSpeedMul * 0.75f;
- if (mbMoveHand) {
- if (mpPlayer->AddCrossHairPos(cVector2f(afVal * 800.0f, 0))) {
- mpPlayer->GetCamera()->AddYaw(-afVal * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
-
- mfYRotation += -afVal * mpPlayer->GetLookSpeed();
- }
-
- return false;
- } else {
- mpPlayer->GetCamera()->AddYaw(-afVal * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
-
- mfYRotation += -afVal * mpPlayer->GetLookSpeed();
-
- return false;
- }
-}
-
-bool cPlayerState_GrabHaptX::OnAddPitch(float afVal) {
- float fInvert = 1;
- if (mpInit->mpButtonHandler->GetInvertMouseY())
- fInvert = -1;
-
- afVal *= mfSpeedMul * 0.75f;
- if (mbMoveHand) {
- if (mpPlayer->AddCrossHairPos(cVector2f(0, afVal * 600.0f))) {
- mpPlayer->GetCamera()->AddPitch(-afVal * mpPlayer->GetLookSpeed());
- }
- return false;
- } else {
- mpPlayer->GetCamera()->AddPitch(-afVal * fInvert * mpPlayer->GetLookSpeed());
- return false;
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::EnterState(iPlayerState *apPrevState) {
- ////////////////////////////////////////////
- // Detach the body if stuck to a sticky area
- cGameStickArea *pStickArea = mpInit->mpMapHandler->GetBodyStickArea(mpPlayer->GetPushBody());
- if (pStickArea) {
- if (pStickArea->GetCanDeatch()) {
- pStickArea->DetachBody();
- } else {
- mpPlayer->ChangeState(apPrevState->mType);
- return;
- }
- }
-
- cCamera3D *pCamera = mpPlayer->GetCamera();
-
- /////////////////////////////////////////
- // Make sure the player is not running
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Run || mPrevMoveState == ePlayerMoveState_Jump)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
-
- //////////////////////////////////////////////////////
- // Get last state, if this is a message use the last previous state instead.
- if (apPrevState->mType != ePlayerState_Message)
- mPrevState = apPrevState->mType;
-
- /////////////////////////////////////////////
- // Set up variables
- mbPickAtPoint = mpPlayer->mbPickAtPoint;
- mbRotateWithPlayer = mpPlayer->mbRotateWithPlayer;
-
- mfHapticTorqueMul = mpPlayer->mfHapticTorqueMul;
-
- if (mPrevState == ePlayerState_InteractMode)
- mbMoveHand = true;
- else
- mbMoveHand = false;
-
- /////////////////////////////////////////////
- // Set up body to be moved
- mpPushBody = mpPlayer->GetPushBody();
- mbHasGravity = mpPushBody->GetGravity();
- if (mbPickAtPoint == false)
- mpPushBody->SetGravity(false);
- mpPushBody->SetAutoDisable(false);
-
- mbHasPlayerGravityPush = mpPushBody->GetPushedByCharacterGravity();
- mpPushBody->SetPushedByCharacterGravity(true);
-
- // Set a newer player mass
- mpPlayer->SetMass(mpPlayer->GetMass() + mpPushBody->GetMass());
-
- // Lower the mass while holding
- mfDefaultMass = mpPushBody->GetMass();
- mpPushBody->SetMass(mpPushBody->GetMass() / mfMassDiv);
-
- /////////////////////////////////////////////
- // Set the player speed mul
- float fMass = mpPushBody->GetMass();
- mfSpeedMul = 1;
- if (fMass > 3) {
- float fMul = 1 - ((fMass - 3.0f) / 37.0f) * 0.34f;
- fMul = cMath::Min(fMul, 0.66f);
-
- mfSpeedMul = fMul;
- }
- mpPlayer->SetSpeedMul(mfSpeedMul);
-
- // If we want to use the normal mass,reset the divison
- if (mpPlayer->mbUseNormalMass)
- mpPushBody->SetMass(mfDefaultMass);
-
- ///////////////////////////////////////////////
- // Get the orientation of the body
- cMatrixf mtxInvModel = cMath::MatrixInverse(mpPushBody->GetLocalMatrix());
- mvObjectUp = mtxInvModel.GetUp();
- mvObjectRight = mtxInvModel.GetRight();
-
- mfGrabDist = cMath::Vector3Dist(mpPlayer->GetCamera()->GetPosition(),
- mpPlayer->GetPickedPos());
- // mfGrabDist = mpPlayer->GetPickedDist();
-
- // reset PID controller
- mGrabPid.Reset();
-
- ///////////////////////////////////////////
- // The pick point relative to the body
- if (mbPickAtPoint)
- mvRelPickPoint = cMath::MatrixMul(mtxInvModel, mpPlayer->GetPickedPos());
- else
- mvRelPickPoint = mpPlayer->GetPickedPos() -
- cMath::MatrixMul(mpPushBody->GetWorldMatrix(),
- mpPushBody->GetMassCentre());
-
- // Set cross hair image.
- // mpPlayer->SetCrossHairState(eCrossHairState_Grab);
-
- // The amount of rotation we wanna apply to the object, increases/decrease
- // when the player turn left/right
- mfYRotation = 0;
-
- // Reset pid controllers
- mRotatePid.Reset();
- mGrabPid.Reset();
-
- mfStartYaw = pCamera->GetYaw();
-
- /////////////////////////////////////////
- // Check if all controllers should be paused.
- iGameEntity *pEntity = (iGameEntity *)mpPushBody->GetUserData();
- if (pEntity->GetPauseControllers()) {
- for (int i = 0; i < mpPushBody->GetJointNum(); ++i) {
- mpPushBody->GetJoint(i)->SetAllControllersPaused(true);
- }
- }
-
- // Set cross hair image.
- mpPlayer->SetCrossHairState(eCrossHairState_Grab);
-
- ////////////////////////////////////////////
- // Haptic Init
- // mpPlayer->GetHapticCamera()->SetRenderActive(false);
-
- // if(mpPlayer->mbGrabbingMoveBody==false)
- if (mbHasGravity)
- mpHGravityForce->SetActive(true);
- mvGravityForce = cVector3f(0, mfDefaultMass * -9.8f * 0.0018f, 0);
-
- mpHAlignForce->SetActive(true);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::LeaveState(iPlayerState *apNextState) {
- mpPushBody->SetPushedByCharacterGravity(mbHasPlayerGravityPush);
- mpPushBody->SetGravity(mbHasGravity);
- mpPushBody->SetActive(true);
- mpPushBody->SetAutoDisable(true);
- mpPushBody->AddForce(cVector3f(0, 1, 0) * mpPushBody->GetMass());
-
- if (mpPlayer->mbUseNormalMass == false)
- mpPushBody->SetMass(mfDefaultMass);
-
- // Reset newer player mass
- mpPlayer->SetMass(mpPlayer->GetDefaultMass());
-
- mpPlayer->SetSpeedMul(1.0f);
-
- ////////////////////////////
- // UnPause controllers
- iGameEntity *pObject = (iGameEntity *)mpPushBody->GetUserData();
- if (pObject->GetPauseControllers()) {
- for (int i = 0; i < mpPushBody->GetJointNum(); ++i) {
- mpPushBody->GetJoint(i)->SetAllControllersPaused(false);
- }
- }
-
- ////////////////////////////////////////////
- // Haptic Exit
- mpPlayer->mbGrabbingMoveBody = false;
-
- // mpPlayer->GetHapticCamera()->SetRenderActive(true);
-
- mpHGravityForce->SetActive(false);
- mpHAlignForce->SetActive(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_GrabHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_GrabHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnStartInventory() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_GrabHaptX::OnStartInventoryShortCut(int alNum) {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// MOVE STATE
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cPlayerState_MoveHaptX_BodyCallback::cPlayerState_MoveHaptX_BodyCallback(cPlayer *apPlayer, float afTimeStep) {
- mpPlayer = apPlayer;
- mfTimeStep = afTimeStep;
- mlBackCount = 0;
-}
-
-bool cPlayerState_MoveHaptX_BodyCallback::OnBeginCollision(iPhysicsBody *apBody, iPhysicsBody *apCollideBody) {
- return true;
-}
-
-void cPlayerState_MoveHaptX_BodyCallback::OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCollideBody, cPhysicsContactData *apContactData) {
- if (mpPlayer->GetCharacterBody()->GetBody() == apCollideBody) {
- mlBackCount = 5;
- }
-}
-
-//-----------------------------------------------------------------------
-
-cPlayerState_MoveHaptX::cPlayerState_MoveHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Move) {
- mpPushBody = NULL;
- mpCallback = hplNew(cPlayerState_MoveHaptX_BodyCallback, (apPlayer, apInit->mpGame->GetStepSize()));
-}
-
-cPlayerState_MoveHaptX::~cPlayerState_MoveHaptX() {
- hplDelete(mpCallback);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::OnUpdate(float afTimeStep) {
- //////////////////////////////////////
- // Check if the player is supposed to back
- if (mpCallback->mlBackCount > 0) {
- mpCallback->mlBackCount--;
- mpPlayer->GetCharacterBody()->Move(eCharDir_Forward, -1, afTimeStep);
- }
-
- //////////////////////////////////////
- // Calculate the pick position
- mvPickPoint = cMath::MatrixMul(mpPushBody->GetLocalMatrix(), mvRelPickPoint);
-
- //////////////////////////////////////
- // Check if player is close enough
- cVector3f vEnd = mvPickPoint;
- cVector3f vStart = mpPlayer->GetCamera()->GetPosition();
-
- float fDistance = cMath::Vector3Dist(vStart, vEnd);
- if (fDistance > mpPlayer->mfCurrentMaxInteractDist * 1.7f) {
- // Log("Out of here %f!\n",mpPlayer->mfCurrentMaxInteractDist);
- mpPlayer->ChangeState(mPrevState);
- return;
- }
-
- /////////////////////////////////////////
- // Check if the body should be stopped
- if (mlMoveCount <= 0) {
- mpPushBody->SetAngularVelocity(0);
- mpPushBody->SetLinearVelocity(0);
- }
-
- ///////////////////////////////////////////////////////////////////////
- // Project the position of the pick point and set is as crosshair pos
- cVector3f vProjPos = cMath::MatrixMul(mpPlayer->GetCamera()->GetViewMatrix(), mvPickPoint);
- vProjPos = cMath::MatrixMulDivideW(mpPlayer->GetCamera()->GetProjectionMatrix(), vProjPos);
-
- mpPlayer->SetCrossHairPos(cVector2f((vProjPos.x + 1) * 0.5f * 800.0f, ((-vProjPos.y) + 1) * 0.5f * 600.0f));
-
- /////////////////////////////////////////////////
- // Check if the camera should be turned
- cVector2f vCrossPos = mpPlayer->GetCrossHairPos();
- cVector2f vBorder = mpPlayer->GetInteractMoveBorder();
-
- if (vCrossPos.x < vBorder.x)
- mpPlayer->GetCamera()->AddYaw((vBorder.x - vCrossPos.x) / 800 * mpPlayer->GetLookSpeed());
- if (vCrossPos.x > (799 - vBorder.x))
- mpPlayer->GetCamera()->AddYaw(-(vCrossPos.x - (799 - vBorder.x)) / 800 * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
-
- if (vCrossPos.y < vBorder.y)
- mpPlayer->GetCamera()->AddPitch((vBorder.y - vCrossPos.y) / 600 * mpPlayer->GetLookSpeed());
- if (vCrossPos.y > (599 - vBorder.y))
- mpPlayer->GetCamera()->AddPitch(-(vCrossPos.y - (599 - vBorder.y)) / 600 * mpPlayer->GetLookSpeed());
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::OnStartInteract() {
- // mpPlayer->ChangeState(ePlayerState_Normal);
-}
-
-void cPlayerState_MoveHaptX::OnStopInteract() {
- mpPlayer->ChangeState(mPrevState);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnJump() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::OnStartExamine() {
- if (mpPlayer->mbCanBeThrown) {
- cVector3f vForward = mpPlayer->GetCamera()->UnProject(mpPlayer->GetCrossHairPos(),
- mpInit->mpGame->GetGraphics()->GetLowLevel());
-
- float fMassMul = mpPushBody->GetMass();
- if (fMassMul > 3)
- fMassMul = 3;
- mpPushBody->AddForce(vForward * 500 * fMassMul);
- }
-
- mpPlayer->ChangeState(mPrevState);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- cVector3f vForce = (mvForward * (afMul * 4.0f));
- mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
- mlMoveCount = 20;
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- cVector3f vForce = (mvRight * (afMul * 4.0f));
- mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
- mlMoveCount = 20;
-
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnAddYaw(float afVal) {
- if (ABS(afVal) > kEpsilonf) {
- cVector3f vForce = (mvRight * (afVal * 100.0f * mpPlayer->mfRightMul));
- mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
- mlMoveCount = 20;
- } else {
- if (mlMoveCount > 0)
- mlMoveCount--;
- }
-
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnAddPitch(float afVal) {
- if (ABS(afVal) > kEpsilonf) {
- cVector3f vForce = (mvUp * (-afVal * 100.0f * mpPlayer->mfUpMul)) +
- (mvForward * (afVal * -80.0f * mpPlayer->mfForwardUpMul));
- mpPushBody->AddForceAtPosition(vForce, mvPickPoint);
- mlMoveCount = 20;
- } else {
- if (mlMoveCount > 0)
- mlMoveCount--;
- }
-
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::EnterState(iPlayerState *apPrevState) {
- // Detach the body if stuck to a sticky area
- cGameStickArea *pStickArea = mpInit->mpMapHandler->GetBodyStickArea(mpPlayer->GetPushBody());
- if (pStickArea && pStickArea->GetCanDeatch()) {
- if (pStickArea->GetCanDeatch()) {
- pStickArea->DetachBody();
- } else {
- mpPlayer->ChangeState(apPrevState->mType);
- return;
- }
- }
-
- cCamera3D *pCamera = mpPlayer->GetCamera();
-
- // Change move state so the player is still
- mPrevMoveState = mpPlayer->GetMoveState();
- // mpPlayer->ChangeMoveState(ePlayerMoveState_Still);
- mpPlayer->SetSpeedMul(0.3f);
- mpPlayer->SetHeadMoveSizeMul(0.2f);
- mpPlayer->SetHeadMoveSpeedMul(0.2f);
-
- // Get last state, if this is a message use the last previous state instead.
- if (apPrevState->mType != ePlayerState_Message)
- mPrevState = apPrevState->mType;
-
- // Set the directions to move the body in
- mvForward = pCamera->GetForward();
- mvRight = pCamera->GetRight();
- mvUp = pCamera->GetUp();
-
- // make forward non y dependant
- mvForward.y = 0;
- mvForward.Normalise();
-
- // Get the body to push
- mpPushBody = mpPlayer->GetPushBody();
- mpPushBody->SetAutoDisable(false);
-
- // The pick point relative to the body
- mvPickPoint = mpPlayer->GetPickedPos();
-
- /////////////////////////////////////////
- // Check if all controllers should be paused.
- iGameEntity *pEntity = (iGameEntity *)mpPushBody->GetUserData();
- if (pEntity->GetPauseControllers()) {
- for (int i = 0; i < mpPushBody->GetJointNum(); ++i) {
- mpPushBody->GetJoint(i)->SetAllControllersPaused(true);
- }
- }
- /////////////////////////////////////////
- // Check if gravtty should be paused.
- if (mpPushBody->GetGravity() && pEntity->GetPauseGravity()) {
- mpPushBody->SetGravity(false);
- bPausedGravity = true;
- } else {
- bPausedGravity = false;
- }
-
- cMatrixf mtxInvModel = cMath::MatrixInverse(mpPushBody->GetLocalMatrix());
- mvRelPickPoint = cMath::MatrixMul(mtxInvModel, mvPickPoint);
-
- // Set cross hair image.
- mpPlayer->SetCrossHairState(eCrossHairState_Grab);
-
- // Add callback to body if needed
- /*if(mpPushBody->GetCollideCharacter())
- {
- mpPushBody->AddBodyCallback(mpCallback);
- }*/
- mpCallback->mlBackCount = 0;
-
- mlMoveCount = 0;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::LeaveState(iPlayerState *apNextState) {
- // Remove callback to body if needed
- /*if(mpPushBody->GetCollideCharacter())
- {
- mpPushBody->RemoveBodyCallback(mpCallback);
- }*/
-
- ////////////////////////////
- // Pause controllers
- iGameEntity *pObject = (iGameEntity *)mpPushBody->GetUserData();
- if (pObject->GetPauseControllers()) {
- for (int i = 0; i < mpPushBody->GetJointNum(); ++i) {
- mpPushBody->GetJoint(i)->SetAllControllersPaused(false);
- }
- }
- ////////////////////////////
- // Pause gravity
- if (bPausedGravity) {
- mpPushBody->SetGravity(true);
- }
-
- mpPushBody->SetAutoDisable(true);
-
- if (mPrevMoveState != ePlayerMoveState_Run && mPrevMoveState != ePlayerMoveState_Jump)
- mpPlayer->ChangeMoveState(mPrevMoveState);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
-
- mpPlayer->SetSpeedMul(1.0f);
- mpPlayer->SetHeadMoveSizeMul(1.0f);
- mpPlayer->SetHeadMoveSpeedMul(1.0f);
-
- if (mPrevState == ePlayerState_Normal)
- mpPlayer->ResetCrossHairPos();
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MoveHaptX::OnPostSceneDraw() {
- // mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawSphere(mvPickPoint,0.1f,cColor(1,1,1,1));
-}
-
-//-----------------------------------------------------------------------
-bool cPlayerState_MoveHaptX::OnStartInventory() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MoveHaptX::OnStartInventoryShortCut(int alNum) {
- return false;
-}
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// PUSH STATE
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------
-
-cPlayerState_PushHaptX::cPlayerState_PushHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Push) {
- mpPushBody = NULL;
-
- mpHAlignForce = mpInit->mpGame->GetHaptic()->GetLowLevel()->CreateImpulseForce(0);
- mpHAlignForce->SetActive(false);
-
- mAlignPid.SetErrorNum(10);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::OnUpdate(float afTimeStep) {
- ////////////////////////////////////
- // Alignment
- cCamera3D *pCamera = mpPlayer->GetCamera();
- cMatrixf mtxProxy = cMath::MatrixRotate(cVector3f(-pCamera->GetPitch(), -pCamera->GetYaw(), 0),
- eEulerRotationOrder_YXZ);
-
- cVector3f vProxyPos = mpInit->mpGame->GetHaptic()->GetLowLevel()->GetProxyPosition();
-
- mAlignPid.p = 1.2f;
- mAlignPid.i = 0;
- mAlignPid.d = 0;
-
- cVector3f vCurrentPoint = mvRelPickPoint + mpPushBody->GetLocalPosition();
-
- cVector3f vAlignError = vCurrentPoint - vProxyPos;
- cVector3f vAlignForce = mAlignPid.Output(vAlignError, afTimeStep);
-
- vAlignForce = cMath::MatrixMul(mtxProxy, vAlignForce);
- mpHAlignForce->SetForce(vAlignForce);
-
- //////////////////////////////////////
- // Check if player is close enough
- cVector3f vEnd = mpPushBody->GetLocalPosition() + mvRelPickPoint;
- cVector3f vStart = mpPlayer->GetCamera()->GetPosition();
-
- float fDistance = cMath::Vector3Dist(vStart, vEnd);
- if (fDistance > mpPlayer->mfCurrentMaxInteractDist * 1.2f) {
- mpPlayer->ChangeState(mPrevState);
- return;
- }
-
- //////////////////////////////////////
- // Update player movement
- cVector3f vPosAdd = mpPushBody->GetLocalPosition() - mvLastBodyPos;
- // No need for the y value.
- vPosAdd.y = 0;
-
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cVector3f vPlayerPos = mpPlayer->GetCharacterBody()->GetPosition() + vPosAdd;
- // mpPlayer->GetCharacterBody()->SetPosition(vPlayerPos,true);
-
- // Not really needed. character body should fix.
- cVector3f vNewPos = vPlayerPos;
- iPhysicsBody *pBody = mpPlayer->GetCharacterBody()->GetBody();
- pPhysicsWorld->CheckShapeWorldCollision(&vNewPos, pBody->GetShape(),
- cMath::MatrixTranslate(vPlayerPos),
- pBody, false, true, NULL, true);
-
- mpPlayer->GetCharacterBody()->SetPosition(vNewPos, true);
-
- mvLastBodyPos = mpPushBody->GetLocalPosition();
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_PushHaptX::OnJump() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::OnStartInteract() {
- // mpPlayer->ChangeState(mPrevState);
-}
-
-void cPlayerState_PushHaptX::OnStopInteract() {
- mpPlayer->ChangeState(mPrevState);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::OnStartExamine() {
- mpPlayer->ChangeState(mPrevState);
-
- if (mpPlayer->mbCanBeThrown) {
- float fMassMul = mpPushBody->GetMass();
- if (fMassMul > 40)
- fMassMul = 40;
- mpPushBody->AddForce(mvForward * 233 * fMassMul);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_PushHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- if (afMul < 0) {
- if (mpPlayer->mbCanBePulled == false)
- return false;
- afMul *= 0.7f;
- }
-
- float fSpeed = mpPushBody->GetLinearVelocity().Length();
-
- ///////////////////////////////////
- // Set the direction and if it is newer add extra force
- if (afMul > 0) {
- if (mlForward != 1 && fSpeed < 0.01f)
- afMul *= 0.6f * mpPushBody->GetMass();
- mlForward = 1;
- } else if (afMul < 0) {
- // If player is to close, push him back.
- if (mlForward != -1) {
- float fPosAdd = (mfMaxSpeed)*afTimeStep;
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- iCharacterBody *pPlayerBody = mpPlayer->GetCharacterBody();
-
- cMatrixf mtxBodyMove = mpPushBody->GetLocalMatrix();
- mtxBodyMove.SetTranslation(mtxBodyMove.GetTranslation() + (mvForward * -1 * fPosAdd));
-
- cCollideData collData;
- collData.SetMaxSize(32);
- bool bCollide = pPhysicsWorld->CheckShapeCollision(
- pPlayerBody->GetShape(), cMath::MatrixTranslate(pPlayerBody->GetPosition()),
- mpPushBody->GetShape(), mtxBodyMove, collData, 32);
-
- if (bCollide) {
- cVector3f vPos = mpPlayer->GetCharacterBody()->GetPosition();
- //cVector3f vOldPos = vPos;
- //cVector3f vNewPos;
- vPos += mvForward * -1 * (fPosAdd + 0.1f);
- mpPlayer->GetCharacterBody()->SetPosition(vPos);
-
- // Not good since slopes does not work:
- /*pPhysicsWorld->CheckShapeWorldCollision(&vNewPos, pPlayerBody->GetShape(),
- cMath::MatrixTranslate(pPlayerBody->GetPosition()),
- mpPushBody,false,true,NULL,false);
-
- if(vNewPos.x != vPos.x || vNewPos.y != vPos.y)
- {
- mpPlayer->GetCharacterBody()->SetPosition(vOldPos);
- }*/
- }
- }
-
- if (mlForward != -1 && fSpeed < 0.01f)
- afMul *= 1.2f * mpPushBody->GetMass();
- mlForward = -1;
- } else {
- mlForward = 0;
- return false;
- }
-
- // Log("Mul: %f\n",afMul);
-
- /////////////////////////////////////
- // If the velocity is not to high add force.
-
- if (fSpeed < mfMaxSpeed) {
-
- if (mpPlayer->mbPickAtPoint) {
- // NON WORKING ATM:
- /*cVector3f vForce = mvForward * afMul*100.0f*0.5f;
-
- cVector3f vPos = cMath::MatrixMul( mpPushBody->GetLocalMatrix(),
- mvLocalPickPoint);
- vPos.y = mpPushBody->GetLocalPosition().y;
-
- mpPushBody->AddForceAtPosition(vForce,vPos);*/
- } else {
- cVector3f vForce = mvForward * afMul * 100.0f; //*0.5f;
-
- // mpPushBody->AddForceAtPosition(vForce,mpPushBody->GetLocalPosition() + mvRight*0.4f);
- // mpPushBody->AddForceAtPosition(vForce,mpPushBody->GetLocalPosition() + mvRight*-0.4f);
- mpPushBody->AddForce(vForce);
- }
- }
-
- // returning true calls move state as well.
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_PushHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- cVector3f vVel = mpPushBody->GetLinearVelocity();
-
- if (vVel.Length() < mfMaxSpeed) {
- // mpPushBody->AddForce(mvRight * afMul*100.0f);
-
- cVector3f vForce = mvRight * afMul * 100.0f; //*0.5f;
-
- // mpPushBody->AddForceAtPosition(vForce,mpPushBody->GetLocalPosition() + mvForward*0.4f);
- // mpPushBody->AddForceAtPosition(vForce,mpPushBody->GetLocalPosition() + mvForward*-0.4f);
- mpPushBody->AddForce(vForce);
- }
-
- // returning true calls move state as well.
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::EnterState(iPlayerState *apPrevState) {
- // Detach the body if stuck to a sticky area
- cGameStickArea *pStickArea = mpInit->mpMapHandler->GetBodyStickArea(mpPlayer->GetPushBody());
- if (pStickArea && pStickArea->GetCanDeatch()) {
- if (pStickArea->GetCanDeatch()) {
- pStickArea->DetachBody();
- } else {
- mpPlayer->ChangeState(apPrevState->mType);
- return;
- }
- }
-
- cCamera3D *pCamera = mpPlayer->GetCamera();
-
- mfMaxSpeed = mpPlayer->GetMaxPushSpeed();
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mfMaxSpeed *= 0.5f;
-
- // Change move state so the player is still
- mPrevMoveState = mpPlayer->GetMoveState();
- mpPlayer->ChangeMoveState(ePlayerMoveState_Still);
-
- // Get last state, if this is a message use the last previous state instead.
- if (apPrevState->mType != ePlayerState_Message)
- mPrevState = apPrevState->mType;
-
- // Set the directions to move the body in
- mvForward = pCamera->GetForward();
- mvForward.y = 0;
- mvForward.Normalise();
-
- mvRight = pCamera->GetRight();
- mvRight.y = 0;
- mvRight.Normalise();
-
- // Get the body to push
- mpPushBody = mpPlayer->GetPushBody();
-
- // All pushed bodies shall be affected by player gravity.
- mbHasPlayerGravityPush = mpPushBody->GetPushedByCharacterGravity();
- mpPushBody->SetPushedByCharacterGravity(true);
-
- // The pick point relative to the body
- mvRelPickPoint = mpPlayer->GetPickedPos() - mpPushBody->GetLocalPosition();
-
- // Set the last position.
- mvLastBodyPos = mpPushBody->GetLocalPosition();
-
- // Set cross hair image.
- mpPlayer->SetCrossHairState(eCrossHairState_Grab);
-
- // Set newer yaw and pitch limits
- mvPrevPitchLimits = pCamera->GetPitchLimits();
-
- cVector2f vMaxHeadLimits = mpPlayer->GetMaxPushHeadMovement();
- cVector2f vMinHeadLimits = mpPlayer->GetMinPushHeadMovement();
- float fXmax = pCamera->GetYaw() + vMaxHeadLimits.x;
- float fYmax = pCamera->GetPitch() + vMaxHeadLimits.y;
-
- float fXmin = pCamera->GetYaw() + vMinHeadLimits.x;
- float fYmin = pCamera->GetPitch() + vMinHeadLimits.y;
-
- pCamera->SetPitchLimits(cVector2f(fYmax, fYmin));
- pCamera->SetYawLimits(cVector2f(fXmax, fXmin));
-
- // Create a little effect when grabbing the body
- mpPushBody->SetAutoDisable(false);
- // mpPushBody->AddForce(cVector3f(0,-1,0) *60.0f *mpPushBody->GetMass());
-
- // This is to check the last used direction
- mlForward = 0;
- mlSideways = 0;
-
- cMatrixf mtxInvWorld = cMath::MatrixInverse(mpPushBody->GetLocalMatrix());
- mvLocalPickPoint = cMath::MatrixMul(mtxInvWorld, mpPlayer->GetPickedPos());
-
- // haptic
- mpHAlignForce->SetActive(true);
- mpPlayer->GetHapticCamera()->SetRenderActive(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::LeaveState(iPlayerState *apNextState) {
- mpPushBody->SetPushedByCharacterGravity(mbHasPlayerGravityPush);
-
- if (mPrevMoveState != ePlayerMoveState_Run && mPrevMoveState != ePlayerMoveState_Jump)
- mpPlayer->ChangeMoveState(mPrevMoveState);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
-
- mpPlayer->GetCamera()->SetPitchLimits(mvPrevPitchLimits);
- mpPlayer->GetCamera()->SetYawLimits(cVector2f(0, 0));
-
- // Create a little effect when letting go of the body
- mpPushBody->SetAutoDisable(true);
- // mpPushBody->AddForce(cVector3f(0,-1,0) *60.0f *mpPushBody->GetMass());
-
- // haptic
- mpHAlignForce->SetActive(false);
- mpPlayer->GetHapticCamera()->SetRenderActive(true);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_PushHaptX::OnPostSceneDraw() {
- return;
- cVector3f vPos = cMath::MatrixMul(mpPushBody->GetLocalMatrix(),
- mvLocalPickPoint);
-
- mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawSphere(vPos, 0.3f, cColor(1, 0, 1));
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_PushHaptX::OnStartInventory() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_PushHaptX::OnStartInventoryShortCut(int alNum) {
- return false;
-}
diff --git a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
deleted file mode 100644
index a9d73f4a9e9..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_InteractHaptX.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#ifndef GAME_PLAYER_STATE_INTERACT_HAPTX_H
-#define GAME_PLAYER_STATE_INTERACT_HAPTX_H
-
-#include "hpl1/engine/engine.h"
-#include "hpl1/penumbra-overture/PlayerState.h"
-
-using namespace hpl;
-
-//-----------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// GRAB STATE
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------
-
-class cPlayerState_GrabHaptX : public iPlayerState {
-public:
- cPlayerState_GrabHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnDraw();
-
- void OnPostSceneDraw();
-
- bool OnJump();
-
- void OnStartInteractMode();
-
- void OnStartInteract();
- void OnStopInteract();
- void OnStartExamine();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartCrouch();
- void OnStopCrouch();
- bool OnStartInventory();
- bool OnStartInventoryShortCut(int alNum);
-
- static float mfMassDiv;
-
-private:
- cVector3f mvRelPickPoint;
- iPhysicsBody *mpPushBody;
-
- ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
-
- cSpringVec3 mGrabSpring;
- cPidControllerVec3 mGrabPid;
- cSpringVec3 mRotateSpring;
- cPidControllerVec3 mRotatePid;
-
- iLowLevelHaptic *mpLowLevelHaptic;
-
- bool mbHasGravity;
-
- bool mbMoveHand;
-
- float mfGrabDist;
-
- float mfDefaultMass;
-
- bool mbHasPlayerGravityPush;
-
- bool mbPickAtPoint;
- bool mbRotateWithPlayer;
-
- cVector3f mvObjectUp;
- cVector3f mvObjectRight;
-
- cVector3f mvCurrentUp;
- cVector3f mvCurrentUpAxis;
-
- float mfStartYaw;
-
- cVector3f mvCurrentDisered;
-
- float mfSpeedMul;
-
- float mfYRotation;
-
- float mfMaxPidForce;
-
- float mfMinThrowMass;
- float mfMaxThrowMass;
-
- float mfMinThrowImpulse;
- float mfMaxThrowImpulse;
-
- iHapticForce *mpHGravityForce;
- cVector3f mvGravityForce;
-
- iHapticForce *mpHAlignForce;
- cPidControllerVec3 mAlignPid;
-
- float mfHapticTorqueMul;
-
- FontData *mpFont;
-};
-
-//-----------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// MOVE STATE
-//////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------
-
-class cPlayerState_MoveHaptX_BodyCallback : public iPhysicsBodyCallback {
-public:
- cPlayerState_MoveHaptX_BodyCallback(cPlayer *apPlayer, float afTimeStep);
-
- bool OnBeginCollision(iPhysicsBody *apBody, iPhysicsBody *apCollideBody);
- void OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCollideBody, cPhysicsContactData *apContactData);
-
- float mfTimeStep;
- int mlBackCount;
- cPlayer *mpPlayer;
-
-private:
-};
-
-//-----------------------------------------------------------------
-
-class cPlayerState_MoveHaptX : public iPlayerState {
-public:
- cPlayerState_MoveHaptX(cInit *apInit, cPlayer *apPlayer);
- ~cPlayerState_MoveHaptX();
-
- void OnUpdate(float afTimeStep);
-
- void OnStartInteract();
- void OnStopInteract();
-
- bool OnJump();
-
- void OnStartExamine();
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnPostSceneDraw();
-
- bool OnStartInventory();
- bool OnStartInventoryShortCut(int alNum);
-
-private:
- cVector3f mvForward;
- cVector3f mvRight;
- cVector3f mvUp;
-
- cVector3f mvRelPickPoint;
- cVector3f mvPickPoint;
-
- bool bPausedGravity;
-
- iPhysicsBody *mpPushBody;
-
- int mlMoveCount;
-
- ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
-
- cPlayerState_MoveHaptX_BodyCallback *mpCallback;
-};
-
-//////////////////////////////////////////////////////////////////////////
-// PUSH STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cPlayerState_PushHaptX : public iPlayerState {
-public:
- cPlayerState_PushHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
- bool OnJump();
-
- void OnStartInteract();
- void OnStopInteract();
-
- void OnStartExamine();
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnPostSceneDraw();
-
- bool OnStartInventory();
- bool OnStartInventoryShortCut(int alNum);
-
-private:
- cVector3f mvForward;
- cVector3f mvRight;
-
- cVector3f mvRelPickPoint;
-
- cVector3f mvLocalPickPoint;
-
- iPhysicsBody *mpPushBody;
- cVector3f mvLastBodyPos;
-
- cVector2f mvPrevPitchLimits;
-
- bool mbHasPlayerGravityPush;
-
- float mfMaxSpeed;
-
- int mlForward;
- int mlSideways;
-
- ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
-
- iHapticForce *mpHAlignForce;
- cPidControllerVec3 mAlignPid;
-};
-
-#endif // GAME_PLAYER_STATE_INTERACT_H
diff --git a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
deleted file mode 100644
index f45c1abdb9b..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.cpp
+++ /dev/null
@@ -1,1033 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#include "hpl1/penumbra-overture/PlayerState_MiscHaptX.h"
-#include "hpl1/engine/engine.h"
-
-#include "hpl1/penumbra-overture/EffectHandler.h"
-#include "hpl1/penumbra-overture/GameLadder.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
-#include "hpl1/penumbra-overture/Init.h"
-#include "hpl1/penumbra-overture/MapHandler.h"
-#include "hpl1/penumbra-overture/Player.h"
-
-//////////////////////////////////////////////////////////////////////////
-// NORMAL STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_NormalHaptX::cPlayerState_NormalHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Normal) {
-}
-
-//-----------------------------------------------------------------------
-
-cVector3f gvStart, gvEnd;
-cVector3f gvFinalStart = 0, gvFinalEnd = 0;
-void cPlayerState_NormalHaptX::OnUpdate(float afTimeStep) {
- if (mpInit->mpNotebook->IsActive() == false &&
- mpInit->mpInventory->IsActive() == false &&
- mpInit->mpNumericalPanel->IsActive() == false &&
- mpInit->mpDeathMenu->IsActive() == false) {
- mpPlayer->ResetCrossHairPos();
- }
-
- /////////////////////////////////////
- // If run is down, run!!
- cInput *pInput = mpInit->mpGame->GetInput();
- if (pInput->IsTriggerd("Run") &&
- mpPlayer->GetMoveState() == ePlayerMoveState_Walk) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- }
-
- /////////////////////////////////////////////////
- // Cast ray to see if anything is picked.
- mpPlayer->mbProxyTouching = false;
- mpPlayer->GetPickRay()->mpPickedBody = NULL;
- cVector3f vProxyPos = mpInit->mpGame->GetHaptic()->GetLowLevel()->GetProxyPosition();
- mpPlayer->GetPickRay()->mvPickedPos = vProxyPos;
- mpPlayer->GetPickRay()->mfPickedDist = cMath::Vector3Dist(vProxyPos, mpPlayer->GetCamera()->GetPosition());
-
- cPortalContainer *pCont = mpInit->mpGame->GetScene()->GetWorld3D()->GetPortalContainer();
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cBoundingVolume bv;
- bv.SetSize(mpPlayer->GetHapticCamera()->GetHandReachRadius() * 2);
- bv.SetPosition(vProxyPos);
- cCollideData collideData;
- collideData.SetMaxSize(1);
-
- cPortalContainerEntityIterator it = pCont->GetEntityIterator(&bv);
- //iGameEntity *pPickedEntity = NULL;
- eGameEntityType pickedType = eGameEntityType_LastEnum;
-
- while (it.HasNext()) {
- iPhysicsBody *pBody = static_cast<iPhysicsBody *>(it.Next());
-
- if (pBody->GetUserData() == NULL)
- continue;
- if (cMath::CheckCollisionBV(bv, *pBody->GetBV()) == false)
- continue;
-
- iGameEntity *pEntity = (iGameEntity *)pBody->GetUserData();
- eGameEntityType type = pEntity->GetType();
-
- //////////////////////////////////////
- // TODO: Sort out more unwanted entites here (areas etc?)
-
- // If Item is picked, skip all else
- if (pickedType == eGameEntityType_Item && type != eGameEntityType_Item)
- continue;
-
- // Non moveable
- if (pBody->GetMass() == 0)
- continue;
- // Static
- if (pEntity->GetType() == eGameEntityType_Object) {
- cGameObject *pObject = static_cast<cGameObject *>(pEntity);
- if (pObject->GetInteractMode() == eObjectInteractMode_Static)
- continue;
- }
- // more checks...
-
- ////////////////////////////////////
- // Collision check
- if (pPhysicsWorld->CheckShapeCollision(mpPlayer->GetHapticCamera()->GetHandShape(),
- cMath::MatrixTranslate(vProxyPos),
- pBody->GetShape(), pBody->GetWorldMatrix(),
- collideData, 1)) {
- pickedType = type;
-
- mpPlayer->mbProxyTouching = true;
- mpPlayer->GetPickRay()->mpPickedBody = pBody;
- if (pickedType == eGameEntityType_Item)
- break;
- }
- }
-
- ////////////////////////////////////
- // Cross hair and pick check
- if (mpPlayer->GetPickRay()->mpPickedBody) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- // Set cross hair state
- eCrossHairState CrossState = pEntity->GetPickCrossHairState(mpPlayer->GetPickedBody());
-
- if (CrossState == eCrossHairState_Active ||
- CrossState == eCrossHairState_Examine) {
- mpPlayer->SetCrossHairState(CrossState);
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- // Call entity
- pEntity->PlayerPick();
- }
-
- /////////////////////////////////////////////////
- // Ray Check, if a body is not yet picked
- if (mpPlayer->GetPickRay()->mpPickedBody == NULL) {
- cVector3f vStart, vEnd;
-
- vStart = mpPlayer->GetCamera()->GetPosition();
- vEnd = vStart + cMath::Vector3Normalize(vProxyPos - vStart) * mpPlayer->GetPickRay()->mfMaxDistance;
-
- // gvEnd = vEnd; gvStart = vStart;
-
- mpPlayer->GetPickRay()->Clear();
- pPhysicsWorld->CastRay(mpPlayer->GetPickRay(), vStart, vEnd, true, false, true);
- mpPlayer->GetPickRay()->CalculateResults();
-
- // Log("Picked body: %d\n",(size_t)mpPlayer->GetPickedBody());
-
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- // Set cross hair state
- eCrossHairState CrossState = pEntity->GetPickCrossHairState(mpPlayer->GetPickedBody());
-
- // TODO: Check here if it is some non physical interaction.
- if ( // CrossState == eCrossHairState_Active || Skip active here...
- CrossState == eCrossHairState_Examine) {
- mpPlayer->SetCrossHairState(CrossState);
- if (CrossState == eCrossHairState_Active) {
- if ((pEntity->GetType() == eGameEntityType_Object &&
- pEntity->GetCallbackScript(eGameEntityScriptType_PlayerInteract) == NULL)) {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
- }
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- // Call entity
- pEntity->PlayerPick();
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::OnStartInteract() {
- // gvFinalEnd = gvEnd;
- // gvFinalStart = gvStart;
-
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
- pEntity->PlayerInteract();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::OnStartExamine() {
- // Log("Picked body: %d\n",(size_t)mpPlayer->GetPickedBody());
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- pEntity->PlayerExamine();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::OnStartRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Walk ||
- mpPlayer->GetMoveState() == ePlayerMoveState_Crouch) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- }
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump) {
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Run);
- }
-}
-void cPlayerState_NormalHaptX::OnStopRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Run)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Walk);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_NormalHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::OnStartInteractMode() {
- mpPlayer->ChangeState(ePlayerState_InteractMode);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::EnterState(iPlayerState *apPrevState) {
- mpPlayer->ResetCrossHairPos();
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_NormalHaptX::LeaveState(iPlayerState *apNextState) {
- // Can cause crashes!!
- // mpPlayer->GetPickRay()->mpPickedBody = NULL;
-}
-
-void cPlayerState_NormalHaptX::OnPostSceneDraw() {
- /*iLowLevelGraphics *pLowGfx = mpInit->mpGame->GetGraphics()->GetLowLevel();
- pLowGfx->DrawLine( gvFinalStart,gvFinalEnd,cColor(1,1));
- pLowGfx->DrawSphere(gvFinalStart,0.1f,cColor(1,0,0,1));
- pLowGfx->DrawSphere(gvFinalEnd,0.1f,cColor(0,1,0,1));*/
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// INTERACT MODE STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_InteractModeHaptX::cPlayerState_InteractModeHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_InteractMode) {
- mvLookSpeed = 0;
- mfRange = 15.0f;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::OnUpdate(float afTimeStep) {
- /////////////////////////////////////////////////
- // Cast ray to see if anything is picked.
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cVector3f vStart, vEnd;
-
- cVector3f vDir = mpPlayer->GetCamera()->UnProject(
- mpPlayer->GetCrossHairPos(),
- mpInit->mpGame->GetGraphics()->GetLowLevel());
- vStart = mpPlayer->GetCamera()->GetPosition();
- vEnd = vStart + vDir * mpPlayer->GetPickRay()->mfMaxDistance;
-
- mpPlayer->GetPickRay()->Clear();
- pPhysicsWorld->CastRay(mpPlayer->GetPickRay(), vStart, vEnd, true, false, true);
-
- // LogUpdate(" Calc pickray results\n");
- mpPlayer->GetPickRay()->CalculateResults();
-
- // LogUpdate(" Use picked body\n");
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- eCrossHairState CrossState = pEntity->GetPickCrossHairState(mpPlayer->GetPickedBody());
-
- if (CrossState == eCrossHairState_None)
- mpPlayer->SetCrossHairState(eCrossHairState_Inactive);
- else
- mpPlayer->SetCrossHairState(CrossState);
-
- pEntity->PlayerPick();
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_Inactive);
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::OnStartInteract() {
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- pEntity->PlayerInteract();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::OnStartExamine() {
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- pEntity->PlayerExamine();
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_InteractModeHaptX::OnAddYaw(float afVal) {
- /*cInput *pInput = mpInit->mpGame->GetInput();
-
- if(pInput->IsTriggerd("LookMode"))
- {
- mpPlayer->GetCamera()->AddYaw( -afVal * 2.0f * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
- }
- else
- {
- if(mpPlayer->AddCrossHairPos(cVector2f(afVal * 800.0f,0)))
- {
- mpPlayer->GetCamera()->AddYaw( -afVal * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
- }
-
- cVector2f vBorder = mpPlayer->GetInteractMoveBorder();
- cVector2f vPos = mpPlayer->GetCrossHairPos();
-
- if(vPos.x < vBorder.x + mfRange || vPos.x > (799 - vBorder.x - mfRange))
- {
- float fDist;
- if(vPos.x < vBorder.x + mfRange)
- {
- fDist = (vPos.x - vBorder.x);
- mvLookSpeed.x = 1 - (fDist / mfRange) * 1;
- }
- else
- {
- fDist = ((799 - vBorder.x) - vPos.x);
- mvLookSpeed.x = (1-(fDist / mfRange)) * -1;
- }
- }
- else
- {
- mvLookSpeed.x =0;
- }
- }
-
- return false;*/
- return true;
-}
-
-bool cPlayerState_InteractModeHaptX::OnAddPitch(float afVal) {
- /*cInput *pInput = mpInit->mpGame->GetInput();
-
- if(pInput->IsTriggerd("LookMode"))
- {
- float fInvert = mpInit->mpButtonHandler->GetInvertMouseY() ? -1.0f : 1.0f;
- mpPlayer->GetCamera()->AddPitch( -afVal *2.0f*fInvert * mpPlayer->GetLookSpeed());
- }
- else
- {
- if(mpPlayer->AddCrossHairPos(cVector2f(0,afVal * 600.0f)))
- {
- mpPlayer->GetCamera()->AddPitch( -afVal * mpPlayer->GetLookSpeed());
- }
-
- cVector2f vBorder = mpPlayer->GetInteractMoveBorder();
- cVector2f vPos = mpPlayer->GetCrossHairPos();
-
- if(vPos.y < vBorder.y + mfRange || vPos.y > (599 - vBorder.y - mfRange))
- {
- float fDist;
- if(vPos.y < vBorder.y + mfRange)
- {
- fDist = (vPos.y - vBorder.y);
- mvLookSpeed.y = 1 - (fDist / mfRange) * 1;
- }
- else
- {
- fDist = ((599 - vBorder.y) - vPos.y);
- mvLookSpeed.y = (1-(fDist / mfRange)) * -1;
- }
- }
- else
- {
- mvLookSpeed.y =0;
- }
- }
-
- return false;*/
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::OnStartInteractMode() {
- mpPlayer->ChangeState(ePlayerState_Normal);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::EnterState(iPlayerState *apPrevState) {
- mPrevMoveState = mpPlayer->GetMoveState();
-
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Run)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
-
- mvLookSpeed = 0;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::LeaveState(iPlayerState *apNextState) {
- /*if(mPrevMoveState != ePlayerMoveState_Run)
- mpPlayer->ChangeMoveState(mPrevMoveState);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);*/
-
- if (apNextState->mType == ePlayerState_Normal)
- mpPlayer->ResetCrossHairPos();
-
- // Can cause crashes!!
- // mpPlayer->GetPickRay()->mpPickedBody = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_InteractModeHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_InteractModeHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// USE ITEM STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_UseItemHaptX::cPlayerState_UseItemHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_UseItem) {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::OnUpdate(float afTimeStep) {
- iLowLevelHaptic *pLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
-
- /////////////////////////////////////////////////
- // Move cross hair
- cVector2f vCrossPos = pLowLevelHaptic->GetProxyScreenPos(cVector2f(800, 600));
- mpPlayer->SetCrossHairPos(vCrossPos);
-
- /////////////////////////////////////////////////
- // Cast ray to see if anything is picked.
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cVector3f vStart, vEnd;
-
- cVector3f vDir = mpPlayer->GetCamera()->UnProject(
- mpPlayer->GetCrossHairPos(),
- mpInit->mpGame->GetGraphics()->GetLowLevel());
- vStart = mpPlayer->GetCamera()->GetPosition();
- vEnd = vStart + vDir * mpPlayer->GetPickRay()->mfMaxDistance;
-
- mpPlayer->GetPickRay()->Clear();
- pPhysicsWorld->CastRay(mpPlayer->GetPickRay(), vStart, vEnd, true, false, true);
- mpPlayer->GetPickRay()->CalculateResults();
-
- iPhysicsBody *pBody = mpPlayer->GetPickedBody();
- iGameEntity *pEntity = NULL;
- if (pBody)
- pEntity = (iGameEntity *)pBody->GetUserData();
-
- if (pEntity && mpPlayer->GetPickedDist() <= pEntity->GetMaxInteractDist()) {
- mpInit->mpPlayer->SetItemFlash(true);
- } else {
- mpInit->mpPlayer->SetItemFlash(false);
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::OnStartInteract() {
- iPhysicsBody *pBody = mpPlayer->GetPickedBody();
- iGameEntity *pEntity = NULL;
- if (pBody)
- pEntity = (iGameEntity *)pBody->GetUserData();
-
- if (pEntity && mpPlayer->GetPickedDist() <= pEntity->GetMaxExamineDist()) {
- if (mpPlayer->GetPickedDist() <= pEntity->GetMaxInteractDist()) {
- iGameEntity *pEntity2 = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
- cGameItemType *pType = mpInit->mpInventory->GetItemType(mpPlayer->GetCurrentItem()->GetItemType());
-
- if (mPrevState == ePlayerState_WeaponMelee ||
- mPrevState == ePlayerState_Throw) {
- mpPlayer->ChangeState(ePlayerState_Normal);
- } else {
- mpPlayer->ChangeState(mPrevState);
- }
-
- pType->OnUse(mpPlayer->GetCurrentItem(), pEntity2);
- } else {
- mpInit->mpEffectHandler->GetSubTitle()->Add(kTranslate("Player", "UseItemTooFar"), 2.0f, true);
- return;
- }
- } else {
- if (mPrevState == ePlayerState_WeaponMelee ||
- mPrevState == ePlayerState_Throw) {
- mpPlayer->ChangeState(ePlayerState_Normal);
- } else {
- mpPlayer->ChangeState(mPrevState);
- }
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::OnStartExamine() {
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- if (mpPlayer->GetPickedDist() <= pEntity->GetMaxExamineDist()) {
- pEntity->PlayerExamine();
- }
- } else {
- if (mPrevState == ePlayerState_WeaponMelee ||
- mPrevState == ePlayerState_Throw) {
- mpPlayer->ChangeState(ePlayerState_Normal);
- } else {
- mpPlayer->ChangeState(mPrevState);
- }
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_UseItemHaptX::OnAddYaw(float afVal) {
- cInput *pInput = mpInit->mpGame->GetInput();
-
- if (pInput->IsTriggerd("LookMode")) {
- mpPlayer->GetCamera()->AddYaw(-afVal * 2.0f * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
- } else if (mpPlayer->AddCrossHairPos(cVector2f(afVal * 800.0f, 0))) {
- mpPlayer->GetCamera()->AddYaw(-afVal * mpPlayer->GetLookSpeed());
- mpPlayer->GetCharacterBody()->SetYaw(mpPlayer->GetCamera()->GetYaw());
- }
-
- return false;
-}
-
-bool cPlayerState_UseItemHaptX::OnAddPitch(float afVal) {
- cInput *pInput = mpInit->mpGame->GetInput();
-
- if (pInput->IsTriggerd("LookMode")) {
- float fInvert = mpInit->mpButtonHandler->GetInvertMouseY() ? -1.0f : 1.0f;
- mpPlayer->GetCamera()->AddPitch(-afVal * 2.0f * fInvert * mpPlayer->GetLookSpeed());
- } else if (mpPlayer->AddCrossHairPos(cVector2f(0, afVal * 600.0f))) {
- mpPlayer->GetCamera()->AddPitch(-afVal * mpPlayer->GetLookSpeed());
- }
-
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::EnterState(iPlayerState *apPrevState) {
- mPrevMoveState = mpPlayer->GetMoveState();
- mPrevState = apPrevState->mType;
-
- mpPlayer->SetCrossHairState(eCrossHairState_Item);
-
- mpPlayer->GetHapticCamera()->SetHandVisible(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::LeaveState(iPlayerState *apNextState) {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
-
- mpPlayer->GetHapticCamera()->SetHandVisible(true);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_UseItemHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_UseItemHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_UseItemHaptX::OnStartInventory() {
- mpPlayer->ChangeState(mPrevState);
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// MESSAGE STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_MessageHaptX::cPlayerState_MessageHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Message) {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MessageHaptX::OnUpdate(float afTimeStep) {
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MessageHaptX::OnJump() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MessageHaptX::OnStartInteract() {
- mpInit->mpGameMessageHandler->ShowNext();
-}
-
-void cPlayerState_MessageHaptX::OnStopInteract() {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MessageHaptX::OnStartExamine() {
- mpInit->mpGameMessageHandler->ShowNext();
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MessageHaptX::OnMoveForwards(float afMul, float afTimeStep) { return false; }
-bool cPlayerState_MessageHaptX::OnMoveSideways(float afMul, float afTimeStep) { return false; }
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MessageHaptX::OnAddYaw(float afVal) { return false; }
-bool cPlayerState_MessageHaptX::OnAddPitch(float afVal) { return false; }
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MessageHaptX::EnterState(iPlayerState *apPrevState) {
- // Change move state so the player is still
- mPrevMoveState = mpPlayer->GetMoveState();
- // mpPlayer->ChangeMoveState(ePlayerMoveState_Still);
-
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- mpPlayer->GetHapticCamera()->SetHandVisible(false);
- mpPlayer->GetHapticCamera()->SetRenderActive(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_MessageHaptX::LeaveState(iPlayerState *apNextState) {
- if (mPrevMoveState != ePlayerMoveState_Run && mPrevMoveState != ePlayerMoveState_Jump)
- mpPlayer->ChangeMoveState(mPrevMoveState);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- mpPlayer->GetHapticCamera()->SetHandVisible(true);
- mpPlayer->GetHapticCamera()->SetRenderActive(true);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MessageHaptX::OnStartInventory() {
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_MessageHaptX::OnStartInventoryShortCut(int alNum) {
- return false;
-}
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// CLIMB STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_ClimbHaptX::cPlayerState_ClimbHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Climb) {
- mpLadder = NULL;
-
- mfUpSpeed = mpInit->mpGameConfig->GetFloat("Movement_Climb", "UpSpeed", 0);
- mfDownSpeed = mpInit->mpGameConfig->GetFloat("Movement_Climb", "DownSpeed", 0);
-
- mfStepLength = mpInit->mpGameConfig->GetFloat("Movement_Climb", "StepLength", 0);
-
- mfStepCount = 0;
-
- mlState = 0;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::PlaySound(const tString &asSound) {
- if (asSound == "")
- return;
-
- iCharacterBody *pCharBody = mpPlayer->GetCharacterBody();
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
-
- cSoundEntity *pSound = pWorld->CreateSoundEntity("LadderStep", asSound, true);
- if (pSound)
- pSound->SetPosition(pCharBody->GetPosition());
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::EnterState(iPlayerState *apPrevState) {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
-
- mvPrevPitchLimits = mpPlayer->GetCamera()->GetPitchLimits();
-
- mlState = 0;
- mpPlayer->GetCharacterBody()->SetGravityActive(false);
- mpPlayer->GetCharacterBody()->SetTestCollision(false);
-
- mvGoalPos = mvStartPosition;
- mvGoalRot.x = 0;
- mvGoalRot.y = mpLadder->GetStartRotation().y;
-
- // Different time if you are above the ladder.
- float fTime = 0.5f;
- if (mpPlayer->GetCharacterBody()->GetPosition().y > mpLadder->GetMaxY())
- fTime = 1.2f;
-
- cVector3f vStartRot;
- vStartRot.x = mpPlayer->GetCamera()->GetPitch();
- vStartRot.y = mpPlayer->GetCamera()->GetYaw();
-
- mvPosAdd = (mvGoalPos - mpPlayer->GetCharacterBody()->GetPosition()) / fTime;
-
- mvRotAdd.x = cMath::GetAngleDistance(vStartRot.x, mvGoalRot.x, k2Pif) / fTime;
- mvRotAdd.y = cMath::GetAngleDistance(vStartRot.y, mvGoalRot.y, k2Pif) / fTime;
-
- mvCharPosition = mpPlayer->GetCharacterBody()->GetPosition();
-
- mfTimeCount = fTime;
-
- mfStepCount = 0;
-
- mbPlayedSound = false;
-
- // Play Sound
- PlaySound(mpLadder->GetAttachSound());
-
- // Haptic
- mpPlayer->GetHapticCamera()->SetRenderActive(false);
- mpPlayer->GetHapticCamera()->SetType(eHapticGameCameraType_Centre);
- mpPlayer->GetHapticCamera()->SetHandVisible(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::LeaveState(iPlayerState *apNextState) {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
-
- mpPlayer->GetCharacterBody()->SetGravityActive(true);
-
- mpPlayer->GetCamera()->SetPitchLimits(mvPrevPitchLimits);
- mpPlayer->GetCamera()->SetYawLimits(cVector2f(0, 0));
-
- // Haptic
- mpPlayer->GetHapticCamera()->SetRenderActive(true);
- mpPlayer->GetHapticCamera()->SetType(eHapticGameCameraType_Frame);
- mpPlayer->GetHapticCamera()->SetHandVisible(true);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::OnUpdate(float afTimeStep) {
- iCharacterBody *pCharBody = mpPlayer->GetCharacterBody();
- cCamera3D *pCam = mpPlayer->GetCamera();
-
- //////////////////////////////////
- // Attach To Ladder
- if (mlState == 0) {
- mfTimeCount -= afTimeStep;
-
- mvCharPosition += mvPosAdd * afTimeStep;
- pCharBody->SetPosition(mvCharPosition);
- mvCharPosition = pCharBody->GetPosition();
-
- pCam->AddPitch(mvRotAdd.x * afTimeStep);
- pCam->AddYaw(mvRotAdd.y * afTimeStep);
- pCharBody->SetYaw(pCam->GetYaw());
-
- if (mfTimeCount <= 0) {
- mpPlayer->GetCharacterBody()->SetTestCollision(true);
-
- ////////////////////////////
- // Set turn head limits
- cVector2f vMaxHeadLimits = cVector2f(cMath::ToRad(120), cMath::ToRad(79));
- cVector2f vMinHeadLimits = cVector2f(cMath::ToRad(-120), cMath::ToRad(-60));
- float fXmax = pCam->GetYaw() + vMaxHeadLimits.x;
- float fYmax = pCam->GetPitch() + vMaxHeadLimits.y;
-
- float fXmin = pCam->GetYaw() + vMinHeadLimits.x;
- float fYmin = pCam->GetPitch() + vMinHeadLimits.y;
-
- pCam->SetPitchLimits(cVector2f(fYmax, fYmin));
- pCam->SetYawLimits(cVector2f(fXmax, fXmin));
-
- mlState++;
- }
- }
- //////////////////////////////////
- // Move On Ladder
- else if (mlState == 1) {
-
- }
- //////////////////////////////////
- // On the top of the ladder
- else if (mlState == 2) {
- mfLeaveAtTopCount -= afTimeStep;
- pCharBody->Move(eCharDir_Forward, 1, afTimeStep);
-
- if (pCharBody->IsOnGround()) {
- mfLeaveAtTopCount -= afTimeStep;
- }
-
- if (mfLeaveAtTopCount <= 0) {
- mpPlayer->ChangeState(ePlayerState_Normal);
- }
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::OnStartInteract() {
- if (mlState != 0)
- mpPlayer->ChangeState(ePlayerState_Normal);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::OnStartExamine() {
- if (mlState != 0)
- mpPlayer->ChangeState(ePlayerState_Normal);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ClimbHaptX::OnAddYaw(float afVal) {
- if (mlState != 0)
- mpPlayer->GetCamera()->AddYaw(-afVal * mpPlayer->GetLookSpeed());
-
- return false;
-}
-
-bool cPlayerState_ClimbHaptX::OnAddPitch(float afVal) {
- // if(mlState!=0)
- // mpPlayer->GetCamera()->AddPitch( -afVal * mpPlayer->GetLookSpeed());
- if (mlState == 0)
- return false;
- else
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ClimbHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- if (mlState == 0 || mlState == 2)
- return false;
-
- iCharacterBody *pCharBody = mpPlayer->GetCharacterBody();
- iPhysicsWorld *pWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
-
- mvCharPosition = pCharBody->GetPosition();
- if (afMul > 0) {
- mvCharPosition.y += afMul * mfUpSpeed * afTimeStep;
-
- if (mfStepCount < 0)
- mfStepCount = 0;
- } else if (afMul < 0) {
- mvCharPosition.y += afMul * mfDownSpeed * afTimeStep;
-
- if (mfStepCount > 0)
- mfStepCount = 0;
- } else {
- if (!mbPlayedSound) {
- if (mfStepCount > 0)
- PlaySound(mpLadder->GetClimbUpSound());
- if (mfStepCount < 0)
- PlaySound(mpLadder->GetClimbDownSound());
- }
-
- mfStepCount = 0;
- mbPlayedSound = false;
- }
-
- // Check collision
- cMatrixf mtxPos = cMath::MatrixTranslate(mvCharPosition);
- cVector3f vNewPos;
- pWorld->CheckShapeWorldCollision(&vNewPos, pCharBody->GetShape(), mtxPos,
- pCharBody->GetBody(), false, true, NULL, true);
- if (vNewPos != mtxPos.GetTranslation()) {
- return false;
- }
-
- if (afMul > 0) {
- mfStepCount += afMul * mfUpSpeed * afTimeStep;
- if (mfStepCount >= mfStepLength) {
- mfStepCount = 0;
- PlaySound(mpLadder->GetClimbUpSound());
- mbPlayedSound = true;
- }
- } else if (afMul < 0) {
- mfStepCount += afMul * mfDownSpeed * afTimeStep;
- if (mfStepCount <= -mfStepLength) {
- mfStepCount = 0;
- PlaySound(mpLadder->GetClimbDownSound());
- mbPlayedSound = true;
- }
- } else {
- }
-
- pCharBody->SetPosition(mvCharPosition);
-
- if ((mvCharPosition.y - pCharBody->GetSize().y * 0.5f) > mpLadder->GetMaxY()) {
- // mpPlayer->ChangeState(ePlayerState_Normal);
- mlState = 2;
- mfLeaveAtTopCount = 2;
- mpPlayer->GetCharacterBody()->SetGravityActive(true);
- } else if ((mvCharPosition.y - pCharBody->GetSize().y / 2) < mpLadder->GetMinY()) {
- mpPlayer->ChangeState(ePlayerState_Normal);
- }
-
- return false;
-}
-bool cPlayerState_ClimbHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- /*iCharacterBody *pCharBody = */mpPlayer->GetCharacterBody();
-
- return false;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ClimbHaptX::OnStartCrouch() {
-}
-
-void cPlayerState_ClimbHaptX::OnStopCrouch() {
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ClimbHaptX::OnJump() {
- mpPlayer->ChangeState(ePlayerState_Normal);
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ClimbHaptX::OnStartInventory() {
- return false;
-}
-
-//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
deleted file mode 100644
index dc027074fc7..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_MiscHaptX.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#ifndef GAME_PLAYER_STATE_MISC_HAPTX_H
-#define GAME_PLAYER_STATE_MISC_HAPTX_H
-
-#include "hpl1/engine/engine.h"
-#include "hpl1/penumbra-overture/PlayerState.h"
-
-using namespace hpl;
-
-//////////////////////////////////////////////////////////////////////////
-// NORMAL STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cPlayerState_NormalHaptX : public iPlayerState {
-private:
-public:
- cPlayerState_NormalHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnStartInteract();
- void OnStartExamine();
-
- void OnStartRun();
- void OnStopRun();
- void OnStartCrouch();
- void OnStopCrouch();
-
- bool OnAddYaw(float afVal) { return true; }
- bool OnAddPitch(float afVal) { return true; }
-
- void OnStartInteractMode();
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnPostSceneDraw();
-};
-//////////////////////////////////////////////////////////////////////////
-// INTERACT MODE STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cPlayerState_InteractModeHaptX : public iPlayerState {
-public:
- cPlayerState_InteractModeHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnStartInteract();
- void OnStartExamine();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- void OnStartInteractMode();
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartCrouch();
- void OnStopCrouch();
-
-private:
- ePlayerMoveState mPrevMoveState;
-
- cVector2f mvLookSpeed;
- float mfRange;
-};
-
-//////////////////////////////////////////////////////////////////////////
-// USE ITEM STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cPlayerState_UseItemHaptX : public iPlayerState {
-private:
- ePlayerMoveState mPrevMoveState;
- ePlayerState mPrevState;
-
-public:
- cPlayerState_UseItemHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnStartInteract();
- void OnStartExamine();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartCrouch();
- void OnStopCrouch();
-
- bool OnStartInventory();
-};
-
-//////////////////////////////////////////////////////////////////////////
-// MESSAGE STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cPlayerState_MessageHaptX : public iPlayerState {
-private:
- ePlayerMoveState mPrevMoveState;
- //ePlayerState mPrevState;
-
-public:
- cPlayerState_MessageHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- bool OnJump();
-
- void OnStartInteract();
- void OnStopInteract();
- void OnStartExamine();
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- bool OnStartInventory();
- bool OnStartInventoryShortCut(int alNum);
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CLIMB
-//////////////////////////////////////////////////////////////////////////
-class cGameLadder;
-class cPlayerState_ClimbHaptX : public iPlayerState {
-private:
- int mlState;
-
- float mfTimeCount;
-
- cVector3f mvCharPosition;
-
- cVector3f mvGoalPos;
- cVector3f mvGoalRot;
-
- cVector3f mvPosAdd;
- cVector3f mvRotAdd;
-
- float mfUpSpeed;
- float mfDownSpeed;
-
- float mfStepLength;
- float mfStepCount;
- bool mbPlayedSound;
-
- cVector2f mvPrevPitchLimits;
-
- float mfLeaveAtTopCount;
-
- void PlaySound(const tString &asSound);
-
-public:
- cPlayerState_ClimbHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartInteract();
- void OnStartExamine();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- void OnStartCrouch();
- void OnStopCrouch();
-
- bool OnJump();
-
- bool OnStartInventory();
-
- cGameLadder *mpLadder;
- cVector3f mvStartPosition;
-};
-
-#endif // GAME_PLAYER_STATE_MISC_H
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
deleted file mode 100644
index f634df4b0ee..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.cpp
+++ /dev/null
@@ -1,981 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#include "hpl1/penumbra-overture/PlayerState_WeaponHaptX.h"
-#include "hpl1/engine/engine.h"
-
-#include "hpl1/penumbra-overture/Init.h"
-#include "hpl1/penumbra-overture/Player.h"
-
-#include "hpl1/penumbra-overture/HudModel_Throw.h"
-#include "hpl1/penumbra-overture/HudModel_Weapon.h"
-
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
-
-#include "hpl1/penumbra-overture/EffectHandler.h"
-#include "hpl1/penumbra-overture/GameEnemy.h"
-#include "hpl1/penumbra-overture/GameEntity.h"
-#include "hpl1/penumbra-overture/MapHandler.h"
-
-#include "common/list.h"
-
-//////////////////////////////////////////////////////////////////////////
-// THROW STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_ThrowHaptX::cPlayerState_ThrowHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_Throw) {
- mfLastForward = 1.0f;
- mfLastSideways = 1.0f;
-
- mpHudObject = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnUpdate(float afTimeStep) {
- if (mpInit->mpNotebook->IsActive() == false &&
- mpInit->mpInventory->IsActive() == false &&
- mpInit->mpNumericalPanel->IsActive() == false &&
- mpInit->mpDeathMenu->IsActive() == false) {
- mpPlayer->ResetCrossHairPos();
- }
-
- /////////////////////////////////////
- // If run is down, run!!
- cInput *pInput = mpInit->mpGame->GetInput();
- if (pInput->IsTriggerd("Run") &&
- mpPlayer->GetMoveState() == ePlayerMoveState_Walk) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- }
-
- /////////////////////////////////////////////////
- // Cast ray to see if anything is picked.
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
- cVector3f vStart, vEnd;
-
- vStart = mpPlayer->GetCamera()->GetPosition();
- vEnd = vStart + mpPlayer->GetCamera()->GetForward() * mpPlayer->GetPickRay()->mfMaxDistance;
-
- mpPlayer->GetPickRay()->Clear();
- pPhysicsWorld->CastRay(mpPlayer->GetPickRay(), vStart, vEnd, true, false, true);
- mpPlayer->GetPickRay()->CalculateResults();
-
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- // Set cross hair state
- eCrossHairState CrossState = pEntity->GetPickCrossHairState(mpPlayer->GetPickedBody());
- if (CrossState != eCrossHairState_None && pEntity->GetDescription() != _W("") &&
- !pEntity->GetHasBeenExamined()) {
- mpPlayer->SetCrossHairState(eCrossHairState_Examine);
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- // Call entity
- // pEntity->PlayerPick();
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- // Quick fix but works, the OnLeave of the previous states sets an old cross hair state.
- // mpPlayer->SetCrossHairState(eCrossHairState_None);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnDraw() {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnPostSceneDraw() {
- // mpHudObject->PostSceneDraw();
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnJump() {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStartInteractMode() {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStartInteract() {
- mpHudObject->OnAttackDown();
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStopInteract() {
- mpHudObject->OnAttackUp();
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStartExamine() {
- // mpInit->mpPlayerHands->SetCurrentModel(1,"");
- // mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
- if (mpPlayer->GetPickedBody()) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- pEntity->PlayerExamine();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStartHolster() {
- mpInit->mpPlayerHands->SetCurrentModel(1, "");
- mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnAddYaw(float afVal) {
- return true; // mpHudObject->OnMouseMove(cVector2f(afVal,0));
-}
-
-bool cPlayerState_ThrowHaptX::OnAddPitch(float afVal) {
- return true; // return mpHudObject->OnMouseMove(cVector2f(0,afVal));
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- mfLastForward = afMul;
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- mfLastSideways = afMul;
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::EnterState(iPlayerState *apPrevState) {
- mpHudObject->OnStart();
-
- // Haptic
- mpPlayer->GetHapticCamera()->SetRenderActive(false);
- mpPlayer->GetHapticCamera()->SetType(eHapticGameCameraType_Centre);
- mpPlayer->GetHapticCamera()->SetHandVisible(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::LeaveState(iPlayerState *apNextState) {
- if (apNextState->mType != ePlayerState_Message &&
- apNextState->mType != ePlayerState_WeaponMelee &&
- mpInit->mpPlayerHands->GetCurrentModel(1) == mpHudObject) {
- mpInit->mpPlayerHands->SetCurrentModel(1, "");
- }
-
- // Haptic
- mpPlayer->GetHapticCamera()->SetRenderActive(true);
- mpPlayer->GetHapticCamera()->SetType(eHapticGameCameraType_Frame);
- mpPlayer->GetHapticCamera()->SetHandVisible(true);
-}
-
-//-----------------------------------------------------------------------
-
-// No running when you have a weapon:
-void cPlayerState_ThrowHaptX::OnStartRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Walk)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump) {
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Run);
- }
-}
-void cPlayerState_ThrowHaptX::OnStopRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Run)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Walk);
-}
-//-----------------------------------------------------------------------
-
-void cPlayerState_ThrowHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_ThrowHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnStartInventory() {
- // mpPlayer->ChangeState(ePlayerState_Normal);
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_ThrowHaptX::OnStartInventoryShortCut(int alNum) {
- return true;
-}
-//-----------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// WEAPON MELEE STATE
-//////////////////////////////////////////////////////////////////////////
-
-cPlayerState_WeaponMeleeHaptX::cPlayerState_WeaponMeleeHaptX(cInit *apInit, cPlayer *apPlayer) : iPlayerState(apInit, apPlayer, ePlayerState_WeaponMelee) {
- mfLastForward = 1.0f;
- mfLastSideways = 1.0f;
-
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
-
- mpSlowdownForce = mpLowLevelHaptic->CreateViscosityForce(0, 6, 0.5f, 50.0f);
- mpSlowdownForce->SetActive(false);
-
- mbInteractDown = false;
-
- mpFeedbackForce = mpLowLevelHaptic->CreateImpulseForce(0);
- mpFeedbackForce->SetActive(false);
-
- mpImpulseForce = mpLowLevelHaptic->CreateImpulseForce(0);
- mpImpulseForce->SetActive(false);
-
- mbCollided = false;
-}
-
-//-----------------------------------------------------------------------
-
-static cVector3f gvPrevPos;
-static bool gbFirstTime = true;
-
-static Common::List<cVector3f> glsVelList;
-
-void cPlayerState_WeaponMeleeHaptX::OnUpdate(float afTimeStep) {
- /////////////////////////////////////
- // Set crosshair to centre of screen
- if (mpInit->mpNotebook->IsActive() == false &&
- mpInit->mpInventory->IsActive() == false &&
- mpInit->mpNumericalPanel->IsActive() == false &&
- mpInit->mpDeathMenu->IsActive() == false) {
- mpPlayer->ResetCrossHairPos();
- }
-
- /////////////////////////////////////
- // If run is down, run!!
- cInput *pInput = mpInit->mpGame->GetInput();
- if (pInput->IsTriggerd("Run") &&
- mpPlayer->GetMoveState() == ePlayerMoveState_Walk) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- }
-
- ///////////////////////////////////////////////
- // Calculate proxy movement speed
- mpLowLevelHaptic = mpInit->mpGame->GetHaptic()->GetLowLevel();
-
- cVector3f vMovement = mpLowLevelHaptic->GetHardwarePosition();
- if (gbFirstTime) {
- gvPrevPos = vMovement;
- gbFirstTime = false;
- }
-
- cVector3f vVelocity = (vMovement - gvPrevPos);
- vVelocity = cVector3f(vVelocity.x, vVelocity.y, vVelocity.z);
-
- glsVelList.push_back(vVelocity);
- // Change here to let the average speed consist of more samples
- if (glsVelList.size() > 10)
- glsVelList.pop_front();
-
- cVector3f vAvg(0);
- for (Common::List<cVector3f>::iterator it = glsVelList.begin(); it != glsVelList.end(); ++it) {
- vAvg += *it;
- }
- vAvg = vAvg / (float)glsVelList.size();
-
- ///////////////////////////////////////////////
- // If button is pressed then turn weapon according to speed of proxy
- if (mbInteractDown) {
- // Log("Avg: %s\n",vAvg.ToString().c_str());
-
- // mvGoalRotation.z =cMath::ToRad(0);
- bool bXSet = true;
- if (vAvg.x > 0.75f) {
- mvGoalRotation.y = cMath::ToRad(65.0f);
- mvGoalRotation.z = cMath::ToRad(90.0f);
- } else if (vAvg.x < -0.75f) {
- mvGoalRotation.y = cMath::ToRad(-65.0f);
- mvGoalRotation.z = cMath::ToRad(90.0f);
- } else {
- mvGoalRotation.y = cMath::ToRad(0.0f);
- bXSet = false;
- }
-
- if (vAvg.y > 0.75f) {
- mvGoalRotation.x = cMath::ToRad(-90.0f - 50.0f);
- if (bXSet) {
- if (mvGoalRotation.y > 0)
- mvGoalRotation.z = cMath::ToRad(45.0f);
- if (mvGoalRotation.y < 0)
- mvGoalRotation.z = cMath::ToRad(135.0f);
- } else {
- mvGoalRotation.z = 0;
- }
- } else if (vAvg.y < -0.75f) {
- mvGoalRotation.x = cMath::ToRad(-90.0f + 50.0f);
- if (bXSet) {
- if (mvGoalRotation.y < 0)
- mvGoalRotation.z = cMath::ToRad(45.0f);
- if (mvGoalRotation.y > 0)
- mvGoalRotation.z = cMath::ToRad(135.0f);
- } else {
- mvGoalRotation.z = 0;
- }
- } else {
- mvGoalRotation.x = cMath::ToRad(-90.0f);
- }
- }
-
- ///////////////////////////////////////////////
- // Calculate weapon and collider matrix
- cVector3f vProxyPos = mpPlayer->GetHapticCamera()->GetHandEntity()->GetWorldPosition();
- float fYaw = mpPlayer->GetCamera()->GetYaw();
-
- cMatrixf mtxWeapon = cMath::MatrixScale(mpHudWeapon->GetHapticScale());
-
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotate(mpHudWeapon->GetHapticRot(), eEulerRotationOrder_XYZ), mtxWeapon);
-
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(0, mvRotation.z, 0), eEulerRotationOrder_YXZ), mtxWeapon);
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(mvRotation.x, mvRotation.y, 0), eEulerRotationOrder_XZY), mtxWeapon);
-
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotateY(fYaw), mtxWeapon);
- mtxWeapon = cMath::MatrixMul(cMath::MatrixTranslate(vProxyPos), mtxWeapon);
-
- mpHudWeapon->GetEntity()->SetMatrix(mtxWeapon);
-
- cMatrixf mtxCollider = cMatrixf::Identity;
-
- mtxCollider = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(0, mvRotation.z, 0), eEulerRotationOrder_YXZ), mtxCollider);
- mtxCollider = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(mvRotation.x, mvRotation.y, 0), eEulerRotationOrder_XZY), mtxCollider);
-
- mtxCollider = cMath::MatrixMul(cMath::MatrixRotateY(fYaw), mtxCollider);
- mtxCollider = cMath::MatrixMul(cMath::MatrixTranslate(vProxyPos), mtxCollider);
-
- // mpBody->SetMatrix(mtxCollider);
-
- ///////////////////////////////////////////////
- // Update angles and turn towards goal
- // Y
- float fAngleStep = cMath::ToRad(90.0f * afTimeStep * 1.2f);
- if (mvGoalRotation.y != mvRotation.y) {
- mvRotation.y = cMath::TurnAngleRad(mvRotation.y, mvGoalRotation.y, fAngleStep);
- }
- // X
- fAngleStep = cMath::ToRad(90.0f * afTimeStep * 1.2f);
- if (mvGoalRotation.x != mvRotation.x) {
- mvRotation.x = cMath::TurnAngleRad(mvRotation.x, mvGoalRotation.x, fAngleStep);
- }
- // Z
- fAngleStep = cMath::ToRad(90.0f * afTimeStep * 5.2f);
- if (mvGoalRotation.z != mvRotation.z) {
- mvRotation.z = cMath::TurnAngleRad(mvRotation.z, mvGoalRotation.z, fAngleStep);
- }
-
- ///////////////////////////////////////////////
- // Make an attack
- float fSpeed = vAvg.Length(); // This speed is used to
- if (mbInteractDown && // Interaction must be down
- (fSpeed > 0.5 || vAvg.z > 0.3f) && // The minimum speed required for attack (z needs to be a bit lower)
- mfAttackCount <= 0 && // Do not allow a newer attack too soon after
- mbCollided == false // Makes sure that something that just collided can not make an attack, this removes double hits, but
- // may skips some hits too.
- ) {
- if (CheckAttack(mtxCollider, cMath::Min(fSpeed * 0.3f, 1.0f))) {
- mfAttackCount = 0.5f;
-
- // Force at hit, removed for now.
- // if(mpFeedbackForce->IsActive()) mpFeedbackForce->SetActive(false);
- // cVector3f vDir = cMath::Vector3Normalize(vAvg);
- // mpFeedbackForce->SetForce(vDir * -1.0f * fSpeed * 0.08f);
- // mpFeedbackForce->SetTimeControl(false, 0.1f,0,0,0.1f);
- // mpFeedbackForce->SetActive(true);
- }
- }
-
- if (mfAttackCount > 0)
- mfAttackCount -= afTimeStep;
-
- ///////////////////////////////////////////////
- // Check of collsion with any body and add force if there is.
- // this so weapon does not go into objects.
- cCamera3D *pCamera = mpInit->mpPlayer->GetCamera();
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
-
- cMatrixf mtxProxy = cMath::MatrixRotate(cVector3f(-pCamera->GetPitch(), -pCamera->GetYaw(),
- -pCamera->GetRoll()),
- eEulerRotationOrder_YXZ);
-
- if (mbInteractDown) {
- cVector3f vNewPos = mtxCollider.GetTranslation();
- bool bCollide = pPhysicsWorld->CheckShapeWorldCollision(&vNewPos, mpCollider, mtxCollider, NULL, false, false, NULL, false);
- if (bCollide && vNewPos != mtxWeapon.GetTranslation()) {
- cVector3f vDiff = vNewPos - mtxCollider.GetTranslation();
-
- float fMaxDiffLength = 0.1f;
- if (vDiff.Length() > fMaxDiffLength) {
- vDiff.Normalise();
- vDiff = vDiff * fMaxDiffLength;
- }
-
- mvPushBackVec = vDiff;
- mvPushBackPos = mtxCollider.GetTranslation();
-
- vDiff = cMath::MatrixMul(mtxProxy, vDiff);
- mpImpulseForce->SetForce(cMath::Vector3Normalize(vDiff) * 2);
-
- // Log("Collide %s\n",vDiff.ToString().c_str());
- mbCollided = true; // Set so that we must be out of collision before making an attack.
- } else {
- mbCollided = false;
-
- mvPushBackVec = 0;
- mpImpulseForce->SetForce(0);
- // mpImpulseForce->SetActive(false);
- }
- } else {
- mvPushBackVec = 0;
- mpImpulseForce->SetForce(0);
- mbCollided = false;
- }
-
- /////////////////////////////////////////////////
- // Cast Ray, To see if anything is picked. So you can still look at stuff
- cVector3f vStart, vEnd;
-
- vStart = mpPlayer->GetCamera()->GetPosition();
- vEnd = vStart + mpPlayer->GetCamera()->GetForward() * mpPlayer->GetPickRay()->mfMaxDistance;
-
- mpPlayer->GetPickRay()->Clear();
- pPhysicsWorld->CastRay(mpPlayer->GetPickRay(), vStart, vEnd, true, false, true);
- mpPlayer->GetPickRay()->CalculateResults();
-
- if (mpPlayer->GetPickedBody() && mpHudWeapon->IsAttacking() == false) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- // Set cross hair state
- eCrossHairState CrossState = pEntity->GetPickCrossHairState(mpPlayer->GetPickedBody());
- if (CrossState != eCrossHairState_None && pEntity->GetDescription() != _W("") &&
- !pEntity->GetHasBeenExamined()) {
- mpPlayer->SetCrossHairState(eCrossHairState_Examine);
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- // Call entity
- // pEntity->PlayerPick();
- } else {
- mpPlayer->SetCrossHairState(eCrossHairState_None);
- }
-
- //////////////////////////////////////
- // Set the previous movement
- gvPrevPos = vMovement;
-
- // Quick fix but works, the OnLeave of the previous states sets an old cross hair state.
- // mpPlayer->SetCrossHairState(eCrossHairState_None);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnDraw() {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnPostSceneDraw() {
- // Comment out this to see debug info!
- return;
-
- cCamera3D *pCamera = static_cast<cCamera3D *>(mpInit->mpGame->GetScene()->GetCamera());
-
- mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawLine(mvPushBackPos, mvPushBackPos + mvPushBackVec, cColor(1, 1));
-
- cVector3f vProxyPos = mpPlayer->GetHapticCamera()->GetHandEntity()->GetWorldPosition();
- float fYaw = mpPlayer->GetCamera()->GetYaw();
- cVector3f vSize = mpCollider->GetSize();
-
- cMatrixf mtxWeapon = cMatrixf::Identity; // cMath::MatrixTranslate(cVector3f(0,vSize.y*0.5f,0));
-
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(0, mvRotation.z, 0), eEulerRotationOrder_YXZ), mtxWeapon);
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotate(cVector3f(mvRotation.x, mvRotation.y, 0), eEulerRotationOrder_XZY), mtxWeapon);
-
- mtxWeapon = cMath::MatrixMul(cMath::MatrixRotateY(fYaw), mtxWeapon);
- mtxWeapon = cMath::MatrixMul(cMath::MatrixTranslate(vProxyPos), mtxWeapon);
-
- cMatrixf mtxCollider = cMath::MatrixMul(pCamera->GetViewMatrix(), mtxWeapon);
-
- cBoundingVolume boundingVolume = mpCollider->GetBoundingVolume();
- boundingVolume.SetTransform(cMath::MatrixMul(mtxWeapon, boundingVolume.GetTransform()));
-
- mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawBoxMaxMin(boundingVolume.GetMax(), boundingVolume.GetMin(), cColor(0, 0, 1, 1));
-
- mpInit->mpGame->GetGraphics()->GetLowLevel()->SetMatrix(eMatrix_ModelView, mtxCollider);
- mpInit->mpGame->GetGraphics()->GetLowLevel()->DrawBoxMaxMin(vSize * 0.5f, vSize * -0.5f, cColor(0, 1, 0, 1));
-
- mpInit->mpGame->GetGraphics()->GetLowLevel()->SetMatrix(eMatrix_ModelView, pCamera->GetViewMatrix());
-
- // mpBody->RenderDebugGeometry(mpInit->mpGame->GetGraphics()->GetLowLevel(),cColor(0,1,0,1));
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::OnJump() {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStartInteractMode() {
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStartInteract() {
- mbInteractDown = true;
- mpPlayer->GetHapticCamera()->SetUseFrame(false);
- mpImpulseForce->SetActive(true);
- mpImpulseForce->SetForce(0);
- mpSlowdownForce->SetActive(true);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStopInteract() {
- mbInteractDown = false;
- mvGoalRotation = 0;
- mpPlayer->GetHapticCamera()->SetUseFrame(true);
- mpImpulseForce->SetActive(false);
- mpSlowdownForce->SetActive(false);
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStartExamine() {
- // mpPlayer->ChangeState(ePlayerState_Normal);
- if (mpPlayer->GetPickedBody() && mpHudWeapon->IsAttacking() == false) {
- iGameEntity *pEntity = (iGameEntity *)mpPlayer->GetPickedBody()->GetUserData();
-
- pEntity->PlayerExamine();
- }
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStartHolster() {
- mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
- // mpHudWeapon = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::OnAddYaw(float afVal) {
- return true;
-}
-
-bool cPlayerState_WeaponMeleeHaptX::OnAddPitch(float afVal) {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::OnMoveForwards(float afMul, float afTimeStep) {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::OnMoveSideways(float afMul, float afTimeStep) {
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::EnterState(iPlayerState *apPrevState) {
- gbFirstTime = false;
-
- // Show the darn weapon
- mpHudWeapon->LoadEntities();
- mpHudWeapon->GetEntity()->SetVisible(true);
- mpHudWeapon->GetEntity()->SetCastsShadows(true);
-
- // Create collider
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
-
- cVector3f vSize = mpHudWeapon->GetHapticSize();
- cMatrixf mtxOffset = cMath::MatrixTranslate(cVector3f(0, vSize.y * 0.5f, 0));
- mpCollider = pPhysicsWorld->CreateBoxShape(vSize, &mtxOffset);
-
- // mpBody = pPhysicsWorld->CreateBody("",mpCollider);
- // mpBody->SetActive(false);
-
- mvRotation = 0;
- mfAttackCount = 0;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::LeaveState(iPlayerState *apNextState) {
- mpSlowdownForce->SetActive(false);
- mpImpulseForce->SetActive(false);
-
- mpHudWeapon->GetEntity()->SetVisible(false);
- mpHudWeapon->DestroyEntities();
-
- iPhysicsWorld *pPhysicsWorld = mpInit->mpGame->GetScene()->GetWorld3D()->GetPhysicsWorld();
-
- pPhysicsWorld->DestroyShape(mpCollider);
- // pPhysicsWorld->DestroyBody(mpBody);
-
- mpPlayer->GetHapticCamera()->SetUseFrame(true);
-
- // mpHudWeapon = NULL;
-}
-
-//-----------------------------------------------------------------------
-
-// No running when you have a weapon:
-void cPlayerState_WeaponMeleeHaptX::OnStartRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Walk)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Run);
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump) {
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Run);
- }
-}
-void cPlayerState_WeaponMeleeHaptX::OnStopRun() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Run)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- mpPlayer->SetPrevMoveState(ePlayerMoveState_Walk);
-}
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::OnStartCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Jump)
- return;
-
- if (mpInit->mpButtonHandler->GetToggleCrouch()) {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch)
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- else
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- } else {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Crouch);
- }
-}
-
-void cPlayerState_WeaponMeleeHaptX::OnStopCrouch() {
- if (mpPlayer->GetMoveState() == ePlayerMoveState_Crouch &&
- mpInit->mpButtonHandler->GetToggleCrouch() == false) {
- mpPlayer->ChangeMoveState(ePlayerMoveState_Walk);
- }
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::OnStartInventory() {
- // mpPlayer->ChangeState(ePlayerState_Normal);
- return true;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::PlaySound(const tString &asSound) {
- cSoundHandler *pSoundHandler = mpInit->mpGame->GetSound()->GetSoundHandler();
-
- pSoundHandler->PlayGui(asSound, false, 1.0f);
-}
-
-//-----------------------------------------------------------------------
-
-bool cPlayerState_WeaponMeleeHaptX::CheckAttack(const cMatrixf &a_mtxTransform, float afSpeed) {
- mpInit->mbWeaponAttacking = true;
- // Log("----------------- BEGIN ATTACK WITH WEAPON ------------ \n");
-
- cMeleeWeaponAttack *pAttack = mpHudWeapon->GetAttack(0);
-
- float fMaxImpulse = pAttack->mfMaxImpulse * afSpeed;
- float fMinImpulse = pAttack->mfMinImpulse * afSpeed;
-
- float fMinMass = pAttack->mfMinMass * afSpeed;
- float fMaxMass = pAttack->mfMaxMass * afSpeed;
-
- float fMinDamage = pAttack->mfMinDamage * afSpeed;
- float fMaxDamage = pAttack->mfMaxDamage * afSpeed;
-
- int lStrength = pAttack->mlAttackStrength;
-
- cCamera3D *pCamera = mpInit->mpPlayer->GetCamera();
-
- cBoundingVolume tempBV = mpCollider->GetBoundingVolume();
- tempBV.SetTransform(cMath::MatrixMul(a_mtxTransform, tempBV.GetTransform()));
-
- cCollideData collideData;
- collideData.SetMaxSize(1);
-
- bool bHit = false;
-
- cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();
- iPhysicsWorld *pPhysicsWorld = pWorld->GetPhysicsWorld();
-
- tVector3fList lstPostions;
-
- ////////////////////////////////
- // Iterate Enemies
- tGameEnemyIterator enemyIt = mpInit->mpMapHandler->GetGameEnemyIterator();
- while (enemyIt.HasNext()) {
- iGameEnemy *pEnemy = enemyIt.Next();
- iPhysicsBody *pBody = pEnemy->GetMover()->GetCharBody()->GetBody();
- float fMass = pBody->GetMass();
-
- if (pEnemy->GetMover()->GetCharBody()->IsActive() == false)
- continue;
-
- if (cMath::CheckCollisionBV(tempBV, *pBody->GetBV())) {
- if (pEnemy->GetMeshEntity()->CheckColliderShapeCollision(pPhysicsWorld,
- mpCollider, a_mtxTransform, &lstPostions, NULL) == false) {
- continue;
- }
-
- // Calculate force
- float fForceSize = 0;
- if (fMass > fMaxMass)
- fForceSize = 0;
- else if (fMass <= fMinMass)
- fForceSize = fMaxImpulse;
- else {
- float fT = (fMass - fMinMass) / (fMaxMass - fMinMass);
- fForceSize = fMinImpulse * fT + fMaxImpulse * (1 - fT);
- }
-
- cVector3f vForceDir = pCamera->GetForward();
- vForceDir.Normalise();
-
- // Add force to bodies
- for (int i = 0; i < pEnemy->GetBodyNum(); ++i) {
- iPhysicsBody *pBody2 = pEnemy->GetBody(i);
-
- pBody2->AddImpulse(vForceDir * fForceSize * 0.5f);
-
- cVector3f vTorque = cVector3f(0, 1, 0) * fMass * fForceSize * 0.5f;
- pBody2->AddTorque(vTorque);
- }
-
- // Calculate damage
- float fDamage = cMath::RandRectf(fMinDamage, fMaxDamage);
-
- pEnemy->Damage(fDamage, lStrength);
-
- // Get closest position
- float fClosestDist = 9999.0f;
- cVector3f vClosestPostion = a_mtxTransform.GetTranslation();
- for (tVector3fListIt it = lstPostions.begin(); it != lstPostions.end(); ++it) {
- cVector3f &vPos = *it;
-
- float fDist = cMath::Vector3DistSqr(pCamera->GetPosition(), vPos);
- if (fDist < fClosestDist) {
- fClosestDist = fDist;
- vClosestPostion = vPos;
- }
- }
-
- // Particle system
- if (pEnemy->GetHitPS() != "") {
- pWorld->CreateParticleSystem("Hit", pEnemy->GetHitPS(), 1, cMath::MatrixTranslate(vClosestPostion));
- }
-
- lstPostions.clear();
-
- bHit = true;
- }
- }
-
- Hpl1::Std::set<iPhysicsBody *> m_setHitBodies;
-
- ////////////////////////////////
- // Iterate bodies
- float fClosestHitDist = 9999.0f;
- cVector3f vClosestHitPos;
- iPhysicsMaterial *pClosestHitMat = NULL;
- cPhysicsBodyIterator it = pPhysicsWorld->GetBodyIterator();
- while (it.HasNext()) {
- iPhysicsBody *pBody = it.Next();
-
- /*float fMass = */pBody->GetMass();
-
- if (pBody->IsActive() == false)
- continue;
- if (pBody->GetCollide() == false)
- continue;
- if (pBody->IsCharacter())
- continue;
-
- if (cMath::CheckCollisionBV(tempBV, *pBody->GetBV())) {
- if (pPhysicsWorld->CheckShapeCollision(pBody->GetShape(), pBody->GetLocalMatrix(),
- mpCollider, a_mtxTransform, collideData, 1) == false) {
- continue;
- }
-
- cVector3f vHitPos = collideData.mvContactPoints[0].mvPoint;
-
- m_setHitBodies.insert(pBody);
-
- // Deal damage and force
- HitBody(pBody, fMinImpulse, fMaxImpulse, fMinMass, fMaxMass, fMinDamage, fMaxDamage, lStrength);
-
- // Check if this is the closest hit body
- float fDist = cMath::Vector3DistSqr(vHitPos, pCamera->GetPosition());
- if (fDist < fClosestHitDist) {
- fClosestHitDist = fDist;
- vClosestHitPos = collideData.mvContactPoints[0].mvPoint;
-
- pClosestHitMat = pBody->GetMaterial();
- }
-
- bHit = true;
- }
- }
-
- ////////////////////////////////////////////
- // Check the closest material and play sounds and effects depending on it.
- if (pClosestHitMat) {
- bHit = true;
-
- cMatrixf mtxPosition = cMath::MatrixTranslate(vClosestHitPos);
-
- cSurfaceData *pData = pClosestHitMat->GetSurfaceData();
- cSurfaceImpactData *pImpact = pData->GetHitDataFromSpeed(pAttack->mfAttackSpeed);
- if (pImpact) {
- cSoundEntity *pSound = pWorld->CreateSoundEntity("Hit", pImpact->GetSoundName(), true);
- if (pSound)
- pSound->SetPosition(vClosestHitPos);
-
- if (pAttack->mlHitPSPrio <= pImpact->GetPSPrio()) {
- if (pImpact->GetPSName() != "")
- pWorld->CreateParticleSystem("Hit", pImpact->GetPSName(), 1, mtxPosition);
- } else {
- if (pAttack->msHitPS != "")
- pWorld->CreateParticleSystem("Hit", pAttack->msHitPS, 1, mtxPosition);
- }
- }
- }
- // Log("----------------- END ATTACK WITH WEAPON ------------ \n");
-
- /////////////////////////
- // Play hit sound
- if (bHit) {
- PlaySound(pAttack->msHitSound);
- }
-
- mpInit->mbWeaponAttacking = false;
-
- return bHit;
-}
-
-//-----------------------------------------------------------------------
-
-void cPlayerState_WeaponMeleeHaptX::HitBody(iPhysicsBody *apBody, float afMinImpulse, float afMaxImpulse,
- float afMinMass, float afMaxMass,
- float afMinDamage, float afMaxDamage,
- int alStrength) {
- iGameEntity *pEntity = (iGameEntity *)apBody->GetUserData();
-
- if (pEntity && pEntity->GetType() == eGameEntityType_Enemy)
- return;
-
- cCamera3D *pCamera = mpInit->mpPlayer->GetCamera();
-
- cVector3f vSpinMul = cVector3f(0, 1, 0);
- vSpinMul = pCamera->GetRight() * vSpinMul.x +
- pCamera->GetUp() * vSpinMul.y +
- pCamera->GetForward() * vSpinMul.z;
-
- float fMass = apBody->GetMass();
-
- // Calculate force
- float fForceSize = 0;
- if (fMass > afMaxMass)
- fForceSize = 0;
- else if (fMass <= afMinMass)
- fForceSize = afMaxImpulse;
- else {
- float fT = (fMass - afMinMass) / (afMaxMass - afMinMass);
- fForceSize = afMinImpulse * fT + afMaxImpulse * (1 - fT);
- }
-
- // Calculate damage
- float fDamage = cMath::RandRectf(afMinDamage, afMaxDamage);
-
- cVector3f vForceDir = pCamera->GetForward();
-
- if (fMass > 0 && fForceSize > 0) {
- vForceDir.Normalise();
-
- // pBody->AddForce(vForceDir * fForceSize);
- apBody->AddImpulse(vForceDir * fForceSize);
-
- cVector3f vTorque = vSpinMul * fMass * fForceSize;
-
- // vTorque = cMath::MatrixMul(pBody->GetInertiaMatrix(),vTorque);
-
- apBody->AddTorque(vTorque);
- }
-
- if (pEntity) {
- pEntity->SetLastImpulse(vForceDir * fForceSize);
- pEntity->Damage(fDamage, alStrength);
- }
-}
-
-//-----------------------------------------------------------------------
diff --git a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h b/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
deleted file mode 100644
index 961f9915a09..00000000000
--- a/engines/hpl1/penumbra-overture/PlayerState_WeaponHaptX.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Copyright (C) 2006-2010 - Frictional Games
- *
- * This file is part of Penumbra Overture.
- */
-
-#ifndef GAME_PLAYER_STATE_WEAPON_HAPTX_H
-#define GAME_PLAYER_STATE_WEAPON_HAPTX_H
-
-#include "hpl1/engine/engine.h"
-#include "hpl1/penumbra-overture/PlayerState.h"
-
-using namespace hpl;
-
-//-----------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// THROW STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cHudModel_Throw;
-
-class cPlayerState_ThrowHaptX : public iPlayerState {
-public:
- cPlayerState_ThrowHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnDraw();
- void OnPostSceneDraw();
-
- bool OnJump();
-
- void OnStartInteractMode();
-
- void OnStartInteract();
- void OnStopInteract();
- void OnStartExamine();
- void OnStartHolster();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartRun();
- void OnStopRun();
-
- void OnStartCrouch();
- void OnStopCrouch();
-
- bool OnStartInventory();
- bool OnStartInventoryShortCut(int alNum);
-
- void SetHudObject(cHudModel_Throw *apHudObject) { mpHudObject = apHudObject; }
-
-private:
- cHudModel_Throw *mpHudObject;
- float mfLastForward;
- float mfLastSideways;
-};
-
-//-----------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// WEAPON MELEE STATE
-//////////////////////////////////////////////////////////////////////////
-
-class cHudModel_WeaponMelee;
-
-class cPlayerState_WeaponMeleeHaptX : public iPlayerState {
-public:
- cPlayerState_WeaponMeleeHaptX(cInit *apInit, cPlayer *apPlayer);
-
- void OnUpdate(float afTimeStep);
-
- void OnDraw();
- void OnPostSceneDraw();
-
- bool OnJump();
-
- void OnStartInteractMode();
-
- void OnStartInteract();
- void OnStopInteract();
- void OnStartExamine();
- void OnStartHolster();
-
- bool OnAddYaw(float afVal);
- bool OnAddPitch(float afVal);
-
- bool OnMoveForwards(float afMul, float afTimeStep);
- bool OnMoveSideways(float afMul, float afTimeStep);
-
- void EnterState(iPlayerState *apPrevState);
- void LeaveState(iPlayerState *apNextState);
-
- void OnStartRun();
- void OnStopRun();
-
- void OnStartCrouch();
- void OnStopCrouch();
-
- bool OnStartInventory();
-
- void SetHudWeapon(cHudModel_WeaponMelee *apHudWeapon) { mpHudWeapon = apHudWeapon; }
- cHudModel_WeaponMelee *GetHudWeapon() { return mpHudWeapon; }
-
-private:
- void PlaySound(const tString &asSound);
- bool CheckAttack(const cMatrixf &mtxTransform, float afSpeed);
- void HitBody(iPhysicsBody *apBody, float afMinImpulse, float afMaxImpulse,
- float afMinMass, float afMaxMass,
- float afMinDamage, float afMaxDamage,
- int alStrength);
-
- iLowLevelHaptic *mpLowLevelHaptic;
-
- cHudModel_WeaponMelee *mpHudWeapon;
- float mfLastForward;
- float mfLastSideways;
-
- iCollideShape *mpCollider;
- // iPhysicsBody *mpBody;
-
- iHapticForce *mpSlowdownForce;
- iHapticForce *mpFeedbackForce;
- iHapticForce *mpImpulseForce;
-
- bool mbCollided;
-
- cVector3f mvPushBackVec;
- cVector3f mvPushBackPos;
-
- float mfAttackCount;
-
- bool mbInteractDown;
- //int mlInteractCount;
-
- cVector3f mvRotation;
- cVector3f mvGoalRotation;
-};
-
-//-----------------------------------------------------------------
-
-#endif // GAME_PLAYER_STATE_WEAPON_H
diff --git a/engines/hpl1/penumbra-overture/PreMenu.cpp b/engines/hpl1/penumbra-overture/PreMenu.cpp
index 09fd82a0fc3..3c19e0adf76 100644
--- a/engines/hpl1/penumbra-overture/PreMenu.cpp
+++ b/engines/hpl1/penumbra-overture/PreMenu.cpp
@@ -575,8 +575,6 @@ void cPreMenu::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("PreMenu");
mpInit->mpGame->GetScene()->SetDrawScene(false);
mpInit->mpGame->GetScene()->SetUpdateMap(false);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(false);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_PreMenu);
for (size_t i = 0; i < mvTexNames.size(); ++i) {
@@ -634,8 +632,6 @@ void cPreMenu::SetActive(bool abX) {
mpInit->mpGame->GetUpdater()->SetContainer("Default");
mpInit->mpGame->GetScene()->SetDrawScene(true);
mpInit->mpGame->GetScene()->SetUpdateMap(true);
- if (mpInit->mbHasHaptics)
- mpInit->mpGame->GetHaptic()->GetLowLevel()->SetUpdateShapes(true);
mpInit->mpButtonHandler->ChangeState(eButtonHandlerState_Game);
mpInit->mpMapHandler->Load(mpInit->msStartMap, mpInit->msStartLink);
diff --git a/engines/hpl1/serialize.cpp b/engines/hpl1/serialize.cpp
index 5dd74971f2d..f07f54c4135 100644
--- a/engines/hpl1/serialize.cpp
+++ b/engines/hpl1/serialize.cpp
@@ -52,7 +52,6 @@
#include "hpl1/penumbra-overture/FadeHandler.h"
#include "hpl1/penumbra-overture/GameMusicHandler.h"
#include "hpl1/penumbra-overture/GraphicsHelper.h"
-#include "hpl1/penumbra-overture/HapticGameCamera.h"
#include "hpl1/penumbra-overture/Inventory.h"
#include "hpl1/penumbra-overture/MapLoadText.h"
#include "hpl1/penumbra-overture/Notebook.h"
More information about the Scummvm-git-logs
mailing list