Перейти к содержанию

[GTA Vice City] Спавн машин рядом с игроком


Рекомендуемые сообщения

 

Записал видео со спавном машин рядом с игроком. Получилось ужасно долго, тихо и в конце похоже пропал звук. 

Я решил всё равно выложить, я вряд ли смогу переснять, но если получится исправить - исправлю ссылку на видео.

Плюс если что есть текстовая статья - можно выложить её (но она как и видео - огромна).

 

В видео мы узнаем какие функции вызываются при создании автомобиля через чит-коды и набросаем небольшой скрипт, который будет создавать требуемый автомобиль перед игроком:

Spoiler

 

 

 

Итоговый скрипт:

Spoiler

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
aobscan(RequestStream, 8B 4C 24 04 53 56 57 55 89 CD 8D 6C AD 00 8B 5C 24 18 8D 2C AD 00 00 00 00 8A 85 ?? ?? ?? ?? 3C 02)
aobscan(loadRequestedStreams, 53 56 57 55 83 EC 10 80 ?? ?? ?? ?? 00 00 75 0E C6 ?? ?? ?? ?? 00 01 C6 ?? ?? ?? ?? 00 00)
aobscan(CStreaming_releaseModel, 8B 4C 24 04 89 CA 8D 14 92 8D 14 95 00 00 00 00 80 A2 ?? ?? ?? ?? FE 81 F9 64 19 00 00 7C 08 81 F9 CD 1E 00 00)
aobscan(releaseModel, 8B 4C 24 04 BA 64 19 00 00 8B 04 8D ?? ?? ?? ?? 0F BF 48 26 8D 81 64 19 00 00 01 CA 8D 04 80)
aobscan(CVehicle_new, 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? C3 00 00 00 00 53 89 CB C7 03 ?? ?? ?? ?? 66 C7 83 ?? ?? ?? ?? 00 00 8B 43 64 56 85 C0 55 7C 12 B9)
aobscan(CAutomobile_constructor, 53 56 57 55 81 EC A8 00 00 00 8B 84 24 C0 00 00 00 50 8B B4 24 C0 00 00 00 89 4C 24 0C)
aobscan(CBike_constructor, 53 56 55 83 EC 10 8B 44 24 24 50 8B 6C 24 24 89 4C 24 10 E8 ?? ?? ?? ?? 8B 44 24 0C)
aobscan(CBoat_constructor, 53 56 57 83 EC 08 8B 44 24 1C 50 8B 74 24 1C 89 4C 24 08 E8 ?? ?? ?? ?? 8B 44 24 04 B9 09 00 00 00)
aobscan(CPlacable_setRotation, 53 89 CB 83 EC 18 D9 44 24 24 D9 44 24 20 D9 EE D9 EE D9 EE D9 C3 D9 FF DF E0 A9 00 04 00 00 74 07)
aobscan(CWorld_add, 53 8B 5C 24 08 8A 43 50 56 24 07 0F B6 D0 83 FA 02 74 05 83 FA 03 75 10 8B 43 64 B9 ?? ?? ?? ?? 6A 01)
aobscan(GetPlayerPed, 0F B6 05 ?? ?? ?? ?? 6B C0 2E 8B 04 C5 ?? ?? ?? ?? C3)

globalalloc(create_vehicle_func, 2048)
globalalloc(model_index, 4)

label(exit)
label(create_vehicle)

model_index:
// sabre turbo
dd #206

create_vehicle_func:
// modelIndex = 206
mov esi,[model_index]

// v3 = loadedModelInfo[modelIndex].flags
mov edi,esi
lea edi,[edi+edi*4]
lea edi,[edi*4]
movzx ebx,byte ptr [edi+gta-vc.exe+54CDE1]

push 1
push esi
call RequestStream
add esp,8

push 0
call loadRequestedStreams
pop ecx

// loadedModelInfo[modelIndex].available == 1
cmp byte ptr [edi+gta-vc.exe+54CDE0],1
jnz exit

// v5 = v3 & 1;
and ebx,01 { 1 }
jnz @f

push esi
call CStreaming_releaseModel
pop ecx

push esi
call releaseModel
pop ecx

@@:

// check model flags for correct constructor
mov edi,esi
mov edi,[edi*4+"gta-vc.exe"+52C4D0]
// get model handling id
movsx eax,word ptr [edi+46]
// DC - size of handling struct
imul eax,eax,000000DC
// calc model offset in handling array
add eax,gta-vc.exe+577E60
add eax,14

// get model flags
mov eax,[eax+cc]
and eax,000f0000
ror eax,4*4

// cause Skimmer is a boat, not a plane O_o
cmp esi,#190
jne @f
mov eax,8

@@:
// get correct constructor
// == IS_BIKE
cmp eax,1
jne @f
push CBike_constructor
push #1260
jmp create_vehicle

@@:
// IS_PLANE
cmp eax,4
jne @f
jmp exit

@@:
// IS_BOAT
cmp eax,8
jne @f
push CBoat_constructor
push #1216
jmp create_vehicle

@@:
// else if is a car
push CAutomobile_constructor
push #1500

create_vehicle:
// size param was been pushed above
call CVehicle_new
add esp,04

mov ebx,eax
test ebx,ebx
jz exit

// mov constructor func to eax
pop eax
// vehicle::
mov ecx,ebx
push 1
push esi
// call vehicle::constructor
call eax
mov ebx,eax
test ebx,ebx
jz exit

// mov to eax player struct
call GetPlayerPed

// rotate car as player
push 0
fld dword ptr [eax+8]
fld dword ptr [eax+4]
fpatan
fstp dword ptr [esp]
push 0
push 0

// x into eax
lea eax,[ebx+34]
// placeble to ecx
lea ecx,[ebx+04]

call CPlacable_setRotation

// move car to player
call GetPlayerPed

// small shift relatively to player
push (float)5

// x
fld dword ptr [eax+34]
fld dword ptr [esp]
fld dword ptr [eax+8]
fmulp
fsubp
fstp dword ptr [ebx+34]

// y
fld dword ptr [esp]
fld dword ptr [eax+4]
fmulp
fld dword ptr [eax+38]
faddp
fstp dword ptr [ebx+38]

// z
push [eax+3c]
pop [ebx+3c]

// remove our shift from stack
add esp,4

// setup flags
mov al,[ebx+50]
and al,07
or al,20
mov [ebx+50],al

// open the doors
mov [ebx+00000230],1

push ebx
call CWorld_add
add esp,04

exit:
ret


[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(create_vehicle_func)
dealloc(model_index)

unregistersymbol(create_vehicle_func)
unregistersymbol(model_index)

 

 

  • Плюс 8
Ссылка на комментарий
Поделиться на другие сайты

20 minutes ago, MasterGH said:

От всего форума, от всех пользователей большой респект за видео. Супер :);)

 

Спасибо :) Надеюсь следующее будет чуть более удачным.

Будем пробовать встроить получившийся скрипт в LUA форму с выбором машинки из выпадающего списка.

Ссылка на комментарий
Поделиться на другие сайты

Было бы забавно сделать, чтобы при смене погоды,в дождь вместо капель падали танки с рандомными координатами от гг это первое что пришло в голову после просмотра видео.

Изменено пользователем partoftheworlD
Ссылка на комментарий
Поделиться на другие сайты

  • 1 месяц спустя...
В 19.03.2017 в 23:40, srg91 сказал:

 

Записал видео со спавном машин рядом с игроком. Получилось ужасно долго, тихо и в конце похоже пропал звук. 

Я решил всё равно выложить, я вряд ли смогу переснять, но если получится исправить - исправлю ссылку на видео.

Плюс если что есть текстовая статья - можно выложить её (но она как и видео - огромна).

 

В видео мы узнаем какие функции вызываются при создании автомобиля через чит-коды и набросаем небольшой скрипт, который будет создавать требуемый автомобиль перед игроком:

  Показать содержимое

 

 

 

Итоговый скрипт:

  Показать содержимое


[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
aobscan(RequestStream, 8B 4C 24 04 53 56 57 55 89 CD 8D 6C AD 00 8B 5C 24 18 8D 2C AD 00 00 00 00 8A 85 ?? ?? ?? ?? 3C 02)
aobscan(loadRequestedStreams, 53 56 57 55 83 EC 10 80 ?? ?? ?? ?? 00 00 75 0E C6 ?? ?? ?? ?? 00 01 C6 ?? ?? ?? ?? 00 00)
aobscan(CStreaming_releaseModel, 8B 4C 24 04 89 CA 8D 14 92 8D 14 95 00 00 00 00 80 A2 ?? ?? ?? ?? FE 81 F9 64 19 00 00 7C 08 81 F9 CD 1E 00 00)
aobscan(releaseModel, 8B 4C 24 04 BA 64 19 00 00 8B 04 8D ?? ?? ?? ?? 0F BF 48 26 8D 81 64 19 00 00 01 CA 8D 04 80)
aobscan(CVehicle_new, 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? C3 00 00 00 00 53 89 CB C7 03 ?? ?? ?? ?? 66 C7 83 ?? ?? ?? ?? 00 00 8B 43 64 56 85 C0 55 7C 12 B9)
aobscan(CAutomobile_constructor, 53 56 57 55 81 EC A8 00 00 00 8B 84 24 C0 00 00 00 50 8B B4 24 C0 00 00 00 89 4C 24 0C)
aobscan(CBike_constructor, 53 56 55 83 EC 10 8B 44 24 24 50 8B 6C 24 24 89 4C 24 10 E8 ?? ?? ?? ?? 8B 44 24 0C)
aobscan(CBoat_constructor, 53 56 57 83 EC 08 8B 44 24 1C 50 8B 74 24 1C 89 4C 24 08 E8 ?? ?? ?? ?? 8B 44 24 04 B9 09 00 00 00)
aobscan(CPlacable_setRotation, 53 89 CB 83 EC 18 D9 44 24 24 D9 44 24 20 D9 EE D9 EE D9 EE D9 C3 D9 FF DF E0 A9 00 04 00 00 74 07)
aobscan(CWorld_add, 53 8B 5C 24 08 8A 43 50 56 24 07 0F B6 D0 83 FA 02 74 05 83 FA 03 75 10 8B 43 64 B9 ?? ?? ?? ?? 6A 01)
aobscan(GetPlayerPed, 0F B6 05 ?? ?? ?? ?? 6B C0 2E 8B 04 C5 ?? ?? ?? ?? C3)

globalalloc(create_vehicle_func, 2048)
globalalloc(model_index, 4)

label(exit)
label(create_vehicle)

model_index:
// sabre turbo
dd #206

create_vehicle_func:
// modelIndex = 206
mov esi,[model_index]

// v3 = loadedModelInfo[modelIndex].flags
mov edi,esi
lea edi,[edi+edi*4]
lea edi,[edi*4]
movzx ebx,byte ptr [edi+gta-vc.exe+54CDE1]

push 1
push esi
call RequestStream
add esp,8

push 0
call loadRequestedStreams
pop ecx

// loadedModelInfo[modelIndex].available == 1
cmp byte ptr [edi+gta-vc.exe+54CDE0],1
jnz exit

// v5 = v3 & 1;
and ebx,01 { 1 }
jnz @f

push esi
call CStreaming_releaseModel
pop ecx

push esi
call releaseModel
pop ecx

@@:

// check model flags for correct constructor
mov edi,esi
mov edi,[edi*4+"gta-vc.exe"+52C4D0]
// get model handling id
movsx eax,word ptr [edi+46]
// DC - size of handling struct
imul eax,eax,000000DC
// calc model offset in handling array
add eax,gta-vc.exe+577E60
add eax,14

// get model flags
mov eax,[eax+cc]
and eax,000f0000
ror eax,4*4

// cause Skimmer is a boat, not a plane O_o
cmp esi,#190
jne @f
mov eax,8

@@:
// get correct constructor
// == IS_BIKE
cmp eax,1
jne @f
push CBike_constructor
push #1260
jmp create_vehicle

@@:
// IS_PLANE
cmp eax,4
jne @f
jmp exit

@@:
// IS_BOAT
cmp eax,8
jne @f
push CBoat_constructor
push #1216
jmp create_vehicle

@@:
// else if is a car
push CAutomobile_constructor
push #1500

create_vehicle:
// size param was been pushed above
call CVehicle_new
add esp,04

mov ebx,eax
test ebx,ebx
jz exit

// mov constructor func to eax
pop eax
// vehicle::
mov ecx,ebx
push 1
push esi
// call vehicle::constructor
call eax
mov ebx,eax
test ebx,ebx
jz exit

// mov to eax player struct
call GetPlayerPed

// rotate car as player
push 0
fld dword ptr [eax+8]
fld dword ptr [eax+4]
fpatan
fstp dword ptr [esp]
push 0
push 0

// x into eax
lea eax,[ebx+34]
// placeble to ecx
lea ecx,[ebx+04]

call CPlacable_setRotation

// move car to player
call GetPlayerPed

// small shift relatively to player
push (float)5

// x
fld dword ptr [eax+34]
fld dword ptr [esp]
fld dword ptr [eax+8]
fmulp
fsubp
fstp dword ptr [ebx+34]

// y
fld dword ptr [esp]
fld dword ptr [eax+4]
fmulp
fld dword ptr [eax+38]
faddp
fstp dword ptr [ebx+38]

// z
push [eax+3c]
pop [ebx+3c]

// remove our shift from stack
add esp,4

// setup flags
mov al,[ebx+50]
and al,07
or al,20
mov [ebx+50],al

// open the doors
mov [ebx+00000230],1

push ebx
call CWorld_add
add esp,04

exit:
ret


[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(create_vehicle_func)
dealloc(model_index)

unregistersymbol(create_vehicle_func)
unregistersymbol(model_index)

 

 

Просто сделай пост с картинами без видео.

Ссылка на комментарий
Поделиться на другие сайты

29 minutes ago, partoftheworlD said:

Ага, нарежь видео по кадрам и выложи эти сотни тысяч скринов сюда.

 

 

offtopic.gif Одну минуту... :D

ffmpeg -i moy_urok_nomer_2.mp4 -f image2 kadr-%07d.png

 

Ссылка на комментарий
Поделиться на другие сайты

×
×
  • Создать...

Важная информация

Находясь на нашем сайте, Вы автоматически соглашаетесь соблюдать наши Условия использования.