mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Merge branch 'coop' of github.com:sm64ex-coop-dev/sm64ex-coop into coop
This commit is contained in:
commit
a8b94fd225
5 changed files with 17 additions and 4 deletions
|
|
@ -45,7 +45,7 @@ void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alloc and init the actors gfx list
|
// Alloc and init the actors gfx list
|
||||||
ActorGfx actorGfx = { 0 };
|
ActorGfx actorGfx = { };
|
||||||
actorGfx.mGfxData = _GfxData;
|
actorGfx.mGfxData = _GfxData;
|
||||||
actorGfx.mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(geoLayout, false);
|
actorGfx.mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(geoLayout, false);
|
||||||
actorGfx.mPackIndex = MOD_PACK_INDEX;
|
actorGfx.mPackIndex = MOD_PACK_INDEX;
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,10 @@ bool network_allow_unknown_local_index(enum PacketType packetType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_send_to(u8 localIndex, struct Packet* p) {
|
void network_send_to(u8 localIndex, struct Packet* p) {
|
||||||
|
if (p == NULL) {
|
||||||
|
LOG_ERROR("no data to send");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// sanity checks
|
// sanity checks
|
||||||
if (gNetworkType == NT_NONE) { LOG_ERROR("network type error none!"); return; }
|
if (gNetworkType == NT_NONE) { LOG_ERROR("network type error none!"); return; }
|
||||||
if (p->error) { LOG_ERROR("packet error!"); return; }
|
if (p->error) { LOG_ERROR("packet error!"); return; }
|
||||||
|
|
@ -272,6 +276,10 @@ void network_send_to(u8 localIndex, struct Packet* p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_send(struct Packet* p) {
|
void network_send(struct Packet* p) {
|
||||||
|
if (p == NULL) {
|
||||||
|
LOG_ERROR("no data to send");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// prevent errors during writing from propagating
|
// prevent errors during writing from propagating
|
||||||
if (p->writeError) {
|
if (p->writeError) {
|
||||||
LOG_ERROR("packet has write error: %u", p->packetType);
|
LOG_ERROR("packet has write error: %u", p->packetType);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void packet_process(struct Packet* p) {
|
||||||
case PACKET_CHAT: network_receive_chat(p); break;
|
case PACKET_CHAT: network_receive_chat(p); break;
|
||||||
case PACKET_KICK: network_receive_kick(p); break;
|
case PACKET_KICK: network_receive_kick(p); break;
|
||||||
case PACKET_COMMAND: network_recieve_chat_command(p); break;
|
case PACKET_COMMAND: network_recieve_chat_command(p); break;
|
||||||
case PACKET_MODERATOR: network_recieve_moderator(); break;
|
case PACKET_MODERATOR: network_recieve_moderator(p); break;
|
||||||
case PACKET_KEEP_ALIVE: network_receive_keep_alive(p); break;
|
case PACKET_KEEP_ALIVE: network_receive_keep_alive(p); break;
|
||||||
case PACKET_LEAVING: network_receive_leaving(p); break;
|
case PACKET_LEAVING: network_receive_leaving(p); break;
|
||||||
case PACKET_SAVE_FILE: network_receive_save_file(p); break;
|
case PACKET_SAVE_FILE: network_receive_save_file(p); break;
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ void network_recieve_chat_command(struct Packet* p);
|
||||||
|
|
||||||
// packet_moderator.c
|
// packet_moderator.c
|
||||||
void network_send_moderator(u8 localIndex);
|
void network_send_moderator(u8 localIndex);
|
||||||
void network_recieve_moderator(void);
|
void network_recieve_moderator(struct Packet* p);
|
||||||
|
|
||||||
// packet_keep_alive.c
|
// packet_keep_alive.c
|
||||||
void network_send_keep_alive(u8 localIndex);
|
void network_send_keep_alive(u8 localIndex);
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,15 @@ void network_send_moderator(u8 localIndex) {
|
||||||
network_send_to(localIndex, &p);
|
network_send_to(localIndex, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_recieve_moderator(void) {
|
void network_recieve_moderator(struct Packet* p) {
|
||||||
if (gIsModerator == 1) {
|
if (gIsModerator == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (network_player_any_connected() && gNetworkPlayers[p->localIndex].type != NPT_SERVER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gIsModerator = 1;
|
gIsModerator = 1;
|
||||||
djui_chat_message_create("\\#fff982\\You are now a Moderator.");
|
djui_chat_message_create("\\#fff982\\You are now a Moderator.");
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue