mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-03-12 05:22:55 +00:00
Merge a06a736dfb
This commit is contained in:
parent
303703384d
commit
dbefbc819f
@ -27,7 +27,7 @@
|
||||
#include "scripted.h"
|
||||
#include "weapons.h"
|
||||
#include "soundent.h"
|
||||
#include "time.h"
|
||||
//#include "time.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
//=========================================================
|
||||
@ -408,13 +408,7 @@ void CBarney::Spawn()
|
||||
{
|
||||
Precache();
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
// This looks ugly - GOAHEAD
|
||||
if( ( sysDate->wMonth == 12 && sysDate->wDay == 25 ) || (sysDate->wMonth == 12 && sysDate->wDay == 24 ) || (sysDate->wMonth == 12 && sysDate->wDay == 23 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
if( IsChristmas( false ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
SET_MODEL( ENT( pev ), "models/barneyxmas.mdl" );
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "weaponinfo.h"
|
||||
#include "usercmd.h"
|
||||
#include "netadr.h"
|
||||
#include "time.h"
|
||||
#include <ctime>
|
||||
|
||||
// START BOT
|
||||
#include "bot.h"
|
||||
@ -354,27 +354,24 @@ void Host_Say( edict_t *pEntity, int teamonly )
|
||||
if( pc != NULL )
|
||||
return; // no character found, so say nothing
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
time_t tTime = time( 0 );
|
||||
struct tm *stTimeNow = localtime( &tTime );
|
||||
|
||||
char *dd = "AM";
|
||||
|
||||
WORD hour = sysDate->wHour;
|
||||
|
||||
if( hour > 11 )
|
||||
if( stTimeNow->tm_hour > 11 )
|
||||
{
|
||||
dd = "PM";
|
||||
hour = hour - 12;
|
||||
stTimeNow->tm_hour -= 12;
|
||||
}
|
||||
if( hour == 0 )
|
||||
hour = 12;
|
||||
if( stTimeNow->tm_hour == 0 )
|
||||
stTimeNow->tm_hour = 12;
|
||||
|
||||
// turn on color set 2 (color on, no sound)
|
||||
if( teamonly )
|
||||
sprintf( text, "[%d:%d %s] %c(TEAM) %s: ", hour, sysDate->wMinute, dd, 2, STRING( pEntity->v.netname ) );
|
||||
sprintf( text, "[%d:%d %s] %c(TEAM) %s: ", stTimeNow->tm_hour, stTimeNow->tm_min, dd, 2, STRING( pEntity->v.netname ) );
|
||||
else
|
||||
sprintf( text, "[%d:%d %s] %c%s: ", hour, sysDate->wMinute, dd, 2, STRING( pEntity->v.netname ) );
|
||||
sprintf( text, "[%d:%d %s] %c%s: ", stTimeNow->tm_hour, stTimeNow->tm_min, dd, 2, STRING( pEntity->v.netname ) );
|
||||
|
||||
j = sizeof( text ) - 2 - strlen( text ); // -2 for /n and null terminator
|
||||
if( (int)strlen( p ) > j )
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "gamerules.h"
|
||||
#include "player.h"
|
||||
#include "monhunt_gamerules.h"
|
||||
#include "time.h"
|
||||
//#include "time.h"
|
||||
|
||||
extern DLL_GLOBAL Vector g_vecAttackDir;
|
||||
extern DLL_GLOBAL int g_iSkillLevel;
|
||||
@ -190,18 +190,13 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
|
||||
{
|
||||
int cSplat;
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
for( cSplat = 0; cSplat < cGibs; cSplat++ )
|
||||
{
|
||||
CGib *pGib = GetClassPtr( (CGib *)NULL );
|
||||
|
||||
if( g_Language == LANGUAGE_GERMAN )
|
||||
{
|
||||
if( ( sysDate->wMonth == 12 && sysDate->wDay == 25 ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
if( IsChristmas( false ) || ( IsMarch31st() ) || (CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
@ -216,7 +211,7 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
|
||||
{
|
||||
if( human )
|
||||
{
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
if( IsChristmas( false ) || ( IsMarch31st() ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
@ -235,7 +230,7 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
if( IsChristmas( false ) || ( IsMarch31st() ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
pGib->Spawn( "models/pgibs.mdl" );
|
||||
pGib->pev->body = RANDOM_LONG( 0, PRESENT_GIB_COUNT - 1 );
|
||||
@ -344,11 +339,7 @@ void CBaseMonster::GibMonster( void )
|
||||
TraceResult tr;
|
||||
BOOL gibbed = FALSE;
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
sysDate = (LPSYSTEMTIME)malloc( sizeof(SYSTEMTIME) );
|
||||
GetLocalTime( sysDate );
|
||||
|
||||
if( ( sysDate->wMonth == 12 && ( ( sysDate->wDay == 23 ) || ( sysDate->wDay == 24 ) || ( sysDate->wDay == 25 ) ) ) || ( sysDate->wMonth == 3 && sysDate->wDay == 31 ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ))
|
||||
if( IsChristmas( false ) || ( IsMarch31st() ) || ( CVAR_GET_FLOAT( "mp_christmas" ) == 1 ) )
|
||||
{
|
||||
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "misc/party2.wav", 1, ATTN_NORM );
|
||||
}
|
||||
|
@ -17,6 +17,69 @@
|
||||
#pragma once
|
||||
|
||||
#include "event_flags.h"
|
||||
#include <ctime>
|
||||
|
||||
//Thanks to shepard62fr!!
|
||||
inline bool IsChristmas( bool xmasonly )
|
||||
{
|
||||
// Get the time now
|
||||
time_t tTime = time( 0 );
|
||||
struct tm *stTimeNow = localtime( &tTime );
|
||||
bool temp;
|
||||
|
||||
// [DEBUG] Tell the date
|
||||
//ALERT( at_console, "%i-%i-%i\n", ( stTimeNow->tm_year + 1900 ), ( stTimeNow->tm_mon + 1 ), stTimeNow->tm_mday );
|
||||
|
||||
// It's Christmas ?
|
||||
if( xmasonly )
|
||||
{
|
||||
if( ( ( stTimeNow->tm_mon + 1 ) == 12 ) && ( stTimeNow->tm_mday == 25 ) )
|
||||
temp = true;
|
||||
else
|
||||
temp = false;
|
||||
}
|
||||
else if( !xmasonly )
|
||||
{
|
||||
if( ( ( stTimeNow->tm_mon + 1 ) == 12 ) && ( ( stTimeNow->tm_mday == 25 ) || ( stTimeNow->tm_mday == 24 ) || (stTimeNow->tm_mday == 23 ) || (stTimeNow->tm_mday == 22 ) ) )
|
||||
temp = true;
|
||||
else
|
||||
temp = false;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline bool IsHalloween()
|
||||
{
|
||||
// Get the time now
|
||||
time_t tTime = time( 0 );
|
||||
struct tm *stTimeNow = localtime( &tTime );
|
||||
|
||||
// [DEBUG] Tell the date
|
||||
//ALERT( at_console, "%i-%i-%i\n", ( stTimeNow->tm_year + 1900 ), ( stTimeNow->tm_mon + 1 ), stTimeNow->tm_mday );
|
||||
|
||||
// It's Christmas ?
|
||||
if( ( ( stTimeNow->tm_mon + 1 ) == 10 ) && ( stTimeNow->tm_mday == 31 ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool IsMarch31st()
|
||||
{
|
||||
// Get the time now
|
||||
time_t tTime = time( 0 );
|
||||
struct tm *stTimeNow = localtime( &tTime );
|
||||
|
||||
// [DEBUG] Tell the date
|
||||
//ALERT( at_console, "%i-%i-%i\n", ( stTimeNow->tm_year + 1900 ), ( stTimeNow->tm_mon + 1 ), stTimeNow->tm_mday );
|
||||
|
||||
// It's Christmas ?
|
||||
if( ( ( stTimeNow->tm_mon + 1 ) == 3 ) && ( stTimeNow->tm_mday == 31 ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must be provided by user of this code
|
||||
extern enginefuncs_t g_engfuncs;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "nodes.h"
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
#include "time.h"
|
||||
//#include "time.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_boombox, CBoombox );
|
||||
|
||||
@ -106,12 +106,8 @@ void CBoombox::Holster( int skiplocal /* = 0 */ )
|
||||
|
||||
void CBoombox::PrimaryAttack()
|
||||
{
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
sysDate = (LPSYSTEMTIME) malloc(sizeof(SYSTEMTIME));
|
||||
GetLocalTime(sysDate);
|
||||
|
||||
if (sysDate->wMonth == 12 && sysDate->wDay == 25 ) {
|
||||
if( IsChristmas( true ) )
|
||||
{
|
||||
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "bbox/xmassong.wav", 1, ATTN_NORM);
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
return;
|
||||
@ -128,4 +124,4 @@ void CBoombox::SecondaryAttack()
|
||||
#endif
|
||||
RadiusDamage( m_pPlayer->pev->origin, pev, m_pPlayer->pev, 10, 750, CLASS_NONE, DMG_BILLNYE | DMG_ALWAYSGIB );
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.75;
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,6 @@
|
||||
#define XMAST_AE_ATTACK_LEFT 0x02
|
||||
#define XMAST_AE_ATTACK_BOTH 0x03
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
|
||||
//#define XMAST_FLINCH_DELAY 1 // at most one flinch every n secs
|
||||
|
||||
class CXmast : public CBaseMonster
|
||||
@ -272,16 +270,13 @@ else
|
||||
SET_MODEL(ENT(pev), "models/xmastreem.mdl");
|
||||
UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );
|
||||
|
||||
sysDate = (LPSYSTEMTIME) malloc(sizeof(SYSTEMTIME));
|
||||
GetLocalTime(sysDate);
|
||||
|
||||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin.
|
||||
if (sysDate->wMonth == 12 && sysDate->wDay == 25 )
|
||||
pev->health = gSkillData.xmastHealth*5;
|
||||
else
|
||||
//if( IsChristmas( true ) )
|
||||
// pev->health = gSkillData.xmastHealth*5;
|
||||
//else
|
||||
pev->health = CBaseMonster::GetHealth( gSkillData.xmastHealth, 5 );
|
||||
m_flFieldOfView = VIEW_FIELD_WIDE;// indicates the width of this monster's forward view cone ( as a dotproduct result )
|
||||
m_MonsterState = MONSTERSTATE_NONE;
|
||||
@ -344,4 +339,4 @@ int CXmast::IgnoreConditions ( void )
|
||||
|
||||
return iIgnore;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -667,10 +667,6 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
|
||||
addDefault = TRUE;
|
||||
|
||||
LPSYSTEMTIME sysDate;
|
||||
sysDate = (LPSYSTEMTIME) malloc(sizeof(SYSTEMTIME));
|
||||
GetLocalTime(sysDate);
|
||||
|
||||
CBasePlayer *m_pPlayer;
|
||||
|
||||
while( ( pWeaponEntity = UTIL_FindEntityByClassname( pWeaponEntity, "game_player_equip" ) ) )
|
||||
@ -679,7 +675,7 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
addDefault = FALSE;
|
||||
}
|
||||
|
||||
if( sysDate->wMonth == 12 && sysDate->wDay == 25 )
|
||||
if( IsChristmas( true ) )
|
||||
{ // This will never use mp_christmas, cant cheat presents ;)
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_VOICE, "misc/b2.wav", 0.8, ATTN_NORM );
|
||||
ClientPrint( pPlayer->pev, HUD_PRINTCENTER, "MERRY CHRISTMAS!\nHave a shotgun and a bow!" ); //digamos al cliente
|
||||
@ -688,7 +684,7 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer )
|
||||
//CLIENT_COMMAND( ENT( pPlayer->pev ), "spk \"have some presence\"\n" );
|
||||
}
|
||||
|
||||
if( sysDate->wMonth == 10 && sysDate->wDay == 31 )
|
||||
if( IsHalloween() )
|
||||
{
|
||||
ClientPrint( pPlayer->pev, HUD_PRINTCENTER, "Happy Halloween!\nHave a good one!" ); //digamos al cliente
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user