Difference between revisions of "02DE"

From GTAMods Wiki
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...")
 
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__{{Icon|3}} {{Icon|VC}} '''IS_PLAYER_IN_TAXI'''
+
__NOTOC__
<hr />
+
{{OpCode
'''Description'''
+
| games      = {{Icon|3}} {{Icon|VC}}
: Checks if the player is in a taxi
+
| command    = IS_PLAYER_IN_TAXI
'''Syntax'''
+
| description = Checks if the player is in a taxi
: 02DE: &nbsp; player [''player handle''] driving_taxi_vehicle
+
| syntax1    = 02DE: &nbsp; player [''player handle''] in_taxi
'''Parameter'''
+
| p1t        = [''player handle'']
: [''player handle'']
+
| p1d        = The [[0053|handle of the player]]
:: The handle of the [[0053|player]]
+
}}
  
This opcode returns true if the player is in a taxi. The game will recognize the following list of vehicles as taxis.
+
This conditional opcode returns true if the player is in a taxi. It recognizes the following as taxis:
{| class="wikitable" style="text-align: center;"
+
{|class="wikitable sortable"
! style="width: 8em;" | {{Icon|3}} || style="width: 8em;" | {{Icon|VC}}
+
!colspan="2" |{{Icon|3}} ||colspan="2" |{{Icon|VC}} ||colspan="2" |{{Icon|LCS}}
 
|-
 
|-
| colspan="2" | Taxi
+
!Id ||Name ||Id ||Name ||Id ||Name
 
|-
 
|-
| colspan="2" | Cabbie
+
|110 ||Taxi ||150 ||Taxi ||151 ||Taxi
 
|-
 
|-
| Borgnine || Zebra Cab
+
|128 ||Cabbie ||168 ||Cabbie ||166 ||Cabbie
 
|-
 
|-
| || Kaufman Cab
+
|148 ||Borgnine ||188 ||Zebra Cab ||181 ||Bickle'76
 +
|-
 +
|||||216 ||Kaufman Cab ||||
 
|}
 
|}
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="asm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm">
; call subroutine to collect values from input parameters
+
loc_446A93:
.text:00446A93                lea    eax, [edi+10h]
+
    lea    eax, [edi+10h]                   ; get address of script's current instruction pointer
.text:00446A96                mov    ecx, edi
+
    mov    ecx, edi                         ; get address of script for thiscall
.text:00446A98                push    1 ; one parameter to collect
+
    push    1                                 ; push 1 for one parameter to collect
.text:00446A9A                push    eax
+
    push    eax                               ; push address of script's current instruction pointer
.text:00446A9B                call    CRunningScript__CollectParameters
+
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
; read collected content
+
    mov    ecx, ds:ScriptParams[0]          ; get value of first parameter, the player handle
.text:00446AA0                mov    ecx, ds:_opcodeParameter1
+
    xor    al, al                           ; set compare flag to false
.text:00446AA6                xor    al, al
+
    imul    ecx, 4Fh
.text:00446AA8                imul    ecx, 4Fh
+
    mov    esi, ds:CWorld::Players[ecx*4]   ; get address of player ped at CWorld::Players + player handle * 0x4F * 4
.text:00446AAB                mov    esi, ds:_playerInfo[ecx*4] ; address of the player
+
    cmp    byte ptr [esi+314h], 0           ; offset player ped address by 0x314 and check whether or not the player ped is in a vehicle
.text:00446AB2                cmp    byte ptr [esi+314h], 0 ; offset 0x314 to check whether or not the player is in car
+
    jz      short loc_446ADC
.text:00446AB9                jz      short loc_446ADC
+
    mov    edx, [esi+310h]                   ; offset player ped address by 0x310 to get address of last entered vehicle
.text:00446ABB                mov    edx, [esi+310h] ; offset 0x310 to get pointer of last entered car
+
    movsx  ebx, word ptr [edx+5Ch]           ; offset last entered vehicle address by 0x5C to get the model index of the vehicle
.text:00446AC1                movsx  ebx, word ptr [edx+5Ch] ; offset 0x5C from car pointer to get the model of the car
+
    cmp    ebx, 6Eh                         ; compare model index with 0x6E, Taxi
.text:00446AC5                cmp    ebx, 6Eh ; 110, Taxi
+
    jz      short loc_446ADA
.text:00446AC8                jz      short loc_446ADA
+
    cmp    ebx, 80h                         ; compare model index with 0x80, Cabbie
.text:00446ACA                cmp    ebx, 80h ; 128, Cabbie
+
    jz      short loc_446ADA
.text:00446AD0                jz      short loc_446ADA
+
    cmp    ebx, 94h                         ; compare model index with 0x94, Borgnine
.text:00446AD2                cmp    ebx, 94h ; 148, Borgnine
+
    jnz    short loc_446ADC
.text:00446AD8                jnz    short loc_446ADC
+
loc_446ADA:
.text:00446ADA loc_446ADA:    mov    al, 1 ; set compare flag to true
+
     mov    al, 1                             ; set compare flag to true
; call subroutine to update compare flag true or false
+
loc_446ADC:
.text:00446ADC loc_446ADC:    mov    ecx, edi
+
     mov    ecx, edi                         ; get address of script for thiscall
.text:00446ADE                push    eax
+
    push    eax                               ; push compare flag
.text:00446ADF                call    CRunningScript__UpdateCompareFlag
+
    call    CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar)
; end
+
    xor    al, al                           ; return 0
.text:00446AE4                xor    al, al
 
.text:00446AE6                add    esp, 210h
 
.text:00446AEC                pop    ebp
 
.text:00446AED                pop    edi
 
.text:00446AEE                pop    esi
 
.text:00446AEF                pop    ebx
 
.text:00446AF0                retn    4
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Vice City ===
 
=== Vice City ===
<syntaxhighlight lang="asm" style="overflow-x: auto;">
+
<syntaxhighlight lang="nasm">
; call subroutine to collect values from input parameters
+
loc_45600E:
.text:0045600E                lea    eax, [ebp+10h]
+
    lea    eax, [ebp+10h]                   ; get address of script's current instruction pointer
.text:00456011                mov    ecx, ebp
+
    mov    ecx, ebp                         ; get address of script for thiscall
.text:00456013                push    1 ; one parameter to collect
+
    push    1                                 ; push 1 for one parameter to collect
.text:00456015                push    eax
+
    push    eax                               ; push address of script's current instruction pointer
.text:00456016                call    CRunningScript__CollectParameters
+
    call    CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short)
; read collected content
+
    mov    ecx, ds:ScriptParams[0]          ; get value of first parameter, the player handle
.text:0045601B                mov    ecx, ds:_opcodeParameter1
+
    xor    al, al                           ; set compare flag to false
.text:00456021                xor    al, al
+
    imul    ecx, 2Eh
.text:00456023                imul    ecx, 2Eh
+
    mov    ebx, ds:CWorld::Players[ecx*8]   ; get address of player ped at CWorld::Players + player handle * 0x2E * 8
.text:00456026                mov    ebx, ds:_playerInfo[ecx*8] ; address of the player
+
    cmp    byte ptr [ebx+3ACh], 0           ; offset player ped address by 0x3AC and check whether or not the player ped is in a vehicle
.text:0045602D                cmp    byte ptr [ebx+3ACh], 0 ; offset 0x3AC to check whether or not the player is in car
+
    jz      short loc_456066
.text:00456034                jz      short loc_456066
+
    mov    edx, [ebx+3A8h]                   ; offset player ped address by 0x3A8 to get address of last entered vehicle
.text:00456036                mov    edx, [ebx+3A8h] ; offset 0x3A8 to get pointer of last entered car
+
    test    edx, edx                         ; check whether or not the last entered vehicle address is null
.text:0045603C                test    edx, edx
+
    jz      short loc_456066
.text:0045603E                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
.text:00456040                movsx  edi, word ptr [edx+5Ch] ; offset 0x5C from car pointer to get the model of the car
+
    cmp    edi, 96h                         ; compare model index with 0x96, Taxi
.text:00456044                cmp    edi, 96h ; 150, Taxi
+
    jz      short loc_456064
.text:0045604A                jz      short loc_456064
+
    cmp    edi, 0A8h                         ; compare model index with 0xA8, Cabbie
.text:0045604C                cmp    edi, 0A8h ; 168, Cabbie
+
    jz      short loc_456064
.text:00456052                jz      short loc_456064
+
    cmp    edi, 0BCh                         ; compare model index with 0xBC, Zebra Cab
.text:00456054                cmp    edi, 0BCh ; 188, Zebra Cab
+
    jz      short loc_456064
.text:0045605A                jz      short loc_456064
+
    cmp    edi, 0D8h                         ; compare model index with 0xD8, Kaufman Cab
.text:0045605C                cmp    edi, 0D8h ; 216, Kaufman Cab
+
    jnz    short loc_456066
.text:00456062                jnz    short loc_456066
+
loc_456064:
.text:00456064 loc_456064:    mov    al, 1 ; set compare flag to true
+
     mov    al, 1                             ; set compare flag to true
; call subroutine to update compare flag true or false
+
loc_456066:
.text:00456066 loc_456066:    mov    ecx, ebp
+
     mov    ecx, ebp                         ; get address of script for thiscall
.text:00456068                push    eax
+
    push    eax                               ; push compare flag
.text:00456069                call    CRunningScript__UpdateCompareFlag
+
    call    CRunningScript::UpdateCompareFlag ; call CRunningScript::UpdateCompareFlag(uchar)
; end
+
    xor    al, al                           ; return 0
.text:0045606E                xor    al, al
 
.text:00456070                add    esp, 1A8h
 
.text:00456076                pop    ebp
 
.text:00456077                pop    edi
 
.text:00456078                pop    esi
 
.text:00456079                pop    ebx
 
.text:0045607A                retn    4
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==
check, player, driving, taxi
+
check, player, driving, taxi, cab, cabbie
  
[[Category:OpCodes]]
+
== See also ==
 +
* {{Icon|3}} [[0295]], checks if the vehicle is a taxi
 +
* {{Icon|SA}} [[0602]], checks if the character is in a taxi

Latest revision as of 04:07, 24 May 2017

GTA III Vice City IS_PLAYER_IN_TAXI


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:

GTA III Vice City Liberty City Stories
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

See also

  • GTA III 0295, checks if the vehicle is a taxi
  • San Andreas 0602, checks if the character is in a taxi