summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Door.cpp
diff options
context:
space:
mode:
authormajestic <majesticcoding@gmail.com>2021-01-11 20:23:56 +0100
committermajestic <majesticcoding@gmail.com>2021-01-11 21:47:09 +0100
commit0f0812618acd6d5c87bd218bfb6f0b099135e64e (patch)
treead7b84792f40cc2fc60dbfdd35d38be783c23934 /src/vehicles/Door.cpp
parentMerge branch 'lcs' of https://github.com/GTAmodding/re3 into lcs (diff)
downloadre3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar.gz
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar.bz2
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar.lz
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar.xz
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.tar.zst
re3-0f0812618acd6d5c87bd218bfb6f0b099135e64e.zip
Diffstat (limited to 'src/vehicles/Door.cpp')
-rw-r--r--src/vehicles/Door.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/vehicles/Door.cpp b/src/vehicles/Door.cpp
index c80965aa..72a30339 100644
--- a/src/vehicles/Door.cpp
+++ b/src/vehicles/Door.cpp
@@ -168,3 +168,58 @@ CTrainDoor::IsClosed(void)
{
return m_fPosn == RetTranslationWhenClosed();
}
+
+bool
+CFerryDoor::IsInUse(void)
+{
+ float translationDifference = m_fPrevPosn - m_fPosn;
+ m_fPrevPosn = m_fPosn;
+ return Abs(translationDifference) > 0.002f;
+}
+
+float
+CFerryDoor::RetTranslationWhenClosed(void)
+{
+ if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn))
+ return m_fClosedPosn;
+ else
+ return m_fOpenPosn;
+}
+
+bool
+CFerryDoor::IsClosed(void)
+{
+ return m_fPosn == RetTranslationWhenClosed();
+}
+
+float
+CFerryDoor::RetTranslationWhenOpen(void)
+{
+ if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn))
+ return m_fOpenPosn;
+ else
+ return m_fClosedPosn;
+}
+
+bool
+CFerryDoor::IsFullyOpen(void)
+{
+ if(Abs(m_fPosn) < Abs(RetTranslationWhenOpen()) - 0.5f)
+ return false;
+ return true;
+}
+
+void
+CFerryDoor::Open(float ratio)
+{
+ float open;
+
+ m_fPrevPosn = m_fPosn;
+ open = RetTranslationWhenOpen();
+ if(ratio < 1.0f){
+ m_fPosn = open*ratio;
+ }else{
+ m_nDoorState = DOORST_OPEN;
+ m_fPosn = open;
+ }
+} \ No newline at end of file