This commit is contained in:
_AG committed 2019-07-07 15:16:54 +02:00
commit d1c6a6aaa6
159 files changed
+390 -188

No files matched your search

+24 -15
View File
@@ -3,30 +3,39 @@ workspace "re3"
location "build"
files { "src/*.*" }
files { "src/skel/*.*" }
files { "src/skel/win/*.*" }
files { "src/math/*.*" }
files { "src/modelinfo/*.*" }
files { "src/entities/*.*" }
files { "src/weapons/*.*" }
files { "src/render/*.*" }
files { "src/control/*.*" }
files { "src/animation/*.*" }
files { "src/audio/*.*" }
files { "src/control/*.*" }
files { "src/core/*.*" }
files { "src/entities/*.*" }
files { "src/math/*.*" }
files { "src/modelinfo/*.*" }
files { "src/objects/*.*" }
files { "src/peds/*.*" }
files { "src/render/*.*" }
files { "src/skel/*.*" }
files { "src/skel/win/*.*" }
files { "src/vehicles/*.*" }
files { "src/weapons/*.*" }
includedirs { "src" }
includedirs { "src/animation" }
includedirs { "src/audio" }
includedirs { "src/control" }
includedirs { "src/core" }
includedirs { "src/entities" }
includedirs { "src/modelinfo" }
includedirs { "src/objects" }
includedirs { "src/peds" }
includedirs { "src/render" }
includedirs { "src/skel/" }
includedirs { "src/skel/win" }
includedirs { "src/modelinfo" }
includedirs { "src/entities" }
includedirs { "src/vehicles" }
includedirs { "src/weapons" }
includedirs { "src/render" }
includedirs { "src/control" }
includedirs { "src/audio" }
includedirs { "src/animation" }
includedirs { "dxsdk/include" }
includedirs { "rwsdk/include/d3d8" }
libdirs { "dxsdk/lib" }
project "re3"
+1 -1
View File
@@ -77,7 +77,7 @@ public:
void UpdateTime(float timeDelta, float relSpeed);
bool UpdateBlend(float timeDelta);
float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
+1 -1
View File
@@ -752,7 +752,7 @@ CAnimManager::LoadAnimFiles(void)
AnimAssocDefinition *def = &CAnimManager::ms_aAnimAssocDefinitions[i];
group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims);
for(j = 0; j < group->numAssociations; j++)
group->GetAnimation(def->animDescs[j].animId)->flags |= def->animDescs[j].flags;
group->GetAnimation(j)->flags |= def->animDescs[j].flags;
RpClumpDestroy(clump);
}
}
@@ -1,6 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "PhoneInfo.h"
#include "Phones.h"
WRAPPER void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F570); }
WRAPPER void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F470); }
WRAPPER void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F470); }
File renamed without changes.
+3 -3
View File
@@ -16,7 +16,7 @@
#include "ModelInfo.h"
#include "Object.h"
#include "Pad.h"
#include "PhoneInfo.h"
#include "Phones.h"
#include "Pickups.h"
#include "Plane.h"
#include "Pools.h"
@@ -638,7 +638,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
if (vehicle->IsCar()){
CAutomobile* car = (CAutomobile*)vehicle;
for (int i = 0; i < 4; i++){
vp->wheel_susp_dist[i] = 50.0f * car->m_aWheelDist[i];
vp->wheel_susp_dist[i] = 50.0f * car->m_aSuspensionSpringRatio[i];
vp->wheel_rotation[i] = 128.0f / M_PI * car->m_aWheelRotation[i];
}
vp->door_angles[0] = 127.0f / M_PI * car->Doors[2].m_fAngle;
@@ -683,7 +683,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
if (vehicle->IsCar()) {
CAutomobile* car = (CAutomobile*)vehicle;
for (int i = 0; i < 4; i++) {
car->m_aWheelDist[i] = vp->wheel_susp_dist[i] / 50.0f;
car->m_aSuspensionSpringRatio[i] = vp->wheel_susp_dist[i] / 50.0f;
car->m_aWheelRotation[i] = vp->wheel_rotation[i] * M_PI / 128.0f;
}
car->Doors[2].m_fAngle = car->Doors[2].m_fPreviousAngle = vp->door_angles[0] * M_PI / 127.0f;
+2 -2
View File
@@ -262,8 +262,8 @@ public:
static void StreamAllNecessaryCarsAndPeds(void);
static bool ShouldStandardCameraBeProcessed(void);
inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
private:
static void RecordThisFrame(void);
+145 -6
View File
@@ -129,6 +129,10 @@ void CMissionCleanup::Process()
}
}
/* NB: CUpsideDownCarCheck is not used by actual script at all
* It has a weird usage: AreAnyCarsUpsideDown would fail any mission
* just like death or arrest. */
void CUpsideDownCarCheck::Init()
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
@@ -137,18 +141,142 @@ void CUpsideDownCarCheck::Init()
}
}
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
{
CVehicle* v = CPools::GetVehiclePool()->GetAt(id);
return v->GetUp().z <= -0.97f &&
v->GetMoveSpeed().Magnitude() < 0.01f &&
v->GetTurnSpeed().Magnitude() < 0.02f;
}
void CUpsideDownCarCheck::UpdateTimers()
{
uint32 timeStep = CTimer::GetTimeStepInMilliseconds();
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex);
if (v){
if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex))
m_sCars[i].m_nUpsideDownTimer += timeStep;
else
m_sCars[i].m_nUpsideDownTimer = 0;
}else{
m_sCars[i].m_nVehicleIndex = -1;
m_sCars[i].m_nUpsideDownTimer = 0;
}
}
}
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > 1000)
return true;
}
return false;
}
void CUpsideDownCarCheck::AddCarToCheck(int32 id)
{
uint16 index = 0;
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
index++;
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
return;
m_sCars[index].m_nVehicleIndex = id;
m_sCars[index].m_nUpsideDownTimer = 0;
}
void CUpsideDownCarCheck::RemoveCarFromCheck(int32 id)
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex == id){
m_sCars[i].m_nVehicleIndex = -1;
m_sCars[i].m_nUpsideDownTimer = 0;
}
}
}
bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex == id)
return m_sCars[i].m_nUpsideDownTimer > 1000;
}
return false;
}
void CStuckCarCheckEntry::Reset()
{
m_nVehicleIndex = -1;
m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);
m_nLastCheck = -1;
m_fRadius = 0.0f;
m_nStuckTime = 0;
m_bStuck = false;
}
void CStuckCarCheck::Init()
{
for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++) {
m_sCars[i].m_nVehicleIndex = -1;
m_sCars[i].m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);
m_sCars[i].m_nStartTime = -1;
m_sCars[i].m_fDistance = 0.0f;
m_sCars[i].m_nStuckTime = 0;
m_sCars[i].m_bStuck = false;
m_sCars[i].Reset();
}
}
void CStuckCarCheck::Process()
{
uint32 timer = CTimer::GetTimeInMilliseconds();
for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex < 0)
continue;
if (timer <= m_sCars[i].m_nStuckTime + m_sCars[i].m_nLastCheck)
continue;
CVehicle* pv = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex);
if (!pv){
m_sCars[i].Reset();
continue;
}
float distance = (pv->GetPosition() - m_sCars[i].m_vecPos).Magnitude();
m_sCars[i].m_bStuck = distance < m_sCars[i].m_fRadius;
m_sCars[i].m_vecPos = pv->GetPosition();
m_sCars[i].m_nLastCheck = timer;
}
}
void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time)
{
CVehicle* pv = CPools::GetVehiclePool()->GetAt(id);
if (!pv)
return;
int index = 0;
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
index++;
/* Would be nice to return if index >= MAX_STUCK_CAR_CHECKS... */
m_sCars[index].m_nVehicleIndex = id;
m_sCars[index].m_vecPos = pv->GetPosition();
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
m_sCars[index].m_fRadius = radius;
m_sCars[index].m_nStuckTime = time;
m_sCars[index].m_bStuck = false;
}
void CStuckCarCheck::RemoveCarFromCheck(int32 id)
{
for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex == id){
m_sCars[i].Reset();
}
}
}
bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id)
{
for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){
if (m_sCars[i].m_nVehicleIndex == id)
return m_sCars[i].m_bStuck;
}
return false;
}
WRAPPER void CTheScripts::CleanUpThisVehicle(CVehicle*) { EAXJMP(0x4548D0); }
WRAPPER void CTheScripts::CleanUpThisPed(CPed*) { EAXJMP(0x4547A0); }
WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); }
@@ -160,4 +288,15 @@ InjectHook(0x437AE0, &CMissionCleanup::Init, PATCH_JUMP);
InjectHook(0x437BA0, &CMissionCleanup::AddEntityToList, PATCH_JUMP);
InjectHook(0x437BD0, &CMissionCleanup::RemoveEntityFromList, PATCH_JUMP);
InjectHook(0x437C10, &CMissionCleanup::Process, PATCH_JUMP);
InjectHook(0x437DC0, &CUpsideDownCarCheck::Init, PATCH_JUMP);
InjectHook(0x437EE0, &CUpsideDownCarCheck::UpdateTimers, PATCH_JUMP);
InjectHook(0x437F80, &CUpsideDownCarCheck::AreAnyCarsUpsideDown, PATCH_JUMP);
InjectHook(0x437FB0, &CUpsideDownCarCheck::AddCarToCheck, PATCH_JUMP);
InjectHook(0x437FE0, &CUpsideDownCarCheck::RemoveCarFromCheck, PATCH_JUMP);
InjectHook(0x438010, &CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile, PATCH_JUMP);
InjectHook(0x438050, &CStuckCarCheck::Init, PATCH_JUMP);
InjectHook(0x4380A0, &CStuckCarCheck::Process, PATCH_JUMP);
InjectHook(0x4381C0, &CStuckCarCheck::AddCarToCheck, PATCH_JUMP);
InjectHook(0x438240, &CStuckCarCheck::RemoveCarFromCheck, PATCH_JUMP);
InjectHook(0x4382A0, &CStuckCarCheck::HasCarBeenStuckForAWhile, PATCH_JUMP);
ENDPATCHES
+14 -2
View File
@@ -101,16 +101,24 @@ class CUpsideDownCarCheck
public:
void Init();
bool IsCarUpsideDown(int32);
void UpdateTimers();
bool AreAnyCarsUpsideDown();
void AddCarToCheck(int32);
void RemoveCarFromCheck(int32);
bool HasCarBeenUpsideDownForAWhile(int32);
};
struct CStuckCarCheckEntry
{
int32 m_nVehicleIndex;
CVector m_vecPos;
int32 m_nStartTime;
float m_fDistance;
int32 m_nLastCheck;
float m_fRadius;
uint32 m_nStuckTime;
bool m_bStuck;
inline void Reset();
};
class CStuckCarCheck
@@ -119,6 +127,10 @@ class CStuckCarCheck
public:
void Init();
void Process();
void AddCarToCheck(int32, float, uint32);
void RemoveCarFromCheck(int32);
bool HasCarBeenStuckForAWhile(int32);
};
class CTheScripts
+1 -1
View File
@@ -8,7 +8,7 @@
#include "PlayerPed.h"
#include "Pad.h"
#include "General.h"
#include "CullZones.h"
#include "ZoneCull.h"
#include "SurfaceTable.h"
#include "MBlur.h"
#include "Camera.h"
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -5,7 +5,7 @@
#include "Game.h"
#include "Zones.h"
#include "General.h"
#include "CullZones.h"
#include "ZoneCull.h"
#include "World.h"
#include "Entity.h"
#include "Train.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,7 @@
#include "DummyObject.h"
#include "World.h"
#include "Zones.h"
#include "CullZones.h"
#include "ZoneCull.h"
#include "CdStream.h"
#include "FileLoader.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+64 -64
View File
@@ -288,80 +288,80 @@ public:
static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize);
// mouse
inline bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
// keyboard
inline bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }
inline bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); }
inline bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); }
inline bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); }
inline bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); }
inline bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); }
inline bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); }
inline bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); }
inline bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); }
inline bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); }
inline bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); }
inline bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); }
inline bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); }
inline bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); }
inline bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
inline bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
inline bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
inline bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
inline bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
inline bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
inline bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
inline bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); }
inline bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); }
inline bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); }
inline bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); }
inline bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); }
inline bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); }
inline bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); }
inline bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); }
inline bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
inline bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
inline bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
inline bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
inline bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
inline bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
inline bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
inline bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); }
inline bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); }
inline bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); }
inline bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); }
inline bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
inline bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
inline bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }
bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); }
bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); }
bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); }
bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); }
bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); }
bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); }
bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); }
bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); }
bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); }
bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); }
bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); }
bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); }
bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); }
bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); }
bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); }
bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); }
bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); }
bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); }
bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); }
bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); }
bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); }
bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); }
bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); }
bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); }
bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); }
bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
// pad
inline bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
inline bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); }
inline bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); }
inline bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); }
inline bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); }
inline bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); }
inline bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); }
inline bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); }
inline bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); }
inline bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
inline bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
inline bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); }
bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); }
bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); }
bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); }
bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); }
bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); }
bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); }
bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); }
bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
inline int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
inline int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
inline int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
inline int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
};
VALIDATE_SIZE(CPad, 0xFC);
#define IsButtonJustDown(pad, btn) \
(!(pad)->OldState.btn && (pad)->NewState.btn)
void LittleTest(void);
void LittleTest(void);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -16,7 +16,7 @@
#include "FileMgr.h"
#include "FileLoader.h"
#include "Zones.h"
#include "CullZones.h"
#include "ZoneCull.h"
#include "Radar.h"
#include "Camera.h"
#include "Record.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+11 -8
View File
@@ -14,21 +14,24 @@ class CTimer
static bool &m_CodePause;
public:
static float GetTimeStep(void) { return ms_fTimeStep; }
static inline void SetTimeStep(float ts) { ms_fTimeStep = ts; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; }
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
static float GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
static inline void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
static uint32 GetFrameCounter(void) { return m_FrameCounter; }
static inline void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; }
static inline void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; }
static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; }
static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; }
static inline void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; }
static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; }
static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; }
static inline void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; }
static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; }
static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; }
static inline void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; }
static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; }
static float GetTimeScale(void) { return ms_fTimeScale; }
static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; }
static void SetTimeScale(float ts) { ms_fTimeScale = ts; }
static bool GetIsPaused() { return m_UserPause || m_CodePause; }
static bool GetIsUserPaused() { return m_UserPause; }
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -8,7 +8,7 @@
#include "Camera.h"
#include "World.h"
#include "FileMgr.h"
#include "CullZones.h"
#include "ZoneCull.h"
int32 &CCullZones::NumCullZones = *(int*)0x8F2564;
CCullZone *CCullZones::aZones = (CCullZone*)0x864750; // [NUMCULLZONES];
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -40,7 +40,7 @@
#include "CutsceneMgr.h"
#include "Lights.h"
#include "Credits.h"
#include "CullZones.h"
#include "ZoneCull.h"
#include "Timecycle.h"
#include "TxdStore.h"
#include "FileMgr.h"
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
+53 -12
View File
@@ -304,6 +304,22 @@ CPhysical::RemoveRefsToEntity(CEntity *ent)
}
}
void
CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos)
{
CVector worldPos = other->GetMatrix() * localPos;
float step = 0.9f * CTimer::GetTimeStep();
CVector pos = other->m_vecMoveSpeed*step + worldPos;
CWorld::Remove(phys);
phys->GetMatrix() = other->GetMatrix();
phys->GetPosition() = pos;
phys->m_vecMoveSpeed = other->m_vecMoveSpeed;
phys->GetMatrix().UpdateRW();
phys->UpdateRwFrame();
CWorld::Add(phys);
}
int32
CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
{
@@ -346,7 +362,7 @@ CPhysical::ProcessControl(void)
IsPed() && !bPedPhysics){
m_vecMoveSpeedAvg = (m_vecMoveSpeedAvg + m_vecMoveSpeed)/2.0f;
m_vecTurnSpeedAvg = (m_vecTurnSpeedAvg + m_vecTurnSpeed)/2.0f;
float step = CTimer::GetTimeStep() * 0.003;
float step = CTimer::GetTimeStep() * 0.003f;
if(m_vecMoveSpeedAvg.MagnitudeSqr() < step*step &&
m_vecTurnSpeedAvg.MagnitudeSqr() < step*step){
m_nStaticFrames++;
@@ -434,15 +450,38 @@ CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
}
void
CPhysical::ApplySpringCollision(float f1, CVector &v, CVector &p, float f2, float f3)
bool
CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias)
{
if(1.0f - f2 <= 0.0f)
return;
float compression = 1.0f - springRatio;
if(compression > 0.0f){
float step = min(CTimer::GetTimeStep(), 3.0f);
float impulse = -0.008f*m_fMass*step * springConst * compression * bias*2.0f;
ApplyMoveForce(springDir*impulse);
ApplyTurnForce(springDir*impulse, point);
}
return true;
}
// What exactly is speed?
bool
CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed)
{
float speedA = DotProduct(speed, springDir);
float speedB = DotProduct(GetSpeed(point), springDir);
float step = min(CTimer::GetTimeStep(), 3.0f);
float strength = -0.008f*m_fMass*2.0f*step * f1 * (1.0f-f2) * f3;
ApplyMoveForce(v*strength);
ApplyTurnForce(v*strength, p);
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
// what is this?
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
a = min(a, 1.0f);
float b = fabs(impulse / (speedB * m_fMass));
if(a < b)
impulse *= a/b;
ApplyMoveForce(springDir*impulse);
ApplyTurnForce(springDir*impulse, point);
return true;
}
void
@@ -1858,10 +1897,10 @@ CPhysical::ProcessCollision(void)
CVehicle *veh = (CVehicle*)this;
if(veh->m_vehType == VEHICLE_TYPE_CAR){
CAutomobile *car = (CAutomobile*)this;
car->m_aWheelDist[0] = 1.0f;
car->m_aWheelDist[1] = 1.0f;
car->m_aWheelDist[2] = 1.0f;
car->m_aWheelDist[3] = 1.0f;
car->m_aSuspensionSpringRatio[0] = 1.0f;
car->m_aSuspensionSpringRatio[1] = 1.0f;
car->m_aSuspensionSpringRatio[2] = 1.0f;
car->m_aSuspensionSpringRatio[3] = 1.0f;
}else if(veh->m_vehType == VEHICLE_TYPE_BIKE){
assert(0 && "TODO - but unused");
}
@@ -1909,6 +1948,7 @@ STARTPATCHES
InjectHook(0x4970C0, &CPhysical::AddCollisionRecord_Treadable, PATCH_JUMP);
InjectHook(0x497240, &CPhysical::GetHasCollidedWith, PATCH_JUMP);
InjectHook(0x49F820, &CPhysical::RemoveRefsToEntity, PATCH_JUMP);
InjectHook(0x49F890, &CPhysical::PlacePhysicalRelativeToOtherPhysical, PATCH_JUMP);
#define F3 float, float, float
InjectHook(0x495B10, &CPhysical::ApplyMoveSpeed, PATCH_JUMP);
@@ -1918,6 +1958,7 @@ STARTPATCHES
InjectHook(0x495D90, (void (CPhysical::*)(F3))&CPhysical::ApplyFrictionMoveForce, PATCH_JUMP);
InjectHook(0x495E10, (void (CPhysical::*)(F3, F3))&CPhysical::ApplyFrictionTurnForce, PATCH_JUMP);
InjectHook(0x499890, &CPhysical::ApplySpringCollision, PATCH_JUMP);
InjectHook(0x499990, &CPhysical::ApplySpringDampening, PATCH_JUMP);
InjectHook(0x495B50, &CPhysical::ApplyGravity, PATCH_JUMP);
InjectHook(0x495B80, (void (CPhysical::*)(void))&CPhysical::ApplyFriction, PATCH_JUMP);
InjectHook(0x495C20, &CPhysical::ApplyAirResistance, PATCH_JUMP);
+7 -1
View File
@@ -81,6 +81,7 @@ public:
void AddCollisionRecord_Treadable(CEntity *ent);
bool GetHasCollidedWith(CEntity *ent);
void RemoveRefsToEntity(CEntity *ent);
static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos);
float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); }
// get speed of point p relative to entity center
@@ -104,6 +105,9 @@ public:
bIsInSafePosition = false;
}
const CVector &GetMoveSpeed() { return m_vecMoveSpeed; }
const CVector &GetTurnSpeed() { return m_vecTurnSpeed; }
void ApplyMoveSpeed(void);
void ApplyTurnSpeed(void);
// Force actually means Impulse here
@@ -117,7 +121,9 @@ public:
void ApplyFrictionMoveForce(const CVector &j) { ApplyFrictionMoveForce(j.x, j.y, j.z); }
void ApplyFrictionTurnForce(float jx, float jy, float jz, float rx, float ry, float rz);
void ApplyFrictionTurnForce(const CVector &j, const CVector &p) { ApplyFrictionTurnForce(j.x, j.y, j.z, p.x, p.y, p.z); }
void ApplySpringCollision(float f1, CVector &v, CVector &p, float f2, float f3);
// springRatio: 1.0 fully extended, 0.0 fully compressed
bool ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias);
bool ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed);
void ApplyGravity(void);
void ApplyFriction(void);
void ApplyAirResistance(void);
+5 -5
View File
@@ -38,35 +38,35 @@ public:
x = 1.0f;
}
inline const CVector &operator+=(CVector const &right) {
const CVector &operator+=(CVector const &right) {
x += right.x;
y += right.y;
z += right.z;
return *this;
}
inline const CVector &operator-=(CVector const &right) {
const CVector &operator-=(CVector const &right) {
x -= right.x;
y -= right.y;
z -= right.z;
return *this;
}
inline const CVector &operator*=(float right) {
const CVector &operator*=(float right) {
x *= right;
y *= right;
z *= right;
return *this;
}
inline const CVector &operator/=(float right) {
const CVector &operator/=(float right) {
x /= right;
y /= right;
z /= right;
return *this;
}
inline CVector operator-() const {
CVector operator-() const {
return CVector(-x, -y, -z);
}
File renamed without changes.
Loaded 100 of 159 files, more files were not shown because too many files have changed in this diff. Show more