Make psDroid->numKills a float and rename it to psDroid->experience. Commits patch #894
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3122 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
08d665fe1c
commit
2e6bf47a94
|
@ -174,7 +174,7 @@ unsigned int cmdDroidMaxGroup(DROID *psCommander)
|
|||
}
|
||||
|
||||
// update the kills of a command droid if psKiller is in a command group
|
||||
void cmdDroidUpdateKills(DROID *psKiller, UDWORD percentDamage)
|
||||
void cmdDroidUpdateKills(DROID *psKiller, float experienceInc)
|
||||
{
|
||||
DROID *psCommander;
|
||||
|
||||
|
@ -185,7 +185,7 @@ void cmdDroidUpdateKills(DROID *psKiller, UDWORD percentDamage)
|
|||
(psKiller->psGroup->type == GT_COMMAND) )
|
||||
{
|
||||
psCommander = psKiller->psGroup->psCommander;
|
||||
psCommander->numKills += percentDamage;
|
||||
psCommander->experience += experienceInc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ extern SDWORD cmdDroidGetIndex(DROID *psCommander);
|
|||
extern unsigned int cmdDroidMaxGroup(DROID *psCommander);
|
||||
|
||||
// update the kills of a command droid if psKiller is in a command group
|
||||
extern void cmdDroidUpdateKills(DROID *psKiller, UDWORD percentDamage);
|
||||
extern void cmdDroidUpdateKills(DROID *psKiller, float experienceInc);
|
||||
|
||||
// get the level of a droids commander, if any
|
||||
extern unsigned int cmdGetCommanderLevel(DROID *psDroid);
|
||||
|
|
|
@ -1808,9 +1808,9 @@ static inline void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
|
|||
if (getDebugMappingStatus()) // cheating on, so output debug info
|
||||
{
|
||||
CONPRINTF(ConsoleString, (ConsoleString,
|
||||
"%s - Damage %d%% - ID %d - kills %d, %s - order %d - action %d - sensor range %hu power %hu - ECM %u",
|
||||
"%s - Damage %d%% - ID %d - kills %f, %s - order %d - action %d - sensor range %hu power %hu - ECM %u",
|
||||
droidGetName(psDroid), 100 - PERCENT(psDroid->body, psDroid->originalBody), psDroid->id,
|
||||
psDroid->numKills / 100, getDroidLevelName(psDroid), psDroid->order, psDroid->action, psDroid->sensorRange,
|
||||
psDroid->experience, getDroidLevelName(psDroid), psDroid->order, psDroid->action, psDroid->sensorRange,
|
||||
psDroid->sensorPower, psDroid->ECMMod));
|
||||
FeedbackClickedOn();
|
||||
}
|
||||
|
@ -1819,9 +1819,9 @@ static inline void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
|
|||
if(godMode)
|
||||
{
|
||||
CONPRINTF(ConsoleString, (ConsoleString,
|
||||
"%s - Damage %d%% - Serial ID %d - Kills %d order %d action %d, %s",
|
||||
"%s - Damage %d%% - Serial ID %d - Kills %f order %d action %d, %s",
|
||||
droidGetName(psDroid), 100 - PERCENT(psDroid->body,
|
||||
psDroid->originalBody),psDroid->id, psDroid->numKills / 100,
|
||||
psDroid->originalBody),psDroid->id, psDroid->experience,
|
||||
psDroid->order, psDroid->action, getDroidLevelName(psDroid)));
|
||||
FeedbackClickedOn();
|
||||
}
|
||||
|
@ -1832,7 +1832,7 @@ static inline void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
|
|||
CONPRINTF(ConsoleString, (ConsoleString,
|
||||
_("%s - Damage %d%% - Kills %d, %s"),
|
||||
droidGetName(psDroid), 100 - PERCENT(psDroid->body,
|
||||
psDroid->originalBody), psDroid->numKills / 100,
|
||||
psDroid->originalBody), (SDWORD) psDroid->experience,
|
||||
getDroidLevelName(psDroid)));
|
||||
FeedbackClickedOn();
|
||||
}
|
||||
|
|
27
src/droid.c
27
src/droid.c
|
@ -147,11 +147,11 @@ BOOL droidInit(void)
|
|||
* \param weaponClass the class of the weapon that deals the damage
|
||||
* \param weaponSubClass the subclass of the weapon that deals the damage
|
||||
* \param angle angle of impact (from the damage dealing projectile in relation to this droid)
|
||||
* \return TRUE when the dealt damage destroys the droid, FALSE when the droid survives
|
||||
* \return > 0 when the dealt damage destroys the droid, < 0 when the droid survives
|
||||
*
|
||||
* NOTE: This function will damage but _never_ destroy transports when in single player (campaign) mode
|
||||
*/
|
||||
SDWORD droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
{
|
||||
// Do at least one point of damage
|
||||
unsigned int actualDamage = 1, armour;
|
||||
|
@ -266,7 +266,7 @@ SDWORD droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD wea
|
|||
destroyDroid(psDroid);
|
||||
}
|
||||
|
||||
return (SDWORD) (body / originalBody * -100);
|
||||
return body / originalBody * -1.0f;
|
||||
}
|
||||
|
||||
// Substract the dealt damage from the droid's remaining body points
|
||||
|
@ -280,8 +280,8 @@ SDWORD droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD wea
|
|||
|
||||
CHECK_DROID(psDroid);
|
||||
|
||||
// Return the amount of damage done as an SDWORD between 0 and 99
|
||||
return (SDWORD) ((float) actualDamage / originalBody * 100);
|
||||
// Return the amount of damage done as an SDWORD between 0 and 999
|
||||
return (float) actualDamage / originalBody;
|
||||
}
|
||||
|
||||
// Check that psVictimDroid is not referred to by any other object in the game
|
||||
|
@ -394,7 +394,7 @@ void recycleDroid(DROID *psDroid)
|
|||
CHECK_DROID(psDroid);
|
||||
|
||||
// store the droids kills
|
||||
numKills = psDroid->numKills;
|
||||
numKills = psDroid->experience;
|
||||
if (numKills > UWORD_MAX)
|
||||
{
|
||||
numKills = UWORD_MAX;
|
||||
|
@ -3340,11 +3340,11 @@ DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD player,
|
|||
}
|
||||
}
|
||||
aDroidExperience[player][experienceLoc] = 0;
|
||||
psDroid->numKills = (UWORD)numKills;
|
||||
psDroid->experience = (UWORD)numKills;
|
||||
}
|
||||
else
|
||||
{
|
||||
psDroid->numKills = 0;
|
||||
psDroid->experience = 0;
|
||||
}
|
||||
|
||||
droidSetBits(pTemplate,psDroid);
|
||||
|
@ -4127,10 +4127,7 @@ UDWORD getDroidLevel(DROID *psDroid)
|
|||
static const unsigned int lastRank = sizeof(arrRank) / sizeof(struct rankMap);
|
||||
bool isCommander = (psDroid->droidType == DROID_COMMAND ||
|
||||
psDroid->droidType == DROID_SENSOR) ? true : false;
|
||||
// We need to divide by 100 to get the actual number since we're using
|
||||
// fixed point arithmatic here, and psDroid->numKills actually is the
|
||||
// percentage of damage dealt to other objects
|
||||
unsigned int numKills = psDroid->numKills / 100;
|
||||
unsigned int numKills = psDroid->experience;
|
||||
unsigned int i;
|
||||
|
||||
// Commanders don't need as much kills for ranks in multiplayer
|
||||
|
@ -5498,7 +5495,7 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to)
|
|||
armourK[impact_side] = psD->armour[impact_side][WC_KINETIC];
|
||||
armourH[impact_side] = psD->armour[impact_side][WC_HEAT];
|
||||
}
|
||||
numKills = psD->numKills;
|
||||
numKills = psD->experience;
|
||||
direction = psD->direction;
|
||||
//only play the sound if unit being taken over is selectedPlayer's but not going to the selectedPlayer
|
||||
//if ((psD->player == selectedPlayer) &&
|
||||
|
@ -5523,7 +5520,7 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to)
|
|||
psNewDroid->armour[impact_side][WC_KINETIC] = armourK[impact_side];
|
||||
psNewDroid->armour[impact_side][WC_HEAT] = armourH[impact_side];
|
||||
}
|
||||
psNewDroid->numKills = numKills;
|
||||
psNewDroid->experience = numKills;
|
||||
psNewDroid->direction = direction;
|
||||
if(!(psNewDroid->droidType == DROID_PERSON ||
|
||||
//psNewDroid->droidType == DROID_CYBORG ||
|
||||
|
@ -5548,7 +5545,7 @@ SWORD droidResistance(DROID *psDroid)
|
|||
|
||||
CHECK_DROID(psDroid);
|
||||
|
||||
resistance = (SWORD)(psDroid->numKills * DROID_RESISTANCE_FACTOR);
|
||||
resistance = (SWORD)(psDroid->experience * DROID_RESISTANCE_FACTOR);
|
||||
|
||||
//ensure base minimum in MP before the upgrade effect
|
||||
if (bMultiPlayer)
|
||||
|
|
|
@ -154,7 +154,7 @@ BOOL templateIsIDF(DROID_TEMPLATE *psTemplate);
|
|||
BOOL idfDroid(DROID *psDroid);
|
||||
|
||||
/* Do damage to a droid */
|
||||
extern SDWORD droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
extern float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
|
||||
/* The main update routine for all droids */
|
||||
extern void droidUpdate(DROID *psDroid);
|
||||
|
|
|
@ -163,7 +163,7 @@ typedef struct _droid
|
|||
UDWORD ECMMod;
|
||||
UDWORD originalBody; //the original body points
|
||||
UDWORD body; // the current body points
|
||||
UWORD numKills;
|
||||
float experience;
|
||||
UWORD turretRotation[DROID_MAXWEAPS]; // Watermelon:turretRotation info for multiple turrents :)
|
||||
UWORD turretPitch[DROID_MAXWEAPS]; //* Watermelon:turrentPitch info for multiple turrents :)
|
||||
UBYTE NameVersion; // Version number used for generating on-the-fly names (e.g. Viper Mk "I" would be stored as 1 - Viper Mk "X" as 10) - copied from droid template
|
||||
|
|
|
@ -249,9 +249,9 @@ void featureStatsShutDown(void)
|
|||
* \param psFeature feature to deal damage to
|
||||
* \param damage amount of damage to deal
|
||||
* \param weaponSubClass the subclass of the weapon that deals the damage
|
||||
* \return TRUE when the dealt damage destroys the feature, FALSE when the feature survives
|
||||
* \return < 0 when the dealt damage destroys the feature, > 0 when the feature survives
|
||||
*/
|
||||
SDWORD featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
float featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
{
|
||||
// Do at least one point of damage
|
||||
unsigned int actualDamage = 1;
|
||||
|
@ -281,7 +281,7 @@ SDWORD featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWO
|
|||
if (actualDamage >= psFeature->body)
|
||||
{
|
||||
destroyFeature(psFeature);
|
||||
return (SDWORD) (body / originalBody * -100);
|
||||
return body / originalBody * -1.0f;
|
||||
}
|
||||
|
||||
// Substract the dealt damage from the feature's remaining body points
|
||||
|
@ -290,7 +290,7 @@ SDWORD featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWO
|
|||
// Set last hit-time to <now>
|
||||
psFeature->timeLastHit = gameTime;
|
||||
|
||||
return (SDWORD) ((float) actualDamage / originalBody * 100);
|
||||
return (float) actualDamage / originalBody;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ extern SDWORD getFeatureStatFromName(const char *pName);
|
|||
wreckage to clear*/
|
||||
extern FEATURE * checkForWreckage(DROID *psDroid);
|
||||
|
||||
extern SDWORD featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
extern float featureDamage(FEATURE *psFeature, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
16
src/game.c
16
src/game.c
|
@ -5432,7 +5432,7 @@ static DROID* buildDroidFromSaveDroidV11(SAVE_DROID_V11* psSaveDroid)
|
|||
burnTime = psSaveDroid->burnStart;
|
||||
psDroid->burnStart = burnTime;
|
||||
|
||||
psDroid->numKills = (UWORD)psSaveDroid->numKills;
|
||||
psDroid->experience = (UWORD)psSaveDroid->numKills;
|
||||
//version 11
|
||||
for (i=0; i < psDroid->numWeaps; i++)
|
||||
{
|
||||
|
@ -5568,7 +5568,7 @@ static DROID* buildDroidFromSaveDroidV19(SAVE_DROID_V18* psSaveDroid, UDWORD ver
|
|||
burnTime = psSaveDroid->burnStart;
|
||||
psDroid->burnStart = burnTime;
|
||||
|
||||
psDroid->numKills = (UWORD)psSaveDroid->numKills;
|
||||
psDroid->experience = (UWORD)psSaveDroid->numKills;
|
||||
//version 14
|
||||
psDroid->resistance = droidResistance(psDroid);
|
||||
|
||||
|
@ -5823,7 +5823,7 @@ static DROID* buildDroidFromSaveDroid(SAVE_DROID* psSaveDroid, UDWORD version)
|
|||
burnTime = psSaveDroid->burnStart;
|
||||
psDroid->burnStart = burnTime;
|
||||
|
||||
psDroid->numKills = (UWORD)psSaveDroid->numKills;
|
||||
psDroid->experience = (UWORD)psSaveDroid->numKills;
|
||||
//version 14
|
||||
psDroid->resistance = droidResistance(psDroid);
|
||||
|
||||
|
@ -6113,7 +6113,7 @@ BOOL loadSaveDroidV11(char *pFileData, UDWORD filesize, UDWORD numDroids, UDWORD
|
|||
/* DROID_SAVE_V11 includes OBJECT_SAVE_V19, SAVE_WEAPON_V19 */
|
||||
endian_udword(&psSaveDroid->body);
|
||||
endian_udword(&psSaveDroid->numWeaps);
|
||||
endian_udword(&psSaveDroid->numKills);
|
||||
endian_udword(&psSaveDroid->experience);
|
||||
endian_uword(&psSaveDroid->turretRotation);
|
||||
endian_uword(&psSaveDroid->turretPitch);
|
||||
/* OBJECT_SAVE_V19 */
|
||||
|
@ -6268,7 +6268,7 @@ BOOL loadSaveDroidV19(char *pFileData, UDWORD filesize, UDWORD numDroids, UDWORD
|
|||
endian_udword(&psSaveDroid->body);
|
||||
endian_udword(&psSaveDroid->saveType);
|
||||
endian_udword(&psSaveDroid->numWeaps);
|
||||
endian_udword(&psSaveDroid->numKills);
|
||||
endian_udword(&psSaveDroid->experience);
|
||||
/* OBJECT_SAVE_V19 */
|
||||
endian_udword(&psSaveDroid->id);
|
||||
endian_udword(&psSaveDroid->x);
|
||||
|
@ -6401,7 +6401,7 @@ BOOL loadSaveDroidV(char *pFileData, UDWORD filesize, UDWORD numDroids, UDWORD v
|
|||
endian_udword(&psSaveDroid->body);
|
||||
endian_udword(&psSaveDroid->saveType);
|
||||
endian_udword(&psSaveDroid->numWeaps);
|
||||
endian_udword(&psSaveDroid->numKills);
|
||||
endian_udword(&psSaveDroid->experience);
|
||||
//Watermelon:'hack' to make it read turretRotation,Pitch table properly
|
||||
if( version == CURRENT_VERSION_NUM )
|
||||
{
|
||||
|
@ -6592,7 +6592,7 @@ static BOOL buildSaveDroidFromDroid(SAVE_DROID* psSaveDroid, DROID* psCurr, DROI
|
|||
|
||||
|
||||
//save out experience level
|
||||
psSaveDroid->numKills = psCurr->numKills;
|
||||
psSaveDroid->numKills = psCurr->experience;
|
||||
//version 11
|
||||
//Watermelon:endian_udword for new save format
|
||||
for(i = 0;i < psCurr->numWeaps;i++)
|
||||
|
@ -6808,7 +6808,7 @@ static BOOL buildSaveDroidFromDroid(SAVE_DROID* psSaveDroid, DROID* psCurr, DROI
|
|||
endian_udword(&psSaveDroid->asWeaps[i].ammo);
|
||||
endian_udword(&psSaveDroid->asWeaps[i].lastFired);
|
||||
}
|
||||
endian_udword(&psSaveDroid->numKills);
|
||||
endian_udword(&psSaveDroid->experience);
|
||||
//Watermelon:endian_udword for new save format
|
||||
for(i = 0;i < psSaveDroid->numWeaps;i++)
|
||||
{
|
||||
|
|
|
@ -503,7 +503,7 @@ static void droidSaveTagged(DROID *psDroid)
|
|||
tagWrite(0x08, psDroid->baseSpeed);
|
||||
tagWriteString(0x09, psDroid->aName);
|
||||
tagWrite(0x0a, psDroid->body);
|
||||
tagWrite(0x0b, psDroid->numKills);
|
||||
tagWrite(0x0b, psDroid->experience);
|
||||
tagWrite(0x0c, psDroid->NameVersion);
|
||||
if (psDroid->psTarget)
|
||||
{
|
||||
|
|
|
@ -1506,11 +1506,11 @@ BOOL recvDestroyExtra(NETMSG *pMsg)
|
|||
psKiller = (DROID*)psSrc;
|
||||
#if 0
|
||||
// FIXME: this code *and* the code that sends this message needs to be modified
|
||||
// in such a way that they update psKiller->numKills with the percentage
|
||||
// in such a way that they update psKiller->experience with the percentage
|
||||
// of damage dealt rather than just a kill count.
|
||||
if(psKiller)
|
||||
{
|
||||
psKiller->numKills++;
|
||||
psKiller->experience++;
|
||||
}
|
||||
cmdDroidUpdateKills(psKiller);
|
||||
#endif
|
||||
|
|
|
@ -287,7 +287,7 @@ static void packageCheck(UDWORD i, NETMSG *pMsg, DROID *pD)
|
|||
NetAdd2(pMsg, i+24, pD->orderX);
|
||||
NetAdd2(pMsg, i+26, pD->orderY);
|
||||
}
|
||||
numkills = pD->numKills;
|
||||
numkills = pD->experience;
|
||||
NetAdd2(pMsg, i+28, numkills); // droid kills
|
||||
|
||||
pMsg->size =(UWORD)( pMsg->size + 30);
|
||||
|
@ -435,7 +435,7 @@ static void highLevelDroidUpdate(DROID *psDroid,UDWORD x, UDWORD y,
|
|||
BASE_OBJECT *psTarget,UDWORD numKills)
|
||||
{
|
||||
// update kill rating.
|
||||
psDroid->numKills = (UWORD)numKills;
|
||||
psDroid->experience = (UWORD)numKills;
|
||||
|
||||
// remote droid is attacking, not here tho!
|
||||
if(order == DORDER_ATTACK && psDroid->order != DORDER_ATTACK && psTarget)
|
||||
|
|
|
@ -102,7 +102,7 @@ static void proj_checkBurnDamage( BASE_OBJECT *apsList, PROJECTILE *psProj,
|
|||
FIRE_BOX *pFireBox );
|
||||
static void proj_Free(PROJECTILE *psObj);
|
||||
|
||||
static SDWORD objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
static float objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
static HIT_SIDE getHitSide (PROJECTILE *psObj, BASE_OBJECT *psTarget);
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -260,7 +260,7 @@ static float QualityFactor(DROID *psAttacker, DROID *psVictim)
|
|||
}
|
||||
|
||||
// update the kills after a target is damaged/destroyed
|
||||
static void proj_UpdateKills(PROJECTILE *psObj, SDWORD percentDamage)
|
||||
static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc)
|
||||
{
|
||||
DROID *psDroid;
|
||||
BASE_OBJECT *psSensor;
|
||||
|
@ -274,14 +274,14 @@ static void proj_UpdateKills(PROJECTILE *psObj, SDWORD percentDamage)
|
|||
}
|
||||
|
||||
// If percentDamage is negative then the target was killed
|
||||
if (bMultiPlayer && percentDamage < 0)
|
||||
if (bMultiPlayer && experienceInc < 0.0f)
|
||||
{
|
||||
sendDestroyExtra(psObj->psDest,psObj->psSource);
|
||||
updateMultiStatsKills(psObj->psDest,psObj->psSource->player);
|
||||
}
|
||||
|
||||
// Since we are no longer interested if it was killed or not, abs it
|
||||
percentDamage = abs(percentDamage);
|
||||
experienceInc = fabs(experienceInc);
|
||||
|
||||
if (psObj->psSource->type == OBJ_DROID) /* update droid kills */
|
||||
{
|
||||
|
@ -294,16 +294,16 @@ static void proj_UpdateKills(PROJECTILE *psObj, SDWORD percentDamage)
|
|||
&& bMultiPlayer)
|
||||
{
|
||||
// Modify the experience gained by the 'quality factor' of the units
|
||||
percentDamage *= QualityFactor(psDroid, (DROID *) psObj->psDest);
|
||||
experienceInc *= QualityFactor(psDroid, (DROID *) psObj->psDest);
|
||||
}
|
||||
|
||||
psDroid->numKills += percentDamage;
|
||||
cmdDroidUpdateKills(psDroid, percentDamage);
|
||||
psDroid->experience += experienceInc;
|
||||
cmdDroidUpdateKills(psDroid, experienceInc);
|
||||
|
||||
if (orderStateObj(psDroid, DORDER_FIRESUPPORT, &psSensor)
|
||||
&& psSensor->type == OBJ_DROID)
|
||||
{
|
||||
((DROID *) psSensor)->numKills += percentDamage;
|
||||
((DROID *) psSensor)->experience += experienceInc;
|
||||
}
|
||||
}
|
||||
else if (psObj->psSource->type == OBJ_STRUCTURE)
|
||||
|
@ -315,7 +315,7 @@ static void proj_UpdateKills(PROJECTILE *psObj, SDWORD percentDamage)
|
|||
&& psDroid->action == DACTION_ATTACK
|
||||
&& psDroid->psActionTarget[0] == psObj->psDest)
|
||||
{
|
||||
psDroid->numKills += percentDamage;
|
||||
psDroid->experience += experienceInc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1213,7 +1213,7 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
UDWORD dice;
|
||||
SDWORD tarX0,tarY0, tarX1,tarY1;
|
||||
SDWORD radCubed, xDiff,yDiff;
|
||||
SDWORD percentDamage;
|
||||
float relativeDamage;
|
||||
Vector3i position,scatter;
|
||||
UDWORD damage; //optimisation - were all being calculated twice on PC
|
||||
//Watermelon: tarZ0,tarZ1,zDiff for AA AOE weapons;
|
||||
|
@ -1404,11 +1404,11 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
}
|
||||
|
||||
// Damage the object
|
||||
percentDamage = objectDamage(psObj->psDest,damage , psStats->weaponClass,psStats->weaponSubClass, impactSide);
|
||||
relativeDamage = objectDamage(psObj->psDest,damage , psStats->weaponClass,psStats->weaponSubClass, impactSide);
|
||||
|
||||
proj_UpdateKills(psObj, percentDamage);
|
||||
proj_UpdateKills(psObj, relativeDamage);
|
||||
|
||||
if (percentDamage >= 0) // So long as the target wasn't killed
|
||||
if (relativeDamage >= 0) // So long as the target wasn't killed
|
||||
{
|
||||
setProjectileDamaged(psObj, psObj->psDest);
|
||||
}
|
||||
|
@ -1486,11 +1486,11 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
// since fragment of a project is from the explosion spot not from the projectile start position
|
||||
impactSide = getHitSide(psObj, (BASE_OBJECT *)psCurrD);
|
||||
|
||||
percentDamage = droidDamage(psCurrD, damage, psStats->weaponClass, psStats->weaponSubClass, impactSide);
|
||||
relativeDamage = droidDamage(psCurrD, damage, psStats->weaponClass, psStats->weaponSubClass, impactSide);
|
||||
|
||||
turnOffMultiMsg(FALSE); // multiplay msgs back on.
|
||||
|
||||
proj_UpdateKills(psObj, percentDamage);
|
||||
proj_UpdateKills(psObj, relativeDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1533,12 +1533,12 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
// since fragment of a project is from the explosion spot not from the projectile start position
|
||||
impactSide = getHitSide(psObj, (BASE_OBJECT *)psCurrS);
|
||||
|
||||
percentDamage = structureDamage(psCurrS,
|
||||
relativeDamage = structureDamage(psCurrS,
|
||||
damage,
|
||||
psStats->weaponClass,
|
||||
psStats->weaponSubClass, impactSide);
|
||||
|
||||
proj_UpdateKills(psObj, percentDamage);
|
||||
proj_UpdateKills(psObj, relativeDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1555,12 +1555,12 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
}
|
||||
}
|
||||
|
||||
percentDamage = structureDamage(psCurrS,
|
||||
relativeDamage = structureDamage(psCurrS,
|
||||
damage,
|
||||
psStats->weaponClass,
|
||||
psStats->weaponSubClass, impactSide);
|
||||
|
||||
proj_UpdateKills(psObj, percentDamage);
|
||||
proj_UpdateKills(psObj, relativeDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1598,14 +1598,14 @@ proj_ImpactFunc( PROJECTILE *psObj )
|
|||
// since fragment of a project is from the explosion spot not from the projectile start position
|
||||
impactSide = getHitSide(psObj, (BASE_OBJECT *)psCurrF);
|
||||
|
||||
percentDamage = featureDamage(psCurrF,
|
||||
relativeDamage = featureDamage(psCurrF,
|
||||
calcDamage(weaponRadDamage(psStats, psObj->player),
|
||||
psStats->weaponEffect,
|
||||
(BASE_OBJECT *)psCurrF),
|
||||
psStats->weaponClass,
|
||||
psStats->weaponSubClass, impactSide);
|
||||
|
||||
proj_UpdateKills(psObj, percentDamage);
|
||||
proj_UpdateKills(psObj, relativeDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2023,7 +2023,7 @@ UDWORD calcDamage(UDWORD baseDamage, WEAPON_EFFECT weaponEffect, BASE_OBJECT *ps
|
|||
* - this represents the amount of damage inflicted on the droid by the weapon
|
||||
* in relation to its original health.
|
||||
* - e.g. If 100 points of (*actual*) damage were done to a unit who started
|
||||
* off (when first produced) with 400 points then 25 would be returned.
|
||||
* off (when first produced) with 400 points then .25 would be returned.
|
||||
* - If the actual damage done to a unit is greater than its remaining points
|
||||
* then the actual damage is clipped: so if we did 200 actual points of
|
||||
* damage to a cyborg with 150 points left the actual damage would be taken
|
||||
|
@ -2031,7 +2031,7 @@ UDWORD calcDamage(UDWORD baseDamage, WEAPON_EFFECT weaponEffect, BASE_OBJECT *ps
|
|||
* - Should sufficient damage be done to destroy/kill a unit then the value is
|
||||
* multiplied by -1, resulting in a negative number.
|
||||
*/
|
||||
SDWORD objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
float objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
{
|
||||
switch (psObj->type)
|
||||
{
|
||||
|
|
|
@ -6117,7 +6117,7 @@ BOOL scrTakeOverDroidsInAreaExp(void)
|
|||
(psDroid->droidType != DROID_CYBORG_CONSTRUCT) &&
|
||||
(psDroid->droidType != DROID_CYBORG_REPAIR) &&
|
||||
// ((SDWORD)getDroidLevel(psDroid) <= level) &&
|
||||
((SDWORD)psDroid->numKills <= level) &&
|
||||
((SDWORD)psDroid->experience <= level) &&
|
||||
psDroid->pos.x >= x1 && psDroid->pos.x <= x2 &&
|
||||
psDroid->pos.y >= y1 && psDroid->pos.y <= y2)
|
||||
{
|
||||
|
@ -6422,7 +6422,7 @@ BOOL scrSetDroidKills(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
psDroid->numKills = (UWORD)kills * 100;
|
||||
psDroid->experience = (UWORD)kills * 100;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -6444,7 +6444,7 @@ BOOL scrGetDroidKills(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
scrFunctionResult.v.ival = psDroid->numKills;
|
||||
scrFunctionResult.v.ival = psDroid->experience;
|
||||
if (!stackPushResult(VAL_INT, &scrFunctionResult))
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
@ -1305,9 +1305,9 @@ BOOL structureStatsShutDown(void)
|
|||
* \param damage amount of damage to deal
|
||||
* \param weaponClass the class of the weapon that deals the damage
|
||||
* \param weaponSubClass the subclass of the weapon that deals the damage
|
||||
* \return TRUE when the dealt damage destroys the structure, FALSE when the structure survives
|
||||
* \return < 0 when the dealt damage destroys the structure, > 0 when the structure survives
|
||||
*/
|
||||
SDWORD structureDamage(STRUCTURE *psStructure, UDWORD damage, UDWORD weaponClass,
|
||||
float structureDamage(STRUCTURE *psStructure, UDWORD damage, UDWORD weaponClass,
|
||||
UDWORD weaponSubClass, HIT_SIDE impactSide)
|
||||
{
|
||||
// Do at least one point of damage
|
||||
|
@ -1356,13 +1356,13 @@ SDWORD structureDamage(STRUCTURE *psStructure, UDWORD damage, UDWORD weaponClass
|
|||
{
|
||||
debug( LOG_ATTACK, " DESTROYED\n");
|
||||
destroyStruct(psStructure);
|
||||
return (SDWORD) (body / originalBody * -100);
|
||||
return body / originalBody * -1.0f;
|
||||
}
|
||||
|
||||
// Substract the dealt damage from the structure's remaining body points
|
||||
psStructure->body -= actualDamage;
|
||||
|
||||
return (SDWORD) ((float) actualDamage / originalBody * 100);
|
||||
return (float) actualDamage / originalBody;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ extern BOOL loadStructureStrengthModifiers(const char *pStrengthModData, UDWORD
|
|||
|
||||
extern BOOL structureStatsShutDown(void);
|
||||
|
||||
extern SDWORD structureDamage(STRUCTURE *psStructure, UDWORD damage,
|
||||
extern float structureDamage(STRUCTURE *psStructure, UDWORD damage,
|
||||
UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide);
|
||||
|
||||
/* Set the type of droid for a factory to build */
|
||||
|
|
Loading…
Reference in New Issue