Cleanups and some documentation.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2444 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-09-25 22:57:16 +00:00
parent f1c9fa2c5e
commit d425668586
4 changed files with 157 additions and 140 deletions
+32 -48
View File
@@ -716,7 +716,8 @@ ambient_anim_task (void *data)
BOOLEAN FrameChanged[MAX_ANIMATIONS]; BOOLEAN FrameChanged[MAX_ANIMATIONS];
BOOLEAN ColorChange = FALSE; BOOLEAN ColorChange = FALSE;
while ((CommFrame = CommData.AlienFrame) == 0 && !Task_ReadState (task, TASK_EXIT)) while ((CommFrame = CommData.AlienFrame) == 0
&& !Task_ReadState (task, TASK_EXIT))
TaskSwitch (); TaskSwitch ();
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -733,16 +734,12 @@ ambient_anim_task (void *data)
memset (AnimFrame, 0, sizeof (AnimFrame)); memset (AnimFrame, 0, sizeof (AnimFrame));
for (i = 0; i <= CommData.NumAnimations; i++) for (i = 0; i <= CommData.NumAnimations; i++)
if (CommData.AlienAmbientArray[i].AnimFlags & YOYO_ANIM) if (CommData.AlienAmbientArray[i].AnimFlags & YOYO_ANIM)
AnimFrame[i] = SetAbsFrameIndex ( AnimFrame[i] = SetAbsFrameIndex (CommFrame,
CommFrame, CommData.AlienAmbientArray[i].StartIndex);
CommData.AlienAmbientArray[i].StartIndex
);
else else
AnimFrame[i] = SetAbsFrameIndex ( AnimFrame[i] = SetAbsFrameIndex (CommFrame,
CommFrame,
(COUNT)(CommData.AlienAmbientArray[i].StartIndex (COUNT)(CommData.AlienAmbientArray[i].StartIndex
+ CommData.AlienAmbientArray[i].NumFrames - 1) + CommData.AlienAmbientArray[i].NumFrames - 1));
);
while (!Task_ReadState (task, TASK_EXIT)) while (!Task_ReadState (task, TASK_EXIT))
{ {
@@ -791,30 +788,24 @@ ambient_anim_task (void *data)
&& pSeq->Direction == UP_DIR))) && pSeq->Direction == UP_DIR)))
{ {
ActiveMask |= 1L << i; ActiveMask |= 1L << i;
pSeq->Alarm = pSeq->Alarm = ADPtr->BaseFrameRate
ADPtr->BaseFrameRate
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1)) % (ADPtr->RandomFrameRate + 1)) + 1;
+ 1;
} }
else else
{ {
ActiveMask &= ~(1L << i); ActiveMask &= ~(1L << i);
pSeq->Alarm = pSeq->Alarm = ADPtr->BaseRestartRate
ADPtr->BaseRestartRate
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1)) % (ADPtr->RandomRestartRate + 1)) + 1;
+ 1;
if (ActiveMask & ADPtr->BlockMask) if (ActiveMask & ADPtr->BlockMask)
continue; continue;
} }
if (pSeq->AnimType == COLOR_ANIM) if (pSeq->AnimType == COLOR_ANIM)
{ {
XFormColorMap ( XFormColorMap (GetColorMapAddress (pSeq->AnimObj.CurCMap),
GetColorMapAddress (pSeq->AnimObj.CurCMap), (COUNT) (pSeq->Alarm - 1));
(COUNT) (pSeq->Alarm - 1)
);
} }
else else
{ {
@@ -837,14 +828,12 @@ ambient_anim_task (void *data)
if (pSeq->AnimType == COLOR_ANIM) if (pSeq->AnimType == COLOR_ANIM)
pSeq->AnimObj.CurCMap = SetRelColorMapIndex ( pSeq->AnimObj.CurCMap = SetRelColorMapIndex (
pSeq->AnimObj.CurCMap, pSeq->AnimObj.CurCMap,
(SWORD) (-pSeq->FramesLeft) (SWORD) (-pSeq->FramesLeft));
);
else else
{ {
pSeq->AnimObj.CurFrame = SetRelFrameIndex ( pSeq->AnimObj.CurFrame = SetRelFrameIndex (
pSeq->AnimObj.CurFrame, pSeq->AnimObj.CurFrame,
(SWORD) (-pSeq->FramesLeft) (SWORD) (-pSeq->FramesLeft));
);
} }
} }
} }
@@ -868,12 +857,10 @@ ambient_anim_task (void *data)
{ {
if (pSeq->Direction == UP_DIR) if (pSeq->Direction == UP_DIR)
pSeq->AnimObj.CurCMap = SetRelColorMapIndex ( pSeq->AnimObj.CurCMap = SetRelColorMapIndex (
pSeq->AnimObj.CurCMap, 1 pSeq->AnimObj.CurCMap, 1);
);
else else
pSeq->AnimObj.CurCMap = SetRelColorMapIndex ( pSeq->AnimObj.CurCMap = SetRelColorMapIndex (
pSeq->AnimObj.CurCMap, -1 pSeq->AnimObj.CurCMap, -1);
);
} }
else else
{ {
@@ -909,12 +896,12 @@ ambient_anim_task (void *data)
&& (ADPtr->AnimFlags & WAIT_TALKING) && (ADPtr->AnimFlags & WAIT_TALKING)
&& !(CommData.AlienTransitionDesc.AnimFlags & PAUSE_TALKING)) && !(CommData.AlienTransitionDesc.AnimFlags & PAUSE_TALKING))
{ {
BOOLEAN done = 0; BOOLEAN done = FALSE;
for (i = 0; i < CommData.NumAnimations; i++) for (i = 0; i < CommData.NumAnimations; i++)
if (ActiveMask & (1L << i) if (ActiveMask & (1L << i)
&& CommData.AlienAmbientArray[i].AnimFlags & WAIT_TALKING) && CommData.AlienAmbientArray[i].AnimFlags & WAIT_TALKING)
done = 1; done = TRUE;
if (! done) if (!done)
{ {
if (ADPtr->StartIndex != TalkBuffer.StartIndex) if (ADPtr->StartIndex != TalkBuffer.StartIndex)
@@ -968,12 +955,10 @@ ambient_anim_task (void *data)
{ {
CommData.AlienTransitionDesc.AnimFlags |= CommData.AlienTransitionDesc.AnimFlags |=
PAUSE_TALKING; PAUSE_TALKING;
ADPtr->AnimFlags &= ADPtr->AnimFlags &= ~PAUSE_TALKING;
~PAUSE_TALKING;
} }
else if (CommData.AlienTransitionDesc.NumFrames) else if (CommData.AlienTransitionDesc.NumFrames)
ADPtr->AnimFlags |= ADPtr->AnimFlags |= TALK_DONE;
TALK_DONE;
else else
ADPtr->AnimFlags &= ADPtr->AnimFlags &=
~(WAIT_TALKING | PAUSE_TALKING); ~(WAIT_TALKING | PAUSE_TALKING);
@@ -987,15 +972,14 @@ ambient_anim_task (void *data)
ADPtr = &CommData.AlienTransitionDesc; ADPtr = &CommData.AlienTransitionDesc;
if (AFlags & TALK_INTRO) if (AFlags & TALK_INTRO)
{ {
FrameRate = FrameRate = ADPtr->BaseFrameRate
ADPtr->BaseFrameRate
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1)); % (ADPtr->RandomFrameRate + 1));
if (TalkAlarm < 0 || TransitionDone) if (TalkAlarm < 0 || TransitionDone)
{ {
TalkFrame = SetAbsFrameIndex (CommFrame, TalkFrame = SetAbsFrameIndex (CommFrame,
ADPtr->StartIndex); ADPtr->StartIndex);
TransitionDone = 0; TransitionDone = FALSE;
} }
else else
TalkFrame = IncFrameIndex (TalkFrame); TalkFrame = IncFrameIndex (TalkFrame);
@@ -1005,14 +989,13 @@ ambient_anim_task (void *data)
ADPtr->NumFrames) ADPtr->NumFrames)
{ {
CommData.AlienTalkDesc.AnimFlags &= ~TALK_INTRO; CommData.AlienTalkDesc.AnimFlags &= ~TALK_INTRO;
TransitionDone = 1; TransitionDone = TRUE;
} }
TransitionFrame = TalkFrame; TransitionFrame = TalkFrame;
} }
else /* if (AFlags & TALK_DONE) */ else /* if (AFlags & TALK_DONE) */
{ {
FrameRate = FrameRate = ADPtr->BaseFrameRate
ADPtr->BaseFrameRate
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->RandomFrameRate + 1)); % (ADPtr->RandomFrameRate + 1));
if (TalkAlarm < 0) if (TalkAlarm < 0)
@@ -1031,8 +1014,7 @@ ambient_anim_task (void *data)
CommData.AlienTalkDesc.AnimFlags &= ~WAIT_TALKING; CommData.AlienTalkDesc.AnimFlags &= ~WAIT_TALKING;
else else
{ {
ADPtr->AnimFlags |= ADPtr->AnimFlags |= PAUSE_TALKING;
PAUSE_TALKING;
ADPtr->AnimFlags &= ~TALK_DONE; ADPtr->AnimFlags &= ~TALK_DONE;
} }
FrameRate = 0; FrameRate = 0;
@@ -1049,7 +1031,7 @@ ambient_anim_task (void *data)
} }
else if (done && (ADPtr->AnimFlags & PAUSE_TALKING)) else if (done && (ADPtr->AnimFlags & PAUSE_TALKING))
{ {
ADPtr->AnimFlags &= ~(WAIT_TALKING | PAUSE_TALKING); ADPtr->AnimFlags &= ~(WAIT_TALKING | PAUSE_TALKING);
} }
} }
@@ -1074,7 +1056,8 @@ ambient_anim_task (void *data)
FRAME F; FRAME F;
F = CommData.AlienFrame; F = CommData.AlienFrame;
CommData.AlienFrame = CommFrame; CommData.AlienFrame = CommFrame;
DrawAlienFrame (TalkFrame, &Sequencer[CommData.NumAnimations - 1]); DrawAlienFrame (TalkFrame,
&Sequencer[CommData.NumAnimations - 1]);
CommData.AlienFrame = F; CommData.AlienFrame = F;
CheckSub = TRUE; CheckSub = TRUE;
ClearSub = ClearSummary; ClearSub = ClearSummary;
@@ -2048,8 +2031,8 @@ InitCommunication (RESOURCE which_comm)
SetResourceIndex (hIndex); SetResourceIndex (hIndex);
LocDataPtr = (LOCDATAPTR)init_race ( LocDataPtr = (LOCDATAPTR)init_race (
status != YEHAT_REBEL_SHIP ? which_comm : (RESOURCE)YEHAT_REBEL_CONVERSATION status != YEHAT_REBEL_SHIP ? which_comm :
); (RESOURCE)YEHAT_REBEL_CONVERSATION);
if (LocDataPtr) if (LocDataPtr)
CommData = *LocDataPtr; CommData = *LocDataPtr;
} }
@@ -2156,6 +2139,7 @@ RaceCommunication (void)
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == 0) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == 0)
InitCommunication (TALKING_PET_CONVERSATION); InitCommunication (TALKING_PET_CONVERSATION);
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & ((1 << 4) | (1 << 5))) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & ((1 << 4) | (1 << 5)))
// Communicate with the Ilwrath using a Hyperwave Broadcaster.
InitCommunication (ILWRATH_CONVERSATION); InitCommunication (ILWRATH_CONVERSATION);
else else
InitCommunication (CHMMR_CONVERSATION); InitCommunication (CHMMR_CONVERSATION);
+3
View File
@@ -572,6 +572,7 @@ Intro (void)
} }
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 5)) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 5))
{ {
// Communicating with an Ilwrath ship using a HyperWave Broadcaster.
if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH)) if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
NPCPhrase (BIG_FUN); NPCPhrase (BIG_FUN);
else if (GET_GAME_STATE (ILWRATH_DECEIVED)) else if (GET_GAME_STATE (ILWRATH_DECEIVED))
@@ -583,6 +584,8 @@ Intro (void)
} }
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 4)) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 4))
{ {
// Communicating with the Ilwrath homeworld using a
// Hyperwave Broadcaster.
GodsSpeak ((RESPONSE_REF)0); GodsSpeak ((RESPONSE_REF)0);
} }
else else
+10 -1
View File
@@ -457,6 +457,11 @@ START_GAME_STATE
* Why this needs 8 bits I don't know. Only specific * Why this needs 8 bits I don't know. Only specific
* combinations of bits seem to be used (0, 1, or all bits). * combinations of bits seem to be used (0, 1, or all bits).
* A closer investigation is desirable. - SvdB * A closer investigation is desirable. - SvdB
* Bit 4 is set when initiating communication with the Ilwrath
* homeworld by means of a HyperWave Broadcaster.
* Bit 5 is set when initiating communication with an Ilwrath
* ship by means of a HyperWave Broadcaster.
* All bits are cleared when communication is over.
*/ */
ADD_GAME_STATE (ORZ_VISITS, 3) ADD_GAME_STATE (ORZ_VISITS, 3)
@@ -605,7 +610,7 @@ START_GAME_STATE
* with RAINBOW_DEFINED, and so on. * with RAINBOW_DEFINED, and so on.
*/ */
ADD_GAME_STATE (RAINBOW_WORLD1, 2) ADD_GAME_STATE (RAINBOW_WORLD1, 2)
/* High byte of the bit array of which RAINBOW_WORLD0 /* High 2 bits of the bit array of which RAINBOW_WORLD0
* is the low byte. * is the low byte.
*/ */
ADD_GAME_STATE (MELNORME_RAINBOW_COUNT, 4) ADD_GAME_STATE (MELNORME_RAINBOW_COUNT, 4)
@@ -701,6 +706,10 @@ START_GAME_STATE
ADD_GAME_STATE (TALKING_PET_SUGGESTIONS, 3) ADD_GAME_STATE (TALKING_PET_SUGGESTIONS, 3)
ADD_GAME_STATE (LEARNED_TALKING_PET, 1) ADD_GAME_STATE (LEARNED_TALKING_PET, 1)
ADD_GAME_STATE (DNYARRI_LIED, 1) ADD_GAME_STATE (DNYARRI_LIED, 1)
/* Set when the Talking Pet tells you his version of their
* race's history with the Ur-Quan.
* Cleared once you confront him about this lie.
*/
ADD_GAME_STATE (SHIP_TO_COMPEL, 1) ADD_GAME_STATE (SHIP_TO_COMPEL, 1)
ADD_GAME_STATE (ORZ_GENERAL_INFO, 2) ADD_GAME_STATE (ORZ_GENERAL_INFO, 2)
+112 -91
View File
@@ -71,7 +71,8 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
r.extent.width -= 2; r.extent.width -= 2;
r.corner.y = 33; r.corner.y = 33;
r.extent.height = 89; r.extent.height = 89;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01));
DrawFilledRectangle (&r); DrawFilledRectangle (&r);
} }
else else
@@ -92,7 +93,8 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
ct.align = ALIGN_CENTER; ct.align = ALIGN_CENTER;
ct.pStr = GAME_STRING (DEVICE_STRING_BASE); ct.pStr = GAME_STRING (DEVICE_STRING_BASE);
ct.CharCount = (COUNT)~0; ct.CharCount = (COUNT)~0;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0x1F, 0x1F), 0x0B)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0xA, 0x1F, 0x1F), 0x0B));
font_DrawText (&ct); font_DrawText (&ct);
SetContextFont (TinyFont); SetContextFont (TinyFont);
@@ -107,15 +109,15 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
s.origin.y = 34; s.origin.y = 34;
cy = y; cy = y;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03));
for (OldDevice = (BYTE)pMS->first_item.y; for (OldDevice = (BYTE)pMS->first_item.y;
OldDevice < (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES) OldDevice < (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES)
&& OldDevice < (BYTE)pMS->first_item.x; && OldDevice < (BYTE)pMS->first_item.x;
++OldDevice) ++OldDevice)
{ {
s.frame = SetAbsFrameIndex ( s.frame = SetAbsFrameIndex (
MiscDataFrame, 77 + pDeviceMap[OldDevice] MiscDataFrame, 77 + pDeviceMap[OldDevice]);
);
DrawStamp (&s); DrawStamp (&s);
if (OldDevice != NewDevice) if (OldDevice != NewDevice)
@@ -146,10 +148,12 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
{ {
cy = y + ((OldDevice - pMS->first_item.y) * 18); cy = y + ((OldDevice - pMS->first_item.y) * 18);
r.corner.y = cy - 6; r.corner.y = cy - 6;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01));
DrawFilledRectangle (&r); DrawFilledRectangle (&r);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03));
t.baseline.y = cy; t.baseline.y = cy;
t.pStr = GAME_STRING (pDeviceMap[OldDevice] + DEVICE_STRING_BASE + 1); t.pStr = GAME_STRING (pDeviceMap[OldDevice] + DEVICE_STRING_BASE + 1);
t.CharCount = utf8StringPos (t.pStr, ' '); t.CharCount = utf8StringPos (t.pStr, ' ');
@@ -164,10 +168,12 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
{ {
cy = y + ((NewDevice - pMS->first_item.y) * 18); cy = y + ((NewDevice - pMS->first_item.y) * 18);
r.corner.y = cy - 6; r.corner.y = cy - 6;
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0x1F), 0x09)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0x1F), 0x09));
DrawFilledRectangle (&r); DrawFilledRectangle (&r);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0x1F, 0x1F), 0x0B)); SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0xA, 0x1F, 0x1F), 0x0B));
t.baseline.y = cy; t.baseline.y = cy;
t.pStr = GAME_STRING (pDeviceMap[NewDevice] + DEVICE_STRING_BASE + 1); t.pStr = GAME_STRING (pDeviceMap[NewDevice] + DEVICE_STRING_BASE + 1);
t.CharCount = utf8StringPos (t.pStr, ' '); t.CharCount = utf8StringPos (t.pStr, ' ');
@@ -181,6 +187,92 @@ DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice)
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
// Returns TRUE if the broadcaster has been successfully activated,
// and FALSE otherwise.
static BOOLEAN
UseCaster (void)
{
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
{
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{
SET_GAME_STATE (USED_BROADCASTER, 1);
return TRUE;
}
return FALSE;
}
if (LOBYTE (GLOBAL (CurrentActivity)) != IN_INTERPLANETARY
|| pSolarSysState != NULL)
return FALSE;
if (pSolarSysState->pOrbitalDesc == &pSolarSysState->PlanetDesc[1]
&& pSolarSysState->MenuState.Initialized == 3
&& CurStarDescPtr->Index == CHMMR_DEFINED
&& !GET_GAME_STATE (CHMMR_UNLEASHED))
{
// In orbit around the Chenjesu/Mmrnmhrm home planet.
NextActivity |= CHECK_LOAD; /* fake a load game */
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
EncounterGroup = 0;
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (npc_built_ship_q));
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
SaveFlagshipState ();
return TRUE;
}
{
BOOLEAN FoundIlwrath;
HSTARSHIP hStarShip;
FoundIlwrath = (BOOLEAN)(CurStarDescPtr->Index == ILWRATH_DEFINED);
// In the Ilwrath home system?
if (!FoundIlwrath &&
(hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q))))
{
// Ilwrath ship is in the system.
SHIP_FRAGMENTPTR FragPtr;
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip);
FoundIlwrath = (BOOLEAN)(
GET_RACE_ID (FragPtr) == ILWRATH_SHIP);
UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
}
if (FoundIlwrath)
{
NextActivity |= CHECK_LOAD; /* fake a load game */
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
EncounterGroup = 0;
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (npc_built_ship_q));
if (CurStarDescPtr->Index == ILWRATH_DEFINED)
{
// Ilwrath home system.
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 4);
}
else
{
// Ilwrath ship.
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 5);
}
if (pSolarSysState->MenuState.Initialized >= 3)
SaveFlagshipState ();
return TRUE;
}
}
return FALSE;
}
static UWORD static UWORD
DeviceFailed (BYTE which_device) DeviceFailed (BYTE which_device)
{ {
@@ -213,7 +305,8 @@ DeviceFailed (BYTE which_device)
PlayMenuSound (MENU_SOUND_INVOKED); PlayMenuSound (MENU_SOUND_INVOKED);
fade_buf[0] = FadeAllToWhite; fade_buf[0] = FadeAllToWhite;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1) SleepThreadUntil (
XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1)
+ (ONE_SECOND * 2)); + (ONE_SECOND * 2));
if (CurStarDescPtr->Index != CHMMR_DEFINED if (CurStarDescPtr->Index != CHMMR_DEFINED
|| pSolarSysState->pOrbitalDesc != || pSolarSysState->pOrbitalDesc !=
@@ -309,81 +402,8 @@ DeviceFailed (BYTE which_device)
break; break;
case UMGAH_HYPERWAVE_DEVICE: case UMGAH_HYPERWAVE_DEVICE:
case BURVIX_HYPERWAVE_DEVICE: case BURVIX_HYPERWAVE_DEVICE:
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) if (UseCaster ())
{ return FALSE;
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
{
SET_GAME_STATE (USED_BROADCASTER, 1);
return (FALSE);
}
}
else if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& pSolarSysState)
{
if (pSolarSysState->pOrbitalDesc ==
&pSolarSysState->PlanetDesc[1]
&& pSolarSysState->MenuState.Initialized == 3
&& CurStarDescPtr->Index == CHMMR_DEFINED
&& !GET_GAME_STATE (CHMMR_UNLEASHED))
{
NextActivity |= CHECK_LOAD; /* fake a load game */
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
EncounterGroup = 0;
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (npc_built_ship_q));
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
SaveFlagshipState ();
return (FALSE);
}
else
{
BOOLEAN FoundIlwrath;
HSTARSHIP hStarShip;
FoundIlwrath = (BOOLEAN)(
CurStarDescPtr->Index == ILWRATH_DEFINED
);
if (!FoundIlwrath && (hStarShip =
GetHeadLink (&GLOBAL (npc_built_ship_q))))
{
SHIP_FRAGMENTPTR FragPtr;
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
FoundIlwrath = (BOOLEAN)(
GET_RACE_ID (FragPtr) == ILWRATH_SHIP
);
UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
}
if (FoundIlwrath)
{
NextActivity |= CHECK_LOAD; /* fake a load game */
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
EncounterGroup = 0;
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
ReinitQueue (&GLOBAL (npc_built_ship_q));
if (CurStarDescPtr->Index == ILWRATH_DEFINED)
{
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 4);
}
else
{
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 5);
}
if (pSolarSysState->MenuState.Initialized >= 3)
SaveFlagshipState ();
return (FALSE);
}
}
}
break; break;
case TAALO_PROTECTOR_DEVICE: case TAALO_PROTECTOR_DEVICE:
break; break;
@@ -403,10 +423,9 @@ DeviceFailed (BYTE which_device)
&& GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1 && GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1
&& GLOBAL_SIS (FuelOnBoard) >= PORTAL_FUEL_COST) && GLOBAL_SIS (FuelOnBoard) >= PORTAL_FUEL_COST)
{ {
/* don't want to DeltaSISGauges /* No DeltaSISGauges because the flagship picture
* because the flagship picture * is currently obscured.
* is currently obscured */
*/
GLOBAL_SIS (FuelOnBoard) -= PORTAL_FUEL_COST; GLOBAL_SIS (FuelOnBoard) -= PORTAL_FUEL_COST;
SET_GAME_STATE (PORTAL_COUNTER, 1); SET_GAME_STATE (PORTAL_COUNTER, 1);
return (FALSE); return (FALSE);
@@ -428,8 +447,10 @@ DoManipulateDevices (PMENU_STATE pMS)
BOOLEAN select, cancel, back, forward; BOOLEAN select, cancel, back, forward;
select = PulsedInputState.menu[KEY_MENU_SELECT]; select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.menu[KEY_MENU_CANCEL]; cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
back = PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_LEFT]; back = PulsedInputState.menu[KEY_MENU_UP] ||
forward = PulsedInputState.menu[KEY_MENU_DOWN] || PulsedInputState.menu[KEY_MENU_RIGHT]; PulsedInputState.menu[KEY_MENU_LEFT];
forward = PulsedInputState.menu[KEY_MENU_DOWN]
|| PulsedInputState.menu[KEY_MENU_RIGHT];
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE); return (FALSE);