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