Skip to content

Commit

Permalink
Merge pull request #205 from HiGuyMB/slightly-better-chat
Browse files Browse the repository at this point in the history
Make chat work on lobby and close with esc
  • Loading branch information
HumanGamer authored Mar 10, 2024
2 parents e4be897 + 18de2c0 commit 42d2403
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
13 changes: 12 additions & 1 deletion game/marble/client/scripts/default.bind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
moveMap.delete();
new ActionMap(moveMap);

if ( isObject( LobbyMap ) )
LobbyMap.delete();
new ActionMap(LobbyMap);

$screenShotMode = true;

function screenShotMode()
Expand Down Expand Up @@ -544,7 +548,10 @@ function cycleDebugRenderMode(%val)

function pauseOrEscape()
{
if (isObject(EditorGui) && Canvas.getContent() == EditorGui.getId())
if (newMessageHud.isAwake())
{
Canvas.popDialog(newMessageHud);
} else if (isObject(EditorGui) && Canvas.getContent() == EditorGui.getId())
{
Editor.close("PlayGui");
Canvas.setContent(RootGui);
Expand Down Expand Up @@ -612,6 +619,10 @@ function clearInputs()
GlobalActionMap.bindCmd(keyboard, "ctrl 4", "", "setVideoMode(800,600,32,0);");
GlobalActionMap.bindCmd(keyboard, "alt t", "", "reloadMaterials();");

// LobbyMap:
// keyboard
LobbyMap.bind(keyboard, "t", GlobalChat);

// MoveMap:
// keyboard
moveMap.bind(keyboard, "F8", dropCameraAtPlayer);
Expand Down
6 changes: 6 additions & 0 deletions game/marble/client/scripts/playGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
%this.setPowerUp( "" );
%this.setBlastBar();

if (newMessageHud.isAwake())
{
schedule(10, 0, deactivateKeyboard);
NMH_Type.schedule(10, makeFirstResponder, true);
}

// hack town - pause if system UI is active
if ($Client::SystemUIActive && !GamePauseGui.isAwake() && !$GameEndNoAllowPause)
{
Expand Down
2 changes: 2 additions & 0 deletions game/marble/client/ui/chathud/newChatHud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ function newChatHud_UpdateIndicatorPosition()

function newChatHud_AddLine(%line)
{
echo("CHAT: " @ stripChars(%line, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\cp\co"));

if(!isObject($NewChatSO))
newChatHud_Init();

Expand Down
3 changes: 3 additions & 0 deletions game/marble/client/ui/chathud/newMessageHud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
function newMessageHud::onSleep(%this)
{
commandtoserver('stopTalking');

activateKeyboard();
NMH_Type.makeFirstResponder(false);
}


Expand Down
16 changes: 16 additions & 0 deletions game/marble/client/ui/lobbyGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,27 @@ function LobbyGui::show(%this)
%this.checkDemoTime();
}

function LobbyGui::onWake( %this )
{
LobbyMap.push();

newChatHud.resize(
0,
0,
getWord(RootGui.extent, 0),
getWord(RootGui.extent, 1)
);
RootGui.add(newChatHud);
RootGui.pushToBack(RootCenterCtrl);
}

function LobbyGui::onSleep( %this )
{
// To fix it so if you have this up when game starts it will be an overlay
// on the play GUI -pw
LobbyPopupDlg.hide();
LobbyMap.pop();
RootGui.remove(newChatHud);
}

// set the correct game state if we are out of demo time. return true if we
Expand Down

0 comments on commit 42d2403

Please sign in to comment.