static void flashSupportShip (ROSTER_STATE *rosterState) { static Color c = BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x00, 0x00), 0x24); static TimeCount NextTime = 0; if (GetTimeCounter () >= NextTime) { NextTime = GetTimeCounter () + (ONE_SECOND / 15); /* The commented code out code is the old code before the switch * to 24-bits colors. The current code produces very slightly * different colors due to rounding errors, but the old code wasn't * original anyhow, and you can't tell the difference visually. * - SvdB if (c >= BUILD_COLOR (MAKE_RGB15 (0x1F, 0x19, 0x19), 0x24)) c = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x00, 0x00), 0x24); else c += BUILD_COLOR (MAKE_RGB15 (0x00, 0x02, 0x02), 0x00); */ if (c.g >= CC5TO8 (0x19)) { c = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x00, 0x00), 0x24); } else { c.g += CC5TO8 (0x02); c.b += CC5TO8 (0x02); } SetContextForeGroundColor (c); drawSupportShip (rosterState, TRUE); } }
/* Some basic color defines */ #define WIDGET_ACTIVE_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E) #define WIDGET_INACTIVE_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x1F), 0x00) #define WIDGET_INACTIVE_SELECTED_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) #define WIDGET_CURSOR_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) #define WIDGET_DIALOG_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07) #define WIDGET_DIALOG_TEXT_COLOR \ BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) static Color win_bg_clr = BUILD_COLOR (MAKE_RGB15_INIT (0x18, 0x18, 0x1F), 0x00); static Color win_medium_clr = BUILD_COLOR (MAKE_RGB15_INIT (0x10, 0x10, 0x18), 0x00); static Color win_dark_clr = BUILD_COLOR (MAKE_RGB15_INIT (0x08, 0x08, 0x10), 0x00); static FONT cur_font; void DrawShadowedBox (RECT *r, Color bg, Color dark, Color medium) { RECT t; Color oldcolor; BatchGraphics ();
// Called from the death_func of an element for an ion trail pixel, or a // ship shadow (when warping in/out). static void cycle_ion_trail (ELEMENT *ElementPtr) { STARSHIP *StarShipPtr; SHIP_INFO *ShipInfoPtr; // Color table for fully functional thrusters static const Color colorTab[] = { BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x15, 0x00), 0x7a), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x11, 0x00), 0x7b), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0E, 0x00), 0x7c), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0A, 0x00), 0x7d), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x07, 0x00), 0x7e), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x03, 0x00), 0x7f), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x00, 0x00), 0x2a), BUILD_COLOR (MAKE_RGB15_INIT (0x1B, 0x00, 0x00), 0x2b), BUILD_COLOR (MAKE_RGB15_INIT (0x17, 0x00, 0x00), 0x2c), BUILD_COLOR (MAKE_RGB15_INIT (0x13, 0x00, 0x00), 0x2d), BUILD_COLOR (MAKE_RGB15_INIT (0x0F, 0x00, 0x00), 0x2e), BUILD_COLOR (MAKE_RGB15_INIT (0x0B, 0x00, 0x00), 0x2f), }; // JMS: Color table for damaged thrusters static const Color colorTab2[] = { BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x15, 0x1F), 0x7a), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x11, 0x1F), 0x7b), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x0E, 0x1F), 0x7c), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x0A, 0x1F), 0x7d), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x07, 0x1F), 0x7e), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x03, 0x1F), 0x7f), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x1F), 0x2a), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x1B), 0x2b), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x17), 0x2c), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x13), 0x2d), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x0F), 0x2e), BUILD_COLOR (MAKE_RGB15_INIT (0x00, 0x00, 0x0B), 0x2f), }; const size_t colorTabCount = sizeof colorTab / sizeof colorTab[0]; // JMS: Get the pointers to element's owner ship. // They are needed to see if the ship's thrust is damaged GetElementStarShip (ElementPtr, &StarShipPtr); ShipInfoPtr = &StarShipPtr->RaceDescPtr->ship_info; assert (!(ElementPtr->state_flags & PLAYER_SHIP)); ElementPtr->colorCycleIndex++; if (ElementPtr->colorCycleIndex != colorTabCount) { ElementPtr->life_span = ElementPtr->thrust_wait; // Reset the life span. // JMS: Damaged thruster emits differently colored particles if (ShipInfoPtr->damage_flags & DAMAGE_THRUST) { SetPrimColor (&DisplayArray[ElementPtr->PrimIndex], colorTab2[ElementPtr->colorCycleIndex]); } else { SetPrimColor (&DisplayArray[ElementPtr->PrimIndex], colorTab[ElementPtr->colorCycleIndex]); } ElementPtr->state_flags &= ~DISAPPEARING; ElementPtr->state_flags |= CHANGING; } // else, the element disappears. }
void flee_preprocess (ELEMENT *ElementPtr) { STARSHIP *StarShipPtr; if (--ElementPtr->turn_wait == 0) { static const Color colorTab[] = { BUILD_COLOR (MAKE_RGB15_INIT (0x0A, 0x00, 0x00), 0x2E), BUILD_COLOR (MAKE_RGB15_INIT (0x0E, 0x00, 0x00), 0x2D), BUILD_COLOR (MAKE_RGB15_INIT (0x13, 0x00, 0x00), 0x2C), BUILD_COLOR (MAKE_RGB15_INIT (0x17, 0x00, 0x00), 0x2B), BUILD_COLOR (MAKE_RGB15_INIT (0x1B, 0x00, 0x00), 0x2A), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x00, 0x00), 0x29), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x04, 0x04), 0x28), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0A, 0x0A), 0x27), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0F, 0x0F), 0x26), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x13, 0x13), 0x25), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x19, 0x19), 0x24), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x13, 0x13), 0x25), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0F, 0x0F), 0x26), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0A, 0x0A), 0x27), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x04, 0x04), 0x28), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x00, 0x00), 0x29), BUILD_COLOR (MAKE_RGB15_INIT (0x1B, 0x00, 0x00), 0x2A), BUILD_COLOR (MAKE_RGB15_INIT (0x17, 0x00, 0x00), 0x2B), BUILD_COLOR (MAKE_RGB15_INIT (0x13, 0x00, 0x00), 0x2C), BUILD_COLOR (MAKE_RGB15_INIT (0x0E, 0x00, 0x00), 0x2D), }; const size_t colorTabCount = sizeof colorTab / sizeof colorTab[0]; ElementPtr->colorCycleIndex++; if (ElementPtr->colorCycleIndex == colorTabCount) ElementPtr->colorCycleIndex = 0; SetPrimColor (&DisplayArray[ElementPtr->PrimIndex], colorTab[ElementPtr->colorCycleIndex]); if (ElementPtr->colorCycleIndex == 0) --ElementPtr->thrust_wait; ElementPtr->turn_wait = ElementPtr->thrust_wait; if (ElementPtr->turn_wait) { ElementPtr->turn_wait = ((ElementPtr->turn_wait - 1) >> 1) + 1; } else if (ElementPtr->colorCycleIndex != (colorTabCount / 2))
static void spawn_phoenix_trail (ELEMENT *ElementPtr) { static const Color colorTable[] = { BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x15, 0x00), 0x7a), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x11, 0x00), 0x7b), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0E, 0x00), 0x7c), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x0A, 0x00), 0x7d), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x07, 0x00), 0x7e), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x03, 0x00), 0x7f), BUILD_COLOR (MAKE_RGB15_INIT (0x1F, 0x00, 0x00), 0x2a), BUILD_COLOR (MAKE_RGB15_INIT (0x1B, 0x00, 0x00), 0x2b), BUILD_COLOR (MAKE_RGB15_INIT (0x17, 0x00, 0x00), 0x2c), BUILD_COLOR (MAKE_RGB15_INIT (0x13, 0x00, 0x00), 0x2d), BUILD_COLOR (MAKE_RGB15_INIT (0x0F, 0x00, 0x00), 0x2e), BUILD_COLOR (MAKE_RGB15_INIT (0x0B, 0x00, 0x00), 0x2f), }; const size_t colorTableCount = sizeof colorTable / sizeof colorTable[0]; ElementPtr->colorCycleIndex++; if (ElementPtr->colorCycleIndex != colorTableCount) { ElementPtr->life_span = TRANSITION_LIFE; SetPrimColor (&(GLOBAL (DisplayArray))[ElementPtr->PrimIndex], colorTable[ElementPtr->colorCycleIndex]); ElementPtr->state_flags &= ~DISAPPEARING; ElementPtr->state_flags |= CHANGING; } // else, the element disappears. }