Difference between revisions of "02DE"
Jump to navigation
Jump to search
(Created page with "__NOTOC__{{Icon|3}} {{Icon|VC}} '''IS_PLAYER_IN_TAXI''' <hr /> '''Description''' : Checks if the player is in a taxi '''Syntax''' : 02DE: player [''player handle''] dri...") |
|||
Line 1: | Line 1: | ||
− | __NOTOC__{{Icon|3}} {{Icon|VC}} | + | __NOTOC__ |
− | + | {{OpCode | |
− | + | | games = {{Icon|3}} {{Icon|VC}} | |
− | + | | command = IS_PLAYER_IN_TAXI | |
− | + | | description = Checks if the player is in a taxi | |
− | + | | syntax1 = 02DE: player [''player handle''] in_taxi | |
− | + | | p1t = [''player handle''] | |
− | + | | p1d = The [[0053|handle of the player]] | |
− | + | }} | |
− | This opcode returns true if the player is in a taxi. | + | This conditional opcode returns true if the player is in a taxi. It recognizes the following list of vehicles as taxis. |
− | {| class="wikitable" style="text-align: center;" | + | {|class="wikitable" style="text-align: center;" |
− | ! style="width: 8em;" | {{Icon|3}} || style="width: 8em;" | {{Icon|VC}} | + | !style="width: 8em;" |{{Icon|3}} ||style="width: 8em;" |{{Icon|VC}} |
|- | |- | ||
− | | colspan="2" | Taxi | + | |colspan="2" |Taxi |
|- | |- | ||
− | | colspan="2" | Cabbie | + | |colspan="2" |Cabbie |
|- | |- | ||
− | | Borgnine || Zebra Cab | + | |Borgnine ||Zebra Cab |
|- | |- | ||
− | | || Kaufman Cab | + | |||Kaufman Cab |
|} | |} | ||
The opcode is [[List of unsupported opcodes|unsupported]] in [[San Andreas]] and is superseded by opcode [[0602]]. | The opcode is [[List of unsupported opcodes|unsupported]] in [[San Andreas]] and is superseded by opcode [[0602]]. | ||
== Disassembled code == | == Disassembled code == | ||
− | These are disassembled code for this opcode both from v1.0 US. | + | These are disassembled code for this opcode both from PC v1.0 US. |
=== GTA III === | === GTA III === | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="nasm" style="overflow-x: auto;"> |
− | + | loc_446A93: | |
− | + | lea eax, [edi+10h] ; get address of script's current instruction pointer | |
− | + | mov ecx, edi ; get CRunningScript pointer 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 | |
− | ; | + | mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle |
− | + | xor al, al ; set compare flag to false | |
− | + | imul ecx, 4Fh | |
− | + | mov esi, ds:CWorld::Players[ecx*4] ; get address of the player at CWorld::Players + player handle * 0x4F * 4 | |
− | + | cmp byte ptr [esi+314h], 0 ; offset player address by 0x314 and check whether or not the player is in car | |
− | + | jz short loc_446ADC | |
− | + | mov edx, [esi+310h] ; offset player address by 0x310 to get address of last entered car | |
− | + | movsx ebx, word ptr [edx+5Ch] ; offset last entered car address by 0x5C to get the model index of the car | |
− | + | cmp ebx, 6Eh ; compare model index with 0x6E, Taxi | |
− | + | jz short loc_446ADA | |
− | + | cmp ebx, 80h ; compare model index with 0x80, Cabbie | |
− | + | jz short loc_446ADA | |
− | + | cmp ebx, 94h ; compare model index with 0x94, Borgnine | |
− | + | jnz short loc_446ADC | |
− | + | loc_446ADA: | |
− | + | mov al, 1 ; set compare flag to true | |
− | + | loc_446ADC: | |
− | + | mov ecx, edi ; get CRunningScript pointer for thiscall | |
− | + | push eax ; push compare flag | |
− | + | call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag | |
− | ; | + | xor al, al ; return 0 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Vice City === | === Vice City === | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="nasm" style="overflow-x: auto;"> |
− | + | loc_45600E: | |
− | + | lea eax, [ebp+10h] ; get address of script's current instruction pointer | |
− | + | mov ecx, ebp ; get CRunningScript pointer 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 | |
− | ; | + | mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle |
− | + | xor al, al ; set compare flag to false | |
− | + | imul ecx, 2Eh | |
− | + | mov ebx, ds:CWorld::Players[ecx*8] ; get address of the player at CWorld::Players + player handle * 0x2E * 8 | |
− | + | cmp byte ptr [ebx+3ACh], 0 ; offset player address by 0x3AC and check whether or not the player is in car | |
− | + | jz short loc_456066 | |
− | + | mov edx, [ebx+3A8h] ; offset player address by 0x3A8 to get address of last entered car | |
− | + | test edx, edx ; checks whether or not the last entered car address is null | |
− | + | jz short loc_456066 | |
− | + | movsx edi, word ptr [edx+5Ch] ; offset last entered car address by 0x5C to get the model index of the car | |
− | + | cmp edi, 96h ; compare model index with 0x96, Taxi | |
− | + | jz short loc_456064 | |
− | + | cmp edi, 0A8h ; compare model index with 0xA8, Cabbie | |
− | + | jz short loc_456064 | |
− | + | cmp edi, 0BCh ; compare model index with 0xBC, Zebra Cab | |
− | + | jz short loc_456064 | |
− | + | cmp edi, 0D8h ; compare model index with 0xD8, Kaufman Cab | |
− | + | jnz short loc_456066 | |
− | + | loc_456064: | |
− | + | mov al, 1 ; set compare flag to true | |
− | + | loc_456066: | |
− | + | mov ecx, ebp ; get CRunningScript pointer for thiscall | |
− | + | push eax ; push compare flag | |
− | + | call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag | |
− | ; | + | xor al, al ; return 0 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Keywords == | == Keywords == | ||
− | check, player, driving, taxi | + | check, player, driving, taxi, cab, cabbie |
− | |||
− |
Revision as of 08:32, 7 November 2016
- Description
- Checks if the player is in a taxi
- Syntax
- 02DE: player [player handle] in_taxi
- Parameter
- [player handle]
- The handle of the player
This conditional opcode returns true if the player is in a taxi. It recognizes the following list of vehicles as taxis.
Taxi | |
Cabbie | |
Borgnine | Zebra Cab |
Kaufman Cab |
The opcode is unsupported in San Andreas and is superseded by opcode 0602.
Disassembled code
These are disassembled code for this opcode both from PC v1.0 US.
GTA III
loc_446A93:
lea eax, [edi+10h] ; get address of script's current instruction pointer
mov ecx, edi ; get CRunningScript pointer 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
mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle
xor al, al ; set compare flag to false
imul ecx, 4Fh
mov esi, ds:CWorld::Players[ecx*4] ; get address of the player at CWorld::Players + player handle * 0x4F * 4
cmp byte ptr [esi+314h], 0 ; offset player address by 0x314 and check whether or not the player is in car
jz short loc_446ADC
mov edx, [esi+310h] ; offset player address by 0x310 to get address of last entered car
movsx ebx, word ptr [edx+5Ch] ; offset last entered car address by 0x5C to get the model index of the car
cmp ebx, 6Eh ; compare model index with 0x6E, Taxi
jz short loc_446ADA
cmp ebx, 80h ; compare model index with 0x80, Cabbie
jz short loc_446ADA
cmp ebx, 94h ; compare model index with 0x94, Borgnine
jnz short loc_446ADC
loc_446ADA:
mov al, 1 ; set compare flag to true
loc_446ADC:
mov ecx, edi ; get CRunningScript pointer for thiscall
push eax ; push compare flag
call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag
xor al, al ; return 0
Vice City
loc_45600E:
lea eax, [ebp+10h] ; get address of script's current instruction pointer
mov ecx, ebp ; get CRunningScript pointer 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
mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle
xor al, al ; set compare flag to false
imul ecx, 2Eh
mov ebx, ds:CWorld::Players[ecx*8] ; get address of the player at CWorld::Players + player handle * 0x2E * 8
cmp byte ptr [ebx+3ACh], 0 ; offset player address by 0x3AC and check whether or not the player is in car
jz short loc_456066
mov edx, [ebx+3A8h] ; offset player address by 0x3A8 to get address of last entered car
test edx, edx ; checks whether or not the last entered car address is null
jz short loc_456066
movsx edi, word ptr [edx+5Ch] ; offset last entered car address by 0x5C to get the model index of the car
cmp edi, 96h ; compare model index with 0x96, Taxi
jz short loc_456064
cmp edi, 0A8h ; compare model index with 0xA8, Cabbie
jz short loc_456064
cmp edi, 0BCh ; compare model index with 0xBC, Zebra Cab
jz short loc_456064
cmp edi, 0D8h ; compare model index with 0xD8, Kaufman Cab
jnz short loc_456066
loc_456064:
mov al, 1 ; set compare flag to true
loc_456066:
mov ecx, ebp ; get CRunningScript pointer for thiscall
push eax ; push compare flag
call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag
xor al, al ; return 0
Keywords
check, player, driving, taxi, cab, cabbie