mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 07:53:45 +00:00
lcs bridge
This commit is contained in:
parent
0c4ab5b609
commit
e6b1a0691b
6 changed files with 34 additions and 19 deletions
|
@ -7,6 +7,8 @@
|
|||
#include "PathFind.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
//--LCS: file done
|
||||
|
||||
void CAutoPilot::ModifySpeed(float speed)
|
||||
{
|
||||
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "PathFind.h"
|
||||
#include "Stats.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
CEntity *CBridge::pLiftRoad;
|
||||
CEntity *CBridge::pLiftPart;
|
||||
CEntity *CBridge::pWeight;
|
||||
|
@ -25,14 +27,14 @@ void CBridge::Init()
|
|||
{
|
||||
#ifdef GTA_BRIDGE
|
||||
FindBridgeEntities();
|
||||
State = STATE_BRIDGE_LOCKED;
|
||||
OldLift = -1.0f;
|
||||
if (pLiftPart && pWeight)
|
||||
{
|
||||
DefaultZLiftPart = pLiftPart->GetPosition().z;
|
||||
DefaultZLiftWeight = pWeight->GetPosition().z;
|
||||
|
||||
if (pLiftRoad)
|
||||
DefaultZLiftRoad = pLiftRoad->GetPosition().z;
|
||||
DefaultZLiftWeight = pWeight->GetPosition().z;
|
||||
|
||||
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
|
||||
}
|
||||
|
@ -49,36 +51,42 @@ void CBridge::Update()
|
|||
|
||||
float liftHeight;
|
||||
|
||||
// Set bridge height and state
|
||||
if (CStats::CommercialPassed)
|
||||
{
|
||||
if (State == STATE_BRIDGE_LOCKED) {
|
||||
liftHeight = 25.0f;
|
||||
TimeOfBridgeBecomingOperational = 0;
|
||||
}
|
||||
else if (State == STATE_BRIDGE_ALWAYS_UNLOCKED) {
|
||||
liftHeight = 0.0f;
|
||||
TimeOfBridgeBecomingOperational = CTimer::GetTimeInMilliseconds() - 20001;
|
||||
}
|
||||
else {
|
||||
if (TimeOfBridgeBecomingOperational == 0)
|
||||
TimeOfBridgeBecomingOperational = CTimer::GetTimeInMilliseconds();
|
||||
|
||||
// Time remaining for bridge to become operational
|
||||
// uint16, so after about a minute it overflows to 0 and the cycle repeats
|
||||
uint16 timeElapsed = CTimer::GetTimeInMilliseconds() - TimeOfBridgeBecomingOperational;
|
||||
// this time cycle duration is 0x20000, so ~2:11
|
||||
uint32 timeElapsed = (CTimer::GetTimeInMilliseconds() - TimeOfBridgeBecomingOperational) % 0x20000;
|
||||
|
||||
// Calculate lift part height and bridge state
|
||||
if (timeElapsed < 10000)
|
||||
if (timeElapsed < 20000)
|
||||
{
|
||||
State = STATE_LIFT_PART_MOVING_DOWN;
|
||||
liftHeight = 25.0f - timeElapsed / 10000.0f * 25.0f;
|
||||
liftHeight = 25.0f - timeElapsed / 20000.0f * 25.0f;
|
||||
}
|
||||
else if (timeElapsed < 40000)
|
||||
else if (timeElapsed < 80000)
|
||||
{
|
||||
liftHeight = 0.0f;
|
||||
State = STATE_LIFT_PART_IS_DOWN;
|
||||
}
|
||||
else if (timeElapsed < 50000)
|
||||
else if (timeElapsed < 90000)
|
||||
{
|
||||
liftHeight = 0.0f;
|
||||
State = STATE_LIFT_PART_ABOUT_TO_MOVE_UP;
|
||||
}
|
||||
else if (timeElapsed < 60000)
|
||||
else if (timeElapsed < 110000)
|
||||
{
|
||||
State = STATE_LIFT_PART_MOVING_UP;
|
||||
liftHeight = (timeElapsed - 50000) / 10000.0f * 25.0f;
|
||||
liftHeight = (timeElapsed - 90000) / 20000.0f * 25.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,12 +94,7 @@ void CBridge::Update()
|
|||
State = STATE_LIFT_PART_IS_UP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
liftHeight = 25.0f;
|
||||
TimeOfBridgeBecomingOperational = 0;
|
||||
State = STATE_BRIDGE_LOCKED;
|
||||
}
|
||||
|
||||
|
||||
// Move bridge part
|
||||
if (liftHeight != OldLift)
|
||||
|
@ -112,6 +115,8 @@ void CBridge::Update()
|
|||
OldLift = liftHeight;
|
||||
}
|
||||
|
||||
// TODO(LCS): cWorldStream
|
||||
|
||||
if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
|
||||
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)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "World.h"
|
||||
#include "ZoneCull.h"
|
||||
|
||||
//--LCS: file done
|
||||
|
||||
#define DISTANCE_TO_SWITCH_DISTANCE_GOTO 20.0f
|
||||
|
||||
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "Zones.h"
|
||||
#include "Pickups.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
|
||||
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
|
||||
#define DISTANCE_TO_SCAN_FOR_PED_DANGER (11.0f)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "Curves.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
|
||||
{
|
||||
CVector2D dir1(dir1X, dir1Y);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "VarConsole.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
//--LCS: file done except TODO
|
||||
|
||||
#define ROTATED_DOOR_OPEN_SPEED (0.015f)
|
||||
#define ROTATED_DOOR_CLOSE_SPEED (0.02f)
|
||||
#define DEFAULT_DOOR_OPEN_SPEED (0.035f)
|
||||
|
|
Loading…
Reference in a new issue