Voiceove clip abstraction.

This is two simultaneous changes: CONVERSATION resources are made of 
three paths instead of one (phrases, clip directory, timestamps), and 
the synthetic, always-loaded '3dovoice' addon controls the use of them.

The intent is to eventually move uqm-0.x.0-voice.zip out of the core 
packages and into the addons with 3domusic.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2978 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-05-18 13:57:22 +00:00
parent 82b1aa60b4
commit 536d0cb676
4 changed files with 73 additions and 37 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.7: Changes towards version 0.7:
- Voiceovers controlled by a synthetic '3dovoice' addon - Michael
- CONVERSATION explicitly names text/voice/timestamps - Michael
- Replaced stricmp() by the POSIX compatible strcasecmp() - SvdB - Replaced stricmp() by the POSIX compatible strcasecmp() - SvdB
- Split STRTAB further into STRTAB and CONVERSATION - Michael - Split STRTAB further into STRTAB and CONVERSATION - Michael
- INT32, BOOLEAN, and STRING resource types - Michael - INT32, BOOLEAN, and STRING resource types - Michael
+27
View File
@@ -0,0 +1,27 @@
comm.arilou.dialogue = CONVERSATION:comm/arilou/arilou.txt:comm/arilou/:comm/arilou/arilou.ts
comm.chmmr.dialogue = CONVERSATION:comm/chmmr/chmmr.txt:comm/chmmr/:comm/chmmr/chmmr.ts
comm.commander.dialogue = CONVERSATION:comm/comandr/comandr.txt:comm/comandr/:comm/comandr/comandr.ts
comm.druuge.dialogue = CONVERSATION:comm/druuge/druuge.txt:comm/druuge/:comm/druuge/druuge.ts
comm.ilwrath.dialogue = CONVERSATION:comm/ilwrath/ilwrath.txt:comm/ilwrath/:comm/ilwrath/ilwrath.ts
comm.kohrah.dialogue = CONVERSATION:comm/blackur/blackur.txt:comm/blackur/:comm/blackur/blackur.ts
comm.melnorme.dialogue = CONVERSATION:comm/melnorm/melnorm.txt:comm/melnorm/:comm/melnorm/melnorm.ts
comm.mycon.dialogue = CONVERSATION:comm/mycon/mycon.txt:comm/mycon/:comm/mycon/mycon.ts
comm.orz.dialogue = CONVERSATION:comm/orz/orz.txt:comm/orz/:comm/orz/orz.ts
comm.pkunk.dialogue = CONVERSATION:comm/pkunk/pkunk.txt:comm/pkunk/:comm/pkunk/pkunk.ts
comm.shofixti.dialogue = CONVERSATION:comm/shofixt/shofixt.txt:comm/shofixt/:comm/shofixt/shofixt.ts
comm.slyhome.dialogue = CONVERSATION:comm/slyhome/slyhome.txt:comm/slyhome/:comm/slyhome/slyhome.ts
comm.slylandro.dialogue = CONVERSATION:comm/slyland/slyland.txt:comm/slyland/:comm/slyland/slyland.ts
comm.spahome.dialogue = CONVERSATION:comm/spahome/spahome.txt:comm/spahome/:comm/spahome/spahome.ts
comm.spathi.dialogue = CONVERSATION:comm/spathi/spathi.txt:comm/spathi/:comm/spathi/spathi.ts
comm.starbase.dialogue = CONVERSATION:comm/starbas/starbas.txt:comm/starbas/:comm/starbas/starbas.ts
comm.supox.dialogue = CONVERSATION:comm/supox/supox.txt:comm/supox/:comm/supox/supox.ts
comm.syreen.dialogue = CONVERSATION:comm/syreen/syreen.txt:comm/syreen/:comm/syreen/syreen.ts
comm.talkingpet.dialogue = CONVERSATION:comm/talkpet/talkpet.txt:comm/talkpet/:comm/talkpet/talkpet.ts
comm.thraddash.dialogue = CONVERSATION:comm/thradd/thradd.txt:comm/thradd/:comm/thradd/thradd.ts
comm.umgah.dialogue = CONVERSATION:comm/umgah/umgah.txt:comm/umgah/:comm/umgah/umgah.ts
comm.urquan.dialogue = CONVERSATION:comm/urquan/urquan.txt:comm/urquan/:comm/urquan/urquan.ts
comm.utwig.dialogue = CONVERSATION:comm/utwig/utwig.txt:comm/utwig/:comm/utwig/utwig.ts
comm.vux.dialogue = CONVERSATION:comm/vux/vux.txt:comm/vux/:comm/vux/vux.ts
comm.yehat.dialogue = CONVERSATION:comm/yehat/yehat.txt:comm/yehat/:comm/yehat/yehat.ts
comm.yehat.rebel.dialogue = CONVERSATION:comm/rebel/rebel.txt:comm/rebel/:comm/rebel/rebel.ts
comm.zoqfotpik.dialogue = CONVERSATION:comm/zoqfot/zoqfot.txt:comm/zoqfot/:comm/zoqfot/zoqfot.ts
+42 -37
View File
@@ -70,20 +70,50 @@ _GetConversationData (const char *path, RESOURCE_DATA *resdata)
slen[MAX_STRINGS], StringOffs, tot_string_size, slen[MAX_STRINGS], StringOffs, tot_string_size,
clen[MAX_STRINGS], ClipOffs, tot_clip_size, clen[MAX_STRINGS], ClipOffs, tot_clip_size,
tslen[MAX_STRINGS], TSOffs, tot_ts_size; tslen[MAX_STRINGS], TSOffs, tot_ts_size;
char CurrentLine[1024], clip_path[1024], *strdata, *clipdata, char CurrentLine[1024], paths[1024], *clip_path, *ts_path,
*ts_data; *strdata, *clipdata, *ts_data;
uio_Stream *timestamp_fp = NULL; uio_Stream *timestamp_fp = NULL;
fp = res_OpenResFile (contentDir, path, "rb"); /* Parse out the conversation components. */
strncpy (paths, path, 1023);
paths[1023] = '\0';
clip_path = strchr (paths, ':');
if (clip_path == NULL)
{
ts_path = NULL;
}
else
{
*clip_path = '\0';
clip_path++;
ts_path = strchr (clip_path, ':');
if (ts_path != NULL)
{
*ts_path = '\0';
ts_path++;
}
}
fp = res_OpenResFile (contentDir, paths, "rb");
if (fp == NULL) if (fp == NULL)
{ {
log_add (log_Warning, "Warning: Can't open '%s'", path); log_add (log_Warning, "Warning: Can't open '%s'", paths);
resdata->ptr = NULL; resdata->ptr = NULL;
return; return;
} }
dataLen = LengthResFile (fp); dataLen = LengthResFile (fp);
log_add (log_Info, "\t'%s' -- %lu bytes in Conversation", path, dataLen); log_add (log_Info, "\t'%s' -- conversation phrases -- %lu bytes", paths, dataLen);
if (clip_path)
log_add (log_Info, "\t'%s' -- voice clip directory", clip_path);
else
log_add (log_Info, "\tNo associated voice clips");
if (ts_path)
log_add (log_Info, "\t'%s' -- timestamps", ts_path);
else
log_add (log_Info, "\tNo associated timestamp file");
if (dataLen == 0) if (dataLen == 0)
{ {
@@ -101,39 +131,13 @@ _GetConversationData (const char *path, RESOURCE_DATA *resdata)
} }
ts_data = NULL; ts_data = NULL;
{ path_len = clip_path ? strlen (clip_path) : 0;
char *s1, *s2;
if (((s2 = 0), (s1 = strrchr (path, '/')) == 0)
&& (s2 = strrchr (path, '\\')) == 0)
n = 0;
else
{
if (s2 > s1)
s1 = s2;
n = s1 - path + 1;
strncpy (clip_path, path, n);
}
clip_path[n] = '\0';
path_len = strlen (clip_path);
}
if (ts_path && (timestamp_fp = uio_fopen (contentDir, ts_path,
"rb")))
{ {
// try to open the timestamp file if ((ts_data = HMalloc (tot_ts_size = POOL_SIZE)) == 0)
char ts_file_name[1024]; goto err;
char *s;
strcpy (ts_file_name, path);
s = strrchr (ts_file_name, '.');
s += 2;
*s++ = 's';
*s = '\0';
if ((timestamp_fp = uio_fopen (contentDir, ts_file_name,
"rb")))
{
log_add (log_Info, "Found timestamp file: %s", ts_file_name);
if ((ts_data = HMalloc (tot_ts_size = POOL_SIZE)) == 0)
goto err;
}
} }
opos = uio_ftell (fp); opos = uio_ftell (fp);
@@ -222,7 +226,8 @@ _GetConversationData (const char *path, RESOURCE_DATA *resdata)
goto err; goto err;
} }
strcpy (&clipdata[ClipOffs], clip_path); if (clip_path)
strcpy (&clipdata[ClipOffs], clip_path);
strcpy (&clipdata[ClipOffs + path_len], s); strcpy (&clipdata[ClipOffs + path_len], s);
ClipOffs += l; ClipOffs += l;
clen[n] = l; clen[n] = l;
+2
View File
@@ -118,6 +118,8 @@ LoadKernel (int argc, char *argv[])
loadAddon ("3domusic"); loadAddon ("3domusic");
} }
loadAddon ("3dovoice"); /* Always try to use voice data */
if (optPrecursorsMusic) if (optPrecursorsMusic)
{ {
loadAddon ("remix"); loadAddon ("remix");