Nice syncing code Sunk

This commit is contained in:
Agent X 2024-12-23 17:23:06 -05:00
parent d6df2ff210
commit 183018cf3c
6 changed files with 8 additions and 6 deletions

View file

@ -204,7 +204,7 @@ NORMAL = "Normal"
TOO_MUCH = "Demasiada"
KNOCKBACK_STRENGTH = "Fuerza de retroceso"
CLASSIC_PVP = "Clásico"
REVAMPED_PVP = "Renovado"
REVAMPED_PVP = "Revisado"
PVP_MODE = "Modo Jugador contra Jugador"
LEAVE_LEVEL = "Salir del nivel"
STAY_IN_LEVEL = "Seguir en el nivel"

View file

@ -170,7 +170,7 @@ bool configMenuDemos = false;
bool configDisablePopups = false;
char configLanguage[MAX_CONFIG_STRING] = "";
bool configDynosLocalPlayerModelOnly = false;
unsigned int configPvpMode = PLAYER_PVP_CLASSIC;
unsigned int configPvpType = PLAYER_PVP_CLASSIC;
// CoopNet settings
char configCoopNetIp[MAX_CONFIG_STRING] = DEFAULT_COOPNET_IP;
unsigned int configCoopNetPort = DEFAULT_COOPNET_PORT;
@ -301,7 +301,7 @@ static const struct ConfigOption options[] = {
{.name = "coop_menu_level", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuLevel},
{.name = "coop_menu_sound", .type = CONFIG_TYPE_UINT, .uintValue = &configMenuSound},
{.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuRandom},
{.name = "player_pvp_mode", .type = CONFIG_TYPE_UINT, .uintValue = &configPvpMode},
{.name = "player_pvp_mode", .type = CONFIG_TYPE_UINT, .uintValue = &configPvpType},
// {.name = "coop_menu_demos", .type = CONFIG_TYPE_BOOL, .boolValue = &configMenuDemos},
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups},
{.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING},

View file

@ -123,7 +123,7 @@ extern bool configMenuDemos;
extern bool configDisablePopups;
extern char configLanguage[MAX_CONFIG_STRING];
extern bool configDynosLocalPlayerModelOnly;
extern unsigned int configPvpMode;
extern unsigned int configPvpType;
// CoopNet settings
extern char configCoopNetIp[MAX_CONFIG_STRING];
extern unsigned int configCoopNetPort;

View file

@ -56,7 +56,7 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) {
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, KNOCKBACK_STRENGTH), kChoices, 3, &sKnockbackIndex, djui_panel_host_settings_knockback_change);
char* pChoices[2] = { DLANG(HOST_SETTINGS, CLASSIC_PVP), DLANG(HOST_SETTINGS, REVAMPED_PVP) };
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &configPvpMode, NULL);
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &configPvpType, NULL);
char* lChoices[3] = { DLANG(HOST_SETTINGS, LEAVE_LEVEL), DLANG(HOST_SETTINGS, STAY_IN_LEVEL), DLANG(HOST_SETTINGS, NONSTOP) };
djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL);

View file

@ -131,7 +131,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
gServerSettings.nametags = configNametags;
gServerSettings.maxPlayers = configAmountofPlayers;
gServerSettings.pauseAnywhere = configPauseAnywhere;
gServerSettings.pvpType = configPvpMode;
gServerSettings.pvpType = configPvpType;
#if defined(RAPI_DUMMY) || defined(WAPI_DUMMY)
gServerSettings.headlessServer = (inNetworkType == NT_SERVER);
#else

View file

@ -125,6 +125,7 @@ void network_send_join(struct Packet* joinRequestPacket) {
packet_write(&p, &gServerSettings.nametags, sizeof(u8));
packet_write(&p, &gServerSettings.maxPlayers, sizeof(u8));
packet_write(&p, &gServerSettings.pauseAnywhere, sizeof(u8));
packet_write(&p, &gServerSettings.pvpType, sizeof(u8));
packet_write(&p, eeprom, sizeof(u8) * 512);
network_send_to(globalIndex, &p);
@ -177,6 +178,7 @@ void network_receive_join(struct Packet* p) {
packet_read(p, &gServerSettings.nametags, sizeof(u8));
packet_read(p, &gServerSettings.maxPlayers, sizeof(u8));
packet_read(p, &gServerSettings.pauseAnywhere, sizeof(u8));
packet_read(p, &gServerSettings.pvpType, sizeof(u8));
packet_read(p, eeprom, sizeof(u8) * 512);
network_player_connected(NPT_SERVER, 0, 0, &DEFAULT_MARIO_PALETTE, "Player", "0");