• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).


Commit MetaInfo

Revision1c2a632122c18e88cb59bc1b582093ca37daefca (tree)
Time2021-09-21 22:25:50
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Cleaned up and moved the code responsible for drawing the MOTD, and fixed the MOTD not using the color to print mid-screen messages with.

Change Summary

Incremental Difference

diff -r 16625849dbee -r 1c2a632122c1 src/c_console.cpp
--- a/src/c_console.cpp Wed Sep 22 23:05:13 2021 +1000
+++ b/src/c_console.cpp Tue Sep 21 09:25:50 2021 -0400
@@ -2277,6 +2277,28 @@
22772277 }
22782278 }
22792279
2280+// [AK] Prints the MOTD in the centre of the screen.
2281+void C_MOTDPrint (FString msg)
2282+{
2283+ if (msg.Len( ) <= 0)
2284+ return;
2285+
2286+ FString ConsoleString;
2287+ ConsoleString.Format ("%s\n%s\n%s\n", bar1, msg, bar3);
2288+
2289+ // Add this message to the console window.
2290+ AddToConsole (-1, ConsoleString);
2291+
2292+ // We cannot create the message if there's no status bar to attach it to.
2293+ if (StatusBar == NULL)
2294+ return;
2295+
2296+ // [AK] Print the MOTD in the same color the user wishes to print mid-screen messages in.
2297+ EColorRange Color = static_cast<EColorRange> (PrintColors[PRINTLEVELS]);
2298+ DHUDMessageFadeOut* pMsg = new DHUDMessageFadeOut (SmallFont, msg, 1.5f, 0.375f, 0, 0, Color, cl_motdtime, 0.35f);
2299+ StatusBar->AttachMessage (pMsg, MAKE_ID('M','O','T','D'));
2300+}
2301+
22802302 /****** Tab completion code ******/
22812303
22822304 struct TabData
diff -r 16625849dbee -r 1c2a632122c1 src/c_console.h
--- a/src/c_console.h Wed Sep 22 23:05:13 2021 +1000
+++ b/src/c_console.h Tue Sep 21 09:25:50 2021 -0400
@@ -84,6 +84,7 @@
8484 class FFont;
8585 void C_MidPrint (FFont *font, const char *message);
8686 void C_MidPrintBold (FFont *font, const char *message);
87+void C_MOTDPrint (FString message); // [AK]
8788
8889 bool C_Responder (event_t *ev);
8990
diff -r 16625849dbee -r 1c2a632122c1 src/cl_main.cpp
--- a/src/cl_main.cpp Wed Sep 22 23:05:13 2021 +1000
+++ b/src/cl_main.cpp Tue Sep 21 09:25:50 2021 -0400
@@ -2801,46 +2801,6 @@
28012801
28022802 //*****************************************************************************
28032803 //
2804-// :(. This is needed so that the MOTD can be printed in the color the user wishes to print
2805-// mid-screen messages in.
2806-extern int PrintColors[7];
2807-void CLIENT_DisplayMOTD( void )
2808-{
2809- FString ConsoleString;
2810-
2811- if ( g_MOTD.Len( ) <= 0 )
2812- return;
2813-
2814- // Add pretty colors/formatting!
2815- V_ColorizeString( g_MOTD );
2816-
2817- ConsoleString.AppendFormat( TEXTCOLOR_RED
2818- "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
2819- "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_TAN
2820- "\n\n%s\n" TEXTCOLOR_RED
2821- "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
2822- "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n\n" ,
2823- g_MOTD.GetChars() );
2824-
2825- // Add this message to the console window.
2826- AddToConsole( -1, ConsoleString );
2827-
2828- // We cannot create the message if there's no status bar to attach it to.
2829- if ( StatusBar == NULL )
2830- return;
2831-
2832- StatusBar->AttachMessage( new DHUDMessageFadeOut( SmallFont, g_MOTD,
2833- 1.5f,
2834- 0.375f,
2835- 0,
2836- 0,
2837- (EColorRange)PrintColors[5],
2838- cl_motdtime,
2839- 0.35f ), MAKE_ID('M','O','T','D') );
2840-}
2841-
2842-//*****************************************************************************
2843-//
28442804 AActor *CLIENT_FindThingByNetID( LONG lNetID )
28452805 {
28462806 return ( g_NetIDList.findPointerByID ( lNetID ) );
@@ -3383,7 +3343,7 @@
33833343 }
33843344
33853345 // Display the message of the day.
3386- CLIENT_DisplayMOTD( );
3346+ C_MOTDPrint( g_MOTD );
33873347 }
33883348
33893349 //*****************************************************************************
@@ -5693,6 +5653,8 @@
56935653 g_MOTD = motd;
56945654 // [BB] Some cleaning of the string since we can't trust the server.
56955655 V_RemoveTrailingCrapFromFString ( g_MOTD );
5656+ // [AK] Add pretty colors/formatting!
5657+ V_ColorizeString( g_MOTD );
56965658 }
56975659
56985660 //*****************************************************************************
@@ -9542,7 +9504,10 @@
95429504
95439505 //*****************************************************************************
95449506 // [Dusk] Redisplay the MOTD
9545-CCMD( motd ) {CLIENT_DisplayMOTD();}
9507+CCMD( motd )
9508+{
9509+ C_MOTDPrint( g_MOTD );
9510+}
95469511
95479512 //*****************************************************************************
95489513 // CONSOLE VARIABLES
diff -r 16625849dbee -r 1c2a632122c1 src/cl_main.h
--- a/src/cl_main.h Wed Sep 22 23:05:13 2021 +1000
+++ b/src/cl_main.h Tue Sep 21 09:25:50 2021 -0400
@@ -162,7 +162,6 @@
162162 void CLIENT_SpawnMissile( const PClass *pType, fixed_t X, fixed_t Y, fixed_t Z, fixed_t VelX, fixed_t VelY, fixed_t VelZ, LONG lNetID, LONG lTargetNetID );
163163 void CLIENT_MoveThing( AActor *pActor, fixed_t X, fixed_t Y, fixed_t Z );
164164 AActor *CLIENT_FindThingByNetID( LONG lID );
165-void CLIENT_DisplayMOTD( void );
166165 void CLIENT_RestoreSpecialPosition( AActor *pActor );
167166 void CLIENT_RestoreSpecialDoomThing( AActor *pActor, bool bFog );
168167 AInventory *CLIENT_FindPlayerInventory( ULONG ulPlayer, const PClass *pType );