port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

143
evoke-64k/bp10/bowfront.cpp Normal file
View File

@@ -0,0 +1,143 @@
#include "bowfront.h"
#include "flockspline.h"
BowFrontInfo g_BowFrontData[ g_iBowFrontCount ];
static D3DXVECTOR3 UpFly[4]=
{
D3DXVECTOR3( 0.0f, -4.0f, 0.0f ),
D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
D3DXVECTOR3( 0.0f, 16.0f, 0.0f ),
D3DXVECTOR3( 0.0f, 20.0f, 0.0f ),
};
D3DXVECTOR2 vecFlock[ 1024 ];
float fFlockTime[ 1024 ];
void GenerateBowFront()
{
for( int i= 0; i < g_iBowFrontCount; ++i )
{
g_BowFrontData[ i ].Disable();
}
float fBaseHeight= 0.0f;
float fStartWidth= -48.0f;
float fEndWidth= 48.0f;
float fStartLength= 128.0f;
float fEndLength= -120.0f;
int BowCount= 96;
int iCount= 0;
g_BowFrontData[ iCount ].m_vCenter.x= -64.0f;
g_BowFrontData[ iCount ].m_vCenter.y= -80.0f;
g_BowFrontData[ iCount ].m_vCenter.z= 0.0f;
g_BowFrontData[ iCount ].m_fInner= 192.0f;
g_BowFrontData[ iCount ].m_fOuter= g_BowFrontData[ iCount ].m_fInner + 32.0f;
g_BowFrontData[ iCount ].m_fWidth= 16.0f;
g_BowFrontData[ iCount ].m_fMaxSpreadAngle= 4.0f;
g_BowFrontData[ iCount ].m_fStartTime= 3.75f;
g_BowFrontData[ iCount ].m_fEndTime= 4.75f;
iCount++;
int iFlock= 0;
for( int i= 0; i < BowCount; ++i )
{
float fPosX= g_Random.genFloat( fStartWidth, fEndWidth );
float fPosZ= fStartLength - g_Random.genFloat( 0.0f, 8.0f );
float fTime= 16.0f;
while( true )
{
assert( iCount < g_iBowFrontCount );
float fStepLength= g_Random.genFloat( 8.0f, 20.0f );
g_BowFrontData[ iCount ].m_vCenter.x= fPosX;
g_BowFrontData[ iCount ].m_vCenter.y= fBaseHeight;
fPosZ-= fStepLength;
g_BowFrontData[ iCount ].m_vCenter.z= fPosZ;
fPosZ-= fStepLength;
float fThick= fStepLength * 0.1f + g_Random.genFloat( 0.0f, 0.75f );
g_BowFrontData[ iCount ].m_fInner= fStepLength - fThick;
g_BowFrontData[ iCount ].m_fOuter= fStepLength + fThick;
g_BowFrontData[ iCount ].m_fWidth= fThick * 0.35f;
g_BowFrontData[ iCount ].m_fMaxSpreadAngle= g_Random.genFloat( 1.2f, 3.1f );
g_BowFrontData[ iCount ].m_fStartTime= fTime;
fTime+= 0.25f * fStepLength;
g_BowFrontData[ iCount ].m_fEndTime= fTime * (31.0f / 32.0f);// - g_Random.genFloat( 0.25f, fStepLength * 0.625f );
iCount++;
if( iCount % 3 == 1 && fabs( -18.0f - fPosX ) < 20.0f && fabs( fPosZ ) < 32.0f )
{
vecFlock[ iFlock ].x= fPosX;
vecFlock[ iFlock ].y= fPosZ;
fFlockTime[ iFlock ]= fTime;
iFlock++;
}
if( fPosZ < fEndLength )
{
break;
}
}
}
for( int i= 0; i < iFlock; ++i )
{
for( int j =0; j < 4; ++j )
{
UpFly[ j ].x= vecFlock[ i ].x;
UpFly[ j ].z= vecFlock[ i ].y;
}
int iBase= 192;
assert( iBase + i < g_iFlockCount );
g_Flocks[ iBase + i ].GeneratePreSpline(
UpFly,
4,
1.5f,
0.25f );
g_Flocks[ iBase + i ].GenerateUpVectors();
g_Flocks[ iBase + i ].GenerateSplinePoints( 128 );
g_Flocks[ iBase + i ].GenerateBoids03( 24 );
g_Flocks[ iBase + i ].m_iTesselation= 2;
g_Flocks[ iBase + i ].m_fTimeOffset= fFlockTime[ i ] - 258.0f;
}
}
void AddBowFrontToScene( float fTime )
{
g_Objects[ OI_BowFront ].Lock();
for( int i= 0; i < g_iBowFrontCount; ++i )
{
if( fTime > g_BowFrontData[ i ].m_fEndTime )
{
continue;
}
if( fTime < g_BowFrontData[ i ].m_fStartTime )
{
continue;
}
float fTimePercent= ( fTime - g_BowFrontData[ i ].m_fStartTime ) /
( g_BowFrontData[ i ].m_fEndTime - g_BowFrontData[ i ].m_fStartTime );
fTimePercent*= g_BowFrontData[ i ].m_fMaxSpreadAngle + c_PI;
fTimePercent-= g_BowFrontData[ i ].m_fMaxSpreadAngle;
float fStartAngle= maximum( fTimePercent, 0.0f );
float fEndAngle= minimum( fTimePercent + g_BowFrontData[ i ].m_fMaxSpreadAngle, c_PI );
g_Objects[ OI_BowFront ].AddRainbow(
g_BowFrontData[ i ].m_vCenter,
g_BowFrontData[ i ].m_fInner, g_BowFrontData[ i ].m_fOuter,
g_BowFrontData[ i ].m_fWidth,
fStartAngle, fEndAngle,
D3DXVECTOR3(0.0f, 0.0f, 0.0f) );
}
g_Objects[ OI_BowFront ].Unlock();
}