mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-26 21:15:42 +00:00
WaterLevel (Beachtoys)
This commit is contained in:
parent
28fb26f792
commit
29a2d810a7
3 changed files with 120 additions and 23 deletions
|
@ -767,13 +767,13 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
|
||||||
CVector toyPos(newPed->GetPosition());
|
CVector toyPos(newPed->GetPosition());
|
||||||
float waterLevel;
|
float waterLevel;
|
||||||
if (CWaterLevel::GetGroundLevel(toyPos, &waterLevel, nil, 30.0f)) {
|
if (CWaterLevel::GetGroundLevel(toyPos, &waterLevel, nil, 30.0f)) {
|
||||||
toyPos.z = 0.004f + waterLevel;
|
toyPos.z = 0.04f + waterLevel;
|
||||||
CEntity *toy = CWaterLevel::CreateBeachToy(toyPos, BEACHTOY_11);
|
CEntity *toy = CWaterLevel::CreateBeachToy(toyPos, BEACHTOY_ANY_TOWEL);
|
||||||
if (toy)
|
if (toy)
|
||||||
toy->SetHeading(heading);
|
toy->SetHeading(heading);
|
||||||
|
|
||||||
if (!(CGeneral::GetRandomNumber() & 3)) {
|
if (!(CGeneral::GetRandomNumber() & 3)) {
|
||||||
CWaterLevel::CreateBeachToy(toyPos + CVector(CGeneral::GetRandomNumberInRange(-2.f, 2.f), CGeneral::GetRandomNumberInRange(-2.f, 2.f), 0.f), BEACHTOY_6);
|
CWaterLevel::CreateBeachToy(toyPos + CVector(CGeneral::GetRandomNumberInRange(-2.f, 2.f), CGeneral::GetRandomNumberInRange(-2.f, 2.f), 0.f), BEACHTOY_LOTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -124,16 +124,12 @@ WaterLevelInitialise(Const char *pWaterDat)
|
||||||
while ( hFile < 0 );
|
while ( hFile < 0 );
|
||||||
|
|
||||||
if ( hFile > 0 )
|
if ( hFile > 0 )
|
||||||
{
|
|
||||||
if ( hFile >= 0 )
|
|
||||||
{
|
{
|
||||||
CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
|
CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
|
||||||
CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
|
CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
|
||||||
CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
|
CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
|
||||||
CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
|
CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
|
||||||
CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
|
CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
|
||||||
}
|
|
||||||
|
|
||||||
CFileMgr::CloseFile(hFile);
|
CFileMgr::CloseFile(hFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +484,6 @@ CWaterLevel::GetWaterNormal(float fX, float fY)
|
||||||
float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f);
|
float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f);
|
||||||
float fWindFactor = CWeather::WindClipped * 0.4f + 0.2f;
|
float fWindFactor = CWeather::WindClipped * 0.4f + 0.2f;
|
||||||
|
|
||||||
//TODO:
|
|
||||||
float _fWave = (WATER_UNSIGN_Y(fY) - y*SMALL_SECTOR_SIZE + WATER_UNSIGN_X(fX) - x*SMALL_SECTOR_SIZE)
|
float _fWave = (WATER_UNSIGN_Y(fY) - y*SMALL_SECTOR_SIZE + WATER_UNSIGN_X(fX) - x*SMALL_SECTOR_SIZE)
|
||||||
* (TWOPI / SMALL_SECTOR_SIZE ) + fAngle;
|
* (TWOPI / SMALL_SECTOR_SIZE ) + fAngle;
|
||||||
|
|
||||||
|
@ -2948,7 +2943,7 @@ CWaterLevel::HandleBeachToysStuff(void)
|
||||||
{
|
{
|
||||||
if ( coldata.SurfaceType == SURFACE_SAND )
|
if ( coldata.SurfaceType == SURFACE_SAND )
|
||||||
{
|
{
|
||||||
CEntity *toy = CreateBeachToy(vecPos, BEACHTOY_LOUNGE);
|
CEntity *toy = CreateBeachToy(vecPos, BEACHTOY_ANY_LOUNGE);
|
||||||
if ( toy )
|
if ( toy )
|
||||||
{
|
{
|
||||||
toy->SetHeading(DEGTORAD(CGeneral::GetRandomNumberInRange(0.0f, 359.0f)));
|
toy->SetHeading(DEGTORAD(CGeneral::GetRandomNumberInRange(0.0f, 359.0f)));
|
||||||
|
@ -2968,6 +2963,104 @@ CWaterLevel::HandleBeachToysStuff(void)
|
||||||
CEntity *
|
CEntity *
|
||||||
CWaterLevel::CreateBeachToy(CVector const &vec, eBeachToy beachtoy)
|
CWaterLevel::CreateBeachToy(CVector const &vec, eBeachToy beachtoy)
|
||||||
{
|
{
|
||||||
//TODO(MIAMI)
|
if (CObject::nNoTempObjects >= 40)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
int finalToy = beachtoy;
|
||||||
|
bool isStatic = false;
|
||||||
|
int model = MI_BEACHBALL;
|
||||||
|
switch (beachtoy) {
|
||||||
|
case BEACHTOY_ANY_LOUNGE:
|
||||||
|
switch ( CGeneral::GetRandomNumber() & 7 ) {
|
||||||
|
case 1:
|
||||||
|
case 7:
|
||||||
|
finalToy = BEACHTOY_LOUNGE_WOOD_UP;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
case 5:
|
||||||
|
finalToy = BEACHTOY_LOUNGE_TOWEL_UP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
finalToy = BEACHTOY_LOUNGE_WOOD_ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BEACHTOY_ANY_TOWEL:
|
||||||
|
switch ( CGeneral::GetRandomNumber() & 7 ) {
|
||||||
|
case 1:
|
||||||
|
case 7:
|
||||||
|
finalToy = BEACHTOY_TOWEL2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 6:
|
||||||
|
finalToy = BEACHTOY_TOWEL3;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
case 5:
|
||||||
|
finalToy = BEACHTOY_TOWEL4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
finalToy = BEACHTOY_TOWEL1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (CObject::nNoTempObjects >= 35) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (finalToy) {
|
||||||
|
case BEACHTOY_BALL:
|
||||||
|
isStatic = false;
|
||||||
|
model = MI_BEACHBALL;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_LOUNGE_WOOD_UP:
|
||||||
|
isStatic = false;
|
||||||
|
model = MI_LOUNGE_WOOD_UP;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_LOUNGE_TOWEL_UP:
|
||||||
|
isStatic = false;
|
||||||
|
model = MI_LOUNGE_TOWEL_UP;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_LOUNGE_WOOD_ON:
|
||||||
|
isStatic = false;
|
||||||
|
model = MI_LOUNGE_WOOD_DN;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_LOTION:
|
||||||
|
model = MI_LOTION;
|
||||||
|
isStatic = true;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_TOWEL1:
|
||||||
|
model = MI_BEACHTOWEL01;
|
||||||
|
isStatic = true;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_TOWEL2:
|
||||||
|
model = MI_BEACHTOWEL02;
|
||||||
|
isStatic = true;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_TOWEL3:
|
||||||
|
model = MI_BEACHTOWEL03;
|
||||||
|
isStatic = true;
|
||||||
|
break;
|
||||||
|
case BEACHTOY_TOWEL4:
|
||||||
|
model = MI_BEACHTOWEL04;
|
||||||
|
isStatic = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CObject *toy = new CObject(model, true);
|
||||||
|
if (toy) {
|
||||||
|
toy->SetPosition(vec);
|
||||||
|
toy->GetMatrix().UpdateRW();
|
||||||
|
toy->m_vecMoveSpeed = CVector(0.f, 0.f, 0.f);
|
||||||
|
toy->m_vecTurnSpeed = CVector(0.f, 0.f, 0.f);
|
||||||
|
toy->ObjectCreatedBy = TEMP_OBJECT;
|
||||||
|
toy->bIsStatic = isStatic;
|
||||||
|
CObject::nNoTempObjects++;
|
||||||
|
toy->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 43200000;
|
||||||
|
CWorld::Add(toy);
|
||||||
|
return toy;
|
||||||
|
} else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
|
@ -81,12 +81,16 @@ enum eBeachToy
|
||||||
{
|
{
|
||||||
BEACHTOY_0 = 0,
|
BEACHTOY_0 = 0,
|
||||||
BEACHTOY_BALL,
|
BEACHTOY_BALL,
|
||||||
BEACHTOY_2,
|
BEACHTOY_LOUNGE_WOOD_UP,
|
||||||
BEACHTOY_3,
|
BEACHTOY_LOUNGE_TOWEL_UP,
|
||||||
BEACHTOY_4,
|
BEACHTOY_LOUNGE_WOOD_ON,
|
||||||
BEACHTOY_LOUNGE = 5,
|
BEACHTOY_ANY_LOUNGE,
|
||||||
BEACHTOY_6,
|
BEACHTOY_LOTION,
|
||||||
BEACHTOY_11 = 11
|
BEACHTOY_TOWEL1,
|
||||||
|
BEACHTOY_TOWEL2,
|
||||||
|
BEACHTOY_TOWEL3,
|
||||||
|
BEACHTOY_TOWEL4,
|
||||||
|
BEACHTOY_ANY_TOWEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RwRaster* gpWaterRaster;
|
extern RwRaster* gpWaterRaster;
|
||||||
|
|
Loading…
Reference in a new issue