CSceneEntity::DispatchStartSpeak
0x00816860 · 2753 bytes · __thiscall
_ZN12CSceneEntity18DispatchStartSpeakEP12CChoreoSceneP9CBaseFlexP12CChoreoEvent12soundlevel_t
Decompiled
undefined (5 params)
/* CSceneEntity::DispatchStartSpeak(CChoreoScene*, CBaseFlex*, CChoreoEvent*, soundlevel_t) */
void __thiscall
CSceneEntity::DispatchStartSpeak
(CSceneEntity *this,CChoreoScene *param_1,CBaseFlex *param_2,CChoreoEvent *param_3,
undefined4 param_5)
{
float fVar1;
CBaseEntity *this_00;
bool bVar2;
char cVar3;
int iVar4;
int iVar5;
int iVar6;
int *piVar7;
float *pfVar8;
CBasePlayer *pCVar9;
char *pcVar10;
uint uVar11;
undefined *puVar12;
CBaseEntity *this_01;
uint uVar13;
int iVar14;
float *pfVar15;
int in_GS_OFFSET;
longdouble lVar16;
longdouble lVar17;
longdouble lVar18;
float fVar19;
int local_3f8;
int local_3f4;
undefined **local_3e4 [8];
undefined **local_3c4;
undefined4 local_3c0;
undefined4 local_3bc;
undefined4 local_3a4;
char *local_3a0;
undefined4 local_39c;
undefined4 local_398;
uint local_394;
int local_390;
undefined4 local_38c;
float local_388;
undefined4 local_384;
undefined1 local_380;
undefined1 local_37f;
undefined1 local_37e;
undefined4 local_37c;
undefined4 local_378;
undefined4 local_374;
undefined4 local_370;
undefined4 local_36c;
undefined4 local_368;
undefined2 local_364;
char local_360 [64];
char local_320 [256];
char local_220 [512];
int local_20;
piVar7 = (int *)&stack0xfffffbe4;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_2 == (CBaseFlex *)0x0) goto LAB_00816eaf;
(**(code **)(*(int *)param_2 + 0x28c))();
CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_3e4);
local_3e4[0] = &PTR__CPASFilter_00bfaf28;
/* try { // try from 008168e3 to 008168e7 has its CatchHandler @ 008172ce */
CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_3e4,(Vector *)&local_3a4);
local_3e4[0] = &PTR__CPASAttenuationFilter_00c08ec8;
/* try { // try from 00816907 to 0081692f has its CatchHandler @ 008172cc */
(**(code **)(*(int *)param_2 + 0x28c))();
piVar7 = (int *)&stack0xfffffbdc;
CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_3e4,(Vector *)&local_3a4,0.8);
if (*(int *)(this + 0x710) != 0) {
/* try { // try from 00816947 to 00816ab8 has its CatchHandler @ 008172aa */
local_3f8 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3e4);
iVar4 = (**(code **)(**(int **)(this + 0x710) + 0x10))();
local_3f8 = local_3f8 + -1;
if (-1 < local_3f8) {
LAB_00816970:
do {
iVar5 = CRecipientFilter::GetRecipientIndex((CRecipientFilter *)local_3e4,local_3f8);
if (0 < iVar4) {
iVar14 = 0;
do {
iVar6 = (**(code **)(**(int **)(this + 0x710) + 0x14))();
if (iVar5 == iVar6) {
local_3f8 = local_3f8 + -1;
if (local_3f8 == -1) goto LAB_008169d5;
goto LAB_00816970;
}
iVar14 = iVar14 + 1;
} while (iVar14 != iVar4);
}
/* try { // try from 00816e0d to 00816e11 has its CatchHandler @ 008172aa */
CRecipientFilter::RemoveRecipientByPlayerIndex((int)local_3e4);
local_3f8 = local_3f8 + -1;
} while (local_3f8 != -1);
}
}
LAB_008169d5:
fVar19 = *(float *)(this + 0x49c);
lVar16 = (longdouble)CChoreoEvent::GetStartTime(param_3);
fVar1 = *(float *)(gpGlobals + 0xc);
if (this[0x6f8] != (CSceneEntity)0x0) {
/* try { // try from 00816ed0 to 00816f06 has its CatchHandler @ 008172aa */
CChoreoEvent::GetParameters(param_3);
GetSceneManager();
CSceneManager::QueueRestoredSound();
local_3e4[0] = &PTR__CPASFilter_00bfaf28;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_3e4);
goto LAB_00816eaf;
}
lVar17 = (longdouble)(*(code *)**(undefined4 **)param_3)();
cVar3 = (**(code **)(*(int *)param_2 + 0x140))();
if (cVar3 != '\0') {
lVar18 = (longdouble)(**(code **)(*(int *)this + 0x3d8))();
piVar7 = (int *)CBaseEntity::MyNPCPointer();
cVar3 = (**(code **)(*piVar7 + 0x6e8))();
pfVar15 = (float *)&g_AIFriendliesTalkSemaphore;
if (cVar3 == '\0') {
pfVar15 = (float *)&g_AIFoesTalkSemaphore;
}
*pfVar15 = (*(float *)(gpGlobals + 0xc) - (fVar19 - (float)lVar16)) + (float)lVar17 +
(float)lVar18;
pfVar8 = (float *)(**(code **)(*(int *)param_2 + 0xc))();
pfVar15[1] = *pfVar8;
}
local_388 = 0.0;
local_3a0 = (char *)0x0;
local_39c = 0x3f800000;
local_394 = 0;
local_398 = param_5;
local_390 = 100;
local_38c = 0;
local_384 = 0;
local_380 = 1;
local_37f = 0;
local_37e = 0;
local_37c = 0xffffffff;
local_378 = 0;
local_374 = 0;
local_370 = 0;
local_36c = 0;
local_368 = 0;
local_364 = 0xffff;
local_3a4 = 2;
if (*(int *)(gpGlobals + 0x14) == 1) {
local_388 = fVar1 - (fVar19 - (float)lVar16);
}
/* try { // try from 00816b9b to 00816bd6 has its CatchHandler @ 008172d7 */
cVar3 = CChoreoScene::ShouldIgnorePhonemes(param_1);
if (cVar3 != '\0') {
local_394 = local_394 | 0x100;
}
local_380 = 0;
CRecipientFilter::RemoveSplitScreenPlayers((CRecipientFilter *)local_3e4);
iVar4 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3e4);
if (0 < iVar4) {
local_3f4 = 0;
do {
/* try { // try from 00816cbe to 00816cde has its CatchHandler @ 008172d7 */
iVar5 = CRecipientFilter::GetRecipientIndex((CRecipientFilter *)local_3e4,local_3f4);
pCVar9 = (CBasePlayer *)UTIL_PlayerByIndex(iVar5);
if (pCVar9 != (CBasePlayer *)0x0) {
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_3c4);
local_3c4 = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 00816cf6 to 00816cfa has its CatchHandler @ 008172e3 */
CRecipientFilter::AddRecipient((CRecipientFilter *)&local_3c4,pCVar9);
/* try { // try from 00816d1e to 00816dad has its CatchHandler @ 008172fb */
cVar3 = GetSoundNameForPlayer(this,param_3,pCVar9,local_220,0x200);
if (cVar3 != '\0') {
local_3a0 = local_220;
iVar5 = speechListIndex * 0x284;
(&speechListSounds)[speechListIndex * 0xa1] = *(undefined4 *)(gpGlobals + 0xc);
V_strncpy(&DAT_00ff4c64 + iVar5,local_220,0x200);
if (param_1 == (CChoreoScene *)0x0) {
pcVar10 = "";
}
else {
pcVar10 = (char *)CChoreoScene::GetFilename(param_1);
}
V_strncpy(&DAT_00ff4e64 + speechListIndex * 0x284,pcVar10,0x80);
fVar19 = *(float *)(this + 0x4a8);
iVar5 = speechListIndex + 1;
speechListIndex = 0;
if (iVar5 < 5) {
speechListIndex = iVar5;
}
if (fVar19 != 1.0) {
if (local_390 == 0) {
fVar19 = fVar19 * 100.0;
}
else {
fVar19 = (float)local_390 * fVar19;
}
local_390 = (int)fVar19;
local_394 = local_394 | 2;
}
if (*(int *)(param_2 + 0x30) == 0) {
iVar5 = 0;
}
else {
iVar5 = *(int *)(param_2 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
/* try { // try from 00816c41 to 00816c73 has its CatchHandler @ 008172fb */
CBaseEntity::EmitSound((IRecipientFilter *)&local_3c4,iVar5,(EmitSound_t *)&local_3a4);
CBaseFlex::AddSceneEvent(param_2,param_1,param_3,(CBaseEntity *)0x0,this);
}
local_3c4 = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_3c4);
}
local_3f4 = local_3f4 + 1;
} while (local_3f4 != iVar4);
}
/* try { // try from 00816e3a to 00816e68 has its CatchHandler @ 008172d7 */
iVar4 = CChoreoEvent::GetCloseCaptionType(param_3);
piVar7 = (int *)&stack0xfffffbdc;
if (iVar4 == 0) {
cVar3 = CChoreoEvent::GetPlaybackCloseCaptionToken(param_3,local_360,0x40);
piVar7 = (int *)&stack0xfffffbdc;
if (cVar3 != '\0') {
/* try { // try from 00816f5b to 008172a7 has its CatchHandler @ 008172d7 */
V_strncpy(local_320,local_360,0x100);
_V_strlower(local_320);
CBaseEntity::RemoveRecipientsIfNotCloseCaptioning((CRecipientFilter *)local_3e4);
cVar3 = CChoreoEvent::IsSuppressingCaptionAttenuation(param_3);
if ((cVar3 == '\0') &&
(iVar4 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3e4), 0 < iVar4)) {
iVar4 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3e4);
iVar4 = iVar4 + -1;
if (-1 < iVar4) {
do {
iVar5 = CRecipientFilter::GetRecipientIndex((CRecipientFilter *)local_3e4,iVar4);
this_01 = (CBaseEntity *)UTIL_PlayerByIndex(iVar5);
if (this_01 != (CBaseEntity *)0x0) {
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
local_3c4 = *(undefined ***)(this_01 + 0x2e0);
local_3c0 = *(undefined4 *)(this_01 + 0x2e4);
local_3bc = *(undefined4 *)(this_01 + 0x2e8);
cVar3 = AttenuateCaption(local_320,(Vector *)&local_3c4,(CUtlVector *)&local_378);
if (cVar3 != '\0') {
uVar11 = *(uint *)(this_01 + 0x2088);
if ((((uVar11 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar11 >> 0xc)) &&
(this_00 = *(CBaseEntity **)(puVar12 + 4), this_00 != (CBaseEntity *)0x0)) {
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
cVar3 = AttenuateCaption(local_320,(Vector *)(this_00 + 0x2e0),
(CUtlVector *)&local_378);
if (cVar3 == '\0') goto LAB_0081720a;
}
CRecipientFilter::RemoveRecipient
((CRecipientFilter *)local_3e4,(CBasePlayer *)this_01);
}
}
LAB_0081720a:
iVar4 = iVar4 + -1;
} while (iVar4 != -1);
}
}
iVar4 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3e4);
piVar7 = (int *)&stack0xfffffbdc;
if (0 < iVar4) {
lVar16 = (longdouble)CChoreoEvent::GetLastSlaveEndTime(param_3);
lVar17 = (longdouble)(*(code *)**(undefined4 **)param_3)();
lVar18 = (longdouble)CChoreoEvent::GetStartTime(param_3);
(**(code **)(*(int *)param_2 + 0x20))();
iVar4 = (**(code **)(*soundemitterbase + 0x88))();
V_strncpy(local_220,local_320,0x100);
if ((iVar4 == 0x15) || (iVar4 == 1)) {
V_strncat(local_320,"_male",0x100,-1);
LAB_00817369:
bVar2 = true;
}
else if ((iVar4 == 0x16) || (bVar2 = false, iVar4 == 2)) {
V_strncat(local_320,"_female",0x100,-1);
goto LAB_00817369;
}
local_3c4 = (undefined **)0x0;
cVar3 = GetCaptionHash(local_320,true,(uint *)&local_3c4);
if ((cVar3 != '\x01') && (bVar2)) {
/* try { // try from 00817339 to 0081739a has its CatchHandler @ 008172d7 */
cVar3 = GetCaptionHash(local_220,true,(uint *)&local_3c4);
}
piVar7 = (int *)&stack0xfffffbd8;
if ((cVar3 != '\0') &&
(cVar3 = CanEmitCaption((uint)local_3c4), piVar7 = (int *)&stack0xfffffbd8, cVar3 != '\0'
)) {
UserMessageBegin((IRecipientFilter *)local_3e4,"CloseCaption");
MessageWriteLong((int)local_3c4);
fVar19 = (float)lVar16 - (float)lVar18;
if ((float)lVar16 - (float)lVar18 <= (float)lVar17) {
fVar19 = (float)lVar17;
}
uVar13 = (uint)(fVar19 * 10.0);
uVar11 = 0xffff;
if (((int)uVar13 < 0x10000) && (uVar11 = 0, -1 < (int)uVar13)) {
uVar11 = uVar13;
}
MessageWriteUBitLong(uVar11,0xf);
MessageWriteUBitLong(0,1);
MessageEnd();
piVar7 = (int *)&stack0xfffffbd8;
}
}
}
}
*piVar7 = (int)&local_378;
local_36c = 0;
piVar7[-1] = 0x816e83;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)*piVar7);
*piVar7 = (int)&local_378;
local_368 = local_378;
piVar7[-1] = 0x816e97;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)*piVar7);
local_3e4[0] = &PTR__CPASFilter_00bfaf28;
*piVar7 = (int)local_3e4;
piVar7[-1] = 0x816eaf;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)*piVar7);
LAB_00816eaf:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
*(undefined1 **)((int)piVar7 + -4) = &LAB_008172d7;
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.