Coding

 Reply to this postStart new topic

Opcode "is_car_visible"

Sweet
post Oct 4 2010, 08:25 AM
Post #1


Ameteur Member

Posts: 48
Joined: 19-August 10



I was posted that on SB forum but nobody respond to it, so i post it there.
In sources, guess what, i found these:
CODE
bool CVehicleSA::IsSphereTouchingVehicle ( CVector * vecOrigin, float fRadius )
{
  DEBUG_TRACE("bool CVehicleSA::IsSphereTouchingVehicle ( CVector * vecOrigin, float fRadius )");
    DWORD dwThis = (DWORD) m_pInterface;
    DWORD dwFunc = FUNC_CVehicle_IsSphereTouchingVehicle;
  bool bReturn = false;

    _asm
    {
    push  eax

        mov     ecx, dwThis
    mov    eax, vecOrigin
    push  fRadius
        push    dword ptr [eax]
        push    dword ptr [eax + 4]
        push    dword ptr [eax + 8]
    call  dwFunc
    mov    bReturn, al
    }
  return bReturn;
}

Is there a way to move this on delphi for creating opcode "is_car_visible"? Or way to find out current entity target of the camera. Any answers will be helpful!
Go to the top of the page
 
+Quote Post
Silent
post Oct 4 2010, 11:30 AM
Post #2


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



Is car visible == is set_car_visibility opcode set to 0?
I'm not sure if you're asking that, or just you want to create condition, that will return true if car is on screen?
Go to the top of the page
 
+Quote Post
Sweet
post Oct 4 2010, 03:54 PM
Post #3


Ameteur Member

Posts: 48
Joined: 19-August 10



Is car really entity target of camera, it means on screen, even if player stand near car but camera isnt looking at car.
Go to the top of the page
 
+Quote Post
Silent
post Oct 4 2010, 06:35 PM
Post #4


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



SANNY
02CA:   car 61@ bounding_sphere_visible

?


Nah, I don't think that you're a noob tongue.gif

This post has been edited by Silent: Oct 4 2010, 06:35 PM
Go to the top of the page
 
+Quote Post
Sweet
post Oct 5 2010, 10:34 AM
Post #5


Ameteur Member

Posts: 48
Joined: 19-August 10



Oh jesus... I KNOW THAT!
I talking about not that opcode, i talking about camera's target_entity check.
Go to the top of the page
 
+Quote Post
Silent
post Oct 5 2010, 02:06 PM
Post #6


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



Okies, so I'm out - I have no knowlege about these things :/
Go to the top of the page
 
+Quote Post
Sweet
post Oct 5 2010, 04:26 PM
Post #7


Ameteur Member

Posts: 48
Joined: 19-August 10



Same as on sanny's forum. I posted that about month ago and still no answers :/
Nobody's research the camera as well.

This post has been edited by Sweet: Oct 5 2010, 04:26 PM
Go to the top of the page
 
+Quote Post
Deji
post Oct 6 2010, 06:11 PM
Post #8


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



You want the ASM for that opcode check, yes?

Not so many ASM users here, I'm not so good with this either. You could make a call to CCamera__isSphereVisible (0x420D40), which is something like what I'd do in CLEO. It would be much easier for me to attempt to recreate an "are coordinates visible" function than an "is car visible" one...

Here's an off-the-top attempt. This code will probably be mostly wrong, but it's better than nothing, I'd say.
CODE
function AreCoordsOnscreen(origin: float[3], fRadius: float):  bool;  // complete guess, probably wrong.
{
  var
    dwFunc, dwThis: Integer;
    bReturn: Boolean;
  begin
    //dwThis := m_pInterface;  // ??? m_pInterface should be a constant. It's value is probably needed.
    dwFunc := $420D40;

    // correct asm structure?
    asm
        push  eax   // don't know what this does

        //mov     ecx, dwThis  // no idea what it does or how it's involved, but it could be needed for this to work.
        mov     eax, origin
        push    fRadius
        push    dword ptr [eax]
        push    dword ptr [eax + 4]
        push    dword ptr [eax + 8]
        call    dwFunc
        mov     bReturn, al
    end
  return bReturn;  // replace with however you return from a function in Delphi - return the value of "bReturn".
}


The ASM is considerably basic, but I have no experience with Pascal or Delphi. It'd help to see some examples of working with SA functions/asm in it.

I'm also wondering where you got that snippet from. It might help to see more of that, too. dwThis probably needs to refer to where the returned data should be directed to, but I'm not sure.


Let me know if you get it working, I'm always interested in working with ASM smile.gif


--------------------
Go to the top of the page
 
+Quote Post
Sweet
post Oct 7 2010, 10:30 AM
Post #9


Ameteur Member

Posts: 48
Joined: 19-August 10



Its piece from SA sources, but not listener's. Its s0beit sources (or MTA, whatever). As Far As I Know its directly from CVehicle.cpp (in src folder).
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

5 User(s) are reading this topic (5 Guests and 0 Anonymous Users)
0 Members: