Commit 22859282 authored by Byurrrer's avatar Byurrrer

частично порефакторил sgeom, поправил баг в lens flare, поправил мелкие баги в...

частично порефакторил sgeom, поправил баг в lens flare, поправил мелкие баги в материалах, порефакторил score, внедрил каналы, добавил наборы звуков, сделал возможность воспроизведения звука с задержками, в общем в звуковом ядре большие изменения, поправил утечку памяти в srender
parent b4ed084b
......@@ -43,5 +43,5 @@ half4 main(vs_out_pp IN):COLOR0
}
result /= half(NumSamples)*(LensFlareParam.z);
return half4(result+0.1,0.0);
return half4(result,0.0);
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ grass_frec 100
green_lod0 50
green_lod1 100
green_less 20
p_far 400
r_far 400
r_s_filter 2
r_s_max_anisotropy 16
......
......@@ -95,11 +95,13 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\source\common\string.cpp" />
<ClCompile Include="..\..\..\source\common\string_func.cpp" />
<ClCompile Include="..\..\..\source\skyxengine.cpp" />
<ClCompile Include="..\..\..\source\SkyXEngine_Build\SkyXEngine_Build.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\common\string.h" />
<ClInclude Include="..\..\..\source\common\string_func.h" />
<ClInclude Include="..\..\..\source\gdefines.h" />
<ClInclude Include="..\..\..\source\GRegisterIndex.h" />
<ClInclude Include="..\..\..\source\SkyXEngine.h" />
......
......@@ -10,6 +10,9 @@
<ClCompile Include="..\..\..\source\skyxengine.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string_func.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Header">
......@@ -38,6 +41,9 @@
<ClInclude Include="..\..\..\source\GRegisterIndex.h">
<Filter>Header</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\string_func.h">
<Filter>Header</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\source\SkyXEngine_Build\SkyXEngine.rc">
......
......@@ -11,11 +11,15 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\source\common\string.cpp" />
<ClCompile Include="..\..\..\source\common\string_func.cpp" />
<ClCompile Include="..\..\..\source\score\sound.cpp" />
<ClCompile Include="..\..\..\source\score\sxscore.cpp" />
<ClCompile Include="..\..\..\source\score\sxscore_dll.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\common\array.h" />
<ClInclude Include="..\..\..\source\common\string_func.h" />
<ClInclude Include="..\..\..\source\score\sound.h" />
<ClInclude Include="..\..\..\source\score\sxscore.h" />
</ItemGroup>
......
......@@ -24,6 +24,12 @@
<ClCompile Include="..\..\..\source\score\sound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\source\common\string_func.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\source\score\sxscore.h">
......@@ -32,5 +38,11 @@
<ClInclude Include="..\..\..\source\score\sound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\string_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\source\common\array.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
This diff is collapsed.
......@@ -7,6 +7,7 @@ See the license in LICENSE
#define _CRT_SECURE_NO_WARNINGS
#include <SkyXEngine.h>
//#include <common/string_func.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
......
......@@ -623,9 +623,9 @@ bool CommandConnect()
struct addrinfo *result = NULL,
*ptr = NULL,
hints;
char recvbuf[2048];
int iResult;
int recvbuflen = sizeof(recvbuf);
// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
......
......@@ -86,7 +86,7 @@ SX_LIB_API UINT Core_0GetTimeLastModify(const char *szPath)
if (hFile == INVALID_HANDLE_VALUE)
return 0;
SYSTEMTIME stUTC, stLocal;
SYSTEMTIME stUTC;
FILETIME ftCreate, ftAccess, ftWrite;
GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite);
FileTimeToSystemTime(&ftWrite, &stUTC);
......
......@@ -84,11 +84,11 @@ void CBaseTool::onPostLoad()
if(m_szPrimaryActionSound[0])
{
m_iSoundAction1 = SSCore_SndCreate3dInst(m_szPrimaryActionSound, false, 0, 100);
m_iSoundAction1 = SSCore_SndCreate3dInst(m_szPrimaryActionSound, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSecondaryActionSound[0])
{
m_iSoundAction2 = SSCore_SndCreate3dInst(m_szSecondaryActionSound, false, 0, 100);
m_iSoundAction2 = SSCore_SndCreate3dInst(m_szSecondaryActionSound, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szPrimaryActionMuzzleflash[0])
{
......@@ -122,7 +122,7 @@ void CBaseTool::primaryAction(BOOL st)
}
if(ID_VALID(m_iSoundAction1))
{
SSCore_SndInstancePlay3d(m_iSoundAction1, &getPos());
SSCore_SndInstancePlay3d(m_iSoundAction1, false, false, &getPos());
}
//((CPlayer*)m_pOwner)->is
......
......@@ -121,27 +121,27 @@ void CBaseWeapon::onPostLoad()
if(m_szSndDraw[0])
{
m_idSndDraw = SSCore_SndCreate3dInst(m_szSndDraw, false, 0, 100);
m_idSndDraw = SSCore_SndCreate3dInst(m_szSndDraw, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSndHolster[0])
{
m_idSndHolster = SSCore_SndCreate3dInst(m_szSndHolster, false, 0, 100);
m_idSndHolster = SSCore_SndCreate3dInst(m_szSndHolster, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSndShoot[0])
{
m_idSndShoot = SSCore_SndCreate3dInst(m_szSndShoot, false, 0, 100);
m_idSndShoot = SSCore_SndCreate3dInst(m_szSndShoot, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSndEmpty[0])
{
m_idSndEmpty = SSCore_SndCreate3dInst(m_szSndEmpty, false, 0, 100);
m_idSndEmpty = SSCore_SndCreate3dInst(m_szSndEmpty, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSndReload[0])
{
m_idSndReload = SSCore_SndCreate3dInst(m_szSndReload, false, 0, 100);
m_idSndReload = SSCore_SndCreate3dInst(m_szSndReload, SX_SOUND_CHANNEL_GAME, 100);
}
if(m_szSndSwitch[0])
{
m_idSndSwitch = SSCore_SndCreate3dInst(m_szSndSwitch, false, 0, 100);
m_idSndSwitch = SSCore_SndCreate3dInst(m_szSndSwitch, SX_SOUND_CHANNEL_GAME, 100);
}
}
......@@ -199,7 +199,7 @@ void CBaseWeapon::primaryAction(BOOL st)
}
if(ID_VALID(m_iSoundAction1))
{
SSCore_SndInstancePlay3d(m_iSoundAction1, &getPos());
SSCore_SndInstancePlay3d(m_iSoundAction1, false, false, &getPos());
}
//((CPlayer*)m_pOwner)->is
......@@ -258,7 +258,7 @@ void CBaseWeapon::reload()
playAnimation("reload");
if(ID_VALID(m_idSndReload))
{
SSCore_SndInstancePlay3d(m_idSndReload, &getPos());
SSCore_SndInstancePlay3d(m_idSndReload, false, false, &getPos());
}
}
}
......@@ -270,7 +270,7 @@ void CBaseWeapon::setFireMode(FIRE_MODE mode)
m_fireMode = mode;
if(ID_VALID(m_idSndReload))
{
SSCore_SndInstancePlay3d(m_idSndSwitch, &getPos());
SSCore_SndInstancePlay3d(m_idSndSwitch, false, false, &getPos());
}
}
}
......
......@@ -126,7 +126,7 @@ void GameData::playFootstepSound(MTLTYPE_PHYSIC mtl_type, const float3 &f3Pos)
return;
}
ID idSound = m_pidFootstepSound[mtl_type][rand() % iCount];
SSCore_SndInstancePlay3d(idSound, (float3*)&f3Pos);
SSCore_SndInstancePlay3d(idSound, false, false, (float3*)&f3Pos);
}
void GameData::loadFoostepsSounds()
......@@ -173,7 +173,7 @@ void GameData::loadFoostepsSounds()
m_pidFootstepSound[i] = jl ? new ID[jl] : NULL;
for(int j = 0; j < jl; ++j)
{
m_pidFootstepSound[i][j] = SSCore_SndCreate3dInst(paSounds[0][j], false, 0, 100);
m_pidFootstepSound[i][j] = SSCore_SndCreate3dInst(paSounds[0][j], SX_SOUND_CHANNEL_GAME, 100);
}
}
}
......
......@@ -24,9 +24,9 @@ CNPCZombie::CNPCZombie(CEntityManager * pMgr) :
m_fSpeedWalk = 0.07f;
m_fSpeedRun = 0.12f;
m_idSndIdle = SSCore_SndCreate3d("mobs/zombie/zombie_idle_16.ogg", false, 0, 30);
m_idSndIdle2 = SSCore_SndCreate3d("mobs/zombie/zombie_idle_17.ogg", false, 0, 30);
m_idSndDeath = SSCore_SndCreate3d("mobs/zombie/zombie_die_1.ogg", false, 0, 45);
m_idSndIdle = SSCore_SndCreate3d("mobs/zombie/zombie_idle_16.ogg", SX_SOUND_CHANNEL_GAME, 0, 30);
m_idSndIdle2 = SSCore_SndCreate3d("mobs/zombie/zombie_idle_17.ogg", SX_SOUND_CHANNEL_GAME, 0, 30);
m_idSndDeath = SSCore_SndCreate3d("mobs/zombie/zombie_die_1.ogg", SX_SOUND_CHANNEL_GAME, 0, 45);
}
CNPCZombie::~CNPCZombie()
......@@ -38,9 +38,9 @@ void CNPCZombie::onSync()
{
BaseClass::onSync();
SSCore_SndPosWSet(m_idSndIdle, &getPos());
SSCore_SndPosWSet(m_idSndIdle2, &getPos());
SSCore_SndPosWSet(m_idSndDeath, &getPos());
SSCore_SndSetPosWorld(m_idSndIdle, &getPos());
SSCore_SndSetPosWorld(m_idSndIdle2, &getPos());
SSCore_SndSetPosWorld(m_idSndDeath, &getPos());
//если здоровье меньше нуля
if (m_fHealth < 0.0f)
......
......@@ -616,6 +616,7 @@ void CShaderManager::allLoad()
if (m_aVS.size() == m_iLastAllLoadVS || m_aPS.size() == m_iLastAllLoadPS)
return;
DWORD dwTime = GetTickCount();
LibReport(REPORT_MSG_LEVEL_NOTICE, "load shaders ...\n");
for (int i = 0, il = m_aVS.size(); i < il; ++i)
......@@ -639,7 +640,7 @@ void CShaderManager::allLoad()
m_iLastAllLoadVS = m_aVS.size();
m_iLastAllLoadPS = m_aPS.size();
LibReport(REPORT_MSG_LEVEL_NOTICE, "all loaded shaders\n");
LibReport(REPORT_MSG_LEVEL_NOTICE, "all loaded shaders, time %d\n", GetTickCount() - dwTime);
}
void CShaderManager::update(SHADER_TYPE type_shader, const char *szName)
......
......@@ -457,7 +457,7 @@ SX_LIB_API ID SGCore_ShaderLoad(SHADER_TYPE type_shader, const char *szPath, con
SX_LIB_API void SGCore_ShaderAllLoad()
{
SG_PRECOND();
SG_PRECOND(_VOID);
return g_pManagerShaders->allLoad();
}
......
......@@ -103,6 +103,12 @@ struct IBaseObject
#define CONFIG_SECTION_MAX_LEN 64 /*!< максимальная длина секции конфигурационного файла */
//!@}
/*! звуковой канал самой игры */
#define SX_SOUND_CHANNEL_GAME 0
/*! звуковой канал главного меню */
#define SX_SOUND_CHANNEL_MAIN_MENU 1
/*! Пустые дефайны для визуальной идентификации аргументов функций
@{
*/
......
......@@ -1871,7 +1871,6 @@ bool CGreen::traceBeam(const float3* start, const float3* dir, float3* _res, ID*
return false;
SXTriangle tmptri;
float dist;
bool tmpiscom = true;
float3 ip;
float3 res;
......@@ -1955,7 +1954,6 @@ bool CGreen::traceBeam(const float3* start, const float3* dir, float3* _res, ID*
void CGreen::getPartBB(float3* bbmin, float3 * bbmax, CSegment** arrsplits, int *count, CSegment* comsegment, ID curr_splits_ids_render)
{
float3 min,max;
float radius;
comsegment->m_pBoundVolumeP->getMinMax(&min, &max);
if (comsegment->m_iCountObj > 0 && SGCore_0InretsectBox(bbmin, bbmax, &min, &max))
......
......@@ -2959,7 +2959,6 @@ void CStaticGeom::applyTransform(ID id)
applyTransformLod(id);
vertex_static* pData;
float3_t* pData2;
int idgroup;
int idbuff;
......@@ -3298,7 +3297,6 @@ bool CStaticGeom::traceBeam(const float3* start, const float3* dir, float3* _res
return false;
SXTriangle tmptri;
float dist;
bool tmpiscom = true;
float3 ip;
float3 res;
......
......@@ -19,7 +19,7 @@ CAmbientSounds::~CAmbientSounds()
void CAmbientSounds::add(const char *szPath)
{
ID id = SSCore_SndCreate2d(szPath);
ID id = SSCore_SndCreate2d(szPath, SX_SOUND_CHANNEL_GAME);
if (id >= 0)
m_aIDSnds.push_back(id);
}
......@@ -28,7 +28,7 @@ void CAmbientSounds::get(ID id, char *szPath)
{
if (id >= 0 && id < m_aIDSnds.size())
{
SSCore_SndFileGet(m_aIDSnds[id], szPath);
SSCore_SndGetFile(m_aIDSnds[id], szPath);
}
}
......@@ -51,7 +51,7 @@ void CAmbientSounds::play()
{
if (m_iPlayingLast >= 0 && m_iPlayingLast < m_aIDSnds.size())
{
SSCore_SndVolumeSet(m_aIDSnds[m_iPlayingLast], 100);
SSCore_SndSetVolume(m_aIDSnds[m_iPlayingLast], 100);
SSCore_SndPlay(m_aIDSnds[m_iPlayingLast]);
m_isPlaying = true;
}
......@@ -65,14 +65,14 @@ void CAmbientSounds::update()
static const float * env_ambient_snd_volume = GET_PCVAR_FLOAT("env_ambient_snd_volume");
static float env_ambient_snd_volume_old = 1.f;
if (SSCore_SndStateGet(m_aIDSnds[m_iPlayingLast]) != SOUND_OBJSTATE_PLAY)
if (SSCore_SndGetState(m_aIDSnds[m_iPlayingLast]) != SOUND_OBJSTATE_PLAY)
{
if (m_iPlayingLast + 1 < m_aIDSnds.size())
++m_iPlayingLast;
else
m_iPlayingLast = 0;
SSCore_SndVolumeSet(m_aIDSnds[m_iPlayingLast], env_ambient_snd_volume_old*100.f);
SSCore_SndSetVolume(m_aIDSnds[m_iPlayingLast], env_ambient_snd_volume_old*100.f);
SSCore_SndPlay(m_aIDSnds[m_iPlayingLast]);
}
......@@ -80,7 +80,7 @@ void CAmbientSounds::update()
{
env_ambient_snd_volume_old = *env_ambient_snd_volume;
if (m_iPlayingLast >= 0)
SSCore_SndVolumeSet(m_aIDSnds[m_iPlayingLast], env_ambient_snd_volume_old*100.f);
SSCore_SndSetVolume(m_aIDSnds[m_iPlayingLast], env_ambient_snd_volume_old*100.f);
}
}
......
......@@ -77,7 +77,7 @@ void CWeatherRndSnd::addSound(const char *szPath)
if (isunic)
{
ID tmpid = SSCore_SndCreate2d(szPath);
ID tmpid = SSCore_SndCreate2d(szPath, SX_SOUND_CHANNEL_GAME);
m_aArrSnds.push_back(CSnd(szPath, tmpid));
m_aCurrSndIDs.push_back(tmpid);
}
......@@ -100,13 +100,13 @@ void CWeatherRndSnd::update()
if((int)m_aCurrSndIDs.size() > tmpkeysnd && m_aCurrSndIDs[tmpkeysnd] && m_aCurrSndIDs[tmpkeysnd] >= 0)
{
m_idCurrPlay = m_aCurrSndIDs[tmpkeysnd];
SSCore_SndPosCurrSet(m_idCurrPlay, 0);
SSCore_SndSetPosPlay(m_idCurrPlay, 0);
int tmprndvol = (rand() % (m_iVolumeE - m_iVolumeB)) + m_iVolumeB;
SSCore_SndVolumeSet(m_idCurrPlay, (long)(env_weather_snd_volume ? (float)tmprndvol * (*env_weather_snd_volume) : tmprndvol), SOUND_VOL_PCT);
SSCore_SndSetVolume(m_idCurrPlay, ((float)(env_weather_snd_volume ? (float)tmprndvol * (*env_weather_snd_volume) : tmprndvol))*0.01f);
SSCore_SndPlay(m_idCurrPlay);
DWORD tmprnd = (rand() % (m_ulPeriodE - m_ulPeriodB)) + m_ulPeriodB;
m_ulNextPlay = TimeGetMls(Core_RIntGet(G_RI_INT_TIMER_RENDER)) + tmprnd + ((SSCore_SndLengthSecGet(m_idCurrPlay) + 1) * 1000);
m_ulNextPlay = TimeGetMls(Core_RIntGet(G_RI_INT_TIMER_RENDER)) + tmprnd + ((SSCore_SndGetLengthSec(m_idCurrPlay) + 1) * 1000);
}
}
}
......@@ -118,7 +118,7 @@ void CWeatherRndSnd::play()
m_isPlaying = true;
if (m_idCurrPlay >= 0 && SSCore_SndStateGet(m_idCurrPlay) == SOUND_OBJSTATE_PAUSE)
if (m_idCurrPlay >= 0 && SSCore_SndGetState(m_idCurrPlay) == SOUND_OBJSTATE_PAUSE)
SSCore_SndPlay(m_idCurrPlay);
}
......@@ -129,7 +129,7 @@ void CWeatherRndSnd::pause()
m_isPlaying = false;
if (m_idCurrPlay >= 0 && SSCore_SndStateGet(m_idCurrPlay) == SOUND_OBJSTATE_PLAY)
if (m_idCurrPlay >= 0 && SSCore_SndGetState(m_idCurrPlay) == SOUND_OBJSTATE_PLAY)
SSCore_SndPlay(SOUND_OBJSTATE_PAUSE);
}
......@@ -176,8 +176,8 @@ CWeather::CWeather()
m_idLightThunderbolt = SML_LigthsCreatePoint(&float3(0, 0, 0), 200, &float3(1, 1, 1), false, true);
SML_LigthsSetEnable(m_idLightThunderbolt, false);
m_idSndRain = SSCore_SndCreate2d("nature/rain.ogg",true);
m_idSndThunder = SSCore_SndCreate2d("nature/thunder.ogg");
m_idSndRain = SSCore_SndCreate2d("nature/rain.ogg", SX_SOUND_CHANNEL_GAME, true);
m_idSndThunder = SSCore_SndCreate2d("nature/thunder.ogg", SX_SOUND_CHANNEL_GAME);
m_fRainVolume = 0;
}
......@@ -646,8 +646,8 @@ void CWeather::update()
SPE_EmitterSet(m_idEffRain, 0, ReCreateCount, env_default_rain_density_old * m_aTimeSections[m_iSectionCurr].m_DataSection.m_fRainDensity * float(WEATHER_RAIN_RECREATE_COUNT));
SPE_EffectEnableSet(m_idEffRain, true);
SSCore_SndPosCurrSet(m_idSndRain, 0);
SSCore_SndVolumeSet(m_idSndRain, 0, SOUND_VOL_PCT);
SSCore_SndSetPosPlay(m_idSndRain, 0);
SSCore_SndSetVolume(m_idSndRain, 0);
if (m_isPlaying)
SSCore_SndPlay(m_idSndRain);
......@@ -780,8 +780,8 @@ void CWeather::update()
}
else
{
SSCore_SndPosCurrSet(m_idSndThunder, 0);
SSCore_SndVolumeSet(m_idSndThunder, (env_weather_snd_volume ? (*env_weather_snd_volume) : 1.f) * 100.f, SOUND_VOL_PCT);
SSCore_SndSetPosPlay(m_idSndThunder, 0);
SSCore_SndSetVolume(m_idSndThunder, (env_weather_snd_volume ? (*env_weather_snd_volume) : 1.f));
if (m_isPlaying)
SSCore_SndPlay(m_idSndThunder);
......@@ -806,8 +806,8 @@ void CWeather::update()
SML_LigthsSetEnable(m_idLightThunderbolt, false);
//и заодно проиграть звук молнии
SSCore_SndPosCurrSet(m_idSndThunder, 0);
SSCore_SndVolumeSet(m_idSndThunder, clampf(m_fRainVolume*2.f*100.f,0.f,100.f), SOUND_VOL_PCT);
SSCore_SndSetPosPlay(m_idSndThunder, 0);
SSCore_SndSetVolume(m_idSndThunder, clampf(m_fRainVolume*2.f, 0.f, 1.f));
if (m_isPlaying)
SSCore_SndPlay(m_idSndThunder);
......@@ -859,7 +859,7 @@ void CWeather::updateRainSound()
}
m_fRainVolume /= tmpcount / 4;
SSCore_SndVolumeSet(m_idSndRain, (env_weather_snd_volume ? (*env_weather_snd_volume) : 1.f) * m_fRainVolume * 100.f, SOUND_VOL_PCT);
SSCore_SndSetVolume(m_idSndRain, (env_weather_snd_volume ? (*env_weather_snd_volume) : 1.f) * m_fRainVolume);
}
float CWeather::getCurrRainDensity()
......@@ -878,10 +878,10 @@ void CWeather::sndPlay()
m_isPlaying = true;
m_RndSnd.play();
if (m_idSndRain >= 0 && SSCore_SndStateGet(m_idSndRain) == SOUND_OBJSTATE_PAUSE)
if (m_idSndRain >= 0 && SSCore_SndGetState(m_idSndRain) == SOUND_OBJSTATE_PAUSE)
SSCore_SndPlay(m_idSndRain);
if (m_idSndThunder >= 0 && SSCore_SndStateGet(m_idSndThunder) == SOUND_OBJSTATE_PAUSE)
if (m_idSndThunder >= 0 && SSCore_SndGetState(m_idSndThunder) == SOUND_OBJSTATE_PAUSE)
SSCore_SndPlay(m_idSndThunder);
}
......@@ -893,10 +893,10 @@ void CWeather::sndPause()
m_isPlaying = false;
m_RndSnd.pause();
if (m_idSndRain >= 0 && SSCore_SndStateGet(m_idSndRain) == SOUND_OBJSTATE_PLAY)
if (m_idSndRain >= 0 && SSCore_SndGetState(m_idSndRain) == SOUND_OBJSTATE_PLAY)
SSCore_SndPause(m_idSndRain);
if (m_idSndThunder >= 0 && SSCore_SndStateGet(m_idSndThunder) == SOUND_OBJSTATE_PLAY)
if (m_idSndThunder >= 0 && SSCore_SndGetState(m_idSndThunder) == SOUND_OBJSTATE_PLAY)
SSCore_SndPause(m_idSndThunder);
}
......
......@@ -265,7 +265,7 @@ bool Lights::getExists(ID id) const
void Lights::DeleteLight(ID id)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->IsGlobal)
GlobalLight = -1;
......@@ -285,7 +285,7 @@ char* Lights::GetLightName(ID id)
void Lights::SetLightName(ID id, const char* name)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
sprintf(ArrLights[id]->Name, "%s", name);
}
......@@ -443,7 +443,7 @@ ID Lights::CreateDirection(ID id, const float3* pos, float dist, const float3* c
void Lights::Render(ID id, DWORD timeDelta)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
float4x4 tmpwmat = ArrLights[id]->WorldMat;
MLSet::DXDevice->SetTransform(D3DTS_WORLD, &(ArrLights[id]->WorldMat.operator D3DXMATRIX()));
......@@ -468,21 +468,21 @@ void Lights::SetCastGlobalShadow(bool isShadowed)
void Lights::GetLightColor(ID id, float3* vec) const
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
(*vec) = ArrLights[id]->Color;
}
void Lights::SetLightColor(ID id, const float3* vec)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->Color = *vec;
}
void Lights::GetLightPos(ID id, float3* vec, bool greal) const
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->IsGlobal && !greal)
{
......@@ -527,7 +527,7 @@ float Lights::GetLightDist(ID id) const
void Lights::SetLightDist(ID id, float radius_height, bool is_create)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->Dist = radius_height;
if (ArrLights[id]->TypeLight == LTYPE_LIGHT_DIR && is_create)
......@@ -562,7 +562,7 @@ void Lights::SetLightDist(ID id, float radius_height, bool is_create)
void Lights::SetLightPos(ID id, const float3* vec, bool greal)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->IsGlobal)
{
......@@ -615,14 +615,14 @@ void Lights::SetLightPos(ID id, const float3* vec, bool greal)
void Lights::GetLightOrient(ID id, SMQuaternion* q) const
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
*q = ArrLights[id]->Quaternion;
}
void Lights::SetLightOrient(ID id, const SMQuaternion* q)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->Quaternion = *q;
......@@ -634,7 +634,7 @@ void Lights::SetLightOrient(ID id, const SMQuaternion* q)
void Lights::SetShadowBias(ID id, float val)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowSM)
ArrLights[id]->ShadowSM->SetBias(val);
......@@ -733,7 +733,7 @@ bool Lights::GetLightEnable(ID id) const
void Lights::SetLightEnable(ID id, bool val)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->IsEnable = val;
LightCountUpdateNull(id);
......@@ -754,7 +754,7 @@ LTYPE_LIGHT Lights::GetLightType(ID id) const
void Lights::ShadowRenderBegin(ID id)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowSM)
ArrLights[id]->ShadowSM->Begin();
......@@ -766,7 +766,7 @@ void Lights::ShadowRenderBegin(ID id)
void Lights::ShadowRenderEnd(ID id)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowSM)
ArrLights[id]->ShadowSM->End();
......@@ -778,7 +778,7 @@ void Lights::ShadowRenderEnd(ID id)
void Lights::ShadowRenderPre(ID id, int cube)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
ArrLights[id]->ShadowCube->Pre(cube);
......@@ -788,7 +788,7 @@ void Lights::ShadowRenderPre(ID id, int cube)
void Lights::ShadowRenderPost(ID id, int cube)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
ArrLights[id]->ShadowCube->Post(cube);
......@@ -900,14 +900,14 @@ ISXFrustum* Lights::GetLightFrustumG(ID id, int split) const
void Lights::UpdateLightGFrustums(ID id, int split, const float3* pos, const float3* dir)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->ShadowPSSM->UpdateFrustums(split, pos, dir);
}
void Lights::ShadowGen2(ID id)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowSM)
ArrLights[id]->ShadowSM->GenShadow2(SGCore_RTGetTexture(ShadowMap));
......@@ -945,7 +945,7 @@ void Lights::ShadowNull()
void Lights::SetLightAngle(ID id, float angle, bool is_create)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->Angle = angle;
if (ArrLights[id]->TypeLight == LTYPE_LIGHT_DIR && is_create)
......@@ -972,7 +972,7 @@ void Lights::SetLightAngle(ID id, float angle, bool is_create)
void Lights::SetLightTopRadius(ID id, float top_radius)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->TypeLight == 1)
{
......@@ -994,7 +994,7 @@ void Lights::SetLightTopRadius(ID id, float top_radius)
void Lights::SetShadowBlurPixel(ID id, float blur_pixel)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
ArrLights[id]->ShadowCube->SetBlurPixel(blur_pixel);
......@@ -1021,7 +1021,7 @@ float Lights::GetShadowBlurPixel(ID id) const
void Lights::SetShadowLocalNear(ID id, float slnear)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
ArrLights[id]->ShadowCube->SetNear(slnear);
......@@ -1044,7 +1044,7 @@ float Lights::GetShadowLocalNear(ID id) const
void Lights::SetShadowLocalFar(ID id, float slfar)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
{
......@@ -1077,7 +1077,7 @@ float Lights::GetShadowLocalFar(ID id) const
void Lights::SetLightCubeEdgeEnable(ID id, int edge, bool enable)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowCube)
ArrLights[id]->ShadowCube->SetEnableCubeEdge(edge, enable);
......@@ -1118,7 +1118,7 @@ ID Lights::GetLightIDArr(ID id, ID inid, int how)
void Lights::SetLightIDArr(ID id, ID inid, int how, ID id_arr)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
if (ArrLights[id]->ShadowSM)
{
......@@ -1139,7 +1139,7 @@ void Lights::SetLightIDArr(ID id, ID inid, int how, ID id_arr)
void Lights::SetLightTypeShadowed(ID id, LTYPE_SHADOW type)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);
ArrLights[id]->TypeShadowed = type;
......@@ -1490,7 +1490,7 @@ void Lights::ToneMappingCom(DWORD timeDelta, float factor_adapted)
void Lights::Set4Or3Splits(ID id, bool is4)
{
LIGHTS_PRE_COND_ID(id);
LIGHTS_PRE_COND_ID(id, _VOID);