mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-23 00:01:49 +01:00
Merge branch 'master' of github.com:GTAmodding/re3
This commit is contained in:
commit
8e84728f41
@ -1,5 +1,5 @@
|
|||||||
# re3
|
# re3
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master)
|
[![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg/branch/master?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master)
|
||||||
<a href="https://discord.gg/jYpXxTm"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
<a href="https://discord.gg/jYpXxTm"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
||||||
| Platform | Debug | Release |
|
| Platform | Debug | Release |
|
||||||
|------------------|-------------|-------------|
|
|------------------|-------------|-------------|
|
||||||
|
50
premake5.lua
50
premake5.lua
@ -103,6 +103,10 @@ project "librw"
|
|||||||
filter {}
|
filter {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function addSrcFiles( prefix )
|
||||||
|
return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.aps", prefix .. "/*.rc"
|
||||||
|
end
|
||||||
|
|
||||||
project "re3"
|
project "re3"
|
||||||
kind "WindowedApp"
|
kind "WindowedApp"
|
||||||
targetname "re3"
|
targetname "re3"
|
||||||
@ -112,27 +116,29 @@ project "re3"
|
|||||||
linkoptions "/SAFESEH:NO"
|
linkoptions "/SAFESEH:NO"
|
||||||
|
|
||||||
|
|
||||||
files { "src/*.*" }
|
files { addSrcFiles("src") }
|
||||||
files { "src/animation/*.*" }
|
files { addSrcFiles("src/animation") }
|
||||||
files { "src/audio/*.*" }
|
files { addSrcFiles("src/audio") }
|
||||||
files { "src/control/*.*" }
|
--files { addSrcFiles("src/audio/miles") }
|
||||||
files { "src/core/*.*" }
|
--files { addSrcFiles("src/audio/openal") }
|
||||||
files { "src/entities/*.*" }
|
files { addSrcFiles("src/control") }
|
||||||
files { "src/math/*.*" }
|
files { addSrcFiles("src/core") }
|
||||||
files { "src/modelinfo/*.*" }
|
files { addSrcFiles("src/entities") }
|
||||||
files { "src/objects/*.*" }
|
files { addSrcFiles("src/math") }
|
||||||
files { "src/peds/*.*" }
|
files { addSrcFiles("src/modelinfo") }
|
||||||
files { "src/render/*.*" }
|
files { addSrcFiles("src/objects") }
|
||||||
files { "src/rw/*.*" }
|
files { addSrcFiles("src/peds") }
|
||||||
files { "src/save/*.*" }
|
files { addSrcFiles("src/render") }
|
||||||
files { "src/skel/*.*" }
|
files { addSrcFiles("src/rw") }
|
||||||
files { "src/skel/win/*.*" }
|
files { addSrcFiles("src/save") }
|
||||||
files { "src/skel/glfw/*.*" }
|
files { addSrcFiles("src/skel") }
|
||||||
files { "src/text/*.*" }
|
files { addSrcFiles("src/skel/win") }
|
||||||
files { "src/vehicles/*.*" }
|
files { addSrcFiles("src/skel/glfw") }
|
||||||
files { "src/weapons/*.*" }
|
files { addSrcFiles("src/text") }
|
||||||
files { "src/extras/*.*" }
|
files { addSrcFiles("src/vehicles") }
|
||||||
files { "eax/*.*" }
|
files { addSrcFiles("src/weapons") }
|
||||||
|
files { addSrcFiles("src/extras") }
|
||||||
|
files { addSrcFiles("eax") }
|
||||||
|
|
||||||
includedirs { "src" }
|
includedirs { "src" }
|
||||||
includedirs { "src/animation" }
|
includedirs { "src/animation" }
|
||||||
@ -173,7 +179,7 @@ project "re3"
|
|||||||
|
|
||||||
filter "platforms:*librw*"
|
filter "platforms:*librw*"
|
||||||
defines { "LIBRW" }
|
defines { "LIBRW" }
|
||||||
files { "src/fakerw/*.*" }
|
files { addSrcFiles("src/fakerw") }
|
||||||
includedirs { "src/fakerw" }
|
includedirs { "src/fakerw" }
|
||||||
includedirs { Librw }
|
includedirs { Librw }
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
|
@ -23,7 +23,6 @@ uint32 CBridge::TimeOfBridgeBecomingOperational;
|
|||||||
|
|
||||||
void CBridge::Init()
|
void CBridge::Init()
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
FindBridgeEntities();
|
FindBridgeEntities();
|
||||||
OldLift = -1.0f;
|
OldLift = -1.0f;
|
||||||
if (pLiftPart && pWeight)
|
if (pLiftPart && pWeight)
|
||||||
@ -36,12 +35,10 @@ void CBridge::Init()
|
|||||||
|
|
||||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBridge::Update()
|
void CBridge::Update()
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
if (!pLiftPart || !pWeight)
|
if (!pLiftPart || !pWeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -116,21 +113,15 @@ void CBridge::Update()
|
|||||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
||||||
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
|
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
|
||||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
|
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBridge::ShouldLightsBeFlashing()
|
bool CBridge::ShouldLightsBeFlashing()
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
return State != STATE_LIFT_PART_IS_DOWN;
|
return State != STATE_LIFT_PART_IS_DOWN;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBridge::FindBridgeEntities()
|
void CBridge::FindBridgeEntities()
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
pWeight = nil;
|
pWeight = nil;
|
||||||
pLiftRoad = nil;
|
pLiftRoad = nil;
|
||||||
pLiftPart = nil;
|
pLiftPart = nil;
|
||||||
@ -147,17 +138,12 @@ void CBridge::FindBridgeEntities()
|
|||||||
pWeight = entry;
|
pWeight = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBridge::ThisIsABridgeObjectMovingUp(int index)
|
bool CBridge::ThisIsABridgeObjectMovingUp(int index)
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
if (index != MI_BRIDGEROADSEGMENT && index != MI_BRIDGELIFT)
|
if (index != MI_BRIDGEROADSEGMENT && index != MI_BRIDGELIFT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP;
|
return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -696,7 +696,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||||||
if (pVehicle->bExtendedRange)
|
if (pVehicle->bExtendedRange)
|
||||||
threshold *= 1.5f;
|
threshold *= 1.5f;
|
||||||
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
||||||
if (pVehicle->GetIsOnScreenAndNotCulled()){
|
if (pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)) {
|
||||||
pVehicle->bFadeOut = true;
|
pVehicle->bFadeOut = true;
|
||||||
}else{
|
}else{
|
||||||
CWorld::Remove(pVehicle);
|
CWorld::Remove(pVehicle);
|
||||||
@ -722,7 +722,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||||||
if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
|
if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
|
||||||
return;
|
return;
|
||||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
||||||
!pVehicle->GetIsOnScreenAndNotCulled()){
|
!(pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)) ){
|
||||||
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
|
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
|
||||||
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
||||||
CWorld::Remove(pVehicle);
|
CWorld::Remove(pVehicle);
|
||||||
@ -2741,11 +2741,7 @@ bool CCarCtrl::ThisRoadObjectCouldMove(int16 mi)
|
|||||||
|
|
||||||
bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
|
bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE // actually they forgot that in VC...
|
|
||||||
// bridge moves up and down
|
// bridge moves up and down
|
||||||
return x > -342.0f && x < -219.0f &&
|
return x > -342.0f && x < -219.0f &&
|
||||||
y > -677.0f && y < -580.0f;
|
y > -677.0f && y < -580.0f;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,6 @@ CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
void
|
void
|
||||||
CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool enable)
|
CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool enable)
|
||||||
{
|
{
|
||||||
@ -987,7 +986,6 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
|
|||||||
m_carPathLinks[i].bBridgeLights = enable;
|
m_carPathLinks[i].bBridgeLights = enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
||||||
|
@ -273,12 +273,8 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
|||||||
bool
|
bool
|
||||||
CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
|
CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
|
||||||
{
|
{
|
||||||
#ifdef GTA_BRIDGE
|
|
||||||
return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
|
return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
|
||||||
!ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
|
!ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -633,11 +633,7 @@ CCamera::CamControl(void)
|
|||||||
m_bInitialNodeFound = false;
|
m_bInitialNodeFound = false;
|
||||||
m_bInitialNoNodeStaticsSet = false;
|
m_bInitialNoNodeStaticsSet = false;
|
||||||
}
|
}
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
Process_Train_Camera_Control();
|
Process_Train_Camera_Control();
|
||||||
#else
|
|
||||||
assert(0 && "this can't happen");
|
|
||||||
#endif
|
|
||||||
}else{
|
}else{
|
||||||
if(((CVehicle*)pTargetEntity)->IsBoat())
|
if(((CVehicle*)pTargetEntity)->IsBoat())
|
||||||
boatTarget = true;
|
boatTarget = true;
|
||||||
@ -2711,7 +2707,6 @@ CCamera::DontProcessObbeCinemaCamera(void)
|
|||||||
bDidWeProcessAnyCinemaCam = false;
|
bDidWeProcessAnyCinemaCam = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
void
|
void
|
||||||
CCamera::LoadTrainCamNodes(char const *name)
|
CCamera::LoadTrainCamNodes(char const *name)
|
||||||
{
|
{
|
||||||
@ -2889,7 +2884,6 @@ CCamera::Process_Train_Camera_Control(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,231 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#ifdef MIAMI
|
|
||||||
|
|
||||||
#include "templates.h"
|
|
||||||
#include "General.h"
|
|
||||||
#include "ModelInfo.h"
|
|
||||||
#include "Streaming.h"
|
|
||||||
#include "FileLoader.h"
|
|
||||||
#include "Script.h"
|
|
||||||
#include "Timer.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "Frontend.h"
|
|
||||||
#include "ColStore.h"
|
|
||||||
|
|
||||||
CPool<ColDef,ColDef> *CColStore::ms_pColPool;
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::Initialise(void)
|
|
||||||
{
|
|
||||||
if(ms_pColPool == nil)
|
|
||||||
ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles");
|
|
||||||
AddColSlot("generic"); // slot 0. not streamed
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::Shutdown(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < COLSTORESIZE; i++)
|
|
||||||
RemoveColSlot(i);
|
|
||||||
if(ms_pColPool)
|
|
||||||
delete ms_pColPool;
|
|
||||||
ms_pColPool = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
CColStore::AddColSlot(const char *name)
|
|
||||||
{
|
|
||||||
ColDef *def = ms_pColPool->New();
|
|
||||||
assert(def);
|
|
||||||
def->isLoaded = false;
|
|
||||||
def->a = 0;
|
|
||||||
def->bounds.left = 1000000.0f;
|
|
||||||
def->bounds.top = 1000000.0f;
|
|
||||||
def->bounds.right = -1000000.0f;
|
|
||||||
def->bounds.bottom = -1000000.0f;
|
|
||||||
def->minIndex = INT16_MAX;
|
|
||||||
def->maxIndex = INT16_MIN;
|
|
||||||
strcpy(def->name, name);
|
|
||||||
return ms_pColPool->GetJustIndex(def);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::RemoveColSlot(int slot)
|
|
||||||
{
|
|
||||||
if(GetSlot(slot)){
|
|
||||||
if(GetSlot(slot)->isLoaded)
|
|
||||||
RemoveCol(slot);
|
|
||||||
ms_pColPool->Delete(GetSlot(slot));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
CColStore::FindColSlot(const char *name)
|
|
||||||
{
|
|
||||||
ColDef *def;
|
|
||||||
int size = ms_pColPool->GetSize();
|
|
||||||
for(int i = 0; i < size; i++){
|
|
||||||
def = GetSlot(i);
|
|
||||||
if(def && !CGeneral::faststricmp(def->name, name))
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
char*
|
|
||||||
CColStore::GetColName(int32 slot)
|
|
||||||
{
|
|
||||||
return GetSlot(slot)->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
CRect&
|
|
||||||
CColStore::GetBoundingBox(int32 slot)
|
|
||||||
{
|
|
||||||
return GetSlot(slot)->bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::IncludeModelIndex(int32 slot, int32 modelIndex)
|
|
||||||
{
|
|
||||||
ColDef *def = GetSlot(slot);
|
|
||||||
if(modelIndex < def->minIndex)
|
|
||||||
def->minIndex = modelIndex;
|
|
||||||
if(modelIndex > def->maxIndex)
|
|
||||||
def->maxIndex = modelIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
CColStore::LoadCol(int32 slot, uint8 *buffer, int32 bufsize)
|
|
||||||
{
|
|
||||||
bool success;
|
|
||||||
ColDef *def = GetSlot(slot);
|
|
||||||
if(def->minIndex > def->maxIndex)
|
|
||||||
success = CFileLoader::LoadCollisionFileFirstTime(buffer, bufsize, slot);
|
|
||||||
else
|
|
||||||
success = CFileLoader::LoadCollisionFile(buffer, bufsize, slot);
|
|
||||||
if(success)
|
|
||||||
def->isLoaded = true;
|
|
||||||
else
|
|
||||||
debug("Failed to load Collision\n");
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::RemoveCol(int32 slot)
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
GetSlot(slot)->isLoaded = false;
|
|
||||||
for(id = 0; id < MODELINFOSIZE; id++){
|
|
||||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(id);
|
|
||||||
if(mi){
|
|
||||||
CColModel *col = mi->GetColModel();
|
|
||||||
if(col && col->level == slot)
|
|
||||||
col->RemoveCollisionVolumes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::LoadAllCollision(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++)
|
|
||||||
if(GetSlot(i))
|
|
||||||
CStreaming::RequestCol(i, 0);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::RemoveAllCollision(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++)
|
|
||||||
if(GetSlot(i))
|
|
||||||
if(CStreaming::CanRemoveCol(i))
|
|
||||||
CStreaming::RemoveCol(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool bLoadAtSecondPosition;
|
|
||||||
static CVector2D secondPosition;
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::AddCollisionNeededAtPosn(const CVector2D &pos)
|
|
||||||
{
|
|
||||||
bLoadAtSecondPosition = true;
|
|
||||||
secondPosition = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::LoadCollision(const CVector2D &pos)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(CStreaming::ms_disableStreaming)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++){
|
|
||||||
if(GetSlot(i) == nil)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool wantThisOne = false;
|
|
||||||
|
|
||||||
if(GetBoundingBox(i).IsPointInside(pos) ||
|
|
||||||
bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) ||
|
|
||||||
CGeneral::faststrcmp(GetColName(i), "yacht") == 0){
|
|
||||||
wantThisOne = true;
|
|
||||||
}else{
|
|
||||||
// TODO: check mission cleanup list
|
|
||||||
}
|
|
||||||
|
|
||||||
if(wantThisOne)
|
|
||||||
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
|
|
||||||
else
|
|
||||||
CStreaming::RemoveCol(i);
|
|
||||||
}
|
|
||||||
bLoadAtSecondPosition = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::RequestCollision(const CVector2D &pos)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++)
|
|
||||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f))
|
|
||||||
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(CStreaming::ms_disableStreaming)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++)
|
|
||||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) &&
|
|
||||||
!CStreaming::HasColLoaded(i)){
|
|
||||||
CStreaming::RequestCol(i, 0);
|
|
||||||
if(TheCamera.GetScreenFadeStatus() == FADE_0)
|
|
||||||
FrontEndMenuManager.MessageScreen("LOADCOL", false);
|
|
||||||
CTimer::Suspend();
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
CTimer::Resume();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
CColStore::HasCollisionLoaded(const CVector2D &pos)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 1; i < COLSTORESIZE; i++)
|
|
||||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) &&
|
|
||||||
!GetSlot(i)->isLoaded)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,43 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "templates.h"
|
|
||||||
|
|
||||||
struct ColDef { // made up name
|
|
||||||
int32 a;
|
|
||||||
bool isLoaded;
|
|
||||||
CRect bounds;
|
|
||||||
char name[20];
|
|
||||||
int16 minIndex;
|
|
||||||
int16 maxIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CColStore
|
|
||||||
{
|
|
||||||
static CPool<ColDef,ColDef> *ms_pColPool;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void Initialise(void);
|
|
||||||
static void Shutdown(void);
|
|
||||||
static int AddColSlot(const char *name);
|
|
||||||
static void RemoveColSlot(int32 slot);
|
|
||||||
static int FindColSlot(const char *name);
|
|
||||||
static char *GetColName(int32 slot);
|
|
||||||
static CRect &GetBoundingBox(int32 slot);
|
|
||||||
static void IncludeModelIndex(int32 slot, int32 modelIndex);
|
|
||||||
static bool LoadCol(int32 storeID, uint8 *buffer, int32 bufsize);
|
|
||||||
static void RemoveCol(int32 slot);
|
|
||||||
static void AddCollisionNeededAtPosn(const CVector2D &pos);
|
|
||||||
static void LoadAllCollision(void);
|
|
||||||
static void RemoveAllCollision(void);
|
|
||||||
static void LoadCollision(const CVector2D &pos);
|
|
||||||
static void RequestCollision(const CVector2D &pos);
|
|
||||||
static void EnsureCollisionIsInMemory(const CVector2D &pos);
|
|
||||||
static bool HasCollisionLoaded(const CVector2D &pos);
|
|
||||||
|
|
||||||
static ColDef *GetSlot(int slot) {
|
|
||||||
assert(slot >= 0);
|
|
||||||
assert(ms_pColPool);
|
|
||||||
assert(slot < ms_pColPool->GetSize());
|
|
||||||
return ms_pColPool->GetSlot(slot);
|
|
||||||
}
|
|
||||||
};
|
|
@ -370,9 +370,7 @@ bool CGame::Initialise(const char* datFile)
|
|||||||
LoadingScreen("Loading the Game", "Position dynamic objects", nil);
|
LoadingScreen("Loading the Game", "Position dynamic objects", nil);
|
||||||
CWorld::RepositionCertainDynamicObjects();
|
CWorld::RepositionCertainDynamicObjects();
|
||||||
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
|
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
CCullZones::ResolveVisibilities();
|
CCullZones::ResolveVisibilities();
|
||||||
#endif
|
|
||||||
CTrain::InitTrains();
|
CTrain::InitTrains();
|
||||||
CPlane::InitPlanes();
|
CPlane::InitPlanes();
|
||||||
CCredits::Init();
|
CCredits::Init();
|
||||||
@ -489,9 +487,7 @@ void CGame::ReInitGameObjectVariables(void)
|
|||||||
CSpecialFX::Init();
|
CSpecialFX::Init();
|
||||||
CWaterCannons::Init();
|
CWaterCannons::Init();
|
||||||
CParticle::ReloadConfig();
|
CParticle::ReloadConfig();
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
CCullZones::ResolveVisibilities();
|
CCullZones::ResolveVisibilities();
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( !FrontEndMenuManager.m_bWantToLoad )
|
if ( !FrontEndMenuManager.m_bWantToLoad )
|
||||||
{
|
{
|
||||||
@ -524,9 +520,7 @@ void CGame::ReloadIPLs(void)
|
|||||||
CCranes::InitCranes();
|
CCranes::InitCranes();
|
||||||
CGarages::Init();
|
CGarages::Init();
|
||||||
CWorld::RepositionCertainDynamicObjects();
|
CWorld::RepositionCertainDynamicObjects();
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
CCullZones::ResolveVisibilities();
|
CCullZones::ResolveVisibilities();
|
||||||
#endif
|
|
||||||
CRenderer::SortBIGBuildings();
|
CRenderer::SortBIGBuildings();
|
||||||
CTimer::Update();
|
CTimer::Update();
|
||||||
}
|
}
|
||||||
|
@ -1982,9 +1982,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
|
|||||||
if(xmin < pos.x && pos.x < xmax &&
|
if(xmin < pos.x && pos.x < xmax &&
|
||||||
ymin < pos.y && pos.y < ymax &&
|
ymin < pos.y && pos.y < ymax &&
|
||||||
(CVector2D(x, y) - pos).MagnitudeSqr() < lodDistSq)
|
(CVector2D(x, y) - pos).MagnitudeSqr() < lodDistSq)
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if(CRenderer::IsEntityCullZoneVisible(e))
|
if(CRenderer::IsEntityCullZoneVisible(e))
|
||||||
#endif
|
|
||||||
RequestModel(e->GetModelIndex(), 0);
|
RequestModel(e->GetModelIndex(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2008,9 +2006,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list)
|
|||||||
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
|
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
|
||||||
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
||||||
if (mi->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff()))
|
if (mi->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff()))
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if(CRenderer::IsEntityCullZoneVisible(e))
|
if(CRenderer::IsEntityCullZoneVisible(e))
|
||||||
#endif
|
|
||||||
RequestModel(e->GetModelIndex(), 0);
|
RequestModel(e->GetModelIndex(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2434,9 +2430,7 @@ CStreaming::LoadScene(const CVector &pos)
|
|||||||
RemoveModel(si - ms_aInfoForModel);
|
RemoveModel(si - ms_aInfoForModel);
|
||||||
}
|
}
|
||||||
CRenderer::m_loadingPriority = false;
|
CRenderer::m_loadingPriority = false;
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
CCullZones::ForceCullZoneCoors(pos);
|
CCullZones::ForceCullZoneCoors(pos);
|
||||||
#endif
|
|
||||||
DeleteAllRwObjects();
|
DeleteAllRwObjects();
|
||||||
AddModelsToRequestList(pos);
|
AddModelsToRequestList(pos);
|
||||||
CRadar::StreamRadarSections(pos);
|
CRadar::StreamRadarSections(pos);
|
||||||
|
@ -38,7 +38,6 @@ CCullZones::Init(void)
|
|||||||
CurrentFlags_Camera = 0;
|
CurrentFlags_Camera = 0;
|
||||||
CurrentFlags_Player = 0;
|
CurrentFlags_Player = 0;
|
||||||
bCurrentSubwayIsInvisible = false;
|
bCurrentSubwayIsInvisible = false;
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
NumCullZones = 0;
|
NumCullZones = 0;
|
||||||
OldCullZone = -1;
|
OldCullZone = -1;
|
||||||
EntityIndicesUsed = 0;
|
EntityIndicesUsed = 0;
|
||||||
@ -47,10 +46,8 @@ CCullZones::Init(void)
|
|||||||
aPointersToBigBuildingsForBuildings[i] = -1;
|
aPointersToBigBuildingsForBuildings[i] = -1;
|
||||||
for(i = 0; i < NUMTREADABLES; i++)
|
for(i = 0; i < NUMTREADABLES; i++)
|
||||||
aPointersToBigBuildingsForTreadables[i] = -1;
|
aPointersToBigBuildingsForTreadables[i] = -1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
bool CCullZone::TestLine(CVector vec1, CVector vec2)
|
bool CCullZone::TestLine(CVector vec1, CVector vec2)
|
||||||
{
|
{
|
||||||
CColPoint colPoint;
|
CColPoint colPoint;
|
||||||
@ -216,7 +213,6 @@ CCullZones::DoVisibilityTestCullZone(int zoneId, bool doIt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CCullZones::Update(void)
|
CCullZones::Update(void)
|
||||||
@ -229,10 +225,8 @@ CCullZones::Update(void)
|
|||||||
switch(CTimer::GetFrameCounter() & 7){
|
switch(CTimer::GetFrameCounter() & 7){
|
||||||
case 0:
|
case 0:
|
||||||
case 4:
|
case 4:
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
/* Update Cull zone */
|
/* Update Cull zone */
|
||||||
ForceCullZoneCoors(TheCamera.GetGameCamPosition());
|
ForceCullZoneCoors(TheCamera.GetGameCamPosition());
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
@ -256,7 +250,6 @@ CCullZones::Update(void)
|
|||||||
void
|
void
|
||||||
CCullZones::ForceCullZoneCoors(CVector coors)
|
CCullZones::ForceCullZoneCoors(CVector coors)
|
||||||
{
|
{
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
int32 z;
|
int32 z;
|
||||||
z = FindCullZoneForCoors(coors);
|
z = FindCullZoneForCoors(coors);
|
||||||
if(z != OldCullZone){
|
if(z != OldCullZone){
|
||||||
@ -266,10 +259,8 @@ CCullZones::ForceCullZoneCoors(CVector coors)
|
|||||||
aZones[z].DoStuffEnteringZone();
|
aZones[z].DoStuffEnteringZone();
|
||||||
OldCullZone = z;
|
OldCullZone = z;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
int32
|
int32
|
||||||
CCullZones::FindCullZoneForCoors(CVector coors)
|
CCullZones::FindCullZoneForCoors(CVector coors)
|
||||||
{
|
{
|
||||||
@ -282,7 +273,6 @@ CCullZones::FindCullZoneForCoors(CVector coors)
|
|||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel)
|
CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel)
|
||||||
@ -360,7 +350,6 @@ CCullZones::AddCullZone(CVector const &position,
|
|||||||
CAttributeZone *attrib;
|
CAttributeZone *attrib;
|
||||||
|
|
||||||
CVector v;
|
CVector v;
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if((flag & ATTRZONE_NOTCULLZONE) == 0){
|
if((flag & ATTRZONE_NOTCULLZONE) == 0){
|
||||||
cull = &aZones[NumCullZones++];
|
cull = &aZones[NumCullZones++];
|
||||||
v = position;
|
v = position;
|
||||||
@ -383,7 +372,6 @@ CCullZones::AddCullZone(CVector const &position,
|
|||||||
cull->m_groupIndexCount[2] = 0;
|
cull->m_groupIndexCount[2] = 0;
|
||||||
cull->m_indexStart = 0;
|
cull->m_indexStart = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if(flag & ~ATTRZONE_NOTCULLZONE){
|
if(flag & ~ATTRZONE_NOTCULLZONE){
|
||||||
attrib = &aAttributeZones[NumAttributeZones++];
|
attrib = &aAttributeZones[NumAttributeZones++];
|
||||||
attrib->minx = minx;
|
attrib->minx = minx;
|
||||||
@ -398,7 +386,6 @@ CCullZones::AddCullZone(CVector const &position,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
void
|
void
|
||||||
CCullZone::DoStuffLeavingZone(void)
|
CCullZone::DoStuffLeavingZone(void)
|
||||||
{
|
{
|
||||||
@ -574,4 +561,3 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
@ -143,12 +143,6 @@ enum Config {
|
|||||||
//#define GTA_PS2
|
//#define GTA_PS2
|
||||||
//#define GTA_XBOX
|
//#define GTA_XBOX
|
||||||
|
|
||||||
#ifndef MIAMI
|
|
||||||
#define GTA_TRAIN // This game has trains
|
|
||||||
#define GTA_BRIDGE // This game has the bridge
|
|
||||||
#define GTA_ZONECULL // This game culls by zones
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This enables things from the PS2 version on PC
|
// This enables things from the PS2 version on PC
|
||||||
#define GTA_PS2_STUFF
|
#define GTA_PS2_STUFF
|
||||||
|
|
||||||
|
@ -60,10 +60,8 @@ CEntity::CEntity(void)
|
|||||||
bMeleeProof = false;
|
bMeleeProof = false;
|
||||||
bOnlyDamagedByPlayer = false;
|
bOnlyDamagedByPlayer = false;
|
||||||
bStreamingDontDelete = false;
|
bStreamingDontDelete = false;
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
bZoneCulled = false;
|
bZoneCulled = false;
|
||||||
bZoneCulled2 = false;
|
bZoneCulled2 = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
bRemoveFromWorld = false;
|
bRemoveFromWorld = false;
|
||||||
bHasHitWall = false;
|
bHasHitWall = false;
|
||||||
@ -150,17 +148,6 @@ CEntity::GetIsOnScreenComplex(void)
|
|||||||
return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix());
|
return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
CEntity::GetIsOnScreenAndNotCulled(void)
|
|
||||||
{
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
return GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this);
|
|
||||||
#else
|
|
||||||
return GetIsOnScreen();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CEntity::Add(void)
|
CEntity::Add(void)
|
||||||
{
|
{
|
||||||
@ -967,10 +954,8 @@ CEntity::SaveEntityFlags(uint8*& buf)
|
|||||||
if (bMeleeProof) tmp |= BIT(27);
|
if (bMeleeProof) tmp |= BIT(27);
|
||||||
if (bOnlyDamagedByPlayer) tmp |= BIT(28);
|
if (bOnlyDamagedByPlayer) tmp |= BIT(28);
|
||||||
if (bStreamingDontDelete) tmp |= BIT(29);
|
if (bStreamingDontDelete) tmp |= BIT(29);
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if (bZoneCulled) tmp |= BIT(30);
|
if (bZoneCulled) tmp |= BIT(30);
|
||||||
if (bZoneCulled2) tmp |= BIT(31);
|
if (bZoneCulled2) tmp |= BIT(31);
|
||||||
#endif
|
|
||||||
|
|
||||||
WriteSaveBuf<uint32>(buf, tmp);
|
WriteSaveBuf<uint32>(buf, tmp);
|
||||||
|
|
||||||
@ -1022,10 +1007,8 @@ CEntity::LoadEntityFlags(uint8*& buf)
|
|||||||
bMeleeProof = !!(tmp & BIT(27));
|
bMeleeProof = !!(tmp & BIT(27));
|
||||||
bOnlyDamagedByPlayer = !!(tmp & BIT(28));
|
bOnlyDamagedByPlayer = !!(tmp & BIT(28));
|
||||||
bStreamingDontDelete = !!(tmp & BIT(29));
|
bStreamingDontDelete = !!(tmp & BIT(29));
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
bZoneCulled = !!(tmp & BIT(30));
|
bZoneCulled = !!(tmp & BIT(30));
|
||||||
bZoneCulled2 = !!(tmp & BIT(31));
|
bZoneCulled2 = !!(tmp & BIT(31));
|
||||||
#endif
|
|
||||||
|
|
||||||
tmp = ReadSaveBuf<uint32>(buf);
|
tmp = ReadSaveBuf<uint32>(buf);
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@ public:
|
|||||||
uint32 bMeleeProof : 1;
|
uint32 bMeleeProof : 1;
|
||||||
uint32 bOnlyDamagedByPlayer : 1;
|
uint32 bOnlyDamagedByPlayer : 1;
|
||||||
uint32 bStreamingDontDelete : 1; // Dont let the streaming remove this
|
uint32 bStreamingDontDelete : 1; // Dont let the streaming remove this
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
uint32 bZoneCulled : 1;
|
uint32 bZoneCulled : 1;
|
||||||
uint32 bZoneCulled2 : 1; // only treadables+10m
|
uint32 bZoneCulled2 : 1; // only treadables+10m
|
||||||
#endif
|
|
||||||
|
|
||||||
// flagsD
|
// flagsD
|
||||||
uint32 bRemoveFromWorld : 1; // remove this entity next time it should be processed
|
uint32 bRemoveFromWorld : 1; // remove this entity next time it should be processed
|
||||||
@ -148,7 +146,6 @@ public:
|
|||||||
bool GetIsTouching(CVector const ¢er, float r);
|
bool GetIsTouching(CVector const ¢er, float r);
|
||||||
bool GetIsOnScreen(void);
|
bool GetIsOnScreen(void);
|
||||||
bool GetIsOnScreenComplex(void);
|
bool GetIsOnScreenComplex(void);
|
||||||
bool GetIsOnScreenAndNotCulled(void);
|
|
||||||
bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); }
|
bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); }
|
||||||
bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); }
|
bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); }
|
||||||
int16 GetModelIndex(void) const { return m_modelIndex; }
|
int16 GetModelIndex(void) const { return m_modelIndex; }
|
||||||
|
@ -709,7 +709,7 @@ CCopPed::ProcessControl(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bool dontShoot = false;
|
bool dontShoot = false;
|
||||||
if (GetIsOnScreenAndNotCulled()) {
|
if (GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this)) {
|
||||||
if (((CTimer::GetFrameCounter() + m_randomSeed) & 0x1F) == 17) {
|
if (((CTimer::GetFrameCounter() + m_randomSeed) & 0x1F) == 17) {
|
||||||
CEntity *foundBuilding = nil;
|
CEntity *foundBuilding = nil;
|
||||||
CColPoint foundCol;
|
CColPoint foundCol;
|
||||||
|
@ -972,9 +972,7 @@ CRenderer::ScanSectorList(CPtrList *lists)
|
|||||||
continue; // already seen
|
continue; // already seen
|
||||||
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if(IsEntityCullZoneVisible(ent))
|
if(IsEntityCullZoneVisible(ent))
|
||||||
#endif
|
|
||||||
switch(SetupEntityVisibility(ent)){
|
switch(SetupEntityVisibility(ent)){
|
||||||
case VIS_VISIBLE:
|
case VIS_VISIBLE:
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
||||||
@ -997,14 +995,12 @@ CRenderer::ScanSectorList(CPtrList *lists)
|
|||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
|
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
|
||||||
if(!CStreaming::ms_disableStreaming)
|
if(!CStreaming::ms_disableStreaming)
|
||||||
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
||||||
if(!m_loadingPriority || CStreaming::ms_numModelsRequested < 10)
|
if(!m_loadingPriority || CStreaming::ms_numModelsRequested < 10)
|
||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1026,9 +1022,7 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
|
|||||||
continue; // already seen
|
continue; // already seen
|
||||||
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if(IsEntityCullZoneVisible(ent))
|
if(IsEntityCullZoneVisible(ent))
|
||||||
#endif
|
|
||||||
switch(SetupEntityVisibility(ent)){
|
switch(SetupEntityVisibility(ent)){
|
||||||
case VIS_VISIBLE:
|
case VIS_VISIBLE:
|
||||||
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
|
||||||
@ -1053,13 +1047,11 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
|
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
|
||||||
if(!CStreaming::ms_disableStreaming)
|
if(!CStreaming::ms_disableStreaming)
|
||||||
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
if(SetupEntityVisibility(ent) == VIS_STREAMME)
|
||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1112,9 +1104,7 @@ CRenderer::ScanSectorList_RequestModels(CPtrList *lists)
|
|||||||
if(ent->m_scanCode == CWorld::GetCurrentScanCode())
|
if(ent->m_scanCode == CWorld::GetCurrentScanCode())
|
||||||
continue; // already seen
|
continue; // already seen
|
||||||
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
ent->m_scanCode = CWorld::GetCurrentScanCode();
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
if(IsEntityCullZoneVisible(ent))
|
if(IsEntityCullZoneVisible(ent))
|
||||||
#endif
|
|
||||||
if(ShouldModelBeStreamed(ent))
|
if(ShouldModelBeStreamed(ent))
|
||||||
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
CStreaming::RequestModel(ent->GetModelIndex(), 0);
|
||||||
}
|
}
|
||||||
@ -1160,7 +1150,6 @@ CRenderer::ShouldModelBeStreamed(CEntity *ent)
|
|||||||
return dist - FADE_DISTANCE - STREAM_DISTANCE < mi->GetLargestLodDistance();
|
return dist - FADE_DISTANCE - STREAM_DISTANCE < mi->GetLargestLodDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
bool
|
bool
|
||||||
CRenderer::IsEntityCullZoneVisible(CEntity *ent)
|
CRenderer::IsEntityCullZoneVisible(CEntity *ent)
|
||||||
{
|
{
|
||||||
@ -1203,7 +1192,6 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent)
|
|||||||
return !(v->m_pCurGroundEntity && v->m_pCurGroundEntity->bZoneCulled2);
|
return !(v->m_pCurGroundEntity && v->m_pCurGroundEntity->bZoneCulled2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset)
|
CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset)
|
||||||
|
@ -64,10 +64,8 @@ public:
|
|||||||
static void SortBIGBuildingsForSectorList(CPtrList *list);
|
static void SortBIGBuildingsForSectorList(CPtrList *list);
|
||||||
|
|
||||||
static bool ShouldModelBeStreamed(CEntity *ent);
|
static bool ShouldModelBeStreamed(CEntity *ent);
|
||||||
#ifdef GTA_ZONECULL
|
|
||||||
static bool IsEntityCullZoneVisible(CEntity *ent);
|
static bool IsEntityCullZoneVisible(CEntity *ent);
|
||||||
static bool IsVehicleCullZoneVisible(CEntity *ent);
|
static bool IsVehicleCullZoneVisible(CEntity *ent);
|
||||||
#endif
|
|
||||||
|
|
||||||
static void RemoveVehiclePedLights(CEntity *ent, bool reset);
|
static void RemoveVehiclePedLights(CEntity *ent, bool reset);
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,6 @@ CVector CTrain::aStationCoors_S[4];
|
|||||||
CTrain::CTrain(int32 id, uint8 CreatedBy)
|
CTrain::CTrain(int32 id, uint8 CreatedBy)
|
||||||
: CVehicle(CreatedBy)
|
: CVehicle(CreatedBy)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
|
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
|
||||||
m_vehType = VEHICLE_TYPE_TRAIN;
|
m_vehType = VEHICLE_TYPE_TRAIN;
|
||||||
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
|
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
|
||||||
@ -61,28 +60,22 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
|
|||||||
|
|
||||||
bUsesCollision = true;
|
bUsesCollision = true;
|
||||||
SetStatus(STATUS_TRAIN_MOVING);
|
SetStatus(STATUS_TRAIN_MOVING);
|
||||||
#else
|
|
||||||
assert(0 && "No trains in this game");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::SetModelIndex(uint32 id)
|
CTrain::SetModelIndex(uint32 id)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CVehicle::SetModelIndex(id);
|
CVehicle::SetModelIndex(id);
|
||||||
for(i = 0; i < NUM_TRAIN_NODES; i++)
|
for(i = 0; i < NUM_TRAIN_NODES; i++)
|
||||||
m_aTrainNodes[i] = nil;
|
m_aTrainNodes[i] = nil;
|
||||||
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
|
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::ProcessControl(void)
|
CTrain::ProcessControl(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF)
|
if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -285,13 +278,11 @@ CTrain::ProcessControl(void)
|
|||||||
TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]);
|
TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif GTA_TRAIN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::PreRender(void)
|
CTrain::PreRender(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
||||||
|
|
||||||
if(m_bIsFirstWagon){
|
if(m_bIsFirstWagon){
|
||||||
@ -351,21 +342,17 @@ CTrain::PreRender(void)
|
|||||||
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::Render(void)
|
CTrain::Render(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
CEntity::Render();
|
CEntity::Render();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::TrainHitStuff(CPtrList &list)
|
CTrain::TrainHitStuff(CPtrList &list)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
CPtrNode *node;
|
CPtrNode *node;
|
||||||
CPhysical *phys;
|
CPhysical *phys;
|
||||||
|
|
||||||
@ -374,13 +361,11 @@ CTrain::TrainHitStuff(CPtrList &list)
|
|||||||
if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f)
|
if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f)
|
||||||
phys->bHitByTrain = true;
|
phys->bHitByTrain = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::AddPassenger(CPed *ped)
|
CTrain::AddPassenger(CPed *ped)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
int i = ped->m_vehEnterType;
|
int i = ped->m_vehEnterType;
|
||||||
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
|
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
|
||||||
pPassengers[i] = ped;
|
pPassengers[i] = ped;
|
||||||
@ -393,13 +378,11 @@ CTrain::AddPassenger(CPed *ped)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::OpenTrainDoor(float ratio)
|
CTrain::OpenTrainDoor(float ratio)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
if(m_rwObject == nil)
|
if(m_rwObject == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -424,7 +407,6 @@ CTrain::OpenTrainDoor(float ratio)
|
|||||||
|
|
||||||
doorL.UpdateRW();
|
doorL.UpdateRW();
|
||||||
doorR.UpdateRW();
|
doorR.UpdateRW();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -432,7 +414,6 @@ CTrain::OpenTrainDoor(float ratio)
|
|||||||
void
|
void
|
||||||
CTrain::InitTrains(void)
|
CTrain::InitTrains(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
int i, j;
|
int i, j;
|
||||||
CTrain *train;
|
CTrain *train;
|
||||||
|
|
||||||
@ -499,25 +480,21 @@ CTrain::InitTrains(void)
|
|||||||
for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++);
|
for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++);
|
||||||
aStationCoors_S[i] = pTrackNodes_S[j].p;
|
aStationCoors_S[i] = pTrackNodes_S[j].p;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::Shutdown(void)
|
CTrain::Shutdown(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
delete[] pTrackNodes;
|
delete[] pTrackNodes;
|
||||||
delete[] pTrackNodes_S;
|
delete[] pTrackNodes_S;
|
||||||
pTrackNodes = nil;
|
pTrackNodes = nil;
|
||||||
pTrackNodes_S = nil;
|
pTrackNodes_S = nil;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists,
|
CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists,
|
||||||
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail)
|
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
bool readingFile = false;
|
bool readingFile = false;
|
||||||
int bp, lp;
|
int bp, lp;
|
||||||
int i, tmp;
|
int i, tmp;
|
||||||
@ -639,7 +616,6 @@ CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *num
|
|||||||
|
|
||||||
// end
|
// end
|
||||||
interpLines[j].time = *totalDuration;
|
interpLines[j].time = *totalDuration;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -651,7 +627,6 @@ ProcessTrainAnnouncements(void)
|
|||||||
void
|
void
|
||||||
CTrain::UpdateTrains(void)
|
CTrain::UpdateTrains(void)
|
||||||
{
|
{
|
||||||
#ifdef GTA_TRAIN
|
|
||||||
int i, j;
|
int i, j;
|
||||||
uint32 time;
|
uint32 time;
|
||||||
float t, deltaT;
|
float t, deltaT;
|
||||||
@ -715,5 +690,4 @@ CTrain::UpdateTrains(void)
|
|||||||
// time offset for each train
|
// time offset for each train
|
||||||
time += 0x40000/4;
|
time += 0x40000/4;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user