Move weaponROF(WEAPON_STATS *psStat) from design.c to stats.c

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1262 4a71c877-e1ca-e34f-864e-861f7616d084
master
Gerard Krol 2007-03-18 00:28:18 +00:00
parent 95552bad16
commit 8a2df06e16
4 changed files with 31 additions and 30 deletions

View File

@ -100,8 +100,6 @@
/***************************************************************************************/
/* Max values for the design bar graphs */
#define DBAR_WEAPMAXROF 240 //700//3500 // maximum shots per minute???
//these are calculated now when the game gets loaded up
//#define DBAR_MAXWEIGHT 3500 // maximum weight for a component
//#define DBAR_SENSORMAXRANGE (30*TILE_UNITS) // maximum sensor range
@ -5679,29 +5677,3 @@ void reverseTemplateList(DROID_TEMPLATE **ppsList)
*ppsList = psPrev;
}
//calculates the weapons ROF based on the fire pause and the salvos
UWORD weaponROF(WEAPON_STATS *psStat)
{
UWORD rof = 0;
//if there are salvos
if (psStat->numRounds)
{
if (psStat->reloadTime != 0)
{
rof = (UWORD)(60 * GAME_TICKS_PER_SEC / psStat->reloadTime);
//multiply by the number of salvos/shot
rof = (UWORD)(rof * psStat->numRounds);
}
}
if (!rof)
{
rof = (UWORD)weaponFirePause(psStat, (UBYTE)selectedPlayer);
if (rof != 0)
{
rof = (UWORD)(60 * GAME_TICKS_PER_SEC / rof);
}
//else leave it at 0
}
return rof;
}

View File

@ -158,6 +158,4 @@ extern void resetDesignPauseState(void);
extern void reverseTemplateList(DROID_TEMPLATE **ppsList);
extern UWORD weaponROF(WEAPON_STATS *psStat);
#endif

View File

@ -28,6 +28,7 @@
#include "lib/framework/frame.h"
#include "lib/framework/strres.h"
#include "lib/framework/frameresource.h"
#include "lib/gamelib/gtime.h"
#include "objects.h"
#include "stats.h"
#include "map.h"
@ -3864,6 +3865,32 @@ UDWORD bodyArmour(BODY_STATS *psStats, UBYTE player, UBYTE bodyType,
return 0; // Should never get here.
}
//calculates the weapons ROF based on the fire pause and the salvos
UWORD weaponROF(WEAPON_STATS *psStat)
{
UWORD rof = 0;
//if there are salvos
if (psStat->numRounds)
{
if (psStat->reloadTime != 0)
{
rof = (UWORD)(60 * GAME_TICKS_PER_SEC / psStat->reloadTime);
//multiply by the number of salvos/shot
rof = (UWORD)(rof * psStat->numRounds);
}
}
if (!rof)
{
rof = (UWORD)weaponFirePause(psStat, (UBYTE)selectedPlayer);
if (rof != 0)
{
rof = (UWORD)(60 * GAME_TICKS_PER_SEC / rof);
}
//else leave it at 0
}
return rof;
}
//Access functions for the max values to be used in the Design Screen
void setMaxComponentWeight(UDWORD weight)

View File

@ -150,6 +150,8 @@ extern BOOL statsAllocProgram(UDWORD numEntries);
/*Allocate Construct Stats*/
extern BOOL statsAllocConstruct(UDWORD numEntries);
extern UWORD weaponROF(WEAPON_STATS *psStat);
/*******************************************************************************
* Load stats functions
*******************************************************************************/
@ -315,6 +317,7 @@ extern PROPULSION_TYPE getPropulsionType(char *pType);
/*returns the weapon effect based on the string name passed in */
extern WEAPON_EFFECT getWeaponEffect(char *pWeaponEffect);
extern UWORD weaponROF(WEAPON_STATS *psStat);
/*Access functions for the upgradeable stats of a weapon*/
extern UDWORD weaponFirePause(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponShortHit(WEAPON_STATS *psStats, UBYTE player);
@ -336,6 +339,7 @@ extern UDWORD constructorPoints(CONSTRUCT_STATS *psStats, UBYTE player);
extern UDWORD bodyPower(BODY_STATS *psStats, UBYTE player, UBYTE bodyType);
extern UDWORD bodyArmour(BODY_STATS *psStats, UBYTE player, UBYTE bodyType,
WEAPON_CLASS weaponClass, int side);
/*dummy function for John*/
extern void brainAvailable(BRAIN_STATS *psStat);