Difference between revisions of "015E"
(Created page with "{{OpCode | games = {{Icon|3}} | command = IS_CAR_IN_AIR | description = Checks if the car is in the air | syntax1 = 015E: car [''car handle''] in_air | p1...") |
(highlight) |
||
Line 12: | Line 12: | ||
== For Vice City == | == For Vice City == | ||
This opcode does not exist in Vice City but it is possible to recreate this opcode. 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. Like for boats, it produces an inconsistent return result for motorbikes. Place this at the end of the file: | This opcode does not exist in Vice City but it is possible to recreate this opcode. 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. Like for boats, it produces an inconsistent return result for motorbikes. Place this at the end of the file: | ||
− | < | + | {{Pre|class=sb-code|1= |
− | :opcode_015E | + | <span class="nl">:opcode_015E</span> |
− | // 0@ - input param (car handle) | + | <span class="c1">// 0@ - input param (car handle)</span> |
− | 05E7: 0@ = car 0@ struct | + | 05E7: <span class="nv">0@</span> = car <span class="nv">0@</span> struct |
− | 0@ += 0x5C5 // number of wheels on ground offset | + | <span class="nv">0@</span> += <span class="m">0x5C5</span> <span class="c1">// number of wheels on ground offset</span> |
− | 05E0: 0@ = read_memory 0@ size 1 virtual_protect 0 // get value | + | 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> <span class="c1">// get value</span> |
− | 0@ == 0 | + | <span class="nv">0@</span> == <span class="m">0</span> |
− | 05F6: ret 0 | + | 05F6: ret <span class="m">0</span> |
− | </ | + | }} |
Use this line as a substitute for opcode 015E. This can be placed anywhere within the external script as a conditional statement: | Use this line as a substitute for opcode 015E. This can be placed anywhere within the external script as a conditional statement: | ||
− | < | + | {{Pre|class=sb-code|1= |
− | // ... | + | <span class="c1">// ...</span> |
− | if | + | <span class="k">if</span> |
− | 05F5: call_scm_func @opcode_015E inputs 1 car_handle [car_handle] | + | 05F5: call_scm_func <span class="nl">@opcode_015E</span> inputs <span class="m">1</span> car_handle [car_handle] |
− | then | + | <span class="k">then</span> |
− | // [RETURNED TRUE] | + | <span class="c1">// [RETURNED TRUE]</span> |
− | else | + | <span class="k">else</span> |
− | // [RETURNED FALSE] | + | <span class="c1">// [RETURNED FALSE]</span> |
− | end | + | <span class="k">end</span> |
− | // ... | + | <span class="c1">// ...</span> |
− | </ | + | }} |
== Keywords == | == Keywords == | ||
check, car, vehicle, in, air, wheels, on, ground | check, car, vehicle, in, air, wheels, on, ground |
Latest revision as of 02:29, 4 December 2016
- Description
- Checks if the car is in the air
- Syntax
- 015E: car [car handle] in_air
- Parameter
- [car handle]
- The handle of the vehicle
This conditional opcode returns true depending on the drive type of the car under these circumstances. If the car is front-wheel drive, the opcode returns true if both the front wheels are off the ground. If the car is rear-wheel drive, the opcode returns true if both the rear wheels are off the ground. If the car is four-wheel drive, the opcode returns true if all four wheels are off the ground. Oddly for boats, the opcode produces an inconsistent return result. It returns true for some boats and false for others. Legacy documentation incorrectly described this opcode as checking if the car's wheels are on the ground.
For Vice City
This opcode does not exist in Vice City but it is possible to recreate this opcode. 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. Like for boats, it produces an inconsistent return result for motorbikes. Place this at the end of the file:
:opcode_015E // 0@ - input param (car handle) 05E7: 0@ = car 0@ struct 0@ += 0x5C5 // number of wheels on ground offset 05E0: 0@ = read_memory 0@ size 1 virtual_protect 0 // get value 0@ == 0 05F6: ret 0
Use this line as a substitute for opcode 015E. This can be placed anywhere within the external script as a conditional statement:
// ... if 05F5: call_scm_func @opcode_015E inputs 1 car_handle [car_handle] then // [RETURNED TRUE] else // [RETURNED FALSE] end // ...
Keywords
check, car, vehicle, in, air, wheels, on, ground