From 47fefabe663a4b844f9b4c96507e5f3e08e1ea08 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 11 May 2019 15:28:13 +0300 Subject: [PATCH] Fixed shaky-camera, when bot gets killed. Make use short bot name here and there. Minor tweaks. --- include/resource.h | 1 + source/basecode.cpp | 2 +- source/combat.cpp | 7 +++++++ source/globals.cpp | 2 +- source/support.cpp | 6 +++--- source/waypoint.cpp | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/resource.h b/include/resource.h index 6e9db7f..0803482 100644 --- a/include/resource.h +++ b/include/resource.h @@ -11,6 +11,7 @@ // general product information #define PRODUCT_NAME "Yet Another POD-Bot" +#define PRODUCT_SHORT_NAME "YaPB" #define PRODUCT_VERSION "2.10" #define PRODUCT_AUTHOR "YaPB Dev Team" #define PRODUCT_URL "https://yapb.ru/" diff --git a/source/basecode.cpp b/source/basecode.cpp index eb7a460..634a809 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -2917,7 +2917,7 @@ void Bot::framePeriodic (void) { // skip some frames m_thinkFps = engine.timebase () + m_thinkInterval; } - else { + else if (m_notKilled) { processLookAngles (); } } diff --git a/source/combat.cpp b/source/combat.cpp index 9a1e455..b1df487 100644 --- a/source/combat.cpp +++ b/source/combat.cpp @@ -429,9 +429,16 @@ const Vector &Bot::getEnemyBodyOffset (void) { if ((m_visibility & VISIBLE_BODY) && !usesSniper () && distance > (m_difficulty > 2 ? 2000.0f : 1000.0f)) { m_visibility &= ~VISIBLE_HEAD; } + + // do not aim at head while close enough to enemy and having sniper else if (distance < 800.0f && usesSniper ()) { m_visibility &= ~VISIBLE_HEAD; } + + // do not aim at head while enemy is soooo close enough to enemy when recoil aims at head automatically + else if (distance < MAX_SPRAY_DISTANCE) { + m_visibility &= ~VISIBLE_HEAD; + } Vector aimPos = m_enemy->v.origin; if (m_difficulty > 2 && !(m_visibility & VISIBLE_OTHER)) { diff --git a/source/globals.cpp b/source/globals.cpp index e87fd8c..398afb2 100644 --- a/source/globals.cpp +++ b/source/globals.cpp @@ -71,7 +71,7 @@ int *g_weaponPrefs[] = {g_normalWeaponPrefs, g_rusherWeaponPrefs, g_carefulWeapo // metamod plugin information plugin_info_t Plugin_info = { META_INTERFACE_VERSION, // interface version - PRODUCT_NAME, // plugin name + PRODUCT_SHORT_NAME, // plugin name PRODUCT_VERSION, // plugin version PRODUCT_DATE, // date of creation PRODUCT_AUTHOR, // plugin author diff --git a/source/support.cpp b/source/support.cpp index 2d8ad60..8d0a31b 100644 --- a/source/support.cpp +++ b/source/support.cpp @@ -507,7 +507,7 @@ void checkWelcome (void) { if (!(g_gameFlags & (GAME_MOBILITY | GAME_XASH_ENGINE))) { engine.execCmd ("speak \"%s\"", sentences.random ().chars ()); } - engine.chatPrint ("----- %s v%s (Build: %u), {%s}, (c) %s, by %s (%s)-----", PRODUCT_NAME, PRODUCT_VERSION, buildNumber (), PRODUCT_DATE, PRODUCT_END_YEAR, PRODUCT_AUTHOR, PRODUCT_URL); + engine.chatPrint ("----- %s v%s (Build: %u), {%s}, (c) %s, by %s (%s)-----", PRODUCT_SHORT_NAME, PRODUCT_VERSION, buildNumber (), PRODUCT_DATE, PRODUCT_END_YEAR, PRODUCT_AUTHOR, PRODUCT_URL); MessageWriter (MSG_ONE, SVC_TEMPENTITY, Vector::null (), g_hostEntity) .writeByte (TE_TEXTMESSAGE) @@ -527,7 +527,7 @@ void checkWelcome (void) { .writeShort (MessageWriter::fu16 (2.0f, 1 << 8)) .writeShort (MessageWriter::fu16 (6.0f, 1 << 8)) .writeShort (MessageWriter::fu16 (0.1f, 1 << 8)) - .writeString (format ("\nServer is running YaPB v%s (Build: %u)\nDeveloped by %s\n\n%s", PRODUCT_VERSION, buildNumber (), PRODUCT_AUTHOR, waypoints.getAuthor ())); + .writeString (format ("\nServer is running %s v%s (Build: %u)\nDeveloped by %s\n\n%s", PRODUCT_SHORT_NAME, PRODUCT_VERSION, buildNumber (), PRODUCT_AUTHOR, waypoints.getAuthor ())); receiveTime = 0.0; messageSent = true; @@ -594,7 +594,7 @@ void logEntry (bool outputToConsole, int logLevel, const char *format, ...) { time_t tickTime = time (&tickTime); tm *time = localtime (&tickTime); - fp.writeFormat ("%02d:%02d:%02d --> %s%s", time->tm_hour, time->tm_min, time->tm_sec, levelString, buffer); + fp.writeFormat ("%02d:%02d:%02d --> %s%s\n", time->tm_hour, time->tm_min, time->tm_sec, levelString, buffer); fp.close (); if (logLevel == LL_FATAL) { diff --git a/source/waypoint.cpp b/source/waypoint.cpp index 40e1e68..8df7549 100644 --- a/source/waypoint.cpp +++ b/source/waypoint.cpp @@ -2809,7 +2809,7 @@ WaypointDownloadError Waypoint::downloadWaypoint (void) { } String request; - request.format ("GET /wpdb/%s.pwf HTTP/1.0\r\nAccept: */*\r\nUser-Agent: YaPB/%s\r\nHost: %s\r\n\r\n", engine.getMapName (), PRODUCT_VERSION, yb_waypoint_autodl_host.str ()); + request.format ("GET /wpdb/%s.pwf HTTP/1.0\r\nAccept: */*\r\nUser-Agent: %s/%s\r\nHost: %s\r\n\r\n", engine.getMapName (), PRODUCT_SHORT_NAME, PRODUCT_VERSION, yb_waypoint_autodl_host.str ()); if (send (socketHandle, request.chars (), static_cast (request.length () + 1), 0) < 1) { closeSocket (socketHandle);