Clean up component.c and remove two unused key mappings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2618 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
e06c186bd6
commit
40170a90ce
121
src/component.c
121
src/component.c
|
@ -55,36 +55,25 @@
|
|||
#include "transporter.h"
|
||||
#include "projectile.h"
|
||||
|
||||
void unsetMatrix(void);
|
||||
void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ);
|
||||
static void unsetMatrix(void);
|
||||
static void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ);
|
||||
|
||||
#define MAX_GROUP_SIZE 10
|
||||
|
||||
#define NUM_GIBLETS 5
|
||||
#define BLIP_ANIM_DURATION 200
|
||||
|
||||
#define DEFAULT_COMPONENT_TRANSLUCENCY 128
|
||||
|
||||
#define DROID_EMP_SPREAD (20 - rand()%40)
|
||||
|
||||
//Watermelon:VTOL weapon connector start
|
||||
#define VTOL_CONNECTOR_START 5
|
||||
|
||||
UDWORD droidScale = 100;
|
||||
void displayComponentTemplate(DROID_TEMPLATE *psTemplate);
|
||||
//void displayComponentObject(BASE_OBJECT *psObj);
|
||||
//Watermelon:updated prototype for displayCompObj again
|
||||
static void displayCompObj(BASE_OBJECT *psObj, BOOL bButton);
|
||||
static iIMDShape *getLeftPropulsionIMD(DROID *psDroid);
|
||||
static iIMDShape *getRightPropulsionIMD(DROID *psDroid);
|
||||
|
||||
static UDWORD getStructureHeight(STRUCTURE *psStructure);
|
||||
|
||||
BOOL leftFirst;
|
||||
|
||||
SDWORD droidLightLevel = 224;
|
||||
UDWORD lightInterval=15;
|
||||
UDWORD lightLastChanged;
|
||||
static BOOL leftFirst;
|
||||
static SDWORD droidLightLevel = 224;
|
||||
static UDWORD lightInterval = 15;
|
||||
static UDWORD lightLastChanged;
|
||||
SDWORD lightSpeed=2;
|
||||
extern UDWORD selectedPlayer;
|
||||
|
||||
|
@ -140,7 +129,7 @@ void updateLightLevels(void)
|
|||
}
|
||||
|
||||
|
||||
void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ)
|
||||
static void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL RotXYZ)
|
||||
{
|
||||
pie_PerspectiveBegin();
|
||||
pie_MatBegin();
|
||||
|
@ -159,7 +148,7 @@ void setMatrix(Vector3i *Position, Vector3i *Rotation, Vector3i *CameraPos, BOOL
|
|||
}
|
||||
|
||||
|
||||
void unsetMatrix(void)
|
||||
static void unsetMatrix(void)
|
||||
{
|
||||
pie_MatEnd();
|
||||
pie_PerspectiveEnd();
|
||||
|
@ -187,23 +176,17 @@ UDWORD getComponentRadius(BASE_STATS *psComponent)
|
|||
compID = StatIsComponent(psComponent);
|
||||
if (compID > 0) {
|
||||
StatGetComponentIMD(psComponent, compID,&ComponentIMD, &MountIMD);
|
||||
// ComponentIMD = StatGetComponentIMD(psComponent, compID);
|
||||
if(ComponentIMD)
|
||||
{
|
||||
return GetRadius(ComponentIMD);
|
||||
}
|
||||
else
|
||||
{
|
||||
// NULL component,should this be an error?
|
||||
}
|
||||
}
|
||||
|
||||
// DBERROR(("Not a valid component"));
|
||||
/* VTOL bombs are only stats allowed to have NULL ComponentIMD */
|
||||
if ( (StatIsComponent(psComponent) != COMP_WEAPON) ||
|
||||
((WEAPON_STATS *)psComponent)->weaponSubClass != WSC_BOMB )
|
||||
{
|
||||
debug( LOG_NEVER, "ComponentPIE == NULL : File : %s Line : %d\n", __FILE__, __LINE__ );
|
||||
debug(LOG_ERROR, "getComponentRadius: ComponentPIE == NULL");
|
||||
}
|
||||
|
||||
return COMPONENT_RADIUS;
|
||||
|
@ -218,8 +201,7 @@ UDWORD getResearchRadius(BASE_STATS *Stat)
|
|||
return GetRadius(ResearchIMD);
|
||||
}
|
||||
|
||||
// DBERROR(("Null IMD in getResearchRadius()"));
|
||||
debug( LOG_NEVER, "ResearchPIE == NULL : File : %s Line : %d\n", __FILE__, __LINE__ );
|
||||
debug(LOG_ERROR, "getResearchRadius: ResearchPIE == NULL");
|
||||
|
||||
return 100;
|
||||
}
|
||||
|
@ -611,7 +593,6 @@ void displayComponentButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Posi
|
|||
compID = StatIsComponent(Stat);
|
||||
if (compID > 0) {
|
||||
StatGetComponentIMD(Stat, compID,&ComponentIMD, &MountIMD);
|
||||
// ComponentIMD = StatGetComponentIMD(Stat, compID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -624,12 +605,9 @@ void displayComponentButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Posi
|
|||
((StatIsComponent(Stat) != COMP_WEAPON) ||
|
||||
((WEAPON_STATS *)Stat)->weaponSubClass != WSC_BOMB) )
|
||||
{
|
||||
debug( LOG_NEVER, "ComponentPIE == NULL : File : %s Line : %d\n", __FILE__, __LINE__ );
|
||||
// DBERROR(("ComponentIMD == NULL"));
|
||||
debug(LOG_ERROR, "ComponentPIE == NULL");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(MountIMD)
|
||||
{
|
||||
pie_Draw3DShape(MountIMD, 0, getPlayerColour(selectedPlayer), pie_MAX_BRIGHT_LEVEL, 0, pie_BUTTON, 0);// ajl changed 0 to selectedPlayer
|
||||
|
@ -651,7 +629,6 @@ void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Posit
|
|||
iIMDShape *MountIMD = ((RESEARCH *)Stat)->pIMD2;
|
||||
Vector3i TmpCamPos = {0,0,0};
|
||||
|
||||
|
||||
if(ResearchIMD)
|
||||
{
|
||||
setMatrix(Position,Rotation,&TmpCamPos,RotXYZ);
|
||||
|
@ -664,8 +641,10 @@ void displayResearchButton(BASE_STATS *Stat, Vector3i *Rotation, Vector3i *Posit
|
|||
|
||||
unsetMatrix();
|
||||
}
|
||||
|
||||
// DBERROR(("Null IMD in displayResearchButton()"));
|
||||
else
|
||||
{
|
||||
debug(LOG_ERROR, "displayResearchButton: ResearchIMD == NULL");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -745,11 +724,8 @@ void displayComponentButtonObject(DROID *psDroid, Vector3i *Rotation, Vector3i *
|
|||
// Watermelon:multiple turrets display removed the pointless mountRotation
|
||||
void displayComponentObject(BASE_OBJECT *psObj)
|
||||
{
|
||||
DROID *psDroid;
|
||||
//iIMDShape *psShape;
|
||||
Vector3i position, rotation; //,null;
|
||||
//iPoint screenCoords;
|
||||
//SDWORD dummyZ;
|
||||
DROID *psDroid = (DROID *)psObj;
|
||||
Vector3i position, rotation;
|
||||
Sint32 xShift,zShift;
|
||||
UDWORD worldAngle;
|
||||
SDWORD difference;
|
||||
|
@ -758,9 +734,7 @@ void displayComponentObject(BASE_OBJECT *psObj)
|
|||
UDWORD tileX,tileY;
|
||||
MAPTILE *psTile;
|
||||
|
||||
psDroid = (DROID *)psObj;
|
||||
psPropStats = asPropulsionStats + psDroid->asBits[COMP_PROPULSION].nStat;
|
||||
|
||||
worldAngle = (UDWORD)(player.r.y / DEG_1) % 360;
|
||||
difference = worldAngle - psObj->direction;
|
||||
|
||||
|
@ -788,10 +762,6 @@ void displayComponentObject(BASE_OBJECT *psObj)
|
|||
position.z = terrainMidY*TILE_UNITS - (psDroid->y - player.p.z);
|
||||
position.y = psDroid->z;
|
||||
|
||||
//{
|
||||
// position.y += bobTransporterHeight();
|
||||
//}
|
||||
//if(psPropStats->propulsionType == LIFT)
|
||||
if(psDroid->droidType == DROID_TRANSPORTER)
|
||||
{
|
||||
position.y += bobTransporterHeight();
|
||||
|
@ -802,10 +772,6 @@ void displayComponentObject(BASE_OBJECT *psObj)
|
|||
rotation.x = psDroid->pitch;
|
||||
rotation.z = psDroid->roll;
|
||||
|
||||
|
||||
/* Get rotation info for the mounting too (holds the gun */
|
||||
// Watermelon:obsolete,since I move it to displayCompObj
|
||||
|
||||
/* Translate origin */
|
||||
pie_TRANSLATE(position.x,position.y,position.z);
|
||||
|
||||
|
@ -869,7 +835,6 @@ void displayComponentObject(BASE_OBJECT *psObj)
|
|||
void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
||||
{
|
||||
DROID *psDroid;
|
||||
//Watermelon:I need another temp pointer to Shape
|
||||
iIMDShape *psShape, *psJet, *psShapeTemp = NULL;
|
||||
Vector3i zero = {0, 0, 0};
|
||||
Vector2i screenCoords;
|
||||
|
@ -880,7 +845,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
UDWORD brightness, specular;
|
||||
UDWORD colour;
|
||||
UDWORD bDarkSide = FALSE;
|
||||
//Watermelon:i
|
||||
UBYTE i;
|
||||
|
||||
/* Cast the droid pointer */
|
||||
|
@ -907,8 +871,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
|
||||
if(!bButton)
|
||||
{
|
||||
// centreX = player.p.x + world_coord(visibleXTiles / 2);
|
||||
// centreZ = player.p.z + world_coord(visibleYTiles / 2);
|
||||
brightness = lightDoFogAndIllumination(psDroid->illumination,getCentreX() - psDroid->x,getCentreZ() - psDroid->y, &specular);
|
||||
pieFlag = pie_SHADOW;
|
||||
}
|
||||
|
@ -921,10 +883,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
/* We've got a z value here _and_ screen coords of origin */
|
||||
dummyZ = pie_RotateProject(&zero, &screenCoords);
|
||||
|
||||
if (droidScale != 100) {
|
||||
pie_MatScale(droidScale);
|
||||
}
|
||||
|
||||
/* set default components transparent */
|
||||
if ( psDroid->asBits[COMP_PROPULSION].nStat == 0 )
|
||||
{
|
||||
|
@ -1038,8 +996,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
/* Indenting here is only to show new matrix context */
|
||||
{
|
||||
psShapeTemp = BODY_IMD(psDroid,psDroid->player);
|
||||
//Watermelon:I moved it to 'for' loop
|
||||
//pie_MatBegin();
|
||||
if( psShapeTemp->nconnectors )
|
||||
{
|
||||
/* vtol weapons attach to connector 2 (underneath);
|
||||
|
@ -1056,39 +1012,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
iConnector = 0;
|
||||
}
|
||||
|
||||
/* Now we need to move for the mount point */
|
||||
//Watermelon:I moved it to switch,this is called __inline__ j/k
|
||||
/*
|
||||
pie_TRANSLATE( psShape->connectors[iConnector].x,
|
||||
psShape->connectors[iConnector].z,
|
||||
psShape->connectors[iConnector].y );
|
||||
*/
|
||||
|
||||
/* Rotate the turret */
|
||||
/*
|
||||
if(&mountRotation[i])
|
||||
{
|
||||
pie_MatRotY(DEG(&mountRotation[i].y));
|
||||
}
|
||||
*/
|
||||
//dont pitch the turret
|
||||
// pie_MatRotZ(DEG(mountRotation->z));
|
||||
|
||||
//I moved it to 'for' loop
|
||||
/* vtol weapons inverted */
|
||||
/*
|
||||
if ( iConnector == 1 )
|
||||
{
|
||||
pie_MatRotZ( DEG_360/2 );//this might affect gun rotation
|
||||
}
|
||||
*/
|
||||
|
||||
//SEPERATE Mount IMDs now...
|
||||
/* Get the mounting graphic - we've already moved to the right position
|
||||
Allegedly - all droids will have a mount graphic so this shouldn't
|
||||
fall on it's arse......*/
|
||||
//psShape = MOUNT_IMD(psDroid,psDroid->player);
|
||||
/* Draw it */
|
||||
switch(psDroid->droidType)
|
||||
{
|
||||
case DROID_DEFAULT:
|
||||
|
@ -1207,7 +1130,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
if (gameTime < (psDroid->asWeaps[i].lastFired + BASE_MUZZLE_FLASH_DURATION))
|
||||
{
|
||||
pie_Draw3DShape(psShape, 0, 0, brightness, 0, pieFlag | pie_ADDITIVE, EFFECT_MUZZLE_ADDITIVE);//muzzle flash
|
||||
// pie_Draw3DShape(psShape, 0, 0, brightness, 0, pieFlag, 0);//muzzle flash
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1216,7 +1138,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
if (frame < psShape->numFrames)
|
||||
{
|
||||
pie_Draw3DShape(psShape, frame, 0, brightness, 0, pieFlag | pie_ADDITIVE, EFFECT_MUZZLE_ADDITIVE);//muzzle flash
|
||||
// pie_Draw3DShape(psShape, frame, 0, brightness, 0, pieFlag, 0);//muzzle flash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1254,8 +1175,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
/* Draw it */
|
||||
if(psShape)
|
||||
{
|
||||
// pie_MatRotY(DEG(getStaticTimeValueRange(7920,360)));
|
||||
// pie_MatRotY(DEG(psDroid->turretRotation));
|
||||
pie_Draw3DShape(psShape, 0,colour/*getPlayerColour( psDroid->player)*/, brightness, specular, pieFlag, iPieData);
|
||||
}
|
||||
|
||||
|
@ -1264,8 +1183,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
/* Draw it */
|
||||
if(psShape)
|
||||
{
|
||||
// pie_MatRotY(DEG(getStaticTimeValueRange(7920,360)));
|
||||
// pie_MatRotY(DEG(psDroid->turretRotation));
|
||||
pie_Draw3DShape(psShape, 0,colour/*getPlayerColour( psDroid->player)*/, brightness, specular, pieFlag, iPieData);
|
||||
}
|
||||
/* Pop Matrix */
|
||||
|
@ -1442,10 +1359,6 @@ void displayCompObj(BASE_OBJECT *psObj, BOOL bButton)
|
|||
}
|
||||
/* 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] */
|
||||
|
||||
//Watermelon:I moved it to 'for' loop
|
||||
/* Pop Matrix */
|
||||
//pie_MatEnd();
|
||||
} // end of illustrative indentation - see above
|
||||
|
||||
/* set default components transparent */
|
||||
|
|
|
@ -99,8 +99,6 @@ extern void compPersonToBits(DROID *psDroid);
|
|||
#define MUZZLE_FLASH_PIE(DROID,PLAYER) (asWeaponStats[DROID->asWeaps[0].nStat].pMuzzleGraphic)
|
||||
|
||||
/* Don't know what these might be? */
|
||||
extern BOOL leftFirst;
|
||||
extern UDWORD droidScale; //testing only - remove when decided
|
||||
extern void updateLightLevels(void);
|
||||
extern SDWORD rescaleButtonObject(SDWORD radius, SDWORD baseScale,SDWORD baseRadius);
|
||||
|
||||
|
|
|
@ -647,6 +647,7 @@ void kf_ToggleCamera( void )
|
|||
/* Toggle 'watch' window on/off */
|
||||
void kf_ToggleWatchWindow( void )
|
||||
{
|
||||
addConsoleMessage("WATCH WINDOW!", LEFT_JUSTIFY); // what is this? - per
|
||||
(void)addDebugMenu(!DebugMenuUp);
|
||||
}
|
||||
|
||||
|
@ -1137,21 +1138,7 @@ void kf_DownGeoOffset( void )
|
|||
geoOffset--;
|
||||
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
/* Ups the droid scale */
|
||||
void kf_UpDroidScale( void )
|
||||
{
|
||||
droidScale++;
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
/* Lowers the droid scale */
|
||||
void kf_DownDroidScale( void )
|
||||
{
|
||||
if(droidScale>2)
|
||||
{
|
||||
droidScale--;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
/* Toggles the power bar display on and off*/
|
||||
void kf_TogglePowerBar( void )
|
||||
|
@ -1531,22 +1518,25 @@ void kf_ChooseCancel( void )
|
|||
// --------------------------------------------------------------------------
|
||||
void kf_ToggleDrivingMode( void )
|
||||
{
|
||||
addConsoleMessage("Toggle driver mode", LEFT_JUSTIFY); // what does this do? - per
|
||||
|
||||
/* No point unless we're tracking */
|
||||
if(getWarCamStatus())
|
||||
{
|
||||
if(getDrivingStatus())
|
||||
{
|
||||
StopDriverMode();
|
||||
addConsoleMessage("DriverMode off", LEFT_JUSTIFY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (driveModeActive() == FALSE) && (demoGetStatus() == FALSE) && !bMultiPlayer)
|
||||
{
|
||||
StartDriverMode( NULL );
|
||||
addConsoleMessage("DriverMode on", LEFT_JUSTIFY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOL bMovePause = FALSE;
|
||||
|
|
|
@ -89,8 +89,6 @@ extern void kf_JumpToMapMarker( void );
|
|||
extern void kf_TogglePowerBar( void );
|
||||
extern void kf_UpGeoOffset( void );
|
||||
extern void kf_DownGeoOffset( void );
|
||||
extern void kf_UpDroidScale( void );
|
||||
extern void kf_DownDroidScale( void );
|
||||
extern void kf_ToggleDebugMappings( void );
|
||||
extern void kf_ToggleGodMode( void );
|
||||
extern void kf_SeekNorth( void );
|
||||
|
|
|
@ -240,8 +240,6 @@ _keymapsave keyMapSaveTable[] =
|
|||
kf_RaiseTile,
|
||||
kf_ToggleOutline,
|
||||
kf_TriFlip,
|
||||
kf_UpDroidScale,
|
||||
kf_DownDroidScale,
|
||||
kf_RaiseGamma,
|
||||
kf_LowerGamma,
|
||||
kf_ToggleWatchWindow,
|
||||
|
@ -445,18 +443,16 @@ void keyInitMappings( BOOL bForceDefaults )
|
|||
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_G,KEYMAP_PRESSED,kf_ToggleGodMode, "Toggle god Mode Status");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_O,KEYMAP_PRESSED,kf_ChooseOptions, "Display Options Screen");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_X,KEYMAP_PRESSED,kf_FinishResearch, "Complete current research");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_LALT,KEY_SPACE,KEYMAP_PRESSED,kf_ToggleWatchWindow, "Toggle watch window");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_LSHIFT,KEY_W,KEYMAP_PRESSED,kf_ToggleWatchWindow, "Toggle watch window");
|
||||
|
||||
saveKeyMap(); // save out the default key mappings.
|
||||
|
||||
// ------------------------ OLD STUFF - Store here!
|
||||
/*
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_LSHIFT,KEY_D,KEYMAP_PRESSED,kf_ToggleDrivingMode, "Toggle Driving Mode");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_F6,KEYMAP_DOWN,kf_UpGeoOffset,"Raise the geometric offset");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_F7,KEYMAP_DOWN,kf_DownGeoOffset,"Lower the geometric offset");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_F8,KEYMAP_DOWN,kf_UpDroidScale,"Increase droid Scaling");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_F9,KEYMAP_DOWN,kf_DownDroidScale,"Decrease droid Scaling");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_C,KEYMAP_PRESSED,kf_SimCloseDown,"Simulate Screen Close Down");
|
||||
keyAddMapping(KEYMAP_ALWAYS,KEY_IGNORE,KEY_D,KEYMAP_PRESSED,kf_ToggleDrivingMode,"Toggle Driving Mode");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_E,KEYMAP_PRESSED,kf_ToggleDroidInfo,"Display droid info whilst tracking");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_I,KEYMAP_PRESSED,kf_ToggleWidgets,"Toggle Widgets");
|
||||
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_J,KEYMAP_PRESSED,kf_ToggleRadarAllign,"Toggles Radar allignment");
|
||||
|
|
Loading…
Reference in New Issue