// Message handler for Secondary Ammo Icon // Sets an ammo value // takes two values: // byte: ammo index // byte: ammo value int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); int index = READ_BYTE(); if( index < 0 || index >= MAX_SEC_AMMO_VALUES ) return 1; m_iAmmoAmounts[index] = READ_BYTE(); m_iFlags |= HUD_ACTIVE; // check to see if there is anything left to draw int count = 0; for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) { count += max( 0, m_iAmmoAmounts[i] ); } if( count == 0 ) { // the ammo fields are all empty, so turn off this hud area m_iFlags &= ~HUD_ACTIVE; return 1; } // make the icons light up m_fFade = 200.0f; return 1; }
// Message handler for Secondary Ammo Value // accepts one value: // string: sprite name int CHudAmmoSecondary::MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); m_HUD_ammoicon = gHUD.GetSpriteIndex( READ_STRING() ); return 1; }
int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); int armor = READ_BYTE(); // armor int damageTaken = READ_BYTE(); // health long bitsDamage = READ_LONG(); // damage bits vec3_t vecFrom; for( int i = 0; i < 3; i++ ) vecFrom[i] = READ_COORD(); UpdateTiles( gHUD.m_flTime, bitsDamage ); // Actually took damage? if( damageTaken > 0 || armor > 0 ) { CalcDamageDirection( vecFrom ); if( gMobileEngfuncs && damageTaken > 0 ) { float time = damageTaken * 4.0f; if( time > 200.0f ) time = 200.0f; gMobileEngfuncs->pfnVibrate( time, 0 ); } } return 1; }
int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); gHUD.m_iHideHUDDisplay = READ_BYTE(); if (gEngfuncs.IsSpectateOnly()) return 1; if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) { static wrect_t nullrc; gpActiveSel = NULL; // Removed by Pcjoe // SetCrosshair( 0, nullrc, 0, 0, 0 ); } else { /* Removed by Pcjoe if ( m_pWeapon ) SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 ); */ } return 1; }
int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf ) { if( m_iFlags & HUD_ACTIVE ) { Reset(); // clear the current MOTD in prep for this one } BEGIN_READ( pszName, pbuf, iSize ); int is_finished = READ_BYTE(); Q_strcat( m_szMOTD, READ_STRING( )); if( is_finished ) { m_iFlags |= HUD_ACTIVE; MOTD_DISPLAY_TIME = CVAR_GET_FLOAT( "motd_display_time" ); m_flActiveTill = gHUD.m_flTime + MOTD_DISPLAY_TIME; // count the number of lines in the MOTD for( char *sz = m_szMOTD; *sz != 0; sz++ ) if( *sz == '\n' ) m_iLines++; } END_READ(); return 1; }
int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); int newfov = READ_BYTE(); int def_fov = CVAR_GET_FLOAT( "default_fov" ); if ( newfov == 0 ) { m_iFOV = def_fov; } else { m_iFOV = newfov; } // the clients fov is actually set in the client data update section of the hud // Set a new sensitivity if ( m_iFOV == def_fov ) { // reset to saved sensitivity m_flMouseSensitivity = 0; } else { // set a new sensitivity that is proportional to the change from the FOV default m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); } return 1; }
//LRC int CHud::MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); for ( int i = 0; i < 3; i++ ) g_fFogColor[ i ] = READ_BYTE(); g_fFadeDuration = READ_SHORT(); g_fStartDist = READ_SHORT(); if (g_fFadeDuration > 0) { // // fading in g_iFinalEndDist = READ_SHORT(); g_fEndDist = FOG_LIMIT; } else if (g_fFadeDuration < 0) { // // fading out g_iFinalEndDist = g_fEndDist = READ_SHORT(); } else { g_fEndDist = READ_SHORT(); } return 1; }
void CVoiceStatus::HandleVoiceMaskMsg(int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); uint32 dw; for(dw=0; dw < VOICE_MAX_PLAYERS_DW; dw++) { m_AudiblePlayers.SetDWord(dw, (uint32)READ_LONG()); m_ServerBannedPlayers.SetDWord(dw, (uint32)READ_LONG()); if(gEngfuncs.pfnGetCvarFloat("voice_clientdebug")) { char str[256]; gEngfuncs.pfnConsolePrint("CVoiceStatus::HandleVoiceMaskMsg\n"); sprintf(str, " - m_AudiblePlayers[%d] = %lu\n", dw, m_AudiblePlayers.GetDWord(dw)); gEngfuncs.pfnConsolePrint(str); sprintf(str, " - m_ServerBannedPlayers[%d] = %lu\n", dw, m_ServerBannedPlayers.GetDWord(dw)); gEngfuncs.pfnConsolePrint(str); } } m_bServerModEnable = READ_BYTE(); }
void CHud :: MsgFunc_SetSkin( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); gHUD.m_iSkin = READ_BYTE(); cl_entity_s *view = gEngfuncs.GetViewModel(); view->curstate.skin = gHUD.m_iSkin; }
// buz: special tank message int CHud :: MsgFunc_SpecTank( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); m_SpecTank_on = READ_BYTE(); if (m_SpecTank_on == 0) // turn off return 1; else if (m_SpecTank_on == 2) // only ammo update { m_SpecTank_Ammo = READ_LONG(); m_SpecTank_Ammo2 = READ_LONG(); m_SpecTank_CrossSize = READ_BYTE(); } else // turn on { m_SpecTank_point.x = READ_COORD(); m_SpecTank_point.y = READ_COORD(); m_SpecTank_point.z = READ_COORD(); m_SpecTank_defYaw = READ_COORD(); m_SpecTank_coneHor = READ_COORD(); m_SpecTank_coneVer = READ_COORD(); m_SpecTank_distFwd = READ_COORD(); m_SpecTank_distUp = READ_COORD(); m_SpecTank_Ammo = READ_LONG(); m_SpecTank_Ammo2 = READ_LONG(); m_SpecTank_CrossSize = READ_BYTE(); } return 1; }
//LRC void CHud :: MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf ) { // CONPRINT("MSG:SetFog"); BEGIN_READ( pbuf, iSize ); for ( int i = 0; i < 3; i++ ) g_fFogColor[ i ] = READ_BYTE(); g_fFadeDuration = READ_SHORT(); g_fStartDist = READ_SHORT(); if (g_fFadeDuration > 0) { // // fading in // g_fStartDist = READ_SHORT(); g_iFinalEndDist = READ_SHORT(); // g_fStartDist = FOG_LIMIT; g_fEndDist = FOG_LIMIT; } else if (g_fFadeDuration < 0) { // // fading out // g_iFinalStartDist = g_iFinalEndDist = g_fEndDist = READ_SHORT(); } else { // g_fStartDist = READ_SHORT(); g_fEndDist = READ_SHORT(); } }
// QUAKECLASSIC int CHud :: MsgFunc_QItems(const char *pszName, int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); m_iQuakeItems = READ_LONG(); return 1; }
// // WeaponList -- Tells the hud about a new weapon type. // int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf) { BEGIN_READ(pbuf, iSize); WEAPON Weapon; strcpy(Weapon.szName, READ_STRING()); Weapon.iAmmoType = (int)READ_CHAR(); Weapon.iMax1 = READ_BYTE(); if(Weapon.iMax1 == 255) Weapon.iMax1 = -1; Weapon.iAmmo2Type = READ_BYTE(); Weapon.iMax2 = READ_BYTE(); if(Weapon.iMax2 == 255) Weapon.iMax2 = -1; Weapon.iSlot = READ_BYTE(); Weapon.iSlotPos = READ_BYTE(); Weapon.iId = READ_LONG(); Weapon.iFlags = READ_BYTE(); Weapon.iClip = 0; gWR.AddWeapon(&Weapon); return 1; }
//LRC void CHud :: MsgFunc_KeyedDLight( const char *pszName, int iSize, void *pbuf ) { // CONPRINT("MSG:KeyedDLight"); BEGIN_READ( pbuf, iSize ); // as-yet unused: // float decay; // drop this each second // float minlight; // don't add when contributing less // qboolean dark; // subtracts light instead of adding (doesn't seem to do anything?) int iKey = READ_BYTE(); dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight( iKey ); int bActive = READ_BYTE(); if (!bActive) { // die instantly dl->die = gEngfuncs.GetClientTime(); } else { // never die dl->die = gEngfuncs.GetClientTime() + 1E6; dl->origin[0] = READ_COORD(); dl->origin[1] = READ_COORD(); dl->origin[2] = READ_COORD(); dl->radius = READ_BYTE(); dl->color.r = READ_BYTE(); dl->color.g = READ_BYTE(); dl->color.b = READ_BYTE(); } }
int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); m_Teamplay = READ_BYTE(); return 1; }
void CHud :: MsgFunc_SetBody( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); gHUD.m_iBody = READ_BYTE(); cl_entity_s *view = gEngfuncs.GetViewModel(); view->curstate.body = gHUD.m_iBody; //gEngfuncs.pfnWeaponAnim( 2, gHUD.m_iBody );//UNDONE: custom frame for view model don't working }
//LRC int CHud::MsgFunc_HUDColor(const char *pszName, int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); m_iHUDColor = READ_LONG(); return 1; }
int __MsgFunc_Bhopcap( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); g_bhopcap = READ_BYTE(); return 1; }
int CHudBattery::MsgFunc_ArmorType(const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); m_enArmorType = (armortype_t)READ_BYTE(); return 1; }
int CHud :: MsgFunc_Intermission( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pszName, iSize, pbuf ); m_iIntermission = 1; END_READ(); return 1; }
int CHudMenu::MsgFunc_AllowSpec(const char *pszName, int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); m_bAllowSpec = !!READ_BYTE(); return 1; }
// trigger_viewset message int CHud :: MsgFunc_CamData( const char *pszName, int iSize, void *pbuf ) // rain stuff { BEGIN_READ( pbuf, iSize ); gHUD.viewEntityIndex = READ_SHORT(); gHUD.viewFlags = READ_SHORT(); // gEngfuncs.Con_Printf( "Got view entity with index %i\n", gHUD.viewEntityIndex ); return 1; }
int CHud :: MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) //AJH -Killar MP3 { BEGIN_READ( pbuf, iSize ); gMP3.PlayMP3( READ_STRING() ); return 1; }
int CHudLensFlare::MsgFunc_LensFlare( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); int mode = READ_BYTE(); if ( mode == 1 ) // allume { gruntlight_t *p = NULL; p = new gruntlight_t; p->index = READ_BYTE(); p->pNext = m_pLight; m_pLight = p; m_iFlags |= HUD_ACTIVE; } else if ( mode == 0 ) { int idx = READ_BYTE(); // destruction d'une flamme gruntlight_t *p = NULL; gruntlight_t *q = NULL; p = m_pLight; while ( p != NULL ) { if ( p->index == idx ) { if ( q == NULL ) { // première de la liste m_pLight = p->pNext, delete p; break; } else { q->pNext = p->pNext; delete p; break; } } q = p; p = p->pNext; } } return 1; }
int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); int client_index = READ_BYTE(); // the client who spoke the message SayTextPrint( READ_STRING(), iSize - 1, client_index ); return 1; }
// Message handler for ShowMenu message // takes four values: // short: a bitfield of keys that are valid input // char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen. // byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string // string: menu string to display // if this message is never received, then scores will simply be the combined totals of the players. int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf ) { char *temp = NULL; BEGIN_READ( pszName, pbuf, iSize ); m_bitsValidSlots = READ_SHORT(); int DisplayTime = READ_CHAR(); int NeedMore = READ_BYTE(); if( DisplayTime > 0 ) m_flShutoffTime = DisplayTime + gHUD.m_flTime; else m_flShutoffTime = -1; if( m_bitsValidSlots ) { if( !m_fWaitingForMore ) { // this is the start of a new menu Q_strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING ); } else { // append to the current menu string Q_strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - Q_strlen( g_szPrelocalisedMenuString )); } g_szPrelocalisedMenuString[MAX_MENU_STRING-1] = 0; // ensure null termination (strncat/strncpy does not) if( !NeedMore ) { // we have the whole string, so we can localise it now Q_strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString )); // Swap in characters if( KB_ConvertString( g_szMenuString, &temp )) { Q_strcpy( g_szMenuString, temp ); free( temp ); } } m_fMenuDisplayed = 1; m_iFlags |= HUD_ACTIVE; } else { m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off m_iFlags &= ~HUD_ACTIVE; } m_fWaitingForMore = NeedMore; END_READ(); return 1; }
int CHud::MsgFunc_Logo(const char *pszName, int iSize, void *pbuf) { BEGIN_READ( pbuf, iSize ); // update Train data m_iLogo = READ_BYTE(); return 1; }
int __MsgFunc_SpikeCheck(const char* name, int size, void* buf) { BEGIN_READ(buf, size); const auto model = READ_STRING(); // Stub: no cheat checks in OpenAG. return 1; }
int __MsgFunc_WhString(const char* name, int size, void* buf) { BEGIN_READ(buf, size); const auto string = READ_STRING(); // Stub: no cheat checks in OpenAG. return 1; }
int __MsgFunc_CheatCheck(const char* name, int size, void* buf) { BEGIN_READ(buf, size); const auto pure = READ_BYTE(); // Stub: no cheat checks in OpenAG. return 1; }