New palette code
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@44 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -481,6 +481,8 @@ XFormPLUT (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
{
|
{
|
||||||
DWORD TimeOut;
|
DWORD TimeOut;
|
||||||
|
|
||||||
|
TimeInterval = 0; // added by Mika
|
||||||
|
|
||||||
FlushPLUTXForms ();
|
FlushPLUTXForms ();
|
||||||
|
|
||||||
TaskControl.CMapPtr = ColorMapPtr;
|
TaskControl.CMapPtr = ColorMapPtr;
|
||||||
@@ -497,7 +499,7 @@ XFormPLUT (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
) == 0
|
) == 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SetColorMap (ColorMapPtr);
|
SetColorMap (ColorMapPtr, TFB_COLORMAP_COMM);
|
||||||
ColorChange = TRUE;
|
ColorChange = TRUE;
|
||||||
TimeOut = GetTimeCounter ();
|
TimeOut = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
@@ -1154,7 +1156,7 @@ AlienTalkSegue (COUNT wait_track)
|
|||||||
|
|
||||||
if (!pCurInputState->Initialized)
|
if (!pCurInputState->Initialized)
|
||||||
{
|
{
|
||||||
SetColorMap (GetColorMapAddress (CommData.AlienColorMap));
|
SetColorMap (GetColorMapAddress (CommData.AlienColorMap), TFB_COLORMAP_COMM);
|
||||||
DrawAlienFrame (CommData.AlienFrame, NULL_PTR);
|
DrawAlienFrame (CommData.AlienFrame, NULL_PTR);
|
||||||
UpdateSpeechGraphics (TRUE);
|
UpdateSpeechGraphics (TRUE);
|
||||||
|
|
||||||
@@ -1537,6 +1539,7 @@ BatchGraphics ();
|
|||||||
|
|
||||||
DestroyStringTable (ReleaseStringTable (CommData.ConversationPhrases));
|
DestroyStringTable (ReleaseStringTable (CommData.ConversationPhrases));
|
||||||
DestroyMusic ((MUSIC_REF)CommData.AlienSong);
|
DestroyMusic ((MUSIC_REF)CommData.AlienSong);
|
||||||
|
TFB_ReleaseColorMap ();
|
||||||
DestroyColorMap (ReleaseColorMap (CommData.AlienColorMap));
|
DestroyColorMap (ReleaseColorMap (CommData.AlienColorMap));
|
||||||
DestroyFont (ReleaseFont (CommData.AlienFont));
|
DestroyFont (ReleaseFont (CommData.AlienFont));
|
||||||
DestroyDrawable (ReleaseDrawable (CommData.AlienFrame));
|
DestroyDrawable (ReleaseDrawable (CommData.AlienFrame));
|
||||||
|
|||||||
@@ -561,6 +561,7 @@ GiveRadios (RESPONSE_REF R)
|
|||||||
XFormPLUT (GetColorMapAddress (
|
XFormPLUT (GetColorMapAddress (
|
||||||
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
|
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
|
||||||
), 0);
|
), 0);
|
||||||
|
TFB_ReleaseColorMap ();
|
||||||
ClearSemaphore (&GraphicsSem);
|
ClearSemaphore (&GraphicsSem);
|
||||||
AlienTalkSegue ((COUNT)~0);
|
AlienTalkSegue ((COUNT)~0);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
|
||||||
//Added by Chris
|
//Added by Chris
|
||||||
|
|
||||||
@@ -335,12 +336,12 @@ LoadHyperspace (void)
|
|||||||
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
|
if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
|
||||||
{
|
{
|
||||||
SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x7, 0x00, 0x00), 0x2F));
|
SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x7, 0x00, 0x00), 0x2F));
|
||||||
SetColorMap (GetColorMapAddress (hypercmaps[0]));
|
SetColorMap (GetColorMapAddress (hypercmaps[0]), TFB_COLORMAP_HYPERSPACE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x1A, 0x00), 0x2F));
|
SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x1A, 0x00), 0x2F));
|
||||||
SetColorMap (GetColorMapAddress (hypercmaps[1]));
|
SetColorMap (GetColorMapAddress (hypercmaps[1]), TFB_COLORMAP_QUASISPACE);
|
||||||
SET_GAME_STATE (USED_BROADCASTER, 0);
|
SET_GAME_STATE (USED_BROADCASTER, 0);
|
||||||
SET_GAME_STATE (BROADCASTER_RESPONSE, 0);
|
SET_GAME_STATE (BROADCASTER_RESPONSE, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ extern BOOLEAN DestroyOverlayWindow (FRAME Display, DRAWABLE Drawable);
|
|||||||
extern void ScrollDisplay (FRAME Display, COORD x, COORD y);
|
extern void ScrollDisplay (FRAME Display, COORD x, COORD y);
|
||||||
|
|
||||||
extern BOOLEAN ReadColorMap (COLORMAPPTR ColorMapPtr);
|
extern BOOLEAN ReadColorMap (COLORMAPPTR ColorMapPtr);
|
||||||
extern BOOLEAN SetColorMap (COLORMAPPTR ColorMapPtr);
|
extern BOOLEAN SetColorMap (COLORMAPPTR ColorMapPtr, int type);
|
||||||
extern BOOLEAN BatchColorMap (COLORMAPPTR ColorMapPtr);
|
extern BOOLEAN BatchColorMap (COLORMAPPTR ColorMapPtr);
|
||||||
extern CYCLE_REF CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles,
|
extern CYCLE_REF CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles,
|
||||||
SIZE TimeInterval);
|
SIZE TimeInterval);
|
||||||
|
|||||||
@@ -16,40 +16,124 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "gfx_common.h"
|
#include "gfx_common.h"
|
||||||
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
COLORMAPPTR CMapPtr;
|
COLORMAPPTR CMapPtr;
|
||||||
SIZE Ticks;
|
SIZE Ticks;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
COUNT NumCycles;
|
COUNT NumCycles;
|
||||||
TASK XFormTask;
|
TASK XFormTask;
|
||||||
} tc;
|
} tc;
|
||||||
} TaskControl;
|
} TaskControl;
|
||||||
|
|
||||||
|
UBYTE _batch_flags;
|
||||||
DWORD* _varPLUTs;
|
DWORD* _varPLUTs;
|
||||||
static unsigned int varPLUTsize = VARPLUTS_SIZE;
|
static unsigned int varPLUTsize = VARPLUTS_SIZE;
|
||||||
UBYTE _batch_flags;
|
|
||||||
|
static BOOLEAN has_colormap = FALSE;
|
||||||
|
static TFB_Palette cmap_rgb[256];
|
||||||
|
static int cmap_type = 0;
|
||||||
|
|
||||||
|
|
||||||
UBYTE *current_colormap;
|
BOOLEAN TFB_HasColorMap ()
|
||||||
int current_colormap_size;
|
{
|
||||||
|
return has_colormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TFB_GetColorMapType ()
|
||||||
|
{
|
||||||
|
return cmap_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TFB_ReleaseColorMap ()
|
||||||
|
{
|
||||||
|
//printf("TFB_ReleaseColorMap()\n");
|
||||||
|
has_colormap = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TFB_ColorMapToRGB (UBYTE *colors)
|
||||||
|
{
|
||||||
|
DWORD i, k, cval;
|
||||||
|
UBYTE j, r, g, b;
|
||||||
|
|
||||||
|
for (i = 0; i < 32;)
|
||||||
|
{
|
||||||
|
cval = MAKE_DWORD (MAKE_WORD (colors[3], colors[2]), MAKE_WORD (colors[1], colors[0]));
|
||||||
|
colors += 4;
|
||||||
|
|
||||||
|
r = (UBYTE)((cval >> 26) & 0x1f);
|
||||||
|
g = (UBYTE)((cval >> 21) & 0x1f);
|
||||||
|
b = (UBYTE)((cval >> 16) & 0x1f);
|
||||||
|
|
||||||
|
for (j = 0; j < 8; ++j)
|
||||||
|
{
|
||||||
|
k = ((j << 5) + i);
|
||||||
|
|
||||||
|
cmap_rgb[k].r = r * (j + 1);
|
||||||
|
cmap_rgb[k].g = g * (j + 1);
|
||||||
|
cmap_rgb[k].b = b * (j + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
|
||||||
|
r = (UBYTE)((cval >> 10) & 0x1f);
|
||||||
|
g = (UBYTE)((cval >> 5) & 0x1f);
|
||||||
|
b = (UBYTE)(cval & 0x1f);
|
||||||
|
|
||||||
|
for (j = 0; j < 8; ++j)
|
||||||
|
{
|
||||||
|
k = ((j << 5) + i);
|
||||||
|
cmap_rgb[k].r = r * (j + 1);
|
||||||
|
cmap_rgb[k].g = g * (j + 1);
|
||||||
|
cmap_rgb[k].b = b * (j + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN TFB_CopyRGBColorMap (TFB_Palette *dst)
|
||||||
|
{
|
||||||
|
if (cmap_type == TFB_COLORMAP_HYPERSPACE ||
|
||||||
|
cmap_type == TFB_COLORMAP_QUASISPACE)
|
||||||
|
{
|
||||||
|
// TODO: some special colormaps still not implemented
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (cmap_type == TFB_COLORMAP_PLANET)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
dst[251-i].r = cmap_rgb[255-i].r;
|
||||||
|
dst[251-i].g = cmap_rgb[255-i].g;
|
||||||
|
dst[251-i].b = cmap_rgb[255-i].b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(dst, cmap_rgb, sizeof(TFB_Palette) * 256);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Status: Implemented
|
// Status: Implemented
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
BatchColorMap (COLORMAPPTR ColorMapPtr)
|
BatchColorMap (COLORMAPPTR ColorMapPtr)
|
||||||
{
|
{
|
||||||
return (SetColorMap (ColorMapPtr));
|
return (SetColorMap (ColorMapPtr, TFB_COLORMAP_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status: Partially implemented
|
// Status: Implemented
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
SetColorMap (COLORMAPPTR map)
|
SetColorMap (COLORMAPPTR map, int type)
|
||||||
{
|
{
|
||||||
int start, end, bytes;
|
int start, end, bytes;
|
||||||
UBYTE *colors = (UBYTE*)map;
|
UBYTE *colors = (UBYTE*)map;
|
||||||
@@ -75,19 +159,19 @@ SetColorMap (COLORMAPPTR map)
|
|||||||
vp = (UBYTE*)_varPLUTs + (start * PLUT_BYTE_SIZE);
|
vp = (UBYTE*)_varPLUTs + (start * PLUT_BYTE_SIZE);
|
||||||
|
|
||||||
memcpy (vp, colors, bytes);
|
memcpy (vp, colors, bytes);
|
||||||
|
cmap_type = type;
|
||||||
|
TFB_ColorMapToRGB (vp);
|
||||||
|
has_colormap = TRUE;
|
||||||
|
|
||||||
current_colormap = vp;
|
//printf("SetColorMap(): vp %x map %x bytes %d, start %d end %d\n",vp, map, bytes, start, end);
|
||||||
current_colormap_size = bytes;
|
|
||||||
|
|
||||||
//printf("SetColorMap(): vp %x map %x bytes %d\n",vp, map, bytes);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_threedo_set_colors (UBYTE *colors, unsigned int indices)
|
_threedo_set_colors (UBYTE *colors, unsigned int indices)
|
||||||
{
|
{
|
||||||
int i, start, end;
|
int i, start, end;
|
||||||
//unsigned int *ce;
|
//unsigned int *ce;
|
||||||
|
|
||||||
start = (int)LOBYTE (indices);
|
start = (int)LOBYTE (indices);
|
||||||
end = (int)HIBYTE (indices);
|
end = (int)HIBYTE (indices);
|
||||||
@@ -95,16 +179,16 @@ _threedo_set_colors (UBYTE *colors, unsigned int indices)
|
|||||||
//ce = colorEntries;
|
//ce = colorEntries;
|
||||||
for (i = start; i <= end; i++)
|
for (i = start; i <= end; i++)
|
||||||
{
|
{
|
||||||
UBYTE r, g, b;
|
UBYTE r, g, b;
|
||||||
|
|
||||||
r = (*colors << 2) | (*colors >> 4);
|
r = (*colors << 2) | (*colors >> 4);
|
||||||
++colors;
|
++colors;
|
||||||
g = (*colors << 2) | (*colors >> 4);
|
g = (*colors << 2) | (*colors >> 4);
|
||||||
++colors;
|
++colors;
|
||||||
b = (*colors << 2) | (*colors >> 4);
|
b = (*colors << 2) | (*colors >> 4);
|
||||||
++colors;
|
++colors;
|
||||||
|
|
||||||
//*ce++ = MakeCLUTColorEntry (i, r, g, b);
|
//*ce++ = MakeCLUTColorEntry (i, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ceCt = end - start + 1;
|
//ceCt = end - start + 1;
|
||||||
@@ -253,7 +337,6 @@ XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
|
|
||||||
//printf ("Partially implemented function activated: XFormColorMap()\n");
|
//printf ("Partially implemented function activated: XFormColorMap()\n");
|
||||||
|
|
||||||
|
|
||||||
FlushColorXForms ();
|
FlushColorXForms ();
|
||||||
|
|
||||||
if (ColorMapPtr == (COLORMAPPTR)0)
|
if (ColorMapPtr == (COLORMAPPTR)0)
|
||||||
@@ -278,7 +361,7 @@ XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if (what == FadeAllToBlack || what == FadeAllToWhite || what == FadeAllToColor)
|
//if (what == FadeAllToBlack || what == FadeAllToWhite || what == FadeAllToColor)
|
||||||
//_threedo_enable_fade ();
|
//_threedo_enable_fade ();
|
||||||
|
|
||||||
if ((TaskControl.Ticks = TimeInterval) <= 0
|
if ((TaskControl.Ticks = TimeInterval) <= 0
|
||||||
|| (TaskControl.tc.XFormTask = AddTask (xform_clut_task, 1024)) == 0)
|
|| (TaskControl.tc.XFormTask = AddTask (xform_clut_task, 1024)) == 0)
|
||||||
@@ -289,7 +372,7 @@ XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
while (TaskControl.tc.XFormTask);
|
while (TaskControl.tc.XFormTask);
|
||||||
|
|
||||||
TimeOut = GetTimeCounter () + TimeInterval + 1;
|
TimeOut = GetTimeCounter () + TimeInterval + 1;
|
||||||
@@ -302,11 +385,11 @@ XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
|
|||||||
void
|
void
|
||||||
FlushColorXForms()
|
FlushColorXForms()
|
||||||
{
|
{
|
||||||
if (XForming)
|
//printf ("Partially implemented function activated: FlushColorXForms()\n");
|
||||||
|
|
||||||
|
if (XForming)
|
||||||
{
|
{
|
||||||
XForming = FALSE;
|
XForming = FALSE;
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf ("Partially implemented function activated: FlushColorXForms()\n");
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,19 +35,21 @@
|
|||||||
#define CYCLE_PENDING (1 << 5)
|
#define CYCLE_PENDING (1 << 5)
|
||||||
#define ENABLE_CYCLE (1 << 6)
|
#define ENABLE_CYCLE (1 << 6)
|
||||||
|
|
||||||
/*enum
|
enum
|
||||||
{
|
{
|
||||||
FadeAllToWhite = 250,
|
TFB_COLORMAP_NONE,
|
||||||
FadeSomeToWhite,
|
TFB_COLORMAP_HYPERSPACE,
|
||||||
FadeAllToBlack,
|
TFB_COLORMAP_QUASISPACE,
|
||||||
FadeAllToColor,
|
TFB_COLORMAP_PLANET,
|
||||||
FadeSomeToBlack,
|
TFB_COLORMAP_COMM
|
||||||
FadeSomeToColor
|
};
|
||||||
};*/
|
|
||||||
|
|
||||||
|
extern DWORD* _varPLUTs;
|
||||||
extern UBYTE _batch_flags;
|
extern UBYTE _batch_flags;
|
||||||
|
|
||||||
extern UBYTE *current_colormap;
|
BOOLEAN TFB_HasColorMap ();
|
||||||
extern int current_colormap_size;
|
int TFB_GetColorMapType ();
|
||||||
|
void TFB_ReleaseColorMap ();
|
||||||
|
BOOLEAN TFB_CopyRGBColorMap (TFB_Palette *dst);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "libs/gfxlib.h"
|
#include "libs/gfxlib.h"
|
||||||
#include "libs/vidlib.h"
|
#include "libs/vidlib.h"
|
||||||
#include "libs/misc.h"
|
#include "libs/misc.h"
|
||||||
#include "cmap.h"
|
|
||||||
|
|
||||||
#define TFB_WINDOW_CAPTION "The Ur-Quan Masters"
|
#define TFB_WINDOW_CAPTION "The Ur-Quan Masters"
|
||||||
|
|
||||||
@@ -240,4 +239,6 @@ extern int GraphicsDriver;
|
|||||||
|
|
||||||
int Starcon2Main (void *);
|
int Starcon2Main (void *);
|
||||||
|
|
||||||
|
#include "cmap.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawCommand->image = (TFB_ImageStruct*) img; //TFB_Image
|
DrawCommand->image = (TFB_ImageStruct*) img;
|
||||||
DrawCommand->UsePalette = FALSE;
|
DrawCommand->UsePalette = FALSE;
|
||||||
|
|
||||||
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
||||||
@@ -144,35 +144,21 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// NOTE: following code for colormaps is experimental
|
if (TFB_HasColorMap() && img->NormalImg->format->BytesPerPixel == 1)
|
||||||
if (img->NormalImg->format->BytesPerPixel == 1)
|
|
||||||
{
|
{
|
||||||
if (current_colormap && current_colormap_size <= 512)
|
// TODO: this currently uses a hack to avoid corrupting sun colors..
|
||||||
|
// why sun won't work properly with colormaps, should be traced later
|
||||||
|
|
||||||
|
int type = TFB_GetColorMapType();
|
||||||
|
|
||||||
|
if (type != TFB_COLORMAP_PLANET ||
|
||||||
|
(type == TFB_COLORMAP_PLANET && (img->Palette[255].r != 248 ||
|
||||||
|
img->Palette[255].g != 248 || img->Palette[255].b != 248)))
|
||||||
{
|
{
|
||||||
int i, n;
|
if (TFB_CopyRGBColorMap(DrawCommand->Palette))
|
||||||
SDL_Color *imgpal;
|
|
||||||
SDL_Color cmap_rgb[256];
|
|
||||||
|
|
||||||
n = TFB_ColorMapToRGB (cmap_rgb);
|
|
||||||
|
|
||||||
//printf("draw cmap %x, size %d, n %d, imgw %d imgh %d\n",current_colormap, current_colormap_size, n, img->NormalImg->w, img->NormalImg->h);
|
|
||||||
|
|
||||||
imgpal = img->NormalImg->format->palette->colors;
|
|
||||||
for (i = 0; i < 256; ++i)
|
|
||||||
{
|
{
|
||||||
DrawCommand->Palette[i].r = imgpal[i].r;
|
DrawCommand->UsePalette = TRUE;
|
||||||
DrawCommand->Palette[i].g = imgpal[i].g;
|
|
||||||
DrawCommand->Palette[i].b = imgpal[i].b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; ++i)
|
|
||||||
{
|
|
||||||
DrawCommand->Palette[252 - i].r = cmap_rgb[n - i - 1].r;
|
|
||||||
DrawCommand->Palette[252 - i].g = cmap_rgb[n - i - 1].g;
|
|
||||||
DrawCommand->Palette[252 - i].b = cmap_rgb[n - i - 1].b;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawCommand->UsePalette = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,8 +195,6 @@ blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
SDL_mutexV (dst_img->mutex);
|
SDL_mutexV (dst_img->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_colormap = 0;
|
|
||||||
|
|
||||||
SDL_mutexV (img->mutex);
|
SDL_mutexV (img->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,8 +204,6 @@ fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
DWORD c32k;
|
DWORD c32k;
|
||||||
|
|
||||||
current_colormap = 0;
|
|
||||||
|
|
||||||
c32k = GetPrimColor (PrimPtr) >> 8; //shift out color index
|
c32k = GetPrimColor (PrimPtr) >> 8; //shift out color index
|
||||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||||
@@ -295,8 +277,6 @@ line_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
int r, g, b;
|
int r, g, b;
|
||||||
DWORD c32k;
|
DWORD c32k;
|
||||||
|
|
||||||
current_colormap = 0;
|
|
||||||
|
|
||||||
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||||
@@ -332,8 +312,6 @@ line_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
|||||||
static void
|
static void
|
||||||
read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
|
read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
|
||||||
{
|
{
|
||||||
current_colormap = 0;
|
|
||||||
|
|
||||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) != SCREEN_DRAWABLE
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) != SCREEN_DRAWABLE
|
||||||
|| TYPE_GET (DstFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE
|
|| TYPE_GET (DstFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE
|
||||||
|| !(TYPE_GET (GetFrameParentDrawable (DstFramePtr)
|
|| !(TYPE_GET (GetFrameParentDrawable (DstFramePtr)
|
||||||
|
|||||||
@@ -243,34 +243,6 @@ TFB_FreeImage (TFB_Image *img)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TFB_ColorMapToRGB (SDL_Color *cmap_rgb)
|
|
||||||
{
|
|
||||||
int i, n;
|
|
||||||
UBYTE *colors;
|
|
||||||
DWORD c;
|
|
||||||
|
|
||||||
colors = current_colormap;
|
|
||||||
n = current_colormap_size / 2;
|
|
||||||
if (n > 256)
|
|
||||||
n = 256;
|
|
||||||
|
|
||||||
for (i = 0; i < n;)
|
|
||||||
{
|
|
||||||
c = MAKE_DWORD (MAKE_WORD (colors[3], colors[2]), MAKE_WORD (colors[1], colors[0]));
|
|
||||||
colors += 4;
|
|
||||||
|
|
||||||
cmap_rgb[i].r = (Uint8)(((c >> 26) & 0x1f) << 3);
|
|
||||||
cmap_rgb[i].g = (Uint8)(((c >> 21) & 0x1f) << 3);
|
|
||||||
cmap_rgb[i++].b = (Uint8)(((c >> 16) & 0x1f) << 3);
|
|
||||||
|
|
||||||
cmap_rgb[i].r = (Uint8)(((c >> 10) & 0x1f) << 3);
|
|
||||||
cmap_rgb[i].g = (Uint8)(((c >> 5 ) & 0x1f) << 3);
|
|
||||||
cmap_rgb[i++].b = (Uint8)(((c >> 0 ) & 0x1f) << 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_SwapBuffers ()
|
TFB_SwapBuffers ()
|
||||||
{
|
{
|
||||||
@@ -347,7 +319,6 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
if (ShowFPS)
|
if (ShowFPS)
|
||||||
TFB_ComputeFPS ();
|
TFB_ComputeFPS ();
|
||||||
|
|
||||||
|
|
||||||
while (DrawCommandQueue->Size > 0)
|
while (DrawCommandQueue->Size > 0)
|
||||||
{
|
{
|
||||||
TFB_DrawCommand DC_real;
|
TFB_DrawCommand DC_real;
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ typedef struct tfb_image
|
|||||||
TFB_Image *TFB_LoadImage (SDL_Surface *img);
|
TFB_Image *TFB_LoadImage (SDL_Surface *img);
|
||||||
void TFB_FreeImage (TFB_Image *img);
|
void TFB_FreeImage (TFB_Image *img);
|
||||||
|
|
||||||
int TFB_ColorMapToRGB (SDL_Color *cmap_rgb);
|
|
||||||
void TFB_SwapBuffers ();
|
void TFB_SwapBuffers ();
|
||||||
SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface);
|
SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ typedef signed int sint32;
|
|||||||
#define NUMBER_OF_PLUT_UINT32s (NUMBER_OF_PLUTVALS >> 1)
|
#define NUMBER_OF_PLUT_UINT32s (NUMBER_OF_PLUTVALS >> 1)
|
||||||
#define GET_VAR_PLUT(i) (_varPLUTs + (i) * NUMBER_OF_PLUT_UINT32s)
|
#define GET_VAR_PLUT(i) (_varPLUTs + (i) * NUMBER_OF_PLUT_UINT32s)
|
||||||
|
|
||||||
extern uint32 *_varPLUTs;
|
//extern uint32 *_varPLUTs;
|
||||||
|
|
||||||
#define NUM_THINGS 256
|
#define NUM_THINGS 256
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ FreePlanet (void)
|
|||||||
pSolarSysState->hTopoData = 0;
|
pSolarSysState->hTopoData = 0;
|
||||||
DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoFrame));
|
DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoFrame));
|
||||||
pSolarSysState->TopoFrame = 0;
|
pSolarSysState->TopoFrame = 0;
|
||||||
|
TFB_ReleaseColorMap ();
|
||||||
DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap));
|
DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap));
|
||||||
pSolarSysState->OrbitalCMap = 0;
|
pSolarSysState->OrbitalCMap = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ FreeIPData (void)
|
|||||||
SISIPFrame = 0;
|
SISIPFrame = 0;
|
||||||
DestroyDrawable (ReleaseDrawable (SunFrame));
|
DestroyDrawable (ReleaseDrawable (SunFrame));
|
||||||
SunFrame = 0;
|
SunFrame = 0;
|
||||||
|
TFB_ReleaseColorMap ();
|
||||||
DestroyColorMap (ReleaseColorMap (OrbitalCMap));
|
DestroyColorMap (ReleaseColorMap (OrbitalCMap));
|
||||||
OrbitalCMap = 0;
|
OrbitalCMap = 0;
|
||||||
DestroyDrawable (ReleaseDrawable (OrbitalFrame));
|
DestroyDrawable (ReleaseDrawable (OrbitalFrame));
|
||||||
@@ -575,7 +576,7 @@ if (!(draw_sys_flags & DRAW_PLANETS))
|
|||||||
SetColorMap (GetColorMapAddress (
|
SetColorMap (GetColorMapAddress (
|
||||||
SetAbsColorMapIndex (OrbitalCMap,
|
SetAbsColorMapIndex (OrbitalCMap,
|
||||||
PLANCOLOR (Type))
|
PLANCOLOR (Type))
|
||||||
));
|
), TFB_COLORMAP_PLANET);
|
||||||
|
|
||||||
Size = PLANSIZE (Type);
|
Size = PLANSIZE (Type);
|
||||||
if (denom == 2 || xnumer > (COUNT)DISPLAY_FACTOR)
|
if (denom == 2 || xnumer > (COUNT)DISPLAY_FACTOR)
|
||||||
@@ -625,10 +626,13 @@ if (!(draw_sys_flags & DRAW_PLANETS))
|
|||||||
if (index < NUMBER_OF_PLANET_TYPES
|
if (index < NUMBER_OF_PLANET_TYPES
|
||||||
&& (pPlanetDesc->data_index & PLANET_SHIELDED))
|
&& (pPlanetDesc->data_index & PLANET_SHIELDED))
|
||||||
{
|
{
|
||||||
|
TFB_ReleaseColorMap();
|
||||||
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 17);
|
s.frame = SetAbsFrameIndex (SpaceJunkFrame, 17);
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TFB_ReleaseColorMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1678,8 +1682,11 @@ DrawSystem (SIZE radius, BOOLEAN IsInnerSystem)
|
|||||||
SetColorMap (GetColorMapAddress (
|
SetColorMap (GetColorMapAddress (
|
||||||
SetAbsColorMapIndex (OrbitalCMap,
|
SetAbsColorMapIndex (OrbitalCMap,
|
||||||
PLANCOLOR (PlanData[pCurDesc->data_index].Type))
|
PLANCOLOR (PlanData[pCurDesc->data_index].Type))
|
||||||
));
|
), TFB_COLORMAP_PLANET);
|
||||||
DrawStamp (&pCurDesc->image);
|
DrawStamp (&pCurDesc->image);
|
||||||
|
|
||||||
|
TFB_ReleaseColorMap();
|
||||||
|
|
||||||
if (index == pSolarSysState->LastPlanetIndex)
|
if (index == pSolarSysState->LastPlanetIndex)
|
||||||
break;
|
break;
|
||||||
index = pCurDesc->NextIndex;
|
index = pCurDesc->NextIndex;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "coderes.h"
|
#include "coderes.h"
|
||||||
|
#include "libs/graphics/gfx_common.h"
|
||||||
|
|
||||||
//Added by Chris
|
//Added by Chris
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ LoadKernel (int argc, char *argv[])
|
|||||||
COLORMAP ColorMapTab;
|
COLORMAP ColorMapTab;
|
||||||
|
|
||||||
ColorMapTab = CaptureColorMap (LoadColorMap (STARCON_COLOR_MAP));
|
ColorMapTab = CaptureColorMap (LoadColorMap (STARCON_COLOR_MAP));
|
||||||
SetColorMap (GetColorMapAddress (ColorMapTab));
|
SetColorMap (GetColorMapAddress (ColorMapTab), TFB_COLORMAP_NONE);
|
||||||
DestroyColorMap (ReleaseColorMap (ColorMapTab));
|
DestroyColorMap (ReleaseColorMap (ColorMapTab));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user