Difference between revisions of "04C9"
Jump to navigation
Jump to search
m |
|||
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
}} | }} | ||
− | This conditional opcode returns true if the player is in a flying vehicle, either as a driver or a passenger. It behaves the same way as using both opcodes [[04AA]] and [[04AC]] together | + | This conditional opcode returns true if the player is in a flying vehicle, either as a driver or a passenger. It behaves the same way as using both opcodes [[04AA]] and [[04AC]] together. By default the game will recognize the following list of vehicles as flying vehicles (for which the IS_HELI or IS_PLANE flag is set in the [[Handling.cfg#Flag_Data_2|handling.cfg]] file): |
* Hunter | * Hunter | ||
* Maverick | * Maverick | ||
Line 23: | Line 23: | ||
== Disassembled code == | == Disassembled code == | ||
This is disassembled code for this opcode from PC v1.0 US. | This is disassembled code for this opcode from PC v1.0 US. | ||
− | <syntaxhighlight lang="nasm | + | <syntaxhighlight lang="nasm"> |
loc_630F46: | loc_630F46: | ||
lea eax, [ebp+10h] ; get address of script's current instruction pointer | lea eax, [ebp+10h] ; get address of script's current instruction pointer | ||
− | mov ecx, ebp ; get address of | + | mov ecx, ebp ; get address of script for thiscall |
push 1 ; push 1 for one parameter to collect | push 1 ; push 1 for one parameter to collect | ||
push eax ; push address of script's current instruction pointer | push eax ; push address of script's current instruction pointer | ||
− | call CRunningScript::CollectParameters ; call CRunningScript::CollectParameters | + | call CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short) |
mov edi, ds:ScriptParams[0] ; get value of first parameter, the player handle | mov edi, ds:ScriptParams[0] ; get value of first parameter, the player handle | ||
xor bl, bl ; set compare flag to false | xor bl, bl ; set compare flag to false | ||
Line 40: | Line 40: | ||
test ecx, ecx ; check whether or not the last entered vehicle address is null | test ecx, ecx ; check whether or not the last entered vehicle address is null | ||
jz short loc_630F9A | jz short loc_630F9A | ||
− | call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance | + | call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance(void) |
cmp eax, 5 ; check whether or not the vehicle is plane | cmp eax, 5 ; check whether or not the vehicle is plane | ||
jz short loc_630F98 | jz short loc_630F98 | ||
mov eax, [edi] ; get address of player ped at CWorld::Players + player handle * 0x170 | mov eax, [edi] ; get address of player ped at CWorld::Players + player handle * 0x170 | ||
mov ecx, [eax+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle for thiscall | mov ecx, [eax+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle for thiscall | ||
− | call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance | + | call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance(void) |
cmp eax, 3 ; check whether or not the vehicle is heli | cmp eax, 3 ; check whether or not the vehicle is heli | ||
jnz short loc_630F9A | jnz short loc_630F9A | ||
Line 51: | Line 51: | ||
mov bl, 1 ; set compare flag to true | mov bl, 1 ; set compare flag to true | ||
loc_630F9A: | loc_630F9A: | ||
− | mov ecx, ebp ; get address of | + | mov ecx, ebp ; get address of script for thiscall |
push ebx ; push compare flag | push ebx ; push compare flag | ||
− | call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag | + | call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar) |
xor al, al ; return 0 | xor al, al ; return 0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 59: | Line 59: | ||
== Keywords == | == Keywords == | ||
player, driving, any, plane, heli, helicopter, flying, vehicle | player, driving, any, plane, heli, helicopter, flying, vehicle | ||
+ | |||
+ | == See also == | ||
+ | * {{Icon|SA}} [[04C8]], checks if the character is in a flying vehicle |
Latest revision as of 17:43, 24 May 2017
- Description
- Checks if the player is in a flying vehicle
- Syntax
- 04C9: player [player handle] in_flying_vehicle
- Parameter
- [player handle]
- The handle of the player
This conditional opcode returns true if the player is in a flying vehicle, either as a driver or a passenger. It behaves the same way as using both opcodes 04AA and 04AC together. By default the game will recognize the following list of vehicles as flying vehicles (for which the IS_HELI or IS_PLANE flag is set in the handling.cfg file):
- Hunter
- Maverick
- Police Maverick
- RC Baron
- RC Goblin
- RC Raider
- Sea Sparrow
- Skimmer
- Sparrow
- VCN Maverick
Legacy documentation describes this as applying to just planes.
Disassembled code
This is disassembled code for this opcode from PC v1.0 US.
loc_630F46:
lea eax, [ebp+10h] ; get address of script's current instruction pointer
mov ecx, ebp ; get address of script for thiscall
push 1 ; push 1 for one parameter to collect
push eax ; push address of script's current instruction pointer
call CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
mov edi, ds:ScriptParams[0] ; get value of first parameter, the player handle
xor bl, bl ; set compare flag to false
imul edi, 170h
add edi, offset CWorld::Players
mov eax, [edi] ; get address of player ped at CWorld::Players + player handle * 0x170
cmp byte ptr [eax+3ACh], 0 ; offset player ped address by 0x3AC and check whether or not the player ped is in a vehicle
jz short loc_630F9A
mov ecx, [eax+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle for thiscall
test ecx, ecx ; check whether or not the last entered vehicle address is null
jz short loc_630F9A
call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance(void)
cmp eax, 5 ; check whether or not the vehicle is plane
jz short loc_630F98
mov eax, [edi] ; get address of player ped at CWorld::Players + player handle * 0x170
mov ecx, [eax+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle for thiscall
call CVehicle::GetVehicleAppearance ; call CVehicle::GetVehicleAppearance(void)
cmp eax, 3 ; check whether or not the vehicle is heli
jnz short loc_630F9A
loc_630F98:
mov bl, 1 ; set compare flag to true
loc_630F9A:
mov ecx, ebp ; get address of script for thiscall
push ebx ; push compare flag
call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar)
xor al, al ; return 0
Keywords
player, driving, any, plane, heli, helicopter, flying, vehicle
See also
- 04C8, checks if the character is in a flying vehicle