Results 1 to 10 of 21

Thread: isTouching()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by filthy_freak_ View Post
    The above function only disables weapon pickup and doesn't disable turrets, bomb planting etc.
    The code doesn't work correctly, because a2 isn't a client address but a gentity address.
    You need to replace 'clientaddress_to_num' with 'gentityaddress_to_num' to get a valid client number.

    Edit: the function uses a different a2 variable. So i was wrong. See: http://killtube.org/showthread.php?2...ll=1#post12093
    Last edited by Mitch; 30th June 2015 at 14:31.

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

    filthy_freak_ (30th June 2015)

  3. #2
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    The code doesn't work correctly, because a2 isn't a client address but a gentity address.
    You need to replace 'clientaddress_to_num' with 'gentityaddress_to_num' to get a valid client number.
    Are you sure? This is what my log returns;
    Code:
    clientaddress_to_num = 0, gentityaddress_to_num = 1024
    PHP Code:
        int clientnum clientaddress_to_num(a2);
        
    int clientnum2 gentityaddress_to_num(a2);
        
    printf("clientaddress_to_num = %i, gentityaddress_to_num = %i\n"clientnumclientnum2); 

  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 filthy_freak_ View Post
    Are you sure? This is what my log returns;
    Code:
    clientaddress_to_num = 0, gentityaddress_to_num = 1024
    PHP Code:
        int clientnum clientaddress_to_num(a2);
        
    int clientnum2 gentityaddress_to_num(a2);
        
    printf("clientaddress_to_num = %i, gentityaddress_to_num = %i\n"clientnumclientnum2); 
    Maybe it is a difference between 1.0 and 1.3 (= where i tested it).

    Edit: In 1.3 i get this:
    Code:
    clientaddress_to_num = -55, gentityaddress_to_num = 0
    Last edited by Mitch; 30th June 2015 at 14:12.

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

    filthy_freak_ (30th June 2015)

  6. #4
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Remove post
    Last edited by filthy_freak_; 30th June 2015 at 14:27. Reason: Nevermind

  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 filthy_freak_ View Post
    EDIT:

    Found the problem.

    Didn't post the correct addresses for 1.2 and 1.3

    Here are the correct addresses:
    1.2
    PHP Code:
                hook_delete_weapon = new cHook(0x08105E9E, (int)delete_weapon);
                
    hook_delete_weapon->hook(); 
    1.3
    PHP Code:
                hook_delete_weapon = new cHook(0x08105FFA, (int)delete_weapon);
                
    hook_delete_weapon->hook(); 
    I will update the above post with the fix. Triple edit: Seems like I can't =(
    I'm using a function one level higher.

    My function (gentity):
    PHP Code:
    sub_8105CAC(signed int sint a2int a3
    Your function (client):
    PHP Code:
    result sub_80DF39E(s, *(_DWORD *)(a2 344), a3); 
    Edit: i committed my version. https://github.com/M-itch/libcod/com...6f7f20d91a895f
    Last edited by Mitch; 30th June 2015 at 14:37.

  8. #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
    Maybe it is a difference between 1.0 and 1.3 (= where i tested it).

    Edit: In 1.3 i get this:
    Code:
    clientaddress_to_num = -55, gentityaddress_to_num = 0
    Are you sure you have set
    PHP Code:
                hook_disable_pickup = new cHook(0x080DF39E, (int)disable_pickup);
                
    hook_disable_pickup->hook(); 
    correctly?

    EDIT: Going by your previous post, seems like you didn't.

    By the way, the use of sub_80DF39E over sub_8105CAC is intentional. Using sub_80DF39E will only disable weapon pickup whereas sub_8105CAC will disable everything with a Use (f) dialogue. Hence why the custom function is called disablePickup and not disableUse.
    Last edited by filthy_freak_; 30th June 2015 at 14:41.

  9. #7
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by filthy_freak_ View Post
    EDIT: Going by your previous post, seems like you didn't.

    By the way, the use of sub_80DF39E over sub_8105CAC is intentional. Using sub_80DF39E will only disable weapon pickup whereas sub_8105CAC will disable everything with a Use (f) dialogue. Hence why the custom function is called disablePickup and not disableUse.
    My version works exactly the same.

    Can you try this:
    After you picked up a weapon and disabled the pickup.
    You should be hearing the ammo pickup sound and the weapon will disappear and reappear when you go over the weapon again.
    (+ not max ammo)

    There are 3 pointers to the function Touch_Item_Auto and i only replace the last one (3).
    1: This one is responsible for the 'Press [Use] to swap for ...' message.
    2: No idea. I don't know how to trigger it. It might have something to do with picking up health.
    3: Picks up the item.
    Last edited by Mitch; 30th June 2015 at 16:26.

Posting Permissions

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