Difference between revisions of "03CF"

From GTAMods Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Icon|trilogy}} '''LOAD_MISSION_AUDIO'''
+
{{OpCode
<hr />
+
| games      = {{Icon|t}}
'''Description'''
+
| command    = LOAD_MISSION_AUDIO
: Loads the mission audio
+
| description = Loads the mission audio
'''Syntax'''
+
| syntax1    = {{Icon|3}} 03CF: load_wav '[''string'']'
: {{Icon|3}} 03CF: load_wav [''string'']
+
| syntax2    = {{Icon|VC}} 03CF: load_wav '[''string'']' as [''int2'']
: {{Icon|VC}} 03CF: load_wav [''string''] as [''int2'']
+
| syntax3    = {{Icon|SA}} 03CF: load_wav [''int1''] as [''int2'']
: {{Icon|SA}} 03CF: load_wav [''int1''] as [''int2'']
+
| p1t        = [''int2'']
'''Parameter'''
+
| p1d        = Buffer, either 1 or 2
: [''string'']
+
| p2t        = [''string'']
:: Audio name, must be from a predefined but hardcoded list
+
| p2d        = Audio name, must be from a predefined but hardcoded list
: [''int1'']
+
| p3t        = [''int1'']
:: Audio event
+
| p3d        = Audio event
: [''int2'']
+
}}
:: Buffer, either 1 or 2
 
  
This opcode loads a wav audio generally played during missions. For GTA III and Vice City, the audio name is not based on the audio file name; it is based on a predefined list hardcoded into the game, although a vast majority of the names do match the file names. Names are not case sensitive and must be 7 characters or less, which is already taken care by the predefined list. In GTA III, only one audio can be loaded at a time but from Vice City and onwards more than one can be loaded. [[03D0]] checks if it has been loaded, [[03D1]] plays it, and [[040D]] clears it.
+
This opcode loads a wav audio generally played during missions. For GTA III and Vice City, the audio name is not based on the audio file name; it is based on a predefined list [[hardcoded]] into the game, although a vast majority of the names do match the file names. Names are not case sensitive (any upper case letters (A-Z) are converted to lower case by the game internally) and must be 7 characters or less, which is already taken care by the predefined list. In GTA III, only one audio can be loaded at a time but from Vice City and onwards more than one can be loaded. [[03D0]] checks if it has been loaded, [[03D1]] plays it, and [[040D]] clears it.
  
 
== Example ==
 
== Example ==
The following example, for Vice City using Sanny Builder, will play an air horn audio after the CAMERA key is pressed.
+
The following example for Vice City plays an air horn audio after pressing [[00E1|button 13]] (CAMERA key).
<syntaxhighlight lang="scm">
+
{{Pre|class=sb-code|1=
// set constants
+
<span class="c1">// set constants</span>
const
+
<span class="k">const</span>
AUDIO = 'AIRHRNL'
+
AUDIO = <span class="s1">'AIRHRNL'</span>
end
+
<span class="k">end</span>
  
while true
+
<span class="k">while</span> <span class="k">true</span>
     wait 10
+
     <span class="k">wait</span> <span class="m">10</span>
     if
+
     <span class="k">if</span>
         00E1:  player 0 pressed_button 13  // camera key
+
         [[00E1]]:  player <span class="m">0</span> pressed_button <span class="m">13</span> <span class="c1">// camera key</span>
     then
+
     <span class="k">then</span>
         03CF: load_wav AUDIO as 1
+
         03CF: load_wav AUDIO as <span class="m">1</span>
         while 83D0:  not wav 1 loaded
+
         <span class="k">while</span> 83D0:  <span class="k">not</span> wav <span class="m">1</span> loaded
             wait 0
+
             <span class="k">wait</span> <span class="m">0</span>
         end
+
         <span class="k">end</span>
         03D1: play_wav 1
+
         03D1: play_wav <span class="m">1</span>
         while 83D2:  not wav 1 ended
+
         <span class="k">while</span> 83D2:  <span class="k">not</span> wav <span class="m">1</span> ended
             wait 0
+
             <span class="k">wait</span> <span class="m">0</span>
         end
+
         <span class="k">end</span>
         040D: unload_wav 1
+
         040D: unload_wav <span class="m">1</span>
     end
+
     <span class="k">end</span>
end
+
<span class="k">end</span>
</syntaxhighlight>
+
}}
  
 
== Keywords ==
 
== Keywords ==
Line 47: Line 46:
  
 
== See also ==
 
== See also ==
* {{Icon|3}} [[Audio (folder, III)|Complete list of audio names for GTA III]]
+
* {{Icon|3}} [[Audio directory (III)|Complete list of audio names for GTA III]]
* {{Icon|VC}} [[Audio (folder, VC)|Complete list of audio names for Vice City]]
+
* {{Icon|VC}} [[Audio directory (VC)|Complete list of audio names for Vice City]]
 
 
[[Category:OpCodes]]
 
[[Category:Code Snippets]]
 

Latest revision as of 06:42, 15 January 2017

GTA III Vice City San Andreas LOAD_MISSION_AUDIO


Description
Loads the mission audio
Syntax
GTA III 03CF: load_wav '[string]'
Vice City 03CF: load_wav '[string]' as [int2]
San Andreas 03CF: load_wav [int1] as [int2]
Parameter
[int2]
Buffer, either 1 or 2
[string]
Audio name, must be from a predefined but hardcoded list
[int1]
Audio event

This opcode loads a wav audio generally played during missions. For GTA III and Vice City, the audio name is not based on the audio file name; it is based on a predefined list hardcoded into the game, although a vast majority of the names do match the file names. Names are not case sensitive (any upper case letters (A-Z) are converted to lower case by the game internally) and must be 7 characters or less, which is already taken care by the predefined list. In GTA III, only one audio can be loaded at a time but from Vice City and onwards more than one can be loaded. 03D0 checks if it has been loaded, 03D1 plays it, and 040D clears it.

Example

The following example for Vice City plays an air horn audio after pressing button 13 (CAMERA key).

// set constants
const
AUDIO = 'AIRHRNL'
end

while true
    wait 10
    if
        00E1:   player 0 pressed_button 13  // camera key
    then
        03CF: load_wav AUDIO as 1
        while 83D0:   not wav 1 loaded
            wait 0
        end
        03D1: play_wav 1
        while 83D2:   not wav 1 ended
            wait 0
        end
        040D: unload_wav 1
    end
end

Keywords

load, wav, mission, audio

See also