diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 6336f7f81..54c559b6b 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.2: +- Added new font effect (PC-lander messages), and set colors for text -PBlue +- Use correct font for 'CAPTAIN', 'FUEL', and 'CREW' is status screen -PBlue - Changed PC cmd-line options: now -a font,menu,scan -PhracturedBlue - Added gradiated font support (for ship name), and PC-font option -PBlue - Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue diff --git a/sc2/TODO b/sc2/TODO index df9682fef..cc22221c6 100644 --- a/sc2/TODO +++ b/sc2/TODO @@ -91,8 +91,7 @@ Implementation bugs (low priority): - PC Menu still has some issues - Still using 3DO menu hierarchy, so menu text isn't identical to PC -PC Font issues: - - Update 'CREW' and 'FUEL' fonts to be identical to PC - - Correct Lander text font color to be the same as PC + - Lander font isn't correct (for PC or 3DO) Stuff still to do (large): - add some way to configure your keys diff --git a/sc2/content/ipanims/obbkgnd.21.png b/sc2/content/ipanims/obbkgnd.21.png new file mode 100644 index 000000000..a828e4d38 Binary files /dev/null and b/sc2/content/ipanims/obbkgnd.21.png differ diff --git a/sc2/content/ipanims/obbkgnd.ani b/sc2/content/ipanims/obbkgnd.ani index 862175aab..7bd31cab8 100755 --- a/sc2/content/ipanims/obbkgnd.ani +++ b/sc2/content/ipanims/obbkgnd.ani @@ -19,3 +19,4 @@ obbkgnd.17.png 0 57 11 10 obbkgnd.18.png 0 57 0 0 obbkgnd.19.png 0 57 9 6 obbkgnd.20.png 0 57 2 -15 +obbkgnd.21.png 0 57 0 0 diff --git a/sc2/content/lbm/flagstat.0.png b/sc2/content/lbm/flagstat.0.png index 41769aaf0..3ca78214a 100644 Binary files a/sc2/content/lbm/flagstat.0.png and b/sc2/content/lbm/flagstat.0.png differ diff --git a/sc2/src/sc2code/libs/gfxlib.h b/sc2/src/sc2code/libs/gfxlib.h index 6e335e322..58c2a94ef 100644 --- a/sc2/src/sc2code/libs/gfxlib.h +++ b/sc2/src/sc2code/libs/gfxlib.h @@ -330,7 +330,7 @@ extern DWORD LoadFontFile (PVOID pStr); extern DWORD LoadGraphicInstance (DWORD res); extern DWORD LoadGraphic (DWORD res); extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame); -extern void SetContextGradientFont (DWORD from, DWORD to); +extern void SetContextFontEffect (BYTE type, DWORD from, DWORD to); extern FONT SetContextFont (FONT Font); extern BOOLEAN DestroyFont (FONT_REF FontRef); extern FONT CaptureFont (FONT_REF FontRef); @@ -390,5 +390,9 @@ extern void FlushColorXForms (void); #define GetColorMapAddress GetStringAddress #define GetColorMapContents GetStringContents +// Font effect defines +#define GRADIENT_EFFECT 0 +#define ALTERNATE_EFFECT 1 + #endif /* _GFX_PROTOS */ diff --git a/sc2/src/sc2code/libs/graphics/font.c b/sc2/src/sc2code/libs/graphics/font.c index 40364b57f..6f55ad2dc 100644 --- a/sc2/src/sc2code/libs/graphics/font.c +++ b/sc2/src/sc2code/libs/graphics/font.c @@ -18,24 +18,26 @@ #include "gfxintrn.h" -extern FRAME Build_Gradiated_Font (FRAME FramePtr, DWORD from, DWORD to); +extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to, BYTE type); static BYTE char_delta_array[MAX_DELTAS]; static struct { BOOLEAN Use; DWORD from; DWORD to; -} FontGrad = {0,0,0}; + BYTE type; +} FontEffect = {0,0,0}; -void SetContextGradientFont (DWORD from, DWORD to) +void SetContextFontEffect (BYTE type, DWORD from, DWORD to) { if (from == to) - FontGrad.Use = 0; + FontEffect.Use = 0; else { - FontGrad.Use = 1; - FontGrad.from = from; - FontGrad.to = to; + FontEffect.Use = 1; + FontEffect.from = from; + FontEffect.to = to; + FontEffect.type = type; } } @@ -220,7 +222,7 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) TEXTPTR TextPtr; PRIMITIVE locPrim; - if (FontGrad.Use) + if (FontEffect.Use) SetPrimType (&locPrim, STAMP_PRIM); else SetPrimType (&locPrim, STAMPFILL_PRIM); @@ -257,11 +259,12 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr) _save_stamp.origin = r.corner; if (BoxIntersect (&r, pClipRect, &r)) { - if (FontGrad.Use) + if (FontEffect.Use) { FRAME origFrame = locPrim.Object.Stamp.frame; - locPrim.Object.Stamp.frame = Build_Gradiated_Font( - locPrim.Object.Stamp.frame, FontGrad.from, FontGrad.to); + locPrim.Object.Stamp.frame = Build_Font_Effect( + locPrim.Object.Stamp.frame, + FontEffect.from, FontEffect.to, FontEffect.type); DrawGraphicsFunc (&r, &locPrim); DestroyDrawable (ReleaseDrawable (locPrim.Object.Stamp.frame)); locPrim.Object.Stamp.frame = origFrame; diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c index 8dbb189b9..472838cba 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c @@ -300,16 +300,15 @@ Uint32 **getpixelarray(FRAMEPTR FramePtr, int width, int height) } -FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to) +FRAMEPTR Build_Font_Effect (FRAMEPTR FramePtr, Uint32 from, Uint32 to, BYTE type) { - UBYTE type; + UBYTE FrameType; FRAMEPTR NewFrame; int x, y; int width, height; Uint32 color, clear; BYTE from_r, from_g, from_b, from_a; BYTE to_r, to_g, to_b, to_a; - int clrstep_r, clrstep_g, clrstep_b, clrstep_a; TFB_Image *tfbImg, *tfbOrigImg; SDL_Surface *img, *OrigImg; PutPixelFn putpix; @@ -317,10 +316,10 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to) width = GetFrameWidth (FramePtr); height = GetFrameHeight (FramePtr); - type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr) + FrameType = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr) ->FlagsAndIndex) >> FTYPE_SHIFT; NewFrame = CaptureDrawable ( - CreateDrawable (type, (SIZE)width, (SIZE)height, 1)); + CreateDrawable (FrameType, (SIZE)width, (SIZE)height, 1)); tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs); OrigImg = tfbOrigImg->NormalImg; SDL_LockSurface (OrigImg); @@ -342,30 +341,51 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to) to_b = (to >> 8) & 0xFF; to_a = to & 0xFF; - clrstep_r = (to_r - from_r) / (height - 5); - clrstep_g = (to_g - from_g) / (height - 5); - clrstep_b = (to_b - from_b) / (height - 5); - clrstep_a = (to_a - from_a) / (height - 5); clear = SDL_MapRGBA (img->format, 0, 0, 0, 0); - for (y = 0; y < 2; y++) for (x = 0; x < width; x++) putpix (img, x, y, clear); width--; - for (; y < height - 1; y++) + if (type == GRADIENT_EFFECT) { - color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); - from_r += clrstep_r; - from_g += clrstep_g; - from_b += clrstep_b; - from_a += clrstep_a; - for (x = 0; x < width; x++) - if (getpix (OrigImg, x, y) == 1) - putpix (img, x, y, color); - else - putpix (img, x, y, clear); - putpix (img, x, y, clear); + int clrstep_r, clrstep_g, clrstep_b, clrstep_a; + clrstep_r = (to_r - from_r) / (height - 5); + clrstep_g = (to_g - from_g) / (height - 5); + clrstep_b = (to_b - from_b) / (height - 5); + clrstep_a = (to_a - from_a) / (height - 5); + for (; y < height - 1; y++) + { + color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); + from_r += clrstep_r; + from_g += clrstep_g; + from_b += clrstep_b; + from_a += clrstep_a; + for (x = 0; x < width; x++) + if (getpix (OrigImg, x, y) == 1) + putpix (img, x, y, color); + else + putpix (img, x, y, clear); + putpix (img, x, y, clear); + } + } + else if (type == ALTERNATE_EFFECT) + { + Uint32 color1, color2; + color1 = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); + color2 = SDL_MapRGBA (img->format, to_r, to_g, to_b, to_a); + for (; y < height - 1; y++) + { + for (x = 0; x < width; x++) + if (getpix (OrigImg, x, y) == 1) + { + color = ((y & 0x01) ^ (x & 0x01)) ? color2 : color1; + putpix (img, x, y, color); + } + else + putpix (img, x, y, clear); + putpix (img, x, y, clear); + } } width++; diff --git a/sc2/src/sc2code/planets/report.c b/sc2/src/sc2code/planets/report.c index 5202e0c33..0de407972 100644 --- a/sc2/src/sc2code/planets/report.c +++ b/sc2/src/sc2code/planets/report.c @@ -19,6 +19,7 @@ #include #include "starcon.h" #include "lander.h" +#include "options.h" #define NUM_CELL_COLS 34 #define NUM_CELL_ROWS 11 @@ -33,7 +34,10 @@ ClearReportArea () STAMP s; PRIMITIVE prim_row[NUM_CELL_COLS]; - s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); + if (optPCfonts) + s.frame = SetAbsFrameIndex (SpaceJunkFrame, 21); + else + s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); GetFrameRect (s.frame, &r); s.origin.x = 1 + (r.extent.width >> 1); s.origin.y = 1; @@ -43,8 +47,13 @@ ClearReportArea () s.origin.x += r.extent.width + 1; SetPrimNextLink (&prim_row[i], i + 1); - SetPrimType (&prim_row[i], STAMPFILL_PRIM); - SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57)); + if (optPCfonts) + SetPrimType (&prim_row[i], STAMP_PRIM); + else + { + SetPrimType (&prim_row[i], STAMPFILL_PRIM); + SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57)); + } } SetPrimNextLink (&prim_row[i - 1], END_OF_LIST); @@ -225,7 +234,18 @@ DoDiscoveryReport (SOUND ReadOutSounds) FONT OldFont; OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont); - MakeReport (ReadOutSounds, + if (optPCfonts) + { + SetContextFontEffect (ALTERNATE_EFFECT, + BUILD_COLOR_RGBA (0x00, 0x00, 0xD6, 0xFF), + BUILD_COLOR_RGBA (0x00, 0x04, 0xFF, 0xFF)); + MakeReport (ReadOutSounds, + (UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString), + GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString)); + SetContextFontEffect (0, 0, 0); + } + else + MakeReport (ReadOutSounds, (UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString), GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString)); SetContextFont (OldFont); diff --git a/sc2/src/sc2code/sis.c b/sc2/src/sc2code/sis.c index 15e91836d..6dcf0423a 100644 --- a/sc2/src/sc2code/sis.c +++ b/sc2/src/sc2code/sis.c @@ -379,14 +379,14 @@ DrawFlagshipName (BOOLEAN InStatusArea) t.align = ALIGN_CENTER; t.CharCount = (COUNT)~0; if (optPCfonts) - SetContextGradientFont( + SetContextFontEffect (GRADIENT_EFFECT, BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF), BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF)); else SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C)); DrawText (&t); if (optPCfonts) - SetContextGradientFont(0, 0); + SetContextFontEffect (0, 0, 0); SetContextForeGroundColor (OldColor); SetContextFont (OldFont); @@ -508,6 +508,54 @@ GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect) pRect->corner.y = IsCrewRect ? 117 : 38; } +void DrawPC_SIS () +{ + TEXT t; + RECT r; + UNICODE buf[10]; + GetGaugeRect (&r, FALSE); + t.baseline.x = STATUS_WIDTH >> 1; + t.baseline.y = r.corner.y - 1; + t.align = ALIGN_CENTER; + t.pStr = buf; + t.CharCount = (COUNT)~0; + SetContextFont (TinyFont); + SetContextForeGroundColor (BLACK_COLOR); + + r.corner.y -= 6; + r.corner.x--; + r.extent.width += 2; + DrawFilledRectangle (&r); + + SetContextFontEffect (GRADIENT_EFFECT, + BUILD_COLOR_RGBA (0x00, 0x4D, 0x00, 0xFF), + BUILD_COLOR_RGBA (0x00, 0xAE, 0x00, 0xFF)); + wsprintf (buf, "FUEL"); + DrawText (&t); + + r.corner.y += 79; + t.baseline.y += 79; + DrawFilledRectangle (&r); + + SetContextFontEffect (GRADIENT_EFFECT, + BUILD_COLOR_RGBA (0x6B, 0x00, 0x00, 0xFF), + BUILD_COLOR_RGBA (0xF7, 0x00, 0x00, 0xFF)); + wsprintf (buf, "CREW"); + DrawText (&t); + SetContextFontEffect (0, 0, 0); + + r.corner.x = 2 + 1; + r.corner.y = 3; + r.extent.width = 58; + r.extent.height = 7; + SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); + DrawFilledRectangle (&r); + SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x02, 0x04, 0x1E), 0x38)); + t.baseline.y = r.corner.y + 6; + wsprintf (buf, "CAPTAIN"); + DrawText (&t); +} + void DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) { @@ -531,6 +579,8 @@ DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) s.origin.x = s.origin.y = 0; s.frame = flagship_status; DrawStamp (&s); + if (optPCfonts) + DrawPC_SIS(); s.origin.x = 1; s.origin.y = 0;