Difference between revisions of "0299"

From GTAMods Wiki
Jump to navigation Jump to search
m
(highlight)
Line 9: Line 9:
 
| p1d        = The [[Garage#GTA III 2|handle of the garage]], for GTA III
 
| p1d        = The [[Garage#GTA III 2|handle of the garage]], for GTA III
 
| p2t        = [''string'']
 
| p2t        = [''string'']
| p2d        = The [[Garage#San Andreas 2|name of the garage]], for San Andreas (max size 7 characters)
+
| p2d        = The [[Garage#San Andreas 2|name of the garage]], for San Andreas
 
}}
 
}}
  
Line 16: Line 16:
 
== For Vice City ==
 
== For Vice City ==
 
This opcode does not exist in Vice City, but garages do not ever deactivate in the game without using the code snippet for [[02B9#For Vice City|simulating opcode 02B9]]. 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:
 
This opcode does not exist in Vice City, but garages do not ever deactivate in the game without using the code snippet for [[02B9#For Vice City|simulating opcode 02B9]]. 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:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
:opcode_0299
+
<span class="nl">:opcode_0299</span>
// 0@ - input param (garage handle)
+
<span class="c1">// 0@ - input param (garage handle)</span>
0@ *= 0xA8  // size of each garage block
+
<span class="nv">0@</span> *= <span class="m">0xA8</span> <span class="c1">// size of each garage block</span>
0@ += 0x812668  // add to beginning of garage block
+
<span class="nv">0@</span> += <span class="m">0x812668</span> <span class="c1">// add to beginning of garage block</span>
05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage type
+
05E0: <span class="nv">1@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span> <span class="c1">// read garage type</span>
if
+
<span class="k">if</span>
     1@ == 11  // is garage type 11
+
     <span class="nv">1@</span> == <span class="m">11</span> <span class="c1">// is garage type 11</span>
then
+
<span class="k">then</span>
     0@ += 1  // door state offset
+
     <span class="nv">0@</span> += <span class="m">1</span> <span class="c1">// door state offset</span>
     05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage door state
+
     05E0: <span class="nv">1@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span> <span class="c1">// read garage door state</span>
     if
+
     <span class="k">if</span>
         1@ == 0  // is door closed
+
         <span class="nv">1@</span> == <span class="m">0</span> <span class="c1">// is door closed</span>
     then
+
     <span class="k">then</span>
         05DF: write_memory 0@ size 1 value 3 virtual_protect 0  // open garage door
+
         05DF: write_memory <span class="nv">0@</span> size <span class="m">1</span> value <span class="m">3</span> virtual_protect <span class="m">0</span> <span class="c1">// open garage door</span>
     end
+
     <span class="k">end</span>
     0@ -= 1
+
     <span class="nv">0@</span> -= <span class="m">1</span>
end
+
<span class="k">end</span>
0@ += 5  // activation offset
+
<span class="nv">0@</span> += <span class="m">5</span> <span class="c1">// activation offset</span>
05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // activate garage
+
05DF: write_memory <span class="nv">0@</span> size <span class="m">1</span> value <span class="m">0</span> virtual_protect <span class="m">0</span> <span class="c1">// activate garage</span>
05F6: ret 0
+
05F6: ret <span class="m">0</span>
</syntaxhighlight>
+
}}
  
 
Use this line as a substitute for opcode 0299. This can be placed anywhere within the external script:
 
Use this line as a substitute for opcode 0299. This can be placed anywhere within the external script:
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
05F5: call_scm_func @opcode_0299 inputs 1 garage_handle [garage handle]
+
05F5: call_scm_func <span class="nl">@opcode_0299</span> inputs <span class="m">1</span> garage_handle [garage handle]
</syntaxhighlight>
+
}}
  
 
== Keywords ==
 
== Keywords ==

Revision as of 03:39, 25 November 2016

GTA III San Andreas ACTIVATE_GARAGE


Description
Activates a garage
Syntax
GTA III 0299: activate_garage [garage handle]
San Andreas 0299: activate_garage '[string]'
San Andreas Garage.Activate( '[string]' )
Parameter
[garage handle]
The handle of the garage, for GTA III
[string]
The name of the garage, for San Andreas

This opcode activates a garage that has been deactivated through opcode 02B9. In GTA III for garage type 11, this opcode has an additional function of allowing the door of the garage to open.

For Vice City

This opcode does not exist in Vice City, but garages do not ever deactivate in the game without using the code snippet for simulating opcode 02B9. 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_0299
// 0@ - input param (garage handle)
0@ *= 0xA8  // size of each garage block
0@ += 0x812668  // add to beginning of garage block
05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage type
if
    1@ == 11  // is garage type 11
then
    0@ += 1  // door state offset
    05E0: 1@ = read_memory 0@ size 1 virtual_protect 0  // read garage door state
    if
        1@ == 0  // is door closed
    then
        05DF: write_memory 0@ size 1 value 3 virtual_protect 0  // open garage door
    end
    0@ -= 1
end
0@ += 5  // activation offset
05DF: write_memory 0@ size 1 value 0 virtual_protect 0  // activate garage
05F6: ret 0

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

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

Keywords

set, garage, activate, enable

External link