0135

From GTAModding
Jump to: navigation, search

GTA III CHANGE_CAR_LOCK


Description
Sets the door lock status of the vehicle
Syntax
0135: [int] = car [car handle] door_status
Parameter
[car handle]
The handle of the vehicle
[int]
Car lock

This opcode behaves exactly as opcode 020A.

Disassembled code

This is disassembled code for this opcode from PC v1.0 US.

loc_43ED92:
    lea     eax, [ebp+10h]                    ; get address of script's current instruction pointer
    mov     ecx, ebp                          ; get address of script for thiscall
    push    2                                 ; push 2 for two parameters to collect
    push    eax                               ; push address of script's current instruction pointer
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
    mov     eax, ds:ScriptParams[0]           ; get value of first parameter, the vehicle handle
    mov     ecx, ds:CPools::ms_pVehiclePool   ; get address of vehicle pool for thiscall
    push    eax                               ; push vehicle handle
    call    CPool_CVehicle_CAutomobile::GetAt ; call CPool<CVehicle, CAutomobile>::GetAt(int) to get address of vehicle
    mov     ebx, ds:ScriptParams[1]           ; get value of second parameter, the car lock
    mov     [eax+224h], ebx                   ; offset vehicle address by 0x224 and set its car lock
    xor     al, al                            ; return 0

Keywords

set, car, vehicle, door, lock, status