03BB

From GTAMods Wiki
Jump to navigation Jump to 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
// 0@ - input param (garage handle)
0@ *= 0xA8  // size of each garage struct
0@ += 0x812668  // base address for garages
0085: 1@ = 0@
1@ += 1  // door state for garage
05E0: 2@ = read_memory 1@ size 1 virtual_protect 0
if
    2@ == 0  // ensure door is closed
then
    0085: 1@ = 0@
    1@ += 0x19  // rotate door for garage
    05E0: 2@ = read_memory 1@ size 1 virtual_protect 0
    if
        2@ == 1
    then
        05DF: write_memory 1@ size 1 value 0 virtual_protect 0  // switch off rotation
        0085: 1@ = 0@
        1@ += 0x58  // maximum height for garage
        05E0: 2@ = read_memory 1@ size 4 virtual_protect 0
        2@ += 0.1
        2@ *= 2.0
        05DF: write_memory 1@ size 4 value 2@ virtual_protect 0  // set maximum height
    end
end
05F6: ret 0

or for GTA III:

:opcode_03BB_supplement
// 0@ - input param (garage handle)
0@ *= 0x8C  // size of each garage struct
0@ += 0x72BCD0  // base address for garages
0085: 1@ = 0@
1@ += 1  // door state for garage
05E0: 2@ = read_memory 1@ size 1 virtual_protect 0
if
    2@ == 0  // ensure door is closed
then
    0085: 1@ = 0@
    1@ += 0x19  // rotate door for garage
    05E0: 2@ = read_memory 1@ size 1 virtual_protect 0
    if
        2@ == 1
    then
        05DF: write_memory 1@ size 1 value 0 virtual_protect 0  // switch off rotation
        0085: 1@ = 0@
        1@ += 0x38  // maximum height for garage
        05E0: 2@ = read_memory 1@ size 4 virtual_protect 0
        2@ += 0.1
        2@ *= 2.0
        05DF: write_memory 1@ size 4 value 2@ 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