diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2019-07-09 22:39:29 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2019-07-09 22:39:29 +0200 |
commit | ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1 (patch) | |
tree | 22019f7aa3ed57061c581ae837b6f4f3751d3822 /src/core | |
parent | RunningScript: 1/12 (diff) | |
parent | yet more CAutomobile (diff) | |
download | re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar.gz re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar.bz2 re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar.lz re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar.xz re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.tar.zst re3-ca4c7d9a4b802940eee9bf0cf86c30120d2e5ca1.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Camera.cpp | 11 | ||||
-rw-r--r-- | src/core/Camera.h | 2 | ||||
-rw-r--r-- | src/core/Collision.cpp | 2 | ||||
-rw-r--r-- | src/core/Collision.h | 2 | ||||
-rw-r--r-- | src/core/Explosion.cpp | 5 | ||||
-rw-r--r-- | src/core/Explosion.h | 15 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 1 | ||||
-rw-r--r-- | src/core/Fire.cpp | 6 | ||||
-rw-r--r-- | src/core/Fire.h | 21 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 8 | ||||
-rw-r--r-- | src/core/Placeable.h | 5 | ||||
-rw-r--r-- | src/core/Wanted.cpp | 10 | ||||
-rw-r--r-- | src/core/Wanted.h | 1 | ||||
-rw-r--r-- | src/core/config.h | 2 | ||||
-rw-r--r-- | src/core/re3.cpp | 10 |
15 files changed, 82 insertions, 19 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 6cafaade..4f565897 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -18,6 +18,7 @@ const float DefaultFOV = 70.0f; // beta: 80.0f CCamera &TheCamera = *(CCamera*)0x6FACF8; bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8; +WRAPPER void CCamera::CamShake(float strength, float x, float y, float z) { EAXJMP(0x46B200); } WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); } WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); } WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); } @@ -679,9 +680,13 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl else if(TargetZOffSet == m_fUnknownZOffSet && TargetZOffSet > m_fCamBufferedHeight){ // TODO: figure this out bool foo = false; - switch(((CPhysical*)CamTargetEntity)->m_nLastCollType) - case 2: case 3: case 5: - case 11: case 23: case 26: + switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched) + case SURFACE_GRASS: + case SURFACE_DIRT: + case SURFACE_PAVEMENT: + case SURFACE_STEEL: + case SURFACE_TIRE: + case SURFACE_STONE: foo = true; if(foo) WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false); diff --git a/src/core/Camera.h b/src/core/Camera.h index da0e55eb..c0309b5f 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -454,6 +454,8 @@ int m_iModeObbeCamIsInForCar; void ProcessMusicFade(void); void SetFadeColour(uint8 r, uint8 g, uint8 b); + void CamShake(float strength, float x, float y, float z); + void SetMotionBlur(int r, int g, int b, int a, int type); void SetMotionBlurAlpha(int a); void RenderMotionBlur(void); diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index d15ccca5..94da1338 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -1173,7 +1173,7 @@ enum { // This checks model A's spheres and lines against model B's spheres, boxes and triangles. // Returns the number of A's spheres that collide. // Returned ColPoints are in world space. -// NB: lines do not seem to be supported very well, use with caution +// NB: only vehicles can have col models with lines, exactly 4, one for each wheel int32 CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, diff --git a/src/core/Collision.h b/src/core/Collision.h index 5a9058d3..b2fe6564 100644 --- a/src/core/Collision.h +++ b/src/core/Collision.h @@ -147,7 +147,7 @@ public: static bool ProcessSphereTriangle(const CColSphere &sph, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq); static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough); static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly); - static int32 ProcessColModels(const CMatrix &matrix1, CColModel &model1, const CMatrix &matrix2, CColModel &model2, CColPoint *point1, CColPoint *point2, float *linedists); + static int32 ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, CColPoint *spherepoints, CColPoint *linepoints, float *linedists); // TODO: // CCollision::IsStoredPolyStillValidVerticalLine diff --git a/src/core/Explosion.cpp b/src/core/Explosion.cpp new file mode 100644 index 00000000..f55cbcd6 --- /dev/null +++ b/src/core/Explosion.cpp @@ -0,0 +1,5 @@ +#include "common.h" +#include "patcher.h" +#include "Explosion.h" + +WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); } diff --git a/src/core/Explosion.h b/src/core/Explosion.h new file mode 100644 index 00000000..69508490 --- /dev/null +++ b/src/core/Explosion.h @@ -0,0 +1,15 @@ +#pragma once + +class CEntity; + +enum eExplosionType +{ + EXPLOSION_3 = 3, + EXPLOSION_4 +}; + +class CExplosion +{ +public: + static void AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32); +}; diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index fdc3b9d7..b949eb98 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -813,6 +813,7 @@ CFileLoader::LoadPedObject(const char *line) if(strcmp(animGroup, CAnimManager::GetAnimGroupName((AssocGroupId)animGroupId)) == 0) break; mi->m_animGroup = animGroupId; + mi->m_carsCanDrive = carsCanDrive; // ??? CModelInfo::GetModelInfo(MI_LOPOLYGUY)->SetColModel(&CTempColModels::ms_colModelPed1); diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index 05d72199..bc59de2f 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -2,4 +2,8 @@ #include "patcher.h" #include "Fire.h" -WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
\ No newline at end of file +CFireManager &gFireManager = *(CFireManager*)0x8F31D0; + +WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); } + +WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); } diff --git a/src/core/Fire.h b/src/core/Fire.h index c7f83fd8..9c9e1dec 100644 --- a/src/core/Fire.h +++ b/src/core/Fire.h @@ -1,13 +1,13 @@ #pragma once -#include "common.h" -#include "Entity.h" + +class CEntity; class CFire { - char m_bIsOngoing; - char m_bExists; - char m_bPropogationFlag; - char m_bAudioSet; + bool m_bIsOngoing; + bool m_bExists; + bool m_bPropogationFlag; + bool m_bAudioSet; CVector m_vecPos; CEntity *m_pEntity; CEntity *m_pSource; @@ -20,4 +20,11 @@ class CFire public: void Extinguish(void); -};
\ No newline at end of file +}; + +class CFireManager +{ +public: + void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32); +}; +extern CFireManager &gFireManager; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index fdb2420b..2fa9d8ea 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -2261,7 +2261,7 @@ bool GetPadMoveUp() return (CPad::GetPad(0)->NewState.DPadUp && !CPad::GetPad(0)->OldState.DPadUp) || (CPad::GetPad(0)->NewKeyState.UP && !CPad::GetPad(0)->OldKeyState.UP) || - (CPad::GetPad(0)->NewState.LeftStickY < 0 && !CPad::GetPad(0)->OldState.LeftStickY < 0); + (CPad::GetPad(0)->NewState.LeftStickY < 0 && !(CPad::GetPad(0)->OldState.LeftStickY < 0)); } bool GetPadMoveDown() @@ -2269,7 +2269,7 @@ bool GetPadMoveDown() return (CPad::GetPad(0)->NewState.DPadDown && !CPad::GetPad(0)->OldState.DPadDown) || (CPad::GetPad(0)->NewKeyState.DOWN && !CPad::GetPad(0)->OldKeyState.DOWN) || - (CPad::GetPad(0)->NewState.LeftStickY > 0 && !CPad::GetPad(0)->OldState.LeftStickY > 0); + (CPad::GetPad(0)->NewState.LeftStickY > 0 && !(CPad::GetPad(0)->OldState.LeftStickY > 0)); } bool GetPadMoveLeft() @@ -2277,7 +2277,7 @@ bool GetPadMoveLeft() return (CPad::GetPad(0)->NewState.DPadLeft && !CPad::GetPad(0)->OldState.DPadLeft) || (CPad::GetPad(0)->NewKeyState.LEFT && !CPad::GetPad(0)->OldKeyState.LEFT) || - (CPad::GetPad(0)->NewState.LeftStickX < 0 && !CPad::GetPad(0)->OldState.LeftStickX < 0); + (CPad::GetPad(0)->NewState.LeftStickX < 0 && !(CPad::GetPad(0)->OldState.LeftStickX < 0)); } bool GetPadMoveRight() @@ -2285,7 +2285,7 @@ bool GetPadMoveRight() return (CPad::GetPad(0)->NewState.DPadRight && !CPad::GetPad(0)->OldState.DPadRight) || (CPad::GetPad(0)->NewKeyState.RIGHT && !CPad::GetPad(0)->OldKeyState.RIGHT) || - (CPad::GetPad(0)->NewState.LeftStickX > 0 && !CPad::GetPad(0)->OldState.LeftStickX > 0); + (CPad::GetPad(0)->NewState.LeftStickX > 0 && !(CPad::GetPad(0)->OldState.LeftStickX > 0)); } bool GetMouseForward() diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 1dfece69..648b315c 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -17,6 +17,11 @@ public: CMatrix &GetMatrix(void) { return m_matrix; } void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); } void SetHeading(float angle); + void SetOrientation(float x, float y, float z){ + CVector pos = m_matrix.GetPosition(); + m_matrix.SetRotate(x, y, z); + m_matrix.Translate(pos); + } bool IsWithinArea(float x1, float y1, float x2, float y2); bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); }; diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp index 21853308..4608bfef 100644 --- a/src/core/Wanted.cpp +++ b/src/core/Wanted.cpp @@ -34,7 +34,7 @@ int CWanted::NumOfHelisRequired() return 2; default: return 0; - }; + } } void CWanted::SetWantedLevel(int32 level) @@ -70,11 +70,17 @@ void CWanted::SetWantedLevel(int32 level) UpdateWantedLevel(); } +void CWanted::SetWantedLevelNoDrop(int32 level) +{ + if (level > m_nWantedLevel) + SetWantedLevel(level); +} + void CWanted::ClearQdCrimes() { for (int i = 0; i < 16; i++) { m_sCrimes[i].m_eCrimeType = CRIME_NONE; - }; + } } void CWanted::UpdateWantedLevel() diff --git a/src/core/Wanted.h b/src/core/Wanted.h index d14bb905..d3f6638b 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -42,6 +42,7 @@ public: bool AreArmyRequired(); int NumOfHelisRequired(); void SetWantedLevel(int32); + void SetWantedLevelNoDrop(int32 level); void ClearQdCrimes(); void UpdateWantedLevel(); }; diff --git a/src/core/config.h b/src/core/config.h index c3b66ff7..b1efd4b6 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -30,6 +30,8 @@ enum Config { NUMDUMMIES = 2802, // 2368 on PS2 NUMAUDIOSCRIPTOBJECTS = 256, + NUMTEMPOBJECTS = 30, + // Link list lengths // TODO: alpha list NUMCOLCACHELINKS = 200, diff --git a/src/core/re3.cpp b/src/core/re3.cpp index d6e81214..f266ffab 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -155,6 +155,15 @@ spawnCar(int id) #endif void +FixCar(void) +{ + CVehicle *veh = FindPlayerVehicle(); + if(veh == nil || !veh->IsCar()) + return; + ((CAutomobile*)veh)->Fix(); +} + +void DebugMenuPopulate(void) { if(DebugMenuLoad()){ @@ -198,6 +207,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat); DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat); + DebugMenuAddCmd("Debug", "Fix Car", FixCar); DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil); DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil); DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil); |