This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).
Revision | 1c2a632122c18e88cb59bc1b582093ca37daefca (tree) |
---|---|
Time | 2021-09-21 22:25:50 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
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.
@@ -2277,6 +2277,28 @@ | ||
2277 | 2277 | } |
2278 | 2278 | } |
2279 | 2279 | |
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 | + | |
2280 | 2302 | /****** Tab completion code ******/ |
2281 | 2303 | |
2282 | 2304 | struct TabData |
@@ -84,6 +84,7 @@ | ||
84 | 84 | class FFont; |
85 | 85 | void C_MidPrint (FFont *font, const char *message); |
86 | 86 | void C_MidPrintBold (FFont *font, const char *message); |
87 | +void C_MOTDPrint (FString message); // [AK] | |
87 | 88 | |
88 | 89 | bool C_Responder (event_t *ev); |
89 | 90 |
@@ -2801,46 +2801,6 @@ | ||
2801 | 2801 | |
2802 | 2802 | //***************************************************************************** |
2803 | 2803 | // |
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 | -// | |
2844 | 2804 | AActor *CLIENT_FindThingByNetID( LONG lNetID ) |
2845 | 2805 | { |
2846 | 2806 | return ( g_NetIDList.findPointerByID ( lNetID ) ); |
@@ -3383,7 +3343,7 @@ | ||
3383 | 3343 | } |
3384 | 3344 | |
3385 | 3345 | // Display the message of the day. |
3386 | - CLIENT_DisplayMOTD( ); | |
3346 | + C_MOTDPrint( g_MOTD ); | |
3387 | 3347 | } |
3388 | 3348 | |
3389 | 3349 | //***************************************************************************** |
@@ -5693,6 +5653,8 @@ | ||
5693 | 5653 | g_MOTD = motd; |
5694 | 5654 | // [BB] Some cleaning of the string since we can't trust the server. |
5695 | 5655 | V_RemoveTrailingCrapFromFString ( g_MOTD ); |
5656 | + // [AK] Add pretty colors/formatting! | |
5657 | + V_ColorizeString( g_MOTD ); | |
5696 | 5658 | } |
5697 | 5659 | |
5698 | 5660 | //***************************************************************************** |
@@ -9542,7 +9504,10 @@ | ||
9542 | 9504 | |
9543 | 9505 | //***************************************************************************** |
9544 | 9506 | // [Dusk] Redisplay the MOTD |
9545 | -CCMD( motd ) {CLIENT_DisplayMOTD();} | |
9507 | +CCMD( motd ) | |
9508 | +{ | |
9509 | + C_MOTDPrint( g_MOTD ); | |
9510 | +} | |
9546 | 9511 | |
9547 | 9512 | //***************************************************************************** |
9548 | 9513 | // CONSOLE VARIABLES |
@@ -162,7 +162,6 @@ | ||
162 | 162 | 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 ); |
163 | 163 | void CLIENT_MoveThing( AActor *pActor, fixed_t X, fixed_t Y, fixed_t Z ); |
164 | 164 | AActor *CLIENT_FindThingByNetID( LONG lID ); |
165 | -void CLIENT_DisplayMOTD( void ); | |
166 | 165 | void CLIENT_RestoreSpecialPosition( AActor *pActor ); |
167 | 166 | void CLIENT_RestoreSpecialDoomThing( AActor *pActor, bool bFog ); |
168 | 167 | AInventory *CLIENT_FindPlayerInventory( ULONG ulPlayer, const PClass *pType ); |