This commit is contained in:
Fire-Head 2019-07-24 20:30:09 +03:00
parent b4ecb3e3da
commit 0c0e564019
7 changed files with 20 additions and 41 deletions

View File

@ -441,7 +441,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson; static bool &m_bUseMouse3rdPerson;
CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; } inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; } CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
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);

View File

@ -501,7 +501,7 @@ void
DisplayGameDebugText() DisplayGameDebugText()
{ {
static bool bDisplayPosn = false; static bool bDisplayPosn = false;
static bool bDisplayRate = false; static bool bDisplayRate = false;
{ {
SETTWEAKPATH("GameDebugText"); SETTWEAKPATH("GameDebugText");

View File

@ -190,21 +190,6 @@ void CTweakVars::AddDBG(const char *path)
bAddTweakVarsNow = true; bAddTweakVarsNow = true;
} }
//inline DebugMenuEntry * DebugMenuAddVar (const char *path , name, ptr, trig, step, lowerBound, upperBound, const char **strings)
/*
inline DebugMenuEntry *
DebugMenuAddVar
(const char *path,
const char *name,
int8_t *ptr,
TriggerFunc triggerFunc,
int8_t step,
int8_t lowerBound,
int8_t upperBound,
const char **strings)
*/
void CTweakSwitch::AddDBG(const char *path) void CTweakSwitch::AddDBG(const char *path)
{ {
DebugMenuEntry *e = DebugMenuAddVar(m_pPath == NULL ? path : m_pPath, m_pVarName, (int32_t *)m_pIntVar, m_pFunc, 1, m_nMin, m_nMax, m_aStr); DebugMenuEntry *e = DebugMenuAddVar(m_pPath == NULL ? path : m_pPath, m_pVarName, (int32_t *)m_pIntVar, m_pFunc, 1, m_nMin, m_nMax, m_aStr);

View File

@ -405,7 +405,7 @@ CEntity::PreRender(void)
}else if(GetModelIndex() == MI_MISSILE){ }else if(GetModelIndex() == MI_MISSILE){
CVector pos = GetPosition(); CVector pos = GetPosition();
float flicker = (CGeneral::GetRandomNumber() & 0xF)/(float)0x10; float flicker = (CGeneral::GetRandomNumber() & 0xF)/(float)0x10;
CShadows::StoreShadowToBeRendered(SHADOWTYPE_2, CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE,
gpShadowExplosionTex, &pos, gpShadowExplosionTex, &pos,
8.0f, 0.0f, 0.0f, -8.0f, 8.0f, 0.0f, 0.0f, -8.0f,
255, 200.0f*flicker, 160.0f*flicker, 120.0f*flicker, 255, 200.0f*flicker, 160.0f*flicker, 120.0f*flicker,
@ -758,7 +758,7 @@ CEntity::ProcessLightsForEntity(void)
// Light shadow // Light shadow
if(effect->light.shadowRange != 0.0f){ if(effect->light.shadowRange != 0.0f){
if(lightOn){ if(lightOn){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_2, CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos, effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f, effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange, 0.0f, -effect->light.shadowRange,
@ -768,7 +768,7 @@ CEntity::ProcessLightsForEntity(void)
effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
15.0f, 1.0f, 40.0f, false, 0.0f); 15.0f, 1.0f, 40.0f, false, 0.0f);
}else if(lightFlickering){ }else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_2, CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos, effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f, effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange, 0.0f, -effect->light.shadowRange,

View File

@ -9,17 +9,12 @@
struct RwTexture; struct RwTexture;
class CEntity; class CEntity;
enum
{
SHADOWTYPE_2 = 2
};
enum eShadowType enum eShadowType
{ {
SHADOWTYPE_NONE = 0, SHADOWTYPE_NONE = 0,
SHADOWTYPE_DARK, SHADOWTYPE_DARK,
SHADOWTYPE_ADDITIVE, SHADOWTYPE_ADDITIVE,
SHADOWTYPE_INVCOLOR SHADOWTYPE_INVCOLOR
}; };
enum eShadowTextureType enum eShadowTextureType

View File

@ -323,7 +323,7 @@ _GetCamBounds(bool *bUseCamStartY, bool *bUseCamEndY, bool *bUseCamStartX, bool
} }
} }
float inline float
SectorRadius(float fSize) SectorRadius(float fSize)
{ {
return Sqrt(Pow(fSize, 2) + Pow(fSize, 2)); return Sqrt(Pow(fSize, 2) + Pow(fSize, 2));
@ -424,7 +424,7 @@ CWaterLevel::RenderWater()
if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr ) if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr )
{ {
if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE), if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE),
&CMatrix(TheCamera.GetCameraMatrix())) ) &TheCamera.GetCameraMatrix()) )
{ {
if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ ) if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ )
{ {
@ -466,7 +466,7 @@ CWaterLevel::RenderWater()
if ( fLargeSectorDistToCamSqr < fHugeSectorMaxRenderDistSqr ) if ( fLargeSectorDistToCamSqr < fHugeSectorMaxRenderDistSqr )
{ {
if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE), //90.879997f, if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE), //90.879997f,
&CMatrix(TheCamera.GetCameraMatrix())) ) &TheCamera.GetCameraMatrix()) )
{ {
// Render four small(32x32) sectors, or one large(64x64). // Render four small(32x32) sectors, or one large(64x64).
@ -629,7 +629,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{ {
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
&CMatrix(TheCamera.GetCameraMatrix())) ) &TheCamera.GetCameraMatrix()) )
{ {
RenderOneFlatExtraHugeWaterPoly( RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@ -663,7 +663,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{ {
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
&CMatrix(TheCamera.GetCameraMatrix())) ) &TheCamera.GetCameraMatrix()) )
{ {
RenderOneFlatExtraHugeWaterPoly( RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@ -687,7 +687,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{ {
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
&CMatrix(TheCamera.GetCameraMatrix())) ) &TheCamera.GetCameraMatrix()) )
{ {
RenderOneFlatExtraHugeWaterPoly( RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,

View File

@ -37,8 +37,8 @@ bool CBoat::IsSectorAffectedByWake(CVector2D sector, float fSize, CBoat **apBoat
{ {
float fDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[j]) * fShapeTime + float(j) * fShapeLength + fSize; float fDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[j]) * fShapeTime + float(j) * fShapeLength + fSize;
if ( fabs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist if ( Abs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist
&& fabs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist ) && Abs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist )
{ {
apBoats[numVerts] = pBoat; apBoats[numVerts] = pBoat;
numVerts = 1; // += ? numVerts = 1; // += ?
@ -56,13 +56,12 @@ float CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
{ {
float fMaxDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fShapeTime + float(i) * fShapeLength; float fMaxDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fShapeTime + float(i) * fShapeLength;
float fX = pBoat->m_avec2dWakePoints[i].x - vecVertex.x; CVector2D vecDist = pBoat->m_avec2dWakePoints[i] - CVector2D(vecVertex);
float fY = pBoat->m_avec2dWakePoints[i].y - vecVertex.y;
float fDist = fY * fY + fX * fX; float fDist = vecDist.MagnitudeSqr();
if ( fDist < SQR(fMaxDist) ) if ( fDist < SQR(fMaxDist) )
return 1.0f - min(fRangeMult * sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f); return 1.0f - min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
} }
return 0.0f; return 0.0f;