Cleanup and comments.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2456 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-10-25 22:38:23 +00:00
parent 34476cdf86
commit 50fb273229
2 changed files with 150 additions and 67 deletions
+68
View File
@@ -16,6 +16,41 @@
#ifndef _COLORS_H #ifndef _COLORS_H
#define _COLORS_H #define _COLORS_H
#if 0
#define DEFAULT_COLOR_00 \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
#define DEFAULT_COLOR_01 \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
#define DEFAULT_COLOR_02 \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x00), 0x02)
#define DEFAULT_COLOR_03 \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)
#define DEFAULT_COLOR_04 \
BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04)
#define DEFAULT_COLOR_05 \
BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x14), 0x05)
#define DEFAULT_COLOR_06 \
BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x00), 0x06)
#define DEFAULT_COLOR_07 \
BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07)
#define DEFAULT_COLOR_08 \
BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)
#define DEFAULT_COLOR_09 \
BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x1F), 0x09)
#define DEFAULT_COLOR_0A \
BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x0A), 0x0A)
#define DEFAULT_COLOR_0B \
BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B)
#define DEFAULT_COLOR_0C \
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x0A), 0x0C)
#define DEFAULT_COLOR_0D \
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x1F), 0x0D)
#define DEFAULT_COLOR_0E \
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E)
#define DEFAULT_COLOR_0F \
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
#endif
#define BLACK_COLOR \ #define BLACK_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
@@ -74,5 +109,38 @@
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E) BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E)
// Not highlighted dialog options in comm.
#define COMM_PLAYER_TEXT_NORMAL_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)
// Currently highlighted dialog option in comm.
#define COMM_PLAYER_TEXT_HIGHLIGHT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x1A, 0x1A, 0x1A), 0x12)
// Background color of the area containing the player's dialog options.
#define COMM_PLAYER_BACKGROUND_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
// "(In response to your statement)"
#define COMM_RESPONSE_INTRO_TEXT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0C, 0x1F), 0x48)
// Your dialog option after choosing it.
#define COMM_FEEDBACK_TEXT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x12, 0x14, 0x4F), 0x44)
// The background when reviewing the conversation history.
#define COMM_HISTORY_BACKGROUND_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x05, 0x00), 0x00)
// The text when reviewing the conversation history.
#define COMM_HISTORY_TEXT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x10, 0x00), 0x6B)
// The text "MORE" when reviewing the conversation history.
#define COMM_MORE_TEXT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x17, 0x00), 0x00)
#endif /* _COLORS_H */ #endif /* _COLORS_H */
+82 -67
View File
@@ -21,6 +21,7 @@
#include "build.h" #include "build.h"
#include "commglue.h" #include "commglue.h"
#include "controls.h" #include "controls.h"
#include "colors.h"
#include "encount.h" #include "encount.h"
#include "endian_uqm.h" #include "endian_uqm.h"
#include "gamestr.h" #include "gamestr.h"
@@ -172,6 +173,10 @@ static int _count_lines (PTEXT pText)
return numLines; return numLines;
} }
// status == -1: draw highlighted player dialog option
// status == -2: draw non-highlighted player dialog option
// status == -4: use current context, and baseline from pTextIn
// status == 1: draw alien speech; subtitle cache is used
static COORD static COORD
add_text (int status, PTEXT pTextIn) add_text (int status, PTEXT pTextIn)
{ {
@@ -196,7 +201,8 @@ add_text (int status, PTEXT pTextIn)
// draws cached subtitle // draws cached subtitle
STAMP s; STAMP s;
s.origin.x = s.origin.y = 0; s.origin.x = 0;
s.origin.y = 0;
s.frame = TextCacheFrame; s.frame = TextCacheFrame;
DrawStamp (&s); DrawStamp (&s);
UnbatchGraphics (); UnbatchGraphics ();
@@ -230,16 +236,17 @@ add_text (int status, PTEXT pTextIn)
switch (status) switch (status)
{ {
case -3: case -3:
// Unknown. Never reached; color matches the background color.
SetContextForeGroundColor ( SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01));
break; break;
case -2: case -2:
SetContextForeGroundColor ( // Not highlighted dialog options.
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)); SetContextForeGroundColor (COMM_PLAYER_TEXT_NORMAL_COLOR);
break; break;
case -1: case -1:
SetContextForeGroundColor ( // Currently highlighted dialog option.
BUILD_COLOR (MAKE_RGB15 (0x1A, 0x1A, 0x1A), 0x12)); SetContextForeGroundColor (COMM_PLAYER_TEXT_HIGHLIGHT_COLOR);
break; break;
} }
@@ -283,17 +290,21 @@ add_text (int status, PTEXT pTextIn)
if (status <= 0) if (status <= 0)
{ {
// Player dialog option or (status == -4) other non-alien
// text.
if (pText->baseline.y < SIS_SCREEN_HEIGHT) if (pText->baseline.y < SIS_SCREEN_HEIGHT)
font_DrawText (pText); font_DrawText (pText);
if (status < -4 && pText->baseline.y >= -status - 10) if (status < -4 && pText->baseline.y >= -status - 10)
{ {
// Never actually reached. Status is never <-4.
++pStr; ++pStr;
break; break;
} }
} }
else else
{ {
// Alien speech
SetContextForeGroundColor (CommData.AlienTextBColor); SetContextForeGroundColor (CommData.AlienTextBColor);
--pText->baseline.x; --pText->baseline.x;
@@ -336,6 +347,17 @@ add_text (int status, PTEXT pTextIn)
return (pText->baseline.y); return (pText->baseline.y);
} }
// This function calculates how much of a string can be fitted within
// a specific width, up to a newline or terminating \0.
// pText is the text to be fitted. pText->CharCount will be set to the
// number of characters that fitted.
// startNext will be filled with the start of the first word that
// doesn't fit in one line.
// maxWidth is the maximum number of pixels that a line may be wide
// maxChars is the maximum number of characters (not bytes) that are to
// be fitted.
// TRUE is returned if a complete line fitted
// FALSE otherwise
static BOOLEAN static BOOLEAN
getLineWithinWidth(TEXT *pText, const unsigned char **startNext, getLineWithinWidth(TEXT *pText, const unsigned char **startNext,
SIZE maxWidth, COUNT maxChars) { SIZE maxWidth, COUNT maxChars) {
@@ -415,7 +437,7 @@ DrawSISComWindow (void)
r.corner.y = SLIDER_Y + SLIDER_HEIGHT; r.corner.y = SLIDER_Y + SLIDER_HEIGHT;
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT - r.corner.y; r.extent.height = SIS_SCREEN_HEIGHT - r.corner.y;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextForeGroundColor (COMM_PLAYER_BACKGROUND_COLOR);
DrawFilledRectangle (&r); DrawFilledRectangle (&r);
SetContext (OldContext); SetContext (OldContext);
@@ -475,7 +497,8 @@ DrawAlienFrame (FRAME aframe, PSEQUENCE pSeq)
s.origin.x = -SAFE_X; s.origin.x = -SAFE_X;
s.origin.y = 0; s.origin.y = 0;
if ((s.frame = CommData.AlienFrame) == 0) s.frame = CommData.AlienFrame;
if (s.frame == 0)
s.frame = aframe; s.frame = aframe;
BatchGraphics (); BatchGraphics ();
@@ -487,10 +510,7 @@ DrawAlienFrame (FRAME aframe, PSEQUENCE pSeq)
if (!(ADPtr->AnimFlags & ANIM_MASK)) if (!(ADPtr->AnimFlags & ANIM_MASK))
{ {
s.frame = SetAbsFrameIndex ( s.frame = SetAbsFrameIndex (s.frame, ADPtr->StartIndex);
s.frame,
ADPtr->StartIndex
);
DrawStamp (&s); DrawStamp (&s);
ADPtr->AnimFlags |= ANIM_DISABLED; ADPtr->AnimFlags |= ANIM_DISABLED;
} }
@@ -515,7 +535,8 @@ DrawAlienFrame (FRAME aframe, PSEQUENCE pSeq)
void void
init_communication (void) init_communication (void)
{ {
subtitle_mutex = CreateMutex ("Subtitle Lock", SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO); subtitle_mutex = CreateMutex ("Subtitle Lock",
SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
} }
void void
@@ -541,7 +562,8 @@ RefreshResponses (PENCOUNTER_STATE pES)
DrawSISComWindow (); DrawSISComWindow ();
y = SLIDER_Y + SLIDER_HEIGHT + 1; y = SLIDER_Y + SLIDER_HEIGHT + 1;
for (response = pES->top_response; response < pES->num_responses; ++response) for (response = pES->top_response; response < pES->num_responses;
++response)
{ {
pES->response_list[response].response_text.baseline.x = TEXT_X_OFFS + 8; pES->response_list[response].response_text.baseline.x = TEXT_X_OFFS + 8;
pES->response_list[response].response_text.baseline.y = y + leading; pES->response_list[response].response_text.baseline.y = y + leading;
@@ -593,12 +615,14 @@ FeedbackPlayerPhrase (UNICODE *pStr)
ct.baseline.y = SLIDER_Y + SLIDER_HEIGHT + 13; ct.baseline.y = SLIDER_Y + SLIDER_HEIGHT + 13;
ct.align = ALIGN_CENTER; ct.align = ALIGN_CENTER;
ct.CharCount = (COUNT)~0; ct.CharCount = (COUNT)~0;
ct.pStr = GAME_STRING (FEEDBACK_STRING_BASE);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xC, 0x1F), 0x48)); ct.pStr = GAME_STRING (FEEDBACK_STRING_BASE);
// "(In response to your statement)"
SetContextForeGroundColor (COMM_RESPONSE_INTRO_TEXT_COLOR);
font_DrawText (&ct); font_DrawText (&ct);
ct.baseline.y += 16; ct.baseline.y += 16;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x12, 0x14, 0x4F), 0x44)); SetContextForeGroundColor (COMM_FEEDBACK_TEXT_COLOR);
ct.pStr = pStr; ct.pStr = pStr;
add_text (-4, &ct); add_text (-4, &ct);
} }
@@ -1485,12 +1509,10 @@ DoConvSummary (PSUMMARY_STATE pSS)
r.extent.height = SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2; r.extent.height = SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2;
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContextForeGroundColor (BUILD_COLOR ( SetContextForeGroundColor (COMM_HISTORY_BACKGROUND_COLOR);
MAKE_RGB15 (0x00, 0x05, 0x00), 0x6E));
DrawFilledRectangle (&r); DrawFilledRectangle (&r);
SetContextForeGroundColor (BUILD_COLOR ( SetContextForeGroundColor (COMM_HISTORY_TEXT_COLOR);
MAKE_RGB15 (0x00, 0x10, 0x00), 0x6B));
t.baseline.x = SAFE_X + 2; t.baseline.x = SAFE_X + 2;
t.align = ALIGN_LEFT; t.align = ALIGN_LEFT;
@@ -1569,12 +1591,10 @@ DoConvSummary (PSUMMARY_STATE pSS)
mt.baseline.y = t.baseline.y; mt.baseline.y = t.baseline.y;
mt.align = ALIGN_CENTER; mt.align = ALIGN_CENTER;
snprintf (buffer, sizeof (buffer), "%s%s%s", // "MORE" snprintf (buffer, sizeof (buffer), "%s%s%s", // "MORE"
STR_MIDDLE_DOT, STR_MIDDLE_DOT, GAME_STRING (FEEDBACK_STRING_BASE + 1),
GAME_STRING (FEEDBACK_STRING_BASE + 1),
STR_MIDDLE_DOT); STR_MIDDLE_DOT);
mt.pStr = buffer; mt.pStr = buffer;
SetContextForeGroundColor (BUILD_COLOR ( SetContextForeGroundColor (COMM_MORE_TEXT_COLOR);
MAKE_RGB15 (0x00, 0x17, 0x00), 0x01));
font_DrawText (&mt); font_DrawText (&mt);
} }
@@ -1598,14 +1618,13 @@ DoCommunication (PENCOUNTER_STATE pES)
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
if (!(CommData.AlienTransitionDesc.AnimFlags & TALK_DONE)) if (!(CommData.AlienTransitionDesc.AnimFlags & TALK_DONE))
{
AlienTalkSegue ((COUNT)~0); AlienTalkSegue ((COUNT)~0);
}
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
; ;
else if (pES->num_responses == 0) else if (pES->num_responses == 0)
{ {
// The player doesn't get a chance to say anything.
DWORD TimeIn, TimeOut; DWORD TimeIn, TimeOut;
TimeOut = FadeMusic (0, ONE_SECOND * 3) + ONE_SECOND / 60; TimeOut = FadeMusic (0, ONE_SECOND * 3) + ONE_SECOND / 60;
@@ -1621,7 +1640,8 @@ DoCommunication (PENCOUNTER_STATE pES)
FadeMusic (BACKGROUND_VOL, ONE_SECOND); FadeMusic (BACKGROUND_VOL, ONE_SECOND);
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
// reset transition state // reset transition state
CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE); CommData.AlienTransitionDesc.AnimFlags &=
~(TALK_INTRO | TALK_DONE);
DoTalkSegue (0); DoTalkSegue (0);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
FlushTalkSegue (); FlushTalkSegue ();
@@ -1672,7 +1692,7 @@ DoCommunication (PENCOUNTER_STATE pES)
(*pES->response_list[pES->cur_response].response_func) (*pES->response_list[pES->cur_response].response_func)
(pES->response_list[pES->cur_response].response_ref); (pES->response_list[pES->cur_response].response_ref);
} }
else if (PulsedInputState.menu[KEY_MENU_CANCEL] && else if (PulsedInputState.menu[KEY_MENU_CANCEL] &&
LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE) LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
{ // Do the conversation summary { // Do the conversation summary
SUMMARY_STATE SummaryState; SUMMARY_STATE SummaryState;
@@ -1702,7 +1722,8 @@ DoCommunication (PENCOUNTER_STATE pES)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
FeedbackPlayerPhrase (pES->phrase_buf); FeedbackPlayerPhrase (pES->phrase_buf);
// reset transition state // reset transition state
CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE); CommData.AlienTransitionDesc.AnimFlags &=
~(TALK_INTRO | TALK_DONE);
DoTalkSegue (0); DoTalkSegue (0);
if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
@@ -1721,8 +1742,7 @@ DoCommunication (PENCOUNTER_STATE pES)
response = (BYTE)((response + (BYTE)(pES->num_responses - 1)) response = (BYTE)((response + (BYTE)(pES->num_responses - 1))
% pES->num_responses); % pES->num_responses);
else if (PulsedInputState.menu[KEY_MENU_DOWN]) else if (PulsedInputState.menu[KEY_MENU_DOWN])
response = (BYTE)((BYTE)(response + 1) response = (BYTE)((BYTE)(response + 1) % pES->num_responses);
% pES->num_responses);
if (response != pES->cur_response) if (response != pES->cur_response)
{ {
@@ -1730,11 +1750,13 @@ DoCommunication (PENCOUNTER_STATE pES)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
BatchGraphics (); BatchGraphics ();
add_text (-2, &pES->response_list[pES->cur_response].response_text); add_text (-2,
&pES->response_list[pES->cur_response].response_text);
pES->cur_response = response; pES->cur_response = response;
y = add_text (-1, &pES->response_list[pES->cur_response].response_text); y = add_text (-1,
&pES->response_list[pES->cur_response].response_text);
if (response < pES->top_response) if (response < pES->top_response)
{ {
pES->top_response = 0; pES->top_response = 0;
@@ -1840,14 +1862,11 @@ HailAlien (void)
SetResourceIndex (hOldIndex); SetResourceIndex (hOldIndex);
CommData.AlienFrame = CaptureDrawable ( CommData.AlienFrame = CaptureDrawable (
LoadGraphicInstance ((RESOURCE)CommData.AlienFrame) LoadGraphicInstance ((RESOURCE)CommData.AlienFrame));
);
CommData.AlienFont = CaptureFont ((FONT_REF) CommData.AlienFont = CaptureFont ((FONT_REF)
LoadGraphic ((RESOURCE)CommData.AlienFont) LoadGraphic ((RESOURCE)CommData.AlienFont));
);
CommData.AlienColorMap = CaptureColorMap ( CommData.AlienColorMap = CaptureColorMap (
LoadColorMapInstance ((RESOURCE)CommData.AlienColorMap) LoadColorMapInstance ((RESOURCE)CommData.AlienColorMap));
);
if ((CommData.AlienSongFlags & LDASF_USE_ALTERNATE) if ((CommData.AlienSongFlags & LDASF_USE_ALTERNATE)
&& CommData.AlienAltSong) && CommData.AlienAltSong)
SongRef = LoadMusicInstance ((RESOURCE)CommData.AlienAltSong); SongRef = LoadMusicInstance ((RESOURCE)CommData.AlienAltSong);
@@ -1857,17 +1876,17 @@ HailAlien (void)
CommData.AlienSong = LoadMusicInstance ((RESOURCE)CommData.AlienSong); CommData.AlienSong = LoadMusicInstance ((RESOURCE)CommData.AlienSong);
CommData.ConversationPhrases = CaptureStringTable ( CommData.ConversationPhrases = CaptureStringTable (
LoadStringTableInstance ((RESOURCE)CommData.ConversationPhrases) LoadStringTableInstance ((RESOURCE)CommData.ConversationPhrases));
);
// init subtitle cache context // init subtitle cache context
TextCacheContext = CaptureContext (CreateContext ()); TextCacheContext = CaptureContext (CreateContext ());
TextCacheFrame = CaptureDrawable (CreateDrawable (WANT_PIXMAP, TextCacheFrame = CaptureDrawable (
SIS_SCREEN_WIDTH, SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2, CreateDrawable (WANT_PIXMAP, SIS_SCREEN_WIDTH,
1)); SIS_SCREEN_HEIGHT - SLIDER_Y - SLIDER_HEIGHT + 2, 1));
SetContext (TextCacheContext); SetContext (TextCacheContext);
SetContextFGFrame (TextCacheFrame); SetContextFGFrame (TextCacheFrame);
TextBack = BUILD_COLOR (MAKE_RGB15 (0, 0, 0x10), 1); TextBack = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x00);
// Color key for the background.
SetContextBackGroundColor (TextBack); SetContextBackGroundColor (TextBack);
ClearDrawable (); ClearDrawable ();
SetFrameTransparentColor (TextCacheFrame, TextBack); SetFrameTransparentColor (TextCacheFrame, TextBack);
@@ -1988,9 +2007,7 @@ InitCommunication (RESOURCE which_comm)
} }
DrawSISMessage (NULL_PTR); DrawSISMessage (NULL_PTR);
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
DrawHyperCoords ( DrawHyperCoords (GLOBAL (ShipStamp.origin));
GLOBAL (ShipStamp.origin)
);
else if (HIWORD (GLOBAL (ShipStamp.frame)) == 0) else if (HIWORD (GLOBAL (ShipStamp.frame)) == 0)
DrawHyperCoords (CurStarDescPtr->star_pt); DrawHyperCoords (CurStarDescPtr->star_pt);
else else
@@ -1999,11 +2016,17 @@ InitCommunication (RESOURCE which_comm)
} }
if (which_comm == 0) if (which_comm == 0)
status = URQUAN_PROBE_SHIP, which_comm = URQUAN_CONVERSATION; {
status = URQUAN_PROBE_SHIP;
which_comm = URQUAN_CONVERSATION;
}
else else
{ {
if (which_comm == (RESOURCE) YEHAT_REBEL_CONVERSATION) if (which_comm == (RESOURCE) YEHAT_REBEL_CONVERSATION)
status = YEHAT_REBEL_SHIP, which_comm = YEHAT_CONVERSATION; {
status = YEHAT_REBEL_SHIP;
which_comm = YEHAT_CONVERSATION;
}
else if (((status = GET_PACKAGE (which_comm) else if (((status = GET_PACKAGE (which_comm)
- GET_PACKAGE (ARILOU_CONVERSATION) - GET_PACKAGE (ARILOU_CONVERSATION)
+ ARILOU_SHIP) >= YEHAT_REBEL_SHIP)) + ARILOU_SHIP) >= YEHAT_REBEL_SHIP))
@@ -2021,7 +2044,8 @@ InitCommunication (RESOURCE which_comm)
} }
hOldIndex = SetResourceIndex (hResIndex); hOldIndex = SetResourceIndex (hResIndex);
if ((hIndex = OpenResourceIndexInstance (which_comm)) == 0) hIndex = OpenResourceIndexInstance (which_comm);
if (hIndex == 0)
{ {
SET_GAME_STATE (BATTLE_SEGUE, 1); SET_GAME_STATE (BATTLE_SEGUE, 1);
LocDataPtr = 0; LocDataPtr = 0;
@@ -2174,10 +2198,8 @@ RaceCommunication (void)
NumShips = LONIBBLE (EncounterPtr->SD.Index); NumShips = LONIBBLE (EncounterPtr->SD.Index);
for (i = 0; i < NumShips; ++i) for (i = 0; i < NumShips; ++i)
{ {
CloneShipFragment ( CloneShipFragment (EncounterPtr->SD.Type,
EncounterPtr->SD.Type, &GLOBAL (npc_built_ship_q), 0);
&GLOBAL (npc_built_ship_q), 0
);
} }
CurStarDescPtr = (STAR_DESCPTR)&EncounterPtr->SD; CurStarDescPtr = (STAR_DESCPTR)&EncounterPtr->SD;
@@ -2187,12 +2209,9 @@ RaceCommunication (void)
hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q)); hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip ( FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip &GLOBAL (npc_built_ship_q), hStarShip);
);
i = GET_RACE_ID (FragPtr); i = GET_RACE_ID (FragPtr);
UnlockStarShip ( UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
&GLOBAL (npc_built_ship_q), hStarShip
);
status = InitCommunication (RaceComm[i]); status = InitCommunication (RaceComm[i]);
@@ -2231,16 +2250,12 @@ RaceCommunication (void)
SHIP_FRAGMENTPTR TemplatePtr; SHIP_FRAGMENTPTR TemplatePtr;
hStarShip = GetStarShipFromIndex ( hStarShip = GetStarShipFromIndex (
&GLOBAL (npc_built_ship_q), i &GLOBAL (npc_built_ship_q), i);
);
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip ( TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip &GLOBAL (npc_built_ship_q), hStarShip);
);
pESD->ShipList[i] = TemplatePtr->ShipInfo; pESD->ShipList[i] = TemplatePtr->ShipInfo;
pESD->ShipList[i].var1 = GET_RACE_ID (TemplatePtr); pESD->ShipList[i].var1 = GET_RACE_ID (TemplatePtr);
UnlockStarShip ( UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
&GLOBAL (npc_built_ship_q), hStarShip
);
} }
ReinitQueue (&GLOBAL (npc_built_ship_q)); ReinitQueue (&GLOBAL (npc_built_ship_q));