Added support for Gradiated fonts (as in 'FUEL', 'CREW')
- added option to use Gradiated font for Ship-name (as in PC version) Changed cmd-line options for PC settings: now '--pcopt=font,menu,scan' git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@541 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
Changes towards version 0.2:
|
Changes towards version 0.2:
|
||||||
|
- 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
|
- Minor fixes to PCMenu by fOSSiL, Nic, PhracturedBlue
|
||||||
- Updated mingw support with better directions, and easier build -PBlue
|
- Updated mingw support with better directions, and easier build -PBlue
|
||||||
- PCMenus now suports 'settings', and menu font is correct -PhracturedBlue
|
- PCMenus now suports 'settings', and menu font is correct -PhracturedBlue
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ Implementation bugs (low priority):
|
|||||||
nearest neighbor.
|
nearest neighbor.
|
||||||
- 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:
|
||||||
|
- Update 'CREW' and 'FUEL' fonts to be identical to PC
|
||||||
|
- 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
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ char *configDir, *saveDir, *meleeDir;
|
|||||||
BOOLEAN optSubtitles = TRUE;
|
BOOLEAN optSubtitles = TRUE;
|
||||||
BOOLEAN optPCscan = FALSE;
|
BOOLEAN optPCscan = FALSE;
|
||||||
BOOLEAN optPCmenu = FALSE;
|
BOOLEAN optPCmenu = FALSE;
|
||||||
|
BOOLEAN optPCfonts = FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
prepareConfigDir (void) {
|
prepareConfigDir (void) {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ extern BOOLEAN optPCscan;
|
|||||||
|
|
||||||
extern BOOLEAN optPCmenu;
|
extern BOOLEAN optPCmenu;
|
||||||
|
|
||||||
|
extern BOOLEAN optPCfonts;
|
||||||
|
|
||||||
extern char *configDir;
|
extern char *configDir;
|
||||||
extern char *meleeDir;
|
extern char *meleeDir;
|
||||||
extern char *saveDir;
|
extern char *saveDir;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ typedef COLOR *PCOLOR;
|
|||||||
#define COLOR_32k(c) (UWORD)((COLOR)(c)>>8)
|
#define COLOR_32k(c) (UWORD)((COLOR)(c)>>8)
|
||||||
#define COLOR_256(c) LOBYTE((COLOR)c)
|
#define COLOR_256(c) LOBYTE((COLOR)c)
|
||||||
#define MAKE_RGB15(r,g,b) (UWORD)(((r)<<10)|((g)<<5)|(b))
|
#define MAKE_RGB15(r,g,b) (UWORD)(((r)<<10)|((g)<<5)|(b))
|
||||||
|
#define BUILD_COLOR_RGBA(r,g,b,a) (DWORD)(((r)<<24)|((g)<<16)|((b)<<8)|(a))
|
||||||
|
|
||||||
typedef BYTE CREATE_FLAGS;
|
typedef BYTE CREATE_FLAGS;
|
||||||
#define WANT_MASK (CREATE_FLAGS)(1 << 0)
|
#define WANT_MASK (CREATE_FLAGS)(1 << 0)
|
||||||
@@ -329,6 +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 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);
|
||||||
|
|||||||
@@ -18,7 +18,27 @@
|
|||||||
|
|
||||||
#include "gfxintrn.h"
|
#include "gfxintrn.h"
|
||||||
|
|
||||||
|
extern FRAME Build_Gradiated_Font (FRAME FramePtr, DWORD from, DWORD to);
|
||||||
|
|
||||||
static BYTE char_delta_array[MAX_DELTAS];
|
static BYTE char_delta_array[MAX_DELTAS];
|
||||||
|
static struct {
|
||||||
|
BOOLEAN Use;
|
||||||
|
DWORD from;
|
||||||
|
DWORD to;
|
||||||
|
} FontGrad = {0,0,0};
|
||||||
|
|
||||||
|
void SetContextGradientFont (DWORD from, DWORD to)
|
||||||
|
{
|
||||||
|
if (from == to)
|
||||||
|
FontGrad.Use = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FontGrad.Use = 1;
|
||||||
|
FontGrad.from = from;
|
||||||
|
FontGrad.to = to;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FONT
|
FONT
|
||||||
SetContextFont (FONT Font)
|
SetContextFont (FONT Font)
|
||||||
@@ -200,7 +220,10 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
TEXTPTR TextPtr;
|
TEXTPTR TextPtr;
|
||||||
PRIMITIVE locPrim;
|
PRIMITIVE locPrim;
|
||||||
|
|
||||||
SetPrimType (&locPrim, STAMPFILL_PRIM);
|
if (FontGrad.Use)
|
||||||
|
SetPrimType (&locPrim, STAMP_PRIM);
|
||||||
|
else
|
||||||
|
SetPrimType (&locPrim, STAMPFILL_PRIM);
|
||||||
SetPrimColor (&locPrim, _get_context_fg_color ());
|
SetPrimColor (&locPrim, _get_context_fg_color ());
|
||||||
|
|
||||||
TextPtr = &PrimPtr->Object.Text;
|
TextPtr = &PrimPtr->Object.Text;
|
||||||
@@ -233,7 +256,19 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
r.extent.height = GetFrameHeight (locPrim.Object.Stamp.frame);
|
r.extent.height = GetFrameHeight (locPrim.Object.Stamp.frame);
|
||||||
_save_stamp.origin = r.corner;
|
_save_stamp.origin = r.corner;
|
||||||
if (BoxIntersect (&r, pClipRect, &r))
|
if (BoxIntersect (&r, pClipRect, &r))
|
||||||
DrawGraphicsFunc (&r, &locPrim);
|
{
|
||||||
|
if (FontGrad.Use)
|
||||||
|
{
|
||||||
|
FRAME origFrame = locPrim.Object.Stamp.frame;
|
||||||
|
locPrim.Object.Stamp.frame = Build_Gradiated_Font(
|
||||||
|
locPrim.Object.Stamp.frame, FontGrad.from, FontGrad.to);
|
||||||
|
DrawGraphicsFunc (&r, &locPrim);
|
||||||
|
DestroyDrawable (ReleaseDrawable (locPrim.Object.Stamp.frame));
|
||||||
|
locPrim.Object.Stamp.frame = origFrame;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DrawGraphicsFunc (&r, &locPrim);
|
||||||
|
}
|
||||||
|
|
||||||
locPrim.Object.Stamp.origin.x += GetFrameWidth (locPrim.Object.Stamp.frame);
|
locPrim.Object.Stamp.origin.x += GetFrameWidth (locPrim.Object.Stamp.frame);
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -298,6 +298,84 @@ Uint32 **getpixelarray(FRAMEPTR FramePtr, int width, int height)
|
|||||||
map[y] = NULL;
|
map[y] = NULL;
|
||||||
return (map);
|
return (map);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FRAMEPTR Build_Gradiated_Font (FRAMEPTR FramePtr, Uint32 from, Uint32 to)
|
||||||
|
{
|
||||||
|
UBYTE type;
|
||||||
|
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;
|
||||||
|
GetPixelFn getpix;
|
||||||
|
|
||||||
|
width = GetFrameWidth (FramePtr);
|
||||||
|
height = GetFrameHeight (FramePtr);
|
||||||
|
type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
|
||||||
|
->FlagsAndIndex) >> FTYPE_SHIFT;
|
||||||
|
NewFrame = CaptureDrawable (
|
||||||
|
CreateDrawable (type, (SIZE)width, (SIZE)height, 1));
|
||||||
|
tfbOrigImg = (TFB_Image *)((BYTE *)(FramePtr) + FramePtr->DataOffs);
|
||||||
|
OrigImg = tfbOrigImg->NormalImg;
|
||||||
|
SDL_LockSurface (OrigImg);
|
||||||
|
|
||||||
|
tfbImg = (TFB_Image *)((BYTE *)(NewFrame) + NewFrame->DataOffs);
|
||||||
|
img = tfbImg->NormalImg;
|
||||||
|
SDL_LockSurface (img);
|
||||||
|
|
||||||
|
putpix = putpixel_for (img);
|
||||||
|
getpix = getpixel_for (OrigImg);
|
||||||
|
|
||||||
|
from_r = (from >> 24);
|
||||||
|
from_g = (from >> 16) & 0xFF;
|
||||||
|
from_b = (from >> 8) & 0xFF;
|
||||||
|
from_a = from & 0xFF;
|
||||||
|
|
||||||
|
to_r = (to >> 24);
|
||||||
|
to_g = (to >> 16) & 0xFF;
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
width++;
|
||||||
|
for (x = 0; x < width; x++)
|
||||||
|
putpix (img, x, y, clear);
|
||||||
|
SDL_UnlockSurface (img);
|
||||||
|
SDL_UnlockSurface (OrigImg);
|
||||||
|
SetFrameHotSpot (NewFrame, GetFrameHotSpot (FramePtr));
|
||||||
|
return (NewFrame);
|
||||||
|
|
||||||
}
|
}
|
||||||
// Generate a pixel (in the correct format to be applied to FramePtr) from the
|
// Generate a pixel (in the correct format to be applied to FramePtr) from the
|
||||||
// r,g,b,a values supplied
|
// r,g,b,a values supplied
|
||||||
|
|||||||
@@ -378,8 +378,15 @@ DrawFlagshipName (BOOLEAN InStatusArea)
|
|||||||
t.baseline.y = r.corner.y + (SHIP_NAME_HEIGHT - InStatusArea);
|
t.baseline.y = r.corner.y + (SHIP_NAME_HEIGHT - InStatusArea);
|
||||||
t.align = ALIGN_CENTER;
|
t.align = ALIGN_CENTER;
|
||||||
t.CharCount = (COUNT)~0;
|
t.CharCount = (COUNT)~0;
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x14, 0x0A, 0x00), 0x0C));
|
if (optPCfonts)
|
||||||
|
SetContextGradientFont(
|
||||||
|
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);
|
DrawText (&t);
|
||||||
|
if (optPCfonts)
|
||||||
|
SetContextGradientFont(0, 0);
|
||||||
|
|
||||||
SetContextForeGroundColor (OldColor);
|
SetContextForeGroundColor (OldColor);
|
||||||
SetContextFont (OldFont);
|
SetContextFont (OldFont);
|
||||||
|
|||||||
+23
-10
@@ -87,8 +87,7 @@ main (int argc, char *argv[])
|
|||||||
{"pcmusic", 0, NULL, 'm'},
|
{"pcmusic", 0, NULL, 'm'},
|
||||||
{"audioquality", 1, NULL, 'q'},
|
{"audioquality", 1, NULL, 'q'},
|
||||||
{"nosubtitles", 0, NULL, 'u'},
|
{"nosubtitles", 0, NULL, 'u'},
|
||||||
{"pcscan", 0, NULL, 'a'},
|
{"pcopt", 1, NULL, 'a'},
|
||||||
{"pcmenu", 0, NULL, 'b'},
|
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ main (int argc, char *argv[])
|
|||||||
strcpy (contentdir, "content");
|
strcpy (contentdir, "content");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:emq:uab", long_options, &option_index)) != -1)
|
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:emq:ua:", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
@@ -187,10 +186,21 @@ main (int argc, char *argv[])
|
|||||||
optSubtitles = FALSE;
|
optSubtitles = FALSE;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
optPCscan = TRUE;
|
{
|
||||||
break;
|
char *thisopt, *optptr = optarg;
|
||||||
case 'b':
|
while (thisopt = strtok (optptr, ","))
|
||||||
optPCmenu = TRUE;
|
{
|
||||||
|
optptr= NULL;
|
||||||
|
if (!strcmp (thisopt, "m") || !strcmp (thisopt, "menu"))
|
||||||
|
optPCmenu = TRUE;
|
||||||
|
else if (!strcmp (thisopt, "s") || !strcmp (thisopt, "scan"))
|
||||||
|
optPCscan = TRUE;
|
||||||
|
else if (!strcmp (thisopt, "f") || !strcmp (thisopt, "font"))
|
||||||
|
optPCfonts = TRUE;
|
||||||
|
else
|
||||||
|
printf ("\nUnknown PC option: %s\n", thisopt);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
printf ("\nOption %s not found!\n", long_options[option_index].name);
|
||||||
@@ -211,9 +221,12 @@ main (int argc, char *argv[])
|
|||||||
printf(" -e, --3domusic (default)\n");
|
printf(" -e, --3domusic (default)\n");
|
||||||
printf(" -m, --pcmusic\n");
|
printf(" -m, --pcmusic\n");
|
||||||
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
|
printf(" -q, --audioquality=QUALITY (high, medium or low, default medium)\n");
|
||||||
printf(" -u, --nosubtitles\n");
|
printf(" -u, --nosubtitles\n");
|
||||||
printf(" -a --pcscan\n");
|
printf(" -a --pcopt=font,menu,scan\n");
|
||||||
printf(" -b --pcmenu\n");
|
printf(" options are comma seperated (no spaces)\n");
|
||||||
|
printf(" font (or 'f') : use PC fonts\n");
|
||||||
|
printf(" menu (or 'm') : use text menus\n");
|
||||||
|
printf(" scan (or 's') : use text for coarse-scan (not hierogliphics)\n");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user