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:
ghaushe
2003-01-12 00:27:54 +00:00
parent d3f142632b
commit 0e471c82cd
10 changed files with 141 additions and 42 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.2: 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 - Changed PC cmd-line options: now -a font,menu,scan -PhracturedBlue
- Added gradiated font support (for ship name), and PC-font option -PBlue - Added gradiated font support (for ship name), and PC-font option -PBlue
- Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue - Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue
+1 -2
View File
@@ -91,8 +91,7 @@ Implementation bugs (low priority):
- PC Menu still has some issues - PC Menu still has some issues
- Still using 3DO menu hierarchy, so menu text isn't identical to PC - Still using 3DO menu hierarchy, so menu text isn't identical to PC
-PC Font issues: -PC Font issues:
- Update 'CREW' and 'FUEL' fonts to be identical to PC - Lander font isn't correct (for PC or 3DO)
- Correct Lander text font color to be the same as PC
Stuff still to do (large): Stuff still to do (large):
- add some way to configure your keys - add some way to configure your keys
Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

+1
View File
@@ -19,3 +19,4 @@ obbkgnd.17.png 0 57 11 10
obbkgnd.18.png 0 57 0 0 obbkgnd.18.png 0 57 0 0
obbkgnd.19.png 0 57 9 6 obbkgnd.19.png 0 57 9 6
obbkgnd.20.png 0 57 2 -15 obbkgnd.20.png 0 57 2 -15
obbkgnd.21.png 0 57 0 0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

+5 -1
View File
@@ -330,7 +330,7 @@ extern DWORD LoadFontFile (PVOID pStr);
extern DWORD LoadGraphicInstance (DWORD res); extern DWORD LoadGraphicInstance (DWORD res);
extern DWORD LoadGraphic (DWORD res); extern DWORD LoadGraphic (DWORD res);
extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame); 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 FONT SetContextFont (FONT Font);
extern BOOLEAN DestroyFont (FONT_REF FontRef); extern BOOLEAN DestroyFont (FONT_REF FontRef);
extern FONT CaptureFont (FONT_REF FontRef); extern FONT CaptureFont (FONT_REF FontRef);
@@ -390,5 +390,9 @@ extern void FlushColorXForms (void);
#define GetColorMapAddress GetStringAddress #define GetColorMapAddress GetStringAddress
#define GetColorMapContents GetStringContents #define GetColorMapContents GetStringContents
// Font effect defines
#define GRADIENT_EFFECT 0
#define ALTERNATE_EFFECT 1
#endif /* _GFX_PROTOS */ #endif /* _GFX_PROTOS */
+14 -11
View File
@@ -18,24 +18,26 @@
#include "gfxintrn.h" #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 BYTE char_delta_array[MAX_DELTAS];
static struct { static struct {
BOOLEAN Use; BOOLEAN Use;
DWORD from; DWORD from;
DWORD to; 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) if (from == to)
FontGrad.Use = 0; FontEffect.Use = 0;
else else
{ {
FontGrad.Use = 1; FontEffect.Use = 1;
FontGrad.from = from; FontEffect.from = from;
FontGrad.to = to; FontEffect.to = to;
FontEffect.type = type;
} }
} }
@@ -220,7 +222,7 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
TEXTPTR TextPtr; TEXTPTR TextPtr;
PRIMITIVE locPrim; PRIMITIVE locPrim;
if (FontGrad.Use) if (FontEffect.Use)
SetPrimType (&locPrim, STAMP_PRIM); SetPrimType (&locPrim, STAMP_PRIM);
else else
SetPrimType (&locPrim, STAMPFILL_PRIM); SetPrimType (&locPrim, STAMPFILL_PRIM);
@@ -257,11 +259,12 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
_save_stamp.origin = r.corner; _save_stamp.origin = r.corner;
if (BoxIntersect (&r, pClipRect, &r)) if (BoxIntersect (&r, pClipRect, &r))
{ {
if (FontGrad.Use) if (FontEffect.Use)
{ {
FRAME origFrame = locPrim.Object.Stamp.frame; FRAME origFrame = locPrim.Object.Stamp.frame;
locPrim.Object.Stamp.frame = Build_Gradiated_Font( locPrim.Object.Stamp.frame = Build_Font_Effect(
locPrim.Object.Stamp.frame, FontGrad.from, FontGrad.to); locPrim.Object.Stamp.frame,
FontEffect.from, FontEffect.to, FontEffect.type);
DrawGraphicsFunc (&r, &locPrim); DrawGraphicsFunc (&r, &locPrim);
DestroyDrawable (ReleaseDrawable (locPrim.Object.Stamp.frame)); DestroyDrawable (ReleaseDrawable (locPrim.Object.Stamp.frame));
locPrim.Object.Stamp.frame = origFrame; locPrim.Object.Stamp.frame = origFrame;
+30 -10
View File
@@ -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; FRAMEPTR NewFrame;
int x, y; int x, y;
int width, height; int width, height;
Uint32 color, clear; Uint32 color, clear;
BYTE from_r, from_g, from_b, from_a; BYTE from_r, from_g, from_b, from_a;
BYTE to_r, to_g, to_b, to_a; BYTE to_r, to_g, to_b, to_a;
int clrstep_r, clrstep_g, clrstep_b, clrstep_a;
TFB_Image *tfbImg, *tfbOrigImg; TFB_Image *tfbImg, *tfbOrigImg;
SDL_Surface *img, *OrigImg; SDL_Surface *img, *OrigImg;
PutPixelFn putpix; PutPixelFn putpix;
@@ -317,10 +316,10 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to)
width = GetFrameWidth (FramePtr); width = GetFrameWidth (FramePtr);
height = GetFrameHeight (FramePtr); height = GetFrameHeight (FramePtr);
type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr) FrameType = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
->FlagsAndIndex) >> FTYPE_SHIFT; ->FlagsAndIndex) >> FTYPE_SHIFT;
NewFrame = CaptureDrawable ( NewFrame = CaptureDrawable (
CreateDrawable (type, (SIZE)width, (SIZE)height, 1)); CreateDrawable (FrameType, (SIZE)width, (SIZE)height, 1));
tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs); tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
OrigImg = tfbOrigImg->NormalImg; OrigImg = tfbOrigImg->NormalImg;
SDL_LockSurface (OrigImg); SDL_LockSurface (OrigImg);
@@ -342,17 +341,19 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to)
to_b = (to >> 8) & 0xFF; to_b = (to >> 8) & 0xFF;
to_a = to & 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); clear = SDL_MapRGBA (img->format, 0, 0, 0, 0);
for (y = 0; y < 2; y++) for (y = 0; y < 2; y++)
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
putpix (img, x, y, clear); putpix (img, x, y, clear);
width--; width--;
if (type == GRADIENT_EFFECT)
{
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++) for (; y < height - 1; y++)
{ {
color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a); color = SDL_MapRGBA (img->format, from_r, from_g, from_b, from_a);
@@ -367,6 +368,25 @@ FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to)
putpix (img, x, y, clear); putpix (img, x, y, clear);
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++; width++;
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
+20
View File
@@ -19,6 +19,7 @@
#include <ctype.h> #include <ctype.h>
#include "starcon.h" #include "starcon.h"
#include "lander.h" #include "lander.h"
#include "options.h"
#define NUM_CELL_COLS 34 #define NUM_CELL_COLS 34
#define NUM_CELL_ROWS 11 #define NUM_CELL_ROWS 11
@@ -33,6 +34,9 @@ ClearReportArea ()
STAMP s; STAMP s;
PRIMITIVE prim_row[NUM_CELL_COLS]; PRIMITIVE prim_row[NUM_CELL_COLS];
if (optPCfonts)
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 21);
else
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18); s.frame = SetAbsFrameIndex (SpaceJunkFrame, 18);
GetFrameRect (s.frame, &r); GetFrameRect (s.frame, &r);
s.origin.x = 1 + (r.extent.width >> 1); s.origin.x = 1 + (r.extent.width >> 1);
@@ -43,9 +47,14 @@ ClearReportArea ()
s.origin.x += r.extent.width + 1; s.origin.x += r.extent.width + 1;
SetPrimNextLink (&prim_row[i], i + 1); SetPrimNextLink (&prim_row[i], i + 1);
if (optPCfonts)
SetPrimType (&prim_row[i], STAMP_PRIM);
else
{
SetPrimType (&prim_row[i], STAMPFILL_PRIM); SetPrimType (&prim_row[i], STAMPFILL_PRIM);
SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57)); SetPrimColor (&prim_row[i], BUILD_COLOR (MAKE_RGB15 (0x00, 0x07, 0x00), 0x57));
} }
}
SetPrimNextLink (&prim_row[i - 1], END_OF_LIST); SetPrimNextLink (&prim_row[i - 1], END_OF_LIST);
SetContextBackGroundColor (BLACK_COLOR); SetContextBackGroundColor (BLACK_COLOR);
@@ -225,6 +234,17 @@ DoDiscoveryReport (SOUND ReadOutSounds)
FONT OldFont; FONT OldFont;
OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont); OldFont = SetContextFont (pSolarSysState->SysInfo.PlanetInfo.LanderFont);
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, MakeReport (ReadOutSounds,
(UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString), (UNICODE *)GetStringAddress (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString),
GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString)); GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString));
+52 -2
View File
@@ -379,14 +379,14 @@ DrawFlagshipName (BOOLEAN InStatusArea)
t.align = ALIGN_CENTER; t.align = ALIGN_CENTER;
t.CharCount = (COUNT)~0; t.CharCount = (COUNT)~0;
if (optPCfonts) if (optPCfonts)
SetContextGradientFont( SetContextFontEffect (GRADIENT_EFFECT,
BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF), BUILD_COLOR_RGBA (0xF7, 0x2C, 0x00, 0xFF),
BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF)); BUILD_COLOR_RGBA (0xF7, 0xBA, 0x00, 0xFF));
else else
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C)); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C));
DrawText (&t); DrawText (&t);
if (optPCfonts) if (optPCfonts)
SetContextGradientFont(0, 0); SetContextFontEffect (0, 0, 0);
SetContextForeGroundColor (OldColor); SetContextForeGroundColor (OldColor);
SetContextFont (OldFont); SetContextFont (OldFont);
@@ -508,6 +508,54 @@ GetGaugeRect (PRECT pRect, BOOLEAN IsCrewRect)
pRect->corner.y = IsCrewRect ? 117 : 38; 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 void
DeltaSISGauges (SIZE crew_delta, SIZE fuel_delta, int resunit_delta) 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.origin.x = s.origin.y = 0;
s.frame = flagship_status; s.frame = flagship_status;
DrawStamp (&s); DrawStamp (&s);
if (optPCfonts)
DrawPC_SIS();
s.origin.x = 1; s.origin.x = 1;
s.origin.y = 0; s.origin.y = 0;