L L4D2node

CTerrorPlayer::UpdateSpeechIdle

0x009fbc30 · 576 bytes · __thiscall

_ZN13CTerrorPlayer16UpdateSpeechIdleEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateSpeechIdle() */

void __thiscall CTerrorPlayer::UpdateSpeechIdle(CTerrorPlayer *this)

{
  float fVar1;
  float fVar2;
  code *pcVar3;
  char cVar4;
  int iVar5;
  undefined4 uVar6;
  longdouble lVar7;
  float fVar8;
  CAI_Concept local_24 [20];
  
  fVar8 = *(float *)(gpGlobals + 0xc);
  if (sm_fNextRemarkPollTime < fVar8) {
    if (sm_nNextRemarkPollCharacter != *(int *)(this + 0x2ba0)) {
      iVar5 = GetPlayerByCharacter(sm_nNextRemarkPollCharacter);
      if (iVar5 != 0) goto LAB_009fbc70;
      fVar8 = *(float *)(gpGlobals + 0xc);
    }
    sm_fNextRemarkPollTime = fVar8 + 0.25;
    sm_nNextRemarkPollCharacter = (sm_nNextRemarkPollCharacter + 1) % 4;
    cVar4 = UpdateSpeechRemarkUponWorld(this);
    if (cVar4 != '\0') {
      if (*(int *)(chet_debug_idle._28_4_ + 0x30) == 0) {
        return;
      }
      uVar6 = SurvivorCharacterName(*(undefined4 *)(this + 0x2ba0));
      Msg("TLK_IDLE: %s is remarking; will not idle\n",uVar6);
      return;
    }
  }
LAB_009fbc70:
  if (*(int *)(AI_TalkIdleEnabled._28_4_ + 0x30) != 0) {
    if (*(int *)(chet_debug_idle._28_4_ + 0x30) == 2) {
      fVar8 = *(float *)(this + 0x30b0);
      fVar1 = *(float *)(gpGlobals + 0xc);
      lVar7 = (longdouble)CountdownTimer::Now();
      fVar2 = *(float *)(this + 0x30a0);
      uVar6 = SurvivorCharacterName(*(undefined4 *)(this + 0x2ba0));
      Msg("TLK_IDLE: %s : vocalizetimer(%d), timeToNextVoc(%.1f)\n",uVar6,fVar2 <= (float)lVar7,
          (double)(fVar8 - fVar1));
    }
    lVar7 = (longdouble)CountdownTimer::Now();
    if ((*(float *)(this + 0x30a0) <= (float)lVar7) &&
       (*(float *)(this + 0x30b0) <= *(float *)(gpGlobals + 0xc) &&
        *(float *)(gpGlobals + 0xc) != *(float *)(this + 0x30b0))) {
      if (*(int *)(chet_debug_idle._28_4_ + 0x30) != 0) {
        uVar6 = SurvivorCharacterName(*(undefined4 *)(this + 0x2ba0));
        Msg("TLK_IDLE: %s will SpeakIfAllowed\n",uVar6);
      }
      pcVar3 = *(code **)(*(int *)this + 0x7b4);
      CAI_Concept::CAI_Concept(local_24,"TLK_IDLE");
      (*pcVar3)(this,local_24,0,0,0,0,0);
      fVar8 = *(float *)(gpGlobals + 0xc);
      lVar7 = (longdouble)RandomFloat(0xc0000000,0x40000000);
      *(float *)(this + 0x30b0) = fVar8 + 10.0 + (float)lVar7;
    }
  }
  return;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)