An Unspeakable Modification for Half-Life |
|
|
Welcome to the Mapping section!In this section I describe how I make certain entities in the Cthulhu mod. My only request is that if you use my code, please credit me in your mod.Note: I use Spirit of Half-Life, so I assume here that you do too! BooksIn Cthulhu, there are a number of things that may be 'read', such as letters, books, etc. For this I created the item_book entity. Here I will tell you how to implement this entity in your mod.1. Insert the following code in your mod's Hammer Editor FGD file: @PointClass size(-16 -16 0, 16 16 36) base(Weapon, Targetx) = item_book : "Book" This should be around the same area in the file where the item_healthkit is defined. 2. Include the BOOK.CPP file into your HL.DLL C++ project. 3. In the HL.DLL file player.cpp, include the following code. I have commented the Cthulhu code and included the preceding lines, so you know where to put the code: int gmsgTeamNames = 0; and in routine LinkUserMessages(): gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 ); 4. In the HL.DLL file triggers.cpp, include the following code in the routine ChangeLevelNow(...). Again I have included the surrounding code, so you should be able to find where to put it: CBaseEntity *pPlayer = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );5. In the HL.DLL file util.h, include the following code (immediately after the definition of UTIL_SayTextAll is a good place): extern void UTIL_ReadBook( const char *szImage ); // Cthulhu 6. In the HL.DLL file util.cpp, include the following code (doesn't really matter where, but with the other messages like UTIL_SayTextAll): extern int gmsgReadBook;
7. In the CLIENT.DLL project, include the ReadBook.CPP file. 8. In the CLIENT.DLL file HUD.H, include the following line in the class definition of CHud (next to the declaration of m_Battery is a good place): ... 9. In the CLIENT.DLL file HUD.H file, include the following code (at some point before the CHud class definition in Step 8 above): #include "ImageLabel.h" 10. In the CLIENT.DLL file HUD.CPP, include the following code in the CHud::Init() routine: m_ReadBook.Init(); // Cthulhu and in the CHuD::VidInit() routine: m_ReadBook.VidInit(); // Cthulhu 11. Rebuild both DLLs and you are now ready to start mapping with books. Some last notes on using books though:
|
|
|
Contact me: philg@xs4all.nl |