From 86681c6f18b5741ba25bbbb7319bb832ffa4807a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 10 Jul 2019 09:06:43 +0300 Subject: Phone start, ped spinning and cop car fix, and some love to CPed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/control/Phones.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/control/Phones.h') diff --git a/src/control/Phones.h b/src/control/Phones.h index a29043ed..7ac34c3a 100644 --- a/src/control/Phones.h +++ b/src/control/Phones.h @@ -1,6 +1,34 @@ #pragma once +#include "Physical.h" #include "AnimBlendAssociation.h" +struct CPhone +{ + CVector m_vecPos; + uint16 *m_apMessages[6]; + int32 field_24; + CEntity *m_pEntity; + int32 m_nState; + uint8 field_30; +}; + +static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); + +class CPhoneInfo { +public: + int32 m_nMax; + int32 m_nNum; + CPhone m_aPhones[50]; + + CPhoneInfo() { } + ~CPhoneInfo() { } + + int FindNearestFreePhone(CVector*); + bool PhoneAtThisPosition(CVector); +}; + +extern CPhoneInfo &gPhoneInfo; + void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg); void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg); \ No newline at end of file -- cgit v1.2.3 From 4f333d44a0c72cd3b8e34b76c8774717ee2a8994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 10 Jul 2019 23:07:41 +0300 Subject: Fix CPhone crash, more functions --- src/control/Phones.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/control/Phones.h') diff --git a/src/control/Phones.h b/src/control/Phones.h index 7ac34c3a..74f24d25 100644 --- a/src/control/Phones.h +++ b/src/control/Phones.h @@ -3,12 +3,25 @@ #include "Physical.h" #include "AnimBlendAssociation.h" +enum { + PHONE_STATE_FREE, + PHONE_STATE_1, + PHONE_STATE_2, + PHONE_STATE_MESSAGE_REMOVED, + PHONE_STATE_ONETIME_MESSAGE_SET, + PHONE_STATE_REPEATED_MESSAGE_SET, + PHONE_STATE_REPEATED_MESSAGE_SHOWN_ONCE, + PHONE_STATE_ONETIME_MESSAGE_SHOWN, + PHONE_STATE_REPEATED_MESSAGE_SHOWN, + PHONE_STATE_9 +}; + struct CPhone { CVector m_vecPos; uint16 *m_apMessages[6]; - int32 field_24; - CEntity *m_pEntity; + uint32 m_lastTimeRepeatedMsgShown; + CEntity *m_pEntity; // it's building pool index in save files int32 m_nState; uint8 field_30; }; @@ -16,6 +29,9 @@ struct CPhone static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); class CPhoneInfo { + static bool &isPhonePickedUp; + static bool &isPhoneBeingPickedUp; + static CPhone *&pickedUpPhone; public: int32 m_nMax; int32 m_nNum; @@ -26,6 +42,11 @@ public: int FindNearestFreePhone(CVector*); bool PhoneAtThisPosition(CVector); + bool HasMessageBeenDisplayed(int); + bool IsMessageBeingDisplayed(int); + void Load(CPhoneInfo *source, uint8 buffer); + void SetPhoneMessage_JustOnce(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6); + void SetPhoneMessage_Repeatedly(int phoneId, uint16 *msg1, uint16 *msg2, uint16 *msg3, uint16 *msg4, uint16 *msg5, uint16 *msg6); }; extern CPhoneInfo &gPhoneInfo; -- cgit v1.2.3