Skip to content

Commit

Permalink
Merge pull request #10 from ravimohan1991/diamond-multi-dev
Browse files Browse the repository at this point in the history
Diamond multi dev merge to main
  • Loading branch information
ravimohan1991 committed May 21, 2023
2 parents 5e75185 + 1dda53b commit ab5144b
Show file tree
Hide file tree
Showing 59 changed files with 25,537 additions and 42,471 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -4,7 +4,10 @@ chatdiamond.log
*.out
chatdiamond.pdf
chatdiamond.synctex.gz
chatdiamond.toc

# UTNativeEssentials
ChatDiamondBin
UTNativeLightHouse
UTNativeLightHouse

build-UTNativeEssentials-Desktop_Qt_6_3_0_GCC_64bit-Debug
2 changes: 2 additions & 0 deletions Classes/CDAboutWindow.uc
Expand Up @@ -20,6 +20,8 @@
* (https://ut99.org/viewtopic.php?f=7&t=14356)
* November, 2022: Transitioning from UTChat to ChatDiamond
* (https://ut99.org/viewtopic.php?f=7&t=14356&start=30#p139510)
* December, 2022: Native experiments
* April, 2023: Native - scripting hybrid progress
*/

//==============================================================================
Expand Down
150 changes: 81 additions & 69 deletions Classes/CDChatWindowChat.uc
Expand Up @@ -20,6 +20,8 @@
* (https://ut99.org/viewtopic.php?f=7&t=14356)
* November, 2022: Transitioning from UTChat to ChatDiamond
* (https://ut99.org/viewtopic.php?f=7&t=14356&start=30#p139510)
* December, 2022: Native experiments
* April, 2023: Native - scripting hybrid progress
*/

//==============================================================================
Expand All @@ -34,11 +36,11 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
// "the central or most important part of something."
#exec AUDIO IMPORT FILE="Sounds\telegram.wav" NAME=MessageKernel GROUP="Sound"

var() config string ChatLog[200];
var() config string IgnorableStrings[40];

var() config bool bIgnoreMessageFilter;
var() config bool bUserWantsMessageSound;

var config bool bUserWantsMessageSound;

var UMenuLabelControl lblHeading;
var CDUTChatTextTextureAnimEmoteArea TheTextArea;
Expand Down Expand Up @@ -85,7 +87,6 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);

function Created ()
{

Super.Created();

CDGRI = Root.GetPlayerOwner().GameReplicationInfo;
Expand Down Expand Up @@ -159,7 +160,7 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
if (sMesg != "")
{
TheTextArea.AddText(sMesg);
CacheMessage(sMesg);
CDDA.CacheChatLine(sMesg);
ButSave.bDisabled = false;
if(bTalkMessage && bUserWantsMessageSound)
{
Expand All @@ -169,9 +170,9 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
else
{
TheTextArea.Clear();
for (i = 0; i < 200; i++)
for (i = FrameWindow.LastHistoricMessagesNumber; i > 0; i--)
{
sTemp = ChatLog[i];
sTemp = CDDA.GetLineFromCacheBottom(i);
if (i > 0 && sTemp == "")
{
break;
Expand Down Expand Up @@ -259,32 +260,40 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
SkinName = "Dummy";
}
CDDA.ResetJsonContainer();
CDDA.AddJsonKeyValue("FaceName", FaceName);
CDDA.AddJsonKeyValue("SkinName", SkinName);
CDDA.AddJsonKeyValue("LocalTime", LocalTimeAndMPOVMarker());
CDDA.AddJsonKeyValue("PlayerName", PRI.PlayerName);
CDDA.AddJsonKeyValue("ChatMessage", Message);

if(PRI.bAdmin)
{
LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker("+") $ " " $ PRI.PlayerName $ ": " $ Message, true);
CDDA.AddJsonKeyValue("Team", "Admin");
}
else if(PRI.Team == 0)
{
LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker("<") $ " " $ PRI.PlayerName $ ": " $ Message, true);
CDDA.AddJsonKeyValue("Team", "Red");
}
else if(PRI.Team == 1)
{
LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker(">") $ " " $ PRI.PlayerName $ ": " $ Message, true);
CDDA.AddJsonKeyValue("Team", "Blue");
}
else // for 4-way I need to think
{
LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker("-") $ " " $ PRI.PlayerName $ ": " $ Message, true);
CDDA.AddJsonKeyValue("Team", "Unknowm");
}

LoadMessages(CDDA.SerializeJson(), true);
CDDA.ResetJsonContainer();
}
else
{

}

if(PRI != none && PRI.bIsSpectator)
if(PRI != none)
{
Log(" Message to spectator: " @ Message @ PRI.PLayerName @ MessageType);
// Maybe exhaustive.
// Well, player join leave and server adds and whatnot. So we shall use
// our filter. Spectators' message is of the form
Expand All @@ -305,8 +314,16 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
SkinName = "Dummy";
}

LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker("-") $ " " $ DisplayableSpectatorMessage, true);//PrepareSpectatorMessageForDisplay(Message));
CDDA.ResetJsonContainer();
CDDA.AddJsonKeyValue("FaceName", FaceName);
CDDA.AddJsonKeyValue("SkinName", SkinName);
CDDA.AddJsonKeyValue("LocalTime", LocalTimeAndMPOVMarker());
CDDA.AddJsonKeyValue("PlayerName", PRI.PlayerName);
CDDA.AddJsonKeyValue("ChatMessage", DisplayableSpectatorMessage);
CDDA.AddJsonKeyValue("Team", "Spectator");

LoadMessages(CDDA.SerializeJson(), true);
CDDA.ResetJsonContainer();
}
else
{
Expand All @@ -318,36 +335,40 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
break;
}
return;
}

Log("Inside interpreattion of messages when sendername is not local player: " $ Message @ PRI.PLayerName @ MessageType);
// Ok the message may be of the case
// (somespectator name):hola
// SomeDifferentPRI seems like spectator pri
if(SomeDifferentPRI != none)
{
Log("Some spectator on multiplay has responded. " $ SomeDifferentPRI.PlayerName);

DisplayableSpectatorMessage = PrepareSpectatorMessageForDisplay(Message, SpectatorLPRI);
DisplayableSpectatorMessage = PrepareSpectatorMessageForDisplay(Message, SpectatorLPRI);

Log("SomeDifferentPRI is: " @ SomeDifferentPRI.PlayerName @ " SpectatorLPRI detected is: " @ SpectatorLPRI.PlayerName);
LP = Pawn(SpectatorLPRI.Owner);
LP.GetMultiSkin(LP, SkinName, FaceName);

LP = Pawn(SpectatorLPRI.Owner);
if(FaceName == "")
{
FaceName = "Dummy";
}

LP.GetMultiSkin(LP, SkinName, FaceName);
if(SkinName == "")
{
SkinName = "Dummy";
}

if(FaceName == "")
{
FaceName = "Dummy";
}
CDDA.ResetJsonContainer();
CDDA.AddJsonKeyValue("FaceName", FaceName);
CDDA.AddJsonKeyValue("SkinName", SkinName);
CDDA.AddJsonKeyValue("LocalTime", LocalTimeAndMPOVMarker());
CDDA.AddJsonKeyValue("PlayerName", PRI.PlayerName);
CDDA.AddJsonKeyValue("ChatMessage", DisplayableSpectatorMessage);
CDDA.AddJsonKeyValue("Team", "Spectator");

if(SkinName == "")
{
SkinName = "Dummy";
}

LoadMessages(FaceName $ ":" $ SkinName $ "::" $ LocalTimeAndMPOVMarker("-") $ " " $ DisplayableSpectatorMessage, true);
LoadMessages(CDDA.SerializeJson(), true);
CDDA.ResetJsonContainer();
}
}
}
Expand Down Expand Up @@ -380,7 +401,7 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
}
}

return SpectatorName $ ": " $ TempoString;
return TempoString;
}

function string FilterSenderName(coerce string Message)
Expand Down Expand Up @@ -455,22 +476,10 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
/*******************************************************************************
* Routine for modifying the console message as per our interpretation
* and encode the deliminators accordingly
*
* @PARAM Message The actual message
* @PARAM CategoryDeliminator Categories are like so
* 1. - for neutral spectator (white color)
* 2. < for red team category
* 3. > for blue team category
* 4. = for green color (could be 4 way team)
* 5. + for golden color (could be 4 way team). Admin
* for now.
*
* @also see CDUTChatTextTextureAnimEmoteArea::DrawTextTextureLine
*
*******************************************************************************
*/

function string LocalTimeAndMPOVMarker(string CategoryDeliminator)
function string LocalTimeAndMPOVMarker()
{
local string Mon, Day, Min, Hour;
local PlayerPawn PlayerOwner;
Expand Down Expand Up @@ -516,21 +525,7 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
Hour = string(PlayerOwner.Level.Hour);
}

return Day @ PlayerOwner.Level.Day @ Mon @ PlayerOwner.Level.Year @ CategoryDeliminator @ Hour $ ":" $ Min;
}
function CacheMessage(string sMesg)
{
local int i;
for(i = 0; i < 200; i++)
{
if(ChatLog[i] == "")
{
ChatLog[i] = sMesg;
break;
}
}
return Day @ PlayerOwner.Level.Day @ Mon @ PlayerOwner.Level.Year @ Hour $ ":" $ Min;
}
function SetChatTextStatus(string Text)
Expand Down Expand Up @@ -648,9 +643,9 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
}
else
{
GetPlayerOwner().PreClientTravel();
GetPlayerOwner().ClientTravel("?OverrideClass=Botpack.CHSpectator", TRAVEL_Relative, False);
ButtonPlaySpectate.SetText("Play");
GetPlayerOwner().PreClientTravel();
GetPlayerOwner().ClientTravel("?OverrideClass=Botpack.CHSpectator", TRAVEL_Relative, False);
ButtonPlaySpectate.SetText("Play");
}

break;
Expand Down Expand Up @@ -692,7 +687,7 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
if(Root.GetPlayerOwner().GameReplicationInfo != CDGRI)
{
CDGRI = Root.GetPlayerOwner().GameReplicationInfo;
TemporaryServerName = GenerateServerName();
TemporaryServerName = GenerateServerName();

if(TemporaryServerName != "" && TemporaryServerName != "Another UT Server")// ye I don't know what you are doing playing on such server anyways
{
Expand All @@ -701,7 +696,12 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
VSRP.CDServerName = TemporaryServerName;
VSRP.CDMD5Hash = TemporaryServerHash;
LoadMessages(VSRP.CDServerName);
class'CDDiscordActor'.static.ResetJsonContainer();
class'CDDiscordActor'.static.AddJsonKeyValue("ServerName", VSRP.CDServerName);
class'CDDiscordActor'.static.AddJsonKeyValue("LocalTime", LocalTimeAndMPOVMarker());
class'CDDiscordActor'.static.AddJsonKeyValue("ServerAddress", Root.GetPlayerOwner().Level.GetAddressURL());
LoadMessages(class'CDDiscordActor'.static.SerializeJson());
class'CDDiscordActor'.static.ResetJsonContainer();
}
}
}
Expand All @@ -722,6 +722,20 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
Super.Resized();
Resize();

TheTextArea.EmoSizeMultiplier = FrameWindow.EmoSize;
TheTextArea.TickCounterWarpNumber = (int(FrameWindow.EmoteAnimSpeed) / 24);
TheTextArea.AnimShockEmote.TexChatSizeFraction = 0.08 * FrameWindow.EmoSize;
TheTextArea.AnimTrashTalkEmote.TexChatSizeFraction = 0.08 * FrameWindow.EmoSize;
}

function ChatConfigurationUpdated()
{
TheTextArea.EmoSizeMultiplier = FrameWindow.EmoSize;
TheTextArea.TickCounterWarpNumber = (int(FrameWindow.EmoteAnimSpeed) / 24);
TheTextArea.AnimShockEmote.TexChatSizeFraction = 0.08 * FrameWindow.EmoSize;
TheTextArea.AnimTrashTalkEmote.TexChatSizeFraction = 0.08 * FrameWindow.EmoSize;
LoadMessages();
}

function Resize()
Expand Down Expand Up @@ -764,20 +778,19 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
{
// local Texture SomeTextureImportedNatively;

Super.Paint(C,MouseX,MouseY);
Super.Paint(C, MouseX, MouseY);

// SomeTextureImportedNatively = CDDA.LoadTextureFromFileOnTheRun("hmm"); //class'CDDiscordActor'.static.LoadTextureFromFileOnTheRun("hmm");

if(FrameWindow.bApplyBGToChatWindow)
{
C.DrawColor = FrameWindow.BackGroundColor;
DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BackgroundGradation');
DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BackgroundGradation');
}
else
{
DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BlackTexture');
}
C.Style = GetPlayerOwner().ERenderStyle.STY_Normal;
}

function Close(optional bool bByParent)
Expand All @@ -789,7 +802,6 @@ class CDChatWindowChat extends UWindowPageWindow config (ChatDiamond);
// How about all the talk messages on ignore list?
defaultproperties
{
bUserWantsMessageSound=true
SilColor=(R=180,G=180,B=180)
GrnColor=(R=0,G=255,B=32)
TxtColor=(R=255,G=255,B=255,A=0)
Expand Down
15 changes: 8 additions & 7 deletions Classes/CDChatWindowEmojis.uc
Expand Up @@ -20,6 +20,8 @@
* (https://ut99.org/viewtopic.php?f=7&t=14356)
* November, 2022: Transitioning from UTChat to ChatDiamond
* (https://ut99.org/viewtopic.php?f=7&t=14356&start=30#p139510)
* December, 2022: Native experiments
* April, 2023: Native - scripting hybrid progress
*/

//================================================================================
Expand Down Expand Up @@ -220,8 +222,8 @@ class CDChatWindowEmojis extends UWindowPageWindow;
Root.QuitGame();
break;

// Courtsey ProAsm's UTCmds8
case ButtonPlaySpectate:
// Courtsey ProAsm's UTCmds8
case ButtonPlaySpectate:
if(GetPlayerOwner().PlayerReplicationInfo.bIsSpectator)
{
GetPlayerOwner().PreClientTravel();
Expand All @@ -230,13 +232,12 @@ class CDChatWindowEmojis extends UWindowPageWindow;
}
else
{
GetPlayerOwner().PreClientTravel();
GetPlayerOwner().ClientTravel("?OverrideClass=Botpack.CHSpectator", TRAVEL_Relative, False);
ButtonPlaySpectate.SetText("Play");
GetPlayerOwner().PreClientTravel();
GetPlayerOwner().ClientTravel("?OverrideClass=Botpack.CHSpectator", TRAVEL_Relative, False);
ButtonPlaySpectate.SetText("Play");
}

break;
}
}
break;
case 7:
ChatWindow.SendMessage(EditMesg);
Expand Down
1 change: 1 addition & 0 deletions Classes/CDChatWindowHelperContextMenu.uc
Expand Up @@ -21,6 +21,7 @@
* November, 2022: Transitioning from UTChat to ChatDiamond
* (https://ut99.org/viewtopic.php?f=7&t=14356&start=30#p139510)
* December, 2022: Native experiments
* April, 2023: Native - scripting hybrid progress
*/

class CDChatWindowHelperContextMenu expands UWindowRightClickMenu;
Expand Down

0 comments on commit ab5144b

Please sign in to comment.