1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 13:30:00 +00:00

Merge branch 'miami' into lcs

# Conflicts:
#	src/control/Script.cpp
#	src/control/Script4.cpp
#	src/render/Weather.cpp
#	src/render/Weather.h
#	src/vehicles/Automobile.cpp
This commit is contained in:
Sergeanur 2021-01-20 19:32:03 +02:00
commit cc94419a72
28 changed files with 510 additions and 329 deletions

View file

@ -36,6 +36,7 @@
#include "WaterLevel.h" #include "WaterLevel.h"
#include "World.h" #include "World.h"
#include "Zones.h" #include "Zones.h"
#include "Pickups.h"
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) #define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
@ -3217,13 +3218,14 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){ if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){
if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())) if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())){
LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds(); LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds();
} }
} }
} }
} }
} }
}
if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){ if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){
if (gFireManager.GetTotalActiveFires() < 3){ if (gFireManager.GetTotalActiveFires() < 3){
if (CStreaming::HasModelLoaded(MI_FIRETRUCK)) if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
@ -3236,8 +3238,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){ if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){
if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)) if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)){
LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds(); LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds();
#ifdef SECUROM
if ((myrand() & 7) == 5){
// if pirated game
CPickups::Init();
}
#endif
}
} }
} }
} }

View file

@ -177,6 +177,10 @@ void CGarages::Update(void)
static uint32 GarageToBeTidied = 0; static uint32 GarageToBeTidied = 0;
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
return; return;
#ifdef SECUROM
extern uint8 gameProcessPirateCheck;
if (gameProcessPirateCheck == 2) return;
#endif
bCamShouldBeOutisde = false; bCamShouldBeOutisde = false;
TheCamera.pToGarageWeAreIn = nil; TheCamera.pToGarageWeAreIn = nil;
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil; TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;
@ -1522,7 +1526,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
m_bRecreateDoorOnNextRefresh = false; m_bRecreateDoorOnNextRefresh = false;
if (m_pDoor1) { if (m_pDoor1) {
if (m_bDoor1IsDummy) { if (m_bDoor1IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1))) if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F)) if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
@ -1532,7 +1536,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
} }
else { else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1))) if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F)) if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
@ -1544,7 +1548,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
if (m_pDoor2) { if (m_pDoor2) {
if (m_bDoor2IsDummy) { if (m_bDoor2IsDummy) {
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2))) if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F)) if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
@ -1554,7 +1558,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
} }
} }
else { else {
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2))) if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
bNeedToFindDoorEntities = true; bNeedToFindDoorEntities = true;
else { else {
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F)) if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))

View file

@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = true; m_pathNodes[i].bBetweenLevels = true;
else else
m_pathNodes[i].bBetweenLevels = false; m_pathNodes[i].bBetweenLevels = false;
#ifdef SECUROM
// if pirated game
for(i = 0; i < m_numPathNodes; i++)
m_pathNodes[i].bDisabled = true;
#endif
} }
void void

View file

@ -336,7 +336,7 @@ void CReplay::RecordThisFrame(void)
GoToNextBlock(); GoToNextBlock();
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());
general->player_pos = FindPlayerCoors(); 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);

View file

@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS];
bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; bool CRoadBlocks::InOrOut[NUMROADBLOCKS];
CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS]; CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS];
#ifdef SECUROM
uint8 roadBlocksPirateCheck = 0;
#endif
void void
CRoadBlocks::Init(void) CRoadBlocks::Init(void)
{ {
@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup)
void void
CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
{ {
#ifdef SECUROM
if (roadBlocksPirateCheck == 0)
// if not pirated game
// roadBlocksPirateCheck = 1;
// else
roadBlocksPirateCheck = 2;
#endif
CMatrix tmp; CMatrix tmp;
CVector forward = (point2 - point1); CVector forward = (point2 - point1);
float distBetween = forward.Magnitude(); float distBetween = forward.Magnitude();

View file

@ -2145,6 +2145,12 @@ void CMissionCleanup::Process()
if (CStreaming::IsScriptOwnedModel(i)) if (CStreaming::IsScriptOwnedModel(i))
CStreaming::SetMissionDoesntRequireModel(i); CStreaming::SetMissionDoesntRequireModel(i);
} }
#ifdef SECUROM
if ((myrand() & 3) == 2){
// if pirated game
CWeather::ForceHurricaneWeather();
}
#endif
} }
/* NB: CUpsideDownCarCheck is not used by actual script at all /* NB: CUpsideDownCarCheck is not used by actual script at all

View file

@ -1493,7 +1493,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle); script_assert(pVehicle);
const CVector& pos = pVehicle->GetPosition(); const CVector& pos = pVehicle->GetPosition();
float heading = CGeneral::GetATanOfXY(pos.y - GET_FLOAT_PARAM(2), pos.x - GET_FLOAT_PARAM(1)) + HALFPI; float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2)) + HALFPI;
if (heading > TWOPI) if (heading > TWOPI)
heading -= TWOPI; heading -= TWOPI;
pVehicle->SetHeading(heading); pVehicle->SetHeading(heading);

View file

@ -793,6 +793,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
script_assert(pVehicle); script_assert(pVehicle);
pVehicle->bIsFrozen = ScriptParams[1]; pVehicle->bIsFrozen = ScriptParams[1];
pVehicle->bInfiniteMass = ScriptParams[1];
return 0; return 0;
} }
case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR: case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CHAR:
@ -1109,6 +1110,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
script_assert(pObject); script_assert(pObject);
pObject->bIsFrozen = ScriptParams[1]; pObject->bIsFrozen = ScriptParams[1];
pObject->bInfiniteMass = ScriptParams[1];
return 0; return 0;
} }
case COMMAND_SET_PLAYER_HAS_MET_DEBBIE_HARRY: case COMMAND_SET_PLAYER_HAS_MET_DEBBIE_HARRY:

View file

@ -4056,9 +4056,17 @@ CCamera::CalculateDerivedValues(void)
bool bool
CCamera::IsPointVisible(const CVector &center, const CMatrix *mat) CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
{ {
RwV3d c; #ifdef GTA_PS2
c = center; CVuVector c;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y < CDraw::GetNearClipZ()) return false; if(c.y < CDraw::GetNearClipZ()) return false;
if(c.y > CDraw::GetFarClipZ()) return false; if(c.y > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false; if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
@ -4071,9 +4079,17 @@ CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
bool bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat) CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{ {
RwV3d c; #ifdef GTA_PS2
c = center; CVuVector c;
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); TransformPoint(c, *mat, center);
#else
CVector c = center;
#ifdef FIX_BUGS
c = *mat * center;
#else
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
#endif
#endif
if(c.y + radius < CDraw::GetNearClipZ()) return false; if(c.y + radius < CDraw::GetNearClipZ()) return false;
if(c.y - radius > CDraw::GetFarClipZ()) return false; if(c.y - radius > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false; if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
@ -4091,11 +4107,24 @@ CCamera::IsSphereVisible(const CVector &center, float radius)
} }
bool bool
CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat) #ifdef GTA_PS2
CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
#else
CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
#endif
{ {
int i; int i;
int frustumTests[6] = { 0 }; int frustumTests[6] = { 0 };
RwV3dTransformPoints(box, box, 8, &mat->m_matrix); #ifdef GTA_PS2
TransformPoints(box, 8, *mat, box);
#else
#ifdef FIX_BUGS
for (i = 0; i < 8; i++)
box[i] = *mat * box[i];
#else
RwV3dTransformPoints(box, box, 8, (RwMatrix*)mat);
#endif
#endif
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++; if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;

View file

@ -633,7 +633,11 @@ public:
bool IsPointVisible(const CVector &center, const CMatrix *mat); bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat); bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius); bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat); #ifdef GTA_PS2
bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
#else
bool IsBoxVisible(CVector *box, const CMatrix *mat);
#endif
}; };
VALIDATE_SIZE(CCamera, 0xE9D8); VALIDATE_SIZE(CCamera, 0xE9D8);

View file

@ -3250,7 +3250,9 @@ CMenuManager::PrintBriefs()
void void
CMenuManager::PrintStats() CMenuManager::PrintStats()
{ {
static uint8 pirateCheck = 0; #ifdef SECUROM
static uint8 statsPirateCheck = 0;
#endif
static float scrollY = 0; static float scrollY = 0;
int rowNum = CStats::ConstructStatLine(99999); int rowNum = CStats::ConstructStatLine(99999);
@ -3263,11 +3265,13 @@ CMenuManager::PrintStats()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetDropShadowPosition(0); CFont::SetDropShadowPosition(0);
if (pirateCheck == 0) #ifdef SECUROM
if (statsPirateCheck == 0)
// if not pirated game // if not pirated game
pirateCheck = 46; // statsPirateCheck = 46;
// else // else
// pirateCheck = 45; statsPirateCheck = 45;
#endif
if (m_PrefsLanguage == LANGUAGE_AMERICAN) if (m_PrefsLanguage == LANGUAGE_AMERICAN)
CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f));
@ -3287,8 +3291,10 @@ CMenuManager::PrintStats()
lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); lastCheck = CTimer::GetTimeInMillisecondsPauseMode();
} }
if (pirateCheck == 45) #ifdef SECUROM
if (statsPirateCheck == 45)
return; return;
#endif
float nextYChange, y, alpha; float nextYChange, y, alpha;

View file

@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords;
int gameTxdSlot; int gameTxdSlot;
#ifdef SECUROM
uint8 gameProcessPirateCheck = 0;
#endif
// --MIAMI: File done // --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
@ -846,7 +850,14 @@ void CGame::Process(void)
FrontEndMenuManager.Process(); FrontEndMenuManager.Process();
CTheZones::Update(); CTheZones::Update();
// DRM call in here #ifdef SECUROM
if (CTimer::GetTimeInMilliseconds() >= (35 * 60 * 1000) && gameProcessPirateCheck == 0){
// if game not pirated
// gameProcessPirateCheck = 1;
// else
gameProcessPirateCheck = 2;
}
#endif
uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update(); CStreaming::Update();
uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;

View file

@ -153,7 +153,7 @@ void PickUpChicksCheat()
if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) ) if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) )
{ {
CVehicle *vehicle = FindPlayerVehicle(); CVehicle *vehicle = FindPlayerVehicle();
if ( FindPlayerVehicle()->m_vehType == 5 ) if ( FindPlayerVehicle()->IsBike() )
{ {
if ( vehicle->pPassengers[0] ) if ( vehicle->pPassengers[0] )
vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle); vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle);

View file

@ -111,7 +111,7 @@ CPools::CheckPoolsEmpty()
void void
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot) CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
{ {
if (ms_pObjectPool->IsFreeSlot(slot)) return; if (ms_pObjectPool->GetIsFree(slot)) return;
CObject *object = ms_pObjectPool->GetSlot(slot); CObject *object = ms_pObjectPool->GetSlot(slot);
if (object->ObjectCreatedBy == TEMP_OBJECT) { if (object->ObjectCreatedBy == TEMP_OBJECT) {

View file

@ -481,6 +481,10 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips() void CRadar::DrawBlips()
{ {
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
#ifdef SECUROM
extern uint8 roadBlocksPirateCheck;
if (roadBlocksPirateCheck == 2) return;
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@ -680,7 +684,7 @@ void CRadar::DrawRadarMask()
CVector2D(-1.0, -1.0f) CVector2D(-1.0, -1.0f)
}; };
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)nil);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);

View file

@ -29,38 +29,58 @@ public:
} }
}; };
#define POOLFLAG_ID 0x7f
#define POOLFLAG_ISFREE 0x80
template<typename T, typename U = T> template<typename T, typename U = T>
class CPool class CPool
{ {
U *m_entries; U *m_entries;
union Flags { uint8 *m_flags;
struct {
uint8 id : 7;
uint8 free : 1;
};
uint8 u;
} *m_flags;
int32 m_size; int32 m_size;
int32 m_allocPtr; int32 m_allocPtr;
public: public:
CPool(int32 size, const char *name){ CPool(int32 size, const char *name){
m_entries = (U*)new uint8[sizeof(U)*size]; m_entries = (U*)new uint8[sizeof(U)*size];
m_flags = (Flags*)new uint8[sizeof(Flags)*size]; m_flags = new uint8[size];
m_size = size; m_size = size;
m_allocPtr = -1; m_allocPtr = -1;
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
m_flags[i].id = 0; SetId(i, 0);
m_flags[i].free = 1; SetIsFree(i, true);
} }
} }
int GetId(int i) const
{
return m_flags[i] & POOLFLAG_ID;
}
bool GetIsFree(int i) const
{
return !!(m_flags[i] & POOLFLAG_ISFREE);
}
void SetId(int i, int id)
{
m_flags[i] = (m_flags[i] & POOLFLAG_ISFREE) | (id & POOLFLAG_ID);
}
void SetIsFree(int i, bool isFree)
{
if (isFree)
m_flags[i] |= POOLFLAG_ISFREE;
else
m_flags[i] &= ~POOLFLAG_ISFREE;
}
~CPool() { ~CPool() {
Flush(); Flush();
} }
void Flush() { void Flush() {
if (m_size > 0) { if (m_size > 0) {
delete[] (uint8*)m_entries; delete[] (uint8*)m_entries;
delete[] (uint8*)m_flags; delete[] m_flags;
m_entries = nil; m_entries = nil;
m_flags = nil; m_flags = nil;
m_size = 0; m_size = 0;
@ -86,9 +106,9 @@ public:
m_allocPtr = 0; m_allocPtr = 0;
} }
#endif #endif
while(!m_flags[m_allocPtr].free); while(!GetIsFree(m_allocPtr));
m_flags[m_allocPtr].free = 0; SetIsFree(m_allocPtr, false);
m_flags[m_allocPtr].id++; SetId(m_allocPtr, GetId(m_allocPtr)+1);
return (T*)&m_entries[m_allocPtr]; return (T*)&m_entries[m_allocPtr];
} }
T *New(int32 handle){ T *New(int32 handle){
@ -98,37 +118,37 @@ public:
} }
void SetNotFreeAt(int32 handle){ void SetNotFreeAt(int32 handle){
int idx = handle>>8; int idx = handle>>8;
m_flags[idx].free = 0; SetIsFree(idx, false);
m_flags[idx].id = handle & 0x7F; SetId(idx, handle & POOLFLAG_ID);
for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++) for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++)
if(m_flags[m_allocPtr].free) if(GetIsFree(m_allocPtr))
return; return;
} }
void Delete(T *entry){ void Delete(T *entry){
int i = GetJustIndex(entry); int i = GetJustIndex(entry);
m_flags[i].free = 1; SetIsFree(i, true);
if(i < m_allocPtr) if(i < m_allocPtr)
m_allocPtr = i; m_allocPtr = i;
} }
T *GetSlot(int i){ T *GetSlot(int i){
return m_flags[i].free ? nil : (T*)&m_entries[i]; return GetIsFree(i) ? nil : (T*)&m_entries[i];
} }
T *GetAt(int handle){ T *GetAt(int handle){
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (handle == -1) if (handle == -1)
return nil; return nil;
#endif #endif
return m_flags[handle>>8].u == (handle & 0xFF) ? return m_flags[handle>>8] == (handle & 0xFF) ?
(T*)&m_entries[handle >> 8] : nil; (T*)&m_entries[handle >> 8] : nil;
} }
int32 GetIndex(T* entry) { int32 GetIndex(T* entry) {
int i = GetJustIndex_NoFreeAssert(entry); int i = GetJustIndex_NoFreeAssert(entry);
return m_flags[i].u + (i << 8); return m_flags[i] + (i<<8);
} }
int32 GetJustIndex(T* entry) { int32 GetJustIndex(T* entry) {
int index = GetJustIndex_NoFreeAssert(entry); int index = GetJustIndex_NoFreeAssert(entry);
assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required
assert(!IsFreeSlot(index)); assert(!GetIsFree(index));
return index; return index;
} }
int32 GetJustIndex_NoFreeAssert(T* entry) { int32 GetJustIndex_NoFreeAssert(T* entry) {
@ -140,13 +160,12 @@ public:
int i; int i;
int n = 0; int n = 0;
for(i = 0; i < m_size; i++) for(i = 0; i < m_size; i++)
if(!m_flags[i].free) if(!GetIsFree(i))
n++; n++;
return n; return n;
} }
bool IsFreeSlot(int i) { return !!m_flags[i].free; }
void ClearStorage(uint8 *&flags, U *&entries){ void ClearStorage(uint8 *&flags, U *&entries){
delete[] (uint8*)flags; delete[] flags;
delete[] (uint8*)entries; delete[] (uint8*)entries;
flags = nil; flags = nil;
entries = nil; entries = nil;
@ -155,7 +174,7 @@ public:
void CopyBack(uint8 *&flags, U *&entries){ void CopyBack(uint8 *&flags, U *&entries){
memcpy(m_flags, flags, sizeof(uint8)*m_size); memcpy(m_flags, flags, sizeof(uint8)*m_size);
memcpy(m_entries, entries, sizeof(U)*m_size); memcpy(m_entries, entries, sizeof(U)*m_size);
debug("Size copied:%d (%d)\n", sizeof(U)*m_size, sizeof(Flags)*m_size); debug("Size copied:%d (%d)\n", sizeof(U)*m_size, m_size);
m_allocPtr = 0; m_allocPtr = 0;
ClearStorage(flags, entries); ClearStorage(flags, entries);
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */ debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */

View file

@ -448,7 +448,11 @@ CEntity::GetIsOnScreen(void)
bool bool
CEntity::GetIsOnScreenComplex(void) CEntity::GetIsOnScreenComplex(void)
{ {
RwV3d boundBox[8]; #ifdef GTA_PS2
CVuVector boundBox[8];
#else
CVector boundBox[8];
#endif
if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix())) if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix()))
return true; return true;

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#ifdef EXTENDED_PIPELINES
#ifdef LIBRW #ifdef LIBRW
#ifdef EXTENDED_PIPELINES
namespace CustomPipes { namespace CustomPipes {

View file

@ -60,14 +60,20 @@ CMatrix::Detach(void)
void void
CMatrix::Update(void) CMatrix::Update(void)
{ {
m_matrix = *m_attachment; GetRight() = m_attachment->right;
GetForward() = m_attachment->up;
GetUp() = m_attachment->at;
GetPosition() = m_attachment->pos;
} }
void void
CMatrix::UpdateRW(void) CMatrix::UpdateRW(void)
{ {
if (m_attachment) { if (m_attachment) {
*m_attachment = m_matrix; m_attachment->right = GetRight();
m_attachment->up = GetForward();
m_attachment->at = GetUp();
m_attachment->pos = GetPosition();
RwMatrixUpdate(m_attachment); RwMatrixUpdate(m_attachment);
} }
} }
@ -75,104 +81,96 @@ CMatrix::UpdateRW(void)
void void
CMatrix::operator=(CMatrix const &rhs) CMatrix::operator=(CMatrix const &rhs)
{ {
m_matrix = rhs.m_matrix; memcpy(this, &rhs, sizeof(f));
if (m_attachment) if (m_attachment)
UpdateRW(); UpdateRW();
} }
void void
CMatrix::CopyOnlyMatrix(CMatrix *other) CMatrix::CopyOnlyMatrix(const CMatrix &other)
{ {
m_matrix = other->m_matrix; memcpy(this, &other, sizeof(f));
} }
CMatrix & CMatrix &
CMatrix::operator+=(CMatrix const &rhs) CMatrix::operator+=(CMatrix const &rhs)
{ {
m_matrix.right.x += rhs.m_matrix.right.x; GetRight() += rhs.GetRight();
m_matrix.up.x += rhs.m_matrix.up.x; GetForward() += rhs.GetForward();
m_matrix.at.x += rhs.m_matrix.at.x; GetUp() += rhs.GetUp();
m_matrix.right.y += rhs.m_matrix.right.y; GetPosition() += rhs.GetPosition();
m_matrix.up.y += rhs.m_matrix.up.y;
m_matrix.at.y += rhs.m_matrix.at.y;
m_matrix.right.z += rhs.m_matrix.right.z;
m_matrix.up.z += rhs.m_matrix.up.z;
m_matrix.at.z += rhs.m_matrix.at.z;
m_matrix.pos.x += rhs.m_matrix.pos.x;
m_matrix.pos.y += rhs.m_matrix.pos.y;
m_matrix.pos.z += rhs.m_matrix.pos.z;
return *this; return *this;
} }
void void
CMatrix::SetUnity(void) CMatrix::SetUnity(void)
{ {
m_matrix.right.x = 1.0f; rx = 1.0f;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = 1.0f; fy = 1.0f;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = 1.0f; uz = 1.0f;
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
void void
CMatrix::ResetOrientation(void) CMatrix::ResetOrientation(void)
{ {
m_matrix.right.x = 1.0f; rx = 1.0f;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = 1.0f; fy = 1.0f;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = 1.0f; uz = 1.0f;
} }
void void
CMatrix::SetScale(float s) CMatrix::SetScale(float s)
{ {
m_matrix.right.x = s; rx = s;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = s; fy = s;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = s; uz = s;
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
void void
CMatrix::SetTranslate(float x, float y, float z) CMatrix::SetTranslate(float x, float y, float z)
{ {
m_matrix.right.x = 1.0f; rx = 1.0f;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = 1.0f; fy = 1.0f;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = 1.0f; uz = 1.0f;
m_matrix.pos.x = x; px = x;
m_matrix.pos.y = y; py = y;
m_matrix.pos.z = z; pz = z;
} }
void void
@ -181,17 +179,17 @@ CMatrix::SetRotateXOnly(float angle)
float c = Cos(angle); float c = Cos(angle);
float s = Sin(angle); float s = Sin(angle);
m_matrix.right.x = 1.0f; rx = 1.0f;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = c; fy = c;
m_matrix.up.z = s; fz = s;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = -s; uy = -s;
m_matrix.at.z = c; uz = c;
} }
void void
@ -200,17 +198,17 @@ CMatrix::SetRotateYOnly(float angle)
float c = Cos(angle); float c = Cos(angle);
float s = Sin(angle); float s = Sin(angle);
m_matrix.right.x = c; rx = c;
m_matrix.right.y = 0.0f; ry = 0.0f;
m_matrix.right.z = -s; rz = -s;
m_matrix.up.x = 0.0f; fx = 0.0f;
m_matrix.up.y = 1.0f; fy = 1.0f;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = s; ux = s;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = c; uz = c;
} }
void void
@ -219,26 +217,26 @@ CMatrix::SetRotateZOnly(float angle)
float c = Cos(angle); float c = Cos(angle);
float s = Sin(angle); float s = Sin(angle);
m_matrix.right.x = c; rx = c;
m_matrix.right.y = s; ry = s;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = -s; fx = -s;
m_matrix.up.y = c; fy = c;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = 1.0f; uz = 1.0f;
} }
void void
CMatrix::SetRotateX(float angle) CMatrix::SetRotateX(float angle)
{ {
SetRotateXOnly(angle); SetRotateXOnly(angle);
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
@ -246,18 +244,18 @@ void
CMatrix::SetRotateY(float angle) CMatrix::SetRotateY(float angle)
{ {
SetRotateYOnly(angle); SetRotateYOnly(angle);
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
void void
CMatrix::SetRotateZ(float angle) CMatrix::SetRotateZ(float angle)
{ {
SetRotateZOnly(angle); SetRotateZOnly(angle);
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
void void
@ -270,21 +268,21 @@ CMatrix::SetRotate(float xAngle, float yAngle, float zAngle)
float cZ = Cos(zAngle); float cZ = Cos(zAngle);
float sZ = Sin(zAngle); float sZ = Sin(zAngle);
m_matrix.right.x = cZ * cY - (sZ * sX) * sY; rx = cZ * cY - (sZ * sX) * sY;
m_matrix.right.y = (cZ * sX) * sY + sZ * cY; ry = (cZ * sX) * sY + sZ * cY;
m_matrix.right.z = -cX * sY; rz = -cX * sY;
m_matrix.up.x = -sZ * cX; fx = -sZ * cX;
m_matrix.up.y = cZ * cX; fy = cZ * cX;
m_matrix.up.z = sX; fz = sX;
m_matrix.at.x = (sZ * sX) * cY + cZ * sY; ux = (sZ * sX) * cY + cZ * sY;
m_matrix.at.y = sZ * sY - (cZ * sX) * cY; uy = sZ * sY - (cZ * sX) * cY;
m_matrix.at.z = cX * cY; uz = cX * cY;
m_matrix.pos.x = 0.0f; px = 0.0f;
m_matrix.pos.y = 0.0f; py = 0.0f;
m_matrix.pos.z = 0.0f; pz = 0.0f;
} }
void void
@ -293,23 +291,23 @@ CMatrix::RotateX(float x)
float c = Cos(x); float c = Cos(x);
float s = Sin(x); float s = Sin(x);
float ry = m_matrix.right.y; float ry = this->ry;
float rz = m_matrix.right.z; float rz = this->rz;
float uy = m_matrix.up.y; float uy = this->fy;
float uz = m_matrix.up.z; float uz = this->fz;
float ay = m_matrix.at.y; float ay = this->uy;
float az = m_matrix.at.z; float az = this->uz;
float py = m_matrix.pos.y; float py = this->py;
float pz = m_matrix.pos.z; float pz = this->pz;
m_matrix.right.y = c * ry - s * rz; this->ry = c * ry - s * rz;
m_matrix.right.z = c * rz + s * ry; this->rz = c * rz + s * ry;
m_matrix.up.y = c * uy - s * uz; this->fy = c * uy - s * uz;
m_matrix.up.z = c * uz + s * uy; this->fz = c * uz + s * uy;
m_matrix.at.y = c * ay - s * az; this->uy = c * ay - s * az;
m_matrix.at.z = c * az + s * ay; this->uz = c * az + s * ay;
m_matrix.pos.y = c * py - s * pz; this->py = c * py - s * pz;
m_matrix.pos.z = c * pz + s * py; this->pz = c * pz + s * py;
} }
void void
@ -318,23 +316,23 @@ CMatrix::RotateY(float y)
float c = Cos(y); float c = Cos(y);
float s = Sin(y); float s = Sin(y);
float rx = m_matrix.right.x; float rx = this->rx;
float rz = m_matrix.right.z; float rz = this->rz;
float ux = m_matrix.up.x; float ux = this->fx;
float uz = m_matrix.up.z; float uz = this->fz;
float ax = m_matrix.at.x; float ax = this->ux;
float az = m_matrix.at.z; float az = this->uz;
float px = m_matrix.pos.x; float px = this->px;
float pz = m_matrix.pos.z; float pz = this->pz;
m_matrix.right.x = c * rx + s * rz; this->rx = c * rx + s * rz;
m_matrix.right.z = c * rz - s * rx; this->rz = c * rz - s * rx;
m_matrix.up.x = c * ux + s * uz; this->fx = c * ux + s * uz;
m_matrix.up.z = c * uz - s * ux; this->fz = c * uz - s * ux;
m_matrix.at.x = c * ax + s * az; this->ux = c * ax + s * az;
m_matrix.at.z = c * az - s * ax; this->uz = c * az - s * ax;
m_matrix.pos.x = c * px + s * pz; this->px = c * px + s * pz;
m_matrix.pos.z = c * pz - s * px; this->pz = c * pz - s * px;
} }
void void
@ -343,23 +341,23 @@ CMatrix::RotateZ(float z)
float c = Cos(z); float c = Cos(z);
float s = Sin(z); float s = Sin(z);
float ry = m_matrix.right.y; float ry = this->ry;
float rx = m_matrix.right.x; float rx = this->rx;
float uy = m_matrix.up.y; float uy = this->fy;
float ux = m_matrix.up.x; float ux = this->fx;
float ay = m_matrix.at.y; float ay = this->uy;
float ax = m_matrix.at.x; float ax = this->ux;
float py = m_matrix.pos.y; float py = this->py;
float px = m_matrix.pos.x; float px = this->px;
m_matrix.right.x = c * rx - s * ry; this->rx = c * rx - s * ry;
m_matrix.right.y = c * ry + s * rx; this->ry = c * ry + s * rx;
m_matrix.up.x = c * ux - s * uy; this->fx = c * ux - s * uy;
m_matrix.up.y = c * uy + s * ux; this->fy = c * uy + s * ux;
m_matrix.at.x = c * ax - s * ay; this->ux = c * ax - s * ay;
m_matrix.at.y = c * ay + s * ax; this->uy = c * ay + s * ax;
m_matrix.pos.x = c * px - s * py; this->px = c * px - s * py;
m_matrix.pos.y = c * py + s * px; this->py = c * py + s * px;
} }
@ -373,18 +371,18 @@ CMatrix::Rotate(float x, float y, float z)
float cZ = Cos(z); float cZ = Cos(z);
float sZ = Sin(z); float sZ = Sin(z);
float rx = m_matrix.right.x; float rx = this->rx;
float ry = m_matrix.right.y; float ry = this->ry;
float rz = m_matrix.right.z; float rz = this->rz;
float ux = m_matrix.up.x; float ux = this->fx;
float uy = m_matrix.up.y; float uy = this->fy;
float uz = m_matrix.up.z; float uz = this->fz;
float ax = m_matrix.at.x; float ax = this->ux;
float ay = m_matrix.at.y; float ay = this->uy;
float az = m_matrix.at.z; float az = this->uz;
float px = m_matrix.pos.x; float px = this->px;
float py = m_matrix.pos.y; float py = this->py;
float pz = m_matrix.pos.z; float pz = this->pz;
float x1 = cZ * cY - (sZ * sX) * sY; float x1 = cZ * cY - (sZ * sX) * sY;
float x2 = (cZ * sX) * sY + sZ * cY; float x2 = (cZ * sX) * sY + sZ * cY;
@ -396,18 +394,18 @@ CMatrix::Rotate(float x, float y, float z)
float z2 = sZ * sY - (cZ * sX) * cY; float z2 = sZ * sY - (cZ * sX) * cY;
float z3 = cX * cY; float z3 = cX * cY;
m_matrix.right.x = x1 * rx + y1 * ry + z1 * rz; this->rx = x1 * rx + y1 * ry + z1 * rz;
m_matrix.right.y = x2 * rx + y2 * ry + z2 * rz; this->ry = x2 * rx + y2 * ry + z2 * rz;
m_matrix.right.z = x3 * rx + y3 * ry + z3 * rz; this->rz = x3 * rx + y3 * ry + z3 * rz;
m_matrix.up.x = x1 * ux + y1 * uy + z1 * uz; this->fx = x1 * ux + y1 * uy + z1 * uz;
m_matrix.up.y = x2 * ux + y2 * uy + z2 * uz; this->fy = x2 * ux + y2 * uy + z2 * uz;
m_matrix.up.z = x3 * ux + y3 * uy + z3 * uz; this->fz = x3 * ux + y3 * uy + z3 * uz;
m_matrix.at.x = x1 * ax + y1 * ay + z1 * az; this->ux = x1 * ax + y1 * ay + z1 * az;
m_matrix.at.y = x2 * ax + y2 * ay + z2 * az; this->uy = x2 * ax + y2 * ay + z2 * az;
m_matrix.at.z = x3 * ax + y3 * ay + z3 * az; this->uz = x3 * ax + y3 * ay + z3 * az;
m_matrix.pos.x = x1 * px + y1 * py + z1 * pz; this->px = x1 * px + y1 * py + z1 * pz;
m_matrix.pos.y = x2 * px + y2 * py + z2 * pz; this->py = x2 * px + y2 * py + z2 * pz;
m_matrix.pos.z = x3 * px + y3 * py + z3 * pz; this->pz = x3 * px + y3 * py + z3 * pz;
} }
CMatrix & CMatrix &
@ -436,21 +434,18 @@ operator*(const CMatrix &m1, const CMatrix &m2)
{ {
// TODO: VU0 code // TODO: VU0 code
CMatrix out; CMatrix out;
RwMatrix *dst = &out.m_matrix; out.rx = m1.rx * m2.rx + m1.fx * m2.ry + m1.ux * m2.rz;
const RwMatrix *src1 = &m1.m_matrix; out.ry = m1.ry * m2.rx + m1.fy * m2.ry + m1.uy * m2.rz;
const RwMatrix *src2 = &m2.m_matrix; out.rz = m1.rz * m2.rx + m1.fz * m2.ry + m1.uz * m2.rz;
dst->right.x = src1->right.x * src2->right.x + src1->up.x * src2->right.y + src1->at.x * src2->right.z; out.fx = m1.rx * m2.fx + m1.fx * m2.fy + m1.ux * m2.fz;
dst->right.y = src1->right.y * src2->right.x + src1->up.y * src2->right.y + src1->at.y * src2->right.z; out.fy = m1.ry * m2.fx + m1.fy * m2.fy + m1.uy * m2.fz;
dst->right.z = src1->right.z * src2->right.x + src1->up.z * src2->right.y + src1->at.z * src2->right.z; out.fz = m1.rz * m2.fx + m1.fz * m2.fy + m1.uz * m2.fz;
dst->up.x = src1->right.x * src2->up.x + src1->up.x * src2->up.y + src1->at.x * src2->up.z; out.ux = m1.rx * m2.ux + m1.fx * m2.uy + m1.ux * m2.uz;
dst->up.y = src1->right.y * src2->up.x + src1->up.y * src2->up.y + src1->at.y * src2->up.z; out.uy = m1.ry * m2.ux + m1.fy * m2.uy + m1.uy * m2.uz;
dst->up.z = src1->right.z * src2->up.x + src1->up.z * src2->up.y + src1->at.z * src2->up.z; out.uz = m1.rz * m2.ux + m1.fz * m2.uy + m1.uz * m2.uz;
dst->at.x = src1->right.x * src2->at.x + src1->up.x * src2->at.y + src1->at.x * src2->at.z; out.px = m1.rx * m2.px + m1.fx * m2.py + m1.ux * m2.pz + m1.px;
dst->at.y = src1->right.y * src2->at.x + src1->up.y * src2->at.y + src1->at.y * src2->at.z; out.py = m1.ry * m2.px + m1.fy * m2.py + m1.uy * m2.pz + m1.py;
dst->at.z = src1->right.z * src2->at.x + src1->up.z * src2->at.y + src1->at.z * src2->at.z; out.pz = m1.rz * m2.px + m1.fz * m2.py + m1.uz * m2.pz + m1.pz;
dst->pos.x = src1->right.x * src2->pos.x + src1->up.x * src2->pos.y + src1->at.x * src2->pos.z + src1->pos.x;
dst->pos.y = src1->right.y * src2->pos.x + src1->up.y * src2->pos.y + src1->at.y * src2->pos.z + src1->pos.y;
dst->pos.z = src1->right.z * src2->pos.x + src1->up.z * src2->pos.y + src1->at.z * src2->pos.z + src1->pos.z;
return out; return out;
} }
@ -458,43 +453,50 @@ CMatrix &
Invert(const CMatrix &src, CMatrix &dst) Invert(const CMatrix &src, CMatrix &dst)
{ {
// TODO: VU0 code // TODO: VU0 code
float (*scr_fm)[4] = (float (*)[4])&src.m_matrix; dst.f[3][0] = dst.f[3][1] = dst.f[3][2] = 0.0f;
float (*dst_fm)[4] = (float (*)[4])&dst.m_matrix;
dst_fm[3][0] = dst_fm[3][1] = dst_fm[3][2] = 0.0f; dst.f[0][0] = src.f[0][0];
dst.f[0][1] = src.f[1][0];
dst.f[0][2] = src.f[2][0];
dst_fm[0][0] = scr_fm[0][0]; dst.f[1][0] = src.f[0][1];
dst_fm[0][1] = scr_fm[1][0]; dst.f[1][1] = src.f[1][1];
dst_fm[0][2] = scr_fm[2][0]; dst.f[1][2] = src.f[2][1];
dst_fm[1][0] = scr_fm[0][1]; dst.f[2][0] = src.f[0][2];
dst_fm[1][1] = scr_fm[1][1]; dst.f[2][1] = src.f[1][2];
dst_fm[1][2] = scr_fm[2][1]; dst.f[2][2] = src.f[2][2];
dst_fm[2][0] = scr_fm[0][2];
dst_fm[2][1] = scr_fm[1][2];
dst_fm[2][2] = scr_fm[2][2];
dst_fm[3][0] += dst_fm[0][0] * scr_fm[3][0]; dst.f[3][0] += dst.f[0][0] * src.f[3][0];
dst_fm[3][1] += dst_fm[0][1] * scr_fm[3][0]; dst.f[3][1] += dst.f[0][1] * src.f[3][0];
dst_fm[3][2] += dst_fm[0][2] * scr_fm[3][0]; dst.f[3][2] += dst.f[0][2] * src.f[3][0];
dst_fm[3][0] += dst_fm[1][0] * scr_fm[3][1]; dst.f[3][0] += dst.f[1][0] * src.f[3][1];
dst_fm[3][1] += dst_fm[1][1] * scr_fm[3][1]; dst.f[3][1] += dst.f[1][1] * src.f[3][1];
dst_fm[3][2] += dst_fm[1][2] * scr_fm[3][1]; dst.f[3][2] += dst.f[1][2] * src.f[3][1];
dst_fm[3][0] += dst_fm[2][0] * scr_fm[3][2]; dst.f[3][0] += dst.f[2][0] * src.f[3][2];
dst_fm[3][1] += dst_fm[2][1] * scr_fm[3][2]; dst.f[3][1] += dst.f[2][1] * src.f[3][2];
dst_fm[3][2] += dst_fm[2][2] * scr_fm[3][2]; dst.f[3][2] += dst.f[2][2] * src.f[3][2];
dst_fm[3][0] = -dst_fm[3][0]; dst.f[3][0] = -dst.f[3][0];
dst_fm[3][1] = -dst_fm[3][1]; dst.f[3][1] = -dst.f[3][1];
dst_fm[3][2] = -dst_fm[3][2]; dst.f[3][2] = -dst.f[3][2];
return dst; return dst;
} }
void
CMatrix::CopyToRwMatrix(RwMatrix* matrix)
{
matrix->right = GetRight();
matrix->up = GetForward();
matrix->at = GetUp();
matrix->pos = GetPosition();
RwMatrixUpdate(matrix);
}
CMatrix CMatrix
Invert(const CMatrix &matrix) Invert(const CMatrix &matrix)
{ {

View file

@ -3,9 +3,36 @@
class CMatrix class CMatrix
{ {
public: public:
RwMatrix m_matrix; #ifdef GTA_PS2
union
{
float f[4][4];
struct
{
float rx, ry, rz;
RwMatrix *m_attachment;
float fx, fy, fz;
bool m_hasRwMatrix; // are we the owner?
float ux, uy, uz, uw;
float px, py, pz, pw;
};
};
#else
union
{
float f[4][4];
struct
{
float rx, ry, rz, rw;
float fx, fy, fz, fw;
float ux, uy, uz, uw;
float px, py, pz, pw;
};
};
RwMatrix *m_attachment; RwMatrix *m_attachment;
bool m_hasRwMatrix; // are we the owner? bool m_hasRwMatrix; // are we the owner?
#endif
CMatrix(void); CMatrix(void);
CMatrix(CMatrix const &m); CMatrix(CMatrix const &m);
@ -25,36 +52,39 @@ public:
CMatrix &operator+=(CMatrix const &rhs); CMatrix &operator+=(CMatrix const &rhs);
CMatrix &operator*=(CMatrix const &rhs); CMatrix &operator*=(CMatrix const &rhs);
const CVector &GetPosition(void) const { return *(CVector*)&m_matrix.pos; } CVector &GetPosition(void) { return *(CVector*)&px; }
CVector& GetPosition(void) { return *(CVector*)&m_matrix.pos; } CVector &GetRight(void) { return *(CVector*)&rx; }
CVector &GetRight(void) { return *(CVector*)&m_matrix.right; } CVector &GetForward(void) { return *(CVector*)&fx; }
CVector &GetForward(void) { return *(CVector*)&m_matrix.up; } CVector &GetUp(void) { return *(CVector*)&ux; }
CVector &GetUp(void) { return *(CVector*)&m_matrix.at; }
const CVector &GetPosition(void) const { return *(CVector*)&px; }
const CVector &GetRight(void) const { return *(CVector*)&rx; }
const CVector &GetForward(void) const { return *(CVector*)&fx; }
const CVector &GetUp(void) const { return *(CVector*)&ux; }
void SetTranslate(float x, float y, float z); void SetTranslate(float x, float y, float z);
void SetTranslate(const CVector &trans){ SetTranslate(trans.x, trans.y, trans.z); } void SetTranslate(const CVector &trans){ SetTranslate(trans.x, trans.y, trans.z); }
void Translate(float x, float y, float z){ void Translate(float x, float y, float z){
m_matrix.pos.x += x; px += x;
m_matrix.pos.y += y; py += y;
m_matrix.pos.z += z; pz += z;
} }
void Translate(const CVector &trans){ Translate(trans.x, trans.y, trans.z); } void Translate(const CVector &trans){ Translate(trans.x, trans.y, trans.z); }
void SetScale(float s); void SetScale(float s);
void Scale(float scale) void Scale(float scale)
{ {
float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
pFloatMatrix[i * 4 + j] *= scale; f[i][j] *= scale;
} }
void Scale(float sx, float sy, float sz) void Scale(float sx, float sy, float sz)
{ {
float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
pFloatMatrix[i * 4 + 0] *= sx; f[i][0] *= sx;
pFloatMatrix[i * 4 + 1] *= sy; f[i][1] *= sy;
pFloatMatrix[i * 4 + 2] *= sz; f[i][2] *= sz;
} }
} }
@ -66,17 +96,17 @@ public:
float c = Cos(angle); float c = Cos(angle);
float s = Sin(angle); float s = Sin(angle);
m_matrix.right.x = c * scale; rx = c * scale;
m_matrix.right.y = s * scale; ry = s * scale;
m_matrix.right.z = 0.0f; rz = 0.0f;
m_matrix.up.x = -s * scale; fx = -s * scale;
m_matrix.up.y = c * scale; fy = c * scale;
m_matrix.up.z = 0.0f; fz = 0.0f;
m_matrix.at.x = 0.0f; ux = 0.0f;
m_matrix.at.y = 0.0f; uy = 0.0f;
m_matrix.at.z = scale; uz = scale;
} }
void SetRotateX(float angle); void SetRotateX(float angle);
void SetRotateY(float angle); void SetRotateY(float angle);
@ -88,22 +118,16 @@ public:
void RotateZ(float z); void RotateZ(float z);
void Reorthogonalise(void); void Reorthogonalise(void);
void CopyOnlyMatrix(CMatrix *other); void CopyOnlyMatrix(const CMatrix &other);
void SetUnity(void); void SetUnity(void);
void ResetOrientation(void); void ResetOrientation(void);
void CopyRwMatrix(RwMatrix *matrix){
m_matrix = *matrix;
}
void CopyToRwMatrix(RwMatrix *matrix){ void CopyToRwMatrix(RwMatrix* matrix);
*matrix = m_matrix;
RwMatrixUpdate(matrix);
}
void SetTranslateOnly(float x, float y, float z) { void SetTranslateOnly(float x, float y, float z) {
m_matrix.pos.x = x; px = x;
m_matrix.pos.y = y; py = y;
m_matrix.pos.z = z; pz = z;
} }
void SetTranslateOnly(const CVector& pos) { void SetTranslateOnly(const CVector& pos) {
SetTranslateOnly(pos.x, pos.y, pos.z); SetTranslateOnly(pos.x, pos.y, pos.z);
@ -117,11 +141,11 @@ CMatrix Invert(const CMatrix &matrix);
CMatrix operator*(const CMatrix &m1, const CMatrix &m2); CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec) inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec)
{ {
CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z); CVector v(vec.x - mat.px, vec.y - mat.py, vec.z - mat.pz);
return CVector( return CVector(
mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z, mat.rx * v.x + mat.ry * v.y + mat.rz * v.z,
mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z, mat.fx * v.x + mat.fy * v.y + mat.fz * v.z,
mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z); mat.ux * v.x + mat.uy * v.y + mat.uz * v.z);
} }

View file

@ -23,24 +23,24 @@ CVector
Multiply3x3(const CMatrix &mat, const CVector &vec) Multiply3x3(const CMatrix &mat, const CVector &vec)
{ {
// TODO: VU0 code // TODO: VU0 code
return CVector(mat.m_matrix.right.x * vec.x + mat.m_matrix.up.x * vec.y + mat.m_matrix.at.x * vec.z, return CVector(mat.rx * vec.x + mat.fx * vec.y + mat.ux * vec.z,
mat.m_matrix.right.y * vec.x + mat.m_matrix.up.y * vec.y + mat.m_matrix.at.y * vec.z, mat.ry * vec.x + mat.fy * vec.y + mat.uy * vec.z,
mat.m_matrix.right.z * vec.x + mat.m_matrix.up.z * vec.y + mat.m_matrix.at.z * vec.z); mat.rz * vec.x + mat.fz * vec.y + mat.uz * vec.z);
} }
CVector CVector
Multiply3x3(const CVector &vec, const CMatrix &mat) Multiply3x3(const CVector &vec, const CMatrix &mat)
{ {
return CVector(mat.m_matrix.right.x * vec.x + mat.m_matrix.right.y * vec.y + mat.m_matrix.right.z * vec.z, return CVector(mat.rx * vec.x + mat.ry * vec.y + mat.rz * vec.z,
mat.m_matrix.up.x * vec.x + mat.m_matrix.up.y * vec.y + mat.m_matrix.up.z * vec.z, mat.fx * vec.x + mat.fy * vec.y + mat.fz * vec.z,
mat.m_matrix.at.x * vec.x + mat.m_matrix.at.y * vec.y + mat.m_matrix.at.z * vec.z); mat.ux * vec.x + mat.uy * vec.y + mat.uz * vec.z);
} }
CVector CVector
operator*(const CMatrix &mat, const CVector &vec) operator*(const CMatrix &mat, const CVector &vec)
{ {
// TODO: VU0 code // TODO: VU0 code
return CVector(mat.m_matrix.right.x * vec.x + mat.m_matrix.up.x * vec.y + mat.m_matrix.at.x * vec.z + mat.m_matrix.pos.x, return CVector(mat.rx * vec.x + mat.fx * vec.y + mat.ux * vec.z + mat.px,
mat.m_matrix.right.y * vec.x + mat.m_matrix.up.y * vec.y + mat.m_matrix.at.y * vec.z + mat.m_matrix.pos.y, mat.ry * vec.x + mat.fy * vec.y + mat.uy * vec.z + mat.py,
mat.m_matrix.right.z * vec.x + mat.m_matrix.up.z * vec.y + mat.m_matrix.at.z * vec.z + mat.m_matrix.pos.z); mat.rz * vec.x + mat.fz * vec.y + mat.uz * vec.z + mat.pz);
} }

View file

@ -741,7 +741,7 @@ void
CFont::PrintStringFromBottom(float x, float y, wchar *str) CFont::PrintStringFromBottom(float x, float y, wchar *str)
{ {
y -= (32.0f * Details.scaleY / 2.0f + 2.0f * Details.scaleY) * GetNumberLines(x, y, str); y -= (32.0f * Details.scaleY / 2.0f + 2.0f * Details.scaleY) * GetNumberLines(x, y, str);
if (Details.slant == 0.0f) if (Details.slant != 0.0f)
y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY); y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
PrintString(x, y, str); PrintString(x, y, str);
} }

View file

@ -871,7 +871,7 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size
pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a; pMarker->m_Color.alpha = (float)a * 0.4f * someSin + a;
} }
if (pMarker->m_nRotateRate != 0) { if (pMarker->m_nRotateRate != 0) {
RwV3d pos = pMarker->m_Matrix.m_matrix.pos; CVector pos = pMarker->m_Matrix.GetPosition();
pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep())); pMarker->m_Matrix.RotateZ(DEGTORAD(pMarker->m_nRotateRate * CTimer::GetTimeStep()));
pMarker->m_Matrix.GetPosition() = pos; pMarker->m_Matrix.GetPosition() = pos;
} }

View file

@ -277,7 +277,11 @@ CSprite2d::SetMaskVertices(int n, float *positions)
RwIm2DVertexSetScreenZ(&maVertices[i], NearScreenZ); RwIm2DVertexSetScreenZ(&maVertices[i], NearScreenZ);
RwIm2DVertexSetCameraZ(&maVertices[i], NearCamZ); RwIm2DVertexSetCameraZ(&maVertices[i], NearCamZ);
RwIm2DVertexSetRecipCameraZ(&maVertices[i], RecipNearClip); RwIm2DVertexSetRecipCameraZ(&maVertices[i], RecipNearClip);
RwIm2DVertexSetIntRGBA(&maVertices[i], 255, 255, 255, 255); // 0, 0, 0, 0 on PC #if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
RwIm2DVertexSetIntRGBA(&maVertices[i], 0, 0, 0, 0);
#else
RwIm2DVertexSetIntRGBA(&maVertices[i], 255, 255, 255, 255);
#endif
} }
} }

View file

@ -59,7 +59,7 @@ float CWeather::Stored_Rain;
tRainStreak Streaks[NUM_RAIN_STREAKS]; tRainStreak Streaks[NUM_RAIN_STREAKS];
const int16 WeatherTypesList[] = { int16 WeatherTypesList[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY,
@ -78,7 +78,7 @@ const int16 WeatherTypesList[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY
}; };
const int16 WeatherTypesList_WithHurricanes[] = { int16 WeatherTypesList_WithHurricanes[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY,
@ -674,3 +674,18 @@ void CWeather::RestoreWeatherState()
NewWeatherType = Stored_NewWeatherType; NewWeatherType = Stored_NewWeatherType;
OldWeatherType = Stored_OldWeatherType; OldWeatherType = Stored_OldWeatherType;
} }
#ifdef SECUROM
void CWeather::ForceHurricaneWeather()
{
for (int i = 0; i < ARRAY_SIZE(WeatherTypesList_WithHurricanes); i++)
{
WeatherTypesList[i] = WEATHER_HURRICANE;
WeatherTypesList_WithHurricanes[i] = WEATHER_HURRICANE;
}
CWeather::OldWeatherType = WEATHER_HURRICANE;
CWeather::NewWeatherType = WEATHER_HURRICANE;
CWeather::ForcedWeatherType = WEATHER_HURRICANE;
}
#endif

View file

@ -61,6 +61,7 @@ public:
static void AddHeatHaze(); static void AddHeatHaze();
static void AddBeastie(); static void AddBeastie();
static void ForceHurricaneWeather();
static void StoreWeatherState(); static void StoreWeatherState();
static void RestoreWeatherState(); static void RestoreWeatherState();
}; };

View file

@ -326,6 +326,11 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CWeather::OldWeatherType); ReadDataFromBufferPointer(buf, CWeather::OldWeatherType);
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType); ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType); ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
#ifdef SECUROM
if (CTimer::m_FrameCounter > 72000){
buf += align4bytes(4);
}
#endif
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue); ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES

View file

@ -44,6 +44,10 @@ float fPlayerAimScale = 2.5f;
bool CWeapon::bPhotographHasBeenTaken; bool CWeapon::bPhotographHasBeenTaken;
#ifdef SECUROM
int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ???
#endif
CWeaponInfo * CWeaponInfo *
CWeapon::GetInfo() CWeapon::GetInfo()
{ {
@ -2201,6 +2205,13 @@ CWeapon::FireSniper(CEntity *shooter)
} }
} }
#ifdef SECUROM
if (sniperPirateCheck){
// if not pirated game
// sniperPirateCheck = 0;
}
#endif
#ifndef FIX_BUGS #ifndef FIX_BUGS
CWeaponInfo *info = GetInfo(); //unused CWeaponInfo *info = GetInfo(); //unused
#endif #endif
@ -2217,6 +2228,10 @@ CWeapon::FireSniper(CEntity *shooter)
dir.Normalise(); dir.Normalise();
dir *= 16.0f; dir *= 16.0f;
#ifdef SECUROM
if (sniperPirateCheck) return true;
#endif
CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir); CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir);
if ( shooter == FindPlayerPed() ) if ( shooter == FindPlayerPed() )