diff --git a/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe index b9aa0ca7..bade06bd 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/Debug/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe index a9f70c51..864d0305 100644 Binary files a/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/Debug/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/Debug/Readme.txt b/Vanda Engine Editor/Debug/Readme.txt index 04535294..4089d8c4 100644 --- a/Vanda Engine Editor/Debug/Readme.txt +++ b/Vanda Engine Editor/Debug/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.6.0 +Vanda Engine 2.7.0 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe index b9aa0ca7..bade06bd 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe index a9f70c51..864d0305 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/VandaEngineEditor/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/VandaEngineEditor/Assets/Icon/Vanda_Version.bmp b/Vanda Engine Editor/VandaEngineEditor/Assets/Icon/Vanda_Version.bmp index c2c7ca81..a74cc67c 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/Assets/Icon/Vanda_Version.bmp and b/Vanda Engine Editor/VandaEngineEditor/Assets/Icon/Vanda_Version.bmp differ diff --git a/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp b/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp index 68c82bd4..89a1d520 100644 --- a/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/EditProjectProperties.cpp @@ -149,7 +149,7 @@ void CEditProjectProperties::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", newProjectName, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", newProjectName, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //save changes to projects.dat @@ -230,7 +230,7 @@ void CEditProjectProperties::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", newProject->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", newProject->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //create new directory diff --git a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp index 34b324ed..b6658424 100644 --- a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/PerspectiveWindow.cpp @@ -2343,7 +2343,7 @@ CInt ShowPrefabInstance(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for ShowPrefabInstance()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for ShowPrefabInstance()", COLOR_RED); return 0; } CBool foundPrefabInstance = CFalse; @@ -2431,7 +2431,7 @@ CInt HidePrefabInstance(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for HidePrefabInstance()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for HidePrefabInstance()", COLOR_RED); return 0; } CBool foundPrefabInstance = CFalse; @@ -2519,7 +2519,7 @@ CInt PausePrefabInstanceAnimations(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for PausePrefabInstanceAnimations()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for PausePrefabInstanceAnimations()", COLOR_RED); return 0; } CScene* scene = NULL; @@ -2676,7 +2676,7 @@ CInt ResumePrefabInstanceAnimations(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for ResumePrefabInstanceAnimations()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for ResumePrefabInstanceAnimations()", COLOR_RED); return 0; } CScene* scene = NULL; @@ -3432,7 +3432,7 @@ CInt ActivateEngineCamera(lua_State* L) if (!foundTarget) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "%s%s%s", "\nActivateEngineCamera() Error: Couldn't find camera '", luaToString, "' to be activated."); + sprintf(temp, "%s%s%s", "\nActivateEngineCamera() Error: Couldn't find camera '", lua_tostring(L, 1), "' to be activated."); PrintInfo(temp, COLOR_RED); return 0; } @@ -6281,7 +6281,7 @@ CInt GetPrefabInstanceTranslate(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for GetPrefabInstanceTranslate()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceTranslate()", COLOR_RED); return 0; } CBool foundPrefabInstance = CFalse; @@ -6393,7 +6393,7 @@ CInt GetPrefabInstanceRotate(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for GetPrefabInstanceRotate()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceRotate()", COLOR_RED); return 0; } CBool foundPrefabInstance = CFalse; @@ -6505,7 +6505,7 @@ CInt GetPrefabInstanceScale(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for GetPrefabInstanceScale()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceScale()", COLOR_RED); return 0; } CBool foundPrefabInstance = CFalse; @@ -6617,7 +6617,7 @@ CInt GetPrefabInstanceRadius(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for GetPrefabInstanceRadius()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetPrefabInstanceRadius()", COLOR_RED); return 0; } @@ -6720,7 +6720,7 @@ CInt GetDistanceOfPrefabInstanceFromPhysicsCamera(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for GetDistanceOfPrefabInstanceFromPhysicsCamera()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetDistanceOfPrefabInstanceFromPhysicsCamera()", COLOR_RED); return 0; } @@ -7811,15 +7811,15 @@ CInt SetLightShininess(lua_State* L) return 0; } -CInt SetPrefabInstanceAmbient(lua_State* L) +CInt GetLightAmbient(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 4) + if (argc < 1) { - PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceAmbient()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetLightAmbient()", COLOR_RED); return 0; } @@ -7827,122 +7827,101 @@ CInt SetPrefabInstanceAmbient(lua_State* L) Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - CBool foundColorError = CFalse; - CFloat R = (CFloat)lua_tonumber(L, 2); - if (R < 0.0f || R > 1.0f) - { - PrintInfo("\nSecond argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat G = (CFloat)lua_tonumber(L, 3); - if (G < 0.0f || G > 1.0f) - { - PrintInfo("\nThird argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat B = (CFloat)lua_tonumber(L, 4); - if (B < 0.0f || B > 1.0f) - { - PrintInfo("\nFourth argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - if (foundColorError) - return 0; - - CFloat Color[4] = { R, G, B, 1.0f }; - - CBool foundPrefabInstance = CFalse; - - if (Cmp("THIS", luaToString)) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentInstancePrefab) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentInstancePrefab->SetAmbient(Color); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : GetLightAmbient(%s) will get ambient light color", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nSetPrefabInstanceAmbient() Error: Couldn't find current prefab instance", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nGetLightAmbient() Error: Couldn't find light '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } - return 0; - } - else if (g_editorMode == eMODE_PREFAB) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceAmbient(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); - PrintInfo(temp, COLOR_GREEN); - return 0; } + return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentLight) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) - { - CChar prefabInstanceName[MAX_NAME_SIZE]; - Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - StringToUpper(prefabInstanceName); + CFloat x = g_currentLight->GetAmbient()[0]; + CFloat y = g_currentLight->GetAmbient()[1]; + CFloat z = g_currentLight->GetAmbient()[2]; - if (Cmp(prefabInstanceName, luaToString)) - { - foundPrefabInstance = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceAmbient(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } - if (!foundPrefabInstance) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nGetLightAmbient Error: Couldn't find current light", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_instancePrefab.size(); i++) + for (CUInt i = 0; i < g_engineLights.size(); i++) { - CChar prefabName[MAX_NAME_SIZE]; - Cpy(prefabName, g_instancePrefab[i]->GetName()); - StringToUpper(prefabName); - if (Cmp(prefabName, luaToString)) + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) { - foundPrefabInstance = CTrue; - g_instancePrefab[i]->SetAmbient(Color); + CFloat x = g_engineLights[i]->m_abstractLight->GetAmbient()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetAmbient()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetAmbient()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } } - if (!foundPrefabInstance) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); - return 0; - } + + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nGetLightAmbient Error: Couldn't find light '%s'", lua_tostring(L, 1)); + PrintInfo(message, COLOR_RED); return 0; } -CInt SetPrefabInstanceDiffuse(lua_State* L) +CInt GetLightDiffuse(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 4) + if (argc < 1) { - PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceDiffuse()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetLightDiffuse()", COLOR_RED); return 0; } @@ -7950,114 +7929,285 @@ CInt SetPrefabInstanceDiffuse(lua_State* L) Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - CBool foundColorError = CFalse; - CFloat R = (CFloat)lua_tonumber(L, 2); - if (R < 0.0f || R > 1.0f) - { - PrintInfo("\nSecond argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat G = (CFloat)lua_tonumber(L, 3); - if (G < 0.0f || G > 1.0f) - { - PrintInfo("\nThird argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat B = (CFloat)lua_tonumber(L, 4); - if (B < 0.0f || B > 1.0f) - { - PrintInfo("\nFourth argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - if (foundColorError) - return 0; - - CFloat Color[4] = { R, G, B, 1.0f }; - - CBool foundPrefabInstance = CFalse; - - if (Cmp("THIS", luaToString)) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentInstancePrefab) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentInstancePrefab->SetDiffuse(Color); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : GetLightDiffuse(%s) will get diffuse light color", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nSetPrefabInstanceDiffuse() Error: Couldn't find current prefab instance", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nGetLightDiffuse() Error: Couldn't find light '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } - return 0; - } - else if (g_editorMode == eMODE_PREFAB) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceDiffuse(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); - PrintInfo(temp, COLOR_GREEN); - return 0; } + return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentLight) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) - { - CChar prefabInstanceName[MAX_NAME_SIZE]; - Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - StringToUpper(prefabInstanceName); + CFloat x = g_currentLight->GetDiffuse()[0]; + CFloat y = g_currentLight->GetDiffuse()[1]; + CFloat z = g_currentLight->GetDiffuse()[2]; - if (Cmp(prefabInstanceName, luaToString)) - { - foundPrefabInstance = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceDiffuse(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } - if (!foundPrefabInstance) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nGetLightDiffuse Error: Couldn't find current light", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_instancePrefab.size(); i++) + for (CUInt i = 0; i < g_engineLights.size(); i++) { - CChar prefabName[MAX_NAME_SIZE]; - Cpy(prefabName, g_instancePrefab[i]->GetName()); - StringToUpper(prefabName); - if (Cmp(prefabName, luaToString)) + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) { - foundPrefabInstance = CTrue; - g_instancePrefab[i]->SetDiffuse(Color); + CFloat x = g_engineLights[i]->m_abstractLight->GetDiffuse()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetDiffuse()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetDiffuse()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } } - if (!foundPrefabInstance) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); + + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nGetLightDiffuse Error: Couldn't find light '%s'", lua_tostring(L, 1)); + PrintInfo(message, COLOR_RED); + + return 0; +} + +CInt GetLightSpecular(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetLightSpecular()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + if (!Cmp(luaToString, "THIS")) + { + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : GetLightSpecular(%s) will get specular light color", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } + } + if (!foundTarget) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nGetLightSpecular() Error: Couldn't find light '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); + } + } + return 0; + } + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat x = g_currentLight->GetSpecular()[0]; + CFloat y = g_currentLight->GetSpecular()[1]; + CFloat z = g_currentLight->GetSpecular()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + else + { + PrintInfo("\nGetLightSpecular Error: Couldn't find current light", COLOR_RED); + } + return 0; } + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat x = g_engineLights[i]->m_abstractLight->GetSpecular()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetSpecular()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetSpecular()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + } + + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nGetLightSpecular Error: Couldn't find light '%s'", lua_tostring(L, 1)); + PrintInfo(message, COLOR_RED); + return 0; } -CInt SetPrefabInstanceSpecular(lua_State* L) +CInt GetLightShininess(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for GetLightShininess()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + if (!Cmp(luaToString, "THIS")) + { + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : GetLightShininess(%s) will get light shininess", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } + } + if (!foundTarget) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nGetLightShininess() Error: Couldn't find light '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); + } + } + return 0; + } + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat val = g_currentLight->GetShininess(); + lua_pushnumber(L, val); + return 1; + } + else + { + PrintInfo("\nGetLightShininess Error: Couldn't find current light", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat val = g_engineLights[i]->m_abstractLight->GetShininess(); + lua_pushnumber(L, val); + return 1; + } + } + + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nGetLightShininess Error: Couldn't find light '%s'", lua_tostring(L, 1)); + PrintInfo(message, COLOR_RED); + + return 0; +} + +CInt SetPrefabInstanceAmbient(lua_State* L) { if (g_testScript) return 0; @@ -8065,7 +8215,7 @@ CInt SetPrefabInstanceSpecular(lua_State* L) int argc = lua_gettop(L); if (argc < 4) { - PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceSpecular()", COLOR_RED); + PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceAmbient()", COLOR_RED); return 0; } @@ -8077,21 +8227,21 @@ CInt SetPrefabInstanceSpecular(lua_State* L) CFloat R = (CFloat)lua_tonumber(L, 2); if (R < 0.0f || R > 1.0f) { - PrintInfo("\nSecond argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nSecond argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } CFloat G = (CFloat)lua_tonumber(L, 3); if (G < 0.0f || G > 1.0f) { - PrintInfo("\nThird argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nThird argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } CFloat B = (CFloat)lua_tonumber(L, 4); if (B < 0.0f || B > 1.0f) { - PrintInfo("\nFourth argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nFourth argument of SetPrefabInstanceAmbient() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } @@ -8108,18 +8258,18 @@ CInt SetPrefabInstanceSpecular(lua_State* L) { if (g_currentInstancePrefab) { - g_currentInstancePrefab->SetSpecular(Color); + g_currentInstancePrefab->SetAmbient(Color); } else { - PrintInfo("\nSetPrefabInstanceSpecular() Error: Couldn't find current prefab instance", COLOR_RED); + PrintInfo("\nSetPrefabInstanceAmbient() Error: Couldn't find current prefab instance", COLOR_RED); } return 0; } else if (g_editorMode == eMODE_PREFAB) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceSpecular(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); + sprintf(temp, "\nSetPrefabInstanceAmbient(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); PrintInfo(temp, COLOR_GREEN); return 0; } @@ -8141,7 +8291,7 @@ CInt SetPrefabInstanceSpecular(lua_State* L) { foundPrefabInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceSpecular(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); + sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceAmbient(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); PrintInfo(message, COLOR_GREEN); break; } @@ -8151,7 +8301,7 @@ CInt SetPrefabInstanceSpecular(lua_State* L) if (!foundPrefabInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + sprintf(temp, "\nSetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); PrintInfo(temp, COLOR_RED); } @@ -8166,13 +8316,13 @@ CInt SetPrefabInstanceSpecular(lua_State* L) if (Cmp(prefabName, luaToString)) { foundPrefabInstance = CTrue; - g_instancePrefab[i]->SetSpecular(Color); + g_instancePrefab[i]->SetAmbient(Color); } } if (!foundPrefabInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + sprintf(temp, "\nSetPrefabInstanceAmbient() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); PrintInfo(temp, COLOR_RED); return 0; } @@ -8180,7 +8330,7 @@ CInt SetPrefabInstanceSpecular(lua_State* L) return 0; } -CInt SetPrefabInstanceEmission(lua_State* L) +CInt SetPrefabInstanceDiffuse(lua_State* L) { if (g_testScript) return 0; @@ -8188,7 +8338,7 @@ CInt SetPrefabInstanceEmission(lua_State* L) int argc = lua_gettop(L); if (argc < 4) { - PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceEmission()", COLOR_RED); + PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceDiffuse()", COLOR_RED); return 0; } @@ -8200,21 +8350,21 @@ CInt SetPrefabInstanceEmission(lua_State* L) CFloat R = (CFloat)lua_tonumber(L, 2); if (R < 0.0f || R > 1.0f) { - PrintInfo("\nSecond argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nSecond argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } CFloat G = (CFloat)lua_tonumber(L, 3); if (G < 0.0f || G > 1.0f) { - PrintInfo("\nThird argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nThird argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } CFloat B = (CFloat)lua_tonumber(L, 4); if (B < 0.0f || B > 1.0f) { - PrintInfo("\nFourth argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + PrintInfo("\nFourth argument of SetPrefabInstanceDiffuse() must be between 0.0 and 1.0", COLOR_RED); foundColorError = CTrue; } @@ -8231,18 +8381,18 @@ CInt SetPrefabInstanceEmission(lua_State* L) { if (g_currentInstancePrefab) { - g_currentInstancePrefab->SetEmission(Color); + g_currentInstancePrefab->SetDiffuse(Color); } else { - PrintInfo("\nSetPrefabInstanceEmission() Error: Couldn't find current prefab instance", COLOR_RED); + PrintInfo("\nSetPrefabInstanceDiffuse() Error: Couldn't find current prefab instance", COLOR_RED); } return 0; } else if (g_editorMode == eMODE_PREFAB) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceEmission(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); + sprintf(temp, "\nSetPrefabInstanceDiffuse(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); PrintInfo(temp, COLOR_GREEN); return 0; } @@ -8264,7 +8414,7 @@ CInt SetPrefabInstanceEmission(lua_State* L) { foundPrefabInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceEmission(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); + sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceDiffuse(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); PrintInfo(message, COLOR_GREEN); break; } @@ -8274,7 +8424,7 @@ CInt SetPrefabInstanceEmission(lua_State* L) if (!foundPrefabInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + sprintf(temp, "\nSetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); PrintInfo(temp, COLOR_RED); } @@ -8289,13 +8439,13 @@ CInt SetPrefabInstanceEmission(lua_State* L) if (Cmp(prefabName, luaToString)) { foundPrefabInstance = CTrue; - g_instancePrefab[i]->SetEmission(Color); + g_instancePrefab[i]->SetDiffuse(Color); } } if (!foundPrefabInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + sprintf(temp, "\nSetPrefabInstanceDiffuse() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); PrintInfo(temp, COLOR_RED); return 0; } @@ -8303,15 +8453,15 @@ CInt SetPrefabInstanceEmission(lua_State* L) return 0; } -CInt SetPrefabInstanceShininess(lua_State* L) +CInt SetPrefabInstanceSpecular(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 2) + if (argc < 4) { - PrintInfo("\nPlease specify 2 arguments for SetPrefabInstanceShininess()", COLOR_RED); + PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceSpecular()", COLOR_RED); return 0; } @@ -8319,13 +8469,33 @@ CInt SetPrefabInstanceShininess(lua_State* L) Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - CFloat shininess = (CFloat)lua_tonumber(L, 2); - if (shininess < 0.0f) + CBool foundColorError = CFalse; + CFloat R = (CFloat)lua_tonumber(L, 2); + if (R < 0.0f || R > 1.0f) { - PrintInfo("\nSecond argument of SetPrefabInstanceShininess() must be 0.0 or higher", COLOR_RED); - return 0; + PrintInfo("\nSecond argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } + + CFloat G = (CFloat)lua_tonumber(L, 3); + if (G < 0.0f || G > 1.0f) + { + PrintInfo("\nThird argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } + + CFloat B = (CFloat)lua_tonumber(L, 4); + if (B < 0.0f || B > 1.0f) + { + PrintInfo("\nFourth argument of SetPrefabInstanceSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } + if (foundColorError) + return 0; + + CFloat Color[4] = { R, G, B, 1.0f }; + CBool foundPrefabInstance = CFalse; if (Cmp("THIS", luaToString)) @@ -8334,18 +8504,244 @@ CInt SetPrefabInstanceShininess(lua_State* L) { if (g_currentInstancePrefab) { - g_currentInstancePrefab->SetShininess(shininess); + g_currentInstancePrefab->SetSpecular(Color); } else { - PrintInfo("\nSetPrefabInstanceShininess() Error: Couldn't find current prefab instance", COLOR_RED); + PrintInfo("\nSetPrefabInstanceSpecular() Error: Couldn't find current prefab instance", COLOR_RED); } return 0; } else if (g_editorMode == eMODE_PREFAB) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\nSetPrefabInstanceShininess(%.2f) will execute for current prefab instance", shininess); + sprintf(temp, "\nSetPrefabInstanceSpecular(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceSpecular(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + g_instancePrefab[i]->SetSpecular(Color); + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceSpecular() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt SetPrefabInstanceEmission(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 4) + { + PrintInfo("\nPlease specify 4 arguments for SetPrefabInstanceEmission()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CBool foundColorError = CFalse; + CFloat R = (CFloat)lua_tonumber(L, 2); + if (R < 0.0f || R > 1.0f) + { + PrintInfo("\nSecond argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } + + CFloat G = (CFloat)lua_tonumber(L, 3); + if (G < 0.0f || G > 1.0f) + { + PrintInfo("\nThird argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } + + CFloat B = (CFloat)lua_tonumber(L, 4); + if (B < 0.0f || B > 1.0f) + { + PrintInfo("\nFourth argument of SetPrefabInstanceEmission() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } + + if (foundColorError) + return 0; + + CFloat Color[4] = { R, G, B, 1.0f }; + + CBool foundPrefabInstance = CFalse; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + g_currentInstancePrefab->SetEmission(Color); + } + else + { + PrintInfo("\nSetPrefabInstanceEmission() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceEmission(%.2f, %.2f, %.2f) will execute for current prefab instance", R, G, B); + PrintInfo(temp, COLOR_GREEN); + return 0; + } + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nProject '%s', VScene '%s' : SetPrefabInstanceEmission(%s, %.2f, %.2f, %.2f) will execute", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name, R, G, B); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + g_instancePrefab[i]->SetEmission(Color); + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceEmission() Error: %s%s%s", "Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt SetPrefabInstanceShininess(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 2) + { + PrintInfo("\nPlease specify 2 arguments for SetPrefabInstanceShininess()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat shininess = (CFloat)lua_tonumber(L, 2); + if (shininess < 0.0f) + { + PrintInfo("\nSecond argument of SetPrefabInstanceShininess() must be 0.0 or higher", COLOR_RED); + return 0; + } + + CBool foundPrefabInstance = CFalse; + + if (Cmp("THIS", luaToString)) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + g_currentInstancePrefab->SetShininess(shininess); + } + else + { + PrintInfo("\nSetPrefabInstanceShininess() Error: Couldn't find current prefab instance", COLOR_RED); + } + return 0; + } + else if (g_editorMode == eMODE_PREFAB) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nSetPrefabInstanceShininess(%.2f) will execute for current prefab instance", shininess); PrintInfo(temp, COLOR_GREEN); return 0; } @@ -20387,7 +20783,7 @@ CInt DeletePrefabInstance(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 arguments for DeletePrefabInstance()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for DeletePrefabInstance()", COLOR_RED); return 0; } @@ -28639,440 +29035,1751 @@ CInt ResumeAllUpdateEvents(lua_State* L) break; } } - if (foundException) - continue; + if (foundException) + continue; + + g_engineCameraInstances[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeAllUpdateEvents warning: Couldn't find '%s' game object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfAllPrefabInstances(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAllPrefabInstances() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_instancePrefab[i]->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_instancePrefab[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAllPrefabInstances warning: Couldn't find '%s' prefab instance object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfVSceneScript(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfVSceneScript() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + if (g_VSceneScript) + g_VSceneScript->SetUpdateEvent(CTrue); + + return 0; +} + +CInt ResumeUpdateEventOfSky(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfSky() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + if (g_skyDome) + g_skyDome->SetUpdateEvent(CTrue); + + return 0; +} + +CInt ResumeUpdateEventOfAllWaters(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAllWaters() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_engineWaters.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_engineWaters[i]->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_engineWaters[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAllWaters warning: Couldn't find '%s' water object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfAllLights(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAllLights() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_engineLights[i]->m_abstractLight->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_engineLights[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAllLights warning: Couldn't find '%s' light object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfAll3DSounds(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAll3DSounds() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_engine3DSounds.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_engine3DSounds[i]->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_engine3DSounds[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAll3DSounds warning: Couldn't find '%s' 3D sound object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfAllAmbientSounds(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAllAmbientSounds() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_engineAmbientSounds[i]->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_engineAmbientSounds[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAllAmbientSounds warning: Couldn't find '%s' ambient sound object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + +CInt ResumeUpdateEventOfMainCharacter(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfMainCharacter() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + if (g_mainCharacter) + g_mainCharacter->SetUpdateEvent(CTrue); + + return 0; +} + +CInt ResumeUpdateEventOfTerrain(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfTerrain() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + if (g_terrain) + g_terrain->SetUpdateEvent(CTrue); + + return 0; +} + +CInt ResumeUpdateEventOfAllEngineCameras(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nResumeUpdateEventOfAllEngineCameras() will be executed for current VScene", COLOR_GREEN); + return 0; + } + + std::vector m_exception; + std::vectorm_foundException; + + int argc = lua_gettop(L); + + for (int n = 1; n <= argc; ++n) + { + CChar name[MAX_NAME_SIZE]; + Cpy(name, lua_tostring(L, n)); + m_exception.push_back(name); + m_foundException.push_back(CFalse); + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CBool foundException = CFalse; + for (CUInt j = 0; j < m_exception.size(); j++) + { + if (Cmp(g_engineCameraInstances[i]->m_abstractCamera->GetName(), m_exception[j].c_str())) + { + foundException = CTrue; + m_foundException[j] = CTrue; + break; + } + } + if (foundException) + continue; + + g_engineCameraInstances[i]->SetUpdateEvent(CTrue); + } + + for (CUInt i = 0; i < m_foundException.size(); i++) + { + if (!m_foundException[i]) + { + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAllEngineCameras warning: Couldn't find '%s' camera object", m_exception[i].c_str()); + PrintInfo(message, COLOR_YELLOW); + } + } + + m_exception.clear(); + + return 0; +} + + +//Pause script Update event of individual game objects +CInt PauseUpdateEventOfPrefabInstance(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfPrefabInstance()", COLOR_RED); + return 0; + } + + CBool foundPrefabInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Prefab Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + g_currentInstancePrefab->SetUpdateEvent(CFalse); + + } + else + { + PrintInfo("\nPauseUpdateEventOfPrefabInstance() Error: Couldn't find current prefab instance", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOfPrefabInstance() will execute for current prefab instance", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOfPrefabInstance() will execute for Project '%s', VScene '%s', Prefab Instance '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + + g_instancePrefab[i]->SetUpdateEvent(CFalse); + } + } + + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt PauseUpdateEventOfWater(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfWater()", COLOR_RED); + return 0; + } + + CBool foundWater = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Water Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentWater) + { + g_currentWater->SetUpdateEvent(CFalse); + + } + else + { + PrintInfo("\nPauseUpdateEventOfWater() Error: Couldn't find current water", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOfWater() will execute for current water", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames.size(); j++) + { + CChar waterName[MAX_NAME_SIZE]; + Cpy(waterName, g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); + StringToUpper(waterName); + + if (Cmp(waterName, luaToString)) + { + foundWater = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOfWater() will execute for Project '%s', VScene '%s', Water '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundWater) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineWaters.size(); i++) + { + CChar waterName[MAX_NAME_SIZE]; + Cpy(waterName, g_engineWaters[i]->GetName()); + StringToUpper(waterName); + if (Cmp(waterName, luaToString)) + { + foundWater = CTrue; + + g_engineWaters[i]->SetUpdateEvent(CFalse); + } + } + + if (!foundWater) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt PauseUpdateEventOfLight(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfLight()", COLOR_RED); + return 0; + } + + CBool foundLight = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Light Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentLight) + { + g_currentLight->m_instanceLight->SetUpdateEvent(CFalse); + } + else + { + PrintInfo("\nPauseUpdateEventOfLight() Error: Couldn't find current light", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOfLight() will execute for current light", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + foundLight = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOfLight() will execute for Project '%s', VScene '%s', Light '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundLight) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + if (Cmp(lightName, luaToString)) + { + foundLight = CTrue; + + g_engineLights[i]->SetUpdateEvent(CFalse); + } + } + + if (!foundLight) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt PauseUpdateEventOf3DSound(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOf3DSound()", COLOR_RED); + return 0; + } + + CBool found3DSound = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //3DSound Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_current3DSound) + { + g_current3DSound->SetUpdateEvent(CFalse); + + } + else + { + PrintInfo("\nPauseUpdateEventOf3DSound() Error: Couldn't find current 3D sound", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOf3DSound() will execute for current 3D sound", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames.size(); j++) + { + CChar threeDSoundName[MAX_NAME_SIZE]; + Cpy(threeDSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); + StringToUpper(threeDSoundName); + + if (Cmp(threeDSoundName, luaToString)) + { + found3DSound = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOf3DSound() will execute for Project '%s', VScene '%s', 3D Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!found3DSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engine3DSounds.size(); i++) + { + CChar threeDSoundName[MAX_NAME_SIZE]; + Cpy(threeDSoundName, g_engine3DSounds[i]->GetName()); + StringToUpper(threeDSoundName); + if (Cmp(threeDSoundName, luaToString)) + { + found3DSound = CTrue; + + g_engine3DSounds[i]->SetUpdateEvent(CFalse); + } + } + + if (!found3DSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt PauseUpdateEventOfAmbientSound(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfAmbientSound()", COLOR_RED); + return 0; + } + + CBool foundAmbientSound = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Ambient Sound Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentAmbientSound) + { + g_currentAmbientSound->SetUpdateEvent(CFalse); + + } + else + { + PrintInfo("\nPauseUpdateEventOfAmbientSound() Error: Couldn't find current ambient sound", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOfAmbientSound() will execute for current ambient sound", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames.size(); j++) + { + CChar ambientSoundName[MAX_NAME_SIZE]; + Cpy(ambientSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); + StringToUpper(ambientSoundName); + + if (Cmp(ambientSoundName, luaToString)) + { + foundAmbientSound = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOfAmbientSound() will execute for Project '%s', VScene '%s', Ambient Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundAmbientSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) + { + CChar ambientSoundName[MAX_NAME_SIZE]; + Cpy(ambientSoundName, g_engineAmbientSounds[i]->GetName()); + StringToUpper(ambientSoundName); + if (Cmp(ambientSoundName, luaToString)) + { + foundAmbientSound = CTrue; + + g_engineAmbientSounds[i]->SetUpdateEvent(CFalse); + } + } + + if (!foundAmbientSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt PauseUpdateEventOfEngineCamera(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfEngineCamera()", COLOR_RED); + return 0; + } + + CBool foundEngineCamera = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Engine Camera Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetUpdateEvent(CFalse); + + } + else + { + PrintInfo("\nPauseUpdateEventOfEngineCamera() Error: Couldn't find current engine camera", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nPauseUpdateEventOfEngineCamera() will execute for current engine camera", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar engineCameraName[MAX_NAME_SIZE]; + Cpy(engineCameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(engineCameraName); + + if (Cmp(engineCameraName, luaToString)) + { + foundEngineCamera = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nPauseUpdateEventOfEngineCamera() will execute for Project '%s', VScene '%s', Engine Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundEngineCamera) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar engineCameraName[MAX_NAME_SIZE]; + Cpy(engineCameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(engineCameraName); + if (Cmp(engineCameraName, luaToString)) + { + foundEngineCamera = CTrue; + + g_engineCameraInstances[i]->SetUpdateEvent(CFalse); + } + } + + if (!foundEngineCamera) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +//Resume script Update event of individual game objects +CInt ResumeUpdateEventOfPrefabInstance(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfPrefabInstance()", COLOR_RED); + return 0; + } + + CBool foundPrefabInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Prefab Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentInstancePrefab) + { + g_currentInstancePrefab->SetUpdateEvent(CTrue); + + } + else + { + PrintInfo("\nResumeUpdateEventOfPrefabInstance() Error: Couldn't find current prefab instance", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOfPrefabInstance() will execute for current prefab instance", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) + { + CChar prefabInstanceName[MAX_NAME_SIZE]; + Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + StringToUpper(prefabInstanceName); + + if (Cmp(prefabInstanceName, luaToString)) + { + foundPrefabInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOfPrefabInstance() will execute for Project '%s', VScene '%s', Prefab Instance '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_instancePrefab.size(); i++) + { + CChar prefabName[MAX_NAME_SIZE]; + Cpy(prefabName, g_instancePrefab[i]->GetName()); + StringToUpper(prefabName); + if (Cmp(prefabName, luaToString)) + { + foundPrefabInstance = CTrue; + + g_instancePrefab[i]->SetUpdateEvent(CTrue); + } + } + + if (!foundPrefabInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); + PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt ResumeUpdateEventOfWater(lua_State* L) +{ + if (g_testScript) + return 0; + + int argc = lua_gettop(L); + if (argc < 1) + { + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfWater()", COLOR_RED); + return 0; + } + + CBool foundWater = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Water Name- First Argument + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentWater) + { + g_currentWater->SetUpdateEvent(CTrue); + + } + else + { + PrintInfo("\nResumeUpdateEventOfWater() Error: Couldn't find current water", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOfWater() will execute for current water", COLOR_GREEN); + } + return 0; + } + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames.size(); j++) + { + CChar waterName[MAX_NAME_SIZE]; + Cpy(waterName, g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); + StringToUpper(waterName); + + if (Cmp(waterName, luaToString)) + { + foundWater = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOfWater() will execute for Project '%s', VScene '%s', Water '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundWater) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); + PrintInfo(temp, COLOR_RED); + } - g_engineCameraInstances[i]->SetUpdateEvent(CTrue); + return 0; } - for (CUInt i = 0; i < m_foundException.size(); i++) + for (CUInt i = 0; i < g_engineWaters.size(); i++) { - if (!m_foundException[i]) + CChar waterName[MAX_NAME_SIZE]; + Cpy(waterName, g_engineWaters[i]->GetName()); + StringToUpper(waterName); + if (Cmp(waterName, luaToString)) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeAllUpdateEvents warning: Couldn't find '%s' game object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); + foundWater = CTrue; + + g_engineWaters[i]->SetUpdateEvent(CTrue); } } - m_exception.clear(); + if (!foundWater) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); + PrintInfo(temp, COLOR_RED); + return 0; + } return 0; } -CInt ResumeUpdateEventOfAllPrefabInstances(lua_State* L) +CInt ResumeUpdateEventOfLight(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 1) { - PrintInfo("\nResumeUpdateEventOfAllPrefabInstances() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfLight()", COLOR_RED); return 0; } - std::vector m_exception; - std::vectorm_foundException; + CBool foundLight = CFalse; - int argc = lua_gettop(L); + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Light Name- First Argument + StringToUpper(luaToString); - for (int n = 1; n <= argc; ++n) + if (Cmp(luaToString, "THIS")) { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentLight) + { + g_currentLight->m_instanceLight->SetUpdateEvent(CTrue); + } + else + { + PrintInfo("\nResumeUpdateEventOfLight() Error: Couldn't find current light", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOfLight() will execute for current light", COLOR_GREEN); + } + return 0; } - for (CUInt i = 0; i < g_instancePrefab.size(); i++) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - if (Cmp(g_instancePrefab[i]->GetName(), m_exception[j].c_str())) + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - foundException = CTrue; - m_foundException[j] = CTrue; - break; + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + StringToUpper(lightName); + + if (Cmp(lightName, luaToString)) + { + foundLight = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOfLight() will execute for Project '%s', VScene '%s', Light '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } } } - if (foundException) - continue; + if (!foundLight) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + PrintInfo(temp, COLOR_RED); + } - g_instancePrefab[i]->SetUpdateEvent(CTrue); + return 0; } - for (CUInt i = 0; i < m_foundException.size(); i++) + for (CUInt i = 0; i < g_engineLights.size(); i++) { - if (!m_foundException[i]) + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + if (Cmp(lightName, luaToString)) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAllPrefabInstances warning: Couldn't find '%s' prefab instance object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); + foundLight = CTrue; + + g_engineLights[i]->SetUpdateEvent(CTrue); } } - m_exception.clear(); - - return 0; -} - -CInt ResumeUpdateEventOfVSceneScript(lua_State* L) -{ - if (g_testScript) - return 0; - - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (!foundLight) { - PrintInfo("\nResumeUpdateEventOfVSceneScript() will be executed for current VScene", COLOR_GREEN); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + PrintInfo(temp, COLOR_RED); return 0; } - if (g_VSceneScript) - g_VSceneScript->SetUpdateEvent(CTrue); - return 0; } -CInt ResumeUpdateEventOfSky(lua_State* L) +CInt ResumeUpdateEventOf3DSound(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 1) { - PrintInfo("\nResumeUpdateEventOfSky() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOf3DSound()", COLOR_RED); return 0; } - if (g_skyDome) - g_skyDome->SetUpdateEvent(CTrue); - - return 0; -} + CBool found3DSound = CFalse; -CInt ResumeUpdateEventOfAllWaters(lua_State* L) -{ - if (g_testScript) - return 0; + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //3DSound Name- First Argument + StringToUpper(luaToString); - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - PrintInfo("\nResumeUpdateEventOfAllWaters() will be executed for current VScene", COLOR_GREEN); - return 0; - } - - std::vector m_exception; - std::vectorm_foundException; - - int argc = lua_gettop(L); + if (g_editorMode == eMODE_VSCENE) + { + if (g_current3DSound) + { + g_current3DSound->SetUpdateEvent(CTrue); - for (int n = 1; n <= argc; ++n) - { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + } + else + { + PrintInfo("\nResumeUpdateEventOf3DSound() Error: Couldn't find current 3D sound", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOf3DSound() will execute for current 3D sound", COLOR_GREEN); + } + return 0; } - for (CUInt i = 0; i < g_engineWaters.size(); i++) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - if (Cmp(g_engineWaters[i]->GetName(), m_exception[j].c_str())) + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - foundException = CTrue; - m_foundException[j] = CTrue; - break; + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames.size(); j++) + { + CChar threeDSoundName[MAX_NAME_SIZE]; + Cpy(threeDSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); + StringToUpper(threeDSoundName); + + if (Cmp(threeDSoundName, luaToString)) + { + found3DSound = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOf3DSound() will execute for Project '%s', VScene '%s', 3D Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } } } - if (foundException) - continue; + if (!found3DSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + PrintInfo(temp, COLOR_RED); + } - g_engineWaters[i]->SetUpdateEvent(CTrue); + return 0; } - for (CUInt i = 0; i < m_foundException.size(); i++) + for (CUInt i = 0; i < g_engine3DSounds.size(); i++) { - if (!m_foundException[i]) + CChar threeDSoundName[MAX_NAME_SIZE]; + Cpy(threeDSoundName, g_engine3DSounds[i]->GetName()); + StringToUpper(threeDSoundName); + if (Cmp(threeDSoundName, luaToString)) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAllWaters warning: Couldn't find '%s' water object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); + found3DSound = CTrue; + + g_engine3DSounds[i]->SetUpdateEvent(CTrue); } } - m_exception.clear(); + if (!found3DSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + PrintInfo(temp, COLOR_RED); + return 0; + } return 0; } -CInt ResumeUpdateEventOfAllLights(lua_State* L) +CInt ResumeUpdateEventOfAmbientSound(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 1) { - PrintInfo("\nResumeUpdateEventOfAllLights() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfAmbientSound()", COLOR_RED); return 0; } - std::vector m_exception; - std::vectorm_foundException; + CBool foundAmbientSound = CFalse; - int argc = lua_gettop(L); + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Ambient Sound Name- First Argument + StringToUpper(luaToString); - for (int n = 1; n <= argc; ++n) + if (Cmp(luaToString, "THIS")) { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentAmbientSound) + { + g_currentAmbientSound->SetUpdateEvent(CTrue); + + } + else + { + PrintInfo("\nResumeUpdateEventOfAmbientSound() Error: Couldn't find current ambient sound", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOfAmbientSound() will execute for current ambient sound", COLOR_GREEN); + } + return 0; } - for (CUInt i = 0; i < g_engineLights.size(); i++) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - if (Cmp(g_engineLights[i]->m_abstractLight->GetName(), m_exception[j].c_str())) + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - foundException = CTrue; - m_foundException[j] = CTrue; - break; + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames.size(); j++) + { + CChar ambientSoundName[MAX_NAME_SIZE]; + Cpy(ambientSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); + StringToUpper(ambientSoundName); + + if (Cmp(ambientSoundName, luaToString)) + { + foundAmbientSound = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOfAmbientSound() will execute for Project '%s', VScene '%s', Ambient Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } } } - if (foundException) - continue; + if (!foundAmbientSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + PrintInfo(temp, COLOR_RED); + } - g_engineLights[i]->SetUpdateEvent(CTrue); + return 0; } - for (CUInt i = 0; i < m_foundException.size(); i++) + for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) { - if (!m_foundException[i]) + CChar ambientSoundName[MAX_NAME_SIZE]; + Cpy(ambientSoundName, g_engineAmbientSounds[i]->GetName()); + StringToUpper(ambientSoundName); + if (Cmp(ambientSoundName, luaToString)) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAllLights warning: Couldn't find '%s' light object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); + foundAmbientSound = CTrue; + + g_engineAmbientSounds[i]->SetUpdateEvent(CTrue); } } - m_exception.clear(); + if (!foundAmbientSound) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + PrintInfo(temp, COLOR_RED); + return 0; + } return 0; } -CInt ResumeUpdateEventOfAll3DSounds(lua_State* L) +CInt ResumeUpdateEventOfEngineCamera(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 1) { - PrintInfo("\nResumeUpdateEventOfAll3DSounds() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfEngineCamera()", COLOR_RED); return 0; } - std::vector m_exception; - std::vectorm_foundException; + CBool foundEngineCamera = CFalse; - int argc = lua_gettop(L); + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Engine Camera Name- First Argument + StringToUpper(luaToString); - for (int n = 1; n <= argc; ++n) + if (Cmp(luaToString, "THIS")) { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + if (g_editorMode == eMODE_VSCENE) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetUpdateEvent(CTrue); + + } + else + { + PrintInfo("\nResumeUpdateEventOfEngineCamera() Error: Couldn't find current engine camera", COLOR_RED); + } + } + else if (g_editorMode == eMODE_PREFAB) + { + PrintInfo("\nResumeUpdateEventOfEngineCamera() will execute for current engine camera", COLOR_GREEN); + } + return 0; } - for (CUInt i = 0; i < g_engine3DSounds.size(); i++) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - if (Cmp(g_engine3DSounds[i]->GetName(), m_exception[j].c_str())) + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - foundException = CTrue; - m_foundException[j] = CTrue; - break; + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar engineCameraName[MAX_NAME_SIZE]; + Cpy(engineCameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(engineCameraName); + + if (Cmp(engineCameraName, luaToString)) + { + foundEngineCamera = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nResumeUpdateEventOfEngineCamera() will execute for Project '%s', VScene '%s', Engine Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } } } - if (foundException) - continue; + if (!foundEngineCamera) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + PrintInfo(temp, COLOR_RED); + } - g_engine3DSounds[i]->SetUpdateEvent(CTrue); + return 0; } - for (CUInt i = 0; i < m_foundException.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - if (!m_foundException[i]) + CChar engineCameraName[MAX_NAME_SIZE]; + Cpy(engineCameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(engineCameraName); + if (Cmp(engineCameraName, luaToString)) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAll3DSounds warning: Couldn't find '%s' 3D sound object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); + foundEngineCamera = CTrue; + + g_engineCameraInstances[i]->SetUpdateEvent(CTrue); } } - m_exception.clear(); + if (!foundEngineCamera) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + PrintInfo(temp, COLOR_RED); + return 0; + } return 0; } -CInt ResumeUpdateEventOfAllAmbientSounds(lua_State* L) +//Terrain +CInt SetTerrainAmbient(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 3) { - PrintInfo("\nResumeUpdateEventOfAllAmbientSounds() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 3 arguments for SetTerrainAmbient()", COLOR_RED); return 0; } - std::vector m_exception; - std::vectorm_foundException; - - int argc = lua_gettop(L); - - for (int n = 1; n <= argc; ++n) + CBool foundColorError = CFalse; + CFloat R = (CFloat)lua_tonumber(L, 1); + if (R < 0.0f || R > 1.0f) { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + PrintInfo("\nFirst argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } - for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) + CFloat G = (CFloat)lua_tonumber(L, 2); + if (G < 0.0f || G > 1.0f) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) - { - if (Cmp(g_engineAmbientSounds[i]->GetName(), m_exception[j].c_str())) - { - foundException = CTrue; - m_foundException[j] = CTrue; - break; - } - } - if (foundException) - continue; + PrintInfo("\nSecond argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } - g_engineAmbientSounds[i]->SetUpdateEvent(CTrue); + CFloat B = (CFloat)lua_tonumber(L, 3); + if (B < 0.0f || B > 1.0f) + { + PrintInfo("\nThird argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } - for (CUInt i = 0; i < m_foundException.size(); i++) + if (foundColorError) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (!m_foundException[i]) - { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAllAmbientSounds warning: Couldn't find '%s' ambient sound object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); - } + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nSetTerrainAmbient(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); + PrintInfo(message, COLOR_GREEN); + return 0; } - m_exception.clear(); + CFloat Color[4] = { R, G, B, 1.0f }; + + if (g_terrain) + g_terrain->SetAmbientColor(Color); return 0; } -CInt ResumeUpdateEventOfMainCharacter(lua_State* L) +CInt SetTerrainDiffuse(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 3) + { + PrintInfo("\nPlease specify 3 arguments for SetTerrainDiffuse()", COLOR_RED); + return 0; + } + + CBool foundColorError = CFalse; + CFloat R = (CFloat)lua_tonumber(L, 1); + if (R < 0.0f || R > 1.0f) { - PrintInfo("\nResumeUpdateEventOfMainCharacter() will be executed for current VScene", COLOR_GREEN); - return 0; + PrintInfo("\nFirst argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } - if (g_mainCharacter) - g_mainCharacter->SetUpdateEvent(CTrue); + CFloat G = (CFloat)lua_tonumber(L, 2); + if (G < 0.0f || G > 1.0f) + { + PrintInfo("\nSecond argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } - return 0; -} + CFloat B = (CFloat)lua_tonumber(L, 3); + if (B < 0.0f || B > 1.0f) + { + PrintInfo("\nThird argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } -CInt ResumeUpdateEventOfTerrain(lua_State* L) -{ - if (g_testScript) + if (foundColorError) return 0; if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - PrintInfo("\nResumeUpdateEventOfTerrain() will be executed for current VScene", COLOR_GREEN); + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nSetTerrainDiffuse(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); + PrintInfo(message, COLOR_GREEN); return 0; } + CFloat Color[4] = { R, G, B, 1.0f }; + if (g_terrain) - g_terrain->SetUpdateEvent(CTrue); + g_terrain->SetDiffuseColor(Color); return 0; } -CInt ResumeUpdateEventOfAllEngineCameras(lua_State* L) +CInt SetTerrainSpecular(lua_State* L) { if (g_testScript) return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + int argc = lua_gettop(L); + if (argc < 3) { - PrintInfo("\nResumeUpdateEventOfAllEngineCameras() will be executed for current VScene", COLOR_GREEN); + PrintInfo("\nPlease specify 3 arguments for SetTerrainSpecular()", COLOR_RED); return 0; } - std::vector m_exception; - std::vectorm_foundException; - - int argc = lua_gettop(L); - - for (int n = 1; n <= argc; ++n) + CBool foundColorError = CFalse; + CFloat R = (CFloat)lua_tonumber(L, 1); + if (R < 0.0f || R > 1.0f) { - CChar name[MAX_NAME_SIZE]; - Cpy(name, lua_tostring(L, n)); - m_exception.push_back(name); - m_foundException.push_back(CFalse); + PrintInfo("\nFirst argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } - for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + CFloat G = (CFloat)lua_tonumber(L, 2); + if (G < 0.0f || G > 1.0f) { - CBool foundException = CFalse; - for (CUInt j = 0; j < m_exception.size(); j++) - { - if (Cmp(g_engineCameraInstances[i]->m_abstractCamera->GetName(), m_exception[j].c_str())) - { - foundException = CTrue; - m_foundException[j] = CTrue; - break; - } - } - if (foundException) - continue; + PrintInfo("\nSecond argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; + } - g_engineCameraInstances[i]->SetUpdateEvent(CTrue); + CFloat B = (CFloat)lua_tonumber(L, 3); + if (B < 0.0f || B > 1.0f) + { + PrintInfo("\nThird argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); + foundColorError = CTrue; } - for (CUInt i = 0; i < m_foundException.size(); i++) + if (foundColorError) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (!m_foundException[i]) - { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAllEngineCameras warning: Couldn't find '%s' camera object", m_exception[i].c_str()); - PrintInfo(message, COLOR_YELLOW); - } + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nSetTerrainSpecular(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); + PrintInfo(message, COLOR_GREEN); + return 0; } - m_exception.clear(); + CFloat Color[4] = { R, G, B, 1.0f }; + + if (g_terrain) + g_terrain->SetSpecularColor(Color); return 0; } - -//Pause script Update event of individual game objects -CInt PauseUpdateEventOfPrefabInstance(lua_State* L) +CInt SetTerrainShininess(lua_State* L) { if (g_testScript) return 0; @@ -29080,544 +30787,470 @@ CInt PauseUpdateEventOfPrefabInstance(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfPrefabInstance()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for SetTerrainShininess()", COLOR_RED); return 0; } - CBool foundPrefabInstance = CFalse; - - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Prefab Instance Name- First Argument - StringToUpper(luaToString); - - if (Cmp(luaToString, "THIS")) + CFloat shininess = (CFloat)lua_tonumber(L, 1); + if (shininess < 0.0f) { - if (g_editorMode == eMODE_VSCENE) - { - if (g_currentInstancePrefab) - { - g_currentInstancePrefab->SetUpdateEvent(CFalse); - - } - else - { - PrintInfo("\nPauseUpdateEventOfPrefabInstance() Error: Couldn't find current prefab instance", COLOR_RED); - } - } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOfPrefabInstance() will execute for current prefab instance", COLOR_GREEN); - } + PrintInfo("\nSetTerrainShininess Error: shininess must be greater than 0.0", COLOR_RED); return 0; } if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) - { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) - { - CChar prefabInstanceName[MAX_NAME_SIZE]; - Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - StringToUpper(prefabInstanceName); + CChar message[MAX_URI_SIZE]; + sprintf(message, "\nSetTerrainShininess(%.2f) will be executed for terrain object", shininess); + PrintInfo(message, COLOR_GREEN); + return 0; + } - if (Cmp(prefabInstanceName, luaToString)) - { - foundPrefabInstance = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOfPrefabInstance() will execute for Project '%s', VScene '%s', Prefab Instance '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } - } - if (!foundPrefabInstance) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); - } + if (g_terrain) + g_terrain->SetShininess(shininess); + + return 0; +} +CInt GetTerrainAmbient(lua_State* L) +{ + if (g_testScript) return 0; - } - for (CUInt i = 0; i < g_instancePrefab.size(); i++) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CChar prefabName[MAX_NAME_SIZE]; - Cpy(prefabName, g_instancePrefab[i]->GetName()); - StringToUpper(prefabName); - if (Cmp(prefabName, luaToString)) - { - foundPrefabInstance = CTrue; - - g_instancePrefab[i]->SetUpdateEvent(CFalse); - } + PrintInfo("\nGetTerrainAmbient() will be executed for terrain object", COLOR_GREEN); + return 0; } - if (!foundPrefabInstance) + if (!g_terrain) { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nGetTerrainAmbient() Error: Couldn't find terrain object", COLOR_RED); return 0; } - return 0; + CFloat x = g_terrain->GetAmbientColor()[0]; + CFloat y = g_terrain->GetAmbientColor()[1]; + CFloat z = g_terrain->GetAmbientColor()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } -CInt PauseUpdateEventOfWater(lua_State* L) +CInt GetTerrainDiffuse(lua_State* L) { if (g_testScript) return 0; - int argc = lua_gettop(L); - if (argc < 1) + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfWater()", COLOR_RED); + PrintInfo("\nGetTerrainDiffuse() will be executed for terrain object", COLOR_GREEN); return 0; } - CBool foundWater = CFalse; - - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Water Name- First Argument - StringToUpper(luaToString); - - if (Cmp(luaToString, "THIS")) + if (!g_terrain) { - if (g_editorMode == eMODE_VSCENE) - { - if (g_currentWater) - { - g_currentWater->SetUpdateEvent(CFalse); - - } - else - { - PrintInfo("\nPauseUpdateEventOfWater() Error: Couldn't find current water", COLOR_RED); - } - } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOfWater() will execute for current water", COLOR_GREEN); - } + PrintInfo("\nGetTerrainDiffuse() Error: Couldn't find terrain object", COLOR_RED); return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) - { - for (CUInt pr = 0; pr < g_projects.size(); pr++) - { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames.size(); j++) - { - CChar waterName[MAX_NAME_SIZE]; - Cpy(waterName, g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); - StringToUpper(waterName); + CFloat x = g_terrain->GetDiffuseColor()[0]; + CFloat y = g_terrain->GetDiffuseColor()[1]; + CFloat z = g_terrain->GetDiffuseColor()[2]; - if (Cmp(waterName, luaToString)) - { - foundWater = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOfWater() will execute for Project '%s', VScene '%s', Water '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } - } - if (!foundWater) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); - PrintInfo(temp, COLOR_RED); - } + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; +} + +CInt GetTerrainSpecular(lua_State* L) +{ + if (g_testScript) + return 0; + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nGetTerrainSpecular() will be executed for terrain object", COLOR_GREEN); return 0; } - for (CUInt i = 0; i < g_engineWaters.size(); i++) + if (!g_terrain) { - CChar waterName[MAX_NAME_SIZE]; - Cpy(waterName, g_engineWaters[i]->GetName()); - StringToUpper(waterName); - if (Cmp(waterName, luaToString)) - { - foundWater = CTrue; + PrintInfo("\nGetTerrainSpecular() Error: Couldn't find terrain object", COLOR_RED); + return 0; + } - g_engineWaters[i]->SetUpdateEvent(CFalse); - } + CFloat x = g_terrain->GetSpecularColor()[0]; + CFloat y = g_terrain->GetSpecularColor()[1]; + CFloat z = g_terrain->GetSpecularColor()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; +} + +CInt GetTerrainShininess(lua_State* L) +{ + if (g_testScript) + return 0; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + { + PrintInfo("\nGetTerrainShininess() will be executed for terrain object", COLOR_GREEN); + return 0; } - if (!foundWater) + if (!g_terrain) { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nGetTerrainShininess() Error: Couldn't find terrain object", COLOR_RED); return 0; } - return 0; + CFloat shininess = g_terrain->GetShininess(); + + lua_pushnumber(L, shininess); + + return 1; } -CInt PauseUpdateEventOfLight(lua_State* L) +//Engine Camera +CInt SetEngineCameraPosition(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 1) + if (argc < 4) { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfLight()", COLOR_RED); + PrintInfo("\nPlease specify 4 arguments for SetEngineCameraPosition()", COLOR_RED); return 0; } - CBool foundLight = CFalse; - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Light Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + CFloat x = (CFloat)lua_tonumber(L, 2); + CFloat y = (CFloat)lua_tonumber(L, 3); + CFloat z = (CFloat)lua_tonumber(L, 4); + + CVec3f position; + position.x = x; position.y = y; position.z = z; + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentLight) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentLight->m_instanceLight->SetUpdateEvent(CFalse); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraPosition(%s, %.2f, %.2f, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), x, y, z); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nPauseUpdateEventOfLight() Error: Couldn't find current light", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraPosition() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOfLight() will execute for current light", COLOR_GREEN); - } return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentEngineCamera) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) - { - CChar lightName[MAX_NAME_SIZE]; - Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); - StringToUpper(lightName); - - if (Cmp(lightName, luaToString)) - { - foundLight = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOfLight() will execute for Project '%s', VScene '%s', Light '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + g_currentEngineCamera->SetPos(position); + g_currentEngineCamera->MoveTransform2(position.x, position.y, position.z); } - if (!foundLight) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nSetEngineCameraPosition Error: Couldn't find current engine camera", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engineLights.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar lightName[MAX_NAME_SIZE]; - Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); - StringToUpper(lightName); - if (Cmp(lightName, luaToString)) - { - foundLight = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); - g_engineLights[i]->SetUpdateEvent(CFalse); + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetPos(position); + g_engineCameraInstances[i]->MoveTransform2(position.x, position.y, position.z); + break; } } - if (!foundLight) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); - PrintInfo(temp, COLOR_RED); - return 0; - } - return 0; } -CInt PauseUpdateEventOf3DSound(lua_State* L) +CInt SetEngineCameraPan(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 1) + if (argc < 2) { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOf3DSound()", COLOR_RED); + PrintInfo("\nPlease specify 2 arguments for SetEngineCameraPan()", COLOR_RED); return 0; } - CBool found3DSound = CFalse; - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //3DSound Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + CFloat pan = (CFloat)lua_tonumber(L, 2); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_current3DSound) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_current3DSound->SetUpdateEvent(CFalse); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraPan(%s, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), pan); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nPauseUpdateEventOf3DSound() Error: Couldn't find current 3D sound", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraPan() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOf3DSound() will execute for current 3D sound", COLOR_GREEN); - } return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentEngineCamera) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames.size(); j++) - { - CChar threeDSoundName[MAX_NAME_SIZE]; - Cpy(threeDSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); - StringToUpper(threeDSoundName); - - if (Cmp(threeDSoundName, luaToString)) - { - found3DSound = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOf3DSound() will execute for Project '%s', VScene '%s', 3D Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + g_currentEngineCamera->SetPan(pan); + g_currentEngineCamera->SetPanAndTilt2(pan, g_currentEngineCamera->GetTilt()); } - if (!found3DSound) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nSetEngineCameraPan Error: Couldn't find current engine camera", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engine3DSounds.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar threeDSoundName[MAX_NAME_SIZE]; - Cpy(threeDSoundName, g_engine3DSounds[i]->GetName()); - StringToUpper(threeDSoundName); - if (Cmp(threeDSoundName, luaToString)) - { - found3DSound = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); - g_engine3DSounds[i]->SetUpdateEvent(CFalse); + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetPan(pan); + g_engineCameraInstances[i]->SetPanAndTilt2(pan, g_engineCameraInstances[i]->GetTilt()); + break; } } - if (!found3DSound) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); - PrintInfo(temp, COLOR_RED); - return 0; - } - return 0; } -CInt PauseUpdateEventOfAmbientSound(lua_State* L) +CInt SetEngineCameraTilt(lua_State* L) { if (g_testScript) return 0; - - int argc = lua_gettop(L); - if (argc < 1) - { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfAmbientSound()", COLOR_RED); - return 0; - } - - CBool foundAmbientSound = CFalse; - - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Ambient Sound Name- First Argument - StringToUpper(luaToString); - - if (Cmp(luaToString, "THIS")) - { - if (g_editorMode == eMODE_VSCENE) - { - if (g_currentAmbientSound) - { - g_currentAmbientSound->SetUpdateEvent(CFalse); - - } - else - { - PrintInfo("\nPauseUpdateEventOfAmbientSound() Error: Couldn't find current ambient sound", COLOR_RED); - } - } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOfAmbientSound() will execute for current ambient sound", COLOR_GREEN); - } + + int argc = lua_gettop(L); + if (argc < 2) + { + PrintInfo("\nPlease specify 2 arguments for SetEngineCameraTilt()", COLOR_RED); return 0; } + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat tilt = (CFloat)lua_tonumber(L, 2); + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (!Cmp(luaToString, "THIS")) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames.size(); j++) + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - CChar ambientSoundName[MAX_NAME_SIZE]; - Cpy(ambientSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); - StringToUpper(ambientSoundName); - - if (Cmp(ambientSoundName, luaToString)) + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) { - foundAmbientSound = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOfAmbientSound() will execute for Project '%s', VScene '%s', Ambient Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraTilt(%s, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), tilt); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } } } } + if (!foundTarget) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraTilt() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); + } } - if (!foundAmbientSound) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); - PrintInfo(temp, COLOR_RED); - } - return 0; } - for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) + if (Cmp(luaToString, "THIS")) { - CChar ambientSoundName[MAX_NAME_SIZE]; - Cpy(ambientSoundName, g_engineAmbientSounds[i]->GetName()); - StringToUpper(ambientSoundName); - if (Cmp(ambientSoundName, luaToString)) + if (g_currentEngineCamera) { - foundAmbientSound = CTrue; - - g_engineAmbientSounds[i]->SetUpdateEvent(CFalse); + g_currentEngineCamera->SetTilt(tilt); + g_currentEngineCamera->SetPanAndTilt2(g_currentEngineCamera->GetPan(), tilt); + } + else + { + PrintInfo("\nSetEngineCameraTilt Error: Couldn't find current engine camera", COLOR_RED); } + + return 0; } - if (!foundAmbientSound) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); - PrintInfo(temp, COLOR_RED); - return 0; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetTilt(tilt); + g_engineCameraInstances[i]->SetPanAndTilt2(g_engineCameraInstances[i]->GetPan(), tilt); + break; + } } return 0; } -CInt PauseUpdateEventOfEngineCamera(lua_State* L) +CInt SetEngineCameraNearClipPlane(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 1) + if (argc < 2) { - PrintInfo("\nPlease specify 1 argument for PauseUpdateEventOfEngineCamera()", COLOR_RED); + PrintInfo("\nPlease specify 2 arguments for SetEngineCameraNearClipPlane()", COLOR_RED); return 0; } - CBool foundEngineCamera = CFalse; - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Engine Camera Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + CFloat ncp = (CFloat)lua_tonumber(L, 2); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentEngineCamera) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentEngineCamera->SetUpdateEvent(CFalse); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraNearClipPlane(%s, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), ncp); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nPauseUpdateEventOfEngineCamera() Error: Couldn't find current engine camera", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraNearClipPlane() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nPauseUpdateEventOfEngineCamera() will execute for current engine camera", COLOR_GREEN); - } return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentEngineCamera) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) - { - CChar engineCameraName[MAX_NAME_SIZE]; - Cpy(engineCameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); - StringToUpper(engineCameraName); - - if (Cmp(engineCameraName, luaToString)) - { - foundEngineCamera = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nPauseUpdateEventOfEngineCamera() will execute for Project '%s', VScene '%s', Engine Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + g_currentEngineCamera->SetNCP(ncp); } - if (!foundEngineCamera) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nSetEngineCameraNearClipPlane Error: Couldn't find current engine camera", COLOR_RED); } return 0; @@ -29625,222 +31258,191 @@ CInt PauseUpdateEventOfEngineCamera(lua_State* L) for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar engineCameraName[MAX_NAME_SIZE]; - Cpy(engineCameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); - StringToUpper(engineCameraName); - if (Cmp(engineCameraName, luaToString)) - { - foundEngineCamera = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); - g_engineCameraInstances[i]->SetUpdateEvent(CFalse); + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetNCP(ncp); + break; } } - if (!foundEngineCamera) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "PauseUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); - PrintInfo(temp, COLOR_RED); - return 0; - } - return 0; } -//Resume script Update event of individual game objects -CInt ResumeUpdateEventOfPrefabInstance(lua_State* L) +CInt SetEngineCameraFarClipPlane(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 1) + if (argc < 2) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfPrefabInstance()", COLOR_RED); + PrintInfo("\nPlease specify 2 arguments for SetEngineCameraFarClipPlane()", COLOR_RED); return 0; } - CBool foundPrefabInstance = CFalse; - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Prefab Instance Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + CFloat fcp = (CFloat)lua_tonumber(L, 2); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentInstancePrefab) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentInstancePrefab->SetUpdateEvent(CTrue); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraFarClipPlane(%s, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), fcp); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nResumeUpdateEventOfPrefabInstance() Error: Couldn't find current prefab instance", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraFarClipPlane() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nResumeUpdateEventOfPrefabInstance() will execute for current prefab instance", COLOR_GREEN); - } return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentEngineCamera) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames.size(); j++) - { - CChar prefabInstanceName[MAX_NAME_SIZE]; - Cpy(prefabInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - StringToUpper(prefabInstanceName); - - if (Cmp(prefabInstanceName, luaToString)) - { - foundPrefabInstance = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOfPrefabInstance() will execute for Project '%s', VScene '%s', Prefab Instance '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_instancePrefabNames[j].m_name); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + g_currentEngineCamera->SetFCP(fcp); } - if (!foundPrefabInstance) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nSetEngineCameraFarClipPlane Error: Couldn't find current engine camera", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_instancePrefab.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar prefabName[MAX_NAME_SIZE]; - Cpy(prefabName, g_instancePrefab[i]->GetName()); - StringToUpper(prefabName); - if (Cmp(prefabName, luaToString)) - { - foundPrefabInstance = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); - g_instancePrefab[i]->SetUpdateEvent(CTrue); + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetFCP(fcp); + break; } } - if (!foundPrefabInstance) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfPrefabInstance() Error: Couldn't find '", luaToString, "' Prefab Instance"); - PrintInfo(temp, COLOR_RED); - return 0; - } - return 0; } -CInt ResumeUpdateEventOfWater(lua_State* L) +CInt SetEngineCameraAngle(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 1) + if (argc < 2) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfWater()", COLOR_RED); + PrintInfo("\nPlease specify 2 arguments for SetEngineCameraAngle()", COLOR_RED); return 0; } - CBool foundWater = CFalse; - CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Water Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + CFloat angle = (CFloat)lua_tonumber(L, 2); + + if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - if (g_editorMode == eMODE_VSCENE) + if (!Cmp(luaToString, "THIS")) { - if (g_currentWater) + CBool foundTarget = CFalse; + + for (CUInt pr = 0; pr < g_projects.size(); pr++) { - g_currentWater->SetUpdateEvent(CTrue); + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nProject '%s', VScene '%s' : SetEngineCameraAngle(%s, %.2f) will be executed", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str(), angle); + PrintInfo(temp, COLOR_GREEN); + foundTarget = CTrue; + break; + } + } + } } - else + if (!foundTarget) { - PrintInfo("\nResumeUpdateEventOfWater() Error: Couldn't find current water", COLOR_RED); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "%s%s%s", "\nSetEngineCameraAngle() Error: Couldn't find engine camera object '", lua_tostring(L, 1), "' in all projects."); + PrintInfo(temp, COLOR_RED); } } - else if (g_editorMode == eMODE_PREFAB) - { - PrintInfo("\nResumeUpdateEventOfWater() will execute for current water", COLOR_GREEN); - } return 0; } - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (Cmp(luaToString, "THIS")) { - for (CUInt pr = 0; pr < g_projects.size(); pr++) + if (g_currentEngineCamera) { - for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) - { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames.size(); j++) - { - CChar waterName[MAX_NAME_SIZE]; - Cpy(waterName, g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); - StringToUpper(waterName); - - if (Cmp(waterName, luaToString)) - { - foundWater = CTrue; - CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOfWater() will execute for Project '%s', VScene '%s', Water '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineWaterNames[j].c_str()); - PrintInfo(message, COLOR_GREEN); - break; - } - } - } + g_currentEngineCamera->m_abstractCamera->SetAngle(angle); } - if (!foundWater) + else { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); - PrintInfo(temp, COLOR_RED); + PrintInfo("\nSetEngineCameraAngle Error: Couldn't find current engine camera", COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engineWaters.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar waterName[MAX_NAME_SIZE]; - Cpy(waterName, g_engineWaters[i]->GetName()); - StringToUpper(waterName); - if (Cmp(waterName, luaToString)) - { - foundWater = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); - g_engineWaters[i]->SetUpdateEvent(CTrue); + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->m_abstractCamera->SetAngle(angle); + break; } } - if (!foundWater) - { - CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfWater() Error: Couldn't find '", luaToString, "' Water"); - PrintInfo(temp, COLOR_RED); - return 0; - } - return 0; } -CInt ResumeUpdateEventOfLight(lua_State* L) +CInt GetEngineCameraPosition(lua_State* L) { if (g_testScript) return 0; @@ -29848,34 +31450,34 @@ CInt ResumeUpdateEventOfLight(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfLight()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraPosition()", COLOR_RED); return 0; } - - CBool foundLight = CFalse; + CBool foundCameraInstance = CFalse; CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Light Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + if (Cmp("THIS", luaToString)) { - if (g_editorMode == eMODE_VSCENE) + if (g_currentEngineCamera) { - if (g_currentLight) - { - g_currentLight->m_instanceLight->SetUpdateEvent(CTrue); - } - else - { - PrintInfo("\nResumeUpdateEventOfLight() Error: Couldn't find current light", COLOR_RED); - } + CFloat x = g_currentEngineCamera->GetPos().x; + CFloat y = g_currentEngineCamera->GetPos().y; + CFloat z = g_currentEngineCamera->GetPos().z; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } - else if (g_editorMode == eMODE_PREFAB) + else { - PrintInfo("\nResumeUpdateEventOfLight() will execute for current light", COLOR_GREEN); + PrintInfo("\nGetEngineCameraPosition() Error: Couldn't find current engine camera", COLOR_RED); + return 0; } - return 0; } if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) @@ -29884,50 +31486,56 @@ CInt ResumeUpdateEventOfLight(lua_State* L) { for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames.size(); j++) + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) { - CChar lightName[MAX_NAME_SIZE]; - Cpy(lightName, g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); - StringToUpper(lightName); + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); - if (Cmp(lightName, luaToString)) + if (Cmp(cameraInstanceName, luaToString)) { - foundLight = CTrue; + foundCameraInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOfLight() will execute for Project '%s', VScene '%s', Light '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineLightNames[j].c_str()); + sprintf(message, "\nGetEngineCameraPosition() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); PrintInfo(message, COLOR_GREEN); break; } } } } - if (!foundLight) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + sprintf(temp, "\nGetEngineCameraPosition Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); PrintInfo(temp, COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engineLights.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar lightName[MAX_NAME_SIZE]; - Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); - StringToUpper(lightName); - if (Cmp(lightName, luaToString)) + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) { - foundLight = CTrue; + foundCameraInstance = CTrue; + CFloat x = g_engineCameraInstances[i]->GetPos().x; + CFloat y = g_engineCameraInstances[i]->GetPos().y; + CFloat z = g_engineCameraInstances[i]->GetPos().z; - g_engineLights[i]->SetUpdateEvent(CTrue); + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; } } - - if (!foundLight) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfLight() Error: Couldn't find '", luaToString, "' Light"); + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); PrintInfo(temp, COLOR_RED); return 0; } @@ -29935,7 +31543,7 @@ CInt ResumeUpdateEventOfLight(lua_State* L) return 0; } -CInt ResumeUpdateEventOf3DSound(lua_State* L) +CInt GetEngineCameraPan(lua_State* L) { if (g_testScript) return 0; @@ -29943,35 +31551,28 @@ CInt ResumeUpdateEventOf3DSound(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOf3DSound()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraPan()", COLOR_RED); return 0; } - - CBool found3DSound = CFalse; + CBool foundCameraInstance = CFalse; CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //3DSound Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + if (Cmp("THIS", luaToString)) { - if (g_editorMode == eMODE_VSCENE) + if (g_currentEngineCamera) { - if (g_current3DSound) - { - g_current3DSound->SetUpdateEvent(CTrue); - - } - else - { - PrintInfo("\nResumeUpdateEventOf3DSound() Error: Couldn't find current 3D sound", COLOR_RED); - } + CFloat val = g_currentEngineCamera->GetPan(); + lua_pushnumber(L, val); + return 1; } - else if (g_editorMode == eMODE_PREFAB) + else { - PrintInfo("\nResumeUpdateEventOf3DSound() will execute for current 3D sound", COLOR_GREEN); + PrintInfo("\nGetEngineCameraPan() Error: Couldn't find current engine camera", COLOR_RED); + return 0; } - return 0; } if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) @@ -29980,50 +31581,50 @@ CInt ResumeUpdateEventOf3DSound(lua_State* L) { for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames.size(); j++) + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) { - CChar threeDSoundName[MAX_NAME_SIZE]; - Cpy(threeDSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); - StringToUpper(threeDSoundName); + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); - if (Cmp(threeDSoundName, luaToString)) + if (Cmp(cameraInstanceName, luaToString)) { - found3DSound = CTrue; + foundCameraInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOf3DSound() will execute for Project '%s', VScene '%s', 3D Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_3DSoundsNames[j].c_str()); + sprintf(message, "\nGetEngineCameraPan() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); PrintInfo(message, COLOR_GREEN); break; } } } } - if (!found3DSound) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + sprintf(temp, "\nGetEngineCameraPan Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); PrintInfo(temp, COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engine3DSounds.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar threeDSoundName[MAX_NAME_SIZE]; - Cpy(threeDSoundName, g_engine3DSounds[i]->GetName()); - StringToUpper(threeDSoundName); - if (Cmp(threeDSoundName, luaToString)) + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) { - found3DSound = CTrue; - - g_engine3DSounds[i]->SetUpdateEvent(CTrue); + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetPan(); + lua_pushnumber(L, val); + return 1; } } - - if (!found3DSound) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOf3DSound() Error: Couldn't find '", luaToString, "' 3D Sound"); + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); PrintInfo(temp, COLOR_RED); return 0; } @@ -30031,7 +31632,7 @@ CInt ResumeUpdateEventOf3DSound(lua_State* L) return 0; } -CInt ResumeUpdateEventOfAmbientSound(lua_State* L) +CInt GetEngineCameraTilt(lua_State* L) { if (g_testScript) return 0; @@ -30039,35 +31640,28 @@ CInt ResumeUpdateEventOfAmbientSound(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfAmbientSound()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraTilt()", COLOR_RED); return 0; } - - CBool foundAmbientSound = CFalse; + CBool foundCameraInstance = CFalse; CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Ambient Sound Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + if (Cmp("THIS", luaToString)) { - if (g_editorMode == eMODE_VSCENE) + if (g_currentEngineCamera) { - if (g_currentAmbientSound) - { - g_currentAmbientSound->SetUpdateEvent(CTrue); - - } - else - { - PrintInfo("\nResumeUpdateEventOfAmbientSound() Error: Couldn't find current ambient sound", COLOR_RED); - } + CFloat val = g_currentEngineCamera->GetTilt(); + lua_pushnumber(L, val); + return 1; } - else if (g_editorMode == eMODE_PREFAB) + else { - PrintInfo("\nResumeUpdateEventOfAmbientSound() will execute for current ambient sound", COLOR_GREEN); + PrintInfo("\nGetEngineCameraTilt() Error: Couldn't find current engine camera", COLOR_RED); + return 0; } - return 0; } if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) @@ -30076,50 +31670,50 @@ CInt ResumeUpdateEventOfAmbientSound(lua_State* L) { for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) { - for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames.size(); j++) + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) { - CChar ambientSoundName[MAX_NAME_SIZE]; - Cpy(ambientSoundName, g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); - StringToUpper(ambientSoundName); + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); - if (Cmp(ambientSoundName, luaToString)) + if (Cmp(cameraInstanceName, luaToString)) { - foundAmbientSound = CTrue; + foundCameraInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOfAmbientSound() will execute for Project '%s', VScene '%s', Ambient Sound '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_ambientSoundsNames[j].c_str()); + sprintf(message, "\nGetEngineCameraTilt() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); PrintInfo(message, COLOR_GREEN); break; } } } } - if (!foundAmbientSound) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + sprintf(temp, "\nGetEngineCameraTilt Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); PrintInfo(temp, COLOR_RED); } return 0; } - for (CUInt i = 0; i < g_engineAmbientSounds.size(); i++) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar ambientSoundName[MAX_NAME_SIZE]; - Cpy(ambientSoundName, g_engineAmbientSounds[i]->GetName()); - StringToUpper(ambientSoundName); - if (Cmp(ambientSoundName, luaToString)) + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) { - foundAmbientSound = CTrue; - - g_engineAmbientSounds[i]->SetUpdateEvent(CTrue); + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetTilt(); + lua_pushnumber(L, val); + return 1; } } - - if (!foundAmbientSound) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfAmbientSound() Error: Couldn't find '", luaToString, "' Ambient Sound"); + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); PrintInfo(temp, COLOR_RED); return 0; } @@ -30127,7 +31721,7 @@ CInt ResumeUpdateEventOfAmbientSound(lua_State* L) return 0; } -CInt ResumeUpdateEventOfEngineCamera(lua_State* L) +CInt GetEngineCameraNearClipPlane(lua_State* L) { if (g_testScript) return 0; @@ -30135,35 +31729,28 @@ CInt ResumeUpdateEventOfEngineCamera(lua_State* L) int argc = lua_gettop(L); if (argc < 1) { - PrintInfo("\nPlease specify 1 argument for ResumeUpdateEventOfEngineCamera()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraNearClipPlane()", COLOR_RED); return 0; } - - CBool foundEngineCamera = CFalse; + CBool foundCameraInstance = CFalse; CChar luaToString[MAX_NAME_SIZE]; - Cpy(luaToString, lua_tostring(L, 1)); //Engine Camera Name- First Argument + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument StringToUpper(luaToString); - if (Cmp(luaToString, "THIS")) + if (Cmp("THIS", luaToString)) { - if (g_editorMode == eMODE_VSCENE) + if (g_currentEngineCamera) { - if (g_currentEngineCamera) - { - g_currentEngineCamera->SetUpdateEvent(CTrue); - - } - else - { - PrintInfo("\nResumeUpdateEventOfEngineCamera() Error: Couldn't find current engine camera", COLOR_RED); - } + CFloat val = g_currentEngineCamera->GetNCP(); + lua_pushnumber(L, val); + return 1; } - else if (g_editorMode == eMODE_PREFAB) + else { - PrintInfo("\nResumeUpdateEventOfEngineCamera() will execute for current engine camera", COLOR_GREEN); + PrintInfo("\nGetEngineCameraNearClipPlane() Error: Couldn't find current engine camera", COLOR_RED); + return 0; } - return 0; } if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) @@ -30174,25 +31761,25 @@ CInt ResumeUpdateEventOfEngineCamera(lua_State* L) { for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) { - CChar engineCameraName[MAX_NAME_SIZE]; - Cpy(engineCameraName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); - StringToUpper(engineCameraName); + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); - if (Cmp(engineCameraName, luaToString)) + if (Cmp(cameraInstanceName, luaToString)) { - foundEngineCamera = CTrue; + foundCameraInstance = CTrue; CChar message[MAX_NAME_SIZE]; - sprintf(message, "\nResumeUpdateEventOfEngineCamera() will execute for Project '%s', VScene '%s', Engine Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + sprintf(message, "\nGetEngineCameraNearClipPlane() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); PrintInfo(message, COLOR_GREEN); break; } } } } - if (!foundEngineCamera) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + sprintf(temp, "\nGetEngineCameraNearClipPlane Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); PrintInfo(temp, COLOR_RED); } @@ -30201,21 +31788,21 @@ CInt ResumeUpdateEventOfEngineCamera(lua_State* L) for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - CChar engineCameraName[MAX_NAME_SIZE]; - Cpy(engineCameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); - StringToUpper(engineCameraName); - if (Cmp(engineCameraName, luaToString)) + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) { - foundEngineCamera = CTrue; - - g_engineCameraInstances[i]->SetUpdateEvent(CTrue); + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetNCP(); + lua_pushnumber(L, val); + return 1; } } - - if (!foundEngineCamera) + if (!foundCameraInstance) { CChar temp[MAX_NAME_SIZE]; - sprintf(temp, "\n%s%s%s", "ResumeUpdateEventOfEngineCamera() Error: Couldn't find '", luaToString, "' Engine Camera"); + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); PrintInfo(temp, COLOR_RED); return 0; } @@ -30223,198 +31810,185 @@ CInt ResumeUpdateEventOfEngineCamera(lua_State* L) return 0; } -CInt SetTerrainAmbient(lua_State* L) +CInt GetEngineCameraFarClipPlane(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 3) + if (argc < 1) { - PrintInfo("\nPlease specify 3 arguments for SetTerrainAmbient()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraFarClipPlane()", COLOR_RED); return 0; } + CBool foundCameraInstance = CFalse; - CBool foundColorError = CFalse; - CFloat R = (CFloat)lua_tonumber(L, 1); - if (R < 0.0f || R > 1.0f) - { - PrintInfo("\nFirst argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat G = (CFloat)lua_tonumber(L, 2); - if (G < 0.0f || G > 1.0f) - { - PrintInfo("\nSecond argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); - CFloat B = (CFloat)lua_tonumber(L, 3); - if (B < 0.0f || B > 1.0f) + if (Cmp("THIS", luaToString)) { - PrintInfo("\nThird argument of SetTerrainAmbient() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->GetFCP(); + lua_pushnumber(L, val); + return 1; + } + else + { + PrintInfo("\nGetEngineCameraFarClipPlane() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } } - if (foundColorError) - return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nSetTerrainAmbient(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); - PrintInfo(message, COLOR_GREEN); - return 0; - } - - CFloat Color[4] = { R, G, B, 1.0f }; - - if (g_terrain) - g_terrain->SetAmbientColor(Color); - - return 0; -} + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); -CInt SetTerrainDiffuse(lua_State* L) -{ - if (g_testScript) - return 0; + if (Cmp(cameraInstanceName, luaToString)) + { + foundCameraInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nGetEngineCameraFarClipPlane() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundCameraInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetEngineCameraFarClipPlane Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); + PrintInfo(temp, COLOR_RED); + } - int argc = lua_gettop(L); - if (argc < 3) - { - PrintInfo("\nPlease specify 3 arguments for SetTerrainDiffuse()", COLOR_RED); return 0; } - CBool foundColorError = CFalse; - CFloat R = (CFloat)lua_tonumber(L, 1); - if (R < 0.0f || R > 1.0f) - { - PrintInfo("\nFirst argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat G = (CFloat)lua_tonumber(L, 2); - if (G < 0.0f || G > 1.0f) - { - PrintInfo("\nSecond argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat B = (CFloat)lua_tonumber(L, 3); - if (B < 0.0f || B > 1.0f) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - PrintInfo("\nThird argument of SetTerrainDiffuse() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetFCP(); + lua_pushnumber(L, val); + return 1; + } } - - if (foundColorError) - return 0; - - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (!foundCameraInstance) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nSetTerrainDiffuse(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); - PrintInfo(message, COLOR_GREEN); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + PrintInfo(temp, COLOR_RED); return 0; } - CFloat Color[4] = { R, G, B, 1.0f }; - - if (g_terrain) - g_terrain->SetDiffuseColor(Color); - return 0; } -CInt SetTerrainSpecular(lua_State* L) +CInt GetEngineCameraAngle(lua_State* L) { if (g_testScript) return 0; int argc = lua_gettop(L); - if (argc < 3) + if (argc < 1) { - PrintInfo("\nPlease specify 3 arguments for SetTerrainSpecular()", COLOR_RED); + PrintInfo("\nPlease specify 1 argument for GetEngineCameraAngle()", COLOR_RED); return 0; } + CBool foundCameraInstance = CFalse; - CBool foundColorError = CFalse; - CFloat R = (CFloat)lua_tonumber(L, 1); - if (R < 0.0f || R > 1.0f) - { - PrintInfo("\nFirst argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } - - CFloat G = (CFloat)lua_tonumber(L, 2); - if (G < 0.0f || G > 1.0f) - { - PrintInfo("\nSecond argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; - } + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); - CFloat B = (CFloat)lua_tonumber(L, 3); - if (B < 0.0f || B > 1.0f) + if (Cmp("THIS", luaToString)) { - PrintInfo("\nThird argument of SetTerrainSpecular() must be between 0.0 and 1.0", COLOR_RED); - foundColorError = CTrue; + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->m_abstractCamera->GetAngle(); + lua_pushnumber(L, val); + return 1; + } + else + { + PrintInfo("\nGetEngineCameraAngle() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } } - if (foundColorError) - return 0; - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nSetTerrainSpecular(%.2f, %.2f, %.2f) will be executed for terrain object", R, G, B); - PrintInfo(message, COLOR_GREEN); - return 0; - } - - CFloat Color[4] = { R, G, B, 1.0f }; - - if (g_terrain) - g_terrain->SetSpecularColor(Color); - - return 0; -} + for (CUInt pr = 0; pr < g_projects.size(); pr++) + { + for (CUInt i = 0; i < g_projects[pr]->m_vsceneObjectNames.size(); i++) + { + for (CUInt j = 0; j < g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames.size(); j++) + { + CChar cameraInstanceName[MAX_NAME_SIZE]; + Cpy(cameraInstanceName, g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + StringToUpper(cameraInstanceName); -CInt SetTerrainShininess(lua_State* L) -{ - if (g_testScript) - return 0; + if (Cmp(cameraInstanceName, luaToString)) + { + foundCameraInstance = CTrue; + CChar message[MAX_NAME_SIZE]; + sprintf(message, "\nGetEngineCameraAngle() will be executed for Project '%s', VScene '%s' : Camera '%s'", g_projects[pr]->m_name, g_projects[pr]->m_sceneNames[i].c_str(), g_projects[pr]->m_vsceneObjectNames[i].m_engineCameraNames[j].c_str()); + PrintInfo(message, COLOR_GREEN); + break; + } + } + } + } + if (!foundCameraInstance) + { + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\nGetEngineCameraAngle Error: %s%s%s", "Couldn't find '", lua_tostring(L, 1), "' engine camera in all projects"); + PrintInfo(temp, COLOR_RED); + } - int argc = lua_gettop(L); - if (argc < 1) - { - PrintInfo("\nPlease specify 1 argument for SetTerrainShininess()", COLOR_RED); return 0; } - CFloat shininess = (CFloat)lua_tonumber(L, 1); - if (shininess < 0.0f) + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) { - PrintInfo("\nSetTerrainShininess Error: shininess must be greater than 0.0", COLOR_RED); - return 0; + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->m_abstractCamera->GetAngle(); + lua_pushnumber(L, val); + return 1; + } } - - if (g_editorMode == eMODE_PREFAB || g_editorMode == eMODE_GUI) + if (!foundCameraInstance) { - CChar message[MAX_URI_SIZE]; - sprintf(message, "\nSetTerrainShininess(%.2f) will be executed for terrain object", shininess); - PrintInfo(message, COLOR_GREEN); + CChar temp[MAX_NAME_SIZE]; + sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + PrintInfo(temp, COLOR_RED); return 0; } - if (g_terrain) - g_terrain->SetShininess(shininess); - return 0; } + CBool CMultipleWindows::firstIdle = CTrue; CChar CMultipleWindows::currentIdleName[MAX_NAME_SIZE]; diff --git a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp index a036e0e0..be38227f 100644 --- a/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/GraphicsEngine/Scene.cpp @@ -144,7 +144,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI CChar temp[MAX_NAME_SIZE]; sprintf(temp, "\n%s %s %s", "Error in opening",fileInZipPath, "in zipfile"); zipCloseFileInZip(zf); - zipClose(zipOpen, "Vanda Engine 2.6.0"); + zipClose(zipOpen, "Vanda Engine 2.7.0"); free(buf); return -1; } @@ -157,7 +157,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI //sprintf(temp, "\n%s %s %s", "Error in opening",fileInZipPath, "for reading"); //PrintInfo( temp, COLOR_RED ); //zipCloseFileInZip(zf); - //zipClose(zf, "Vanda Engine 2.6.0"); + //zipClose(zf, "Vanda Engine 2.7.0"); //free(buf); //return -1; // } @@ -173,7 +173,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI CChar temp[MAX_NAME_SIZE]; sprintf(temp, "\n%s%s", "Error in reading ",fileInZipPath); zipCloseFileInZip(zf); - zipClose(zf, "Vanda Engine 2.6.0"); + zipClose(zf, "Vanda Engine 2.7.0"); free(buf); return -1; } @@ -188,7 +188,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI sprintf( temp, "\n%s%s%s", "Error in writing ", fileInZipPath, " in the zipfile"); zipCloseFileInZip(zf); - zipClose(zf, "Vanda Engine 2.6.0"); + zipClose(zf, "Vanda Engine 2.7.0"); free(buf); return -1; } @@ -198,7 +198,7 @@ CInt CScene::WriteZipFile(CChar* zipFileName, CChar* fileInZipName, CChar* fileI if (fin) fclose(fin); zipCloseFileInZip(zf); - zipClose(zf,"Vanda Engine 2.6.0"); + zipClose(zf,"Vanda Engine 2.7.0"); free(buf); return 1; } diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp index 07e5fa3e..482bdde3 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.cpp @@ -42,7 +42,7 @@ CScriptEditorAddFunction::CScriptEditorAddFunction(CWnd* pParent /*=NULL*/) Cpy(ActivateFirstPersonCamera, "ActivateFirstPersonCamera()"); Cpy(ActivateImportedCamera, "ActivateImportedCamera(string importedCameraFullName, float endTime[optional])"); Cpy(ActivateImportedCameraOfPrefabInstance, "ActivateImportedCameraOfPrefabInstance(string prefabInstanceName, string prefabCameraName, float endTime[optional])"); - Cpy(ActivateEngineCamera, "ActivateEngineCamera(string gameObjectCameraName, float endTime[optional])"); + Cpy(ActivateEngineCamera, "ActivateEngineCamera(string engineCameraName, float endTime[optional])"); Cpy(SetPhysicsCameraAngle, "SetPhysicsCameraAngle(float angleDegree)"); Cpy(GetPhysicsCameraAngle, "GetPhysicsCameraAngle()"); Cpy(SetPhysicsCameraTilt, "SetPhysicsCameraTilt(float tiltDegree)"); @@ -127,6 +127,11 @@ CScriptEditorAddFunction::CScriptEditorAddFunction(CWnd* pParent /*=NULL*/) Cpy(SetLightSpecular, "SetLightSpecular(string lightObjectName, float red, float green, float blue)"); Cpy(SetLightShininess, "SetLightShininess(string lightObjectName, float shininess)"); + Cpy(GetLightAmbient, "GetLightAmbient(string lightObjectName)"); + Cpy(GetLightDiffuse, "GetLightDiffuse(string lightObjectName)"); + Cpy(GetLightSpecular, "GetLightSpecular(string lightObjectName)"); + Cpy(GetLightShininess, "GetLightShininess(string lightObjectName)"); + Cpy(SetPrefabInstanceAmbient, "SetPrefabInstanceAmbient(string prefabInstanceName, float red, float green, float blue)"); Cpy(SetPrefabInstanceDiffuse, "SetPrefabInstanceDiffuse(string prefabInstanceName, float red, float green, float blue)"); Cpy(SetPrefabInstanceSpecular, "SetPrefabInstanceSpecular(string prefabInstanceName, float red, float green, float blue)"); @@ -486,6 +491,25 @@ CScriptEditorAddFunction::CScriptEditorAddFunction(CWnd* pParent /*=NULL*/) Cpy(SetTerrainSpecular, "SetTerrainSpecular(float red, float green, float blue)"); Cpy(SetTerrainShininess, "SetTerrainShininess(float shininess)"); + Cpy(GetTerrainAmbient, "GetTerrainAmbient()"); + Cpy(GetTerrainDiffuse, "GetTerrainDiffuse()"); + Cpy(GetTerrainSpecular, "GetTerrainSpecular()"); + Cpy(GetTerrainShininess, "GetTerrainShininess()"); + + //Engine Camera + Cpy(SetEngineCameraPosition, "SetEngineCameraPosition(string engineCameraName, float x, float y, float z)"); + Cpy(SetEngineCameraPan, "SetEngineCameraPan(string engineCameraName, float pan)"); + Cpy(SetEngineCameraTilt, "SetEngineCameraTilt(string engineCameraName, float tilt)"); + Cpy(SetEngineCameraNearClipPlane, "SetEngineCameraNearClipPlane(string engineCameraName, float nearClipPlane)"); + Cpy(SetEngineCameraFarClipPlane, "SetEngineCameraFarClipPlane(string engineCameraName, float farClipPlane)"); + Cpy(SetEngineCameraAngle, "SetEngineCameraAngle(string engineCameraName, float angle)"); + + Cpy(GetEngineCameraPosition, "GetEngineCameraPosition(string engineCameraName)"); + Cpy(GetEngineCameraPan, "GetEngineCameraPan(string engineCameraName)"); + Cpy(GetEngineCameraTilt, "GetEngineCameraTilt(string engineCameraName)"); + Cpy(GetEngineCameraNearClipPlane, "GetEngineCameraNearClipPlane(string engineCameraName)"); + Cpy(GetEngineCameraFarClipPlane, "GetEngineCameraFarClipPlane(string engineCameraName)"); + Cpy(GetEngineCameraAngle, "GetEngineCameraAngle(string engineCameraName)"); } CScriptEditorAddFunction::~CScriptEditorAddFunction() @@ -906,7 +930,23 @@ void CScriptEditorAddFunction::OnLvnItemchangedListFunctions(NMHDR *pNMHDR, LRES { m_richFunctionName.SetWindowTextA(SetLightShininess); } - else if (Cmp(szBuffer, "SetPrefabInstanceAmbient")) + else if (Cmp(szBuffer, "GetLightAmbient")) + { + m_richFunctionName.SetWindowTextA(GetLightAmbient); + } + else if (Cmp(szBuffer, "GetLightDiffuse")) + { + m_richFunctionName.SetWindowTextA(GetLightDiffuse); + } + else if (Cmp(szBuffer, "GetLightSpecular")) + { + m_richFunctionName.SetWindowTextA(GetLightSpecular); + } + else if (Cmp(szBuffer, "GetLightShininess")) + { + m_richFunctionName.SetWindowTextA(GetLightShininess); + } + if (Cmp(szBuffer, "SetPrefabInstanceAmbient")) { m_richFunctionName.SetWindowTextA(SetPrefabInstanceAmbient); } @@ -1034,7 +1074,7 @@ void CScriptEditorAddFunction::OnLvnItemchangedListFunctions(NMHDR *pNMHDR, LRES { m_richFunctionName.SetWindowTextA(DisablePhysicsDebugMode); } - if (Cmp(szBuffer, "SetCharacterControllerPosition")) + else if (Cmp(szBuffer, "SetCharacterControllerPosition")) { m_richFunctionName.SetWindowTextA(SetCharacterControllerPosition); } @@ -2124,6 +2164,70 @@ void CScriptEditorAddFunction::OnLvnItemchangedListFunctions(NMHDR *pNMHDR, LRES { m_richFunctionName.SetWindowTextA(SetTerrainShininess); } + else if (Cmp(szBuffer, "GetTerrainAmbient")) + { + m_richFunctionName.SetWindowTextA(GetTerrainAmbient); + } + else if (Cmp(szBuffer, "GetTerrainDiffuse")) + { + m_richFunctionName.SetWindowTextA(GetTerrainDiffuse); + } + else if (Cmp(szBuffer, "GetTerrainSpecular")) + { + m_richFunctionName.SetWindowTextA(GetTerrainSpecular); + } + else if (Cmp(szBuffer, "GetTerrainShininess")) + { + m_richFunctionName.SetWindowTextA(GetTerrainShininess); + } + else if (Cmp(szBuffer, "SetEngineCameraPosition")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraPosition); + } + else if (Cmp(szBuffer, "SetEngineCameraPan")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraPan); + } + else if (Cmp(szBuffer, "SetEngineCameraTilt")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraTilt); + } + else if (Cmp(szBuffer, "SetEngineCameraNearClipPlane")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraNearClipPlane); + } + else if (Cmp(szBuffer, "SetEngineCameraFarClipPlane")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraFarClipPlane); + } + else if (Cmp(szBuffer, "SetEngineCameraAngle")) + { + m_richFunctionName.SetWindowTextA(SetEngineCameraAngle); + } + else if (Cmp(szBuffer, "GetEngineCameraPosition")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraPosition); + } + else if (Cmp(szBuffer, "GetEngineCameraPan")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraPan); + } + else if (Cmp(szBuffer, "GetEngineCameraTilt")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraTilt); + } + else if (Cmp(szBuffer, "GetEngineCameraNearClipPlane")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraNearClipPlane); + } + else if (Cmp(szBuffer, "GetEngineCameraFarClipPlane")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraFarClipPlane); + } + else if (Cmp(szBuffer, "GetEngineCameraAngle")) + { + m_richFunctionName.SetWindowTextA(GetEngineCameraAngle); + } CInt end = m_richFunctionName.GetWindowTextLengthA(); m_richFunctionName.SetSel(0, end); @@ -2264,6 +2368,11 @@ BOOL CScriptEditorAddFunction::OnInitDialog() InsertItem("SetLightSpecular"); InsertItem("SetLightShininess"); + InsertItem("GetLightAmbient"); + InsertItem("GetLightDiffuse"); + InsertItem("GetLightSpecular"); + InsertItem("GetLightShininess"); + InsertItem("SetPrefabInstanceAmbient"); InsertItem("SetPrefabInstanceDiffuse"); InsertItem("SetPrefabInstanceSpecular"); @@ -2621,6 +2730,24 @@ BOOL CScriptEditorAddFunction::OnInitDialog() InsertItem("SetTerrainDiffuse"); InsertItem("SetTerrainSpecular"); InsertItem("SetTerrainShininess"); + InsertItem("GetTerrainAmbient"); + InsertItem("GetTerrainDiffuse"); + InsertItem("GetTerrainSpecular"); + InsertItem("GetTerrainShininess"); + + //Engine Camera + InsertItem("SetEngineCameraPosition"); + InsertItem("SetEngineCameraPan"); + InsertItem("SetEngineCameraTilt"); + InsertItem("SetEngineCameraNearClipPlane"); + InsertItem("SetEngineCameraFarClipPlane"); + InsertItem("SetEngineCameraAngle"); + InsertItem("GetEngineCameraPosition"); + InsertItem("GetEngineCameraPan"); + InsertItem("GetEngineCameraTilt"); + InsertItem("GetEngineCameraNearClipPlane"); + InsertItem("GetEngineCameraFarClipPlane"); + InsertItem("GetEngineCameraAngle"); m_listFunctions.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED | LVIS_FOCUSED); m_listFunctions.SetSelectionMark(0); diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h index 24a13d04..f1abf862 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEditorAddFunction.h @@ -139,6 +139,11 @@ class CScriptEditorAddFunction : public CDialog CChar SetLightSpecular[MAX_URI_SIZE]; CChar SetLightShininess[MAX_URI_SIZE]; + CChar GetLightAmbient[MAX_URI_SIZE]; + CChar GetLightDiffuse[MAX_URI_SIZE]; + CChar GetLightSpecular[MAX_URI_SIZE]; + CChar GetLightShininess[MAX_URI_SIZE]; + CChar SetPrefabInstanceAmbient[MAX_URI_SIZE]; CChar SetPrefabInstanceDiffuse[MAX_URI_SIZE]; CChar SetPrefabInstanceSpecular[MAX_URI_SIZE]; @@ -495,6 +500,26 @@ class CScriptEditorAddFunction : public CDialog CChar SetTerrainSpecular[MAX_URI_SIZE]; CChar SetTerrainShininess[MAX_URI_SIZE]; + CChar GetTerrainAmbient[MAX_URI_SIZE]; + CChar GetTerrainDiffuse[MAX_URI_SIZE]; + CChar GetTerrainSpecular[MAX_URI_SIZE]; + CChar GetTerrainShininess[MAX_URI_SIZE]; + + //Engine Camera + CChar SetEngineCameraPosition[MAX_URI_SIZE]; + CChar SetEngineCameraPan[MAX_URI_SIZE]; + CChar SetEngineCameraTilt[MAX_URI_SIZE]; + CChar SetEngineCameraNearClipPlane[MAX_URI_SIZE]; + CChar SetEngineCameraFarClipPlane[MAX_URI_SIZE]; + CChar SetEngineCameraAngle[MAX_URI_SIZE]; + + CChar GetEngineCameraPosition[MAX_URI_SIZE]; + CChar GetEngineCameraPan[MAX_URI_SIZE]; + CChar GetEngineCameraTilt[MAX_URI_SIZE]; + CChar GetEngineCameraNearClipPlane[MAX_URI_SIZE]; + CChar GetEngineCameraFarClipPlane[MAX_URI_SIZE]; + CChar GetEngineCameraAngle[MAX_URI_SIZE]; + CImageList m_image; public: diff --git a/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h b/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h index 1c26f2ca..0b036cda 100644 --- a/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h +++ b/Vanda Engine Editor/VandaEngineEditor/ScriptEngine/LuaForCpp.h @@ -189,6 +189,11 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "SetLightSpecular", SetLightSpecular); lua_register(L, "SetLightShininess", SetLightShininess); + lua_register(L, "GetLightAmbient", GetLightAmbient); + lua_register(L, "GetLightDiffuse", GetLightDiffuse); + lua_register(L, "GetLightSpecular", GetLightSpecular); + lua_register(L, "GetLightShininess", GetLightShininess); + lua_register(L, "SetPrefabInstanceAmbient", SetPrefabInstanceAmbient); lua_register(L, "SetPrefabInstanceDiffuse", SetPrefabInstanceDiffuse); lua_register(L, "SetPrefabInstanceSpecular", SetPrefabInstanceSpecular); @@ -541,8 +546,29 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "ResumeUpdateEventOfAmbientSound", ResumeUpdateEventOfAmbientSound); lua_register(L, "ResumeUpdateEventOfEngineCamera", ResumeUpdateEventOfEngineCamera); + //Terrain lua_register(L, "SetTerrainAmbient", SetTerrainAmbient); lua_register(L, "SetTerrainDiffuse", SetTerrainDiffuse); lua_register(L, "SetTerrainSpecular", SetTerrainSpecular); lua_register(L, "SetTerrainShininess", SetTerrainShininess); + + lua_register(L, "GetTerrainAmbient", GetTerrainAmbient); + lua_register(L, "GetTerrainDiffuse", GetTerrainDiffuse); + lua_register(L, "GetTerrainSpecular", GetTerrainSpecular); + lua_register(L, "GetTerrainShininess", GetTerrainShininess); + + //Engine Camera + lua_register(L, "SetEngineCameraPosition", SetEngineCameraPosition); + lua_register(L, "SetEngineCameraPan", SetEngineCameraPan); + lua_register(L, "SetEngineCameraTilt", SetEngineCameraTilt); + lua_register(L, "SetEngineCameraNearClipPlane", SetEngineCameraNearClipPlane); + lua_register(L, "SetEngineCameraFarClipPlane", SetEngineCameraFarClipPlane); + lua_register(L, "SetEngineCameraAngle", SetEngineCameraAngle); + + lua_register(L, "GetEngineCameraPosition", GetEngineCameraPosition); + lua_register(L, "GetEngineCameraPan", GetEngineCameraPan); + lua_register(L, "GetEngineCameraTilt", GetEngineCameraTilt); + lua_register(L, "GetEngineCameraNearClipPlane", GetEngineCameraNearClipPlane); + lua_register(L, "GetEngineCameraFarClipPlane", GetEngineCameraFarClipPlane); + lua_register(L, "GetEngineCameraAngle", GetEngineCameraAngle); } diff --git a/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp b/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp index d0db509a..f637b063 100644 --- a/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/SetCurrentProject.cpp @@ -165,7 +165,7 @@ void CSetCurrentProject::OnOK() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", szBuffer, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", szBuffer, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); //save the changes to projects.dat FILE *ProjectsFilePtr; diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.aps b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.aps index fb333298..8a0e8077 100644 Binary files a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.aps and b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.aps differ diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc index 485192ae..e2fe43dd 100644 --- a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc +++ b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditor.rc @@ -2882,7 +2882,7 @@ BEGIN LTEXT "Do not show this dialog at startup",IDC_STATIC,20,151,155,10 CONTROL "Tick",IDC_WELCOME_BUTTON_UNCHECK,"Button",BS_OWNERDRAW | WS_TABSTOP,5,149,12,12 CONTROL IDB_BITMAP7,IDC_STATIC,"Static",SS_BITMAP,2,3,77,19 - LTEXT "Version 2.6.0",IDC_STATIC,7,33,60,8 + LTEXT "Version 2.7.0",IDC_STATIC,7,33,60,8 LTEXT "© 2023 Ehsan Kamrani",IDC_STATIC,7,50,126,9 CONTROL "Tutorials",IDDONATE,"Button",BS_OWNERDRAW | WS_TABSTOP,15,91,52,16 LTEXT "To see the demo, please go to File | Open menu.",IDC_STATIC,9,69,167,9 @@ -3042,7 +3042,7 @@ CAPTION "About Vanda Engine" FONT 9, "Century Gothic", 400, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,241,114,50,16,WS_GROUP - LTEXT "VandaEngine Version 2.6.0",IDC_STATIC,103,7,123,8,SS_NOPREFIX + LTEXT "VandaEngine Version 2.7.0",IDC_STATIC,103,7,123,8,SS_NOPREFIX CONTROL IDB_BITMAP_SCENE_LIST,IDC_STATIC,"Static",SS_BITMAP,21,79,59,17 CONTROL IDB_BITMAP1,IDC_STATIC,"Static",SS_BITMAP,83,79,67,17 CONTROL IDB_BITMAP_OPENAL_LOGO,IDC_STATIC,"Static",SS_BITMAP,153,73,59,27 @@ -3614,12 +3614,12 @@ BEGIN BEGIN VALUE "CompanyName", "Ehsan Kamrani " VALUE "FileDescription", "Vanda Engine" - VALUE "FileVersion", "2.6.0" + VALUE "FileVersion", "2.7.0" VALUE "internalName", "VandaEngine.exe" VALUE "LegalCopyright", "(c) 2015 Ehsan Kamrani . All rights reserved." VALUE "OriginalFilename", "VandaEngine.exe" VALUE "ProductName", " Vanda Engine" - VALUE "ProductVersion", "2.6.0" + VALUE "ProductVersion", "2.7.0" END END BLOCK "VarFileInfo" diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp index f747356f..470c60a0 100644 --- a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp +++ b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.cpp @@ -27,7 +27,7 @@ #endif //Version = Max.Min.BugFixes; -CInt g_version = 260; +CInt g_version = 270; CChar g_edition[MAX_NAME_SIZE]; CBool g_useOriginalPathOfDAETextures = CFalse; @@ -1484,7 +1484,7 @@ BOOL CVandaEngineDlg::OnInitDialog() SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon - SetWindowText(_T("Vanda Engine 2.6.0")); + SetWindowText(_T("Vanda Engine 2.7.0")); // TODO: Add extra initialization here ShowWindow( SW_SHOWMAXIMIZED ); @@ -3066,7 +3066,7 @@ BOOL CVandaEngineDlg::OnInitDialog() } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; @@ -3127,7 +3127,7 @@ BOOL CVandaEngineDlg::OnInitDialog() PrintInfo("\nFatal Error(s) Occured. Go To View > Report", COLOR_RED); } else - PrintInfo( "\nVersion 2.6.0 initialized successfully" ); + PrintInfo( "\nVersion 2.7.0 initialized successfully" ); //CAboutDlg dlgAbout; //dlgAbout.DoModal(); ReleaseCapture(); @@ -3316,7 +3316,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; } @@ -3402,7 +3402,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) g_shareGeometriesBetweenScenes = CFalse; CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.6.0 : Prefab Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.7.0 : Prefab Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (g_multipleView->IsPlayGameMode()) @@ -3476,7 +3476,7 @@ BOOL CVandaEngineDlg::OnCommand(WPARAM wParam, LPARAM lParam) SortButtons(); CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.6.0 : GUI Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.7.0 : GUI Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (g_multipleView->IsPlayGameMode()) @@ -7809,7 +7809,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) PrintInfo("\nScene cleared successfully"); CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.6.0 : GUI Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.7.0 : GUI Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); return CTrue; @@ -8257,7 +8257,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) if (g_projects[i]->m_isActive) { CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", g_projects[i]->m_name, " - ", "Untitled", ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", g_projects[i]->m_name, " - ", "Untitled", ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; } @@ -8266,7 +8266,7 @@ CBool CVandaEngineDlg::OnMenuClickedNew( CBool askQuestion ) else if (g_editorMode == eMODE_PREFAB) { CChar temp[256]; - sprintf(temp, "%s", "Vanda Engine 2.6.0 : Prefab Mode (Untitled)"); + sprintf(temp, "%s", "Vanda Engine 2.7.0 : Prefab Mode (Untitled)"); ex_pVandaEngineDlg->SetWindowTextA(temp); } @@ -10020,7 +10020,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSaveGUIAs(CBool askQuestion) g_multipleView->RenderWindow(); //to save screenshot CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.6.0 : GUI Mode (", g_currentPackageAndGUIName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.7.0 : GUI Mode (", g_currentPackageAndGUIName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (m_dlgSaveGUIs) @@ -10862,7 +10862,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSavePrefabAs(CBool askQuestion) g_multipleView->RenderWindow(); //to save screenshot CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.6.0 : Prefab Mode (", g_currentPackageAndPrefabName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.7.0 : Prefab Mode (", g_currentPackageAndPrefabName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); if (m_dlgSavePrefabs) @@ -14187,7 +14187,7 @@ CVoid CVandaEngineDlg::OnMenuClickedSaveAs(CBool askQuestion) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; @@ -15374,7 +15374,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenGUI() ReleaseCapture(); CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.6.0 : GUI Mode (", guiAndPackageName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.7.0 : GUI Mode (", guiAndPackageName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); } @@ -17144,7 +17144,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenPrefab() } g_updateOctree = CTrue; CChar temp[256]; - sprintf(temp, "%s%s%s", "Vanda Engine 2.6.0 : Prefab Mode (", prefabAndPackageName, ")"); + sprintf(temp, "%s%s%s", "Vanda Engine 2.7.0 : Prefab Mode (", prefabAndPackageName, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); fclose(filePtr); @@ -19187,7 +19187,7 @@ CBool CVandaEngineDlg::OnMenuClickedOpenVScene(CBool askQuestion) } CChar temp[256]; - sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.6.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); + sprintf(temp, "%s%s%s%s%s", "Vanda Engine 2.7.0 (", g_projects[i]->m_name, " - ", m_currentVSceneNameWithoutDot, ")"); ex_pVandaEngineDlg->SetWindowTextA(temp); break; @@ -26145,6 +26145,26 @@ void CVandaEngineDlg::OnBnClickedBtnDeactivatePlayMode() m_engineLights.clear(); //End of loading light properties + //Load Engine Camera Properties + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + g_engineCameraInstances[i]->m_abstractCamera->SetAngle(m_engineCameraInstances[i]->m_abstractCamera->GetAngle()); + + CVec3f pos(m_engineCameraInstances[i]->GetPos().x, m_engineCameraInstances[i]->GetPos().y, m_engineCameraInstances[i]->GetPos().z); + g_engineCameraInstances[i]->SetPos(pos); + g_engineCameraInstances[i]->SetNCP(m_engineCameraInstances[i]->GetNCP()); + g_engineCameraInstances[i]->SetFCP(m_engineCameraInstances[i]->GetFCP()); + g_engineCameraInstances[i]->SetPan(m_engineCameraInstances[i]->GetPan()); + g_engineCameraInstances[i]->SetTilt(m_engineCameraInstances[i]->GetTilt()); + } + for (std::vector::iterator it = m_engineCameraInstances.begin(); it != m_engineCameraInstances.end(); it++) + { + CDelete((*it)->m_abstractCamera); + CDelete(*it); + } + m_engineCameraInstances.clear(); + //End of loading engine camera properties + if (g_dynamicShadowMap) { switch (g_shadowProperties.m_shadowResolution) @@ -26575,6 +26595,26 @@ void CVandaEngineDlg::OnBnClickedBtnActivatePlayMode() m_engineLights.push_back(instance_light); } + //Save Engine Camera Properties + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CInstanceCamera* instance_camera = new CInstanceCamera(); + CCamera* abstract_camera = new CCamera(); + + instance_camera->m_parent = NULL; + instance_camera->m_abstractCamera = abstract_camera; + instance_camera->m_abstractCamera->SetAngle(g_engineCameraInstances[i]->m_abstractCamera->GetAngle()); + + CVec3f pos(g_engineCameraInstances[i]->GetPos().x, g_engineCameraInstances[i]->GetPos().y, g_engineCameraInstances[i]->GetPos().z); + instance_camera->SetPos(pos); + instance_camera->SetNCP(g_engineCameraInstances[i]->GetNCP()); + instance_camera->SetFCP(g_engineCameraInstances[i]->GetFCP()); + instance_camera->SetPan(g_engineCameraInstances[i]->GetPan()); + instance_camera->SetTilt(g_engineCameraInstances[i]->GetTilt()); + + m_engineCameraInstances.push_back(instance_camera); + } + if (g_editorMode == eMODE_VSCENE || g_editorMode == eMODE_PREFAB) { //collision flags diff --git a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.h b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.h index 1c53b3cc..d2826679 100644 --- a/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.h +++ b/Vanda Engine Editor/VandaEngineEditor/VandaEngineEditorDlg.h @@ -737,6 +737,7 @@ class CVandaEngineDlg : public CDialog std::vectorm_engineVideos; std::vector m_instancePrefab; std::vector m_prefab; + std::vectorm_engineCameraInstances; CCurrentVSceneProperties m_currentVSceneProperties; CBool m_showMenuCursor; CBool m_pauseMainCharacterAnimations; diff --git a/Vanda Engine Editor/VandaEngineEditor/stdafx.h b/Vanda Engine Editor/VandaEngineEditor/stdafx.h index 9f05ced3..46c28674 100644 --- a/Vanda Engine Editor/VandaEngineEditor/stdafx.h +++ b/Vanda Engine Editor/VandaEngineEditor/stdafx.h @@ -220,6 +220,11 @@ CInt SetLightDiffuse(lua_State* L); CInt SetLightSpecular(lua_State* L); CInt SetLightShininess(lua_State* L); +CInt GetLightAmbient(lua_State* L); +CInt GetLightDiffuse(lua_State* L); +CInt GetLightSpecular(lua_State* L); +CInt GetLightShininess(lua_State* L); + CInt SetPrefabInstanceAmbient(lua_State* L); CInt SetPrefabInstanceDiffuse(lua_State* L); CInt SetPrefabInstanceSpecular(lua_State* L); @@ -571,7 +576,29 @@ CInt ResumeUpdateEventOf3DSound(lua_State* L); CInt ResumeUpdateEventOfAmbientSound(lua_State* L); CInt ResumeUpdateEventOfEngineCamera(lua_State* L); +//Terrain CInt SetTerrainAmbient(lua_State* L); CInt SetTerrainDiffuse(lua_State* L); CInt SetTerrainSpecular(lua_State* L); CInt SetTerrainShininess(lua_State* L); + +CInt GetTerrainAmbient(lua_State* L); +CInt GetTerrainDiffuse(lua_State* L); +CInt GetTerrainSpecular(lua_State* L); +CInt GetTerrainShininess(lua_State* L); + +//Engine Camera +CInt SetEngineCameraPosition(lua_State* L); +CInt SetEngineCameraPan(lua_State* L); +CInt SetEngineCameraTilt(lua_State* L); +CInt SetEngineCameraNearClipPlane(lua_State* L); +CInt SetEngineCameraFarClipPlane(lua_State* L); +CInt SetEngineCameraAngle(lua_State* L); + +CInt GetEngineCameraPosition(lua_State* L); +CInt GetEngineCameraPan(lua_State* L); +CInt GetEngineCameraTilt(lua_State* L); +CInt GetEngineCameraNearClipPlane(lua_State* L); +CInt GetEngineCameraFarClipPlane(lua_State* L); +CInt GetEngineCameraAngle(lua_State* L); + diff --git a/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe b/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe index b9aa0ca7..bade06bd 100644 Binary files a/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe and b/Vanda Engine Editor/release/Assets/Engine/Publish-Debug/publish-debug.exe differ diff --git a/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe b/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe index a9f70c51..864d0305 100644 Binary files a/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe and b/Vanda Engine Editor/release/Assets/Engine/Publish/publish.exe differ diff --git a/Vanda Engine Editor/release/Readme.txt b/Vanda Engine Editor/release/Readme.txt index 04535294..4089d8c4 100644 --- a/Vanda Engine Editor/release/Readme.txt +++ b/Vanda Engine Editor/release/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.6.0 +Vanda Engine 2.7.0 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Win32/Debug/Readme.txt b/Vanda Engine Win32/Debug/Readme.txt index 04535294..4089d8c4 100644 --- a/Vanda Engine Win32/Debug/Readme.txt +++ b/Vanda Engine Win32/Debug/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.6.0 +Vanda Engine 2.7.0 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org diff --git a/Vanda Engine Win32/VandaEngineWin32/Main.cpp b/Vanda Engine Win32/VandaEngineWin32/Main.cpp index ecf456bc..88d274b9 100644 --- a/Vanda Engine Win32/VandaEngineWin32/Main.cpp +++ b/Vanda Engine Win32/VandaEngineWin32/Main.cpp @@ -5234,6 +5234,242 @@ CInt SetLightShininess(lua_State* L) return 0; } +CInt GetLightAmbient(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetLightAmbient()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat x = g_currentLight->GetAmbient()[0]; + CFloat y = g_currentLight->GetAmbient()[1]; + CFloat z = g_currentLight->GetAmbient()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + else + { + //PrintInfo("\nGetLightAmbient Error: Couldn't find current light", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat x = g_engineLights[i]->m_abstractLight->GetAmbient()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetAmbient()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetAmbient()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + } + + //CChar message[MAX_URI_SIZE]; + //sprintf(message, "\nGetLightAmbient Error: Couldn't find light '%s'", lua_tostring(L, 1)); + //PrintInfo(message, COLOR_RED); + + return 0; +} + +CInt GetLightDiffuse(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetLightDiffuse()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat x = g_currentLight->GetDiffuse()[0]; + CFloat y = g_currentLight->GetDiffuse()[1]; + CFloat z = g_currentLight->GetDiffuse()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + else + { + //PrintInfo("\nGetLightDiffuse Error: Couldn't find current light", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat x = g_engineLights[i]->m_abstractLight->GetDiffuse()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetDiffuse()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetDiffuse()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + } + + //CChar message[MAX_URI_SIZE]; + //sprintf(message, "\nGetLightDiffuse Error: Couldn't find light '%s'", lua_tostring(L, 1)); + //PrintInfo(message, COLOR_RED); + + return 0; +} + +CInt GetLightSpecular(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetLightSpecular()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat x = g_currentLight->GetSpecular()[0]; + CFloat y = g_currentLight->GetSpecular()[1]; + CFloat z = g_currentLight->GetSpecular()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + else + { + //PrintInfo("\nGetLightSpecular Error: Couldn't find current light", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat x = g_engineLights[i]->m_abstractLight->GetSpecular()[0]; + CFloat y = g_engineLights[i]->m_abstractLight->GetSpecular()[1]; + CFloat z = g_engineLights[i]->m_abstractLight->GetSpecular()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + } + + //CChar message[MAX_URI_SIZE]; + //sprintf(message, "\nGetLightSpecular Error: Couldn't find light '%s'", lua_tostring(L, 1)); + //PrintInfo(message, COLOR_RED); + + return 0; +} + +CInt GetLightShininess(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetLightShininess()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentLight) + { + CFloat val = g_currentLight->GetShininess(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetLightShininess Error: Couldn't find current light", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineLights.size(); i++) + { + CChar lightName[MAX_NAME_SIZE]; + Cpy(lightName, g_engineLights[i]->m_abstractLight->GetName()); + StringToUpper(lightName); + + if (Cmp(luaToString, lightName)) + { + CFloat val = g_engineLights[i]->m_abstractLight->GetShininess(); + lua_pushnumber(L, val); + return 1; + } + } + + //CChar message[MAX_URI_SIZE]; + //sprintf(message, "\nGetLightShininess Error: Couldn't find light '%s'", lua_tostring(L, 1)); + //PrintInfo(message, COLOR_RED); + + return 0; +} + CInt SetPrefabInstanceAmbient(lua_State* L) { //if (g_testScript) @@ -19574,6 +19810,7 @@ CInt ResumeUpdateEventOfEngineCamera(lua_State* L) return 0; } +//Terrain CInt SetTerrainAmbient(lua_State* L) { int argc = lua_gettop(L); @@ -19722,6 +19959,690 @@ CInt SetTerrainShininess(lua_State* L) return 0; } +CInt GetTerrainAmbient(lua_State* L) +{ + if (!g_terrain) + { + //PrintInfo("\nGetTerrainAmbient() Error: Couldn't find terrain object", COLOR_RED); + return 0; + } + + CFloat x = g_terrain->GetAmbientColor()[0]; + CFloat y = g_terrain->GetAmbientColor()[1]; + CFloat z = g_terrain->GetAmbientColor()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; +} + +CInt GetTerrainDiffuse(lua_State* L) +{ + if (!g_terrain) + { + //PrintInfo("\nGetTerrainDiffuse() Error: Couldn't find terrain object", COLOR_RED); + return 0; + } + + CFloat x = g_terrain->GetDiffuseColor()[0]; + CFloat y = g_terrain->GetDiffuseColor()[1]; + CFloat z = g_terrain->GetDiffuseColor()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; +} + +CInt GetTerrainSpecular(lua_State* L) +{ + if (!g_terrain) + { + //PrintInfo("\nGetTerrainSpecular() Error: Couldn't find terrain object", COLOR_RED); + return 0; + } + + CFloat x = g_terrain->GetSpecularColor()[0]; + CFloat y = g_terrain->GetSpecularColor()[1]; + CFloat z = g_terrain->GetSpecularColor()[2]; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; +} + +CInt GetTerrainShininess(lua_State* L) +{ + if (!g_terrain) + { + //PrintInfo("\nGetTerrainShininess() Error: Couldn't find terrain object", COLOR_RED); + return 0; + } + + CFloat shininess = g_terrain->GetShininess(); + + lua_pushnumber(L, shininess); + + return 1; +} + +//Engine Camera +CInt SetEngineCameraPosition(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 4) + { + //PrintInfo("\nPlease specify 4 arguments for SetEngineCameraPosition()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat x = (CFloat)lua_tonumber(L, 2); + CFloat y = (CFloat)lua_tonumber(L, 3); + CFloat z = (CFloat)lua_tonumber(L, 4); + + CVec3f position; + position.x = x; position.y = y; position.z = z; + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetPos(position); + g_currentEngineCamera->MoveTransform2(position.x, position.y, position.z); + } + else + { + //PrintInfo("\nSetEngineCameraPosition Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetPos(position); + g_engineCameraInstances[i]->MoveTransform2(position.x, position.y, position.z); + break; + } + } + + return 0; +} + +CInt SetEngineCameraPan(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 2) + { + //PrintInfo("\nPlease specify 2 arguments for SetEngineCameraPan()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat pan = (CFloat)lua_tonumber(L, 2); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetPan(pan); + g_currentEngineCamera->SetPanAndTilt2(pan, g_currentEngineCamera->GetTilt()); + } + else + { + //PrintInfo("\nSetEngineCameraPan Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetPan(pan); + g_engineCameraInstances[i]->SetPanAndTilt2(pan, g_engineCameraInstances[i]->GetTilt()); + break; + } + } + + return 0; +} + +CInt SetEngineCameraTilt(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 2) + { + //PrintInfo("\nPlease specify 2 arguments for SetEngineCameraTilt()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat tilt = (CFloat)lua_tonumber(L, 2); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetTilt(tilt); + g_currentEngineCamera->SetPanAndTilt2(g_currentEngineCamera->GetPan(), tilt); + } + else + { + //PrintInfo("\nSetEngineCameraTilt Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetTilt(tilt); + g_engineCameraInstances[i]->SetPanAndTilt2(g_engineCameraInstances[i]->GetPan(), tilt); + break; + } + } + + return 0; +} + +CInt SetEngineCameraNearClipPlane(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 2) + { + //PrintInfo("\nPlease specify 2 arguments for SetEngineCameraNearClipPlane()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat ncp = (CFloat)lua_tonumber(L, 2); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetNCP(ncp); + } + else + { + //PrintInfo("\nSetEngineCameraNearClipPlane Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetNCP(ncp); + break; + } + } + + return 0; +} + +CInt SetEngineCameraFarClipPlane(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 2) + { + //PrintInfo("\nPlease specify 2 arguments for SetEngineCameraFarClipPlane()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat fcp = (CFloat)lua_tonumber(L, 2); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->SetFCP(fcp); + } + else + { + //PrintInfo("\nSetEngineCameraFarClipPlane Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->SetFCP(fcp); + break; + } + } + + return 0; +} + +CInt SetEngineCameraAngle(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 2) + { + //PrintInfo("\nPlease specify 2 arguments for SetEngineCameraAngle()", COLOR_RED); + return 0; + } + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); + StringToUpper(luaToString); + + CFloat angle = (CFloat)lua_tonumber(L, 2); + + if (Cmp(luaToString, "THIS")) + { + if (g_currentEngineCamera) + { + g_currentEngineCamera->m_abstractCamera->SetAngle(angle); + } + else + { + //PrintInfo("\nSetEngineCameraAngle Error: Couldn't find current engine camera", COLOR_RED); + } + + return 0; + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + + if (Cmp(luaToString, cameraName)) + { + g_engineCameraInstances[i]->m_abstractCamera->SetAngle(angle); + break; + } + } + + return 0; +} + +CInt GetEngineCameraPosition(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraPosition()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat x = g_currentEngineCamera->GetPos().x; + CFloat y = g_currentEngineCamera->GetPos().y; + CFloat z = g_currentEngineCamera->GetPos().z; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + else + { + //PrintInfo("\nGetEngineCameraPosition() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat x = g_engineCameraInstances[i]->GetPos().x; + CFloat y = g_engineCameraInstances[i]->GetPos().y; + CFloat z = g_engineCameraInstances[i]->GetPos().z; + + lua_pushnumber(L, x); + lua_pushnumber(L, y); + lua_pushnumber(L, z); + + return 3; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetEngineCameraPan(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraPan()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->GetPan(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetEngineCameraPan() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetPan(); + lua_pushnumber(L, val); + return 1; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetEngineCameraTilt(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraTilt()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->GetTilt(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetEngineCameraTilt() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetTilt(); + lua_pushnumber(L, val); + return 1; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetEngineCameraNearClipPlane(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraNearClipPlane()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->GetNCP(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetEngineCameraNearClipPlane() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetNCP(); + lua_pushnumber(L, val); + return 1; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetEngineCameraFarClipPlane(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraFarClipPlane()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->GetFCP(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetEngineCameraFarClipPlane() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->GetFCP(); + lua_pushnumber(L, val); + return 1; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + +CInt GetEngineCameraAngle(lua_State* L) +{ + int argc = lua_gettop(L); + if (argc < 1) + { + //PrintInfo("\nPlease specify 1 argument for GetEngineCameraAngle()", COLOR_RED); + return 0; + } + CBool foundCameraInstance = CFalse; + + CChar luaToString[MAX_NAME_SIZE]; + Cpy(luaToString, lua_tostring(L, 1)); //Camera Instance Name- First Argument + StringToUpper(luaToString); + + if (Cmp("THIS", luaToString)) + { + if (g_currentEngineCamera) + { + CFloat val = g_currentEngineCamera->m_abstractCamera->GetAngle(); + lua_pushnumber(L, val); + return 1; + } + else + { + //PrintInfo("\nGetEngineCameraAngle() Error: Couldn't find current engine camera", COLOR_RED); + return 0; + } + } + + for (CUInt i = 0; i < g_engineCameraInstances.size(); i++) + { + CChar cameraName[MAX_NAME_SIZE]; + Cpy(cameraName, g_engineCameraInstances[i]->m_abstractCamera->GetName()); + StringToUpper(cameraName); + if (Cmp(cameraName, luaToString)) + { + foundCameraInstance = CTrue; + CFloat val = g_engineCameraInstances[i]->m_abstractCamera->GetAngle(); + lua_pushnumber(L, val); + return 1; + } + } + if (!foundCameraInstance) + { + //CChar temp[MAX_NAME_SIZE]; + //sprintf(temp, "\n%s%s%s", "Couldn't find '", luaToString, "' engine camera"); + //PrintInfo(temp, COLOR_RED); + return 0; + } + + return 0; +} + CBool CMain::firstIdle = CTrue; CChar CMain::currentIdleName[MAX_NAME_SIZE]; diff --git a/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h b/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h index 573f4df3..ea815753 100644 --- a/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h +++ b/Vanda Engine Win32/VandaEngineWin32/ScriptEngine/LuaForCpp.h @@ -178,6 +178,11 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "SetLightSpecular", SetLightSpecular); lua_register(L, "SetLightShininess", SetLightShininess); + lua_register(L, "GetLightAmbient", GetLightAmbient); + lua_register(L, "GetLightDiffuse", GetLightDiffuse); + lua_register(L, "GetLightSpecular", GetLightSpecular); + lua_register(L, "GetLightShininess", GetLightShininess); + lua_register(L, "SetPrefabInstanceAmbient", SetPrefabInstanceAmbient); lua_register(L, "SetPrefabInstanceDiffuse", SetPrefabInstanceDiffuse); lua_register(L, "SetPrefabInstanceSpecular", SetPrefabInstanceSpecular); @@ -530,8 +535,30 @@ static void LuaRegisterFunctions(lua_State* L) lua_register(L, "ResumeUpdateEventOfAmbientSound", ResumeUpdateEventOfAmbientSound); lua_register(L, "ResumeUpdateEventOfEngineCamera", ResumeUpdateEventOfEngineCamera); + //Terrain lua_register(L, "SetTerrainAmbient", SetTerrainAmbient); lua_register(L, "SetTerrainDiffuse", SetTerrainDiffuse); lua_register(L, "SetTerrainSpecular", SetTerrainSpecular); lua_register(L, "SetTerrainShininess", SetTerrainShininess); + + lua_register(L, "GetTerrainAmbient", GetTerrainAmbient); + lua_register(L, "GetTerrainDiffuse", GetTerrainDiffuse); + lua_register(L, "GetTerrainSpecular", GetTerrainSpecular); + lua_register(L, "GetTerrainShininess", GetTerrainShininess); + + //Engine Camera + lua_register(L, "SetEngineCameraPosition", SetEngineCameraPosition); + lua_register(L, "SetEngineCameraPan", SetEngineCameraPan); + lua_register(L, "SetEngineCameraTilt", SetEngineCameraTilt); + lua_register(L, "SetEngineCameraNearClipPlane", SetEngineCameraNearClipPlane); + lua_register(L, "SetEngineCameraFarClipPlane", SetEngineCameraFarClipPlane); + lua_register(L, "SetEngineCameraAngle", SetEngineCameraAngle); + + lua_register(L, "GetEngineCameraPosition", GetEngineCameraPosition); + lua_register(L, "GetEngineCameraPan", GetEngineCameraPan); + lua_register(L, "GetEngineCameraTilt", GetEngineCameraTilt); + lua_register(L, "GetEngineCameraNearClipPlane", GetEngineCameraNearClipPlane); + lua_register(L, "GetEngineCameraFarClipPlane", GetEngineCameraFarClipPlane); + lua_register(L, "GetEngineCameraAngle", GetEngineCameraAngle); + } diff --git a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp index 2ac3f48e..4ab2bfc6 100644 --- a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp +++ b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.cpp @@ -22,7 +22,7 @@ class COpenALSoundBuffer; //Edition.MaxVersion.MinVersion.BugFixes; -CInt g_version = 260; +CInt g_version = 270; CChar g_edition[MAX_NAME_SIZE]; CScene* g_currentScene = NULL; CInstancePrefab* g_currentInstancePrefab = NULL; diff --git a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc index 670d48a9..64b1b164 100644 --- a/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc +++ b/Vanda Engine Win32/VandaEngineWin32/VandaEngineWin32.rc @@ -75,12 +75,12 @@ BEGIN BEGIN VALUE "CompanyName", "Ehsan Kamrani " VALUE "FileDescription", "Vanda Engine" - VALUE "FileVersion", "2.6.0" + VALUE "FileVersion", "2.7.0" VALUE "internalName", "VandaEngine.exe" VALUE "LegalCopyright", "(c) 2023 Vanda Engine. All rights reserved." VALUE "OriginalFilename", "VandaEngine.exe" VALUE "ProductName", " Vanda Engine" - VALUE "ProductVersion", "2.6.0" + VALUE "ProductVersion", "2.7.0" END END BLOCK "VarFileInfo" @@ -101,7 +101,7 @@ CAPTION "About" FONT 8, "System" BEGIN ICON 107,IDC_MYICON,14,9,16,16 - LTEXT "VandaEngine Version 2.6.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "VandaEngine Version 2.7.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2023",IDC_STATIC,49,20,119,8 DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP END diff --git a/Vanda Engine Win32/VandaEngineWin32/stdafx.h b/Vanda Engine Win32/VandaEngineWin32/stdafx.h index e0df44c1..05cfd049 100644 --- a/Vanda Engine Win32/VandaEngineWin32/stdafx.h +++ b/Vanda Engine Win32/VandaEngineWin32/stdafx.h @@ -176,6 +176,11 @@ CInt SetLightDiffuse(lua_State* L); CInt SetLightSpecular(lua_State* L); CInt SetLightShininess(lua_State* L); +CInt GetLightAmbient(lua_State* L); +CInt GetLightDiffuse(lua_State* L); +CInt GetLightSpecular(lua_State* L); +CInt GetLightShininess(lua_State* L); + CInt SetPrefabInstanceAmbient(lua_State* L); CInt SetPrefabInstanceDiffuse(lua_State* L); CInt SetPrefabInstanceSpecular(lua_State* L); @@ -527,11 +532,32 @@ CInt ResumeUpdateEventOf3DSound(lua_State* L); CInt ResumeUpdateEventOfAmbientSound(lua_State* L); CInt ResumeUpdateEventOfEngineCamera(lua_State* L); +//Terrain CInt SetTerrainAmbient(lua_State* L); CInt SetTerrainDiffuse(lua_State* L); CInt SetTerrainSpecular(lua_State* L); CInt SetTerrainShininess(lua_State* L); +CInt GetTerrainAmbient(lua_State* L); +CInt GetTerrainDiffuse(lua_State* L); +CInt GetTerrainSpecular(lua_State* L); +CInt GetTerrainShininess(lua_State* L); + +//Engine Camera +CInt SetEngineCameraPosition(lua_State* L); +CInt SetEngineCameraPan(lua_State* L); +CInt SetEngineCameraTilt(lua_State* L); +CInt SetEngineCameraNearClipPlane(lua_State* L); +CInt SetEngineCameraFarClipPlane(lua_State* L); +CInt SetEngineCameraAngle(lua_State* L); + +CInt GetEngineCameraPosition(lua_State* L); +CInt GetEngineCameraPan(lua_State* L); +CInt GetEngineCameraTilt(lua_State* L); +CInt GetEngineCameraNearClipPlane(lua_State* L); +CInt GetEngineCameraFarClipPlane(lua_State* L); +CInt GetEngineCameraAngle(lua_State* L); + void GenerateLoadingTexture( char* fileName ); void DeleteLoadingTexture(); CVoid ShowLoadingScene(CChar* message = NULL); diff --git a/Vanda Engine Win32/release/Readme.txt b/Vanda Engine Win32/release/Readme.txt index 04535294..4089d8c4 100644 --- a/Vanda Engine Win32/release/Readme.txt +++ b/Vanda Engine Win32/release/Readme.txt @@ -1,4 +1,4 @@ -Vanda Engine 2.6.0 +Vanda Engine 2.7.0 Copyright (C) 2023 Ehsan Kamrani www.vanda3d.org