miscellaneous, mostly world related
This commit is contained in:
parent
f2d1ceb043
commit
b2f8c7eb23
@ -5,6 +5,7 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "CullZones.h"
|
#include "CullZones.h"
|
||||||
|
@ -49,7 +49,7 @@ void
|
|||||||
CCollision::Update(void)
|
CCollision::Update(void)
|
||||||
{
|
{
|
||||||
CVector playerCoors;
|
CVector playerCoors;
|
||||||
FindPlayerCoors(playerCoors);
|
playerCoors = FindPlayerCoors();
|
||||||
eLevelName level = CTheZones::m_CurrLevel;
|
eLevelName level = CTheZones::m_CurrLevel;
|
||||||
bool forceLevelChange = false;
|
bool forceLevelChange = false;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
|||||||
|
|
||||||
level = LEVEL_NONE;
|
level = LEVEL_NONE;
|
||||||
|
|
||||||
FindPlayerCoors(playerCoors);
|
playerCoors = FindPlayerCoors();
|
||||||
sx = CWorld::GetSectorIndexX(playerCoors.x);
|
sx = CWorld::GetSectorIndexX(playerCoors.x);
|
||||||
sy = CWorld::GetSectorIndexY(playerCoors.y);
|
sy = CWorld::GetSectorIndexY(playerCoors.y);
|
||||||
multipleLevels = false;
|
multipleLevels = false;
|
||||||
|
@ -72,7 +72,6 @@ void
|
|||||||
CCullZones::Update(void)
|
CCullZones::Update(void)
|
||||||
{
|
{
|
||||||
bool invisible;
|
bool invisible;
|
||||||
CVector v;
|
|
||||||
|
|
||||||
if(bCullZonesDisabled)
|
if(bCullZonesDisabled)
|
||||||
return;
|
return;
|
||||||
@ -96,7 +95,7 @@ CCullZones::Update(void)
|
|||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
/* Update player attributes */
|
/* Update player attributes */
|
||||||
CurrentFlags_Player = FindAttributesForCoors(FindPlayerCoors(v),
|
CurrentFlags_Player = FindAttributesForCoors(FindPlayerCoors(),
|
||||||
&CurrentWantedLevelDrop_Player);
|
&CurrentWantedLevelDrop_Player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -153,7 +152,7 @@ CCullZones::FindZoneWithStairsAttributeForPlayer(void)
|
|||||||
int i;
|
int i;
|
||||||
CVector coors;
|
CVector coors;
|
||||||
|
|
||||||
FindPlayerCoors(coors);
|
coors = FindPlayerCoors();
|
||||||
for(i = 0; i < NumAttributeZones; i++)
|
for(i = 0; i < NumAttributeZones; i++)
|
||||||
if(aAttributeZones[i].attributes & ATTRZONE_STAIRS &&
|
if(aAttributeZones[i].attributes & ATTRZONE_STAIRS &&
|
||||||
coors.x >= aAttributeZones[i].minx && coors.x <= aAttributeZones[i].maxx &&
|
coors.x >= aAttributeZones[i].minx && coors.x <= aAttributeZones[i].maxx &&
|
||||||
|
@ -279,7 +279,7 @@ void CRadar::DrawBlips()
|
|||||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1)
|
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1)
|
||||||
angle = PI + FindPlayerHeading();
|
angle = PI + FindPlayerHeading();
|
||||||
else
|
else
|
||||||
angle = FindPlayerHeading() - (PI + atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
|
||||||
|
|
||||||
DrawRotatingRadarSprite(CentreSprite, out.x, out.y, angle, 255);
|
DrawRotatingRadarSprite(CentreSprite, out.x, out.y, angle, 255);
|
||||||
|
|
||||||
@ -868,8 +868,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
|||||||
{
|
{
|
||||||
float s, c;
|
float s, c;
|
||||||
|
|
||||||
s = -sin(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
s = -sin(TheCamera.GetForward().Heading());
|
||||||
c = cos(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
c = cos(TheCamera.GetForward().Heading());
|
||||||
|
|
||||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) {
|
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) {
|
||||||
s = 0.0f;
|
s = 0.0f;
|
||||||
@ -885,8 +885,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
|||||||
else
|
else
|
||||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
||||||
|
|
||||||
s = -sin(atan2(-forward.x, forward.y));
|
s = -sin(forward.Heading());
|
||||||
c = cos(atan2(-forward.x, forward.y));
|
c = cos(forward.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
out.x = s * in.y + c * in.x;
|
out.x = s * in.y + c * in.x;
|
||||||
@ -915,8 +915,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
|||||||
c = 1.0f;
|
c = 1.0f;
|
||||||
}
|
}
|
||||||
else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
|
else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
|
||||||
s = sin(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
s = sin(TheCamera.GetForward().Heading());
|
||||||
c = cos(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
c = cos(TheCamera.GetForward().Heading());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CVector forward;
|
CVector forward;
|
||||||
@ -928,8 +928,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
|||||||
else
|
else
|
||||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
||||||
|
|
||||||
s = sin(atan2(-forward.x, forward.y));
|
s = sin(forward.Heading());
|
||||||
c = cos(atan2(-forward.x, forward.y));
|
c = cos(forward.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_RadarRange);
|
float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_RadarRange);
|
||||||
|
@ -250,7 +250,6 @@ void
|
|||||||
CStreaming::Update(void)
|
CStreaming::Update(void)
|
||||||
{
|
{
|
||||||
CEntity *train;
|
CEntity *train;
|
||||||
CVector playerPos;
|
|
||||||
CStreamingInfo *si, *prev;
|
CStreamingInfo *si, *prev;
|
||||||
bool requestedSubway = false;
|
bool requestedSubway = false;
|
||||||
|
|
||||||
@ -280,8 +279,7 @@ CStreaming::Update(void)
|
|||||||
ms_numModelsRequested < 5 &&
|
ms_numModelsRequested < 5 &&
|
||||||
!CRenderer::m_loadingPriority){
|
!CRenderer::m_loadingPriority){
|
||||||
StreamVehiclesAndPeds();
|
StreamVehiclesAndPeds();
|
||||||
FindPlayerCoors(playerPos);
|
StreamZoneModels(FindPlayerCoors());
|
||||||
StreamZoneModels(playerPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequestedModels();
|
LoadRequestedModels();
|
||||||
|
141
src/World.cpp
141
src/World.cpp
@ -2,13 +2,16 @@
|
|||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "DMAudio.h"
|
||||||
|
#include "CarCtrl.h"
|
||||||
#include "Garages.h"
|
#include "Garages.h"
|
||||||
#include "TempColModels.h"
|
#include "TempColModels.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
WRAPPER void CWorld::Add(CEntity *entity) { EAXJMP(0x4AE930); }
|
|
||||||
|
|
||||||
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
|
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
|
||||||
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
|
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
|
||||||
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
|
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
|
||||||
@ -23,6 +26,41 @@ bool &CWorld::bSecondShift = *(bool*)0x95CD54;
|
|||||||
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
|
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
|
||||||
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
|
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
|
||||||
|
|
||||||
|
void
|
||||||
|
CWorld::Add(CEntity *ent)
|
||||||
|
{
|
||||||
|
if(ent->IsVehicle() || ent->IsPed())
|
||||||
|
DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, true);
|
||||||
|
|
||||||
|
if(ent->bIsBIGBuilding)
|
||||||
|
ms_bigBuildingsList[ent->m_level].InsertItem(ent);
|
||||||
|
else
|
||||||
|
ent->Add();
|
||||||
|
|
||||||
|
if(ent->IsBuilding() || ent->IsDummy())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!ent->bIsStatic)
|
||||||
|
((CPhysical*)ent)->AddToMovingList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CWorld::Remove(CEntity *ent)
|
||||||
|
{
|
||||||
|
if(ent->IsVehicle() || ent->IsPed())
|
||||||
|
DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, false);
|
||||||
|
|
||||||
|
if(ent->bIsBIGBuilding)
|
||||||
|
ms_bigBuildingsList[ent->m_level].RemoveItem(ent);
|
||||||
|
else
|
||||||
|
ent->Remove();
|
||||||
|
|
||||||
|
if(ent->IsBuilding() || ent->IsDummy())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!ent->bIsStatic)
|
||||||
|
((CPhysical*)ent)->RemoveFromMovingList();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CWorld::ClearScanCodes(void)
|
CWorld::ClearScanCodes(void)
|
||||||
@ -571,7 +609,98 @@ CWorld::FindRoofZFor3DCoord(float x, float y, float z, bool *found)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPlayerPed*
|
||||||
|
FindPlayerPed(void)
|
||||||
|
{
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle*
|
||||||
|
FindPlayerVehicle(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||||
|
return ped->m_pMyVehicle;
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVehicle*
|
||||||
|
FindPlayerTrain(void)
|
||||||
|
{
|
||||||
|
if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
|
||||||
|
return FindPlayerVehicle();
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEntity*
|
||||||
|
FindPlayerEntity(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||||
|
return ped->m_pMyVehicle;
|
||||||
|
else
|
||||||
|
return ped;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector
|
||||||
|
FindPlayerCoors(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||||
|
return ped->m_pMyVehicle->GetPosition();
|
||||||
|
else
|
||||||
|
return ped->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector&
|
||||||
|
FindPlayerSpeed(void)
|
||||||
|
{
|
||||||
|
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||||
|
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||||
|
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
||||||
|
else
|
||||||
|
return ped->m_vecMoveSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector&
|
||||||
|
FindPlayerCentreOfWorld(int32 player)
|
||||||
|
{
|
||||||
|
if(CCarCtrl::bCarsGeneratedAroundCamera)
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
if(CWorld::Players[player].m_pRemoteVehicle)
|
||||||
|
return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
|
||||||
|
if(FindPlayerVehicle())
|
||||||
|
return FindPlayerVehicle()->GetPosition();
|
||||||
|
return CWorld::Players[player].m_pPed->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector&
|
||||||
|
FindPlayerCentreOfWorld_NoSniperShift(void)
|
||||||
|
{
|
||||||
|
if(CCarCtrl::bCarsGeneratedAroundCamera)
|
||||||
|
return TheCamera.GetPosition();
|
||||||
|
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
||||||
|
if(FindPlayerVehicle())
|
||||||
|
return FindPlayerVehicle()->GetPosition();
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
FindPlayerHeading(void)
|
||||||
|
{
|
||||||
|
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
|
||||||
|
if(FindPlayerVehicle())
|
||||||
|
return FindPlayerVehicle()->GetForward().Heading();
|
||||||
|
return CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetForward().Heading();
|
||||||
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP);
|
||||||
|
InjectHook(0x4AE9D0, CWorld::Remove, PATCH_JUMP);
|
||||||
InjectHook(0x4B1F60, CWorld::ClearScanCodes, PATCH_JUMP);
|
InjectHook(0x4B1F60, CWorld::ClearScanCodes, PATCH_JUMP);
|
||||||
InjectHook(0x4AF970, CWorld::ProcessLineOfSight, PATCH_JUMP);
|
InjectHook(0x4AF970, CWorld::ProcessLineOfSight, PATCH_JUMP);
|
||||||
InjectHook(0x4B0A80, CWorld::ProcessLineOfSightSector, PATCH_JUMP);
|
InjectHook(0x4B0A80, CWorld::ProcessLineOfSightSector, PATCH_JUMP);
|
||||||
@ -587,11 +716,3 @@ STARTPATCHES
|
|||||||
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
|
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
|
||||||
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
|
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
|
||||||
ENDPATCHES
|
ENDPATCHES
|
||||||
|
|
||||||
WRAPPER CPlayerPed *FindPlayerPed(void) { EAXJMP(0x4A1150); }
|
|
||||||
WRAPPER CVector &FindPlayerCoors(CVector &v) { EAXJMP(0x4A1030); }
|
|
||||||
WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); }
|
|
||||||
WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); }
|
|
||||||
WRAPPER CVector &FindPlayerSpeed(void) { EAXJMP(0x4A1090); }
|
|
||||||
WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); }
|
|
||||||
WRAPPER float FindPlayerHeading(void) { EAXJMP(0x4A1220); }
|
|
||||||
|
@ -68,6 +68,7 @@ public:
|
|||||||
static bool &bProcessCutsceneOnly;
|
static bool &bProcessCutsceneOnly;
|
||||||
|
|
||||||
static void Add(CEntity *entity);
|
static void Add(CEntity *entity);
|
||||||
|
static void Remove(CEntity *ent);
|
||||||
|
|
||||||
static CSector *GetSector(int x, int y) { return &ms_aSectors[y][x]; }
|
static CSector *GetSector(int x, int y) { return &ms_aSectors[y][x]; }
|
||||||
static CPtrList &GetBigBuildingList(eLevelName i) { return ms_bigBuildingsList[i]; }
|
static CPtrList &GetBigBuildingList(eLevelName i) { return ms_bigBuildingsList[i]; }
|
||||||
@ -108,9 +109,11 @@ public:
|
|||||||
class CPlayerPed;
|
class CPlayerPed;
|
||||||
class CVehicle;
|
class CVehicle;
|
||||||
CPlayerPed *FindPlayerPed(void);
|
CPlayerPed *FindPlayerPed(void);
|
||||||
CVector &FindPlayerCoors(CVector &v);
|
|
||||||
CVehicle *FindPlayerVehicle(void);
|
CVehicle *FindPlayerVehicle(void);
|
||||||
CVehicle *FindPlayerTrain(void);
|
CVehicle *FindPlayerTrain(void);
|
||||||
|
CEntity *FindPlayerEntity(void);
|
||||||
|
CVector FindPlayerCoors(void);
|
||||||
CVector &FindPlayerSpeed(void);
|
CVector &FindPlayerSpeed(void);
|
||||||
CVector FindPlayerCentreOfWorld_NoSniperShift(void);
|
CVector &FindPlayerCentreOfWorld(int32 player);
|
||||||
|
CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
|
||||||
float FindPlayerHeading(void);
|
float FindPlayerHeading(void);
|
||||||
|
@ -114,7 +114,7 @@ void
|
|||||||
CTheZones::Update(void)
|
CTheZones::Update(void)
|
||||||
{
|
{
|
||||||
CVector pos;
|
CVector pos;
|
||||||
FindPlayerCoors(pos);
|
pos = FindPlayerCoors();
|
||||||
m_pPlayersZone = FindSmallestZonePosition(&pos);
|
m_pPlayersZone = FindSmallestZonePosition(&pos);
|
||||||
m_CurrLevel = GetLevelFromPosition(pos);
|
m_CurrLevel = GetLevelFromPosition(pos);
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,5 @@ WRAPPER uint8 cDMAudio::IsMP3RadioChannelAvailable() { EAXJMP(0x57C9F0); }
|
|||||||
WRAPPER void cDMAudio::SetEffectsFadeVol(uint8) { EAXJMP(0x57C8F0); }
|
WRAPPER void cDMAudio::SetEffectsFadeVol(uint8) { EAXJMP(0x57C8F0); }
|
||||||
WRAPPER void cDMAudio::SetMusicFadeVol(uint8) { EAXJMP(0x57C920); }
|
WRAPPER void cDMAudio::SetMusicFadeVol(uint8) { EAXJMP(0x57C920); }
|
||||||
WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
|
WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
|
||||||
WRAPPER void cDMAudio::SetEntityStatus(int32, int8) { EAXJMP(0x57C810); }
|
WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); }
|
||||||
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
|
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
|
||||||
|
@ -193,7 +193,7 @@ public:
|
|||||||
void SetEffectsFadeVol(uint8);
|
void SetEffectsFadeVol(uint8);
|
||||||
void SetMusicFadeVol(uint8);
|
void SetMusicFadeVol(uint8);
|
||||||
int32 CreateEntity(int, void*);
|
int32 CreateEntity(int, void*);
|
||||||
void SetEntityStatus(int32, int8);
|
void SetEntityStatus(int32 id, uint8 enable);
|
||||||
void SetRadioInCar(int32);
|
void SetRadioInCar(int32);
|
||||||
uint8 IsMP3RadioChannelAvailable();
|
uint8 IsMP3RadioChannelAvailable();
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
|
|
||||||
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
|
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
|
||||||
|
bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
|
||||||
|
|
||||||
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
|
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
|
||||||
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
|
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
|
||||||
|
@ -11,4 +11,5 @@ public:
|
|||||||
static int32 ChooseCarModel(int32 vehclass);
|
static int32 ChooseCarModel(int32 vehclass);
|
||||||
|
|
||||||
static int32 &NumLawEnforcerCars;
|
static int32 &NumLawEnforcerCars;
|
||||||
|
static bool &bCarsGeneratedAroundCamera;
|
||||||
};
|
};
|
||||||
|
@ -214,7 +214,7 @@ void CReplay::RecordThisFrame(void)
|
|||||||
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
general->type = REPLAYPACKET_GENERAL;
|
general->type = REPLAYPACKET_GENERAL;
|
||||||
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix());
|
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix());
|
||||||
FindPlayerCoors(general->player_pos);
|
general->player_pos = FindPlayerCoors();
|
||||||
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
|
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
|
||||||
Record.m_nOffset += sizeof(*general);
|
Record.m_nOffset += sizeof(*general);
|
||||||
tClockPacket* clock = (tClockPacket*)&Record.m_pBase[Record.m_nOffset];
|
tClockPacket* clock = (tClockPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
@ -603,8 +603,8 @@ void CReplay::RestoreStuffFromMem(void)
|
|||||||
ped->m_modelIndex = -1;
|
ped->m_modelIndex = -1;
|
||||||
ped->SetModelIndex(mi);
|
ped->SetModelIndex(mi);
|
||||||
ped->m_pVehicleAnim = 0;
|
ped->m_pVehicleAnim = 0;
|
||||||
ped->uAudioEntityId = DMAudio.CreateEntity(0, ped);
|
ped->m_audioEntityId = DMAudio.CreateEntity(0, ped);
|
||||||
DMAudio.SetEntityStatus(ped->uAudioEntityId, 1);
|
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
|
||||||
CPopulation::UpdatePedCount(ped->m_nPedType, false);
|
CPopulation::UpdatePedCount(ped->m_nPedType, false);
|
||||||
if (ped->m_wepModelID >= 0)
|
if (ped->m_wepModelID >= 0)
|
||||||
ped->AddWeaponModel(ped->m_wepModelID);
|
ped->AddWeaponModel(ped->m_wepModelID);
|
||||||
@ -641,8 +641,8 @@ void CReplay::RestoreStuffFromMem(void)
|
|||||||
car->SetDoorDamage(16, 4, true); /* DOOR_BACK_LEFT */
|
car->SetDoorDamage(16, 4, true); /* DOOR_BACK_LEFT */
|
||||||
car->SetDoorDamage(12, 5, true); /* DOOR_BACK_RIGHT */
|
car->SetDoorDamage(12, 5, true); /* DOOR_BACK_RIGHT */
|
||||||
}
|
}
|
||||||
vehicle->uAudioEntityId = DMAudio.CreateEntity(0, vehicle);
|
vehicle->m_audioEntityId = DMAudio.CreateEntity(0, vehicle);
|
||||||
DMAudio.SetEntityStatus(vehicle->uAudioEntityId, 1);
|
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true);
|
||||||
CCarCtrl::UpdateCarCount(vehicle, false);
|
CCarCtrl::UpdateCarCount(vehicle, false);
|
||||||
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
||||||
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
||||||
|
@ -1,7 +1,57 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Dummy.h"
|
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
#include "World.h"
|
||||||
|
#include "Dummy.h"
|
||||||
|
|
||||||
void *CDummy::operator new(size_t sz) { return CPools::GetDummyPool()->New(); }
|
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::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
|
||||||
|
@ -9,9 +9,14 @@ public:
|
|||||||
CEntryInfoList m_entryInfoList;
|
CEntryInfoList m_entryInfoList;
|
||||||
|
|
||||||
CDummy(void) { m_type = ENTITY_TYPE_DUMMY; }
|
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 new(size_t);
|
||||||
static void operator delete(void*, 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");
|
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
|
||||||
|
@ -771,9 +771,9 @@ CPed::Attack(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (weaponAnimAssoc->animId == ANIM_WEAPON_BAT_V || weaponAnimAssoc->animId == ANIM_WEAPON_BAT_H) {
|
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) {
|
} 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;
|
weaponAnimAssoc->speed = 0.5f;
|
||||||
@ -843,13 +843,13 @@ CPed::Attack(void)
|
|||||||
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep <= ourWeapon->m_fAnimLoopEnd) {
|
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep <= ourWeapon->m_fAnimLoopEnd) {
|
||||||
switch (ourWeaponType) {
|
switch (ourWeaponType) {
|
||||||
case WEAPONTYPE_UZI:
|
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;
|
break;
|
||||||
case WEAPONTYPE_AK47:
|
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;
|
break;
|
||||||
case WEAPONTYPE_M16:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1281,19 +1281,19 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
|
|
||||||
if (m_vehEnterType == VEHICLE_ENTER_FRONT_RIGHT || m_vehEnterType == VEHICLE_ENTER_REAR_RIGHT) {
|
if (m_vehEnterType == VEHICLE_ENTER_FRONT_RIGHT || m_vehEnterType == VEHICLE_ENTER_REAR_RIGHT) {
|
||||||
if (vehIsUpsideDown) {
|
if (vehIsUpsideDown) {
|
||||||
m_fRotationDest = -PI + atan2(-veh->GetForward().x, veh->GetForward().y);
|
m_fRotationDest = -PI + veh->GetForward().Heading();
|
||||||
} else if (veh->bIsBus) {
|
} 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 {
|
} else {
|
||||||
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
|
m_fRotationDest = GetForward().Heading();
|
||||||
}
|
}
|
||||||
} else if (m_vehEnterType == VEHICLE_ENTER_FRONT_LEFT || m_vehEnterType == VEHICLE_ENTER_REAR_LEFT) {
|
} else if (m_vehEnterType == VEHICLE_ENTER_FRONT_LEFT || m_vehEnterType == VEHICLE_ENTER_REAR_LEFT) {
|
||||||
if (vehIsUpsideDown) {
|
if (vehIsUpsideDown) {
|
||||||
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
|
m_fRotationDest = veh->GetForward().Heading();
|
||||||
} else if (veh->bIsBus) {
|
} 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 {
|
} else {
|
||||||
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
|
m_fRotationDest = veh->GetForward().Heading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1539,7 +1539,7 @@ CPed::PlayFootSteps(void)
|
|||||||
stepPart = 2;
|
stepPart = 2;
|
||||||
|
|
||||||
if (stepPart != 0) {
|
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);
|
CVector footPos(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
for (RwFrame *frame = GetNodeFrame(stepPart == 1 ? PED_FOOTL : PED_FOOTR); frame; frame = RwFrameGetParent(frame))
|
for (RwFrame *frame = GetNodeFrame(stepPart == 1 ? PED_FOOTL : PED_FOOTR); frame; frame = RwFrameGetParent(frame))
|
||||||
|
@ -42,7 +42,7 @@ CPhysical::CPhysical(void)
|
|||||||
m_vecDamageNormal = CVector(0.0f, 0.0f, 0.0f);
|
m_vecDamageNormal = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
bUsesCollision = true;
|
bUsesCollision = true;
|
||||||
uAudioEntityId = -5;
|
m_audioEntityId = -5;
|
||||||
unk1 = 100.0f;
|
unk1 = 100.0f;
|
||||||
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
|
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
|
||||||
field_EC = 0;
|
field_EC = 0;
|
||||||
|
@ -14,7 +14,7 @@ class CPhysical : public CEntity
|
|||||||
public:
|
public:
|
||||||
// The not properly indented fields haven't been checked properly yet
|
// The not properly indented fields haven't been checked properly yet
|
||||||
|
|
||||||
int uAudioEntityId;
|
int32 m_audioEntityId;
|
||||||
float unk1;
|
float unk1;
|
||||||
CTreadable *m_carTreadable;
|
CTreadable *m_carTreadable;
|
||||||
CTreadable *m_pedTreadable;
|
CTreadable *m_pedTreadable;
|
||||||
@ -58,9 +58,8 @@ public:
|
|||||||
uint8 bHitByTrain : 1; // from nick
|
uint8 bHitByTrain : 1; // from nick
|
||||||
uint8 m_phy_flagA80 : 1;
|
uint8 m_phy_flagA80 : 1;
|
||||||
|
|
||||||
uint8 m_nLastCollType;
|
uint8 m_nLastCollType;
|
||||||
uint8 m_nZoneLevel;
|
uint8 m_nZoneLevel;
|
||||||
uint8 pad[3];
|
|
||||||
|
|
||||||
CPhysical(void);
|
CPhysical(void);
|
||||||
~CPhysical(void);
|
~CPhysical(void);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Automobile.h"
|
|
||||||
#include "PlayerPed.h"
|
#include "Collision.h"
|
||||||
|
|
||||||
enum eWastedBustedState
|
enum eWastedBustedState
|
||||||
{
|
{
|
||||||
@ -10,10 +10,9 @@ enum eWastedBustedState
|
|||||||
WBSTATE_FAILED_CRITICAL_MISSION,
|
WBSTATE_FAILED_CRITICAL_MISSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CCivilianPed
|
class CVehicle;
|
||||||
{
|
class CPlayerPed;
|
||||||
|
class CCivilianPed;
|
||||||
};
|
|
||||||
|
|
||||||
class CPlayerInfo
|
class CPlayerInfo
|
||||||
{
|
{
|
||||||
@ -22,10 +21,7 @@ public:
|
|||||||
CVehicle *m_pRemoteVehicle;
|
CVehicle *m_pRemoteVehicle;
|
||||||
CColModel m_ColModel;
|
CColModel m_ColModel;
|
||||||
CVehicle *m_pVehicleEx;
|
CVehicle *m_pVehicleEx;
|
||||||
char m_aszPlayerName[70];
|
char m_aPlayerName[70];
|
||||||
private:
|
|
||||||
int8 _pad0[2];
|
|
||||||
public:
|
|
||||||
int32 m_nMoney;
|
int32 m_nMoney;
|
||||||
int32 m_nVisibleMoney;
|
int32 m_nVisibleMoney;
|
||||||
int32 m_nCollectedPackages;
|
int32 m_nCollectedPackages;
|
||||||
@ -40,7 +36,7 @@ public:
|
|||||||
int32 m_nNextSexMoneyUpdateTime;
|
int32 m_nNextSexMoneyUpdateTime;
|
||||||
int32 m_nSexFrequency;
|
int32 m_nSexFrequency;
|
||||||
CCivilianPed *m_pHooker;
|
CCivilianPed *m_pHooker;
|
||||||
int8 m_bWBState; // eWastedBustedState
|
int8 m_WBState; // eWastedBustedState
|
||||||
int8 field_217;
|
int8 field_217;
|
||||||
int8 field_218;
|
int8 field_218;
|
||||||
int8 field_219;
|
int8 field_219;
|
||||||
@ -71,4 +67,4 @@ public:
|
|||||||
RwTexture *m_pSkinTexture;
|
RwTexture *m_pSkinTexture;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerPed: error");
|
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
|
||||||
|
@ -22,6 +22,7 @@ public:
|
|||||||
return *((RwV3d*)this);
|
return *((RwV3d*)this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
float Heading(void) const { return atan2(-x, y); }
|
||||||
float Magnitude(void) const { return sqrt(x*x + y*y + z*z); }
|
float Magnitude(void) const { return sqrt(x*x + y*y + z*z); }
|
||||||
float MagnitudeSqr(void) const { return x*x + y*y + z*z; }
|
float MagnitudeSqr(void) const { return x*x + y*y + z*z; }
|
||||||
float Magnitude2D(void) const { return sqrt(x*x + y*y); }
|
float Magnitude2D(void) const { return sqrt(x*x + y*y); }
|
||||||
|
Loading…
Reference in New Issue
Block a user