void DrawBattleCrewAmount (SHIP_INFO *ShipInfoPtr, COORD y_offs) { #define MAX_CREW_DIGITS 3 RECT r; TEXT t; UNICODE buf[40]; t.baseline.x = BATTLE_CREW_X + RES_STAT_SCALE(2) - RES_CASE(0,0,2); // JMS_GFX if (optWhichMenu == OPT_PC) t.baseline.x -= RES_STAT_SCALE(8); // JMS_GFX t.baseline.y = BATTLE_CREW_Y + y_offs; t.align = ALIGN_LEFT; t.pStr = buf; t.CharCount = (COUNT)~0; r.corner.x = t.baseline.x; r.corner.y = t.baseline.y - (5 << RESOLUTION_FACTOR); // JMS_GFX r.extent.width = 6 * MAX_CREW_DIGITS + (6 << RESOLUTION_FACTOR) + RESOLUTION_FACTOR; // JMS_GFX r.extent.height = (5 << RESOLUTION_FACTOR) + RES_CASE(0,2,3); // JMS_GFX sprintf (buf, "%u", ShipInfoPtr->crew_level); SetContextFont (StarConFont); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); DrawFilledRectangle (&r); SetContextForeGroundColor (BLACK_COLOR); font_DrawText (&t); }
static void DrawDevice (COUNT device, COUNT pos, bool selected) { RECT r; TEXT t; t.align = ALIGN_CENTER; t.baseline.x = DEVICE_COL_1; r.extent.width = DEVICE_SEL_WIDTH; r.extent.height = (TEXT_SPACING_Y * 2) + RES_CASE(0,4,0); r.corner.x = DEVICE_SEL_ORG_X - RES_CASE(0,0,8); // draw line background r.corner.y = DEVICE_ORG_Y + pos * DEVICE_SPACING_Y + NAME_OFS_Y; SetContextForeGroundColor (selected ? DEVICES_SELECTED_BACK_COLOR : DEVICES_BACK_COLOR); DrawFilledRectangle (&r); SetContextFont (TinyFont); // print device name SetContextForeGroundColor (selected ? DEVICES_SELECTED_NAME_COLOR : DEVICES_NAME_COLOR); t.baseline.y = r.corner.y + TEXT_BASELINE; t.pStr = GAME_STRING (device + DEVICE_STRING_BASE + 1); t.CharCount = utf8StringPos (t.pStr, ' '); font_DrawText (&t); t.baseline.y += TEXT_SPACING_Y; t.pStr = skipUTF8Chars (t.pStr, t.CharCount + 1); t.CharCount = (COUNT)~0; font_DrawText (&t); }
void DrawCrewFuelString (COORD y, SIZE state) { STAMP Stamp; Stamp.origin.y = y + GAUGE_YOFFS + STARCON_TEXT_HEIGHT - RES_CASE(0,6,12);//(RESOLUTION_FACTOR == 2 ? 12 : 0); if (state == 0) { Stamp.origin.x = CREW_XOFFS + (STAT_WIDTH >> 1) + RES_STAT_SCALE(6) - RES_CASE(0,8,8);//(RESOLUTION_FACTOR == 2 ? 8 : 0); // JMS_GFX if (optWhichMenu == OPT_PC) Stamp.frame = SetAbsFrameIndex (StatusFrame, 4); else Stamp.frame = SetAbsFrameIndex (StatusFrame, 0); DrawStamp (&Stamp); }
static BOOLEAN DrawNameString (bool nameCaptain, UNICODE *Str, COUNT CursorPos, COUNT state) { RECT r; TEXT lf; Color BackGround, ForeGround; FONT Font; LockMutex (GraphicsLock); { r.extent.width = SHIP_NAME_WIDTH; // JMS_GFX r.extent.height = SHIP_NAME_HEIGHT; SetContext (StatusContext); if (nameCaptain) { // Naming the captain Font = TinyFont; r.corner.x = RES_STAT_SCALE(3); // JMS_GFX; r.corner.y = RES_CASE(10,18,30); // JMS_GFX r.extent.width -= RES_STAT_SCALE(2); // JMS_GFX; lf.baseline.x = (STATUS_WIDTH >> 1) - RES_CASE(1,0,-1); lf.baseline.y = r.corner.y + r.extent.height - RES_CASE(1,4,3); BackGround = BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x1F), 0x09); ForeGround = BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B); } else { // Naming the flagship Font = StarConFont; r.corner.x = RES_CASE(2,4,7); // JMS_GFX; r.corner.y = RES_CASE(20,40,62); // JMS_GFX; lf.baseline.x = r.corner.x + (r.extent.width >> 1); lf.baseline.y = r.corner.y + r.extent.height - RES_CASE(1,3,3); // JMS_GFX BackGround = BUILD_COLOR (MAKE_RGB15 (0x0F, 0x00, 0x00), 0x2D); ForeGround = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x00), 0x7D); } lf.align = ALIGN_CENTER; }
void DrawCaptainsWindow (STARSHIP *StarShipPtr) { COORD y; COORD y_offs; RECT r; STAMP s; FRAME Frame; RACE_DESC *RDPtr; RDPtr = StarShipPtr->RaceDescPtr; Frame = RDPtr->ship_data.captain_control.background; if (Frame) { Frame = SetAbsFrameIndex (Frame, 0); RDPtr->ship_data.captain_control.background = Frame; Frame = SetRelFrameIndex (Frame, 1); RDPtr->ship_data.captain_control.turn = Frame; Frame = SetRelFrameIndex (Frame, 5); RDPtr->ship_data.captain_control.thrust = Frame; Frame = SetRelFrameIndex (Frame, 3); RDPtr->ship_data.captain_control.weapon = Frame; Frame = SetRelFrameIndex (Frame, 3); RDPtr->ship_data.captain_control.special = Frame; } BatchGraphics (); // Grey area under and around captain's window. assert (StarShipPtr->playerNr >= 0); y_offs = status_y_offsets[StarShipPtr->playerNr]; r.corner.x = CAPTAIN_XOFFS - RES_STAT_SCALE(4); // JMS_GFX r.corner.y = y_offs + SHIP_INFO_HEIGHT; r.extent.width = STATUS_WIDTH - 2; r.extent.height = SHIP_STATUS_HEIGHT - CAPTAIN_YOFFS + (4 << RESOLUTION_FACTOR); // JMS_GFX SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); DrawFilledRectangle (&r); // Left border of the status panel. SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); r.corner.x = 1; r.corner.y = y_offs + SHIP_INFO_HEIGHT; r.extent.width = 1; r.extent.height = (SHIP_STATUS_HEIGHT - SHIP_INFO_HEIGHT - 2); DrawFilledRectangle (&r); r.corner.x = 0; ++r.extent.height; DrawFilledRectangle (&r); // Lower and right border of the status panel. SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); r.corner.x = STATUS_WIDTH - 1; r.corner.y = y_offs + SHIP_INFO_HEIGHT; r.extent.width = 1; r.extent.height = SHIP_STATUS_HEIGHT - SHIP_INFO_HEIGHT; DrawFilledRectangle (&r); r.corner.x = STATUS_WIDTH - 2; DrawFilledRectangle (&r); r.corner.x = 1; r.extent.width = STATUS_WIDTH - 2; r.corner.y = y_offs + (SHIP_STATUS_HEIGHT - 2); r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = 0; ++r.extent.width; ++r.corner.y; DrawFilledRectangle (&r); y = y_offs + CAPTAIN_YOFFS; // Darker grey rectangle at bottom and right of captain's window SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); r.corner.x = CAPTAIN_WIDTH + CAPTAIN_XOFFS; r.corner.y = y; r.extent.width = 1; r.extent.height = CAPTAIN_HEIGHT; DrawFilledRectangle (&r); r.corner.x = CAPTAIN_XOFFS - 1; r.corner.y += CAPTAIN_HEIGHT; r.extent.width = CAPTAIN_WIDTH + 2; r.extent.height = 1; DrawFilledRectangle (&r); // Light grey rectangle at top and left of captains window SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); r.corner.x = CAPTAIN_XOFFS - 1; r.extent.width = CAPTAIN_WIDTH + 2; r.corner.y = y - 1; r.extent.height = 1; DrawFilledRectangle (&r); r.corner.x = CAPTAIN_XOFFS - 1; r.extent.width = 1; r.corner.y = y; r.extent.height = CAPTAIN_HEIGHT; DrawFilledRectangle (&r); s.frame = RDPtr->ship_data.captain_control.background; s.origin.x = CAPTAIN_XOFFS; s.origin.y = y; DrawStamp (&s); if (StarShipPtr->captains_name_index == 0 && StarShipPtr->playerNr == RPG_PLAYER_NUM) { // This is SIS TEXT t; t.baseline.x = STATUS_WIDTH >> 1; t.baseline.y = y + RES_CASE(6,-22,-44); // JMS_GFX t.align = ALIGN_CENTER; t.pStr = GLOBAL_SIS (CommanderName); t.CharCount = (COUNT)~0; SetContextForeGroundColor (RES_CASE(BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x00), 0x02), BLACK_COLOR, BLACK_COLOR)); SetContextFont (TinyFont); font_DrawText (&t); }
static void DrawDevicesDisplay (DEVICES_STATE *devState) { TEXT t; RECT r; STAMP s; COORD cy; COUNT i; r.corner.x = RES_CASE(2,2,3); // JMS_GFX r.corner.y = RES_STAT_SCALE(20) - RES_CASE(0,1,0); // JMS_GFX r.extent.width = FIELD_WIDTH + 1; // JMS_GFX // XXX: Shouldn't the height be 1 less? This draws the bottom border // 1 pixel too low. Or if not, why do we need another box anyway? r.extent.height = RES_STAT_SCALE(129) - r.corner.y + RES_CASE(0,6,19); // JMS_GFX DrawStarConBox (&r, 1, SHADOWBOX_MEDIUM_COLOR, SHADOWBOX_DARK_COLOR, TRUE, DEVICES_BACK_COLOR); DrawBorder(12); // print the "DEVICES" title SetContextFont (StarConFont); t.baseline.x = (STATUS_WIDTH >> 1) - RES_STAT_SCALE(1); // JMS_GFX t.baseline.y = r.corner.y + RES_STAT_SCALE(7); // JMS_GFX t.align = ALIGN_CENTER; t.pStr = GAME_STRING (DEVICE_STRING_BASE); t.CharCount = (COUNT)~0; SetContextForeGroundColor (DEVICES_SELECTED_NAME_COLOR); font_DrawText (&t); s.origin.x = DEVICE_COL_0; cy = DEVICE_ORG_Y; // draw device icons and print names for (i = 0; i < MAX_VIS_DEVICES; ++i, cy += DEVICE_SPACING_Y) { COUNT devIndex = devState->topIndex + i; if (devIndex >= devState->count) break; // draw device icon s.origin.y = cy + ICON_OFS_Y; s.frame = SetAbsFrameIndex (MiscDataFrame, 77 + devState->list[devIndex]); if (RESOLUTION_FACTOR < 2) { DrawStamp (&s); } else { int oldMode, oldScale; oldMode = SetGraphicScaleMode (TFB_SCALE_BILINEAR); oldScale = SetGraphicScale ((int)(GSCALE_IDENTITY / 2)); DrawStamp (&s); SetGraphicScale (oldScale); SetGraphicScaleMode (oldMode); } DrawDevice (devState->list[devIndex], i, false); } }
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 (); }