Difference between revisions of "029C"

From GTAMods Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Icon|3}} '''IS_BOAT'''
+
{{OpCode
<hr />
+
| games      = {{Icon|3}}
<onlyinclude>{{#ifeq:{{{transcludesection|opcode}}}|opcode|
+
| command    = IS_BOAT
'''Description'''
+
| description = Checks if the vehicle is a boat
: Checks if the vehicle is a boat
+
| syntax1    = 029C: &nbsp; is [''car handle''] boat
'''Syntax'''
+
| p1t        = [''car handle'']
: 029C: &nbsp; car [''car handle''] stopped
+
| p1d        = The handle of the vehicle
'''Parameter'''
+
}}
: [''car handle'']
 
:: The handle of the vehicle
 
  
This opcode returns true if the vehicle is of type boat. Most major documentations had incorrectly described this opcode. This mistake had remained undetected for a very long time.
+
This conditional opcode returns true if the vehicle is of [[CARS (IDE Section)#GTA III|type]] boat. Legacy documentations had incorrectly described this opcode as "car stopped," which had remained uncorrected for a long time.
}}</onlyinclude>
 
  
 
== For Vice City ==
 
== For Vice City ==
This opcode does not exist in Vice City, but the game still recognizes vehicles by type. The following example, using Sanny Builder with [[CLEO]] for Vice City, 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 the game can recognize vehicles by type. 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:
<source lang="scm">
+
{{Pre|class=sb-code|1=
:opcode_029C
+
<span class="nl">:opcode_029C</span>
05E7: 0@ = car {car handle} struct
+
05E7: <span class="nv">0@</span> = car <span class="nv">0@</span> struct
// change {car handle} to the actual handle of the vehicle
+
<span class="nv">0@</span> += <span class="m">0x29C</span> <span class="c1">// vehicle type offset</span>
0@ += 0x29C  // vehicle type offset
+
05E0: <span class="nv">0@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span>
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
+
     <span class="nv">0@</span> == <span class="m">1</span> <span class="c1">// is type boat</span>
if
+
05F6: ret <span class="m">0</span>
     0@ == 1  // is type boat
+
}}
then
+
 
    0485: return_true
+
Use this line as a substitute for opcode 029C. This can be placed anywhere within the external script as a conditional statement:
else
+
{{Pre|class=sb-code|1=
    059A: return_false
+
<span class="c1">// ...</span>
end
+
<span class="k">if</span>
return
+
     05F5: call_scm_func <span class="nl">@opcode_029C</span> inputs <span class="m">1</span> car_handle [car handle]
</source>
+
<span class="k">then</span>
Use the gosub as a substitute for opcode 029C. This can be placed only within an IF statement:
+
     <span class="c1">// [RETURNED TRUE]</span>
<source lang="scm">
+
<span class="k">else</span>
if
+
     <span class="c1">// [RETURNED FALSE]</span>
     gosub @opcode_029C
+
<span class="k">end</span>
then
+
<span class="c1">// ...</span>
     // [RETURNED TRUE]
+
}}
else
 
     // [RETURNED FALSE]
 
end
 
</source>
 
  
 
== Keywords ==
 
== Keywords ==
 
check, stopped, car, boat
 
check, stopped, car, boat
 
[[Category:OpCodes]][[Category:Code Snippets]]
 

Latest revision as of 06:45, 12 December 2016

GTA III IS_BOAT


Description
Checks if the vehicle is a boat
Syntax
029C:   is [car handle] boat
Parameter
[car handle]
The handle of the vehicle

This conditional opcode returns true if the vehicle is of type boat. Legacy documentations had incorrectly described this opcode as "car stopped," which had remained uncorrected for a long time.

For Vice City

This opcode does not exist in Vice City but the game can recognize vehicles by type. 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_029C
05E7: 0@ = car 0@ struct
0@ += 0x29C  // vehicle type offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
    0@ == 1  // is type boat
05F6: ret 0

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

// ...
if
    05F5: call_scm_func @opcode_029C inputs 1 car_handle [car handle]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

check, stopped, car, boat