Clean up addConstructionLine and allow construction and demolish beam colours be moddable.

master
per 2013-01-15 22:24:26 +01:00
parent 1566232f99
commit 7d5179573d
3 changed files with 17 additions and 43 deletions

View File

@ -87,3 +87,5 @@ E0,E0,E0,ff // team11 - white
ff,80,40,ff // construction bar text
00,ff,00,ff // power queue bar text
80,c0,00,ff // WZCOL_MAP_PREVIEW_BARREL
00,00,ff,ff // constructor beam
ff,00,00,ff // demolish beam

View File

@ -111,8 +111,10 @@
#define WZCOL_CONSTRUCTION_BARTEXT psPalette[86]
#define WZCOL_POWERQUEUE_BARTEXT psPalette[87]
#define WZCOL_MAP_PREVIEW_BARREL psPalette[88]
#define WZCOL_CONSTRUCTOR_BEAM psPalette[89]
#define WZCOL_DEMOLISH_BEAM psPalette[90]
#define WZCOL_MAX 89
#define WZCOL_MAX 91
//*************************************************************************

View File

@ -4120,68 +4120,38 @@ static void doConstructionLines( void )
/// Draw the construction or demolish lines for one droid
static void addConstructionLine(DROID *psDroid, STRUCTURE *psStructure)
{
Vector3f *point;
Vector3f pts[3];
int pointIndex;
Vector3i each;
Vector3f *point, pts[3];
UDWORD pointIndex;
SDWORD realY;
Vector3i null, vec;
PIELIGHT colour;
null.x = null.y = null.z = 0;
each.x = psDroid->pos.x;
each.z = psDroid->pos.y;
each.y = psDroid->pos.z + 24;
pts[0] = Vector3f(psDroid->pos.x - player.p.x, psDroid->pos.z + 24, -(psDroid->pos.y - player.p.z));
vec.x = each.x - player.p.x;
vec.z = -(each.z - player.p.z);
vec.y = each.y;
pts[0] = vec;
pointIndex = rand()%(psStructure->sDisplay.imd->npoints-1);
pointIndex = rand() % (psStructure->sDisplay.imd->npoints - 1);
point = &(psStructure->sDisplay.imd->points[pointIndex]);
each.x = psStructure->pos.x + point->x;
realY = structHeightScale(psStructure) * point->y;
each.y = psStructure->pos.z + realY;
each.y = psStructure->pos.z + (structHeightScale(psStructure) * point->y);
each.z = psStructure->pos.y - point->z;
if (rand()%250 < deltaGraphicsTime)
if (rand() % 250 < deltaGraphicsTime)
{
effectSetSize(30);
addEffect(&each,EFFECT_EXPLOSION,EXPLOSION_TYPE_SPECIFIED,true,getImdFromIndex(MI_PLASMA),0);
}
vec.x = each.x - player.p.x;
vec.z = -(each.z - player.p.z);
vec.y = each.y;
pts[1] = Vector3f(each.x - player.p.x, each.y, -(each.z - player.p.z));
pts[1] = vec;
pointIndex = rand()%(psStructure->sDisplay.imd->npoints-1);
pointIndex = rand() % (psStructure->sDisplay.imd->npoints - 1);
point = &(psStructure->sDisplay.imd->points[pointIndex]);
each.x = psStructure->pos.x + point->x;
realY = structHeightScale(psStructure) * point->y;
each.y = psStructure->pos.z + realY;
each.y = psStructure->pos.z + (structHeightScale(psStructure) * point->y);
each.z = psStructure->pos.y - point->z;
vec.x = each.x - player.p.x;
vec.z = -(each.z - player.p.z);
vec.y = each.y;
pts[2] = vec;
// set the colour
colour = pal_SetBrightness(UBYTE_MAX);
if (psDroid->action == DACTION_DEMOLISH)
{
colour.byte.b = 0;
} else {
colour.byte.r = 0;
}
colour.byte.g = 0;
pts[2] = Vector3f(each.x - player.p.x, each.y, -(each.z - player.p.z));
colour = (psDroid->action == DACTION_DEMOLISH) ? WZCOL_DEMOLISH_BEAM : WZCOL_CONSTRUCTOR_BEAM;
pie_TransColouredTriangle(pts, colour);
}