2007-01-15 12:09:25 -08:00
|
|
|
/*
|
|
|
|
This file is part of Warzone 2100.
|
|
|
|
Copyright (C) 1999-2004 Eidos Interactive
|
|
|
|
Copyright (C) 2005-2007 Warzone Resurrection Project
|
|
|
|
|
|
|
|
Warzone 2100 is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Warzone 2100 is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Warzone 2100; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2008-02-16 05:05:34 -08:00
|
|
|
/**
|
|
|
|
* @file component.c
|
|
|
|
* Draws component objects - oh yes indeed.
|
2007-06-28 10:47:08 -07:00
|
|
|
*/
|
2006-11-06 06:40:07 -08:00
|
|
|
#include <string.h>
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/framework/frame.h"
|
2007-07-12 12:56:16 -07:00
|
|
|
#include "basedef.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "droid.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "order.h"
|
|
|
|
#include "component.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/ivis_common/ivisdef.h" //ivis matrix code
|
2007-02-14 12:13:31 -08:00
|
|
|
#include "lib/ivis_opengl/piematrix.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/ivis_common/piedef.h" //ivis matrix code
|
|
|
|
#include "lib/ivis_common/piestate.h" //ivis render code
|
2007-12-08 16:33:03 -08:00
|
|
|
#include "lib/ivis_common/piepalette.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "lighting.h"
|
|
|
|
#include "loop.h"
|
|
|
|
|
|
|
|
#define GetRadius(x) ((x)->sradius)
|
|
|
|
|
|
|
|
#include "stats.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/ivis_common/piemode.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "objects.h"
|
|
|
|
#include "display.h"
|
|
|
|
#include "geometry.h"
|
|
|
|
#include "display3d.h"
|
|
|
|
#include "map.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/gamelib/gtime.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "intdisplay.h"
|
|
|
|
#include "miscimd.h"
|
|
|
|
#include "effects.h"
|
|
|
|
#include "e3demo.h"
|
|
|
|
#include "transporter.h"
|
|
|
|
#include "projectile.h"
|
|
|
|
|
2007-10-24 14:15:54 -07:00
|
|
|
static void unsetMatrix(void);
|
2008-04-05 09:22:05 -07:00
|
|
|
static void setMatrix(Vector3i *Position, Vector3i *Rotation, BOOL RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
#define BLIP_ANIM_DURATION 200
|
|
|
|
#define DEFAULT_COMPONENT_TRANSLUCENCY 128
|
|
|
|
#define DROID_EMP_SPREAD (20 - rand()%40)
|
|
|
|
|
2006-12-17 09:12:14 -08:00
|
|
|
//Watermelon:VTOL weapon connector start
|
|
|
|
#define VTOL_CONNECTOR_START 5
|
|
|
|
|
|
|
|
static void displayCompObj(BASE_OBJECT *psObj, BOOL bButton);
|
2007-06-28 10:47:08 -07:00
|
|
|
static iIMDShape *getLeftPropulsionIMD(DROID *psDroid);
|
|
|
|
static iIMDShape *getRightPropulsionIMD(DROID *psDroid);
|
|
|
|
static UDWORD getStructureHeight(STRUCTURE *psStructure);
|
|
|
|
|
2007-10-24 14:15:54 -07:00
|
|
|
static BOOL leftFirst;
|
|
|
|
static SDWORD droidLightLevel = 224;
|
|
|
|
static UDWORD lightInterval = 15;
|
|
|
|
static UDWORD lightLastChanged;
|
2007-06-28 10:47:08 -07:00
|
|
|
SDWORD lightSpeed=2;
|
|
|
|
extern UDWORD selectedPlayer;
|
|
|
|
|
|
|
|
UBYTE PlayerColour[MAX_PLAYERS];// = {0,1,2,3,4,5,6,7}
|
|
|
|
|
|
|
|
// Colour Lookups
|
|
|
|
// use col = MAX_PLAYERS for anycolour (see multiint.c)
|
|
|
|
BOOL setPlayerColour(UDWORD player, UDWORD col)
|
|
|
|
{
|
|
|
|
if(player >MAX_PLAYERS || col >MAX_PLAYERS)
|
|
|
|
{
|
2006-08-22 07:28:49 -07:00
|
|
|
debug( LOG_ERROR, "setplayercolour: wrong values" );
|
|
|
|
abort();
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
PlayerColour[(UBYTE)player] = (UBYTE)col;
|
2008-03-24 09:51:17 -07:00
|
|
|
return true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
UBYTE getPlayerColour(UDWORD pl)
|
|
|
|
{
|
|
|
|
return PlayerColour[pl];
|
|
|
|
}
|
|
|
|
|
|
|
|
void initPlayerColours(void)
|
|
|
|
{
|
|
|
|
UBYTE i;
|
|
|
|
for(i=0;i<MAX_PLAYERS;i++)
|
|
|
|
{
|
|
|
|
PlayerColour[i] = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void updateLightLevels(void)
|
|
|
|
{
|
|
|
|
if(gameTime>(lightLastChanged+lightInterval))
|
|
|
|
{
|
|
|
|
droidLightLevel+=lightSpeed;
|
|
|
|
lightLastChanged = gameTime;
|
2007-02-10 08:39:39 -08:00
|
|
|
if(droidLightLevel>255 || droidLightLevel<128)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
if(lightSpeed>0)
|
|
|
|
{
|
|
|
|
lightSpeed = -lightSpeed;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lightSpeed = -lightSpeed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
static void setMatrix(Vector3i *Position, Vector3i *Rotation, BOOL RotXYZ)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_PerspectiveBegin();
|
|
|
|
pie_MatBegin();
|
|
|
|
|
|
|
|
pie_TRANSLATE(Position->x,Position->y,Position->z);
|
|
|
|
|
|
|
|
if(RotXYZ) {
|
|
|
|
pie_MatRotX(DEG(Rotation->x));
|
|
|
|
pie_MatRotY(DEG(Rotation->y));
|
|
|
|
pie_MatRotZ(DEG(Rotation->z));
|
|
|
|
} else {
|
|
|
|
pie_MatRotY(DEG(Rotation->y));
|
|
|
|
pie_MatRotX(DEG(Rotation->x));
|
|
|
|
pie_MatRotZ(DEG(Rotation->z));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-24 14:15:54 -07:00
|
|
|
static void unsetMatrix(void)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_MatEnd();
|
|
|
|
pie_PerspectiveEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-20 10:17:50 -07:00
|
|
|
UDWORD getComponentDroidRadius(WZ_DECL_UNUSED DROID *psDroid)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
return 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-20 10:17:50 -07:00
|
|
|
UDWORD getComponentDroidTemplateRadius(WZ_DECL_UNUSED DROID_TEMPLATE *psDroid)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
return 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UDWORD getComponentRadius(BASE_STATS *psComponent)
|
|
|
|
{
|
|
|
|
iIMDShape *ComponentIMD = NULL;
|
|
|
|
iIMDShape *MountIMD = NULL;
|
|
|
|
SDWORD compID;
|
|
|
|
|
|
|
|
compID = StatIsComponent(psComponent);
|
2008-01-27 16:02:28 -08:00
|
|
|
if (compID > 0)
|
|
|
|
{
|
2007-06-28 10:47:08 -07:00
|
|
|
StatGetComponentIMD(psComponent, compID,&ComponentIMD, &MountIMD);
|
|
|
|
if(ComponentIMD)
|
|
|
|
{
|
|
|
|
return GetRadius(ComponentIMD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* VTOL bombs are only stats allowed to have NULL ComponentIMD */
|
|
|
|
if ( (StatIsComponent(psComponent) != COMP_WEAPON) ||
|
|
|
|
((WEAPON_STATS *)psComponent)->weaponSubClass != WSC_BOMB )
|
2006-05-27 09:37:17 -07:00
|
|
|
{
|
2007-10-24 14:15:54 -07:00
|
|
|
debug(LOG_ERROR, "getComponentRadius: ComponentPIE == NULL");
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return COMPONENT_RADIUS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UDWORD getResearchRadius(BASE_STATS *Stat)
|
|
|
|
{
|
|
|
|
iIMDShape *ResearchIMD = ((RESEARCH *)Stat)->pIMD;
|
|
|
|
|
|
|
|
if(ResearchIMD) {
|
|
|
|
return GetRadius(ResearchIMD);
|
|
|
|
}
|
|
|
|
|
2007-10-24 14:15:54 -07:00
|
|
|
debug(LOG_ERROR, "getResearchRadius: ResearchPIE == NULL");
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
return 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UDWORD getStructureSize(STRUCTURE *psStructure)
|
|
|
|
{
|
|
|
|
UDWORD size;
|
|
|
|
//radius based on base plate size
|
|
|
|
|
|
|
|
size = psStructure->pStructureType->baseWidth;
|
|
|
|
if (psStructure->pStructureType->baseBreadth > size)
|
|
|
|
{
|
|
|
|
size = psStructure->pStructureType->baseBreadth;
|
|
|
|
}
|
|
|
|
return (size);
|
|
|
|
}
|
|
|
|
|
|
|
|
UDWORD getStructureStatSize(STRUCTURE_STATS *Stats)
|
|
|
|
{
|
|
|
|
UDWORD size;
|
|
|
|
//radius based on base plate size
|
|
|
|
|
|
|
|
size = Stats->baseWidth;
|
|
|
|
if (Stats->baseBreadth > size)
|
|
|
|
{
|
|
|
|
size = Stats->baseBreadth;
|
|
|
|
}
|
|
|
|
return (size);
|
|
|
|
}
|
|
|
|
|
|
|
|
UDWORD getStructureHeight(STRUCTURE *psStructure)
|
|
|
|
{
|
2007-06-17 14:12:02 -07:00
|
|
|
return (getStructureStatHeight(psStructure->pStructureType));
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
UDWORD getStructureStatHeight(STRUCTURE_STATS *psStat)
|
|
|
|
{
|
2007-06-17 14:12:02 -07:00
|
|
|
if (psStat->pIMD)
|
|
|
|
{
|
2007-12-21 09:34:23 -08:00
|
|
|
return (psStat->pIMD->max.y - psStat->pIMD->min.y);
|
2007-06-17 14:12:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayIMDButton(iIMDShape *IMDShape, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
pie_SetFogStatus(false);
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(IMDShape, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-25 09:38:27 -08:00
|
|
|
//Watermelon:changed it to loop thru and draw all weapons
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayStructureButton(STRUCTURE *psStructure, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd;
|
|
|
|
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
|
|
|
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
2007-06-28 10:47:08 -07:00
|
|
|
UDWORD nWeaponStat;
|
2006-11-25 09:38:27 -08:00
|
|
|
int i;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/*HACK HACK HACK!
|
|
|
|
if its a 'tall thin (ie tower)' structure with something on the top - offset the
|
|
|
|
position to show the object on top*/
|
|
|
|
if (psStructure->pStructureType->pIMD->nconnectors && scale == SMALL_STRUCT_SCALE &&
|
|
|
|
getStructureHeight(psStructure) > TOWER_HEIGHT)
|
|
|
|
{
|
|
|
|
Position->y -= 20;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
/* Draw the building's base first */
|
|
|
|
baseImd = psStructure->pStructureType->pBaseIMD;
|
|
|
|
if(baseImd!=NULL) {
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psStructure->sDisplay.imd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
//and draw the turret
|
|
|
|
if(psStructure->sDisplay.imd->nconnectors)
|
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
for (i = 0;i < STRUCT_MAXWEAPS;i++)
|
|
|
|
{
|
|
|
|
weaponImd[i] = NULL;//weapon is gun ecm or sensor
|
|
|
|
mountImd[i] = NULL;
|
|
|
|
}
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
strImd = psStructure->sDisplay.imd;
|
|
|
|
//get an imd to draw on the connector priority is weapon, ECM, sensor
|
|
|
|
//check for weapon
|
2006-11-25 09:38:27 -08:00
|
|
|
//Watermelon:re-enabled if (psStructure->numWeaps > 0)
|
|
|
|
if (psStructure->numWeaps > 0)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
for (i = 0;i < psStructure->numWeaps;i++)
|
|
|
|
{
|
|
|
|
if (psStructure->asWeaps[i].nStat > 0)
|
|
|
|
{
|
|
|
|
nWeaponStat = psStructure->asWeaps[i].nStat;
|
|
|
|
weaponImd[i] = asWeaponStats[nWeaponStat].pIMD;
|
|
|
|
mountImd[i] = asWeaponStats[nWeaponStat].pMountGraphic;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-11-25 09:38:27 -08:00
|
|
|
if (weaponImd[i] == NULL)
|
|
|
|
{
|
|
|
|
//check for ECM
|
|
|
|
if (psStructure->pStructureType->pECM != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[i] = psStructure->pStructureType->pECM->pIMD;
|
|
|
|
mountImd[i] = psStructure->pStructureType->pECM->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weaponImd[i] == NULL)
|
|
|
|
{
|
|
|
|
//check for sensor
|
|
|
|
if (psStructure->pStructureType->pSensor != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[i] = psStructure->pStructureType->pSensor->pIMD;
|
|
|
|
mountImd[i] = psStructure->pStructureType->pSensor->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
if (psStructure->asWeaps[0].nStat > 0)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
nWeaponStat = psStructure->asWeaps[0].nStat;
|
|
|
|
weaponImd[0] = asWeaponStats[nWeaponStat].pIMD;
|
|
|
|
mountImd[0] = asWeaponStats[nWeaponStat].pMountGraphic;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2006-11-25 09:38:27 -08:00
|
|
|
if (weaponImd[0] == NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
//check for ECM
|
|
|
|
if (psStructure->pStructureType->pECM != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[0] = psStructure->pStructureType->pECM->pIMD;
|
|
|
|
mountImd[0] = psStructure->pStructureType->pECM->pMountGraphic;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-25 09:38:27 -08:00
|
|
|
|
|
|
|
if (weaponImd[0] == NULL)
|
|
|
|
{
|
|
|
|
//check for sensor
|
|
|
|
if (psStructure->pStructureType->pSensor != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[0] = psStructure->pStructureType->pSensor->pIMD;
|
|
|
|
mountImd[0] = psStructure->pStructureType->pSensor->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//draw Weapon/ECM/Sensor for structure
|
2006-11-25 09:38:27 -08:00
|
|
|
//Watermelon:uses 0
|
|
|
|
if(weaponImd[0] != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
if (psStructure->numWeaps > 0)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
for (i = 0;i < psStructure->numWeaps;i++)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
iV_MatrixBegin();
|
|
|
|
iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y);
|
|
|
|
pie_MatRotY(DEG(-((SDWORD)psStructure->turretRotation[i])));
|
|
|
|
if (mountImd[i] != NULL)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
if(mountImd[i]->nconnectors)
|
|
|
|
{
|
|
|
|
iV_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
iV_MatrixRotateX(DEG(psStructure->turretPitch[i]));
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(weaponImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
//we have a droid weapon so do we draw a muzzle flash
|
|
|
|
iV_MatrixEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iV_MatrixBegin();
|
|
|
|
iV_TRANSLATE(strImd->connectors->x,strImd->connectors->z,strImd->connectors->y);
|
|
|
|
pie_MatRotY(DEG(-((SDWORD)psStructure->turretRotation[0])));
|
|
|
|
if (mountImd[0] != NULL)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(mountImd[0], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
if(mountImd[0]->nconnectors)
|
|
|
|
{
|
|
|
|
iV_TRANSLATE(mountImd[0]->connectors->x,mountImd[0]->connectors->z,mountImd[0]->connectors->y);
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-25 09:38:27 -08:00
|
|
|
iV_MatrixRotateX(DEG(psStructure->turretPitch[0]));
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(weaponImd[0], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
//we have a droid weapon so do we draw a muzzle flash
|
|
|
|
iV_MatrixEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
2008-04-20 10:17:50 -07:00
|
|
|
void displayStructureStatButton(STRUCTURE_STATS *Stats, UDWORD Player, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
iIMDShape *baseImd,*strImd;//*mountImd,*weaponImd;
|
|
|
|
iIMDShape *mountImd[STRUCT_MAXWEAPS];
|
|
|
|
iIMDShape *weaponImd[STRUCT_MAXWEAPS];
|
2006-12-31 07:18:01 -08:00
|
|
|
UBYTE i;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/*HACK HACK HACK!
|
|
|
|
if its a 'tall thin (ie tower)' structure stat with something on the top - offset the
|
|
|
|
position to show the object on top*/
|
|
|
|
if (Stats->pIMD->nconnectors && scale == SMALL_STRUCT_SCALE &&
|
|
|
|
getStructureStatHeight(Stats) > TOWER_HEIGHT)
|
|
|
|
{
|
|
|
|
Position->y -= 20;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
/* Draw the building's base first */
|
|
|
|
baseImd = Stats->pBaseIMD;
|
|
|
|
|
2007-12-08 16:33:03 -08:00
|
|
|
if (baseImd != NULL)
|
|
|
|
{
|
|
|
|
pie_Draw3DShape(baseImd, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(Stats->pIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//and draw the turret
|
|
|
|
if(Stats->pIMD->nconnectors)
|
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
if (Stats->numWeaps > 0)
|
|
|
|
{
|
|
|
|
for (i = 0;i < Stats->numWeaps;i++)
|
|
|
|
{
|
|
|
|
weaponImd[i] = NULL;//weapon is gun ecm or sensor
|
|
|
|
mountImd[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
weaponImd[0] = NULL;
|
|
|
|
mountImd[0] = NULL;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
strImd = Stats->pIMD;
|
|
|
|
//get an imd to draw on the connector priority is weapon, ECM, sensor
|
|
|
|
//check for weapon
|
2006-11-25 09:38:27 -08:00
|
|
|
//Watermelon:can only have the STRUCT_MAXWEAPS
|
|
|
|
if (Stats->numWeaps > 0)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
for (i = 0;i < Stats->numWeaps;i++)
|
|
|
|
{
|
|
|
|
//can only have the one
|
|
|
|
if (Stats->psWeapStat[i] != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[i] = Stats->psWeapStat[i]->pIMD;
|
|
|
|
mountImd[i] = Stats->psWeapStat[i]->pMountGraphic;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-11-25 09:38:27 -08:00
|
|
|
if (weaponImd[i] == NULL)
|
|
|
|
{
|
|
|
|
//check for ECM
|
|
|
|
if (Stats->pECM != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[i] = Stats->pECM->pIMD;
|
|
|
|
mountImd[i] = Stats->pECM->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weaponImd[i] == NULL)
|
|
|
|
{
|
|
|
|
//check for sensor
|
|
|
|
if (Stats->pSensor != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[i] = Stats->pSensor->pIMD;
|
|
|
|
mountImd[i] = Stats->pSensor->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
if (Stats->psWeapStat[0] != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
weaponImd[0] = Stats->psWeapStat[0]->pIMD;
|
|
|
|
mountImd[0] = Stats->psWeapStat[0]->pMountGraphic;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2006-11-25 09:38:27 -08:00
|
|
|
if (weaponImd[0] == NULL)
|
|
|
|
{
|
|
|
|
//check for ECM
|
|
|
|
if (Stats->pECM != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[0] = Stats->pECM->pIMD;
|
|
|
|
mountImd[0] = Stats->pECM->pMountGraphic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weaponImd[0] == NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
//check for sensor
|
|
|
|
if (Stats->pSensor != NULL)
|
|
|
|
{
|
|
|
|
weaponImd[0] = Stats->pSensor->pIMD;
|
|
|
|
mountImd[0] = Stats->pSensor->pMountGraphic;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//draw Weapon/ECM/Sensor for structure
|
2006-11-25 09:38:27 -08:00
|
|
|
if(weaponImd[0] != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
if (Stats->numWeaps > 0)
|
|
|
|
{
|
|
|
|
for (i = 0;i < Stats->numWeaps;i++)
|
|
|
|
{
|
|
|
|
iV_MatrixBegin();
|
|
|
|
iV_TRANSLATE(strImd->connectors[i].x,strImd->connectors[i].z,strImd->connectors[i].y);
|
|
|
|
pie_MatRotY(DEG(0));
|
|
|
|
if (mountImd[i] != NULL)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(mountImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
if(mountImd[i]->nconnectors)
|
|
|
|
{
|
|
|
|
iV_TRANSLATE(mountImd[i]->connectors->x,mountImd[i]->connectors->z,mountImd[i]->connectors->y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
iV_MatrixRotateX(DEG(0));
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(weaponImd[i], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
//we have a droid weapon so do we draw a muzzle flash
|
|
|
|
iV_MatrixEnd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-25 09:38:27 -08:00
|
|
|
iV_MatrixBegin();
|
|
|
|
iV_TRANSLATE(strImd->connectors[0].x,strImd->connectors[0].z,strImd->connectors[0].y);
|
|
|
|
pie_MatRotY(DEG(0));
|
|
|
|
if (mountImd[0] != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(mountImd[0], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
if(mountImd[0]->nconnectors)
|
|
|
|
{
|
|
|
|
iV_TRANSLATE(mountImd[0]->connectors->x,mountImd[0]->connectors->z,mountImd[0]->connectors->y);
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-25 09:38:27 -08:00
|
|
|
iV_MatrixRotateX(DEG(0));
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(weaponImd[0], 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2006-11-25 09:38:27 -08:00
|
|
|
//we have a droid weapon so do we draw a muzzle flash
|
|
|
|
iV_MatrixEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
// Render a component given a BASE_STATS structure.
|
|
|
|
//
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayComponentButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position,
|
2007-06-28 10:47:08 -07:00
|
|
|
BOOL RotXYZ, SDWORD scale)
|
|
|
|
{
|
|
|
|
iIMDShape *ComponentIMD = NULL;
|
|
|
|
iIMDShape *MountIMD = NULL;
|
|
|
|
SDWORD compID;
|
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
compID = StatIsComponent(Stat);
|
|
|
|
if (compID > 0) {
|
|
|
|
StatGetComponentIMD(Stat, compID,&ComponentIMD, &MountIMD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsetMatrix();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* VTOL bombs are only stats allowed to have NULL ComponentIMD */
|
|
|
|
if ( (ComponentIMD == NULL) &&
|
|
|
|
((StatIsComponent(Stat) != COMP_WEAPON) ||
|
|
|
|
((WEAPON_STATS *)Stat)->weaponSubClass != WSC_BOMB) )
|
|
|
|
{
|
2007-10-24 14:15:54 -07:00
|
|
|
debug(LOG_ERROR, "ComponentPIE == NULL");
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if(MountIMD)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(MountIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
if(ComponentIMD)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(ComponentIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Render a research item given a BASE_STATS structure.
|
|
|
|
//
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
iIMDShape *ResearchIMD = ((RESEARCH *)Stat)->pIMD;
|
|
|
|
iIMDShape *MountIMD = ((RESEARCH *)Stat)->pIMD2;
|
|
|
|
|
|
|
|
if(ResearchIMD)
|
|
|
|
{
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
if(MountIMD) {
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(MountIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(ResearchIMD, 0, getPlayerColour(selectedPlayer), WZCOL_WHITE, WZCOL_BLACK, pie_BUTTON, 0);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
unsetMatrix();
|
|
|
|
}
|
2007-10-24 14:15:54 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
debug(LOG_ERROR, "displayResearchButton: ResearchIMD == NULL");
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Render a composite droid given a DROID_TEMPLATE structure.
|
|
|
|
//
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayComponentButtonTemplate(DROID_TEMPLATE *psTemplate, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
static DROID Droid; // Made static to reduce stack usage.
|
|
|
|
SDWORD difference;
|
|
|
|
|
|
|
|
/* init to NULL */
|
|
|
|
memset( &Droid, 0, sizeof(DROID) );
|
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
// Decide how to sort it.
|
|
|
|
|
|
|
|
difference = Rotation->y%360;
|
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if((difference>0 && difference <180) || difference<-180)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
droidSetBits(psTemplate,&Droid);
|
|
|
|
Droid.player = (UBYTE)selectedPlayer;
|
|
|
|
|
2007-12-15 07:39:29 -08:00
|
|
|
Droid.pos.x = Droid.pos.y = Droid.pos.z = 0;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//draw multi component object as a button object
|
2008-03-24 09:51:17 -07:00
|
|
|
displayCompObj((BASE_OBJECT*)&Droid, true);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-11-04 14:56:28 -08:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Render a composite droid given a DROID structure.
|
|
|
|
//
|
2007-03-16 09:20:16 -07:00
|
|
|
void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *Position, BOOL RotXYZ, SDWORD scale)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
SDWORD difference;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2008-04-05 09:22:05 -07:00
|
|
|
setMatrix(Position, Rotation, RotXYZ);
|
2007-06-28 10:47:08 -07:00
|
|
|
pie_MatScale(scale);
|
|
|
|
|
|
|
|
// Decide how to sort it.
|
|
|
|
difference = Rotation->y%360;
|
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if((difference>0 && difference <180) || difference<-180)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// And render the composite object.
|
|
|
|
//draw multi component object as a button object
|
2008-03-24 09:51:17 -07:00
|
|
|
displayCompObj((BASE_OBJECT*)psDroid, true);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
unsetMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Assumes matrix context is already set */
|
2006-12-17 09:12:14 -08:00
|
|
|
// Watermelon:multiple turrets display removed the pointless mountRotation
|
2007-06-28 10:47:08 -07:00
|
|
|
void displayComponentObject(BASE_OBJECT *psObj)
|
|
|
|
{
|
2007-10-24 14:15:54 -07:00
|
|
|
DROID *psDroid = (DROID *)psObj;
|
|
|
|
Vector3i position, rotation;
|
2007-04-27 03:21:17 -07:00
|
|
|
Sint32 xShift,zShift;
|
|
|
|
UDWORD worldAngle;
|
|
|
|
SDWORD difference;
|
|
|
|
SDWORD frame;
|
|
|
|
PROPULSION_STATS *psPropStats;
|
|
|
|
UDWORD tileX,tileY;
|
|
|
|
MAPTILE *psTile;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
2007-04-27 03:21:17 -07:00
|
|
|
worldAngle = (UDWORD)(player.r.y / DEG_1) % 360;
|
|
|
|
difference = worldAngle - psObj->direction;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if((difference>0 && difference <180) || difference<-180)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
leftFirst = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Push the matrix */
|
|
|
|
pie_MatBegin();
|
|
|
|
|
|
|
|
/* Get internal tile units coordinates */
|
2007-05-22 13:36:07 -07:00
|
|
|
xShift = map_round(player.p.x);
|
|
|
|
zShift = map_round(player.p.z);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/* Mask out to tile_units resolution */
|
|
|
|
pie_TRANSLATE(xShift,0,-zShift);
|
|
|
|
|
|
|
|
/* Get the real position */
|
2007-12-15 07:39:29 -08:00
|
|
|
position.x = (psDroid->pos.x - player.p.x) - terrainMidX*TILE_UNITS;
|
|
|
|
position.z = terrainMidY*TILE_UNITS - (psDroid->pos.y - player.p.z);
|
|
|
|
position.y = psDroid->pos.z;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if(psDroid->droidType == DROID_TRANSPORTER)
|
|
|
|
{
|
|
|
|
position.y += bobTransporterHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get all the pitch,roll,yaw info */
|
|
|
|
rotation.y = -(SDWORD)psDroid->direction;
|
|
|
|
rotation.x = psDroid->pitch;
|
|
|
|
rotation.z = psDroid->roll;
|
|
|
|
|
|
|
|
/* Translate origin */
|
|
|
|
pie_TRANSLATE(position.x,position.y,position.z);
|
|
|
|
|
|
|
|
/* Rotate for droid */
|
|
|
|
pie_MatRotY(DEG(rotation.y));
|
|
|
|
pie_MatRotX(DEG(rotation.x));
|
|
|
|
pie_MatRotZ(DEG(rotation.z));
|
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if( (gameTime-psDroid->timeLastHit < GAME_TICKS_PER_SEC) && psDroid->lastHitWeapon == WSC_ELECTRONIC)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
objectShimmy( (BASE_OBJECT*) psDroid );
|
|
|
|
}
|
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
if (psDroid->lastHitWeapon == WSC_EMP &&
|
|
|
|
(gameTime - psDroid->timeLastHit < EMP_DISABLE_TIME))
|
|
|
|
{
|
|
|
|
Vector3i position;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
//add an effect on the droid
|
2007-12-15 07:39:29 -08:00
|
|
|
position.x = psDroid->pos.x + DROID_EMP_SPREAD;
|
|
|
|
position.y = psDroid->pos.z + rand()%8;;
|
|
|
|
position.z = psDroid->pos.y + DROID_EMP_SPREAD;
|
2007-06-17 14:12:02 -07:00
|
|
|
effectGiveAuxVar(90+rand()%20);
|
2008-03-24 09:51:17 -07:00
|
|
|
addEffect(&position,EFFECT_EXPLOSION,EXPLOSION_TYPE_PLASMA,false,NULL,0);
|
2007-06-17 14:12:02 -07:00
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if (godMode || (psDroid->visible[selectedPlayer] == UBYTE_MAX) || demoGetStatus())
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
//ingame not button object
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:should render 3 mounted weapons now
|
2008-03-24 09:51:17 -07:00
|
|
|
displayCompObj(psObj,false);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
// make sure it's not over water.
|
2007-12-15 07:39:29 -08:00
|
|
|
tileX = psDroid->pos.x/TILE_UNITS;
|
|
|
|
tileY = psDroid->pos.y/TILE_UNITS;
|
2007-06-28 10:47:08 -07:00
|
|
|
// double check it's on map
|
2007-02-19 08:46:48 -08:00
|
|
|
if ( tileX < mapWidth && tileY < mapHeight )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
psTile = mapTile(tileX,tileY);
|
2007-11-03 11:48:47 -07:00
|
|
|
if (terrainType(psTile) != TER_WATER)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
frame = gameTime/BLIP_ANIM_DURATION + psDroid->id; //visible[selectedPlayer];
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(getImdFromIndex(MI_BLIP), frame, 0, WZCOL_WHITE, WZCOL_BLACK, pie_ADDITIVE, psDroid->visible[selectedPlayer] / 2);
|
2007-06-28 10:47:08 -07:00
|
|
|
/* set up all the screen coords stuff - need to REMOVE FROM THIS LOOP */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pie_MatEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Assumes matrix context is already set */
|
2006-11-04 14:56:28 -08:00
|
|
|
// Watermelon:this is able to handle multiple weapon graphics now
|
2006-12-17 09:12:14 -08:00
|
|
|
// removed mountRotation,they get such stuff from psObj directly now
|
|
|
|
void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
DROID *psDroid;
|
2006-11-04 14:56:28 -08:00
|
|
|
iIMDShape *psShape, *psJet, *psShapeTemp = NULL;
|
2007-05-21 07:06:31 -07:00
|
|
|
Vector3i zero = {0, 0, 0};
|
2007-03-16 09:20:16 -07:00
|
|
|
Vector2i screenCoords;
|
2007-06-28 10:47:08 -07:00
|
|
|
SDWORD dummyZ, iConnector;
|
|
|
|
PROPULSION_STATS *psPropStats;
|
|
|
|
SDWORD frame;
|
|
|
|
SDWORD pieFlag, iPieData;
|
2007-12-13 10:08:37 -08:00
|
|
|
PIELIGHT brightness;
|
|
|
|
const PIELIGHT specular = WZCOL_BLACK;
|
2007-06-28 10:47:08 -07:00
|
|
|
UDWORD colour;
|
2008-03-24 09:51:17 -07:00
|
|
|
UDWORD bDarkSide = false;
|
2006-12-31 07:18:01 -08:00
|
|
|
UBYTE i;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Cast the droid pointer */
|
|
|
|
psDroid = (DROID *)psObj;
|
2007-02-10 08:39:39 -08:00
|
|
|
if( (gameTime-psDroid->timeLastHit < GAME_TICKS_PER_SEC/4 ) && psDroid->lastHitWeapon == WSC_ELECTRONIC && !gamePaused())
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
colour = getPlayerColour(rand()%MAX_PLAYERS);
|
2008-03-24 09:51:17 -07:00
|
|
|
bDarkSide = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
colour = getPlayerColour(psDroid->player);
|
|
|
|
}
|
|
|
|
|
|
|
|
//set pieflag for button object or ingame object
|
|
|
|
if ( bButton )
|
|
|
|
{
|
|
|
|
pieFlag = pie_BUTTON;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pieFlag = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-24 15:53:18 -07:00
|
|
|
if(!bButton)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-12-13 10:08:37 -08:00
|
|
|
brightness = pal_SetBrightness(psDroid->illumination);
|
2007-03-24 15:53:18 -07:00
|
|
|
pieFlag = pie_SHADOW;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
brightness = WZCOL_WHITE;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We've got a z value here _and_ screen coords of origin */
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/* set default components transparent */
|
|
|
|
if ( psDroid->asBits[COMP_PROPULSION].nStat == 0 )
|
|
|
|
{
|
|
|
|
pieFlag |= pie_TRANSLUCENT;
|
|
|
|
iPieData = DEFAULT_COMPONENT_TRANSLUCENCY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iPieData = 0;
|
|
|
|
}
|
|
|
|
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:uses psShapeTemp too separate it from turret's psShape
|
|
|
|
psShapeTemp = (leftFirst ? getLeftPropulsionIMD(psDroid) : getRightPropulsionIMD(psDroid));
|
|
|
|
if(psShapeTemp!=NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set default components transparent */
|
|
|
|
if ( psDroid->asBits[COMP_BODY].nStat == 0 )
|
|
|
|
{
|
|
|
|
pieFlag |= pie_TRANSLUCENT;
|
|
|
|
iPieData = DEFAULT_COMPONENT_TRANSLUCENCY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pieFlag &= ~pie_TRANSLUCENT;
|
|
|
|
iPieData = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the body graphic now*/
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:uses psShapeTemp too separate it from turret's psShape
|
|
|
|
psShapeTemp = BODY_IMD(psDroid,psDroid->player);
|
|
|
|
if(psShapeTemp!=NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
if ( psDroid->droidType == DROID_PERSON)
|
|
|
|
{
|
|
|
|
/* draw body if not animating */
|
2008-03-24 09:51:17 -07:00
|
|
|
if ( psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
// FIXME - hideous....!!!!
|
|
|
|
pie_MatScale(75);
|
2006-11-04 14:56:28 -08:00
|
|
|
pie_Draw3DShape(psShapeTemp, 0, psDroid->player-6, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//else if( psDroid->droidType == DROID_CYBORG)
|
2007-06-17 14:12:02 -07:00
|
|
|
else if (cyborgDroid(psDroid))
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* draw body if cyborg not animating */
|
2008-03-24 09:51:17 -07:00
|
|
|
if ( psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get propulsion stats */
|
|
|
|
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
2007-04-03 06:20:41 -07:00
|
|
|
ASSERT( psPropStats != NULL,
|
2006-08-23 05:58:48 -07:00
|
|
|
"moveUpdateUnit: invalid propulsion stats pointer" );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/* render vtol jet if flying - horrible hack - GJ */
|
|
|
|
if (((psPropStats->propulsionType == LIFT) &&
|
2007-06-17 14:12:02 -07:00
|
|
|
//(psDroid->droidType != DROID_CYBORG)) && (!bButton))
|
|
|
|
(!cyborgDroid(psDroid))) && (!bButton))
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* show flame if above ground */
|
|
|
|
if ( psDroid->sMove.Status != MOVEINACTIVE )
|
|
|
|
{
|
|
|
|
/* draw flame if found */
|
|
|
|
|
|
|
|
/* GJ TODO: add flame-finding code here */
|
2007-06-17 14:12:02 -07:00
|
|
|
psJet = asBodyStats[psDroid->asBits[COMP_BODY].nStat].pFlameIMD;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
if ( psJet != NULL )
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psJet, getStaticTimeValueRange(100,psJet->numFrames), colour, brightness, specular, pie_ADDITIVE, 200);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//don't change the screen coords of an object if drawing it in a button
|
|
|
|
if (!bButton)
|
|
|
|
{
|
|
|
|
/* set up all the screen coords stuff - need to REMOVE FROM THIS LOOP */
|
|
|
|
calcScreenCoords(psDroid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set default components transparent */
|
2007-06-17 14:12:02 -07:00
|
|
|
if (psDroid->asWeaps[0].nStat == 0 &&
|
|
|
|
psDroid->asBits[COMP_SENSOR].nStat == 0 &&
|
|
|
|
psDroid->asBits[COMP_ECM].nStat == 0 &&
|
|
|
|
psDroid->asBits[COMP_BRAIN].nStat == 0 &&
|
|
|
|
psDroid->asBits[COMP_REPAIRUNIT].nStat == 0 &&
|
|
|
|
psDroid->asBits[COMP_CONSTRUCT].nStat == 0)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pieFlag |= pie_TRANSLUCENT;
|
|
|
|
iPieData = DEFAULT_COMPONENT_TRANSLUCENCY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pieFlag &= ~pie_TRANSLUCENT;
|
|
|
|
iPieData = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Indenting here is only to show new matrix context */
|
|
|
|
{
|
2006-11-04 14:56:28 -08:00
|
|
|
psShapeTemp = BODY_IMD(psDroid,psDroid->player);
|
|
|
|
if( psShapeTemp->nconnectors )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* vtol weapons attach to connector 2 (underneath);
|
|
|
|
* all others to connector 1 */
|
2006-12-17 09:12:14 -08:00
|
|
|
/* Watermelon:VTOL's now skip the first 5 connectors(0 to 4),
|
|
|
|
VTOL's use 5,6,7,8 etc now */
|
2007-06-28 10:47:08 -07:00
|
|
|
if ( (psPropStats->propulsionType == LIFT) &&
|
|
|
|
psDroid->droidType == DROID_WEAPON )
|
|
|
|
{
|
2006-12-17 09:12:14 -08:00
|
|
|
iConnector = VTOL_CONNECTOR_START;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iConnector = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(psDroid->droidType)
|
|
|
|
{
|
|
|
|
case DROID_DEFAULT:
|
|
|
|
case DROID_TRANSPORTER:
|
|
|
|
case DROID_CYBORG:
|
|
|
|
case DROID_CYBORG_SUPER:
|
|
|
|
case DROID_WEAPON:
|
|
|
|
case DROID_COMMAND: // command droids have a weapon to store all the graphics
|
2006-05-27 09:37:17 -07:00
|
|
|
/* Get the mounting graphic - we've already moved to the right position
|
2007-06-28 10:47:08 -07:00
|
|
|
Allegedly - all droids will have a mount graphic so this shouldn't
|
|
|
|
fall on it's arse......*/
|
|
|
|
/* Double check that the weapon droid actually has any */
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:uses numWeaps
|
2007-06-28 10:47:08 -07:00
|
|
|
//if(psDroid->numWeaps)
|
2006-11-04 14:56:28 -08:00
|
|
|
for (i = 0;i < psDroid->numWeaps;i++)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-02-10 08:39:39 -08:00
|
|
|
if (psDroid->asWeaps[i].nStat > 0 || psDroid->droidType == DROID_DEFAULT)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-04 14:56:28 -08:00
|
|
|
if ( psShapeTemp->connectors )
|
|
|
|
{
|
|
|
|
pie_MatBegin();
|
|
|
|
//Watermelon:reset Z?
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2006-12-17 09:12:14 -08:00
|
|
|
//Watermelon:to skip number of VTOL_CONNECTOR_START ground unit connectors
|
|
|
|
if ( iConnector < VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
2007-07-27 10:19:44 -07:00
|
|
|
pie_TRANSLATE(psShapeTemp->connectors[i].x,
|
|
|
|
psShapeTemp->connectors[i].z,
|
|
|
|
psShapeTemp->connectors[i].y);
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
2006-12-17 09:12:14 -08:00
|
|
|
else
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
2006-12-17 09:12:14 -08:00
|
|
|
pie_TRANSLATE( psShapeTemp->connectors[iConnector + i].x,
|
|
|
|
psShapeTemp->connectors[iConnector + i].z,
|
|
|
|
psShapeTemp->connectors[iConnector + i].y );
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-11-04 14:56:28 -08:00
|
|
|
if ( psDroid->turretRotation[i] )
|
|
|
|
{
|
|
|
|
pie_MatRotY(DEG( (-(SDWORD)psDroid->turretRotation[i])) );
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
|
2006-11-04 14:56:28 -08:00
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-11-04 14:56:28 -08:00
|
|
|
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//psShape = WEAPON_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
psShape = (asWeaponStats[psDroid->asWeaps[i].nStat]).pMountGraphic;
|
|
|
|
/* Draw it */
|
|
|
|
//if(psDroid->numWeaps) already done this check above?!
|
|
|
|
{
|
|
|
|
pie_TRANSLATE(0,0,psDroid->asWeaps[i].recoilValue/3);
|
|
|
|
}
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
//if(psDroid->numWeaps) already done this check above?!
|
|
|
|
{
|
|
|
|
pie_TRANSLATE(0,0,psDroid->asWeaps[i].recoilValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* translate for weapon mount point if cyborg */
|
|
|
|
//if( psDroid->droidType == DROID_CYBORG &&
|
|
|
|
if (cyborgDroid(psDroid) && psShape && psShape->nconnectors)
|
|
|
|
{
|
|
|
|
pie_TRANSLATE( psShape->connectors[0].x,
|
|
|
|
psShape->connectors[0].z,
|
|
|
|
psShape->connectors[0].y );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
|
|
|
//pitch the barrel down
|
|
|
|
pie_MatRotX(DEG( (-(psDroid->turretPitch[i])) ));
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-04 14:56:28 -08:00
|
|
|
//pitch the barrel up
|
|
|
|
pie_MatRotX(DEG(psDroid->turretPitch[i]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the weapon (gun?) graphic */
|
|
|
|
//psShape = WEAPON_IMD(psDroid,psDroid->player);
|
|
|
|
psShape = (asWeaponStats[psDroid->asWeaps[i].nStat]).pIMD;
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
|
|
|
//we have a droid weapon so do we draw a muzzle flash
|
|
|
|
if( psShape && psShape->nconnectors )
|
|
|
|
{
|
|
|
|
/* Now we need to move to the end fo the barrel */
|
2006-11-25 09:38:27 -08:00
|
|
|
//Watermelon:fixed the bug,I mingled body connector and weapon connector :/
|
|
|
|
pie_TRANSLATE( psShape->connectors[0].x,
|
|
|
|
psShape->connectors[0].z,
|
|
|
|
psShape->connectors[0].y );
|
2006-11-04 14:56:28 -08:00
|
|
|
//and draw the muzzle flash
|
|
|
|
//animate for the duration of the flash only
|
|
|
|
//Watermelon:change macro to actual accessor for each turret effect
|
|
|
|
//psShape = MUZZLE_FLASH_PIE(psDroid,psDroid->player);
|
|
|
|
psShape = (asWeaponStats[psDroid->asWeaps[i].nStat]).pMuzzleGraphic;
|
|
|
|
if(psShape)
|
|
|
|
{
|
|
|
|
//assume no clan colours formuzzle effects
|
|
|
|
if ((psShape->numFrames == 0) || (psShape->animInterval <= 0))//no anim so display one frame for a fixed time
|
|
|
|
{
|
|
|
|
if (gameTime < (psDroid->asWeaps[i].lastFired + BASE_MUZZLE_FLASH_DURATION))
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, 0, brightness, WZCOL_BLACK, pieFlag | pie_ADDITIVE, EFFECT_MUZZLE_ADDITIVE);//muzzle flash
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frame = (gameTime - psDroid->asWeaps[i].lastFired)/psShape->animInterval;
|
|
|
|
if (frame < psShape->numFrames)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, frame, 0, brightness, WZCOL_BLACK, pieFlag | pie_ADDITIVE, EFFECT_MUZZLE_ADDITIVE);//muzzle flash
|
2006-11-04 14:56:28 -08:00
|
|
|
}
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-04 14:56:28 -08:00
|
|
|
/* Pop Matrix */
|
|
|
|
pie_MatEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DROID_SENSOR:
|
2006-05-27 09:37:17 -07:00
|
|
|
/* Get the mounting graphic - we've already moved to the right position
|
2007-06-28 10:47:08 -07:00
|
|
|
Allegedly - all droids will have a mount graphic so this shouldn't
|
|
|
|
fall on it's arse......*/
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:sensor uses connectors[0]
|
|
|
|
pie_MatBegin();
|
|
|
|
//Watermelon:reset Z?
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2006-11-04 14:56:28 -08:00
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
|
|
|
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
|
|
|
}
|
|
|
|
|
|
|
|
pie_TRANSLATE( psShapeTemp->connectors[0].x,
|
|
|
|
psShapeTemp->connectors[0].z,
|
|
|
|
psShapeTemp->connectors[0].y );
|
|
|
|
|
|
|
|
if(psDroid->turretRotation[0])
|
|
|
|
{
|
|
|
|
pie_MatRotY(DEG( (-(SDWORD)(psDroid->turretRotation[0])) ));
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = SENSOR_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0,colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Get the sensor graphic, assuming it's there */
|
|
|
|
psShape = SENSOR_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0,colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-04 14:56:28 -08:00
|
|
|
/* Pop Matrix */
|
|
|
|
pie_MatEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DROID_CONSTRUCT:
|
2007-06-17 14:12:02 -07:00
|
|
|
case DROID_CYBORG_CONSTRUCT:
|
2006-05-27 09:37:17 -07:00
|
|
|
/* Get the mounting graphic - we've already moved to the right position
|
2007-06-28 10:47:08 -07:00
|
|
|
Allegedly - all droids will have a mount graphic so this shouldn't
|
|
|
|
fall on it's arse......*/
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:cyborg uses connectors[0]
|
|
|
|
pie_MatBegin();
|
|
|
|
//Watermelon:reset Z?
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2006-11-04 14:56:28 -08:00
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
|
|
|
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
|
|
|
}
|
|
|
|
pie_TRANSLATE( psShapeTemp->connectors[0].x,
|
|
|
|
psShapeTemp->connectors[0].z,
|
|
|
|
psShapeTemp->connectors[0].y );
|
|
|
|
|
|
|
|
if(psDroid->turretRotation[0])
|
|
|
|
{
|
|
|
|
pie_MatRotY(DEG( (-(SDWORD)(psDroid->turretRotation[0])) ));
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = CONSTRUCT_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0,colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/* translate for construct mount point if cyborg */
|
|
|
|
if (cyborgDroid(psDroid) && psShape && psShape->nconnectors)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_TRANSLATE( psShape->connectors[0].x,
|
|
|
|
psShape->connectors[0].z,
|
|
|
|
psShape->connectors[0].y );
|
|
|
|
}
|
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/* Get the construct graphic assuming it's there */
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = CONSTRUCT_IMD(psDroid,psDroid->player);
|
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/* Draw it */
|
2007-06-28 10:47:08 -07:00
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0,colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-04 14:56:28 -08:00
|
|
|
/* Pop Matrix */
|
|
|
|
pie_MatEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case DROID_ECM:
|
2006-05-27 09:37:17 -07:00
|
|
|
/* Get the mounting graphic - we've already moved to the right position
|
2007-06-28 10:47:08 -07:00
|
|
|
Allegedly - all droids will have a mount graphic so this shouldn't
|
|
|
|
fall on it's arse......*/
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:ecm uses connectors[0]
|
|
|
|
pie_MatBegin();
|
|
|
|
//Watermelon:reset Z?
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2006-11-04 14:56:28 -08:00
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
|
|
|
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
|
|
|
}
|
|
|
|
pie_TRANSLATE( psShapeTemp->connectors[0].x,
|
|
|
|
psShapeTemp->connectors[0].z,
|
|
|
|
psShapeTemp->connectors[0].y );
|
|
|
|
|
|
|
|
if(psDroid->turretRotation[0])
|
|
|
|
{
|
|
|
|
pie_MatRotY(DEG( (-(SDWORD)(psDroid->turretRotation[0])) ));
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = ECM_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Get the ECM graphic assuming it's there.... */
|
|
|
|
psShape = ECM_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-11-04 14:56:28 -08:00
|
|
|
/* Pop Matrix */
|
|
|
|
pie_MatEnd();
|
|
|
|
break;
|
2007-06-28 10:47:08 -07:00
|
|
|
case DROID_REPAIR:
|
2007-06-17 14:12:02 -07:00
|
|
|
case DROID_CYBORG_REPAIR:
|
2006-05-27 09:37:17 -07:00
|
|
|
/* Get the mounting graphic - we've already moved to the right position
|
2007-06-28 10:47:08 -07:00
|
|
|
Allegedly - all droids will have a mount graphic so this shouldn't
|
|
|
|
fall on it's arse......*/
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:cyborg uses connectors[0]
|
|
|
|
pie_MatBegin();
|
|
|
|
//Watermelon:reset Z?
|
2007-05-21 07:06:31 -07:00
|
|
|
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
2006-11-04 14:56:28 -08:00
|
|
|
/* vtol weapons inverted */
|
2006-12-17 09:12:14 -08:00
|
|
|
if ( iConnector >= VTOL_CONNECTOR_START )
|
2006-11-04 14:56:28 -08:00
|
|
|
{
|
|
|
|
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
|
|
|
}
|
|
|
|
pie_TRANSLATE( psShapeTemp->connectors[0].x,
|
|
|
|
psShapeTemp->connectors[0].z,
|
|
|
|
psShapeTemp->connectors[0].y );
|
|
|
|
|
|
|
|
if(psDroid->turretRotation[0])
|
|
|
|
{
|
|
|
|
pie_MatRotY(DEG( (-(SDWORD)(psDroid->turretRotation[0])) ));
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = REPAIR_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/* translate for construct mount point if cyborg */
|
|
|
|
if (cyborgDroid(psDroid) && psShape && psShape->nconnectors)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_TRANSLATE( psShape->connectors[0].x,
|
|
|
|
psShape->connectors[0].z,
|
|
|
|
psShape->connectors[0].y );
|
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-17 14:12:02 -07:00
|
|
|
/* Get the Repair graphic assuming it's there.... */
|
|
|
|
psShape = REPAIR_IMD(psDroid,psDroid->player);
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Draw it */
|
|
|
|
if(psShape)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-02-10 08:39:39 -08:00
|
|
|
if(psShape->nconnectors && psDroid->action == DACTION_DROIDREPAIR)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
pie_TRANSLATE( psShape->connectors[0].x,
|
|
|
|
psShape->connectors[0].z,
|
|
|
|
psShape->connectors[0].y );
|
|
|
|
pie_TRANSLATE(0,-20,0);
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
psShape = getImdFromIndex(MI_FLAME);
|
|
|
|
|
|
|
|
/* Rotate for droid */
|
2007-04-27 03:21:17 -07:00
|
|
|
pie_MatRotY( DEG( (SDWORD)psDroid->direction ) );
|
|
|
|
pie_MatRotX( DEG( -psDroid->pitch ) );
|
|
|
|
pie_MatRotZ( DEG( -psDroid->roll ) );
|
2006-11-04 14:56:28 -08:00
|
|
|
//Watermelon:rotate Y
|
|
|
|
pie_MatRotY(DEG( -( (-(SDWORD)(psDroid->turretRotation[0])) ) ));
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
iV_MatrixRotateY(-player.r.y);
|
|
|
|
iV_MatrixRotateX(-player.r.x);
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Dither on software */
|
|
|
|
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, getStaticTimeValueRange(100,psShape->numFrames), 0, brightness, WZCOL_BLACK, pie_ADDITIVE, 140);
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Dither off software */
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
iV_MatrixRotateX(player.r.x);
|
|
|
|
iV_MatrixRotateY(player.r.y);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
2006-11-04 14:56:28 -08:00
|
|
|
/* Pop Matrix */
|
|
|
|
pie_MatEnd();
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case DROID_PERSON:
|
|
|
|
// no extra mounts for people
|
|
|
|
break;
|
|
|
|
default:
|
2007-06-14 13:59:04 -07:00
|
|
|
ASSERT(!"invalid droid type", "Whoa! Weirdy type of droid found in drawComponentObject!!!");
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* We've also got a handle on the psShape here for the weapon which has a connector to point to
|
|
|
|
muzzle flash attachment points - just grab it from psShape->connectors->[x|y|z] */
|
|
|
|
} // end of illustrative indentation - see above
|
|
|
|
|
|
|
|
/* set default components transparent */
|
|
|
|
if ( psDroid->asBits[COMP_PROPULSION].nStat == 0 )
|
|
|
|
{
|
|
|
|
pieFlag |= pie_TRANSLUCENT;
|
|
|
|
iPieData = DEFAULT_COMPONENT_TRANSLUCENCY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pieFlag &= ~pie_TRANSLUCENT;
|
|
|
|
iPieData = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
psShape = (leftFirst ? getRightPropulsionIMD(psDroid) : getLeftPropulsionIMD(psDroid));
|
|
|
|
if(psShape!=NULL)
|
|
|
|
{
|
2007-12-08 16:33:03 -08:00
|
|
|
pie_Draw3DShape(psShape, 0, colour, brightness, specular, pieFlag, iPieData);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-16 09:20:16 -07:00
|
|
|
void destroyFXDroid(DROID *psDroid)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-05-20 07:37:27 -07:00
|
|
|
UDWORD i;
|
|
|
|
iIMDShape *psImd = NULL;
|
|
|
|
SDWORD widthScatter, breadthScatter, heightScatter;
|
|
|
|
Vector3i pos;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
widthScatter = TILE_UNITS/4;
|
|
|
|
breadthScatter = TILE_UNITS/4;
|
|
|
|
heightScatter = TILE_UNITS/5;
|
|
|
|
for(i=0; i<5; i++)
|
|
|
|
{
|
2007-12-15 07:39:29 -08:00
|
|
|
pos.x = psDroid->pos.x + widthScatter - rand()%(2*widthScatter);
|
|
|
|
pos.z = psDroid->pos.y + breadthScatter - rand()%(2*breadthScatter);
|
|
|
|
pos.y = psDroid->pos.z + 16 +heightScatter;
|
2007-06-28 10:47:08 -07:00
|
|
|
switch(i)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
switch(psDroid->droidType)
|
|
|
|
{
|
|
|
|
case DROID_DEFAULT:
|
|
|
|
case DROID_CYBORG:
|
|
|
|
case DROID_CYBORG_SUPER:
|
2007-06-17 14:12:02 -07:00
|
|
|
case DROID_CYBORG_CONSTRUCT:
|
|
|
|
case DROID_CYBORG_REPAIR:
|
2007-06-28 10:47:08 -07:00
|
|
|
case DROID_WEAPON:
|
2006-05-27 09:37:17 -07:00
|
|
|
case DROID_COMMAND:
|
2006-11-04 14:56:28 -08:00
|
|
|
if (psDroid->numWeaps > 0)
|
|
|
|
{
|
|
|
|
if(psDroid->asWeaps[0].nStat > 0)
|
|
|
|
{
|
|
|
|
psImd = WEAPON_MOUNT_IMD(psDroid,psDroid->player);
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
psImd = getRandomDebrisImd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
psImd = getRandomDebrisImd();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
switch(psDroid->droidType)
|
|
|
|
{
|
|
|
|
case DROID_DEFAULT:
|
|
|
|
case DROID_CYBORG:
|
|
|
|
case DROID_CYBORG_SUPER:
|
2007-06-17 14:12:02 -07:00
|
|
|
case DROID_CYBORG_CONSTRUCT:
|
|
|
|
case DROID_CYBORG_REPAIR:
|
2007-06-28 10:47:08 -07:00
|
|
|
case DROID_WEAPON:
|
2006-05-27 09:37:17 -07:00
|
|
|
case DROID_COMMAND:
|
2007-01-07 11:08:23 -08:00
|
|
|
if(psDroid->numWeaps)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
psImd = WEAPON_IMD(psDroid,psDroid->player);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
psImd = getRandomDebrisImd();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
psImd = getRandomDebrisImd();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
psImd = getRandomDebrisImd();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(psImd)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
addEffect(&pos,EFFECT_GRAVITON,GRAVITON_TYPE_EMITTING_DR,true,psImd,getPlayerColour(psDroid->player));
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
addEffect(&pos,EFFECT_GRAVITON,GRAVITON_TYPE_EMITTING_DR,true,getRandomDebrisImd(),0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void compPersonToBits(DROID *psDroid)
|
|
|
|
{
|
2007-03-16 09:20:16 -07:00
|
|
|
Vector3i position; //,rotation,velocity;
|
2007-06-28 10:47:08 -07:00
|
|
|
iIMDShape *headImd, *legsImd, *armImd, *bodyImd;
|
|
|
|
UDWORD groundHeight;
|
|
|
|
UDWORD col;
|
|
|
|
|
|
|
|
if(!psDroid->visible[selectedPlayer])
|
|
|
|
{
|
|
|
|
/* We can't see the person or cyborg - so get out */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* get bits pointers according to whether baba or cyborg*/
|
2007-06-17 14:12:02 -07:00
|
|
|
if (cyborgDroid(psDroid))
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
headImd = getImdFromIndex(MI_CYBORG_HEAD);
|
|
|
|
legsImd = getImdFromIndex(MI_CYBORG_LEGS);
|
|
|
|
armImd = getImdFromIndex(MI_CYBORG_ARM);
|
|
|
|
bodyImd = getImdFromIndex(MI_CYBORG_BODY);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
headImd = getImdFromIndex(MI_BABA_HEAD);
|
|
|
|
legsImd = getImdFromIndex(MI_BABA_LEGS);
|
|
|
|
armImd = getImdFromIndex(MI_BABA_ARM);
|
|
|
|
bodyImd = getImdFromIndex(MI_BABA_BODY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get where he's at */
|
2007-12-15 07:39:29 -08:00
|
|
|
position.x = psDroid->pos.x;
|
|
|
|
position.y = psDroid->pos.z+1;
|
|
|
|
groundHeight = psDroid->pos.z;
|
|
|
|
position.z = psDroid->pos.y;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
/* Tell about player colour */
|
|
|
|
col = getPlayerColour(psDroid->player);
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
addEffect(&position,EFFECT_GRAVITON,GRAVITON_TYPE_GIBLET,true,headImd,col);
|
|
|
|
addEffect(&position,EFFECT_GRAVITON,GRAVITON_TYPE_GIBLET,true,legsImd,col);
|
|
|
|
addEffect(&position,EFFECT_GRAVITON,GRAVITON_TYPE_GIBLET,true,armImd,col);
|
|
|
|
addEffect(&position,EFFECT_GRAVITON,GRAVITON_TYPE_GIBLET,true,bodyImd,col);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
iIMDShape *getLeftPropulsionIMD(DROID *psDroid)
|
|
|
|
{
|
|
|
|
UDWORD bodyStat, propStat;
|
|
|
|
iIMDShape **imd;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
bodyStat = psDroid->asBits[COMP_BODY].nStat;
|
|
|
|
propStat = psDroid->asBits[COMP_PROPULSION].nStat;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
imd = asBodyStats[bodyStat].ppIMDList;
|
|
|
|
imd += (propStat * NUM_PROP_SIDES + LEFT_PROP);
|
|
|
|
|
|
|
|
return *imd;
|
|
|
|
}
|
|
|
|
|
2007-05-20 07:37:27 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
iIMDShape *getRightPropulsionIMD(DROID *psDroid)
|
|
|
|
{
|
|
|
|
UDWORD bodyStat, propStat;
|
|
|
|
iIMDShape **imd;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
bodyStat = psDroid->asBits[COMP_BODY].nStat;
|
|
|
|
propStat = psDroid->asBits[COMP_PROPULSION].nStat;
|
|
|
|
|
|
|
|
imd = asBodyStats[bodyStat].ppIMDList;
|
|
|
|
imd += (propStat * NUM_PROP_SIDES + RIGHT_PROP);
|
|
|
|
|
|
|
|
return *imd;
|
|
|
|
}
|
|
|
|
|
2007-05-20 07:37:27 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
SDWORD rescaleButtonObject(SDWORD radius, SDWORD baseScale,SDWORD baseRadius)
|
|
|
|
{
|
|
|
|
SDWORD newScale;
|
|
|
|
newScale = 100 * baseRadius;
|
|
|
|
newScale /= radius;
|
|
|
|
if(baseScale > 0)
|
|
|
|
{
|
|
|
|
newScale += baseScale;
|
|
|
|
newScale /= 2;
|
|
|
|
}
|
|
|
|
return newScale;
|
|
|
|
}
|