diff options
author | erorcun <erayorcunus@gmail.com> | 2020-06-03 16:06:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 16:06:07 +0200 |
commit | 1e2b087601747c5031f48badf016c768b032976e (patch) | |
tree | 4ad32e600c365326d721db8d3d6359e7b4d7f00d /src/control | |
parent | get rid of III code (diff) | |
parent | Peds, eSound and PedState enum, fixes (diff) | |
download | re3-1e2b087601747c5031f48badf016c768b032976e.tar re3-1e2b087601747c5031f48badf016c768b032976e.tar.gz re3-1e2b087601747c5031f48badf016c768b032976e.tar.bz2 re3-1e2b087601747c5031f48badf016c768b032976e.tar.lz re3-1e2b087601747c5031f48badf016c768b032976e.tar.xz re3-1e2b087601747c5031f48badf016c768b032976e.tar.zst re3-1e2b087601747c5031f48badf016c768b032976e.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/PathFind.cpp | 10 | ||||
-rw-r--r-- | src/control/PathFind.h | 5 | ||||
-rw-r--r-- | src/control/Script.cpp | 31 |
3 files changed, 35 insertions, 11 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 4a948032..0dd9359c 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -23,7 +23,6 @@ CPathFind ThePaths; #define NUMDETACHED_PEDS 1214 #define NUMTEMPEXTERNALNODES 4600 - CPathInfoForObject *InfoForTileCars; CPathInfoForObject *InfoForTilePeds; @@ -1861,6 +1860,15 @@ CPathFind::DisplayPathData(void) } } +CVector +CPathFind::TakeWidthIntoAccountForWandering(CPathNode* nextNode, uint16 random) +{ + CVector pos = nextNode->GetPosition(); + float newX = (nextNode->GetPedNodeWidth() * ((random % 16) - 7)) + pos.x; + float newY = (nextNode->GetPedNodeWidth() * (((random / 16) % 16) - 7)) + pos.y; + return CVector(newX, newY, pos.z); +} + CPathNode* CPathFind::GetNode(int16 index) { diff --git a/src/control/PathFind.h b/src/control/PathFind.h index e481f4c6..2896237a 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -62,7 +62,7 @@ struct CPathNode int16 z; int16 distance; // in path search int16 firstLink; - int8 width; + uint8 width; int8 group; uint8 numLinks : 4; @@ -89,6 +89,7 @@ struct CPathNode float GetZ(void) { return z/8.0f; } bool HasDivider(void) { return width != 0; } float GetDividerWidth(void) { return width/(2*8.0f); } + float GetPedNodeWidth(void) { return width*(31.f/(500.f * 8.f)); } CPathNode *GetPrev(void); CPathNode *GetNext(void); void SetPrev(CPathNode *node); @@ -253,6 +254,8 @@ public: void Save(uint8 *buf, uint32 *size); void Load(uint8 *buf, uint32 size); + static CVector TakeWidthIntoAccountForWandering(CPathNode*, uint16); + CPathNode *GetNode(int16 index); int16 GetIndex(CPathNode *node); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d238f276..f59701b3 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -9913,13 +9913,21 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) StoreParameters(&m_nIp, 3); return 0; case COMMAND_ATTACH_CHAR_TO_CAR: - // TODO(MIAMI) - assert(0); + { + CollectParameters(&m_nIp, 8); + CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CVehicle *pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + pPed->AttachPedToEntity(pVehicle, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(ScriptParams[6]), (eWeaponType)ScriptParams[7]); return 0; + } case COMMAND_DETACH_CHAR_FROM_CAR: - // TODO(MIAMI) - assert(0); + { + CollectParameters(&m_nIp, 1); + CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + if (pPed && pPed->m_attachedTo) + pPed->DettachPedFromEntity(); return 0; + } case COMMAND_SET_CAR_CHANGE_LANE: // for some reason changed in SA { CollectParameters(&m_nIp, 2); @@ -10964,14 +10972,15 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); - debug("SET_CHAR_SHUFFLE_INTO_DRIVERS_SEAT is not implemented\n"); + pPed->PedShuffle(); return 0; } case COMMAND_ATTACH_CHAR_TO_OBJECT: { CollectParameters(&m_nIp, 8); - debug("ATTACH_CHAR_TO_OBJECT is not implemented\n"); + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + pPed->AttachPedToEntity(pObject, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(ScriptParams[6]), (eWeaponType)ScriptParams[7]); return 0; } case COMMAND_SET_CHAR_AS_PLAYER_FRIEND: @@ -11309,7 +11318,11 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_SET_CHAR_ANSWERING_MOBILE: { CollectParameters(&m_nIp, 2); - debug("SET_CHAR_ANSWERING_MOBILE not implemented\n"); // TODO(MIAMI) + CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + if (ScriptParams[1]) + pPed->SetAnswerMobile(); + else + pPed->ClearAnswerMobile(); return 0; } case COMMAND_SET_PLAYER_DRUNKENNESS: @@ -11988,7 +12001,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) case COMMAND_ADD_BIG_GUN_FLASH: { CollectParameters(&m_nIp, 6); - debug("ADD_BIG_GUN_FLASH not implemented\n"); // TODO(MIAMI) + CWeapon::AddGunFlashBigGuns(*(CVector*)&ScriptParams[0], *(CVector*)&ScriptParams[3]); return 0; } case COMMAND_HAS_CHAR_BOUGHT_ICE_CREAM: |