0415

From GTAMods Wiki
Jump to navigation Jump to search

GTA III IS_CAR_DOOR_CLOSED


Description
Checks if the car component of the car is closed
Syntax
0415:   car [car handle] door [int] closed
Parameter
[car handle]
The handle of the vehicle
[int]
Car part (see below)

This conditional opcode returns true if the car component of the car is closed; the component does not need to be a door. If the component is damaged and cannot be closed shut, the opcode can still return true if the component rotates into the closing position. This opcode was never called in the original script of GTA III.

Car parts

Part Enum Notes
0 BONNET bonnet, hood
1 BOOT boot, trunk, tailgate
2 FRONT_LEFT_DOOR front left door
3 FRONT_RIGHT_DOOR front right door
4 REAR_LEFT_DOOR rear left door
5 REAR_RIGHT_DOOR rear right door

For Vice City

This opcode does not exist in Vice City but it possible to get the state of the vehicle's car parts. The following example, using Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:

:opcode_0415
// [email protected] - input param (car handle)
// [email protected] - input param (part)
05E7: [email protected] = car [email protected] struct
05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0  // read virtual table
[email protected] += 0x6C  // offset in table
05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0
05E4: call_function_method [email protected] [email protected] num_params 1 pop 0 part [email protected] [email protected]  // CAutomobile::IsDoorMissing
05F9: [email protected] = [email protected] AND 1  // retrieve only 1 byte
05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0  // read virtual table
[email protected] += 0x68  // offset in table
05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0
05E4: call_function_method [email protected] [email protected] num_params 1 pop 0 part [email protected] [email protected]  // CAutomobile::IsDoorClosed
05F9: [email protected] = [email protected] AND 1  // retrieve only 1 byte
if and
    [email protected] == 0
    [email protected] == 1
then
end
05F6: ret 0

Use this line as a substitute for opcode 0415. This can be placed anywhere within the external script as a conditional statement:

// ...
if
    05F5: call_scm_func @opcode_0415 inputs 2 car_handle [car handle] car_part [int]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

check, car, vehicle, door, component, part, closed