Fixes #205 (Alternate colours for Speedo/Tacho Needles) : Applied Simon's patches 1 and 2 + changed Spirit RB1 LT needles to black, as a demo (Eckhard, feel free to do better ;-)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2907 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d381169fce9f865ebe07c52169baa03a235807cf
Former-commit-id: 5bf347bce771b27c1a083bda5fc008f961743004
This commit is contained in:
pouillot 2010-10-17 12:06:10 +00:00
parent 86509c3d77
commit c82ea3c0fd
3 changed files with 22 additions and 4 deletions

View file

@ -648,6 +648,11 @@ typedef struct CarElt
#define PRM_SPEEDO_MAXANG "speedometer max angle"
#define PRM_SPEEDO_DIGITAL "speedometer digital"
#define PRM_NEEDLE_RED "needle red"
#define PRM_NEEDLE_GREEN "needle green"
#define PRM_NEEDLE_BLUE "needle blue"
#define PRM_NEEDLE_ALPHA "needle alpha"
#define PRM_WHEEL_3D "3d wheel"
#define PRM_FRONT_WHEEL_3D "3d front wheel"
#define PRM_REAR_WHEEL_3D "3d rear wheel"

View file

@ -867,7 +867,7 @@ cGrBoard::grDispCounterBoard2(tCarElt *car)
snprintf(buf, sizeof(buf), "%s", car->_gear == 0 ? "N" : "R");
else
snprintf(buf, sizeof(buf), "%d", car->_gear);
GfuiPrintString(buf, grRed, GFUI_FONT_LARGE_C,
GfuiPrintString(buf, curInst->needleColor, GFUI_FONT_LARGE_C,
(int)curInst->digitXCenter, (int)curInst->digitYCenter, GFUI_ALIGN_HC_VB);
glTranslatef(-centerAnchor, -BOTTOM_ANCHOR, 0);
@ -904,7 +904,7 @@ cGrBoard::grDispCounterBoard2(tCarElt *car)
if (curInst->digital) {
// Do not add "%3d" or something, because the digital font DOES NOT SUPPORT BLANKS!!!!
snprintf(buf, sizeof(buf), "%d", abs((int)(car->_speed_x * 3.6)));
GfuiPrintString(buf, grRed, GFUI_FONT_LARGE_C,
GfuiPrintString(buf, curInst->needleColor, GFUI_FONT_LARGE_C,
(int)curInst->digitXCenter, (int)curInst->digitYCenter, GFUI_ALIGN_HC_VB);
}
@ -1280,6 +1280,12 @@ void grInitBoardCar(tCarElt *car)
curInst->maxAngle = GfParmGetNum(handle, SECT_GROBJECTS, PRM_TACHO_MAXANG, "deg", -45) - curInst->minAngle;
curInst->monitored = &(car->_enginerpm);
curInst->prevVal = curInst->minAngle;
/* Get colour to use for needle, default is Red */
curInst->needleColor[0] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_RED, (char*)NULL, 1.0);
curInst->needleColor[1] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_GREEN, (char*)NULL, 0.0);
curInst->needleColor[2] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_BLUE, (char*)NULL, 0.0);
curInst->needleColor[3] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_ALPHA, (char*)NULL, 1.0);
curInst->CounterList = glGenLists(1);
glNewList(curInst->CounterList, GL_COMPILE);
@ -1298,7 +1304,7 @@ void grInitBoardCar(tCarElt *car)
glNewList(curInst->needleList, GL_COMPILE);
glBegin(GL_TRIANGLE_STRIP);
{
glColor4f(1.0, 0.0, 0.0, 1.0);
glColor4f(curInst->needleColor[0], curInst->needleColor[1], curInst->needleColor[2], curInst->needleColor[3]);
glVertex2f(0, -needleySz);
glVertex2f(0, needleySz);
glVertex2f(needlexSz, -needleySz / 2.0);
@ -1347,6 +1353,12 @@ void grInitBoardCar(tCarElt *car)
curInst->digital = 1;
}
/* Get colour to use for needle, default is Red */
curInst->needleColor[0] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_RED, (char*)NULL, 1.0);
curInst->needleColor[1] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_GREEN, (char*)NULL, 0.0);
curInst->needleColor[2] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_BLUE, (char*)NULL, 0.0);
curInst->needleColor[3] = GfParmGetNum(handle, SECT_GROBJECTS, PRM_NEEDLE_ALPHA, (char*)NULL, 1.0);
curInst->CounterList = glGenLists(1);
glNewList(curInst->CounterList, GL_COMPILE);
glBegin(GL_TRIANGLE_STRIP);
@ -1364,7 +1376,7 @@ void grInitBoardCar(tCarElt *car)
glNewList(curInst->needleList, GL_COMPILE);
glBegin(GL_TRIANGLE_STRIP);
{
glColor4f(1.0, 0.0, 0.0, 1.0);
glColor4f(curInst->needleColor[0], curInst->needleColor[1], curInst->needleColor[2], curInst->needleColor[3]);
glVertex2f(0, -needleySz);
glVertex2f(0, needleySz);
glVertex2f(needlexSz, -needleySz / 2.0);

View file

@ -44,6 +44,7 @@ public:
tdble prevVal;
tdble rawPrev;
int digital;
float needleColor[4];
};