Skip to content

Commit f668633

Browse files
Allow chat box in singleplayer (#2269)
### Allow chat box in singleplayer - In vanilla, the in-game chat box is disabled in singleplayer scenarios. You can now enable it by setting `[General] -> AllowChatBoxInSinglePlayer` to true. - `AllowChatBoxInSinglePlayer` controls whether the chat box is available in singleplayer mode. Defaults to `false`. In `rulesmd.ini`: ```ini [General] AllowChatBoxInSinglePlayer=false ; boolean ``` --------- Co-authored-by: Noble Fish <89088785+DeathFishAtEase@users.noreply.github.com> Co-authored-by: Noble_Fish <1065703286@qq.com>
1 parent 3bc76ba commit f668633

10 files changed

Lines changed: 72 additions & 0 deletions

File tree

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ This page lists all the individual contributions to the project by their author.
815815
- Framework for dynamic sight
816816
- Fix voxel projectile and animation lighting issues
817817
- Export interface for external call
818+
- Allow chat box in singleplayer
818819
- **solar-III (凤九歌)**
819820
- Target scanning delay customization (documentation)
820821
- Skip target scanning function calling for unarmed technos (documentation)

Phobos.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
<ClCompile Include="src\Misc\Hooks.INIInheritance.cpp" />
233233
<ClCompile Include="src\Misc\Hooks.LaserDraw.cpp" />
234234
<ClCompile Include="src\Misc\Hooks.LightEffects.cpp" />
235+
<ClCompile Include="src\Misc\Hooks.MessageList.cpp" />
235236
<ClCompile Include="src\Misc\Hooks.Overlay.cpp" />
236237
<ClCompile Include="src\Misc\Hooks.PCX.cpp" />
237238
<ClCompile Include="src\Misc\Hooks.Timers.cpp" />

docs/User-Interface.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ IngameScore.LoseTheme= ; Soundtrack theme ID
3030

3131
## Battle screen UI/UX
3232

33+
### Allow chat box in singleplayer
34+
35+
- In vanilla, the in-game chat box is disabled in singleplayer scenarios. You can now enable it by setting `[General] -> AllowChatBoxInSinglePlayer` to true.
36+
37+
In `rulesmd.ini`:
38+
```ini
39+
[General]
40+
AllowChatBoxInSinglePlayer=false ; boolean
41+
```
42+
3343
### Allow draw SuperWeapon timer as percentage
3444

3545
- Superweapon cd timer can now draw as percentage.

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ HideShakeEffects=false ; boolean
598598
- [Customizable Berzerk mission](Fixed-or-Improved-Logics.md#enhanced-berzerk-behavior) (by TaranDahl)
599599
- [Tank Bunker foundation and state update delay improvements](Fixed-or-Improved-Logics.md#tank-bunker-improvements) (by Starkku)
600600
- [Custom cruise missiles](New-or-Enhanced-Logics.md#custom-cruise-missiles) (by Noble_Fish)
601+
- [Allow chat box in singleplayer](User-Interface.md#allow-chat-box-in-singleplayer) (by TaranDahl)
601602
602603
#### Vanilla fixes:
603604
- Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya)

docs/locale/zh_CN/LC_MESSAGES/CREDITS.po

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,9 @@ msgstr "修复了 Voxel 抛射体和动画的光照问题"
27582758
msgid "Export interface for external call"
27592759
msgstr "用于外部调用的导出接口"
27602760

2761+
msgid "Allow chat box in singleplayer"
2762+
msgstr "允许在单人模式使用聊天框"
2763+
27612764
msgid "**solar-III (凤九歌)**"
27622765
msgstr "**solar-III(凤九歌)**"
27632766

docs/locale/zh_CN/LC_MESSAGES/User-Interface.po

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ msgstr "在 `rulesmd.ini`:"
104104
msgid "Battle screen UI/UX"
105105
msgstr "战斗界面 UI/UX"
106106

107+
msgid "Allow chat box in singleplayer"
108+
msgstr "允许在单人模式使用聊天框"
109+
110+
msgid ""
111+
"In vanilla, the in-game chat box is disabled in singleplayer scenarios. "
112+
"You can now enable it by setting `[General] -> "
113+
"AllowChatBoxInSinglePlayer` to true."
114+
msgstr ""
115+
"原版中,游戏内聊天框在单人模式下被禁用。现在可以将 `[General] -> "
116+
"AllowChatBoxInSinglePlayer` 设为 `true` 来启用。"
117+
107118
msgid "Allow draw SuperWeapon timer as percentage"
108119
msgstr "允许以百分比形式绘制超武计时器"
109120

docs/locale/zh_CN/LC_MESSAGES/Whats-New.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,11 @@ msgid ""
20522052
msgstr ""
20532053
"[坦克碉堡面积和状态更新间隔改进](Fixed-or-Improved-Logics.md#tank-bunker-improvements) (by Starkku)"
20542054

2055+
msgid ""
2056+
"[Allow chat box in singleplayer](User-Interface.md#allow-chat-box-in-"
2057+
"singleplayer) (by TaranDahl)"
2058+
msgstr "[允许在单人模式使用聊天框](User-Interface.md#allow-chat-box-in-singleplayer)(by TaranDahl)"
2059+
20552060
msgid "Vanilla fixes:"
20562061
msgstr "原版问题修复:"
20572062

src/Ext/Rules/Body.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
445445

446446
this->BunkerStateUpdateDelay.Read(exINI, GameStrings::General, "BunkerStateUpdateDelay");
447447

448+
this->AllowChatBoxInSinglePlayer.Read(exINI, GameStrings::General, "AllowChatBoxInSinglePlayer");
449+
448450
// Section AITargetTypes
449451
int itemsCount = pINI->GetKeyCount("AITargetTypes");
450452
for (int i = 0; i < itemsCount; ++i)
@@ -790,6 +792,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
790792
.Process(this->TeamDelays_Count)
791793
.Process(this->BerzerkMission)
792794
.Process(this->BunkerStateUpdateDelay)
795+
.Process(this->AllowChatBoxInSinglePlayer)
793796
;
794797
}
795798

src/Ext/Rules/Body.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ class RulesExt
376376

377377
Valueable<int> BunkerStateUpdateDelay;
378378

379+
Valueable<bool> AllowChatBoxInSinglePlayer;
380+
379381
ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
380382
, Storage_TiberiumIndex { -1 }
381383
, HarvesterDumpAmount { 0.0f }
@@ -690,6 +692,8 @@ class RulesExt
690692
, BerzerkMission { Mission::Hunt }
691693

692694
, BunkerStateUpdateDelay { 15 }
695+
696+
, AllowChatBoxInSinglePlayer { false }
693697
{ }
694698

695699
virtual ~ExtData() = default;

src/Misc/Hooks.MessageList.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <Ext/Rules/Body.h>
2+
3+
DEFINE_HOOK(0x55E477, Game_ComScenarioDialog_ChatBox, 0x5)
4+
{
5+
if (RulesExt::Global()->AllowChatBoxInSinglePlayer)
6+
return 0x55E48D;
7+
8+
return 0;
9+
}
10+
11+
DEFINE_HOOK(0x55E62F, Game_ComScenarioDialog_ChatBox2, 0x6)
12+
{
13+
if (RulesExt::Global()->AllowChatBoxInSinglePlayer)
14+
return 0x55E637;
15+
16+
return 0;
17+
}
18+
19+
DEFINE_HOOK(0x55E693, Game_ComScenarioDialog_ChatBox3, 0x6)
20+
{
21+
if (RulesExt::Global()->AllowChatBoxInSinglePlayer)
22+
return 0x55E69B;
23+
24+
return 0;
25+
}
26+
27+
DEFINE_HOOK(0x55E746, Game_ComScenarioDialog_ChatBox4, 0x5)
28+
{
29+
if (RulesExt::Global()->AllowChatBoxInSinglePlayer)
30+
return 0x55E77B;
31+
32+
return 0;
33+
}

0 commit comments

Comments
 (0)