client almost builds

This commit is contained in:
d1str4ught
2025-08-19 00:20:40 +02:00
parent 4be475f111
commit be56f3f31a
1090 changed files with 126610 additions and 14032 deletions

View File

@@ -29,9 +29,9 @@ void CActorInstance::SoundEventProcess(BOOL bCheckFrequency)
if (!m_pkCurRaceMotionData)
return;
CSoundManager& rkSndMgr=CSoundManager::Instance();
const NSound::TSoundInstanceVector* c_pkVct_kSndInst=m_pkCurRaceMotionData->GetSoundInstanceVectorPointer();
rkSndMgr.UpdateSoundInstance(m_x, m_y, m_z, m_kCurMotNode.dwcurFrame, c_pkVct_kSndInst, bCheckFrequency);
const TSoundInstanceVector* c_pkVct_kSndInst = m_pkCurRaceMotionData->GetSoundInstanceVectorPointer();
UpdateSoundInstance(m_kCurMotNode.dwcurFrame, *c_pkVct_kSndInst,
m_x, m_y, m_z, bCheckFrequency);
}
void CActorInstance::MotionEventProcess(DWORD dwcurFrame, int iIndex, const CRaceMotionData::TMotionEventData * c_pData)

View File

@@ -966,7 +966,7 @@ bool CArea::__Load_LoadObject(const char * c_szFileName)
if (rVector.size() > 6)
{
for (int portalIdx = 0; portalIdx < min(rVector.size()-6, PORTAL_ID_MAX_NUM); ++portalIdx)
for (int portalIdx = 0; portalIdx < std::min(rVector.size()-6, (size_t)PORTAL_ID_MAX_NUM); ++portalIdx)
{
ObjectData.abyPortalID[portalIdx] = atoi(rVector[6+portalIdx].c_str());
}
@@ -1318,19 +1318,19 @@ void CArea::TAmbienceInstance::UpdateOnceSound(float fxCenter, float fyCenter, f
float fDistance = sqrtf((fx - fxCenter)*(fx - fxCenter) + (fy - fyCenter)*(fy - fyCenter) + (fz - fzCenter)*(fz - fzCenter));
if (DWORD(fDistance) < dwRange)
{
if (-1 == iPlaySoundIndex)
if (!pSample)
{
if (AmbienceData.AmbienceSoundVector.empty())
return;
const char * c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
iPlaySoundIndex = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
// Tracef(" %d : OncePlay [%f] : %s\n", iPlaySoundIndex, fDistance, c_szFileName);
}
}
else
{
iPlaySoundIndex = -1;
pSample.reset();
}
}
@@ -1347,7 +1347,7 @@ void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, f
return;
const char * c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
iPlaySoundIndex = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
// Tracef(" %d : StepPlay [%f] : %s\n", iPlaySoundIndex, fDistance, c_szFileName);
fNextPlayTime = CTimer::Instance().GetCurrentSecond();
@@ -1356,40 +1356,28 @@ void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, f
}
else
{
iPlaySoundIndex = -1;
pSample.reset();
fNextPlayTime = 0.0f;
}
}
void CArea::TAmbienceInstance::UpdateLoopSound(float fxCenter, float fyCenter, float fzCenter)
{
float fDistance = sqrtf((fx - fxCenter)*(fx - fxCenter) + (fy - fyCenter)*(fy - fyCenter) + (fz - fzCenter)*(fz - fzCenter));
float fDistance = sqrtf((fx - fxCenter) * (fx - fxCenter) + (fy - fyCenter) * (fy - fyCenter) + (fz - fzCenter) * (fz - fzCenter));
if (DWORD(fDistance) < dwRange)
{
if (-1 == iPlaySoundIndex)
if (!pSample)
{
if (AmbienceData.AmbienceSoundVector.empty())
return;
const char * c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
iPlaySoundIndex = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName, 0);
// Tracef(" %d : LoopPlay [%f] : %s\n", iPlaySoundIndex, fDistance, c_szFileName);
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, AmbienceData.AmbienceSoundVector[0], 0);
}
if (-1 != iPlaySoundIndex)
else
{
// Tracef("%d : %f\n", iPlaySoundIndex, __GetVolumeFromDistance(fDistance));
CSoundManager::Instance().SetSoundVolume3D(iPlaySoundIndex, __GetVolumeFromDistance(fDistance));
pSample->SetVolume(__GetVolumeFromDistance(fDistance));
}
}
else
{
if (-1 != iPlaySoundIndex)
{
// Tracef(" %d : LoopStop\n", iPlaySoundIndex);
CSoundManager::Instance().StopSound3D(iPlaySoundIndex);
iPlaySoundIndex = -1;
}
pSample.reset();
}
}
@@ -1441,6 +1429,5 @@ CArea::SAmbienceInstance::SAmbienceInstance()
fy = 0.0f;
fz = 0.0f;
dwRange = 0;
iPlaySoundIndex = -1;
fNextPlayTime = 0.0f;
}

View File

@@ -68,7 +68,7 @@ class CArea
float fx, fy, fz;
DWORD dwRange;
float fMaxVolumeAreaPercentage;
int iPlaySoundIndex;
std::unique_ptr<SoundSample> pSample;
float fNextPlayTime;
prt::TPropertyAmbience AmbienceData;

View File

@@ -583,48 +583,48 @@ void CTerrain::RAW_CountTiles()
{
for (long y = 0; y < TILEMAP_RAW_YSIZE; ++y)
{
long lPatchIndexY = min(max((y-1)/PATCH_TILE_YSIZE,0), PATCH_YCOUNT - 1);
long lPatchIndexY = std::min(std::max((y-1)/PATCH_TILE_YSIZE,0l), (long)PATCH_YCOUNT - 1);
for (long x = 0; x < TILEMAP_RAW_XSIZE; ++x)
{
long lPatchIndexX = min(max((x-1)/(PATCH_TILE_XSIZE), 0), PATCH_XCOUNT - 1);
long lPatchIndexX = std::min(std::max((x-1)/(PATCH_TILE_XSIZE), 0l), (long)PATCH_XCOUNT - 1);
BYTE tilenum = m_abyTileMap[y * TILEMAP_RAW_XSIZE + x];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + lPatchIndexX][tilenum];
if ( 0 == y % PATCH_TILE_YSIZE && 0 != y && (TILEMAP_RAW_YSIZE - 2) != y)
{
++m_TerrainSplatPatch.PatchTileCount[min(PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + lPatchIndexX][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::min((long)PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + lPatchIndexX][tilenum];
if ( 0 == x % PATCH_TILE_XSIZE && 0 != x && (TILEMAP_RAW_XSIZE - 2) != x)
{
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + min(PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[min(PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + min(PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::min((long)PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::min((long)PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + std::min((long)PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
}
else if ( 1 == x % PATCH_TILE_XSIZE && (TILEMAP_RAW_XSIZE -1) != x && 1 != x)
{
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + max(0, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[min(PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + max(0, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::max(0l, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::min((long)PATCH_YCOUNT - 1, lPatchIndexY + 1) * PATCH_XCOUNT + std::max(0l, lPatchIndexX - 1)][tilenum];
}
}
else if ( 1 == y % PATCH_TILE_YSIZE && (TILEMAP_RAW_YSIZE -1) != y && 1 != y)
{
++m_TerrainSplatPatch.PatchTileCount[max(0, lPatchIndexY - 1) * PATCH_XCOUNT + lPatchIndexX][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::max(0l, lPatchIndexY - 1) * PATCH_XCOUNT + lPatchIndexX][tilenum];
if ( 0 == x % PATCH_TILE_XSIZE && 0 != x && (TILEMAP_RAW_XSIZE - 2) != x)
{
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + min(PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[max(0, lPatchIndexY - 1) * PATCH_XCOUNT + min(PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::min((long)PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::max(0l, lPatchIndexY - 1) * PATCH_XCOUNT + std::min((long)PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
}
else if ( 1 == x % PATCH_TILE_XSIZE && (TILEMAP_RAW_XSIZE -1) != x && 1 != x)
{
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + max(0, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[max(0, lPatchIndexY - 1) * PATCH_XCOUNT + max(0, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::max(0l, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[std::max(0l, lPatchIndexY - 1) * PATCH_XCOUNT + std::max(0l, lPatchIndexX - 1)][tilenum];
}
}
else
{
if ( 0 == x % PATCH_TILE_XSIZE && 0 != x && (TILEMAP_RAW_XSIZE - 2) != x)
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + min(PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::min((long)PATCH_XCOUNT - 1, lPatchIndexX + 1)][tilenum];
else if ( 1 == x % PATCH_TILE_XSIZE && (TILEMAP_RAW_XSIZE -1) != x && 1 != x)
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + max(0, lPatchIndexX - 1)][tilenum];
++m_TerrainSplatPatch.PatchTileCount[lPatchIndexY * PATCH_XCOUNT + std::max(0l, lPatchIndexX - 1)][tilenum];
}
++m_TerrainSplatPatch.TileCount[tilenum];
@@ -1115,7 +1115,7 @@ void CTerrain::_CalculateTerrainPatch(BYTE byPatchNumX, BYTE byPatchNumY)
fY += float(CELLSCALE);
}
if (wNumPlainType <= max(wNumHillType, wNumCliffType))
if (wNumPlainType <= std::max(wNumHillType, wNumCliffType))
{
if (wNumCliffType <= wNumHillType)
rkTerrainPatch.SetType(CTerrainPatch::PATCH_TYPE_HILL);

View File

@@ -2,7 +2,8 @@
add_library(GameLib STATIC ${FILE_SOURCES})
# target_link_libraries(GameLib
# )
target_link_libraries(GameLib
lzo2
)
GroupSourcesByFolder(GameLib)

View File

@@ -193,12 +193,12 @@ void CDungeonBlock::GetBoundBox(D3DXVECTOR3 * pv3Min, D3DXVECTOR3 * pv3Max)
D3DXVECTOR3 v3Max;
pInstance->GetBoundBox(&v3Min, &v3Max);
pv3Min->x = min(v3Min.x, pv3Min->x);
pv3Min->y = min(v3Min.x, pv3Min->y);
pv3Min->z = min(v3Min.x, pv3Min->z);
pv3Max->x = max(v3Max.x, pv3Max->x);
pv3Max->y = max(v3Max.x, pv3Max->y);
pv3Max->z = max(v3Max.x, pv3Max->z);
pv3Min->x = std::min(v3Min.x, pv3Min->x);
pv3Min->y = std::min(v3Min.x, pv3Min->y);
pv3Min->z = std::min(v3Min.x, pv3Min->z);
pv3Max->x = std::max(v3Max.x, pv3Max->x);
pv3Max->y = std::max(v3Max.x, pv3Max->y);
pv3Max->z = std::max(v3Max.x, pv3Max->z);
}
}

View File

@@ -185,7 +185,7 @@ void CFlyTrace::Render()
const D3DXVECTOR3& rkNew=it2->second;
D3DXVECTOR3 B = rkNew - rkOld;
float radius = max(fabs(B.x),max(fabs(B.y),fabs(B.z)))/2;
float radius = std::max(fabs(B.x),std::max(fabs(B.y),fabs(B.z)))/2;
Vector3d c(it1->second.x+B.x*0.5f,
it1->second.y+B.y*0.5f,
it1->second.z+B.z*0.5f

View File

@@ -112,10 +112,10 @@ void CMapOutdoor::AssignTerrainPtr()
OnPreAssignTerrainPtr();
short sReferenceCoordMinX, sReferenceCoordMaxX, sReferenceCoordMinY, sReferenceCoordMaxY;
sReferenceCoordMinX = max(m_CurCoordinate.m_sTerrainCoordX - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxX = min(m_CurCoordinate.m_sTerrainCoordX + LOAD_SIZE_WIDTH, m_sTerrainCountX - 1);
sReferenceCoordMinY = max(m_CurCoordinate.m_sTerrainCoordY - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxY = min(m_CurCoordinate.m_sTerrainCoordY + LOAD_SIZE_WIDTH, m_sTerrainCountY - 1);
sReferenceCoordMinX = std::max(m_CurCoordinate.m_sTerrainCoordX - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxX = std::min(m_CurCoordinate.m_sTerrainCoordX + LOAD_SIZE_WIDTH, m_sTerrainCountX - 1);
sReferenceCoordMinY = std::max(m_CurCoordinate.m_sTerrainCoordY - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxY = std::min(m_CurCoordinate.m_sTerrainCoordY + LOAD_SIZE_WIDTH, m_sTerrainCountY - 1);
DWORD i;
for (i = 0; i < AROUND_AREA_NUM; ++i)

View File

@@ -90,10 +90,10 @@ bool CMapOutdoor::Update(float fX, float fY, float fZ)
WORD wCellCoordY = (iy % CTerrainImpl::TERRAIN_YSIZE) / CTerrainImpl::CELLSCALE;
short sReferenceCoordMinX, sReferenceCoordMaxX, sReferenceCoordMinY, sReferenceCoordMaxY;
sReferenceCoordMinX = max(m_CurCoordinate.m_sTerrainCoordX - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxX = min(m_CurCoordinate.m_sTerrainCoordX + LOAD_SIZE_WIDTH, m_sTerrainCountX - 1);
sReferenceCoordMinY = max(m_CurCoordinate.m_sTerrainCoordY - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxY = min(m_CurCoordinate.m_sTerrainCoordY + LOAD_SIZE_WIDTH, m_sTerrainCountY - 1);
sReferenceCoordMinX = std::max(m_CurCoordinate.m_sTerrainCoordX - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxX = std::min(m_CurCoordinate.m_sTerrainCoordX + LOAD_SIZE_WIDTH, m_sTerrainCountX - 1);
sReferenceCoordMinY = std::max(m_CurCoordinate.m_sTerrainCoordY - LOAD_SIZE_WIDTH, 0);
sReferenceCoordMaxY = std::min(m_CurCoordinate.m_sTerrainCoordY + LOAD_SIZE_WIDTH, m_sTerrainCountY - 1);
for (WORD usY = sReferenceCoordMinY; usY <=sReferenceCoordMaxY; ++usY)
{

View File

@@ -295,7 +295,7 @@ float CRaceMotionData::GetEventStartTime(DWORD dwIndex) const
return m_MotionEventDataVector[dwIndex]->fStartingTime;
}
const NSound::TSoundInstanceVector * CRaceMotionData::GetSoundInstanceVectorPointer() const
const TSoundInstanceVector * CRaceMotionData::GetSoundInstanceVectorPointer() const
{
return &m_SoundInstanceVector;
}
@@ -553,13 +553,13 @@ bool CRaceMotionData::SaveMotionData(const char * c_szFileName)
#endif
bool CRaceMotionData::LoadSoundScriptData(const char * c_szFileName)
{
NSound::TSoundDataVector SoundDataVector;
if (!NSound::LoadSoundInformationPiece(c_szFileName, SoundDataVector))
TSoundDataVector SoundDataVector;
if (!LoadSoundInformationPiece(c_szFileName, SoundDataVector))
{
return false;
}
NSound::DataToInstance(SoundDataVector, &m_SoundInstanceVector);
DataToInstance(SoundDataVector, &m_SoundInstanceVector);
return true;
}

View File

@@ -1,6 +1,6 @@
#pragma once
#include "../milesLib/Type.h"
#include "MilesLib/Type.h"
#include "RaceMotionDataEvent.h"
class CRaceMotionData
@@ -253,7 +253,7 @@ class CRaceMotionData
float GetEventStartTime(DWORD dwIndex) const;
// Sound Data
const NSound::TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
const TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
// File
#ifdef WORLD_EDITOR
@@ -291,7 +291,7 @@ class CRaceMotionData
BOOL m_bCancelEnableSkill;
TMotionEventDataVector m_MotionEventDataVector;
NSound::TSoundInstanceVector m_SoundInstanceVector;
TSoundInstanceVector m_SoundInstanceVector;
private:
BOOL m_hasSplashEvent;

View File

@@ -76,7 +76,7 @@ void CSnowEnvironment::Deform()
if (m_bSnowEnable)
{
for (int p = 0; p < min(10, m_dwParticleMaxNum - m_kVct_pkParticleSnow.size()); ++p)
for (int p = 0; p < std::min(10ull, m_dwParticleMaxNum - m_kVct_pkParticleSnow.size()); ++p)
{
CSnowParticle * pSnowParticle = CSnowParticle::New();
pSnowParticle->Init(v3ChangedPos);
@@ -177,7 +177,7 @@ void CSnowEnvironment::Render()
__BeginBlur();
DWORD dwParticleCount = min(m_dwParticleMaxNum, m_kVct_pkParticleSnow.size());
DWORD dwParticleCount = std::min((size_t)m_dwParticleMaxNum, m_kVct_pkParticleSnow.size());
CCamera * pCamera = CCameraManager::Instance().GetCurrentCamera();
if (!pCamera)

View File

@@ -145,7 +145,7 @@ bool CWeaponTrace::BuildVertex()
*/
std::vector<TPDTVertex> m_ShortVertexVector, m_LongVertexVector;
float length = min(m_fLifeTime, m_LongTimePointList.back().first);
float length = std::min(m_fLifeTime, m_LongTimePointList.back().first);
int n = m_LongTimePointList.size()-1;
assert(n<max_size-1);
@@ -226,8 +226,8 @@ bool CWeaponTrace::BuildVertex()
TPDTVertex v;
//v.diffuse = D3DXCOLOR(0.3f,0.8f,1.0f, (loop)?max(1.0f-(t/m_fLifeTime),0.0f)/2:0.0f );
float ttt = min(max((t+Input[0].first)/m_fLifeTime,0.0f),1.0f);
v.diffuse = D3DXCOLOR(0.3f,0.8f,1.0f, (loop)?min(max((1.0f-ttt)*(1.0f-ttt)/2.5-0.1f,0.0f),1.0f):0.0f );
float ttt = std::min(std::max((t+Input[0].first)/m_fLifeTime,0.0f),1.0f);
v.diffuse = D3DXCOLOR(0.3f,0.8f,1.0f, (loop)?std::min(std::max((1.0f-ttt)*(1.0f-ttt)/2.5f-0.1f,0.0f),1.0f):0.0f );
//v.diffuse = D3DXCOLOR(0.0f,0.0f,0.0f, (loop)?min(max((1.0f-ttt)*(1.0f-ttt)-0.1f,0.0f),1.0f):0.0f );
//v.diffuse = 0xffffffff;
v.position = a+cc*(b+cc*(c+cc*d)); // next position