But it's random stuff that all worked before. Something different crashes the program each time, although there are certain entities, .rects, CHudStamina, and CHudMapType that seem to crash it a lot.
Persuter > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:hlcoders- > [EMAIL PROTECTED]] On Behalf Of Tom > Sent: Sunday, February 10, 2002 4:09 AM > To: [EMAIL PROTECTED] > Subject: Re: [hlcoders] More Message Problems > > I think I solved my problem, I was sending the message too early, so it > wasnt ready (I think). > > Just thinking along the lines of my problem, are you sure that you are not > sending the message too early, and when you intersept it you then try to > call a memeber of gHud or the viewport which isnt there? > > ----- Original Message ----- > From: "Persuter" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, February 10, 2002 6:49 AM > Subject: RE: [hlcoders] More Message Problems > > > > For more of an update on this: I've removed the Initialize function of a > > different hud element, and it gets way farther now, only crashing upon > > beginning the render. Again, the problem seems to be that HUD elements > > keep losing pointers or something. I'll get an access error while > > accessing something like hSprite in CHudHealth. The variables in the hud > > element classes just sort of disappear. What could be causing this? > > > > Persuter > > Lead Coder of Hostile Intent > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] [mailto:hlcoders- > > > [EMAIL PROTECTED]] On Behalf Of Persuter > > > Sent: Saturday, February 09, 2002 7:09 PM > > > To: [EMAIL PROTECTED] > > > Subject: [hlcoders] More Message Problems > > > > > > I'm having message problems of my own. I decided against the bsp > > reader, > > > since I just need to get one value. I set up a HUD element that would > > > keep track of the map type (the keyvalue info), so the HUD functions > > > that needed to know could hook into that. > > > > > > However, now I'm having a problem where CHud::Init() will crash in > > > seemingly random places while running through all the hud elements > > init > > > functions. Generally one or more of them (m_Speed, m_AmmoSecondary, > > > etc.) will not be anything, but simply contain empty pointers and > > > whatnot, and the program will crash out with an access violation when > > it > > > tries to access the Init function. > > > > > > The especially weird thing is that these objects worked before I put > > the > > > new message in and even if I remove the Init function for the new > > > object, it still crashes. > > > > > > On the server-side: > > > > > > In player.cpp: > > > > > > int gmsgMapType = 0; > > > > > > In LinkUserMessages(): > > > > > > gmsgMapType = REG_USER_MSG( "MapType", 1 ); > > > > > > OK, now I think this is my problem, I really didn't know where to put > > > this: > > > > > > I have in CBasePlayer::UpdateClientData(): > > > > > > if (m_fInitHUD) > > > { > > > m_fInitHUD = FALSE; > > > gInitHUD = FALSE; > > > > > > MESSAGE_BEGIN( MSG_ONE, gmsgResetHUD, NULL, pev ); > > > WRITE_BYTE( 0 ); > > > MESSAGE_END(); > > > > > > if ( !m_fGameHUDInitialized ) > > > { > > > MESSAGE_BEGIN( MSG_ONE, gmsgInitHUD, NULL, pev > > > ); > > > MESSAGE_END(); > > > > > > g_pGameRules->InitHUD( this ); > > > m_fGameHUDInitialized = TRUE; > > > if ( g_pGameRules->IsMultiplayer() ) > > > { > > > FireTargets( "game_playerjoin", this, > > > this, USE_TOGGLE, 0 ); > > > } > > > } > > > FireTargets( "game_playerspawn", this, this, USE_TOGGLE, > > > 0 ); > > > > > > CBaseEntity* pMapType = NULL; > > > pMapType = UTIL_FindEntityByClassname( pMapType, > > > "hi_maptype" ); > > > > > > > > > MESSAGE_BEGIN( MSG_ONE, gmsgMapType, NULL, pev ); > > > if( pMapType ) > > > WRITE_BYTE( > > > ((CMapType*)pMapType)->m_iMapType ); > > > else > > > WRITE_BYTE( 5 ); // Otherwise any models > > > may be used. > > > MESSAGE_END(); > > > } > > > > > > On the client-side: > > > > > > In hud.cpp: > > > > > > m_MapType.Init(); > > > > > > In hud.h: > > > > > > class CHudMapType : public CHudBase > > > { > > > public: > > > int m_iMapType; > > > int Init( void ); > > > int MsgFunc_MapType( const char *pszName, int iSize, void* pbuf > > > ); > > > }; > > > > > > In hud.h, in the definition of CHud: > > > > > > CHudMapType m_MapType; > > > > > > Further down, same place: > > > > > > int _cdecl MsgFunc_MapType( const char *pszName, int iSize, > > > void *pbuf ); > > > > > > In maptype.cpp: > > > > > > DECLARE_MESSAGE( m_MapType, MapType ); > > > > > > int CHudMapType::Init( void ) > > > { > > > HOOK_MESSAGE( MapType ); > > > > > > gHUD.AddHudElem( this ); > > > > > > return 1; > > > > > > } > > > > > > int CHudMapType::MsgFunc_MapType( const char *pszName, int iSize, > > void* > > > pbuf ) > > > { > > > BEGIN_READ( pbuf, iSize ); > > > > > > m_iMapType = READ_BYTE(); > > > > > > return 1; > > > > > > } > > > > > > > > > > > > > > > _________________________________________________________ > > > Do You Yahoo!? > > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or view the list archives, > > > please visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > _________________________________________________________ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders