From 70f6904e2d9166c3bf76f8a0355d6e2594b6f54f Mon Sep 17 00:00:00 2001 From: Alienmario Date: Mon, 22 Dec 2025 23:30:43 +0100 Subject: [PATCH] fix output delimiter --- scripting/include/srccoop.inc | 2 -- scripting/include/srccoop/levellump.inc | 23 +++++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripting/include/srccoop.inc b/scripting/include/srccoop.inc index ee02b8a0..78da0308 100644 --- a/scripting/include/srccoop.inc +++ b/scripting/include/srccoop.inc @@ -10,7 +10,6 @@ #if defined SRCCOOP_HL2DM #define CHECK_ENGINE "HL2DM"; if (GetEngineVersion() != Engine_HL2DM) - #define OUTPUT_SEPARATOR "," #define INTRO_TIMER_HUDTEXT #define ENTPATCH_CUSTOM_NPC_MODELS @@ -59,7 +58,6 @@ #define SRCCOOP_BLACKMESA #endif #define CHECK_ENGINE "Black Mesa"; if (GetEngineVersion() != Engine_BlackMesa) - #define OUTPUT_SEPARATOR "\27" #define ENTPATCH_CUSTOM_NPC_MODELS #define ENTPATCH_UPDATE_ENEMY_MEMORY diff --git a/scripting/include/srccoop/levellump.inc b/scripting/include/srccoop/levellump.inc index 4f5798c1..b1c66896 100644 --- a/scripting/include/srccoop/levellump.inc +++ b/scripting/include/srccoop/levellump.inc @@ -27,12 +27,20 @@ enum struct CEntityOutputLump float m_flDelay; int m_iTimesToFire; + char m_szDelimiter[2]; + bool LoadFromEntityKeyLump(const CEntityKeyLump pEntityKeyLump) { char buffers[5][MAX_VALUE]; - if (sizeof(buffers) != ExplodeString(pEntityKeyLump.m_szValue, OUTPUT_SEPARATOR, buffers, sizeof(buffers), sizeof(buffers[]))) + + this.m_szDelimiter = "\27"; // 'ESC' + if (sizeof(buffers) != ExplodeString(pEntityKeyLump.m_szValue, this.m_szDelimiter, buffers, sizeof(buffers), sizeof(buffers[]))) { - return false; + this.m_szDelimiter = ","; + if (sizeof(buffers) != ExplodeString(pEntityKeyLump.m_szValue, this.m_szDelimiter, buffers, sizeof(buffers), sizeof(buffers[]))) + { + return false; + } } if (!StringToFloatEx(buffers[3], this.m_flDelay)) { @@ -50,11 +58,14 @@ enum struct CEntityOutputLump void SaveToEntityKeyLump(CEntityKeyLump pEntityKeyLump) { + if (this.m_szDelimiter[0] == EOS) + this.m_szDelimiter = "\27"; // default to 'ESC' + FormatEx(pEntityKeyLump.m_szValue, sizeof(pEntityKeyLump.m_szValue), "%s%s%s%s%s%s%.2f%s%d", - this.m_szTargetEntity, OUTPUT_SEPARATOR, - this.m_szInputName, OUTPUT_SEPARATOR, - this.m_szParameter, OUTPUT_SEPARATOR, - this.m_flDelay, OUTPUT_SEPARATOR, + this.m_szTargetEntity, this.m_szDelimiter, + this.m_szInputName, this.m_szDelimiter, + this.m_szParameter, this.m_szDelimiter, + this.m_flDelay, this.m_szDelimiter, this.m_iTimesToFire); }