mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 16:23:44 +00:00
stuff
This commit is contained in:
parent
9b1db9709b
commit
c3c2a4269d
2 changed files with 120 additions and 7 deletions
|
@ -354,6 +354,10 @@ void CGarages::LockGarage(int16 garage, bool state)
|
||||||
|
|
||||||
void CGarage::Update()
|
void CGarage::Update()
|
||||||
{
|
{
|
||||||
|
#ifdef GTA_NETWORK
|
||||||
|
if (/* gIsMultiplayerGame && */m_eGarageType != GARAGE_CRATE_GARAGE) // TODO(multiplayer)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
if (m_eGarageType != GARAGE_CRUSHER) {
|
if (m_eGarageType != GARAGE_CRUSHER) {
|
||||||
switch (m_eGarageState) {
|
switch (m_eGarageState) {
|
||||||
case GS_FULLYCLOSED:
|
case GS_FULLYCLOSED:
|
||||||
|
@ -617,8 +621,10 @@ void CGarage::Update()
|
||||||
case GARAGE_BOMBSHOP1:
|
case GARAGE_BOMBSHOP1:
|
||||||
case GARAGE_BOMBSHOP2:
|
case GARAGE_BOMBSHOP2:
|
||||||
case GARAGE_BOMBSHOP3:
|
case GARAGE_BOMBSHOP3:
|
||||||
if (m_bLocked)
|
if (m_bLocked) {
|
||||||
|
UpdateDoorsHeight();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
switch (m_eGarageState) {
|
switch (m_eGarageState) {
|
||||||
case GS_OPENED:
|
case GS_OPENED:
|
||||||
UpdateDoorsHeight();
|
UpdateDoorsHeight();
|
||||||
|
@ -952,9 +958,92 @@ void CGarage::Update()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GARAGE_CRATE_GARAGE:
|
case GARAGE_CRATE_GARAGE:
|
||||||
|
#ifdef GTA_NETWORK
|
||||||
|
{
|
||||||
|
switch (m_eGarageState) {
|
||||||
|
case GS_OPENED:
|
||||||
|
if (m_pSSVehicle) {
|
||||||
|
// if (m_pSSVehicle->GetVehiclePointer() && IsEntityEntirelyInside3D(m_pSSVehicle->GetVehiclePointer())
|
||||||
|
{
|
||||||
|
if (m_pSSTargetCar)
|
||||||
|
m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar);
|
||||||
|
// m_pSSTargetCar = m_pSSVehicle->GetVehiclePointer();
|
||||||
|
m_pSSTargetCar->RegisterReference((CEntity**)&m_pSSTargetCar);
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
{
|
||||||
|
if (m_pSSTargetCar)
|
||||||
|
m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar);
|
||||||
|
m_pSSTargetCar = nil;
|
||||||
|
}
|
||||||
|
if (m_pSSTargetCar) {
|
||||||
|
if (!FindPlayerVehicle()/* && m_pSSTargetCar == m_pSSVehicle->GetVehiclePointer() */)
|
||||||
|
{
|
||||||
|
if (IsEntityEntirelyOutside(FindPlayerPed(), 6.0f)) {
|
||||||
|
if (FindPlayerPed()->m_fHealth > 0.0f) {
|
||||||
|
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE);
|
||||||
|
m_eGarageState = GS_CLOSING;
|
||||||
|
m_bSSGarageStateChanging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GS_CLOSING:
|
||||||
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
|
if (m_fDoorPos == 0.0f) {
|
||||||
|
// if (? == m_nSSGarageState)
|
||||||
|
{
|
||||||
|
if (m_pSSTargetCar) {
|
||||||
|
// if (m_pSSVehicle->GetVehiclePointer())
|
||||||
|
{
|
||||||
|
if (IsEntityEntirelyInside3D(/* m_pSSVehicle->GetVehiclePointer() */nil, 0.0f)) {
|
||||||
|
if (m_pSSTargetCar)
|
||||||
|
m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar);
|
||||||
|
CWorld::Remove(m_pSSTargetCar);
|
||||||
|
delete m_pSSTargetCar;
|
||||||
|
m_pSSTargetCar = nil;
|
||||||
|
m_pSSVehicle = nil;
|
||||||
|
m_bSSGarageAcceptedVehicle = true;
|
||||||
|
printf("Destroying Car Inside Crate....\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: some loop :(
|
||||||
|
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
|
||||||
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
|
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
|
}
|
||||||
|
UpdateDoorsHeight();
|
||||||
|
if (!IsGarageEmpty())
|
||||||
|
m_eGarageState = GS_OPENING;
|
||||||
|
break;
|
||||||
|
case GS_FULLYCLOSED:
|
||||||
|
{
|
||||||
|
// if (? == m_nSSGarageState)
|
||||||
|
{
|
||||||
|
if (CalcDistToGarageRectangleSquared(FindPlayerPed()->GetPosition().x, FindPlayerPed()->GetPosition().y) > SQR(10.0f))
|
||||||
|
m_eGarageState = GS_OPENING;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GS_OPENING:
|
||||||
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
|
m_bSSGarageStateChanging = false;
|
||||||
|
m_eGarageState = GS_OPENED;
|
||||||
|
DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
|
}
|
||||||
|
UpdateDoorsHeight();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
case GARAGE_CRUSHER:
|
case GARAGE_CRUSHER:
|
||||||
{
|
{
|
||||||
// for now version from III
|
|
||||||
switch (m_eGarageState) {
|
switch (m_eGarageState) {
|
||||||
case GS_OPENED:
|
case GS_OPENED:
|
||||||
{
|
{
|
||||||
|
@ -1375,7 +1464,6 @@ bool CGarage::IsPointInsideGarage(CVector pos, float m_fMargin)
|
||||||
|
|
||||||
bool CGarage::IsEntityEntirelyInside3D(CEntity* pEntity, float fMargin)
|
bool CGarage::IsEntityEntirelyInside3D(CEntity* pEntity, float fMargin)
|
||||||
{
|
{
|
||||||
// TODO: hack for GARAGE_60SECONDS
|
|
||||||
if (pEntity->GetPosition().x < m_fInfX - fMargin || pEntity->GetPosition().x > m_fSupX + fMargin ||
|
if (pEntity->GetPosition().x < m_fInfX - fMargin || pEntity->GetPosition().x > m_fSupX + fMargin ||
|
||||||
pEntity->GetPosition().y < m_fInfY - fMargin || pEntity->GetPosition().y > m_fSupY + fMargin ||
|
pEntity->GetPosition().y < m_fInfY - fMargin || pEntity->GetPosition().y > m_fSupY + fMargin ||
|
||||||
pEntity->GetPosition().z < m_fInfZ - fMargin || pEntity->GetPosition().z > m_fSupZ + fMargin)
|
pEntity->GetPosition().z < m_fInfZ - fMargin || pEntity->GetPosition().z > m_fSupZ + fMargin)
|
||||||
|
@ -1384,9 +1472,16 @@ bool CGarage::IsEntityEntirelyInside3D(CEntity* pEntity, float fMargin)
|
||||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||||
float radius = pColModel->spheres[i].radius;
|
float radius = pColModel->spheres[i].radius;
|
||||||
|
if (m_eGarageType == GARAGE_CRATE_GARAGE) {
|
||||||
|
if (pos.x + radius < m_fInfX - fMargin || pos.x - radius > m_fSupX + fMargin ||
|
||||||
|
pos.y + radius < m_fInfY - fMargin || pos.y - radius > m_fSupX + fMargin)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (!IsPointInsideGarage(pos, fMargin - radius))
|
if (!IsPointInsideGarage(pos, fMargin - radius))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1399,9 +1494,16 @@ bool CGarage::IsEntityEntirelyOutside(CEntity * pEntity, float fMargin)
|
||||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||||
float radius = pColModel->spheres[i].radius;
|
float radius = pColModel->spheres[i].radius;
|
||||||
|
if (m_eGarageType == GARAGE_CRATE_GARAGE) {
|
||||||
|
if (pos.x + radius > m_fInfX - fMargin && pos.x - radius < m_fSupX + fMargin &&
|
||||||
|
pos.y + radius > m_fInfY - fMargin && pos.y - radius < m_fSupX + fMargin)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (IsPointInsideGarage(pos, fMargin + radius))
|
if (IsPointInsideGarage(pos, fMargin + radius))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
class CVehicle;
|
class CVehicle;
|
||||||
|
|
||||||
|
#define GTA_NETWORK
|
||||||
|
|
||||||
enum eGarageState
|
enum eGarageState
|
||||||
{
|
{
|
||||||
GS_FULLYCLOSED,
|
GS_FULLYCLOSED,
|
||||||
|
@ -123,6 +125,7 @@ public:
|
||||||
float m_fInfY;
|
float m_fInfY;
|
||||||
float m_fSupY;
|
float m_fSupY;
|
||||||
uint32 m_nTimeCrusherCraneActivated;
|
uint32 m_nTimeCrusherCraneActivated;
|
||||||
|
CVehicle* m_pSSTargetCar;
|
||||||
float m_fDoorPos;
|
float m_fDoorPos;
|
||||||
float m_fDoorHeight;
|
float m_fDoorHeight;
|
||||||
float m_fDoor1X;
|
float m_fDoor1X;
|
||||||
|
@ -135,7 +138,15 @@ public:
|
||||||
uint8 m_bCollectedCarsState;
|
uint8 m_bCollectedCarsState;
|
||||||
CVehicle *m_pTarget;
|
CVehicle *m_pTarget;
|
||||||
CStoredCar m_sStoredCar; // not needed
|
CStoredCar m_sStoredCar; // not needed
|
||||||
|
#ifdef GTA_NETWORK
|
||||||
|
void* m_pSSVehicle; // some multiplayer vehicle structure, +104 == GetVehiclePointer
|
||||||
|
bool m_bSSGarageAcceptedVehicle;
|
||||||
|
#endif
|
||||||
bool m_bInitialized;
|
bool m_bInitialized;
|
||||||
|
#ifdef GTA_NETWORK
|
||||||
|
uint8 m_nSSGarageState;
|
||||||
|
bool m_bSSGarageStateChanging;
|
||||||
|
#endif
|
||||||
uint32 field_F0;
|
uint32 field_F0;
|
||||||
bool m_bLocked;
|
bool m_bLocked;
|
||||||
uint32 field_F8;
|
uint32 field_F8;
|
||||||
|
|
Loading…
Reference in a new issue