Tech: Commentary sounds and transcripts

Use the wiki to refer to underlying game logic, modding techniques and as a technical reference.

Moderators: Veedub, Sean, RacerBG

Tech: Commentary sounds and transcripts

Postby Veedub » Wed Jul 26, 2017 11:50 am

There is a commentary text file in the "text" folder that configures the sound clips/transcripts used in the game. There are three files, one for each language.

English: \text\comme.txt
French: \text\commf.txt
German: \text\commg.txt

The format of each line in the file is as follows:
>FILENAME.WAV This sentence is a transcript of the sound file.<

The filename refers to the sound clip to play in the game.
The text is a transcript of the sound clip and is displayed in the game.

Each line in the file is represented in the game as an index. To play the sound clip and display the transcript as described on line 42, the game refers to an index of 41.

There appears to be 357 commentary sounds available to the game. More lines/indices may be able to be loaded into the game, if the game has space allocated for a greater number of lines/indices. The below code at 0x00520FB0 in the gpw.exe suggests that there may be memory allocation for 370 lines.

Code: Select all
// Function to process data loaded from commentary transcript file COMME.TXT
// Appears to process 370 lines in the file or until ">" character is not encountered
// Filename can be 12 characters long.
// Transcript can be 99 characters long.
char *__cdecl uf_LoadCommentaryResourceStrings()
  char *result; // eax@1
  signed int i; // [sp+Ch] [bp-Ch]@1
  const char *currentCharacter; // [sp+10h] [bp-8h]@1
  char *commentaryFileNames; // [sp+14h] [bp-4h]@4
  char *commentaryTranscriptions; // [sp+14h] [bp-4h]@10

  result = (char *)un_DataBuffer;
  currentCharacter = (const char *)un_DataBuffer;
  for ( i = 0; i < 370; ++i )
    result = strchr(currentCharacter, 62);      // ">"
    if ( !result )
    currentCharacter = result + 1;

    // add each character to filename until space or null encountered
    commentaryFileNames = &un_CommentaryFileNames[13 * i];
      *commentaryFileNames++ = *currentCharacter++;
    while ( *currentCharacter != 32 && *currentCharacter );
    *commentaryFileNames = 0;

    // process spaces
    while ( *currentCharacter == 32 );

    // add each character to transcript until greater than character encountered
    commentaryTranscriptions = &un_CommentaryTranscriptions[100 * i];
      *commentaryTranscriptions++ = *currentCharacter++;
    while ( *currentCharacter != 60 && *currentCharacter );// "<"

    result = commentaryTranscriptions;
    *commentaryTranscriptions = 0;
  return result;

Every driver has a commentary index (a number between 67 and 107) assigned to their profile.
Every team has a commentary index (a number between 231 and 241) assigned to their profile.

There are 41 driver commentary sounds in the game:
- 30 F1 drivers (three teams, Benetton, Jordan and Stewart, have no test drivers by default)
- 11 Non-F1 drivers
Every driver has five sounds each.

There are 11 team commentary sounds in the game:
- 11 teams
Every team has one sound each.

The following table shows the lines relating to the above information.

Code: Select all
Line 68-108: Driver P1
Line 109-149: Driver P2
Line 150-190: Driver P3
Line 191-231: Driver Out
Line 232-242: Team Out
Line 243: "We're out"
Line 244-284: Driver In Pits

Line 243 seems out of place but is used when the player's team has both cars out of the race.

If a driver is assigned an index of 67 to play "Driver P1" (line 68), then to play "Driver P2" (line 109), 41 is added to the index of 67 to achieve an index of 108, and so forth for the other sounds relating to the same driver. So a driver profile only needs to be concerned with the indices 67 to 107, as the game will locate the other indices by applying the appropriate offset.

WARNING: If the game has been modified to create additional drivers for the three teams with no test drivers, then at least three drivers must share the same commentary index as an existing driver, due to there being only 41 of 44 "slots" available. Alternatively, all drivers could share the same index and a generalised sound clip/transcript is used that does not reference a driver or team name.

EDITOR: GPW Edit will automatically overwrite the lines shown in the table above according to the information entered into the editor. This will eliminate the manual effort required to maintain and update the file when there are driver name changes.
There is no limit to what a man can do so long as he does not care a straw who gets the credit for it.
Posts: 447
Joined: Sun Jun 02, 2013 12:09 am

Return to Wiki

Who is online

Users browsing this forum: No registered users and 0 guests