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; r.corner.x = DEVICE_SEL_ORG_X; // 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); }
static void DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice) { #define MAX_VIS_DEVICES 5 COORD y, cy; TEXT t; RECT r; PBYTE pDeviceMap; LockMutex (GraphicsLock); SetContext (StatusContext); SetContextFont (TinyFont); y = 41; t.baseline.x = 40; t.align = ALIGN_CENTER; t.CharCount = 3; pDeviceMap = (PBYTE)pMS->CurFrame; if (OldDevice > NUM_DEVICES || (NewDevice < NUM_DEVICES && (NewDevice < (BYTE)pMS->first_item.y || NewDevice >= (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES)))) { STAMP s; r.corner.x = 2; r.extent.width = FIELD_WIDTH + 1; if (!(pMS->Initialized & 1)) { ++r.corner.x; r.extent.width -= 2; r.corner.y = 33; r.extent.height = 89; SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); DrawFilledRectangle (&r); } else { TEXT ct; r.corner.y = 20; r.extent.height = 109; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19), BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextFont (StarConFont); ct.baseline.x = (STATUS_WIDTH >> 1) - 1; ct.baseline.y = 27; ct.align = ALIGN_CENTER; ct.pStr = GAME_STRING (DEVICE_STRING_BASE); ct.CharCount = (COUNT)~0; SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B)); font_DrawText (&ct); SetContextFont (TinyFont); } if (NewDevice < (BYTE)pMS->first_item.y) pMS->first_item.y = NewDevice; else if (NewDevice >= (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES)) pMS->first_item.y = NewDevice - (MAX_VIS_DEVICES - 1); s.origin.x = 4; s.origin.y = 34; cy = y; SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)); for (OldDevice = (BYTE)pMS->first_item.y; OldDevice < (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES) && OldDevice < (BYTE)pMS->first_item.x; ++OldDevice) { s.frame = SetAbsFrameIndex ( MiscDataFrame, 77 + pDeviceMap[OldDevice]); DrawStamp (&s); if (OldDevice != NewDevice) { t.baseline.y = cy; t.pStr = GAME_STRING (pDeviceMap[OldDevice] + DEVICE_STRING_BASE + 1); t.CharCount = utf8StringPos (t.pStr, ' '); font_DrawText (&t); t.baseline.y += 7; t.pStr = skipUTF8Chars (t.pStr, t.CharCount + 1); t.CharCount = (COUNT)~0; font_DrawText (&t); } cy += 18; s.origin.y += 18; } OldDevice = NewDevice; }