do not threat c4 as grenade
simplify linkents several other fixes
This commit is contained in:
parent
e9d826ccea
commit
a7231d87ed
8 changed files with 58 additions and 88 deletions
|
|
@ -203,7 +203,7 @@ namespace Math
|
|||
//
|
||||
static inline void SineCosine (float rad, float *sine, float *cosine)
|
||||
{
|
||||
#if defined (_WIN32) && defined (_MSC_VER)
|
||||
#if defined (_WIN32) && defined (_MSC_VER) && !defined (__clang__)
|
||||
__asm
|
||||
{
|
||||
fld dword ptr[rad]
|
||||
|
|
@ -223,7 +223,8 @@ namespace Math
|
|||
*cosine = _cos;
|
||||
*sine = _sin;
|
||||
#else
|
||||
#error "SineConsine not defined."
|
||||
*sine = sinf (rad);
|
||||
*cosine = cosf (rad);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -616,7 +617,7 @@ public:
|
|||
//
|
||||
inline static const Vector &GetZero (void)
|
||||
{
|
||||
static const Vector &s_zero = Vector (0.0f, 0.0f, 0.0f);
|
||||
static const Vector s_zero = Vector (0.0f, 0.0f, 0.0f);
|
||||
return s_zero;
|
||||
}
|
||||
|
||||
|
|
@ -2754,21 +2755,6 @@ public:
|
|||
return strcmp (m_bufferPtr, string.m_bufferPtr);
|
||||
}
|
||||
|
||||
//
|
||||
// Function: CompareI
|
||||
// Compares string with other string without case check.
|
||||
//
|
||||
// Parameters:
|
||||
// string - String t compare with.
|
||||
//
|
||||
// Returns:
|
||||
// Zero if they are equal.
|
||||
//
|
||||
int CompareI (String &string) const
|
||||
{
|
||||
return strcmpi (m_bufferPtr, string.m_bufferPtr);
|
||||
}
|
||||
|
||||
//
|
||||
// Function: Compare
|
||||
// Compares string with other string.
|
||||
|
|
@ -2784,21 +2770,6 @@ public:
|
|||
return strcmp (m_bufferPtr, str);
|
||||
}
|
||||
|
||||
//
|
||||
// Function: CompareI
|
||||
// Compares string with other string without case check.
|
||||
//
|
||||
// Parameters:
|
||||
// str - String to compare with.
|
||||
//
|
||||
// Returns:
|
||||
// Zero if they are equal.
|
||||
//
|
||||
int CompareI (const char *str) const
|
||||
{
|
||||
return stricmp (m_bufferPtr, str);
|
||||
}
|
||||
|
||||
//
|
||||
// Function: Collate
|
||||
// Collate the string.
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@
|
|||
<ClInclude Include="..\include\resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\basecode.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\basecode.cpp" />
|
||||
<ClCompile Include="..\source\combat.cpp" />
|
||||
<ClCompile Include="..\source\manager.cpp" />
|
||||
<ClCompile Include="..\source\chatlib.cpp" />
|
||||
|
|
@ -180,23 +178,17 @@
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<AdditionalIncludeDirectories>..\mmgr;..\include\engine;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>core.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\release\inf\yapb.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\release\asm\</AssemblerListingLocation>
|
||||
<ObjectFileName>.\release\obj\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\release\inf\</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
|
|
@ -209,9 +201,11 @@
|
|||
<Optimization>Full</Optimization>
|
||||
<GenerateAlternateCodePaths>AVXI</GenerateAlternateCodePaths>
|
||||
<UseProcessorExtensions>AVXI</UseProcessorExtensions>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<ForceConformanceInForLoopScope>false</ForceConformanceInForLoopScope>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<PrecompiledHeaderOutputFileDirectory />
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
@ -228,7 +222,7 @@
|
|||
<OutputFile>.\release\yapb.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DelayLoadDLLs>user32.dll;ws2_32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>Debug</GenerateDebugInformation>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>false</OptimizeReferences>
|
||||
|
|
@ -245,6 +239,7 @@
|
|||
<ImageHasSafeExceptionHandlers>
|
||||
</ImageHasSafeExceptionHandlers>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
|
|
|
|||
|
|
@ -1242,7 +1242,7 @@ void Bot::CheckMessageQueue (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
|
||||
if ((m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice) || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
|
||||
{
|
||||
if (m_radioSelect < Radio_GoGoGo)
|
||||
FakeClientCommand (GetEntity (), "radio1");
|
||||
|
|
@ -2128,29 +2128,25 @@ void Bot::PushTask (TaskID id, float desire, int data, float time, bool resume)
|
|||
DeleteSearchNodes ();
|
||||
IgnoreCollisionShortly ();
|
||||
|
||||
int taskId = GetTaskId ();
|
||||
|
||||
// leader bot?
|
||||
if (m_isLeader && GetTaskId () == TASK_SEEKCOVER)
|
||||
if (m_isLeader && taskId == TASK_SEEKCOVER)
|
||||
CommandTeam (); // reorganize team if fleeing
|
||||
|
||||
if (GetTaskId () == TASK_CAMP)
|
||||
if (taskId == TASK_CAMP)
|
||||
SelectBestWeapon ();
|
||||
|
||||
// this is best place to handle some voice commands report team some info
|
||||
if (Random.Long (0, 100) < 95)
|
||||
{
|
||||
switch (GetTaskId ())
|
||||
{
|
||||
case TASK_BLINDED:
|
||||
if (taskId == TASK_BLINDED)
|
||||
InstantChatterMessage (Chatter_GotBlinded);
|
||||
break;
|
||||
|
||||
case TASK_PLANTBOMB:
|
||||
else if (taskId == TASK_PLANTBOMB)
|
||||
InstantChatterMessage (Chatter_PlantingC4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Random.Long (0, 100) < 80 && GetTaskId () == TASK_CAMP)
|
||||
if (Random.Long (0, 100) < 80 && taskId == TASK_CAMP)
|
||||
{
|
||||
if ((g_mapType & MAP_DE) && g_bombPlanted)
|
||||
ChatterMessage (Chatter_GuardDroppedC4);
|
||||
|
|
@ -4440,6 +4436,10 @@ void Bot::RunTask_PickupItem ()
|
|||
|
||||
switch (m_pickupType)
|
||||
{
|
||||
case PICKUP_DROPPED_C4:
|
||||
case PICKUP_NONE:
|
||||
break;
|
||||
|
||||
case PICKUP_WEAPON:
|
||||
m_aimFlags |= AIM_NAVPOINT;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ void StripTags (char *buffer)
|
|||
{
|
||||
// this function strips 'clan' tags specified below in given string buffer
|
||||
|
||||
char *tagOpen[] = {"-=", "-[", "-]", "-}", "-{", "<[", "<]", "[-", "]-", "{-", "}-", "[[", "[", "{", "]", "}", "<", ">", "-", "|", "=", "+", "(", ")"};
|
||||
char *tagClose[] = {"=-", "]-", "[-", "{-", "}-", "]>", "[>", "-]", "-[", "-}", "-{", "]]", "]", "}", "[", "{", ">", "<", "-", "|", "=", "+", ")", "("};
|
||||
const char *tagOpen[] = {"-=", "-[", "-]", "-}", "-{", "<[", "<]", "[-", "]-", "{-", "}-", "[[", "[", "{", "]", "}", "<", ">", "-", "|", "=", "+", "(", ")"};
|
||||
const char *tagClose[] = {"=-", "]-", "[-", "{-", "}-", "]>", "[>", "-]", "-[", "-}", "-{", "]]", "]", "}", "[", "{", ">", "<", "-", "|", "=", "+", ")", "("};
|
||||
|
||||
int index, fieldStart, fieldStop, i;
|
||||
int length = strlen (buffer); // get length of string
|
||||
|
|
|
|||
|
|
@ -869,7 +869,7 @@ WeaponSelectEnd:
|
|||
{
|
||||
if (distance >= 750.0f && !IsShieldDrawn ())
|
||||
pev->button |= IN_ATTACK2; // draw the shield
|
||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && (m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable(m_enemy)))
|
||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && ((m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable(m_enemy))))
|
||||
pev->button |= IN_ATTACK2; // draw out the shield
|
||||
|
||||
m_shieldCheckTime = GetWorldTime () + 1.0f;
|
||||
|
|
|
|||
|
|
@ -2206,9 +2206,6 @@ void StartFrame (void)
|
|||
}
|
||||
bots.CalculatePingOffsets ();
|
||||
|
||||
if (g_bombPlanted)
|
||||
waypoints.SetBombPosition ();
|
||||
|
||||
if (g_isMetamod)
|
||||
{
|
||||
static cvar_t *csdm_active;
|
||||
|
|
@ -3208,18 +3205,23 @@ void ConVarWrapper::PushRegisteredConVarsToEngine (bool gameVars)
|
|||
}
|
||||
}
|
||||
|
||||
#define LINK_ENTITY(entityFunction) \
|
||||
export void entityFunction (entvars_t *pev) \
|
||||
static void LinkEntity_Helper (EntityPtr_t &entAddress, const char *name, entvars_t *pev)
|
||||
{
|
||||
// here we're see an ugliest hack :)
|
||||
if (entAddress == NULL || g_gameVersion == CSV_CZERO)
|
||||
entAddress = g_gameLib->GetFuncAddr <EntityPtr_t > (name);
|
||||
|
||||
if (entAddress == NULL)
|
||||
return;
|
||||
|
||||
entAddress (pev);
|
||||
}
|
||||
|
||||
#define LINK_ENTITY(entityName) \
|
||||
export void entityName (entvars_t *pev) \
|
||||
{ \
|
||||
static EntityPtr_t entity_addr = NULL; \
|
||||
\
|
||||
if (entity_addr == NULL) \
|
||||
entity_addr = g_gameLib->GetFuncAddr <EntityPtr_t> (#entityFunction); \
|
||||
\
|
||||
if (entity_addr == NULL) \
|
||||
return; \
|
||||
\
|
||||
(*entity_addr) (pev); \
|
||||
static EntityPtr_t addr = NULL; \
|
||||
LinkEntity_Helper (addr, #entityName, pev); \
|
||||
} \
|
||||
|
||||
// entities in counter-strike...
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ void BotManager::TouchWithKillerEntity (Bot *bot)
|
|||
MDLL_Touch (m_killerEntity, bot->GetEntity ());
|
||||
}
|
||||
|
||||
// it's already defined in interface.cpp
|
||||
extern "C" void player (entvars_t *pev);
|
||||
|
||||
void BotManager::CallGameEntity (entvars_t *vars)
|
||||
{
|
||||
// this function calls gamedll player() function, in case to create player entity in game
|
||||
|
|
@ -100,14 +103,7 @@ void BotManager::CallGameEntity (entvars_t *vars)
|
|||
CALL_GAME_ENTITY (PLID, "player", vars);
|
||||
return;
|
||||
}
|
||||
|
||||
static EntityPtr_t playerFunction = NULL;
|
||||
|
||||
if (playerFunction == NULL)
|
||||
playerFunction = g_gameLib->GetFuncAddr <EntityPtr_t> ("player");
|
||||
|
||||
if (playerFunction != NULL)
|
||||
(*playerFunction) (vars);
|
||||
player (vars);
|
||||
}
|
||||
|
||||
int BotManager::CreateBot (const String &name, int difficulty, int personality, int team, int member)
|
||||
|
|
@ -851,7 +847,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
char rejectReason[128];
|
||||
int clientIndex = IndexOfEntity (bot);
|
||||
|
||||
memset (this, 0, sizeof (*this));
|
||||
memset (reinterpret_cast <void *> (this), 0, sizeof (*this));
|
||||
|
||||
pev = &bot->v;
|
||||
|
||||
|
|
@ -1477,8 +1473,14 @@ void BotManager::UpdateActiveGrenades (void)
|
|||
|
||||
// search the map for any type of grenade
|
||||
while (!IsEntityNull (grenade = FIND_ENTITY_BY_CLASSNAME (grenade, "grenade")))
|
||||
{
|
||||
// do not count c4 as a grenade
|
||||
if (strcmp (STRING (grenade->v.model) + 9, "c4.mdl") == 0)
|
||||
continue;
|
||||
|
||||
m_activeGrenades.Push (grenade);
|
||||
}
|
||||
}
|
||||
|
||||
const Array <entity_t> &BotManager::GetActiveGrenades (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1565,7 +1565,7 @@ void Waypoint::Think (void)
|
|||
float distance = (m_paths[i]->origin - g_hostEntity->v.origin).GetLength ();
|
||||
|
||||
// check if waypoint is whitin a distance, and is visible
|
||||
if (distance < 1024.0f && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 512.0f))
|
||||
if (distance < 512.0f && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 128.0f))
|
||||
{
|
||||
// check the distance
|
||||
if (distance < nearestDistance)
|
||||
|
|
@ -1574,7 +1574,7 @@ void Waypoint::Think (void)
|
|||
nearestDistance = distance;
|
||||
}
|
||||
|
||||
if (m_waypointDisplayTime[i] + 1.0f < GetWorldTime ())
|
||||
if (m_waypointDisplayTime[i] + 0.8f < GetWorldTime ())
|
||||
{
|
||||
float nodeHeight = 0.0f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue