small fixes

This commit is contained in:
aap 2020-05-25 20:36:18 +02:00
parent 52644192e3
commit 3c3b1aadc0
9 changed files with 33 additions and 28 deletions

View File

@ -33,22 +33,22 @@
CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60;
CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C;
CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64;
CPtrList CWorld::ms_bigBuildingsList[4];
CPtrList CWorld::ms_listMovingEntityPtrs;
CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];
uint16 CWorld::ms_nCurrentScanCode;
uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61;
uint8 CWorld::PlayerInFocus;
CPlayerInfo CWorld::Players[NUMPLAYERS];
bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC;
CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494;
bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F;
bool CWorld::bSecondShift;// = *(bool*)0x95CD54;
bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C;
bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B;
bool CWorld::bNoMoreCollisionTorque;
CEntity *CWorld::pIgnoreEntity;
bool CWorld::bIncludeDeadPeds;
bool CWorld::bSecondShift;
bool CWorld::bForceProcessControl;
bool CWorld::bProcessCutsceneOnly;
bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C;
bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA;
bool CWorld::bDoingCarCollisions;
bool CWorld::bIncludeCarTyres;
void
CWorld::Initialise()

View File

@ -63,7 +63,7 @@
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
PedAudioData CommentWaitTime[39] = {

View File

@ -506,18 +506,18 @@ CCoronas::DoSunAndMoon(void)
{
// yeah, moon is done somewhere else....
CVector sunCoors = CTimeCycle::GetSunPosition();
CVector sunCoors = CTimeCycle::GetSunDirection();
sunCoors *= 150.0f;
sunCoors += TheCamera.GetPosition();
if(CTimeCycle::GetSunPosition().z > -0.2f){
if(CTimeCycle::GetSunDirection().z > -0.2f){
float size = ((CGeneral::GetRandomNumber()&0xFF) * 0.005f + 10.0f) * CTimeCycle::GetSunSize();
RegisterCorona(SUN_CORE,
CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(),
255, sunCoors, size,
999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f);
if(CTimeCycle::GetSunPosition().z > 0.0f)
if(CTimeCycle::GetSunDirection().z > 0.0f)
RegisterCorona(SUN_CORONA,
CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(),
255, sunCoors, 25.0f * CTimeCycle::GetSunSize(),

View File

@ -642,12 +642,12 @@ CShadows::StoreShadowForPole(CEntity *pPole, float fOffsetX, float fOffsetY, flo
PolePos.y += fOffsetX * pPole->GetRight().y + fOffsetY * pPole->GetForward().y;
PolePos.z += fOffsetZ;
PolePos.x += -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2);
PolePos.y += -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2);
PolePos.x += -CTimeCycle::GetSunDirection().x * (fPoleHeight / 2);
PolePos.y += -CTimeCycle::GetSunDirection().y * (fPoleHeight / 2);
StoreStaticShadow((uintptr)pPole + nID + _TODOCONST(51), SHADOWTYPE_DARK, gpPostShadowTex, &PolePos,
-CTimeCycle::GetSunPosition().x * (fPoleHeight / 2),
-CTimeCycle::GetSunPosition().y * (fPoleHeight / 2),
-CTimeCycle::GetSunDirection().x * (fPoleHeight / 2),
-CTimeCycle::GetSunDirection().y * (fPoleHeight / 2),
CTimeCycle::GetShadowSideX() * fPoleWidth,
CTimeCycle::GetShadowSideY() * fPoleWidth,
2 * (int32)((pPole->GetUp().z - 0.5f) * CTimeCycle::GetShadowStrength() * 2.0f) / 3,

View File

@ -298,7 +298,7 @@ CTimeCycle::Update(void)
m_CurrentStoredValue = (m_CurrentStoredValue+1)&0xF;
float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60);
CVector &sunPos = GetSunPosition();
CVector &sunPos = GetSunDirection();
sunPos.x = Sin(sunAngle);
sunPos.y = 1.0f;
sunPos.z = 0.2f - Cos(sunAngle);

View File

@ -142,7 +142,7 @@ public:
static void Initialise(void);
static void Update(void);
static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; }
static CVector &GetSunDirection(void) { return m_VectorToSun[m_CurrentStoredValue]; }
static float GetShadowFrontX(void) { return m_fShadowFrontX[m_CurrentStoredValue]; }
static float GetShadowFrontY(void) { return m_fShadowFrontY[m_CurrentStoredValue]; }
static float GetShadowSideX(void) { return m_fShadowSideX[m_CurrentStoredValue]; }

View File

@ -4314,7 +4314,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
return object;
}
CColPoint spherepoints[MAX_COLLISION_POINTS];
static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
CObject*
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
@ -4434,7 +4434,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(),
this->GetMatrix(), *this->GetColModel(),
spherepoints, nil, nil) > 0)
aTempPedColPts, nil, nil) > 0)
obj->m_pCollidingEntity = this;
if(bRenderScorched)

View File

@ -570,7 +570,7 @@ CHeli::PreRender(void)
i = 0;
for(angle = 0.0f; angle < TWOPI; angle += TWOPI/32){
CVector pos(radius*Cos(angle), radius*Sin(angle), 0.0f);
CVector dir = pos*0.01f;
CVector dir = CVector(pos.x, pos.y, 1.0f)*0.01f;
pos += GetPosition();
if(CWorld::ProcessVerticalLine(pos, testLowZ, point, entity, true, false, false, false, true, false, nil))

View File

@ -466,6 +466,10 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
static bool bBraking;
static bool bDriving;
#ifdef FIX_BUGS
bAlreadySkidding = false;
#endif
// how much force we want to apply in these axes
float fwd = 0.0f;
float right = 0.0f;
@ -547,7 +551,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
}
}
if(sq(adhesion) < sq(right) + sq(fwd)){
float speedSq = sq(right) + sq(fwd);
if(sq(adhesion) < speedSq){
if(*wheelState != WHEEL_STATE_FIXED){
if(bDriving && contactSpeedFwd < 0.2f)
*wheelState = WHEEL_STATE_SPINNING;
@ -555,7 +560,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
*wheelState = WHEEL_STATE_SKIDDING;
}
float l = Sqrt(sq(right) + sq(fwd));
float l = Sqrt(speedSq);
float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss;
right *= adhesion * tractionLoss / l;
fwd *= adhesion * tractionLoss / l;