Quantcast

Jump to content

» «
Photo

LSPD Camera Overlay From Eye in the Sky Mission?

4 replies to this topic
OfficerJohnson
  • OfficerJohnson

    Crackhead

  • Members
  • Joined: 07 Jan 2018
  • United-States

#1

Posted 3 weeks ago

Hello everyone. I would like to know how to get this overlay to appear. Is it a "scale form"? Can you please explain how I get that camera overlay from the mission to appear?

In addition, where can I find where the symbols for the mission are stored? Any ideas?

Bob_74
  • Bob_74

    Crackhead

  • Members
  • Joined: 05 Jan 2018
  • None

#2

Posted 3 weeks ago Edited by Bob_74, 3 weeks ago.

It is a scaleform: https://scaleform.de...pizza/#heli_cam
 
I tried quickly to see how it works and I ended up with this:

public static void ShowHeliCam()
{
    float range = 30.0f;
    Vehicle target = null;

    while (range > 5.0f && target == null)
    {
        target = World.GetClosestVehicle(Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, range, 0f)), 5f);
        range = range - 0.5f;
    }

    // Creating the Scaleform
    int handle = Function.Call<int>(Hash.REQUEST_SCALEFORM_MOVIE, "heli_cam");
    while (!Function.Call<bool>(Hash.HAS_SCALEFORM_MOVIE_LOADED, handle))
        Script.Yield();

    // Requesting textures related to this script
    Function.Call(Hash.REQUEST_STREAMED_TEXTURE_DICT, "helicopterHUD", false);
    while (!Function.Call<bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, "helicopterHUD"))
        Script.Yield();

    // This scaleform takes all the screen
    Function.Call(Hash.DRAW_SCALEFORM_MOVIE_FULLSCREEN, handle, 255, 255, 255, 0, 1);

    // 0 = No logo / 1 = LSPD logo top right
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION, handle, "SET_CAM_LOGO");
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT, 1);
    Function.Call(Hash._POP_SCALEFORM_MOVIE_FUNCTION_VOID);

    // Oscillation amplitude (all on false = no oscillation)
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION, handle, "SET_AUDIO_STATES");
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL, true);
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL, true);
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL, true);
    Function.Call(Hash._POP_SCALEFORM_MOVIE_FUNCTION_VOID);

    // Float1 = Left graduations / Float2 = To right graduation
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION, handle, "SET_ALT_FOV_HEADING");
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT, 200f);
    Function.Call(Hash._PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT, 0.5f);
    Function.Call(Hash._POP_SCALEFORM_MOVIE_FUNCTION_VOID);

    if (target != null)
    {
        if (target.Exists())
        {
            float offset = 0.4f; // Value in script: 0.4f or 2f / Handles the "hud_corner" spacing (would need to decrease from 2.0 to 0.4 while the targetting is in progress)

            // Translate world coordinates into screen coordinates + set the new screen coordinates as origin
            Function.Call(Hash.SET_DRAW_ORIGIN, target.Position.X, target.Position.Y, target.Position.Z, 0);

            offset = offset * 0.03f; // It is present in the script, I don't know why
            Function.Call(Hash.DRAW_SPRITE, "helicopterhud", "hud_corner", (-offset * 0.5f), -offset, 0.013f, 0.013f, 0f, 64, 255, 64, 255);
            Function.Call(Hash.DRAW_SPRITE, "helicopterhud", "hud_corner", (offset * 0.5f), -offset, 0.013f, 0.013f, 90f, 64, 255, 64, 255);
            Function.Call(Hash.DRAW_SPRITE, "helicopterhud", "hud_corner", (-offset * 0.5f), offset, 0.013f, 0.013f, 270f, 64, 255, 64, 255);
            Function.Call(Hash.DRAW_SPRITE, "helicopterhud", "hud_corner", (offset * 0.5f), offset, 0.013f, 0.013f, 180f, 64, 255, 64, 255);


            // Arrow locating the target, needs trigonometry to find where to point at
            // Function.Call(Hash.DRAW_SPRITE, "helicopterhud", "hudArrow", 0.0f, 0.0f, 0.02f, 0.04f, 180f, 64, 64, 255, 255);

            // Clear the ogirin coordinates to be able to draw other things again
            Function.Call(Hash.CLEAR_DRAW_ORIGIN);
        }
        else
        {
            // The vehicle doesn't exist, show the TargetLost icon
            Function.Call(Hash.DRAW_SPRITE, "helicopterHUD", "TargetLost", 0.5f, 0.70f, 0.03f, 0.05f, 0.0f, 255, 64, 64, 255);
        }
    }
    else
    {
        // No vehicle found show the TargetLost icon
        Function.Call(Hash.DRAW_SPRITE, "helicopterHUD", "TargetLost", 0.5f, 0.70f, 0.03f, 0.05f, 0.0f, 255, 64, 64, 255);
    }
}

It must be called every frames.
The game does a lot of calculation (b678 - carsteal2.c - line 49542) to fill the gauges with heading and rotation values, here I just put fixed values (200 and 0.5) that you'll need to change according to what you want.
Also, the targeting arrow calculation is at line 50112.
 
C9qUAVel.pngW4Hpdbxl.png
 
I hope it will help you :)

 

EDIT: To know what functions to call, I only looked at the carsteal2 script.

A scaleform works that way:

 

You request a scaleform (REQUEST_SCALEFORM_MOVIE) and it returns its handle.

You wait until the scaleform is loaded (HAS_SCALEFORM_MOVIE_LOADED) by checking the handle.

 

Then you can call the scaleform functions (_PUSH_SCALEFORM_MOVIE_FUNCTION).

Functions needs parameters, so you need to send them using (_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_xxxx where xxx is the type of the parameter).

Then you execute/end the function using _POP_SCALEFORM_MOVIE_FUNCTION_VOID.

  • nm710 and OfficerJohnson like this

OfficerJohnson
  • OfficerJohnson

    Crackhead

  • Members
  • Joined: 07 Jan 2018
  • United-States

#3

Posted 3 weeks ago

Holy **** Bob!!!

You wrote all that code yourself?

I had just recently figured out it was a scale form, so nice to see that's been confirmed.

What did you look for in the script? I've looked through about 1/4 of it and my head already hurts. And yes. Carsteal2.c4.

OfficerJohnson
  • OfficerJohnson

    Crackhead

  • Members
  • Joined: 07 Jan 2018
  • United-States

#4

Posted 3 weeks ago

Okay. So let me get this straight...

All this is found under one scaleform named "heli_cam". To manipulate the functions/methods within a scaleform, we have to push the parameters onto a stack using the natives. Once we are done and have pushed all the values/parameters, we use the pop command to end the stack, correct?

This helps immensely BTW. And since you put it in CSharp, I can track it a bit easier. I'll check out the Scaleform class of SHV.NET to see what I can find.

Bob_74
  • Bob_74

    Crackhead

  • Members
  • Joined: 05 Jan 2018
  • None

#5

Posted 3 weeks ago Edited by Bob_74, 3 weeks ago.

Holy **** Bob!!!

You wrote all that code yourself?

I had just recently figured out it was a scale form, so nice to see that's been confirmed.

What did you look for in the script? I've looked through about 1/4 of it and my head already hurts. And yes. Carsteal2.c4.

Yes I wrote that but it's quite basic, I didn't handle the sliders dynamically and such.
You look for the script's name, when it is requested to load, you will see the name of the variable containing it. Now you can search through the file to find how this variable (scaleform) is used.

Okay. So let me get this straight...

All this is found under one scaleform named "heli_cam". To manipulate the functions/methods within a scaleform, we have to push the parameters onto a stack using the natives. Once we are done and have pushed all the values/parameters, we use the pop command to end the stack, correct?

This helps immensely BTW. And since you put it in CSharp, I can track it a bit easier. I'll check out the Scaleform class of SHV.NET to see what I can find.

Exactly! The hardest part is to follow how the scaleform is created and how it's functions are called in the decompiled script ;)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users