summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp2
-rw-r--r--core/io/file_access_pack.cpp2
-rw-r--r--core/io/multiplayer_api.cpp16
-rw-r--r--core/os/main_loop.h28
-rw-r--r--core/os/midi_driver.cpp5
-rw-r--r--core/script_language.h2
-rw-r--r--core/typedefs.h6
7 files changed, 37 insertions, 24 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index e7ddbc690f..67de156fc3 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -792,7 +792,7 @@ Dictionary _OS::get_datetime_from_unix_time(int64_t unix_time_val) const {
size_t imonth = 0;
- while (dayno >= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth]) {
+ while ((unsigned long)dayno >= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth]) {
dayno -= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth];
imonth++;
}
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index c97b8cafac..d38d09c6bb 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -272,7 +272,7 @@ int FileAccessPack::get_buffer(uint8_t *p_dst, int p_length) const {
if (eof)
return 0;
- int64_t to_read = p_length;
+ uint64_t to_read = p_length;
if (to_read + pos > pf.size) {
eof = true;
to_read = int64_t(pf.size) - int64_t(pos);
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 99aa1cca80..22530ad721 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -64,7 +64,7 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
return false;
}
-_FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, int p_remote_id) {
+_FORCE_INLINE_ bool _can_call_mode(MultiplayerAPI::RPCMode mode, int p_node_master, int p_remote_id) {
switch (mode) {
case MultiplayerAPI::RPC_MODE_DISABLED: {
@@ -76,11 +76,11 @@ _FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, i
} break;
case MultiplayerAPI::RPC_MODE_MASTERSYNC:
case MultiplayerAPI::RPC_MODE_MASTER: {
- return p_node->is_network_master();
+ return p_node_master == NetworkedMultiplayerPeer::TARGET_PEER_SERVER;
} break;
case MultiplayerAPI::RPC_MODE_PUPPETSYNC:
case MultiplayerAPI::RPC_MODE_PUPPET: {
- return !p_node->is_network_master() && p_remote_id == p_node->get_network_master();
+ return p_node_master != NetworkedMultiplayerPeer::TARGET_PEER_SERVER && p_remote_id == p_node_master;
} break;
}
@@ -282,8 +282,9 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_name);
}
- ERR_EXPLAIN("RPC '" + String(p_name) + "' is not allowed from: " + itos(p_from) + ". Mode is " + itos((int)rpc_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
- ERR_FAIL_COND(!_can_call_mode(p_node, rpc_mode, p_from));
+ int node_master_id = p_node->get_network_master();
+ ERR_EXPLAIN("RPC '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rpc_mode) + ", master is " + itos(node_master_id) + ".");
+ ERR_FAIL_COND(!_can_call_mode(rpc_mode, p_from, node_master_id));
int argc = p_packet[p_offset];
Vector<Variant> args;
@@ -331,8 +332,9 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
rset_mode = p_node->get_script_instance()->get_rset_mode(p_name);
}
- ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(p_node->get_network_master()) + ".");
- ERR_FAIL_COND(!_can_call_mode(p_node, rset_mode, p_from));
+ int node_master_id = p_node->get_network_master();
+ ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(node_master_id) + ".");
+ ERR_FAIL_COND(!_can_call_mode(rset_mode, p_from, node_master_id));
Variant value;
Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed());
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index bfdf92acfa..ad734d3fc8 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -51,21 +51,19 @@ protected:
public:
enum {
- NOTIFICATION_WM_MOUSE_ENTER = 2,
- NOTIFICATION_WM_MOUSE_EXIT = 3,
- NOTIFICATION_WM_FOCUS_IN = 4,
- NOTIFICATION_WM_FOCUS_OUT = 5,
- NOTIFICATION_WM_QUIT_REQUEST = 6,
- NOTIFICATION_WM_GO_BACK_REQUEST = 7,
- NOTIFICATION_WM_UNFOCUS_REQUEST = 8,
- NOTIFICATION_OS_MEMORY_WARNING = 9,
- // Note: NOTIFICATION_TRANSLATION_CHANGED and NOTIFICATION_WM_ABOUT used to have id=10 and id=11 but these
- // conflict with NOTIFICATION_ENTER_TREE (id=10) and NOTIFICATION_EXIT_TREE (id=11), so id=90 and id=91
- // fixes this issue.
- NOTIFICATION_TRANSLATION_CHANGED = 90,
- NOTIFICATION_WM_ABOUT = 91,
- NOTIFICATION_CRASH = 92,
- NOTIFICATION_OS_IME_UPDATE = 93,
+ //make sure these are replicated in Node
+ NOTIFICATION_WM_MOUSE_ENTER = 1002,
+ NOTIFICATION_WM_MOUSE_EXIT = 1003,
+ NOTIFICATION_WM_FOCUS_IN = 1004,
+ NOTIFICATION_WM_FOCUS_OUT = 1005,
+ NOTIFICATION_WM_QUIT_REQUEST = 1006,
+ NOTIFICATION_WM_GO_BACK_REQUEST = 1007,
+ NOTIFICATION_WM_UNFOCUS_REQUEST = 1008,
+ NOTIFICATION_OS_MEMORY_WARNING = 1009,
+ NOTIFICATION_TRANSLATION_CHANGED = 1010,
+ NOTIFICATION_WM_ABOUT = 1011,
+ NOTIFICATION_CRASH = 1012,
+ NOTIFICATION_OS_IME_UPDATE = 1013,
};
virtual void input_event(const Ref<InputEvent> &p_event);
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index 0d7ad23d68..7cb7ae130f 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -75,6 +75,11 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
if (length >= 3) {
event->set_pitch(data[1]);
event->set_velocity(data[2]);
+
+ if (event->get_message() == MIDI_MESSAGE_NOTE_ON && event->get_velocity() == 0) {
+ // https://www.midi.org/forum/228-writing-midi-software-send-note-off,-or-zero-velocity-note-on
+ event->set_message(MIDI_MESSAGE_NOTE_OFF);
+ }
}
break;
diff --git a/core/script_language.h b/core/script_language.h
index b6d7bea9c7..005e21e2cc 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -205,6 +205,8 @@ public:
static ScriptCodeCompletionCache *get_singleton() { return singleton; }
ScriptCodeCompletionCache();
+
+ virtual ~ScriptCodeCompletionCache() {}
};
class ScriptLanguage {
diff --git a/core/typedefs.h b/core/typedefs.h
index 78688ff311..a3d7314b1c 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -328,4 +328,10 @@ struct _GlobalLock {
#define _PRINTF_FORMAT_ATTRIBUTE_2_3
#endif
+/** This is needed due to a strange OpenGL API that expects a pointer
+ * type for an argument that is actually an offset.
+ */
+
+#define CAST_INT_TO_UCHAR_PTR(ptr) ((uint8_t *)(uintptr_t)(ptr))
+
#endif // TYPEDEFS_H