void CargoMenu (void) { MENU_STATE MenuState; memset (&MenuState, 0, sizeof MenuState); // draw the initial cargo display DrawCargoStrings ((BYTE)~0, MenuState.CurState); DrawElementDescription (MenuState.CurState); SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); MenuState.InputFunc = DoDiscardCargo; DoInput (&MenuState, TRUE); // erase the cargo display ClearSISRect (DRAW_SIS_DISPLAY); }
BOOLEAN DevicesMenu (void) { MENU_STATE MenuState; DEVICES_STATE DevicesState; memset (&MenuState, 0, sizeof MenuState); MenuState.privData = &DevicesState; memset (&DevicesState, 0, sizeof DevicesState); DevicesState.count = InventoryDevices (DevicesState.list, NUM_DEVICES); if (!DevicesState.count) return FALSE; DrawDevices (&DevicesState, (COUNT)~0, MenuState.CurState); SetMenuSounds (MENU_SOUND_ARROWS | MENU_SOUND_PAGEUP | MENU_SOUND_PAGEDOWN, MENU_SOUND_SELECT); MenuState.InputFunc = DoManipulateDevices; DoInput (&MenuState, TRUE); SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); if (GLOBAL_SIS (CrewEnlisted) != (COUNT)~0 && !(GLOBAL (CurrentActivity) & CHECK_ABORT)) { LockMutex (GraphicsLock); ClearSISRect (DRAW_SIS_DISPLAY); UnlockMutex (GraphicsLock); if (!GET_GAME_STATE (PORTAL_COUNTER) && !(GLOBAL (CurrentActivity) & START_ENCOUNTER) && GLOBAL_SIS (CrewEnlisted) != (COUNT)~0) return TRUE; } return FALSE; }
static void DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem) { RECT r; STAMP s; CONTEXT OldContext; OldContext = SetContext (StatusContext); GetContextClipRect (&r); s.origin.x = RADAR_X - r.corner.x; s.origin.y = RADAR_Y - r.corner.y; r.corner.x = s.origin.x - 1; r.corner.y = s.origin.y - 11; r.extent.width = RADAR_WIDTH + 2; r.extent.height = 11; BatchGraphics (); ClearSISRect (CLEAR_SIS_RADAR); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); DrawFilledRectangle (&r); r.corner = s.origin; r.extent.width = RADAR_WIDTH; r.extent.height = RADAR_HEIGHT; SetContextForeGroundColor (BLACK_COLOR); DrawFilledRectangle (&r); if (NewRaceItem != (BYTE)~0) { TEXT t; HFLEETINFO hStarShip; FLEET_INFO *FleetPtr; UNICODE buf[30]; hStarShip = GetAvailableRaceFromIndex (NewRaceItem); NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q), hStarShip); // Draw the ship name, above the ship image. s.frame = SetAbsFrameIndex (pMS->ModuleFrame, 3 + NewRaceItem); DrawStamp (&s); // Draw the ship image. FleetPtr = LockFleetInfo (&GLOBAL (avail_race_q), hStarShip); s.frame = FleetPtr->melee_icon; UnlockFleetInfo (&GLOBAL (avail_race_q), hStarShip); t.baseline.x = s.origin.x + RADAR_WIDTH - 2; t.baseline.y = s.origin.y + RADAR_HEIGHT - 2; s.origin.x += (RADAR_WIDTH >> 1); s.origin.y += (RADAR_HEIGHT >> 1); DrawStamp (&s); // Print the ship cost. t.align = ALIGN_RIGHT; t.CharCount = (COUNT)~0; t.pStr = buf; sprintf (buf, "%u", ShipCost[NewRaceItem]); SetContextFont (TinyFont); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x00, 0x1F, 0x00), 0x02)); font_DrawText (&t); }
void DrawSISFrame (void) { RECT r; SetContext (ScreenContext); BatchGraphics (); { SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); r.corner.x = 0; r.corner.y = 0; r.extent.width = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.extent.height = SIS_ORG_Y - 1; DrawFilledRectangle (&r); r.corner.x = 0; r.corner.y = 0; r.extent.width = SIS_ORG_X - 1; r.extent.height = SIS_ORG_Y + SIS_SCREEN_HEIGHT + 1; DrawFilledRectangle (&r); r.corner.x = 0; r.corner.y = r.extent.height; r.extent.width = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.extent.height = SCREEN_HEIGHT - SIS_ORG_Y + SIS_SCREEN_HEIGHT; DrawFilledRectangle (&r); r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.corner.y = 0; r.extent.width = SCREEN_WIDTH - r.corner.x; r.extent.height = SCREEN_HEIGHT; DrawFilledRectangle (&r); r.corner.x = SIS_ORG_X - 1; r.corner.y = SIS_ORG_Y - 1; r.extent.width = SIS_SCREEN_WIDTH + 2; r.extent.height = SIS_SCREEN_HEIGHT + 2; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19), BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F), TRUE, BLACK_COLOR); r.corner.y = 0; r.extent.height = SIS_ORG_Y; r.corner.x = SIS_ORG_X; r.extent.width = SIS_MESSAGE_BOX_WIDTH; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54), BUILD_COLOR (MAKE_RGB15 (0x00, 0x01, 0x1C), 0x4E), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); r.extent.width = SIS_TITLE_BOX_WIDTH; r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54), BUILD_COLOR (MAKE_RGB15 (0x00, 0x01, 0x1C), 0x4E), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextForeGroundColor (BLACK_COLOR); r.corner.x = SAFE_X + SPACE_WIDTH - 1; r.corner.y = 0; r.extent.width = 1; r.extent.height = SCREEN_HEIGHT; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SAFE_Y + 139; DrawPoint (&r.corner); r.corner.x = SCREEN_WIDTH - 1; DrawPoint (&r.corner); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); r.corner.y = 1; r.extent.width = 1; r.extent.height = SAFE_Y + SIS_TITLE_HEIGHT; r.corner.x = SIS_ORG_X - 1; DrawFilledRectangle (&r); r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH - 1; DrawFilledRectangle (&r); r.corner.x = 0; r.corner.y = SCREEN_HEIGHT - 1; r.extent.width = SAFE_X + SPACE_WIDTH - 1; r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH - 2; r.corner.y = 0; r.extent.width = 1; r.extent.height = SCREEN_HEIGHT - 1; DrawFilledRectangle (&r); r.corner.x = SCREEN_WIDTH - 1; r.corner.y = 0; r.extent.width = 1; r.extent.height = SAFE_Y + 139; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SCREEN_HEIGHT - 1; r.extent.width = SCREEN_WIDTH - r.corner.x; r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = SCREEN_WIDTH - 1; r.corner.y = SAFE_Y + 140; r.extent.width = 1; r.extent.height = (SCREEN_HEIGHT - 1) - r.corner.y; DrawFilledRectangle (&r); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); r.corner.y = 1; r.extent.width = 1; r.extent.height = SAFE_Y + SIS_MESSAGE_HEIGHT; r.corner.x = SIS_ORG_X + SIS_MESSAGE_BOX_WIDTH; DrawFilledRectangle (&r); r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH; ++r.extent.height; DrawFilledRectangle (&r); r.corner.y = 0; r.extent.width = (SAFE_X + SPACE_WIDTH - 2) - r.corner.x; r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = 0; r.extent.width = SIS_ORG_X - r.corner.x; DrawFilledRectangle (&r); r.corner.x = SIS_ORG_X + SIS_MESSAGE_BOX_WIDTH; r.extent.width = SIS_SPACER_BOX_WIDTH; DrawFilledRectangle (&r); r.corner.x = 0; r.corner.y = 1; r.extent.width = 1; r.extent.height = (SCREEN_HEIGHT - 1) - r.corner.y; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = 0; r.extent.width = 1; r.extent.height = SAFE_Y + 139; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH + 1; r.corner.y = SAFE_Y + 139; r.extent.width = STATUS_WIDTH - 2; r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SAFE_Y + 140; r.extent.width = 1; r.extent.height = SCREEN_HEIGHT - r.corner.y; DrawFilledRectangle (&r); } InitSISContexts (); ClearSISRect (DRAW_SIS_DISPLAY); UnbatchGraphics (); }
void DrawSISFrame (void) { RECT r; SetContext (ScreenContext); BatchGraphics (); { // Middle grey rectangles around space window. SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); // r.corner.x = 0; r.corner.y = 0; r.extent.width = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.extent.height = SIS_ORG_Y - 1; DrawFilledRectangle (&r); // Inside Left Border r.corner.x = 0; r.corner.y = 0; r.extent.width = SIS_ORG_X - 1; r.extent.height = SIS_ORG_Y + SIS_SCREEN_HEIGHT + 1; DrawFilledRectangle (&r); // Bottom left of the border r.corner.x = 0; r.corner.y = r.extent.height; r.extent.width = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.extent.height = SCREEN_HEIGHT - SIS_ORG_Y + SIS_SCREEN_HEIGHT; DrawFilledRectangle (&r); // Top right inside border r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH + 1; r.corner.y = 0; r.extent.width = SCREEN_WIDTH - r.corner.x; r.extent.height = SCREEN_HEIGHT; DrawFilledRectangle (&r); // Light and dark grey edges of the inner space window. r.corner.x = SIS_ORG_X - 1; r.corner.y = SIS_ORG_Y - 1; r.extent.width = SIS_SCREEN_WIDTH + 2; r.extent.height = SIS_SCREEN_HEIGHT + 2; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19), BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F), TRUE, BLACK_COLOR); // The big Blue box in the upper edge of screen containing the star system name. r.corner.y = 0; r.extent.height = SIS_ORG_Y; r.corner.x = SIS_ORG_X; r.extent.width = SIS_MESSAGE_BOX_WIDTH; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54), BUILD_COLOR (MAKE_RGB15 (0x00, 0x01, 0x1C), 0x4E), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); // The smaller blue box. r.extent.width = SIS_TITLE_BOX_WIDTH; r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54), BUILD_COLOR (MAKE_RGB15 (0x00, 0x01, 0x1C), 0x4E), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); // Black border between menu area and space window area SetContextForeGroundColor (BLACK_COLOR); r.corner.x = SAFE_X + SPACE_WIDTH - 1; r.corner.y = 0; r.extent.width = 1; r.extent.height = SCREEN_HEIGHT; DrawFilledRectangle (&r); // Bottom corners of the SIS gauges r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SAFE_Y + RES_CASE(139, 282, 434); // JMS_GFX DrawPoint (&r.corner); r.corner.x = SCREEN_WIDTH - 1; // JMS_GFX DrawPoint (&r.corner); // Light grey border on the left side of big blue box. SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); r.corner.y = 1; r.extent.width = 1; r.extent.height = SAFE_Y + SIS_TITLE_HEIGHT; r.corner.x = SIS_ORG_X - 1; DrawFilledRectangle (&r); // The same for small blue box r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH - SIS_TITLE_BOX_WIDTH - 1; DrawFilledRectangle (&r); // Light grey horizontal line at the bottom of the screen, space window side r.corner.x = 0; r.corner.y = SCREEN_HEIGHT - 1; r.extent.width = SAFE_X + SPACE_WIDTH - 1; r.extent.height = 1; DrawFilledRectangle (&r); // Light grey vertical line at the right side of space window r.corner.x = SAFE_X + SPACE_WIDTH - 2; r.corner.y = 0; r.extent.width = 1; r.extent.height = SCREEN_HEIGHT - 1; DrawFilledRectangle (&r); // Vertical line at the right side of the menu window, upper part r.corner.x = SCREEN_WIDTH - 1; r.corner.y = 0; r.extent.width = 1; r.extent.height = SAFE_Y + RES_CASE(139, 282, 434); // JMS_GFX DrawFilledRectangle (&r); // Horizontal line at the bottom of the screen, menu window side r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SCREEN_HEIGHT - 1; r.extent.width = SCREEN_WIDTH - r.corner.x; r.extent.height = 1; DrawFilledRectangle (&r); // Vertical line at the right side of the menu window, lower part r.corner.x = SCREEN_WIDTH - 1; r.corner.y = SAFE_Y + RES_CASE(140, 283, 435); r.extent.width = 1; r.extent.height = (SCREEN_HEIGHT - 1) - r.corner.y; DrawFilledRectangle (&r); // Dark grey border around blue boxes. SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); // Vertical line on the right side of the big blue box r.corner.y = 1; // There was a reason this was supposed to be "1": Serosis r.extent.width = 1; r.extent.height = SAFE_Y + SIS_MESSAGE_HEIGHT; r.corner.x = SIS_ORG_X + SIS_MESSAGE_BOX_WIDTH; DrawFilledRectangle (&r); // Vertical line on the right side of the small blue box r.corner.x = SIS_ORG_X + SIS_SCREEN_WIDTH; ++r.extent.height; DrawFilledRectangle (&r); // r.corner.y = 0; r.extent.width = (SAFE_X + SPACE_WIDTH - 2) - r.corner.x; r.extent.height = 1; DrawFilledRectangle (&r); // r.corner.x = 0; r.extent.width = SIS_ORG_X - r.corner.x; DrawFilledRectangle (&r); // Horizontal line between boxes r.corner.x = SIS_ORG_X + SIS_MESSAGE_BOX_WIDTH; r.extent.width = SIS_SPACER_BOX_WIDTH; DrawFilledRectangle (&r); // r.corner.x = 0; r.corner.y = 1; r.extent.width = 1; r.extent.height = (SCREEN_HEIGHT - 1) - r.corner.y; DrawFilledRectangle (&r); // Dark verticle line accent for the top left of the right panel r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = 0; r.extent.width = 1; r.extent.height = SAFE_Y + RES_CASE(139, 282, 434); // JMS_GFX DrawFilledRectangle (&r); // Horizontal line of the separator below the SIS gauges r.corner.x = SAFE_X + SPACE_WIDTH + 1; r.corner.y = SAFE_Y + RES_CASE(139, 282, 434); // JMS_GFX r.extent.width = STATUS_WIDTH - 2; r.extent.height = 1; DrawFilledRectangle (&r); // Dark verticle line accent for the bottom left of the right panel r.corner.x = SAFE_X + SPACE_WIDTH; r.corner.y = SAFE_Y + RES_CASE(140, 283, 435); // JMS_GFX r.extent.width = 1; r.extent.height = SCREEN_HEIGHT - r.corner.y; DrawFilledRectangle (&r); DrawBorder(0); } InitSISContexts (); ClearSISRect (DRAW_SIS_DISPLAY); UnbatchGraphics (); }
static void DoSell (RESPONSE_REF R) { BYTE num_new_rainbows; UWORD rainbow_mask; SIZE added_credit; int what_to_sell_queued = 0; rainbow_mask = MAKE_WORD ( GET_GAME_STATE (RAINBOW_WORLD0), GET_GAME_STATE (RAINBOW_WORLD1) ); num_new_rainbows = (BYTE)(-GET_GAME_STATE (MELNORME_RAINBOW_COUNT)); while (rainbow_mask) { if (rainbow_mask & 1) ++num_new_rainbows; rainbow_mask >>= 1; } if (!PLAYER_SAID (R, sell)) { if (PLAYER_SAID (R, sell_life_data)) { DWORD TimeIn; added_credit = GLOBAL_SIS (TotalBioMass) * BIO_CREDIT_VALUE; NPCPhrase (SOLD_LIFE_DATA1); NPCPhrase (-(int)GLOBAL_SIS (TotalBioMass)); NPCPhrase (SOLD_LIFE_DATA2); NPCPhrase (-(int)added_credit); NPCPhrase (SOLD_LIFE_DATA3); // queue WHAT_TO_SELL before talk-segue if (num_new_rainbows) { NPCPhrase (WHAT_TO_SELL); what_to_sell_queued = 1; } AlienTalkSegue (1); DrawCargoStrings ((BYTE)~0, (BYTE)~0); SleepThread (ONE_SECOND / 2); TimeIn = GetTimeCounter (); DrawCargoStrings ( (BYTE)NUM_ELEMENT_CATEGORIES, (BYTE)NUM_ELEMENT_CATEGORIES ); do { TimeIn = GetTimeCounter (); if (AnyButtonPress (TRUE)) { DeltaCredit (GLOBAL_SIS (TotalBioMass) * BIO_CREDIT_VALUE); GLOBAL_SIS (TotalBioMass) = 0; } else { --GLOBAL_SIS (TotalBioMass); DeltaCredit (BIO_CREDIT_VALUE); } DrawCargoStrings ( (BYTE)NUM_ELEMENT_CATEGORIES, (BYTE)NUM_ELEMENT_CATEGORIES ); } while (GLOBAL_SIS (TotalBioMass)); SleepThread (ONE_SECOND / 2); LockMutex (GraphicsLock); ClearSISRect (DRAW_SIS_DISPLAY); UnlockMutex (GraphicsLock); } else /* if (R == sell_rainbow_locations) */ { added_credit = num_new_rainbows * (250 * BIO_CREDIT_VALUE); NPCPhrase (SOLD_RAINBOW_LOCATIONS1); NPCPhrase (-(int)num_new_rainbows); NPCPhrase (SOLD_RAINBOW_LOCATIONS2); NPCPhrase (-(int)added_credit); NPCPhrase (SOLD_RAINBOW_LOCATIONS3); num_new_rainbows += GET_GAME_STATE (MELNORME_RAINBOW_COUNT); SET_GAME_STATE (MELNORME_RAINBOW_COUNT, num_new_rainbows); num_new_rainbows = 0; DeltaCredit (added_credit); } AskedToBuy = FALSE; } if (GLOBAL_SIS (TotalBioMass) || num_new_rainbows) { if (!what_to_sell_queued) NPCPhrase (WHAT_TO_SELL); if (GLOBAL_SIS (TotalBioMass)) Response (sell_life_data, DoSell); if (num_new_rainbows) Response (sell_rainbow_locations, DoSell); Response (done_selling, NatureOfConversation); } else { if (PLAYER_SAID (R, sell)) NPCPhrase (NOTHING_TO_SELL); DISABLE_PHRASE (sell); NatureOfConversation (R); } }