2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 11:19:39 +01:00

Reformat some strings yet.

This commit is contained in:
Night Owl 2016-08-02 18:36:48 +05:00
parent 7c17f6e042
commit 156b0ae69a
4 changed files with 58 additions and 40 deletions

View File

@ -28,7 +28,7 @@
DECLARE_MESSAGE( m_MOTD, MOTD )
int CHudMOTD :: Init( void )
int CHudMOTD::Init( void )
{
gHUD.AddHudElem( this );
@ -42,13 +42,13 @@ int CHudMOTD :: Init( void )
return 1;
}
int CHudMOTD :: VidInit( void )
int CHudMOTD::VidInit( void )
{
// Load sprites here
return 1;
}
void CHudMOTD :: Reset( void )
void CHudMOTD::Reset( void )
{
m_iFlags &= ~HUD_ACTIVE; // start out inactive
m_szMOTD[0] = 0;
@ -60,7 +60,7 @@ void CHudMOTD :: Reset( void )
#define ROW_GAP 13
#define ROW_RANGE_MIN 30
#define ROW_RANGE_MAX ( ScreenHeight - 100 )
int CHudMOTD :: Draw( float fTime )
int CHudMOTD::Draw( float fTime )
{
gHUD.m_iNoConsolePrint &= ~( 1 << 1 );
if( !m_bShow )
@ -68,60 +68,61 @@ int CHudMOTD :: Draw( float fTime )
gHUD.m_iNoConsolePrint |= 1 << 1;
bool bScroll;
// find the top of where the MOTD should be drawn, so the whole thing is centered in the screen
int ypos = (ScreenHeight - LINE_HEIGHT * m_iLines)/2; // shift it up slightly
int ypos = ( ScreenHeight - LINE_HEIGHT * m_iLines ) / 2; // shift it up slightly
char *ch = m_szMOTD;
int xpos = (ScreenWidth - gHUD.m_scrinfo.charWidths[ 'M' ] * m_iMaxLength) / 2;
if( xpos < 30 ) xpos = 30;
int xmax = xpos + gHUD.m_scrinfo.charWidths[ 'M' ] * m_iMaxLength;
int xpos = ( ScreenWidth - gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength ) / 2;
if( xpos < 30 )
xpos = 30;
int xmax = xpos + gHUD.m_scrinfo.charWidths['M'] * m_iMaxLength;
int height = LINE_HEIGHT * m_iLines;
int ypos_r=ypos;
if( height > ROW_RANGE_MAX )
{
ypos = ROW_RANGE_MIN + 7 + scroll;
if( ypos > ROW_RANGE_MIN + 4 )
scroll-= (ypos - ( ROW_RANGE_MIN + 4))/3.0;
scroll-= ( ypos - ( ROW_RANGE_MIN + 4 ) ) / 3.0;
if( ypos + height < ROW_RANGE_MAX )
scroll+= (ROW_RANGE_MAX - (ypos + height))/ 3.0;
scroll+= ( ROW_RANGE_MAX - ( ypos + height ) ) / 3.0;
ypos_r = ROW_RANGE_MIN;
height = ROW_RANGE_MAX;
}
int ymax = ypos + height;
if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;
gHUD.DrawDarkRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10);
while ( *ch )
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
while( *ch )
{
char *next_line;
int line_length = 0; // count the length of the current line
for ( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
line_length += gHUD.m_scrinfo.charWidths[ *next_line ];
for( next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
line_length += gHUD.m_scrinfo.charWidths[*next_line];
char *top = next_line;
if ( *top == '\n' )
if( *top == '\n' )
*top = 0;
else
top = NULL;
// find where to start drawing the line
if( (ypos > ROW_RANGE_MIN) && (ypos + LINE_HEIGHT <= ypos_r + height) )
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
ypos += LINE_HEIGHT;
if ( top ) // restore
if( top ) // restore
*top = '\n';
ch = next_line;
if ( *ch == '\n' )
if( *ch == '\n' )
ch++;
if ( ypos > (ScreenHeight - 20) )
if( ypos > ( ScreenHeight - 20 ) )
break; // don't let it draw too low
}
return 1;
}
int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
{
if ( m_iFlags & HUD_ACTIVE )
if( m_iFlags & HUD_ACTIVE )
{
Reset(); // clear the current MOTD in prep for this one
}
@ -131,17 +132,16 @@ int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
int is_finished = READ_BYTE();
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) );
if ( is_finished )
if( is_finished )
{
int length = 0;
m_iMaxLength = 0;
m_iFlags |= HUD_ACTIVE;
for ( char *sz = m_szMOTD; *sz != 0; sz++ ) // count the number of lines in the MOTD
for( char *sz = m_szMOTD; *sz != 0; sz++ ) // count the number of lines in the MOTD
{
if ( *sz == '\n' )
if( *sz == '\n' )
{
m_iLines++;
if( length > m_iMaxLength )

View File

@ -35,7 +35,7 @@ int CHudAmmoSecondary::Init( void )
gHUD.AddHudElem(this);
m_HUD_ammoicon = 0;
for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
m_iAmmoAmounts[i] = -1; // -1 means don't draw this value
Reset();
@ -55,7 +55,7 @@ int CHudAmmoSecondary::VidInit( void )
int CHudAmmoSecondary::Draw( float flTime )
{
if ( ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
if( ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
return 1;
// draw secondary ammo icons above normal ammo readout

View File

@ -268,8 +268,26 @@ stub functions for such things as precaching. So we don't have to modify weapon
is compiled into both game and client .dlls.
======================
*/
int stub_PrecacheModel ( char* s ) { return 0; }
int stub_PrecacheSound ( char* s ) { return 0; }
unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; }
const char *stub_NameForFunction ( unsigned long function ) { return "func"; }
void stub_SetModel ( edict_t *e, const char *m ) {}
int stub_PrecacheModel( char* s )
{
return 0;
}
int stub_PrecacheSound( char* s )
{
return 0;
}
unsigned short stub_PrecacheEvent( int type, const char *s )
{
return 0;
}
const char *stub_NameForFunction( unsigned long function )
{
return "func";
}
void stub_SetModel( edict_t *e, const char *m )
{
}

View File

@ -42,19 +42,19 @@ ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];
void EMIT_SOUND_DYN( edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch ) { }
// CBaseEntity Stubs
int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
int CBaseEntity::TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
CBaseEntity *CBaseEntity::GetNextTarget( void ) { return NULL; }
int CBaseEntity::Save( CSave &save ) { return 1; }
int CBaseEntity::Restore( CRestore &restore ) { return 1; }
void CBaseEntity::SetObjectCollisionBox( void ) { }
int CBaseEntity :: Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity :: MakeDormant( void ) { }
int CBaseEntity :: IsDormant( void ) { return 0; }
BOOL CBaseEntity :: IsInWorld( void ) { return TRUE; }
int CBaseEntity::Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity::MakeDormant( void ) { }
int CBaseEntity::IsDormant( void ) { return 0; }
BOOL CBaseEntity::IsInWorld( void ) { return TRUE; }
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
int CBaseEntity :: DamageDecal( int bitsDamageType ) { return -1; }
CBaseEntity * CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
int CBaseEntity::DamageDecal( int bitsDamageType ) { return -1; }
CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
void CBaseEntity::SUB_Remove( void ) { }
// CBaseDelay Stubs