combat: use scale for selecting new enemy

linkage: display hw renderer as game flags
linkage: display running engine (hl25) as game flags
This commit is contained in:
jeefo 2023-11-29 22:34:45 +03:00
commit f3a4fb5a8b
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
4 changed files with 37 additions and 9 deletions

@ -1 +1 @@
Subproject commit 7179ca3e4f1bc72620d9ef76a9cf67e59ce76120 Subproject commit 5767ac6bd530cebd257747835361456f4a40d567

View file

@ -45,7 +45,10 @@ CR_DECLARE_SCOPED_ENUM (GameFlags,
FreeForAll = cr::bit (8), // csdm mod with ffa mode FreeForAll = cr::bit (8), // csdm mod with ffa mode
ReGameDLL = cr::bit (9), // server dll is a regamedll ReGameDLL = cr::bit (9), // server dll is a regamedll
HasFakePings = cr::bit (10), // on that game version we can fake bots pings HasFakePings = cr::bit (10), // on that game version we can fake bots pings
HasBotVoice = cr::bit (11) // on that game version we can use chatter HasBotVoice = cr::bit (11), // on that game version we can use chatter
SwRenderer = cr::bit (12), // game runs with software renderer
HwRenderer = cr::bit (13), // games runs with hardware renderer
AnniversaryHL25 = cr::bit (14) // half-life 25th anniversary engine
) )
// defines map type // defines map type

View file

@ -284,7 +284,7 @@ bool Bot::lookupEnemies () {
} }
// check the engine PVS // check the engine PVS
if (!frustum.check (m_viewFrustum, interesting) || !game.checkVisibility (interesting, set)) { if (!game.checkVisibility (interesting, set)) {
continue; continue;
} }
@ -310,7 +310,7 @@ bool Bot::lookupEnemies () {
player = client.ent; player = client.ent;
// check the engine PVS // check the engine PVS
if (!frustum.check (m_viewFrustum, player) || !game.checkVisibility (player, set)) { if (!game.checkVisibility (player, set)) {
continue; continue;
} }
@ -322,7 +322,7 @@ bool Bot::lookupEnemies () {
} }
const float distanceSq = player->v.origin.distanceSq (pev->origin); const float distanceSq = player->v.origin.distanceSq (pev->origin);
if (distanceSq < nearestDistanceSq) { if (distanceSq * 0.7f < nearestDistanceSq) {
nearestDistanceSq = distanceSq; nearestDistanceSq = distanceSq;
newEnemy = player; newEnemy = player;
@ -333,7 +333,7 @@ bool Bot::lookupEnemies () {
} }
} }
} }
m_enemyUpdateTime = game.time () + (usesKnife () ? 1.0f : 0.75f); m_enemyUpdateTime = game.time () + (usesKnife () ? 1.0f : 0.5f);
if (game.isNullEntity (newEnemy) && !game.isNullEntity (shieldEnemy)) { if (game.isNullEntity (newEnemy) && !game.isNullEntity (shieldEnemy)) {
newEnemy = shieldEnemy; newEnemy = shieldEnemy;

View file

@ -333,7 +333,7 @@ void Game::registerEngineCommand (const char *command, void func ()) {
// pointed to by "function" in order to handle it. // pointed to by "function" in order to handle it.
// check for hl pre 1.1.0.4, as it's doesn't have pfnAddServerCommand // check for hl pre 1.1.0.4, as it's doesn't have pfnAddServerCommand
if (!plat.checkPointer (engfuncs.pfnAddServerCommand)) { if (!plat.isValidPtr (engfuncs.pfnAddServerCommand)) {
logger.fatal ("%s's minimum HL engine version is 1.1.0.4 and minimum Counter-Strike is Beta 6.5. Please update your engine / game version.", product.name); logger.fatal ("%s's minimum HL engine version is 1.1.0.4 and minimum Counter-Strike is Beta 6.5. Please update your engine / game version.", product.name);
} }
engfuncs.pfnAddServerCommand (const_cast <char *> (command), func); engfuncs.pfnAddServerCommand (const_cast <char *> (command), func);
@ -848,6 +848,19 @@ bool Game::postload () {
}); });
} }
// setup flags
if (game.isSoftwareRenderer ()) {
m_gameFlags |= GameFlags::SwRenderer;
}
else {
m_gameFlags |= GameFlags::SwRenderer;
}
// is 25th anniversary
if (game.is25thAnniversaryUpdate ()) {
m_gameFlags |= GameFlags::AnniversaryHL25;
}
// initialize weapons // initialize weapons
conf.initWeapons (); conf.initWeapons ();
@ -1048,6 +1061,18 @@ void Game::printBotVersion () {
botRuntimeFlags.push ("Metamod"); botRuntimeFlags.push ("Metamod");
} }
if (is (GameFlags::AnniversaryHL25)) {
botRuntimeFlags.push ("HL25");
}
if (is (GameFlags::SwRenderer)) {
botRuntimeFlags.push ("SWR");
}
if (is (GameFlags::HwRenderer)) {
botRuntimeFlags.push ("HWR");
}
// print if we're using sse 4.x instructions // print if we're using sse 4.x instructions
if (cpuflags.sse41 || cpuflags.sse42 || cpuflags.neon) { if (cpuflags.sse41 || cpuflags.sse42 || cpuflags.neon) {
Array <String> simdLevels {}; Array <String> simdLevels {};
@ -1232,8 +1257,8 @@ float LightMeasure::getLightLevel (const Vector &point) {
// it's depends if we're are on dedicated or on listenserver // it's depends if we're are on dedicated or on listenserver
auto recursiveCheck = [&] () -> bool { auto recursiveCheck = [&] () -> bool {
if (!game.isSoftwareRenderer ()) { if (!game.is (GameFlags::SwRenderer)) {
if (game.is25thAnniversaryUpdate ()) { if (game.is (GameFlags::AnniversaryHL25)) {
return recursiveLightPoint <msurface_hw_25anniversary_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint); return recursiveLightPoint <msurface_hw_25anniversary_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint);
} }
return recursiveLightPoint <msurface_hw_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint); return recursiveLightPoint <msurface_hw_t, mnode_hw_t> (reinterpret_cast <mnode_hw_t *> (m_worldModel->nodes), point, endPoint);