diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-06-29 15:55:19 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-06-29 15:55:19 +0200 |
commit | 0974447f585a457ea7d68187db28bcec5aa269e2 (patch) | |
tree | 6f7cf38dc4ea9a17b1bc6125fcc69758cf535e34 /src/entities | |
parent | Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun (diff) | |
parent | fix (diff) | |
download | re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar.gz re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar.bz2 re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar.lz re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar.xz re3-0974447f585a457ea7d68187db28bcec5aa269e2.tar.zst re3-0974447f585a457ea7d68187db28bcec5aa269e2.zip |
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/CopPed.h | 24 | ||||
-rw-r--r-- | src/entities/Dummy.cpp | 52 | ||||
-rw-r--r-- | src/entities/Dummy.h | 7 | ||||
-rw-r--r-- | src/entities/Ped.cpp | 24 | ||||
-rw-r--r-- | src/entities/Physical.cpp | 2 | ||||
-rw-r--r-- | src/entities/Physical.h | 7 | ||||
-rw-r--r-- | src/entities/PlayerInfo.h | 20 | ||||
-rw-r--r-- | src/entities/Train.h | 11 |
8 files changed, 103 insertions, 44 deletions
diff --git a/src/entities/CopPed.h b/src/entities/CopPed.h index d41c2e9e..23d52ad0 100644 --- a/src/entities/CopPed.h +++ b/src/entities/CopPed.h @@ -4,18 +4,18 @@ enum eCrimeType { CRIME_NONE, - CRIME_SHOT_FIRED, - CRIME_PED_FIGHT, - CRIME_COP_FIGHT, - CRIME_DAMAGED_PED, - CRIME_DAMAGED_COP, - CRIME_CAR_THEFT, - CRIME_CRIME7, - CRIME_COP_EVASIVE_DIVE, - CRIME_COP_EVASIVE_DIVE2, - CRIME_PED_RUN_OVER, - CRIME_COP_RUN_OVER, - CRIME_DESTROYED_HELI, + CRIME_POSSESSION_GUN, + CRIME_HIT_PED, + CRIME_HIT_COP, + CRIME_SHOOT_PED, + CRIME_SHOOT_COP, + CRIME_STEAL_CAR, + CRIME_RUN_REDLIGHT, + CRIME_RECKLESS_DRIVING, + CRIME_SPEEDING, + CRIME_RUNOVER_PED, + CRIME_RUNOVER_COP, + CRIME_SHOOT_HELI, CRIME_PED_BURNED, CRIME_COP_BURNED, CRIME_VEHICLE_BURNED, diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp index a4880175..68b67b5c 100644 --- a/src/entities/Dummy.cpp +++ b/src/entities/Dummy.cpp @@ -1,7 +1,57 @@ #include "common.h" #include "patcher.h" -#include "Dummy.h" #include "Pools.h" +#include "World.h" +#include "Dummy.h" void *CDummy::operator new(size_t sz) { return CPools::GetDummyPool()->New(); } void CDummy::operator delete(void *p, size_t sz) { CPools::GetDummyPool()->Delete((CDummy*)p); } + +void +CDummy::Add(void) +{ + int x, xstart, xmid, xend; + int y, ystart, ymid, yend; + CSector *s; + CPtrList *list; + + CRect bounds = GetBoundRect(); + xstart = CWorld::GetSectorIndexX(bounds.left); + xend = CWorld::GetSectorIndexX(bounds.right); + xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f); + ystart = CWorld::GetSectorIndexY(bounds.top); + yend = CWorld::GetSectorIndexY(bounds.bottom); + ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f); + assert(xstart >= 0); + assert(xend < NUMSECTORS_X); + assert(ystart >= 0); + assert(yend < NUMSECTORS_Y); + + for(y = ystart; y <= yend; y++) + for(x = xstart; x <= xend; x++){ + s = CWorld::GetSector(x, y); + if(x == xmid && y == ymid) + list = &s->m_lists[ENTITYLIST_OBJECTS]; + else + list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; + CPtrNode *node = list->InsertItem(this); + assert(node); + m_entryInfoList.InsertItem(list, node, s); + } +} + +void +CDummy::Remove(void) +{ + CEntryInfoNode *node, *next; + for(node = m_entryInfoList.first; node; node = next){ + next = node->next; + node->list->DeleteNode(node->listnode); + m_entryInfoList.DeleteNode(node); + } +} + +STARTPATCHES + InjectHook(0x473860, &CDummy::Add_, PATCH_JUMP); + InjectHook(0x473AD0, &CDummy::Remove_, PATCH_JUMP); +ENDPATCHES diff --git a/src/entities/Dummy.h b/src/entities/Dummy.h index 034d4c57..4cfef2e2 100644 --- a/src/entities/Dummy.h +++ b/src/entities/Dummy.h @@ -9,9 +9,14 @@ public: CEntryInfoList m_entryInfoList; CDummy(void) { m_type = ENTITY_TYPE_DUMMY; } - // TODO: Add, Remove + void Add(void); + void Remove(void); static void *operator new(size_t); static void operator delete(void*, size_t); + + // to make patching virtual functions possible + void Add_(void) { CDummy::Add(); } + void Remove_(void) { CDummy::Remove(); } }; static_assert(sizeof(CDummy) == 0x68, "CDummy: error"); diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 74cdab09..7f83ea84 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -771,9 +771,9 @@ CPed::Attack(void) } } else { if (weaponAnimAssoc->animId == ANIM_WEAPON_BAT_V || weaponAnimAssoc->animId == ANIM_WEAPON_BAT_H) { - DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f); } else if (weaponAnimAssoc->animId == ANIM_FIGHT_PPUNCH) { - DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_PUNCH_ATTACK, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_PUNCH_ATTACK, 0.0f); } weaponAnimAssoc->speed = 0.5f; @@ -843,13 +843,13 @@ CPed::Attack(void) if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep <= ourWeapon->m_fAnimLoopEnd) { switch (ourWeaponType) { case WEAPONTYPE_UZI: - DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f); break; case WEAPONTYPE_AK47: - DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f); break; case WEAPONTYPE_M16: - DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f); break; default: break; @@ -1281,19 +1281,19 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (m_vehEnterType == VEHICLE_ENTER_FRONT_RIGHT || m_vehEnterType == VEHICLE_ENTER_REAR_RIGHT) { if (vehIsUpsideDown) { - m_fRotationDest = -PI + atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = -PI + veh->GetForward().Heading(); } else if (veh->bIsBus) { - m_fRotationDest = 0.5 * PI + atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = 0.5 * PI + veh->GetForward().Heading(); } else { - m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = veh->GetForward().Heading(); } } else if (m_vehEnterType == VEHICLE_ENTER_FRONT_LEFT || m_vehEnterType == VEHICLE_ENTER_REAR_LEFT) { if (vehIsUpsideDown) { - m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = veh->GetForward().Heading(); } else if (veh->bIsBus) { - m_fRotationDest = -0.5 * PI + atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = -0.5 * PI + veh->GetForward().Heading(); } else { - m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y); + m_fRotationDest = veh->GetForward().Heading(); } } @@ -1539,7 +1539,7 @@ CPed::PlayFootSteps(void) stepPart = 2; if (stepPart != 0) { - DMAudio.PlayOneShot(uAudioEntityId, stepPart == 1 ? SOUND_STEP_START : SOUND_STEP_END, 1.0f); + DMAudio.PlayOneShot(m_audioEntityId, stepPart == 1 ? SOUND_STEP_START : SOUND_STEP_END, 1.0f); CVector footPos(0.0f, 0.0f, 0.0f); for (RwFrame *frame = GetNodeFrame(stepPart == 1 ? PED_FOOTL : PED_FOOTR); frame; frame = RwFrameGetParent(frame)) diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 3e043a32..64e0fb8b 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -42,7 +42,7 @@ CPhysical::CPhysical(void) m_vecDamageNormal = CVector(0.0f, 0.0f, 0.0f); bUsesCollision = true; - uAudioEntityId = -5; + m_audioEntityId = -5; unk1 = 100.0f; m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f); field_EC = 0; diff --git a/src/entities/Physical.h b/src/entities/Physical.h index 11d2a1f9..749e2dd8 100644 --- a/src/entities/Physical.h +++ b/src/entities/Physical.h @@ -14,7 +14,7 @@ class CPhysical : public CEntity public: // The not properly indented fields haven't been checked properly yet - int uAudioEntityId; + int32 m_audioEntityId; float unk1; CTreadable *m_carTreadable; CTreadable *m_pedTreadable; @@ -58,9 +58,8 @@ public: uint8 bHitByTrain : 1; // from nick uint8 m_phy_flagA80 : 1; - uint8 m_nLastCollType; - uint8 m_nZoneLevel; - uint8 pad[3]; + uint8 m_nLastCollType; + uint8 m_nZoneLevel; CPhysical(void); ~CPhysical(void); diff --git a/src/entities/PlayerInfo.h b/src/entities/PlayerInfo.h index abda1b23..79f379d5 100644 --- a/src/entities/PlayerInfo.h +++ b/src/entities/PlayerInfo.h @@ -1,6 +1,6 @@ #pragma once -#include "Automobile.h" -#include "PlayerPed.h" + +#include "Collision.h" enum eWastedBustedState { @@ -10,10 +10,9 @@ enum eWastedBustedState WBSTATE_FAILED_CRITICAL_MISSION, }; -struct CCivilianPed -{ - -}; +class CVehicle; +class CPlayerPed; +class CCivilianPed; class CPlayerInfo { @@ -22,10 +21,7 @@ public: CVehicle *m_pRemoteVehicle; CColModel m_ColModel; CVehicle *m_pVehicleEx; - char m_aszPlayerName[70]; -private: - int8 _pad0[2]; -public: + char m_aPlayerName[70]; int32 m_nMoney; int32 m_nVisibleMoney; int32 m_nCollectedPackages; @@ -40,7 +36,7 @@ public: int32 m_nNextSexMoneyUpdateTime; int32 m_nSexFrequency; CCivilianPed *m_pHooker; - int8 m_bWBState; // eWastedBustedState + int8 m_WBState; // eWastedBustedState int8 field_217; int8 field_218; int8 field_219; @@ -71,4 +67,4 @@ public: RwTexture *m_pSkinTexture; }; -static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerPed: error"); +static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error"); diff --git a/src/entities/Train.h b/src/entities/Train.h index e591239b..f3fb9a40 100644 --- a/src/entities/Train.h +++ b/src/entities/Train.h @@ -2,10 +2,19 @@ #include "Vehicle.h" +enum +{ + TRAIN_DOOR_STATE2 = 2 +}; + class CTrain : public CVehicle { public: // 0x288 - uint8 stuff[92]; + uint8 stuff1[20]; + uint8 m_trackId; + uint8 stuff2[7]; + int16 m_doorState; + uint8 stuff3[62]; }; static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error"); |