03BB

From GTAModding
Jump to: navigation, search

GTA III Vice City SET_ROTATING_GARAGE_DOOR


Description
Sets the garage door to swing open
Syntax
03BB: set_garage [garage handle] door_type_to_swing_open
Parameter
[garage handle]
The handle of the garage

This opcode sets the garage door to swing open instead of slide open. There is no way to undo this behavior without extensively editing the memory of the game. Some doors do not properly swing open if it was not designed to do so, e.g. the Vice Port Pay n Spray.

Reset garage door

This supplemental code allows you to reset the garage door so that it can slide again. It checks if the door is closed first; resetting the door while it is opened is complicated. It uses Sanny Builder with CLEO for GTA III and Vice City in an external script (not the main one) and tested on US v1.0. Place this at the end of the file for Vice City:

:opcode_03BB_supplement
// [email protected] - input param (garage handle)
[email protected] *= 0xA8  // size of each garage struct
[email protected] += 0x812668  // base address for garages
0085: [email protected] = [email protected]
[email protected] += 1  // door state for garage
05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0
if
    [email protected] == 0  // ensure door is closed
then
    0085: [email protected] = [email protected]
    [email protected] += 0x19  // rotate door for garage
    05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if
        [email protected] == 1
    then
        05DF: write_memory [email protected] size 1 value 0 virtual_protect 0  // switch off rotation
        0085: [email protected] = [email protected]
        [email protected] += 0x58  // maximum height for garage
        05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0
        [email protected] += 0.1
        [email protected] *= 2.0
        05DF: write_memory [email protected] size 4 value [email protected] virtual_protect 0  // set maximum height
    end
end
05F6: ret 0

or for GTA III:

:opcode_03BB_supplement
// [email protected] - input param (garage handle)
[email protected] *= 0x8C  // size of each garage struct
[email protected] += 0x72BCD0  // base address for garages
0085: [email protected] = [email protected]
[email protected] += 1  // door state for garage
05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0
if
    [email protected] == 0  // ensure door is closed
then
    0085: [email protected] = [email protected]
    [email protected] += 0x19  // rotate door for garage
    05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0
    if
        [email protected] == 1
    then
        05DF: write_memory [email protected] size 1 value 0 virtual_protect 0  // switch off rotation
        0085: [email protected] = [email protected]
        [email protected] += 0x38  // maximum height for garage
        05E0: [email protected] = read_memory [email protected] size 4 virtual_protect 0
        [email protected] += 0.1
        [email protected] *= 2.0
        05DF: write_memory [email protected] size 4 value [email protected] virtual_protect 0  // set maximum height
    end
end
05F6: ret 0

Use this line as a supplement for opcode 03BB. This can be placed anywhere within the external script:

05F5: call_scm_func @opcode_03BB_supplement inputs 1 garage_handle [garage handle]

Keywords

set, garage, door, rotate, swing, open