mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Replaced old host/join menu with new DJUI menu system
This commit is contained in:
parent
733217a07a
commit
13d504a953
12 changed files with 53 additions and 25 deletions
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
#make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here'
|
||||
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run --server 27015 --configfile sm64config_server.txt'
|
||||
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here'
|
||||
#make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run --server 27015 --configfile sm64config_server.txt'
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#ifdef IMMEDIATELOAD
|
||||
#include "levels/menu/header.h"
|
||||
#include "levels/scripts.h"
|
||||
#else
|
||||
#include "levels/intro/header.h"
|
||||
#endif
|
||||
|
@ -12,15 +13,14 @@
|
|||
#include "make_const_nonconst.h"
|
||||
|
||||
const LevelScript level_script_entry[] = {
|
||||
INIT_LEVEL(),
|
||||
SLEEP(/*frames*/ 2),
|
||||
BLACKOUT(/*active*/ FALSE),
|
||||
SET_REG(/*value*/ 0),
|
||||
#ifdef IMMEDIATELOAD
|
||||
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_main_menu_entry_1),
|
||||
JUMP(/*target*/ level_main_menu_entry_1),
|
||||
#else
|
||||
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_entry_1),
|
||||
JUMP(/*target*/ level_script_entry),
|
||||
#endif
|
||||
SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS),
|
||||
JUMP(/*target*/ level_main_scripts_entry),
|
||||
|
||||
// old behavior (intro)
|
||||
//INIT_LEVEL(),
|
||||
//SLEEP(/*frames*/ 2),
|
||||
//BLACKOUT(/*active*/ FALSE),
|
||||
//SET_REG(/*value*/ 0),
|
||||
//EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_entry_1),
|
||||
//JUMP(/*target*/ level_script_entry),
|
||||
};
|
||||
|
|
|
@ -1867,7 +1867,7 @@ s32 execute_mario_action(UNUSED struct Object *o) {
|
|||
s32 inLoop = TRUE;
|
||||
// hide inactive players
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[gMarioState->playerIndex];
|
||||
if (np->type != NPT_LOCAL) {
|
||||
if (gMarioState->playerIndex != 0) {
|
||||
bool levelAreaMismatch =
|
||||
(np->currCourseNum != gCurrCourseNum
|
||||
|| np->currActNum != gCurrActNum
|
||||
|
|
|
@ -514,6 +514,8 @@ s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) {
|
|||
}
|
||||
|
||||
u8 is_player_active(struct MarioState* m) {
|
||||
if (gNetworkType == NT_NONE && m == &gMarioStates[0]) { return TRUE; }
|
||||
|
||||
if (m->action == ACT_BUBBLED) { return FALSE; }
|
||||
struct NetworkPlayer* np = &gNetworkPlayers[m->playerIndex];
|
||||
if (np->type != NPT_LOCAL) {
|
||||
|
|
|
@ -199,7 +199,7 @@ void unload_object(struct Object *obj) {
|
|||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_CYLBOARD;
|
||||
obj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
|
||||
if (obj->oSyncID != 0) {
|
||||
if (obj->oSyncID != 0 && gNetworkType != NT_NONE) {
|
||||
if (gSyncObjects[obj->oSyncID].syncDeathEvent) {
|
||||
network_send_object(obj);
|
||||
} else {
|
||||
|
|
|
@ -129,5 +129,6 @@ void djui_panel_shutdown(void) {
|
|||
sPanelList = NULL;
|
||||
sPanelRemoving = NULL;
|
||||
sMoveAmount = 0;
|
||||
|
||||
gInteractableOverridePad = false;
|
||||
djui_cursor_set_visible(false);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include "djui.h"
|
||||
#include "src/pc/network/network.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
|
@ -18,6 +19,23 @@ Direct connections \\#ffa0a0\\require you\\#c8c8c8\\ to configure port forwardin
|
|||
Forward port '\\#d0d0ff\\%d\\#c8c8c8\\' for UDP.\
|
||||
";
|
||||
|
||||
void djui_panel_host_message_do_host(struct DjuiBase* caller) {
|
||||
djui_panel_shutdown();
|
||||
#ifndef DISCORD_SDK
|
||||
configNetworkSystem = 1;
|
||||
network_set_system(NS_SOCKET);
|
||||
#else
|
||||
if (configNetworkSystem == 0) {
|
||||
network_set_system(NS_DISCORD);
|
||||
} else {
|
||||
network_set_system(NS_SOCKET);
|
||||
}
|
||||
#endif
|
||||
network_init(NT_SERVER);
|
||||
extern s16 gChangeLevel;
|
||||
gChangeLevel = 16;
|
||||
}
|
||||
|
||||
void djui_panel_host_message_create(struct DjuiBase* caller) {
|
||||
f32 warningLines = 0;
|
||||
char* warningMessage = NULL;
|
||||
|
@ -62,7 +80,7 @@ void djui_panel_host_message_create(struct DjuiBase* caller) {
|
|||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_menu_back);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_host_message_do_host);
|
||||
defaultBase = &button2->base;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/network/network.h"
|
||||
#include "src/pc/utils/misc.h"
|
||||
#include "src/pc/configfile.h"
|
||||
|
||||
|
@ -14,6 +15,12 @@ static char* sJoiningDirect = "\
|
|||
Enter \\#d0d0ff\\direct connection\\#c8c8c8\\ IP and port:\
|
||||
";
|
||||
|
||||
void djui_panel_join_do_join(struct DjuiBase* caller) {
|
||||
djui_panel_shutdown();
|
||||
network_set_system(NS_SOCKET);
|
||||
network_init(NT_CLIENT);
|
||||
}
|
||||
|
||||
void djui_panel_join_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 2 + 32 + 16 * 2 + 64;
|
||||
|
||||
|
@ -69,7 +76,7 @@ void djui_panel_join_create(struct DjuiBase* caller) {
|
|||
djui_base_set_size_type(&button2->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&button2->base, 0.485f, 64);
|
||||
djui_base_set_alignment(&button2->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_menu_back);
|
||||
djui_interactable_hook_click(&button2->base, djui_panel_join_do_join);
|
||||
defaultBase = &button2->base;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
#include "djui.h"
|
||||
#include "src/pc/controller/controller_sdl.h"
|
||||
|
||||
static void djui_panel_main_close(struct DjuiBase* caller) {
|
||||
gInteractableOverridePad = false;
|
||||
djui_panel_shutdown();
|
||||
djui_cursor_set_visible(false);
|
||||
}
|
||||
|
||||
void djui_panel_main_create(struct DjuiBase* caller) {
|
||||
f32 bodyHeight = 64 * 4 + 16 * 3;
|
||||
|
||||
|
|
|
@ -152,5 +152,7 @@ void network_receive_join(struct Packet* p) {
|
|||
network_player_connected(NPT_LOCAL, myGlobalIndex);
|
||||
|
||||
save_file_load_all(TRUE);
|
||||
//custom_menu_goto_game(gCurrSaveFileNum);
|
||||
|
||||
extern s16 gChangeLevel;
|
||||
gChangeLevel = 16;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,8 @@ static u16 get_spawn_info_index_of_object(struct Object* o) {
|
|||
////
|
||||
|
||||
void network_send_level_respawn_info(struct Object* o, u8 respawnInfoBits) {
|
||||
if (gNetworkType == NT_NONE) { return; }
|
||||
|
||||
// make sure our area is valid
|
||||
if (!gNetworkPlayerLocal->currAreaSyncValid) {
|
||||
LOG_ERROR("my area is invalid");
|
||||
|
|
|
@ -383,6 +383,8 @@ static void packet_read_object_only_death(struct Packet* p, struct Object* o) {
|
|||
// ----- main send/receive ----- //
|
||||
|
||||
void network_send_object(struct Object* o) {
|
||||
if (gNetworkType == NT_NONE) { return; }
|
||||
|
||||
// sanity check SyncObject
|
||||
if (!network_sync_object_initialized(o)) { return; }
|
||||
if (o->behavior == bhvRespawner) { return; }
|
||||
|
|
Loading…
Reference in a new issue