Quantcast

Jump to content

» «
Photo

TV render

5 replies to this topic
AXLiberty
  • AXLiberty

    Player Hater

  • Members
  • Joined: 07 Sep 2011

#1

Posted 22 July 2013 - 05:49 PM

I'm make a little script for render movie on model, but he is didn't work... What i did wrong?

CODE
library WatchTV;

uses
 Windows,
 SysUtils,
 Classes;

type
 n_GET_SCRIPT_RENDERTARGET_RENDER_ID = function (TV_Model : string) : integer; cdecl;
 DRAW_MOVIE = procedure (x1, y1, x2, y2, unk1 : real; unk2, unk3, unk4, unk5 : integer); cdecl;
 SET_CURRENT_MOVIE = procedure (Movie : string); cdecl;
 SET_MOVIE_TIME = procedure (Time : real); cdecl;
 PLAY_MOVIE = procedure (); cdecl;
 PRINT_STRING_WITH_LITERAL_STRING_NOW = procedure (GXT_Entry, Text : PAnsiChar; Time, Unk : Integer); cdecl;

function GetExeFileVersion( AFileName: String ): String;
var
 dwSize, dwTemp: DWORD;
 abInfo: Array of byte;
 Pint: ^VS_FIXEDFILEINFO;
begin
 dwSize:= GetFileVersionInfoSize(pchar(AFileName),dwTemp);
 if dwSize <> 0 then
 begin
   SetLength(abInfo,dwSize);
   GetFileVersionInfo(pchar(AFileName),0,dwSize,@abInfo[0]);
   if VerQueryValue(@abInfo[0],'\',Pointer(pint), dwTemp) then
   begin
     Result := IntToStr( HiWord(pint^.dwFileVersionMS) );
     Result := Result + IntToStr( LoWord(pint^.dwFileVersionMS) );
     Result := Result + IntToStr( HiWord(pint^.dwFileVersionLS) );
     Result := Result + IntToStr( LoWord(pint^.dwFileVersionLS) );
   end;
 end;
end;

function KeyPressed(const Key : SmallInt) : Boolean;
begin
 Result := Hi(GetKeyState(Key)) = $FF;
end;

var
 GetScriptRenderTargetRenderID : n_GET_SCRIPT_RENDERTARGET_RENDER_ID;
 DrawMovie : DRAW_MOVIE;
 SetCurrentMovie : SET_CURRENT_MOVIE;
 SetMovieTime : SET_MOVIE_TIME;
 PlayMovie : PLAY_MOVIE;
 PrintStringWithLiteralStringNow : PRINT_STRING_WITH_LITERAL_STRING_NOW;

procedure MainLoop();
begin
 if LowerCase(ExtractFileName(GetModuleName(GetModuleHandleA(nil)))) = 'gtaiv.exe' then
   begin
   if GetExeFileVersion(GetModuleName(GetModuleHandleA(nil))) = '1040' then
     begin
     @GetScriptRenderTargetRenderID := Pointer($004B6ED0 - $400000 + GetModuleHandleA(nil));
     @DrawMovie := Pointer($009C0C00 - $400000 + GetModuleHandleA(nil));
     @SetCurrentMovie := Pointer($009C0040 - $400000 + GetModuleHandleA(nil));
     @SetMovieTime := Pointer($009C0080 - $400000 + GetModuleHandleA(nil));
     @PrintStringWithLiteralStringNow := Pointer($00A10FE0 - $400000 + GetModuleHandleA(nil));
     end
   end;
 while True do
   begin
   Sleep(100);
   if KeyPressed(VK_F8) then
     begin
     GetScriptRenderTargetRenderID('cj_tv_9');
     DrawMovie(0.50000000, 0.50000000, 1.00000000, 1.00000000, 0.00000000, 255, 255, 255, 255);
     SetCurrentMovie('weazel');
     SetMovieTime(1.00000000);
     PlayMovie();
     PrintStringWithLiteralStringNow('string', 'TV is on', 5000, 1);
     Sleep(2000);
     end;
   end;
end;

var
 idThread : Cardinal;

begin
 CreateThread(nil, 0, @MainLoop, nil, 0, idThread);
end.

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009

#2

Posted 26 July 2013 - 06:42 AM

Hi AXLiberty,
...as promised...

C++
CODE
eSound tv_sound;
int viewportID;
eInteriorRoomKey tvRoomKey;

// TV
SetMinigameInProgress(1);
if (IsPlayerPlaying(GetPlayer()))
{
GetScriptRenderTargetRenderId(&tvRenderID);
SetTextRenderId(tvRenderID);
RequestAmbientAudioBank("SCRIPT_AMBIENT/TELEVISION");
tv_sound = GetSoundId();
GetGameViewportId(&viewportID);
SetRoomForViewportByKey(viewportID, tvRoomKey);
HideHUDAndRadarThisFrame();
SwitchStreaming(0);
OverrideFreezeFlags(1);
PlaySoundFrontend(tv_sound, "TELEVISION_TURN_ON");
if (!HasSoundFinished(tv_sound)) { Wait(0); }
MuteGameworldAndPositionedRadioForTv(1);
SetCurrentMovie("Skorpro_TV");
SetTextRenderId(tvRenderID);
DrawMovie(0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 255, 255, 255, 255);
SetMovieTime(1.01f);
SetMovieVolume(20.0f);
SetTextRenderId(tvRenderID);
PlayMovie();
}

Note: The movie is frozen but sound is ok! Why? NO IDEA... any help?

AXLiberty
  • AXLiberty

    Player Hater

  • Members
  • Joined: 07 Sep 2011

#3

Posted 26 July 2013 - 07:19 AM

Hi. Thank you for this.

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009

#4

Posted 26 July 2013 - 07:52 AM

QUOTE (AXLiberty @ Friday, Jul 26 2013, 07:19)
Hi. Thank you for this.

You're welcome biggrin.gif Hope it works for you... if so, please post your (Delphi) script here again, thanx smile.gif

julionib
  • julionib

    Coder

  • Members
  • Joined: 13 Sep 2012
  • Brazil

#5

Posted 26 July 2013 - 11:01 AM

lol, Delphi + gta scripting, didnt knew that it was possible, nice

AXLiberty
  • AXLiberty

    Player Hater

  • Members
  • Joined: 07 Sep 2011

#6

Posted 27 July 2013 - 07:13 AM

QUOTE (julionib @ Friday, Jul 26 2013, 11:01)
lol, Delphi + gta scripting, didnt knew that it was possible, nice

It is possible, but it's really hard sad.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users