Added alternating-pixel font effect (used for lander text messages)
- currently this is only enabled for PC, since the 3DO needs color changes - added new obbkgnd.21.png which is the correct background for pc lander txt Changed "CAPTAIN", "FUEL", and "CREW" fonts (SIS) to be correct for PC Set black background for flagstat.0.png to be true black git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@542 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <ctype.h>
|
||||
#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);
|
||||
|
||||
+52
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user