Difference between revisions of "03BB"
Jump to navigation
Jump to search
m |
(reset garage door) |
||
Line 9: | Line 9: | ||
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. | 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 in Vice City 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 Vice City in an external script (not the main one) and tested on US v1.0. Place this at the end of the file: | ||
+ | {{Pre|class=sb-code|1= | ||
+ | <span class="nl">:opcode_03BB_supplement</span> | ||
+ | <span class="c1">// 0@ - input param (garage handle)</span> | ||
+ | <span class="nv">0@</span> *= <span class="m">0xA8</span> <span class="c1">// size of each garage struct</span> | ||
+ | <span class="nv">0@</span> += <span class="m">0x812668</span> <span class="c1">// base address for garages</span> | ||
+ | 0085: <span class="nv">1@</span> = <span class="nv">0@</span> | ||
+ | <span class="nv">1@</span> += <span class="m">1</span> <span class="c1">// door state for garage</span> | ||
+ | [[0A8D|05E0]]: <span class="nv">2@</span> = read_memory <span class="nv">1@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span> | ||
+ | <span class="k">if</span> | ||
+ | <span class="nv">2@</span> == <span class="m">0</span> <span class="c1">// ensure door is closed</span> | ||
+ | <span class="k">then</span> | ||
+ | 0085: <span class="nv">1@</span> = <span class="nv">0@</span> | ||
+ | <span class="nv">1@</span> += <span class="m">0x19</span> <span class="c1">// rotate door for garage</span> | ||
+ | [[0A8D|05E0]]: <span class="nv">2@</span> = read_memory <span class="nv">1@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span> | ||
+ | <span class="k">if</span> | ||
+ | <span class="nv">2@</span> == <span class="m">1</span> | ||
+ | <span class="k">then</span> | ||
+ | [[0A8C|05DF]]: write_memory <span class="nv">1@</span> size <span class="m">1</span> value <span class="m">0</span> virtual_protect <span class="m">0</span> <span class="c1">// switch off rotation</span> | ||
+ | 0085: <span class="nv">1@</span> = <span class="nv">0@</span> | ||
+ | <span class="nv">1@</span> += <span class="m">0x58</span> <span class="c1">// maximum height for garage</span> | ||
+ | [[0A8D|05E0]]: <span class="nv">2@</span> = read_memory <span class="nv">1@</span> size <span class="m">4</span> virtual_protect <span class="m">0</span> | ||
+ | <span class="nv">2@</span> += <span class="m">0.1</span> | ||
+ | <span class="nv">2@</span> *= <span class="m">2.0</span> | ||
+ | [[0A8C|05DF]]: write_memory <span class="nv">1@</span> size <span class="m">4</span> value <span class="nv">2@</span> virtual_protect <span class="m">0</span> <span class="c1">// set maximum height</span> | ||
+ | <span class="k">end</span> | ||
+ | <span class="k">end</span> | ||
+ | [[0AB2|05F6]]: ret <span class="m">0</span> | ||
+ | }} | ||
+ | |||
+ | Use this line as a supplement for opcode 03BB. This can be placed anywhere within the external script: | ||
+ | {{Pre|class=sb-code|1= | ||
+ | [[0AB1|05F5]]: call_scm_func <span class="nl">@opcode_03BB_supplement</span> inputs <span class="m">1</span> garage_handle [garage handle] | ||
+ | }} | ||
== Keywords == | == Keywords == | ||
set, garage, door, rotate, swing, open | set, garage, door, rotate, swing, open |
Revision as of 17:40, 2 July 2017
- 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 in Vice City 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 Vice City in an external script (not the main one) and tested on US v1.0. Place this at the end of the file:
: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
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