|
|
|
Editor: RED is new, YELLOW is old. I spent a long time on Wavelength's IRC Channel working on this one. Its on how to add map briefings to your mod as seen in TFC, CS, and coming soon Goldeneye. Mp.dll Open multiplay_gamerules.cpp and goto the MOTD function: Youll need to add this: int length, char_count = 0; char *pFileList; char szFilename[100]=""; const char *szMapName = (STRING(gpGlobals->mapname)); strcpy(szFilename, "maps/"); strcat ( szFilename, szMapName ); strcat( szFilename, ".txt" ); char *aFileList = pFileList = (char *)LOAD_FILE_FOR_ME( szFilename , &length); // char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length ); You might want to add a handler for if there isnt a txt file though What you need to do is this: // char *aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length ); if (pFileList == NULL) { FREE_FILE( aFileList ); aFileList = pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length ); } Client.dll Now well make it so that the motd stays forever and you have to press fire to clear it. Open MOTD.cpp and find this line: CVAR_CREATE( "motd_display_time", "6", 0 ); Increase the 6 to 99, its not really forever but a long time. Add this to hud.h in the CHudMOTD class: void Think ( void ); Now add this to motd.cpp: void CHudMOTD :: Think ( void ) { if (gHUD.m_iKeyBits & IN_ATTACK) { Reset(); } } *Added by Biggs: If you need to change it from printing in the center go to: int ypos = max(((ScreenHeight - (m_iLines * LINE_HEIGHT))/2) - 40, 30 ); // shift it up slightly Comment that line out. Also comment out this line: int xpos = (ScreenWidth - line_length) / 2; Now that will get rid of valve's spot to draw it in the middle. Here is what you will need to put if you want to change were it draws. Note that this will define were to start to draw the top left corner. It starts there and draws down. int xpos = ScreenWidth / 4; // One forth across the screen. Make sure you use Screenwidth / ? to make sure // it will figure out what resolution the person is in int ypos = (ScreenHeight / 2) - (gHUD.m_iFontHeight / 2); // Very middle of the screen. Then to print it out: gHUD.DrawHudString( xpos, ypos, ScreenWidth/2, ch, 255, 180, 0 ); Were xpos and ypos is the location of the top left corner. ScreenWidth is the maximum length here im dividing it by 2 you can change that if you need to. ch is the text we want to display in this case it will be the mapname.txt 255 is the R in (R G B) 180 is the G 0 is the B That will give us the half-life yellow look. If you want to find out the RGB values. Open up Photoshop or PaintShop Pro. On the color mixer you can select the color you want and below it should show you the color in RGB values. Ok now there is a small problem with the motd.txt It might cut off your file. You in order to fix that we need to adjust the MAX_MOTD_LENGTH To do this open up the mp.dll workspace and go to the line #define MAX_MOTD_LENGTH (MAX_MOTD_CHUNK * 4) in multiplayer_gamerules.cpp If you have a long .txt file you will need to change the *4 to your needs. Just make your own judgement call don't worry you can always change the value untill you have it right. Let's say we want to change *4 to *9 So we make it: #define MAX_MOTD_LENGTH (MAX_MOTD_CHUNK * 9) Now you take the 9 and multiply it by the 60 in #define MAX_MOTD_CHUNK 60 That will give you 540. Remember this number it will come in handy later. After you have changed these values save your file and compile the mp.dll Now that we have that done we just change the maximum length of our .txt file so it won't cut if off. Now all we have to do is to tell the client.dll our changes. So open the client.dll's workspace back up and open the file hud.h Goto the line enum { MAX_MOTD_LENGTH = 241, }; Ok remember that number 540? Well now is the time to use it. You see our .txt file in the mp.dll totals 540 but in order to make sure we have enough room let's increase the number by one. So change the 540 to 541 and plug it in for the 241 and you should now have enum { MAX_MOTD_LENGTH = 541, }; Then just save your file and compile the client.dll (with inline function expantion off) and you will be all set. If you need to change the values again just repeat this process. I hope you guys got all that. Look for this in the upcoming goldeneye mod.
Any questions or suggestions should be sent to me:
bigguy@valveworld.com