Difference between revisions of "02DE"
Jump to navigation
Jump to search
(added lcs) |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 27: | Line 27: | ||
These are disassembled code for this opcode both from PC v1.0 US. | These are disassembled code for this opcode both from PC v1.0 US. | ||
=== GTA III === | === GTA III === | ||
− | <syntaxhighlight lang="nasm | + | <syntaxhighlight lang="nasm"> |
loc_446A93: | loc_446A93: | ||
lea eax, [edi+10h] ; get address of script's current instruction pointer | lea eax, [edi+10h] ; get address of script's current instruction pointer | ||
− | mov ecx, edi ; get | + | mov ecx, edi ; 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 ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle | mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle | ||
xor al, al ; set compare flag to false | xor al, al ; set compare flag to false | ||
imul ecx, 4Fh | imul ecx, 4Fh | ||
− | mov esi, ds:CWorld::Players[ecx*4] ; get address of | + | mov esi, ds:CWorld::Players[ecx*4] ; get address of player ped 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 | + | cmp byte ptr [esi+314h], 0 ; offset player ped address by 0x314 and check whether or not the player ped is in a vehicle |
jz short loc_446ADC | jz short loc_446ADC | ||
− | mov edx, [esi+310h] ; offset player address by 0x310 to get address of last entered | + | mov edx, [esi+310h] ; offset player ped address by 0x310 to get address of last entered vehicle |
− | movsx ebx, word ptr [edx+5Ch] ; offset last entered | + | movsx ebx, word ptr [edx+5Ch] ; offset last entered vehicle address by 0x5C to get the model index of the vehicle |
cmp ebx, 6Eh ; compare model index with 0x6E, Taxi | cmp ebx, 6Eh ; compare model index with 0x6E, Taxi | ||
jz short loc_446ADA | jz short loc_446ADA | ||
Line 51: | Line 51: | ||
mov al, 1 ; set compare flag to true | mov al, 1 ; set compare flag to true | ||
loc_446ADC: | loc_446ADC: | ||
− | mov ecx, edi ; get | + | mov ecx, edi ; get address of script for thiscall |
push eax ; push compare flag | push eax ; 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> | ||
=== Vice City === | === Vice City === | ||
− | <syntaxhighlight lang="nasm | + | <syntaxhighlight lang="nasm"> |
loc_45600E: | loc_45600E: | ||
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 | + | 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 ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle | mov ecx, ds:ScriptParams[0] ; get value of first parameter, the player handle | ||
xor al, al ; set compare flag to false | xor al, al ; set compare flag to false | ||
imul ecx, 2Eh | imul ecx, 2Eh | ||
− | mov ebx, ds:CWorld::Players[ecx*8] ; get address of | + | mov ebx, ds:CWorld::Players[ecx*8] ; get address of player ped 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 | + | cmp byte ptr [ebx+3ACh], 0 ; offset player ped address by 0x3AC and check whether or not the player ped is in a vehicle |
jz short loc_456066 | jz short loc_456066 | ||
− | mov edx, [ebx+3A8h] ; offset player address by 0x3A8 to get address of last entered | + | mov edx, [ebx+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle |
− | test edx, edx ; | + | test edx, edx ; check whether or not the last entered vehicle address is null |
jz short loc_456066 | jz short loc_456066 | ||
− | movsx edi, word ptr [edx+5Ch] ; offset last entered | + | movsx edi, word ptr [edx+5Ch] ; offset last entered vehicle address by 0x5C to get the model index of the vehicle |
cmp edi, 96h ; compare model index with 0x96, Taxi | cmp edi, 96h ; compare model index with 0x96, Taxi | ||
jz short loc_456064 | jz short loc_456064 | ||
Line 86: | Line 86: | ||
mov al, 1 ; set compare flag to true | mov al, 1 ; set compare flag to true | ||
loc_456066: | loc_456066: | ||
− | mov ecx, ebp ; get | + | mov ecx, ebp ; get address of script for thiscall |
push eax ; push compare flag | push eax ; 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 96: | Line 96: | ||
== See also == | == See also == | ||
+ | * {{Icon|3}} [[0295]], checks if the vehicle is a taxi | ||
* {{Icon|SA}} [[0602]], checks if the character is in a taxi | * {{Icon|SA}} [[0602]], checks if the character is in a taxi |
Latest revision as of 04:07, 24 May 2017
- 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 as taxis:
Id | Name | Id | Name | Id | Name |
---|---|---|---|---|---|
110 | Taxi | 150 | Taxi | 151 | Taxi |
128 | Cabbie | 168 | Cabbie | 166 | Cabbie |
148 | Borgnine | 188 | Zebra Cab | 181 | Bickle'76 |
216 | Kaufman Cab |
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 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 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 player ped at CWorld::Players + player handle * 0x4F * 4
cmp byte ptr [esi+314h], 0 ; offset player ped address by 0x314 and check whether or not the player ped is in a vehicle
jz short loc_446ADC
mov edx, [esi+310h] ; offset player ped address by 0x310 to get address of last entered vehicle
movsx ebx, word ptr [edx+5Ch] ; offset last entered vehicle address by 0x5C to get the model index of the vehicle
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 address of script for thiscall
push eax ; push compare flag
call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar)
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 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 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 player ped at CWorld::Players + player handle * 0x2E * 8
cmp byte ptr [ebx+3ACh], 0 ; offset player ped address by 0x3AC and check whether or not the player ped is in a vehicle
jz short loc_456066
mov edx, [ebx+3A8h] ; offset player ped address by 0x3A8 to get address of last entered vehicle
test edx, edx ; check whether or not the last entered vehicle address is null
jz short loc_456066
movsx edi, word ptr [edx+5Ch] ; offset last entered vehicle address by 0x5C to get the model index of the vehicle
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 address of script for thiscall
push eax ; push compare flag
call CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar)
xor al, al ; return 0
Keywords
check, player, driving, taxi, cab, cabbie