Hack in the team colour when shaders aren't supported.

Ugly, but better than nothing.
master
Cyp 2011-02-20 20:24:00 +01:00
parent e6298083f0
commit e0617af5e6
6 changed files with 28 additions and 17 deletions

View File

@ -55,7 +55,7 @@ typedef struct {SDWORD texPage; SWORD tu, tv, tw, th;} PIEIMAGE; /**< An area of
* Global ProtoTypes * Global ProtoTypes
*/ */
/***************************************************************************/ /***************************************************************************/
extern void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData); extern void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount = 0);
extern void pie_DrawImage(const PIEIMAGE *image, const PIERECT *dest); extern void pie_DrawImage(const PIEIMAGE *image, const PIERECT *dest);
extern void pie_GetResetCounts(unsigned int* pPieCount, unsigned int* pTileCount, unsigned int* pPolyCount, unsigned int* pStateCount); extern void pie_GetResetCounts(unsigned int* pPieCount, unsigned int* pTileCount, unsigned int* pPolyCount, unsigned int* pStateCount);

View File

@ -129,13 +129,19 @@ static transluscent_shape_t* tshapes = NULL;
static unsigned int tshapes_size = 0; static unsigned int tshapes_size = 0;
static unsigned int nb_tshapes = 0; static unsigned int nb_tshapes = 0;
static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT teamcolour, int pieFlag, int pieFlagData) static void pie_Draw3DShape2(iIMDShape *shape, int frame, PIELIGHT colour, PIELIGHT teamcolour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount = 0)
{ {
if (bShaderlessTeamcolourHack)
{
colour.byte.r = (colour.byte.r*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.r*shaderlessTeamColourHackAmount) / 256; // Ugly, but better than being colourblind.
colour.byte.g = (colour.byte.g*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.g*shaderlessTeamColourHackAmount) / 256;
colour.byte.b = (colour.byte.b*(256 - shaderlessTeamColourHackAmount) + teamcolour.byte.b*shaderlessTeamColourHackAmount) / 256;
}
iIMDPoly *pPolys; iIMDPoly *pPolys;
bool light = true; bool light = true;
pie_SetAlphaTest(true); pie_SetAlphaTest(true);
/* Set fog status */ /* Set fog status */
if (!(pieFlag & pie_FORCE_FOG) && if (!(pieFlag & pie_FORCE_FOG) &&
(pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON)) (pieFlag & pie_ADDITIVE || pieFlag & pie_TRANSLUCENT || pieFlag & pie_BUTTON))
@ -462,7 +468,7 @@ void pie_CleanUp( void )
scshapes = NULL; scshapes = NULL;
} }
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData) void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int pieFlag, int pieFlagData, int shaderlessTeamColourHackAmount)
{ {
PIELIGHT teamcolour; PIELIGHT teamcolour;
@ -479,7 +485,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
if (drawing_interface || !shadows) if (drawing_interface || !shadows)
{ {
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData); pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData, shaderlessTeamColourHackAmount);
} }
else else
{ {
@ -559,7 +565,7 @@ void pie_Draw3DShape(iIMDShape *shape, int frame, int team, PIELIGHT colour, int
} }
} }
pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData); pie_Draw3DShape2(shape, frame, colour, teamcolour, pieFlag, pieFlagData, shaderlessTeamColourHackAmount);
} }
} }
} }

View File

@ -48,6 +48,8 @@ UDWORD screenWidth = 0;
UDWORD screenHeight = 0; UDWORD screenHeight = 0;
UDWORD screenDepth = 0; UDWORD screenDepth = 0;
bool bShaderlessTeamcolourHack = false;
/* global used to indicate preferred internal OpenGL format */ /* global used to indicate preferred internal OpenGL format */
int wz_texture_compression; int wz_texture_compression;
@ -262,6 +264,7 @@ bool screenInitialise(
{ {
debug(LOG_POPUP, "OpenGL 2.0 is not supported by your system, current shaders require this."); debug(LOG_POPUP, "OpenGL 2.0 is not supported by your system, current shaders require this.");
debug(LOG_POPUP, "Team colors will not function correctly on your system."); debug(LOG_POPUP, "Team colors will not function correctly on your system.");
bShaderlessTeamcolourHack = true;
} }
glViewport(0, 0, width, height); glViewport(0, 0, width, height);

View File

@ -35,6 +35,8 @@
#include "lib/framework/types.h" #include "lib/framework/types.h"
extern bool bShaderlessTeamcolourHack;
/* ------------------------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------------------------- */
/* Legacy stuff /* Legacy stuff

View File

@ -212,7 +212,7 @@ void displayStructureButton(STRUCTURE *psStructure, Vector3i *rotation, Vector3i
if(baseImd!=NULL) { if(baseImd!=NULL) {
pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0); pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0);
} }
pie_Draw3DShape(psStructure->sDisplay.imd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0); pie_Draw3DShape(psStructure->sDisplay.imd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0, 64);
//and draw the turret //and draw the turret
if(psStructure->sDisplay.imd->nconnectors) if(psStructure->sDisplay.imd->nconnectors)
{ {
@ -310,7 +310,7 @@ void displayStructureStatButton(STRUCTURE_STATS *Stats, Vector3i *Rotation, Vect
{ {
pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0); pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0);
} }
pie_Draw3DShape(Stats->pIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0); pie_Draw3DShape(Stats->pIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, pie_BUTTON, 0, 64);
//and draw the turret //and draw the turret
if(Stats->pIMD->nconnectors) if(Stats->pIMD->nconnectors)
@ -565,7 +565,7 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
psShapeTemp = (leftFirst ? getLeftPropulsionIMD(psDroid) : getRightPropulsionIMD(psDroid)); psShapeTemp = (leftFirst ? getLeftPropulsionIMD(psDroid) : getRightPropulsionIMD(psDroid));
if(psShapeTemp!=NULL) if(psShapeTemp!=NULL)
{ {
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData); pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData, 256);
} }
/* set default components transparent */ /* set default components transparent */
@ -601,7 +601,7 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
/* draw body if cyborg not animating */ /* draw body if cyborg not animating */
if ( psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false ) if ( psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false )
{ {
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData); pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData, 256);
} }
} }
else else
@ -936,7 +936,7 @@ static void displayCompObj(DROID *psDroid, BOOL bButton)
psShape = (leftFirst ? getRightPropulsionIMD(psDroid) : getLeftPropulsionIMD(psDroid)); psShape = (leftFirst ? getRightPropulsionIMD(psDroid) : getLeftPropulsionIMD(psDroid));
if(psShape!=NULL) if(psShape!=NULL)
{ {
pie_Draw3DShape(psShape, 0, colour, brightness, pieFlag, iPieData); pie_Draw3DShape(psShape, 0, colour, brightness, pieFlag, iPieData, 256);
} }
} }

View File

@ -1374,7 +1374,7 @@ void renderAnimComponent( const COMPONENT_OBJECT *psObj )
pie_MatRotZ(-psObj->orientation.y); pie_MatRotZ(-psObj->orientation.y);
pie_MatRotX(-psObj->orientation.x); pie_MatRotX(-psObj->orientation.x);
pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, pie_STATIC_SHADOW, 0); pie_Draw3DShape(psObj->psShape, 0, iPlayer, brightness, pie_STATIC_SHADOW, 0, 256);
/* clear stack */ /* clear stack */
pie_MatEnd(); pie_MatEnd();
@ -2172,7 +2172,7 @@ void renderStructure(STRUCTURE *psStructure)
pieFlag = pie_TRANSLUCENT | pie_FORCE_FOG; pieFlag = pie_TRANSLUCENT | pie_FORCE_FOG;
pieFlagData = 255; pieFlagData = 255;
} }
pie_Draw3DShape(psStructure->pStructureType->pBaseIMD, 0, colour, buildingBrightness, pieFlag, pieFlagData); pie_Draw3DShape(psStructure->pStructureType->pBaseIMD, 0, colour, buildingBrightness, pieFlag, pieFlagData, 64);
} }
// override // override
@ -2190,7 +2190,7 @@ void renderStructure(STRUCTURE *psStructure)
//first check if partially built - ANOTHER HACK! //first check if partially built - ANOTHER HACK!
if (psStructure->status == SS_BEING_BUILT || psStructure->status == SS_BEING_DEMOLISHED) if (psStructure->status == SS_BEING_BUILT || psStructure->status == SS_BEING_DEMOLISHED)
{ {
pie_Draw3DShape(strImd, 0, colour, buildingBrightness, pie_HEIGHT_SCALED | pie_SHADOW, structHeightScale(psStructure) * pie_RAISE_SCALE); pie_Draw3DShape(strImd, 0, colour, buildingBrightness, pie_HEIGHT_SCALED | pie_SHADOW, structHeightScale(psStructure) * pie_RAISE_SCALE, 64);
} }
else else
{ {
@ -2208,7 +2208,7 @@ void renderStructure(STRUCTURE *psStructure)
{ {
pie_SetShaderStretchDepth(psStructure->pos.z - psStructure->foundationDepth); pie_SetShaderStretchDepth(psStructure->pos.z - psStructure->foundationDepth);
} }
pie_Draw3DShape(strImd, animFrame, colour, buildingBrightness, pieFlag, pieFlagData); pie_Draw3DShape(strImd, animFrame, colour, buildingBrightness, pieFlag, pieFlagData, 64);
pie_SetShaderStretchDepth(0); pie_SetShaderStretchDepth(0);
// It might have weapons on it // It might have weapons on it
@ -2616,7 +2616,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure)
(psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) ) (psStructure->status == SS_BEING_BUILT && psStructure->pStructureType->type == REF_RESOURCE_EXTRACTOR) )
{ {
pie_Draw3DShape(psStructure->sDisplay.imd, 0, getPlayerColour(psStructure->player), pie_Draw3DShape(psStructure->sDisplay.imd, 0, getPlayerColour(psStructure->player),
brightness, pie_HEIGHT_SCALED|pie_SHADOW, structHeightScale(psStructure) * pie_RAISE_SCALE); brightness, pie_HEIGHT_SCALED|pie_SHADOW, structHeightScale(psStructure) * pie_RAISE_SCALE, 64);
} }
else else
{ {
@ -2638,7 +2638,7 @@ static BOOL renderWallSection(STRUCTURE *psStructure)
} }
pieFlagData = 0; pieFlagData = 0;
} }
pie_Draw3DShape(imd, 0, getPlayerColour(psStructure->player), brightness, pieFlag, pieFlagData); pie_Draw3DShape(imd, 0, getPlayerColour(psStructure->player), brightness, pieFlag, pieFlagData, 64);
} }
imd->points = temp; imd->points = temp;