Difference between revisions of "057F"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{Icon|VC}} '''GET_BUS_FARES_COLLECTED_BY_PLAYER''' <hr /> '''Description''' : Gets the bus fares collected by the player '''Syntax''' : 057F: get_player [''player handle''] s...")
 
(trying out disassembly)
Line 12: Line 12:
  
 
This opcode gets the bus fares collected by the player so far. Bus fares can only be collected when you are stopped in a Coach at a bus stop. Each fare costs $5 so the value it can return will be in multiples of 5. Once this opcode is called, the bus fares collected ''will reset to 0 afterwards'' so you must store the value to another variable if you want to keep track of the total bus fares collected. You do not need to be in a Coach to use this opcode. The original script called this opcode only in the 'BUS' thread.
 
This opcode gets the bus fares collected by the player so far. Bus fares can only be collected when you are stopped in a Coach at a bus stop. Each fare costs $5 so the value it can return will be in multiples of 5. Once this opcode is called, the bus fares collected ''will reset to 0 afterwards'' so you must store the value to another variable if you want to keep track of the total bus fares collected. You do not need to be in a Coach to use this opcode. The original script called this opcode only in the 'BUS' thread.
 +
 +
== Disassembled code ==
 +
This is disassembled code for this opcode from v1.0 US.
 +
<syntaxhighlight lang="asm">
 +
; call subroutine to collect values from input parameters
 +
.text:00637836                lea    eax, [ebx+10h]
 +
.text:00637839                mov    ecx, ebx
 +
.text:0063783B                push    1  ; one parameter to collect
 +
.text:0063783D                push    eax
 +
.text:0063783E                call    CRunningScript__CollectParameters
 +
; read collected content
 +
.text:00637843                mov    edi, ds:_opcodeParameter1
 +
.text:00637849                imul    edi, 170h
 +
.text:0063784F                push    1
 +
.text:00637851                add    edi, offset _playerInfo  ; pointer to the player
 +
.text:00637857                mov    ecx, [edi]
 +
.text:00637859                mov    eax, [ecx+6D4h]  ; offset 0x6D4 to get bus fares collected
 +
.text:0063785F                mov    ecx, ebx
 +
.text:00637861                mov    ds:_opcodeParameter1, eax
 +
.text:00637866                mov    eax, [edi]
 +
.text:00637868                mov    dword ptr [eax+6D4h], 0  ; set bus fares collected to 0 after getting it
 +
; call subroutine to store value from output parameter into variable
 +
.text:00637872                lea    eax, [ebx+10h]
 +
.text:00637875                push    eax
 +
.text:00637876                call    CRunningScript__StoreParameters
 +
; end
 +
.text:0063787B                lea    esp, [ebp-0Ch]
 +
.text:0063787E                xor    al, al
 +
.text:00637880                pop    edi
 +
.text:00637881                pop    esi
 +
.text:00637882                pop    ebx
 +
.text:00637883                pop    ebp
 +
.text:00637884                retn    4
 +
</syntaxhighlight>
  
 
== Keywords ==
 
== Keywords ==

Revision as of 18:02, 13 January 2015

Vice City GET_BUS_FARES_COLLECTED_BY_PLAYER


Description

Gets the bus fares collected by the player

Syntax

057F: get_player [player handle] store_coach_passengers_dropped_off_to [var]

Parameter

[player handle]
The handle of the player
[var]
Variable to store the integer value

This opcode gets the bus fares collected by the player so far. Bus fares can only be collected when you are stopped in a Coach at a bus stop. Each fare costs $5 so the value it can return will be in multiples of 5. Once this opcode is called, the bus fares collected will reset to 0 afterwards so you must store the value to another variable if you want to keep track of the total bus fares collected. You do not need to be in a Coach to use this opcode. The original script called this opcode only in the 'BUS' thread.

Disassembled code

This is disassembled code for this opcode from v1.0 US.

; call subroutine to collect values from input parameters
.text:00637836                 lea     eax, [ebx+10h]
.text:00637839                 mov     ecx, ebx
.text:0063783B                 push    1  ; one parameter to collect
.text:0063783D                 push    eax
.text:0063783E                 call    CRunningScript__CollectParameters
; read collected content
.text:00637843                 mov     edi, ds:_opcodeParameter1
.text:00637849                 imul    edi, 170h
.text:0063784F                 push    1
.text:00637851                 add     edi, offset _playerInfo  ; pointer to the player
.text:00637857                 mov     ecx, [edi]
.text:00637859                 mov     eax, [ecx+6D4h]  ; offset 0x6D4 to get bus fares collected
.text:0063785F                 mov     ecx, ebx
.text:00637861                 mov     ds:_opcodeParameter1, eax
.text:00637866                 mov     eax, [edi]
.text:00637868                 mov     dword ptr [eax+6D4h], 0  ; set bus fares collected to 0 after getting it
; call subroutine to store value from output parameter into variable
.text:00637872                 lea     eax, [ebx+10h]
.text:00637875                 push    eax
.text:00637876                 call    CRunningScript__StoreParameters
; end
.text:0063787B                 lea     esp, [ebp-0Ch]
.text:0063787E                 xor     al, al
.text:00637880                 pop     edi
.text:00637881                 pop     esi
.text:00637882                 pop     ebx
.text:00637883                 pop     ebp
.text:00637884                 retn    4

Keywords

get, store, bus, coach, collect, collected, dropped, off, passenger