Added spoken Slylandro probe coordinates; bug #732
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3610 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -476,7 +476,7 @@ DoTransaction (RESPONSE_REF R)
|
||||
UnlockMutex (GraphicsLock);
|
||||
|
||||
NPCPhrase (FUEL0);
|
||||
NPCPhrase (-(int)f);
|
||||
NPCNumber (f, NULL);
|
||||
NPCPhrase (FUEL1);
|
||||
|
||||
if (f >= 250)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define NUM_ALIEN_RACE_ITEMS 16
|
||||
#define NUM_TECH_ITEMS 13
|
||||
|
||||
static NUMBER_SPEECH_DESC melnorme_numbers_english;
|
||||
static const NUMBER_SPEECH_DESC melnorme_numbers_english;
|
||||
|
||||
static LOCDATA melnorme_desc =
|
||||
{
|
||||
@@ -159,7 +159,7 @@ static COUNT melnorme_tens_names[] =
|
||||
ENUMERATE_NINETY
|
||||
};
|
||||
|
||||
static NUMBER_SPEECH_DESC melnorme_numbers_english =
|
||||
static const NUMBER_SPEECH_DESC melnorme_numbers_english =
|
||||
{
|
||||
5, /* NumDigits */
|
||||
{
|
||||
@@ -1183,9 +1183,9 @@ DoSell (RESPONSE_REF R)
|
||||
added_credit = GLOBAL_SIS (TotalBioMass) * BIO_CREDIT_VALUE;
|
||||
|
||||
NPCPhrase (SOLD_LIFE_DATA1);
|
||||
NPCPhrase (-(int)GLOBAL_SIS (TotalBioMass));
|
||||
NPCNumber (GLOBAL_SIS (TotalBioMass), NULL);
|
||||
NPCPhrase (SOLD_LIFE_DATA2);
|
||||
NPCPhrase (-(int)added_credit);
|
||||
NPCNumber (added_credit, NULL);
|
||||
NPCPhrase (SOLD_LIFE_DATA3);
|
||||
// queue WHAT_TO_SELL before talk-segue
|
||||
if (num_new_rainbows)
|
||||
@@ -1231,9 +1231,9 @@ DoSell (RESPONSE_REF R)
|
||||
added_credit = num_new_rainbows * (250 * BIO_CREDIT_VALUE);
|
||||
|
||||
NPCPhrase (SOLD_RAINBOW_LOCATIONS1);
|
||||
NPCPhrase (-(int)num_new_rainbows);
|
||||
NPCNumber (num_new_rainbows, NULL);
|
||||
NPCPhrase (SOLD_RAINBOW_LOCATIONS2);
|
||||
NPCPhrase (-(int)added_credit);
|
||||
NPCNumber (added_credit, NULL);
|
||||
NPCPhrase (SOLD_RAINBOW_LOCATIONS3);
|
||||
|
||||
num_new_rainbows += GET_GAME_STATE (MELNORME_RAINBOW_COUNT);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "../commall.h"
|
||||
#include <math.h>
|
||||
#include "resinst.h"
|
||||
#include "strings.h"
|
||||
|
||||
@@ -25,6 +26,8 @@
|
||||
#include "uqm/setup.h"
|
||||
|
||||
|
||||
static const NUMBER_SPEECH_DESC probe_numbers_english;
|
||||
|
||||
static LOCDATA slylandro_desc =
|
||||
{
|
||||
NULL, /* init_encounter_func */
|
||||
@@ -110,19 +113,116 @@ static LOCDATA slylandro_desc =
|
||||
0, 0, /* RestartRate */
|
||||
0, /* BlockMask */
|
||||
},
|
||||
NULL, /* AlienNumberSpeech - none */
|
||||
&probe_numbers_english, /* AlienNumberSpeech - default */
|
||||
/* Filler for loaded resources */
|
||||
NULL, NULL, NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static COUNT probe_digit_names[] =
|
||||
{
|
||||
ENUMERATE_ZERO,
|
||||
ENUMERATE_ONE,
|
||||
ENUMERATE_TWO,
|
||||
ENUMERATE_THREE,
|
||||
ENUMERATE_FOUR,
|
||||
ENUMERATE_FIVE,
|
||||
ENUMERATE_SIX,
|
||||
ENUMERATE_SEVEN,
|
||||
ENUMERATE_EIGHT,
|
||||
ENUMERATE_NINE,
|
||||
};
|
||||
|
||||
static COUNT probe_teen_names[] =
|
||||
{
|
||||
ENUMERATE_TEN,
|
||||
ENUMERATE_ELEVEN,
|
||||
ENUMERATE_TWELVE,
|
||||
ENUMERATE_THIRTEEN,
|
||||
ENUMERATE_FOURTEEN,
|
||||
ENUMERATE_FIFTEEN,
|
||||
ENUMERATE_SIXTEEN,
|
||||
ENUMERATE_SEVENTEEN,
|
||||
ENUMERATE_EIGHTEEN,
|
||||
ENUMERATE_NINETEEN,
|
||||
};
|
||||
|
||||
static COUNT probe_tens_names[] =
|
||||
{
|
||||
0, /* invalid */
|
||||
0, /* skip digit */
|
||||
ENUMERATE_TWENTY,
|
||||
ENUMERATE_THIRTY,
|
||||
ENUMERATE_FOURTY,
|
||||
ENUMERATE_FIFTY,
|
||||
ENUMERATE_SIXTY,
|
||||
ENUMERATE_SEVENTY,
|
||||
ENUMERATE_EIGHTY,
|
||||
ENUMERATE_NINETY,
|
||||
};
|
||||
|
||||
static const NUMBER_SPEECH_DESC probe_numbers_english =
|
||||
{
|
||||
5, /* NumDigits */
|
||||
{
|
||||
{ /* 1000-999999 */
|
||||
1000, /* Divider */
|
||||
0, /* Subtrahend */
|
||||
NULL, /* StrDigits - recurse */
|
||||
NULL, /* Names - not used */
|
||||
ENUMERATE_THOUSAND /* CommonIndex */
|
||||
},
|
||||
{ /* 100-999 */
|
||||
100, /* Divider */
|
||||
0, /* Subtrahend */
|
||||
probe_digit_names, /* StrDigits */
|
||||
NULL, /* Names - not used */
|
||||
ENUMERATE_HUNDRED /* CommonIndex */
|
||||
},
|
||||
{ /* 20-99 */
|
||||
10, /* Divider */
|
||||
0, /* Subtrahend */
|
||||
probe_tens_names, /* StrDigits */
|
||||
NULL, /* Names - not used */
|
||||
0 /* CommonIndex - not used */
|
||||
},
|
||||
{ /* 10-19 */
|
||||
1, /* Divider */
|
||||
10, /* Subtrahend */
|
||||
probe_teen_names, /* StrDigits */
|
||||
NULL, /* Names - not used */
|
||||
0 /* CommonIndex - not used */
|
||||
},
|
||||
{ /* 0-9 */
|
||||
1, /* Divider */
|
||||
0, /* Subtrahend */
|
||||
probe_digit_names, /* StrDigits */
|
||||
NULL, /* Names - not used */
|
||||
0 /* CommonIndex - not used */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static RESPONSE_REF threat,
|
||||
something_wrong,
|
||||
we_are_us,
|
||||
why_attack,
|
||||
bye;
|
||||
|
||||
static void
|
||||
sayCoord (int coord)
|
||||
{
|
||||
int ac;
|
||||
|
||||
ac = abs (coord);
|
||||
|
||||
NPCPhrase_splice (coord < 0 ? COORD_MINUS : COORD_PLUS);
|
||||
NPCNumber (ac / 10, "%03d");
|
||||
NPCPhrase_splice (COORD_POINT);
|
||||
NPCNumber (ac % 10, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
CombatIsInevitable (RESPONSE_REF R)
|
||||
{
|
||||
@@ -266,13 +366,6 @@ CombatIsInevitable (RESPONSE_REF R)
|
||||
else if (PLAYER_SAID (R, we_are_us))
|
||||
{
|
||||
NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_ID);
|
||||
if (NumVisits == 3 && !optSubtitles)
|
||||
{
|
||||
/* If playing without subtitles, don't use the
|
||||
* last item in the conversation tree, which mentions
|
||||
* coordinates which can't be spoken. */
|
||||
NumVisits--;
|
||||
}
|
||||
switch (NumVisits++)
|
||||
{
|
||||
case 0:
|
||||
@@ -286,9 +379,16 @@ CombatIsInevitable (RESPONSE_REF R)
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
SIZE dx, dy;
|
||||
|
||||
// Probe's coordinate system is {-Y,X} relative to B Corvi
|
||||
dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) - 333;
|
||||
dy = 9812 - LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y));
|
||||
|
||||
NPCPhrase (THIS_IS_PROBE_40);
|
||||
NPCPhrase (THIS_IS_PROBE_41);
|
||||
NPCPhrase (GLOBAL_PLAYER_LOCATION);
|
||||
sayCoord (dy);
|
||||
NPCPhrase_splice (THIS_IS_PROBE_41);
|
||||
sayCoord (dx);
|
||||
NPCPhrase (THIS_IS_PROBE_42);
|
||||
|
||||
--NumVisits;
|
||||
|
||||
@@ -75,6 +75,39 @@ enum
|
||||
HOSTILE,
|
||||
DESTRUCT_SEQUENCE,
|
||||
destruct_code,
|
||||
COORD_PLUS,
|
||||
COORD_MINUS,
|
||||
COORD_POINT,
|
||||
ENUMERATE_HUNDRED,
|
||||
ENUMERATE_THOUSAND,
|
||||
ENUMERATE_ZERO,
|
||||
ENUMERATE_ONE,
|
||||
ENUMERATE_TWO,
|
||||
ENUMERATE_THREE,
|
||||
ENUMERATE_FOUR,
|
||||
ENUMERATE_FIVE,
|
||||
ENUMERATE_SIX,
|
||||
ENUMERATE_SEVEN,
|
||||
ENUMERATE_EIGHT,
|
||||
ENUMERATE_NINE,
|
||||
ENUMERATE_TEN,
|
||||
ENUMERATE_ELEVEN,
|
||||
ENUMERATE_TWELVE,
|
||||
ENUMERATE_THIRTEEN,
|
||||
ENUMERATE_FOURTEEN,
|
||||
ENUMERATE_FIFTEEN,
|
||||
ENUMERATE_SIXTEEN,
|
||||
ENUMERATE_SEVENTEEN,
|
||||
ENUMERATE_EIGHTEEN,
|
||||
ENUMERATE_NINETEEN,
|
||||
ENUMERATE_TWENTY,
|
||||
ENUMERATE_THIRTY,
|
||||
ENUMERATE_FOURTY,
|
||||
ENUMERATE_FIFTY,
|
||||
ENUMERATE_SIXTY,
|
||||
ENUMERATE_SEVENTY,
|
||||
ENUMERATE_EIGHTY,
|
||||
ENUMERATE_NINETY,
|
||||
};
|
||||
|
||||
#endif /* _STRINGS_H */
|
||||
|
||||
+73
-57
@@ -26,12 +26,12 @@
|
||||
#include <assert.h>
|
||||
#include "libs/log.h"
|
||||
|
||||
int NPCNumberPhrase (int number, UNICODE **ptrack);
|
||||
static int NPCNumberPhrase (int number, const char *fmt, UNICODE **ptrack);
|
||||
|
||||
void
|
||||
NPCPhrase_cb (int index, TFB_TrackCB cb)
|
||||
{
|
||||
UNICODE *pStr, numbuf[400];
|
||||
UNICODE *pStr, buf[400];
|
||||
void *pClip, *pTimeStamp;
|
||||
|
||||
switch (index)
|
||||
@@ -46,54 +46,25 @@ NPCPhrase_cb (int index, TFB_TrackCB cb)
|
||||
pClip = 0;
|
||||
pTimeStamp = 0;
|
||||
break;
|
||||
case GLOBAL_PLAYER_LOCATION:
|
||||
{
|
||||
SIZE dx, dy;
|
||||
COUNT adx, ady;
|
||||
|
||||
dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) - 333;
|
||||
adx = dx >= 0 ? dx : -dx;
|
||||
dy = 9812 - LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y));
|
||||
ady = dy >= 0 ? dy : -dy;
|
||||
sprintf (numbuf,
|
||||
"%+04d.%01u,%+04d.%01u",
|
||||
(SIZE)(dy / 10), (COUNT)(ady % 10),
|
||||
(SIZE)(dx / 10), (COUNT)(adx % 10));
|
||||
pStr = numbuf;
|
||||
pClip = 0;
|
||||
pTimeStamp = 0;
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
return;
|
||||
}
|
||||
default:
|
||||
if (index < 0)
|
||||
{
|
||||
if (index > UNREASONABLE_NUMBER)
|
||||
{
|
||||
if (CommData.AlienNumberSpeech)
|
||||
{
|
||||
NPCNumberPhrase (-index, NULL);
|
||||
return;
|
||||
}
|
||||
sprintf (numbuf, "%d", -index);
|
||||
}
|
||||
else
|
||||
{
|
||||
COUNT i;
|
||||
STRING S;
|
||||
{ // One of the alliance name variants
|
||||
COUNT i;
|
||||
STRING S;
|
||||
|
||||
index -= GLOBAL_ALLIANCE_NAME;
|
||||
index -= GLOBAL_ALLIANCE_NAME;
|
||||
|
||||
i = GET_GAME_STATE (NEW_ALLIANCE_NAME);
|
||||
S = SetAbsStringTableIndex (CommData.ConversationPhrases, (index - 1) + i);
|
||||
strcpy (numbuf, (UNICODE *)GetStringAddress (S));
|
||||
if (i == 3)
|
||||
strcat (numbuf, GLOBAL_SIS (CommanderName));
|
||||
}
|
||||
pStr = numbuf;
|
||||
i = GET_GAME_STATE (NEW_ALLIANCE_NAME);
|
||||
S = SetAbsStringTableIndex (CommData.ConversationPhrases, (index - 1) + i);
|
||||
strcpy (buf, (UNICODE *)GetStringAddress (S));
|
||||
if (i == 3)
|
||||
strcat (buf, GLOBAL_SIS (CommanderName));
|
||||
|
||||
pStr = buf;
|
||||
pClip = 0;
|
||||
pTimeStamp = 0;
|
||||
}
|
||||
@@ -115,8 +86,56 @@ NPCPhrase_cb (int index, TFB_TrackCB cb)
|
||||
SpliceTrack (pClip, pStr, pTimeStamp, cb);
|
||||
}
|
||||
|
||||
int
|
||||
NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
// Special case variant: prevents page breaks.
|
||||
void
|
||||
NPCPhrase_splice (int index)
|
||||
{
|
||||
UNICODE *pStr;
|
||||
void *pClip;
|
||||
|
||||
assert (index >= 0);
|
||||
if (index == 0)
|
||||
return;
|
||||
|
||||
pStr = (UNICODE *)GetStringAddress (
|
||||
SetAbsStringTableIndex (CommData.ConversationPhrases, index - 1));
|
||||
pClip = GetStringSoundClip (
|
||||
SetAbsStringTableIndex (CommData.ConversationPhrases, index - 1));
|
||||
|
||||
if (!pClip)
|
||||
{ // Just appending some text
|
||||
SpliceTrack (NULL, pStr, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{ // Splicing in some voice
|
||||
UNICODE *tracks[] = {NULL, NULL};
|
||||
|
||||
tracks[0] = pClip;
|
||||
SpliceMultiTrack (tracks, pStr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NPCNumber (int number, const char *fmt)
|
||||
{
|
||||
UNICODE buf[32];
|
||||
|
||||
if (!fmt)
|
||||
fmt = "%d";
|
||||
|
||||
if (CommData.AlienNumberSpeech)
|
||||
{
|
||||
NPCNumberPhrase (number, fmt, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// just splice in the subtitle text
|
||||
snprintf (buf, sizeof buf, fmt, number);
|
||||
SpliceTrack (NULL, buf, NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
NPCNumberPhrase (int number, const char *fmt, UNICODE **ptrack)
|
||||
{
|
||||
#define MAX_NUMBER_TRACKS 20
|
||||
NUMBER_SPEECH speech = CommData.AlienNumberSpeech;
|
||||
@@ -125,6 +144,7 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
int toplevel = 0;
|
||||
UNICODE *TrackNames[MAX_NUMBER_TRACKS];
|
||||
UNICODE numbuf[60];
|
||||
const SPEECH_DIGIT* dig = NULL;
|
||||
|
||||
if (!speech)
|
||||
return 0;
|
||||
@@ -132,15 +152,17 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
if (!ptrack)
|
||||
{
|
||||
toplevel = 1;
|
||||
sprintf (numbuf, "%d", number);
|
||||
if (!fmt)
|
||||
fmt = "%d";
|
||||
sprintf (numbuf, fmt, number);
|
||||
ptrack = TrackNames;
|
||||
}
|
||||
|
||||
for (i = 0; i < speech->NumDigits; ++i)
|
||||
{
|
||||
SPEECH_DIGIT* dig = speech->Digits + i;
|
||||
int quot;
|
||||
|
||||
dig = speech->Digits + i;
|
||||
quot = number / dig->Divider;
|
||||
|
||||
if (quot == 0)
|
||||
@@ -166,7 +188,7 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
}
|
||||
else
|
||||
{
|
||||
int ctracks = NPCNumberPhrase (quot, ptrack);
|
||||
int ctracks = NPCNumberPhrase (quot, NULL, ptrack);
|
||||
ptrack += ctracks;
|
||||
queued += ctracks;
|
||||
}
|
||||
@@ -181,9 +203,7 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
{
|
||||
*ptrack++ = GetStringSoundClip (
|
||||
SetAbsStringTableIndex (
|
||||
CommData.ConversationPhrases,
|
||||
(COUNT) (name->StrIndex - 1)
|
||||
));
|
||||
CommData.ConversationPhrases, name->StrIndex - 1));
|
||||
queued++;
|
||||
break;
|
||||
}
|
||||
@@ -192,9 +212,7 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
else if (dig->CommonNameIndex != 0)
|
||||
{
|
||||
*ptrack++ = GetStringSoundClip (SetAbsStringTableIndex (
|
||||
CommData.ConversationPhrases,
|
||||
(COUNT) (dig->CommonNameIndex - 1)
|
||||
));
|
||||
CommData.ConversationPhrases, dig->CommonNameIndex - 1));
|
||||
queued++;
|
||||
}
|
||||
|
||||
@@ -205,11 +223,9 @@ NPCNumberPhrase (int number, UNICODE **ptrack)
|
||||
{
|
||||
if (queued == 0)
|
||||
{ // nothing queued, say "zero"
|
||||
assert (number == 0);
|
||||
*ptrack++ = GetStringSoundClip (SetAbsStringTableIndex (
|
||||
CommData.ConversationPhrases,
|
||||
speech->Digits[speech->NumDigits - 1].StrDigits[0]
|
||||
));
|
||||
|
||||
CommData.ConversationPhrases, dig->StrDigits[number] - 1));
|
||||
}
|
||||
*ptrack++ = NULL; // term
|
||||
|
||||
|
||||
@@ -74,10 +74,7 @@ enum
|
||||
{
|
||||
GLOBAL_PLAYER_NAME = -1000000,
|
||||
GLOBAL_SHIP_NAME,
|
||||
GLOBAL_PLAYER_LOCATION,
|
||||
|
||||
GLOBAL_ALLIANCE_NAME,
|
||||
UNREASONABLE_NUMBER = GLOBAL_ALLIANCE_NAME + 1000,
|
||||
};
|
||||
|
||||
typedef COUNT RESPONSE_REF;
|
||||
@@ -90,6 +87,8 @@ extern void DoNPCPhrase (UNICODE *pStr);
|
||||
|
||||
extern void NPCPhrase_cb (int index, TFB_TrackCB cb);
|
||||
#define NPCPhrase(index) NPCPhrase_cb ((index), NULL)
|
||||
extern void NPCPhrase_splice (int index);
|
||||
extern void NPCNumber (int number, const char *fmt);
|
||||
|
||||
#define ALLIANCE_NAME_BUFSIZE 256
|
||||
extern void GetAllianceName (UNICODE *buf, RESPONSE_REF name_1);
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct
|
||||
// 0-9, 10-19, ..20-90, ..100-900, etc.
|
||||
SPEECH_DIGIT Digits[MAX_SPEECH_DIGITS];
|
||||
} NUMBER_SPEECH_DESC;
|
||||
typedef NUMBER_SPEECH_DESC *NUMBER_SPEECH;
|
||||
typedef const NUMBER_SPEECH_DESC *NUMBER_SPEECH;
|
||||
|
||||
typedef DWORD LDAS_FLAGS;
|
||||
#define LDASF_NONE ((LDAS_FLAGS) 0 )
|
||||
|
||||
Reference in New Issue
Block a user