-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds option to disable in-game chat (#30)
Addresses issue #7 Adds option to disable in-game chat. If `DisableChat=True`, the player cannot send or receive messages from others. The option can be set in spawn.ini (under "Settings" section) and RA2MD.ini (under "Options" section). Enabling the option in spawn.ini overrides the setting in RA2MD.ini even if explicitly set to `False`.
- Loading branch information
Showing
12 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define countof(x) sizeof(x)/sizeof(*x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%include "macros/patch.inc" | ||
%include "macros/datatypes.inc" | ||
|
||
cextern DisableChat | ||
|
||
; Don't send message to others. | ||
hack 0x0055EF38, 0x0055EF3E | ||
cmp byte[DisableChat], 0 | ||
jz .Reg | ||
jmp 0x0055F056 | ||
|
||
.Reg: | ||
cmp edi, ebx | ||
mov dword[esp + 0x14], ebx | ||
jmp hackend | ||
|
||
; After receiving message, don't play sound if AddMessage returns NULL. | ||
hack 0x0048D97E | ||
cmp eax, 0 | ||
je 0x0048D99A | ||
|
||
.Reg: | ||
mov eax, [0x008871E0] | ||
jmp hackend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <wchar.h> | ||
|
||
#include "HouseClass.h" | ||
#include "RA.h" | ||
#include "macros/patch.h" | ||
|
||
CALL(0x48d979, _fake_MessageListClass__Add_Message); | ||
CALL(0x55f0f5, _fake_MessageListClass__Add_Message); | ||
|
||
bool DisableChat = false; | ||
|
||
void *__thiscall fake_MessageListClass__Add_Message(MessageListClass *this, | ||
const wchar_t *Name, | ||
int ID, | ||
const wchar_t *message, | ||
int color, | ||
int32_t PrintType, | ||
int32_t duration, | ||
bool SinglePlayer) | ||
{ | ||
if (!DisableChat || Name == NULL) | ||
{ | ||
return MessageListClass__Add_Message(this, Name, ID, message, color, PrintType, duration, SinglePlayer); | ||
} | ||
|
||
if (wcsicmp(Name, PlayerPtr->UIName) == 0) | ||
{ | ||
return MessageListClass__Add_Message(this, 0, 0, L"Chat is disabled. Message not sent.", 4, 0x4096, 270, 1); | ||
} | ||
|
||
/* Base case. Don't display incoming player messages. */ | ||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters