Results 1 to 10 of 33

Thread: Fire direction/angles

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Tally View Post
    Not sure if you can use setTargetEnt() in COD2 MP, but in COD4...
    setEntTarget() is CoD4 only, you can use Tally's code, but you need to set the origin of the hud every frame to the players origin (this looks abit laggy though)

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    setEntTarget() is CoD4 only, you can use Tally's code, but you need to set the origin of the hud every frame to the players origin (this looks abit laggy though)
    No, it's in COD2 for sure but it must be Single Player only.

  3. The Following User Says Thank You to Tally For This Useful Post:

    serthy (11th June 2015)

  4. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by Tally View Post
    No, it's in COD2 for sure but it must be Single Player only.
    Indeed, it is only available in SP. But it might be possible to port it to MP.
    Edit: isn't in SP either. I posted the wrong function.. (for turret).

    COD4
    PHP Code:
    int __cdecl sub_808F8EA(int a1)
    {
      
    int *v1// ebx@2
      
    int result// eax@3
      
    char v3// [sp+8h] [bp-10h]@0

      
    if ( HIWORD(a1) == )
      {
        
    v1 = &dword_8335620[43 * (unsigned __int16)a1];
      }
      else
      {
        
    sub_815F134("not a hud element");
        
    v1 0;
      }
      
    result sub_80C76EC(0);
      
    v1[4] = *(_DWORD *)result;
      if ( !(*(
    _BYTE *)(result 246) & 0x10) )
        
    result sub_81228D4(
                   
    15,
                   
    "SetTargetEnt() called on a non-broadcasting entity, may not show in client snapshots.",
                   
    v3);
      return 
    result;

    COD2 turrent setTargetEntity (not a hud function, oops).
    PHP Code:
    int __cdecl GScr_SetTargetEntity(int a1)
    {
      
    char *v1// ebx@2
      
    int v2// ebx@3
      
    int result// eax@3
      
    char v4// al@5
      
    int v5// eax@5
      
    int v6// ebx@5

      
    if ( HIWORD(a1) )
      {
        
    Scr_ObjectError("not an entity");
        
    v1 0;
        if ( 
    v10C )
          goto 
    LABEL_3;
      }
      else
      {
        
    v1 = (char *)&g_entities 508 * (unsigned __int16)a1;
        if ( *((
    _DWORD *)v1 67) )
        {
    LABEL_3:
          
    v2 = *((_DWORD *)v1 67);
          
    result Scr_GetEntity(0);
          *(
    _DWORD *)(v2 16) = result;
          return 
    result;
        }
      }
      
    v4 SL_ConvertToString(*((_WORD *)v1 140));
      
    v5 va("entity type '%s' is not a turret"v4);
      
    Scr_Error(v5);
      
    v6 = *((_DWORD *)v1 67);
      
    result Scr_GetEntity(0);
      *(
    _DWORD *)(v6 16) = result;
      return 
    result;

    Last edited by Mitch; 13th June 2015 at 11:29.

  5. The Following User Says Thank You to Mitch For This Useful Post:

    serthy (11th June 2015)

  6. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Nice

    Quote Originally Posted by Mitch View Post
    PHP Code:
        v1 = (char *)&g_entities 508 * (unsigned __int16)a1;
        if ( *((
    _DWORD *)v1 67) ) 
    How do you know such things? (magic numbers etc)

  7. #5
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by serthy View Post
    Nice



    How do you know such things? (magic numbers etc)
    I searched it that function name in the Mac binary. It contains all the functions names and more.

    Edit: you only need the code within else curly brackets.
    Last edited by Mitch; 11th June 2015 at 09:19.

  8. The Following User Says Thank You to Mitch For This Useful Post:

    filthy_freak_ (11th June 2015)

  9. #6
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    I searched it that function name in the Mac binary. It contains all the functions names and more.
    Rawr. If I had known this I could have probably saved 10+ hours going through code.

    EDIT: Could you upload the mac binaries for those of us that have never touched a mac?
    Last edited by filthy_freak_; 11th June 2015 at 10:58.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •