parent
a3072aa35e
commit
b902a2f2a7
27 changed files with 84 additions and 75 deletions
|
@ -150,7 +150,7 @@ private:
|
|||
if (new_hash_table_power == -1)
|
||||
return;
|
||||
|
||||
Element **new_hash_table = memnew_arr(Element *, (1 << new_hash_table_power));
|
||||
Element **new_hash_table = memnew_arr(Element *, ((uint64_t)1 << new_hash_table_power));
|
||||
if (!new_hash_table) {
|
||||
|
||||
ERR_PRINT("Out of Memory");
|
||||
|
@ -230,7 +230,7 @@ private:
|
|||
if (!p_t.hash_table || p_t.hash_table_power == 0)
|
||||
return; /* not copying from empty table */
|
||||
|
||||
hash_table = memnew_arr(Element *, 1 << p_t.hash_table_power);
|
||||
hash_table = memnew_arr(Element *, (uint64_t)1 << p_t.hash_table_power);
|
||||
hash_table_power = p_t.hash_table_power;
|
||||
elements = p_t.elements;
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
|
||||
#define sprintf sprintf_s
|
||||
#endif
|
||||
|
||||
bool Logger::should_log(bool p_err) {
|
||||
return (!p_err || _print_error_enabled) && (p_err || _print_line_enabled);
|
||||
}
|
||||
|
|
|
@ -1309,7 +1309,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
|
|||
case Variant::INT: {
|
||||
|
||||
int64_t val = p_property;
|
||||
if (val > 0x7FFFFFFF || val < -0x80000000) {
|
||||
if (val > 0x7FFFFFFF || val < -(int64_t)0x80000000) {
|
||||
f->store_32(VARIANT_INT64);
|
||||
f->store_64(val);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
#define snprintf _snprintf_s
|
||||
#endif
|
||||
|
||||
#define MAX_DIGITS 6
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
|
||||
#define strcpy strcpy_s
|
||||
#endif
|
||||
|
||||
#ifndef IPHONE_ENABLED
|
||||
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
|
||||
|
||||
|
@ -84,6 +88,7 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
|
|||
return; //these are ultimately annoying, so removing for now
|
||||
|
||||
char debSource[256], debType[256], debSev[256];
|
||||
|
||||
if (source == _EXT_DEBUG_SOURCE_API_ARB)
|
||||
strcpy(debSource, "OpenGL");
|
||||
else if (source == _EXT_DEBUG_SOURCE_WINDOW_SYSTEM_ARB)
|
||||
|
|
|
@ -73,6 +73,10 @@ RasterizerScene *RasterizerGLES3::get_scene() {
|
|||
#define _EXT_DEBUG_SEVERITY_LOW_ARB 0x9148
|
||||
#define _EXT_DEBUG_OUTPUT 0x92E0
|
||||
|
||||
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
|
||||
#define strcpy strcpy_s
|
||||
#endif
|
||||
|
||||
#ifdef GLAD_ENABLED
|
||||
// Restricting to GLAD as only used in initialize() with GLAD_GL_ARB_debug_output
|
||||
#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
|
||||
|
|
|
@ -1246,14 +1246,11 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
|
|||
case ShaderLanguage::TYPE_SAMPLER3D: {
|
||||
|
||||
target = GL_TEXTURE_3D;
|
||||
tex = storage->resources.white_tex_3d;
|
||||
|
||||
switch (texture_hints[i]) {
|
||||
|
||||
// TODO
|
||||
default: {
|
||||
tex = storage->resources.white_tex_3d;
|
||||
} break;
|
||||
}
|
||||
//switch (texture_hints[i]) {
|
||||
// TODO
|
||||
//}
|
||||
|
||||
} break;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ Error AudioDriverRtAudio::init() {
|
|||
active = true;
|
||||
|
||||
break;
|
||||
} catch (RtAudioError &e) {
|
||||
} catch (RtAudioError) {
|
||||
// try with less channels
|
||||
ERR_PRINT("Unable to open audio, retrying with fewer channels...");
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
|||
path = path + ".tmp";
|
||||
}
|
||||
|
||||
f = _wfopen(path.c_str(), mode_string);
|
||||
_wfopen_s(&f, path.c_str(), mode_string);
|
||||
|
||||
if (f == NULL) {
|
||||
last_error = ERR_FILE_CANT_OPEN;
|
||||
|
@ -278,7 +278,7 @@ bool FileAccessWindows::file_exists(const String &p_name) {
|
|||
FILE *g;
|
||||
//printf("opening file %s\n", p_fname.c_str());
|
||||
String filename = fix_path(p_name);
|
||||
g = _wfopen(filename.c_str(), L"rb");
|
||||
_wfopen_s(&g, filename.c_str(), L"rb");
|
||||
if (g == NULL) {
|
||||
|
||||
return false;
|
||||
|
|
|
@ -32,18 +32,6 @@
|
|||
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void CameraEditor::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
|
||||
/* case NOTIFICATION_PROCESS: {
|
||||
|
||||
if (preview->is_pressed() && node)
|
||||
node->call("make_current");
|
||||
|
||||
} break;*/
|
||||
}
|
||||
}
|
||||
void CameraEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
|
|
|
@ -50,7 +50,6 @@ class CameraEditor : public Control {
|
|||
void _pressed();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
void _node_removed(Node *p_node);
|
||||
static void _bind_methods();
|
||||
|
||||
|
|
|
@ -3454,10 +3454,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
|||
|
||||
if (points.size() > 3) {
|
||||
|
||||
QuickHull qh;
|
||||
Vector<Vector3> varr = Variant(points);
|
||||
Geometry::MeshData md;
|
||||
Error err = qh.build(varr, md);
|
||||
Error err = QuickHull::build(varr, md);
|
||||
if (err == OK) {
|
||||
Vector<Vector3> points;
|
||||
points.resize(md.edges.size() * 2);
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include "core/io/stream_peer_ssl.h"
|
||||
#include "tls/mbedtls/wrapper/include/openssl/ssl.h"
|
||||
|
||||
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
|
||||
#define strncpy strncpy_s
|
||||
#endif
|
||||
|
||||
Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocols) {
|
||||
|
||||
ERR_FAIL_COND_V(context != NULL, FAILED);
|
||||
|
|
|
@ -313,7 +313,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u
|
|||
} else if (to < 0) {
|
||||
|
||||
// All but one, for us if not excluded
|
||||
if (_peer_id != -p_peer_id)
|
||||
if (_peer_id != -(int32_t)p_peer_id)
|
||||
_store_pkt(from, to, in_buffer, data_size);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -91,18 +91,18 @@ Error ContextGL_Win::initialize() {
|
|||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||
PFD_DOUBLEBUFFER,
|
||||
PFD_TYPE_RGBA,
|
||||
OS::get_singleton()->is_layered_allowed() ? 32 : 24,
|
||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
OS::get_singleton()->is_layered_allowed() ? 8 : 0, // Alpha Buffer
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
24, // 24Bit Z-Buffer (Depth Buffer)
|
||||
0, // No Stencil Buffer
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
(BYTE)PFD_TYPE_RGBA,
|
||||
OS::get_singleton()->is_layered_allowed() ? (BYTE)32 : (BYTE)24,
|
||||
(BYTE)0, (BYTE)0, (BYTE)0, (BYTE)0, (BYTE)0, (BYTE)0, // Color Bits Ignored
|
||||
OS::get_singleton()->is_layered_allowed() ? (BYTE)8 : (BYTE)0, // Alpha Buffer
|
||||
(BYTE)0, // Shift Bit Ignored
|
||||
(BYTE)0, // No Accumulation Buffer
|
||||
(BYTE)0, (BYTE)0, (BYTE)0, (BYTE)0, // Accumulation Bits Ignored
|
||||
(BYTE)24, // 24Bit Z-Buffer (Depth Buffer)
|
||||
(BYTE)0, // No Stencil Buffer
|
||||
(BYTE)0, // No Auxiliary Buffer
|
||||
(BYTE)PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
(BYTE)0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
|
|||
|
||||
const GUID &guid = instance->guidProduct;
|
||||
char uid[128];
|
||||
sprintf(uid, "%08lx%04hx%04hx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
|
||||
sprintf_s(uid, "%08lx%04hx%04hx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
|
||||
__builtin_bswap32(guid.Data1), guid.Data2, guid.Data3,
|
||||
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
||||
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
|
|
|
@ -1204,7 +1204,14 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
|
||||
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
char *windowid = getenv("GODOT_WINDOWID");
|
||||
char *windowid;
|
||||
#ifdef MINGW_ENABLED
|
||||
windowid = getenv("GODOT_WINDOWID");
|
||||
#else
|
||||
size_t len;
|
||||
_dupenv_s(&windowid, &len, "GODOT_WINDOWID");
|
||||
#endif
|
||||
|
||||
if (windowid) {
|
||||
|
||||
// strtoull on mingw
|
||||
|
@ -1213,6 +1220,7 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
#else
|
||||
hWnd = (HWND)_strtoui64(windowid, NULL, 0);
|
||||
#endif
|
||||
free(windowid);
|
||||
SetLastError(0);
|
||||
user_proc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)(WNDPROC)::WndProc);
|
||||
|
@ -2546,7 +2554,16 @@ void OS_Windows::set_icon(const Ref<Image> &p_icon) {
|
|||
|
||||
bool OS_Windows::has_environment(const String &p_var) const {
|
||||
|
||||
#ifdef MINGW_ENABLED
|
||||
return _wgetenv(p_var.c_str()) != NULL;
|
||||
#else
|
||||
wchar_t *env;
|
||||
size_t len;
|
||||
_wdupenv_s(&env, &len, p_var.c_str());
|
||||
const bool has_env = env != NULL;
|
||||
free(env);
|
||||
return has_env;
|
||||
#endif
|
||||
};
|
||||
|
||||
String OS_Windows::get_environment(const String &p_var) const {
|
||||
|
@ -2926,7 +2943,7 @@ bool OS_Windows::is_disable_crash_handler() const {
|
|||
Error OS_Windows::move_to_trash(const String &p_path) {
|
||||
SHFILEOPSTRUCTW sf;
|
||||
WCHAR *from = new WCHAR[p_path.length() + 2];
|
||||
wcscpy(from, p_path.c_str());
|
||||
wcscpy_s(from, p_path.length() + 1, p_path.c_str());
|
||||
from[p_path.length() + 1] = 0;
|
||||
|
||||
sf.hwnd = hWnd;
|
||||
|
|
|
@ -204,12 +204,6 @@ Size2 Node2D::get_scale() const {
|
|||
return _scale;
|
||||
}
|
||||
|
||||
void Node2D::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
Transform2D Node2D::get_transform() const {
|
||||
|
||||
return _mat;
|
||||
|
|
|
@ -52,8 +52,6 @@ class Node2D : public CanvasItem {
|
|||
void _update_xform_values();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
|
|
@ -593,7 +593,7 @@ void TileMap::update_dirty_quadrants() {
|
|||
|
||||
if (quadrant_order_dirty) {
|
||||
|
||||
int index = -0x80000000; //always must be drawn below children
|
||||
int index = -(int64_t)0x80000000; //always must be drawn below children
|
||||
for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
|
||||
|
||||
Quadrant &q = E->get();
|
||||
|
|
|
@ -448,7 +448,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||
|
||||
//float dist_att_db = -20 * Math::log(dist + 0.00001); //logarithmic attenuation, like in real life
|
||||
|
||||
float center_val[3] = { 0.5, 0.25, 0.16666 };
|
||||
float center_val[3] = { 0.5f, 0.25f, 0.16666f };
|
||||
AudioFrame center_frame(center_val[vol_index_max - 1], center_val[vol_index_max - 1]);
|
||||
|
||||
if (attenuation < 1.0) {
|
||||
|
|
|
@ -1619,7 +1619,7 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
|
|||
Vector3(-0.700629, -0.509037, 0.5),
|
||||
Vector3(0.267617, -0.823639, 0.5)
|
||||
};
|
||||
static const float weights[6] = { 0.25, 0.15, 0.15, 0.15, 0.15, 0.15 };
|
||||
static const float weights[6] = { 0.25f, 0.15f, 0.15f, 0.15f, 0.15f, 0.15f };
|
||||
//
|
||||
cone_dirs = dirs;
|
||||
cone_dir_count = 6;
|
||||
|
@ -1641,7 +1641,7 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
|
|||
Vector3(0.19124006749743122, 0.39355745585016605, 0.8991883926788214),
|
||||
Vector3(0.19124006749743122, -0.39355745585016605, 0.8991883926788214),
|
||||
};
|
||||
static const float weights[10] = { 0.08571, 0.08571, 0.08571, 0.08571, 0.08571, 0.08571, 0.08571, 0.133333, 0.133333, 0.13333 };
|
||||
static const float weights[10] = { 0.08571f, 0.08571f, 0.08571f, 0.08571f, 0.08571f, 0.08571f, 0.08571f, 0.133333f, 0.133333f, 0.13333f };
|
||||
cone_dirs = dirs;
|
||||
cone_dir_count = 10;
|
||||
cone_aperture = 0.404; // tan(angle) 45 degrees
|
||||
|
@ -1875,7 +1875,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
|
|||
if (bake_mode == BAKE_MODE_RAY_TRACE) {
|
||||
//blur
|
||||
//gauss kernel, 7 step sigma 2
|
||||
static const float gauss_kernel[4] = { 0.214607, 0.189879, 0.131514, 0.071303 };
|
||||
static const float gauss_kernel[4] = { 0.214607f, 0.189879f, 0.131514f, 0.071303f };
|
||||
//horizontal pass
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
|
|
|
@ -38,10 +38,9 @@ Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() {
|
|||
|
||||
if (points.size() > 3) {
|
||||
|
||||
QuickHull qh;
|
||||
Vector<Vector3> varr = Variant(points);
|
||||
Geometry::MeshData md;
|
||||
Error err = qh.build(varr, md);
|
||||
Error err = QuickHull::build(varr, md);
|
||||
if (err == OK) {
|
||||
Vector<Vector3> lines;
|
||||
lines.resize(md.edges.size() * 2);
|
||||
|
|
|
@ -201,10 +201,10 @@ Error DynamicFontAtSize::_load() {
|
|||
|
||||
if (FT_HAS_COLOR(face)) {
|
||||
int best_match = 0;
|
||||
int diff = ABS(id.size - face->available_sizes[0].width);
|
||||
int diff = ABS(id.size - ((int64_t)face->available_sizes[0].width));
|
||||
scale_color_font = float(id.size) / face->available_sizes[0].width;
|
||||
for (int i = 1; i < face->num_fixed_sizes; i++) {
|
||||
int ndiff = ABS(id.size - face->available_sizes[i].width);
|
||||
int ndiff = ABS(id.size - ((int64_t)face->available_sizes[i].width));
|
||||
if (ndiff < diff) {
|
||||
best_match = i;
|
||||
diff = ndiff;
|
||||
|
|
|
@ -36,22 +36,22 @@
|
|||
|
||||
const float Reverb::comb_tunings[MAX_COMBS] = {
|
||||
//freeverb comb tunings
|
||||
0.025306122448979593,
|
||||
0.026938775510204082,
|
||||
0.028956916099773241,
|
||||
0.03074829931972789,
|
||||
0.032244897959183672,
|
||||
0.03380952380952381,
|
||||
0.035306122448979592,
|
||||
0.036666666666666667
|
||||
0.025306122448979593f,
|
||||
0.026938775510204082f,
|
||||
0.028956916099773241f,
|
||||
0.03074829931972789f,
|
||||
0.032244897959183672f,
|
||||
0.03380952380952381f,
|
||||
0.035306122448979592f,
|
||||
0.036666666666666667f
|
||||
};
|
||||
|
||||
const float Reverb::allpass_tunings[MAX_ALLPASS] = {
|
||||
//freeverb allpass tunings
|
||||
0.0051020408163265302,
|
||||
0.007732426303854875,
|
||||
0.01,
|
||||
0.012607709750566893
|
||||
0.0051020408163265302f,
|
||||
0.007732426303854875f,
|
||||
0.01f,
|
||||
0.012607709750566893f
|
||||
};
|
||||
|
||||
void Reverb::process(float *p_src, float *p_dst, int p_frames) {
|
||||
|
|
|
@ -3506,6 +3506,7 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
|
|||
nv.sint = -cn->values[i].sint;
|
||||
} break;
|
||||
case TYPE_UINT: {
|
||||
// FIXME: This can't work on uint
|
||||
nv.uint = -cn->values[i].uint;
|
||||
} break;
|
||||
case TYPE_FLOAT: {
|
||||
|
|
|
@ -689,7 +689,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
|
|||
if (indices.empty()) {
|
||||
|
||||
ERR_EXPLAIN("Bad Polygon!");
|
||||
ERR_FAIL_V();
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
Item::CommandPolygon *polygon = memnew(Item::CommandPolygon);
|
||||
|
|
Loading…
Reference in a new issue