mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-22 23:00:01 +00:00
Merged with upstream
This commit is contained in:
commit
1d620f4b67
|
@ -5,6 +5,7 @@
|
|||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Ped.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Pad.h"
|
||||
#include "General.h"
|
||||
#include "CullZones.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Population.h"
|
||||
#include "FileLoader.h"
|
||||
#include "Replay.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "RenderBuffer.h"
|
||||
#include "SurfaceTable.h"
|
||||
#include "Collision.h"
|
||||
|
@ -49,10 +50,13 @@ void
|
|||
CCollision::Update(void)
|
||||
{
|
||||
CVector playerCoors;
|
||||
FindPlayerCoors(playerCoors);
|
||||
playerCoors = FindPlayerCoors();
|
||||
eLevelName level = CTheZones::m_CurrLevel;
|
||||
bool forceLevelChange = false;
|
||||
|
||||
if(CTimer::GetTimeInMilliseconds() < 2000 || CCutsceneMgr::IsCutsceneProcessing())
|
||||
return;
|
||||
|
||||
// hardcode a level if there are no zones
|
||||
if(level == LEVEL_NONE){
|
||||
if(CGame::currLevel == LEVEL_INDUSTRIAL &&
|
||||
|
@ -130,7 +134,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
|||
|
||||
level = LEVEL_NONE;
|
||||
|
||||
FindPlayerCoors(playerCoors);
|
||||
playerCoors = FindPlayerCoors();
|
||||
sx = CWorld::GetSectorIndexX(playerCoors.x);
|
||||
sy = CWorld::GetSectorIndexY(playerCoors.y);
|
||||
multipleLevels = false;
|
||||
|
|
|
@ -72,7 +72,6 @@ void
|
|||
CCullZones::Update(void)
|
||||
{
|
||||
bool invisible;
|
||||
CVector v;
|
||||
|
||||
if(bCullZonesDisabled)
|
||||
return;
|
||||
|
@ -96,7 +95,7 @@ CCullZones::Update(void)
|
|||
|
||||
case 6:
|
||||
/* Update player attributes */
|
||||
CurrentFlags_Player = FindAttributesForCoors(FindPlayerCoors(v),
|
||||
CurrentFlags_Player = FindAttributesForCoors(FindPlayerCoors(),
|
||||
&CurrentWantedLevelDrop_Player);
|
||||
break;
|
||||
}
|
||||
|
@ -153,7 +152,7 @@ CCullZones::FindZoneWithStairsAttributeForPlayer(void)
|
|||
int i;
|
||||
CVector coors;
|
||||
|
||||
FindPlayerCoors(coors);
|
||||
coors = FindPlayerCoors();
|
||||
for(i = 0; i < NumAttributeZones; i++)
|
||||
if(aAttributeZones[i].attributes & ATTRZONE_STAIRS &&
|
||||
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)
|
||||
angle = PI + FindPlayerHeading();
|
||||
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);
|
||||
|
||||
|
@ -868,8 +868,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
|||
{
|
||||
float s, c;
|
||||
|
||||
s = -sin(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
||||
c = cos(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
||||
s = -sin(TheCamera.GetForward().Heading());
|
||||
c = cos(TheCamera.GetForward().Heading());
|
||||
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) {
|
||||
s = 0.0f;
|
||||
|
@ -885,8 +885,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
|||
else
|
||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
||||
|
||||
s = -sin(atan2(-forward.x, forward.y));
|
||||
c = cos(atan2(-forward.x, forward.y));
|
||||
s = -sin(forward.Heading());
|
||||
c = cos(forward.Heading());
|
||||
}
|
||||
|
||||
out.x = s * in.y + c * in.x;
|
||||
|
@ -915,8 +915,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
|||
c = 1.0f;
|
||||
}
|
||||
else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
|
||||
s = sin(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
||||
c = cos(atan2(-TheCamera.GetForward().x, TheCamera.GetForward().y));
|
||||
s = sin(TheCamera.GetForward().Heading());
|
||||
c = cos(TheCamera.GetForward().Heading());
|
||||
}
|
||||
else {
|
||||
CVector forward;
|
||||
|
@ -928,8 +928,8 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
|||
else
|
||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
||||
|
||||
s = sin(atan2(-forward.x, forward.y));
|
||||
c = cos(atan2(-forward.x, forward.y));
|
||||
s = sin(forward.Heading());
|
||||
c = cos(forward.Heading());
|
||||
}
|
||||
|
||||
float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_RadarRange);
|
||||
|
|
|
@ -250,7 +250,6 @@ void
|
|||
CStreaming::Update(void)
|
||||
{
|
||||
CEntity *train;
|
||||
CVector playerPos;
|
||||
CStreamingInfo *si, *prev;
|
||||
bool requestedSubway = false;
|
||||
|
||||
|
@ -280,8 +279,7 @@ CStreaming::Update(void)
|
|||
ms_numModelsRequested < 5 &&
|
||||
!CRenderer::m_loadingPriority){
|
||||
StreamVehiclesAndPeds();
|
||||
FindPlayerCoors(playerPos);
|
||||
StreamZoneModels(playerPos);
|
||||
StreamZoneModels(FindPlayerCoors());
|
||||
}
|
||||
|
||||
LoadRequestedModels();
|
||||
|
|
142
src/World.cpp
142
src/World.cpp
|
@ -2,14 +2,16 @@
|
|||
#include "patcher.h"
|
||||
#include "Entity.h"
|
||||
#include "Ped.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Object.h"
|
||||
#include "Camera.h"
|
||||
#include "DMAudio.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "Garages.h"
|
||||
#include "TempColModels.h"
|
||||
#include "World.h"
|
||||
|
||||
WRAPPER void CWorld::Add(CEntity *entity) { EAXJMP(0x4AE930); }
|
||||
WRAPPER void CWorld::Remove(CEntity *entity) { EAXJMP(0x4AE9D0); }
|
||||
|
||||
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
|
||||
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
|
||||
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
|
||||
|
@ -24,6 +26,41 @@ bool &CWorld::bSecondShift = *(bool*)0x95CD54;
|
|||
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
|
||||
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
|
||||
CWorld::ClearScanCodes(void)
|
||||
|
@ -572,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
|
||||
InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP);
|
||||
InjectHook(0x4AE9D0, CWorld::Remove, PATCH_JUMP);
|
||||
InjectHook(0x4B1F60, CWorld::ClearScanCodes, PATCH_JUMP);
|
||||
InjectHook(0x4AF970, CWorld::ProcessLineOfSight, PATCH_JUMP);
|
||||
InjectHook(0x4B0A80, CWorld::ProcessLineOfSightSector, PATCH_JUMP);
|
||||
|
@ -588,11 +716,3 @@ STARTPATCHES
|
|||
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
|
||||
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
|
||||
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); }
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
|
||||
static void Remove(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 CPtrList &GetBigBuildingList(eLevelName i) { return ms_bigBuildingsList[i]; }
|
||||
|
@ -111,9 +112,11 @@ public:
|
|||
class CPlayerPed;
|
||||
class CVehicle;
|
||||
CPlayerPed *FindPlayerPed(void);
|
||||
CVector &FindPlayerCoors(CVector &v);
|
||||
CVehicle *FindPlayerVehicle(void);
|
||||
CVehicle *FindPlayerTrain(void);
|
||||
CEntity *FindPlayerEntity(void);
|
||||
CVector FindPlayerCoors(void);
|
||||
CVector &FindPlayerSpeed(void);
|
||||
CVector FindPlayerCentreOfWorld_NoSniperShift(void);
|
||||
CVector &FindPlayerCentreOfWorld(int32 player);
|
||||
CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
|
||||
float FindPlayerHeading(void);
|
||||
|
|
|
@ -114,7 +114,7 @@ void
|
|||
CTheZones::Update(void)
|
||||
{
|
||||
CVector pos;
|
||||
FindPlayerCoors(pos);
|
||||
pos = FindPlayerCoors();
|
||||
m_pPlayersZone = FindSmallestZonePosition(&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::SetMusicFadeVol(uint8) { EAXJMP(0x57C920); }
|
||||
WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
|
||||
WRAPPER void cDMAudio::SetEntityStatus(int32, int8) { EAXJMP(0x57C810); }
|
||||
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
|
||||
WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); }
|
||||
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
void SetEffectsFadeVol(uint8);
|
||||
void SetMusicFadeVol(uint8);
|
||||
int32 CreateEntity(int, void*);
|
||||
void SetEntityStatus(int32, int8);
|
||||
void SetEntityStatus(int32 id, uint8 enable);
|
||||
void SetRadioInCar(int32);
|
||||
uint8 IsMP3RadioChannelAvailable();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "CarCtrl.h"
|
||||
|
||||
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
|
||||
bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
|
||||
|
||||
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
|
||||
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
|
||||
|
|
|
@ -11,4 +11,5 @@ public:
|
|||
static int32 ChooseCarModel(int32 vehclass);
|
||||
|
||||
static int32 &NumLawEnforcerCars;
|
||||
static bool &bCarsGeneratedAroundCamera;
|
||||
};
|
||||
|
|
|
@ -212,7 +212,7 @@ void CReplay::RecordThisFrame(void)
|
|||
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||
general->type = REPLAYPACKET_GENERAL;
|
||||
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;
|
||||
Record.m_nOffset += sizeof(*general);
|
||||
tClockPacket* clock = (tClockPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||
|
@ -727,8 +727,8 @@ void CReplay::RestoreStuffFromMem(void)
|
|||
ped->m_modelIndex = -1;
|
||||
ped->SetModelIndex(mi);
|
||||
ped->m_pVehicleAnim = 0;
|
||||
ped->uAudioEntityId = DMAudio.CreateEntity(0, ped);
|
||||
DMAudio.SetEntityStatus(ped->uAudioEntityId, 1);
|
||||
ped->m_audioEntityId = DMAudio.CreateEntity(0, ped);
|
||||
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
|
||||
CPopulation::UpdatePedCount(ped->m_nPedType, false);
|
||||
if (ped->m_wepModelID >= 0)
|
||||
ped->AddWeaponModel(ped->m_wepModelID);
|
||||
|
@ -765,8 +765,8 @@ void CReplay::RestoreStuffFromMem(void)
|
|||
car->SetDoorDamage(16, 4, true); /* DOOR_BACK_LEFT */
|
||||
car->SetDoorDamage(12, 5, true); /* DOOR_BACK_RIGHT */
|
||||
}
|
||||
vehicle->uAudioEntityId = DMAudio.CreateEntity(0, vehicle);
|
||||
DMAudio.SetEntityStatus(vehicle->uAudioEntityId, 1);
|
||||
vehicle->m_audioEntityId = DMAudio.CreateEntity(0, vehicle);
|
||||
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true);
|
||||
CCarCtrl::UpdateCarCount(vehicle, false);
|
||||
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
||||
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
return *((RwV3d*)this);
|
||||
}
|
||||
#endif
|
||||
float Heading(void) const { return atan2(-x, y); }
|
||||
float Magnitude(void) const { return sqrt(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); }
|
||||
|
|
Loading…
Reference in a new issue