rem: (((100 * BATTLE_FRAME_RATE * energy_regeneration) / (1 + energy_wait)) + 5) / 10;
add: (((100 * ONE_SECOND * energy_regeneration) / ((1 + energy_wait) * BATTLE_FRAME_RATE)) + 5) / 10;
context: DrawFlagshipStats (void){	RECT r;	TEXT t;	FONT OldFont;	COLOR OldColor;	CONTEXT OldContext;	UNICODE buf[60];	SIZE leading;	BYTE i;	BYTE energy_regeneration, energy_wait, turn_wait;	COUNT max_thrust;	DWORD fuel;	/* collect stats */#define ENERGY_REGENERATION 1#define ENERGY_WAIT 10#define MAX_THRUST 10#define TURN_WAIT 17	energy_regeneration = ENERGY_REGENERATION;	energy_wait = ENERGY_WAIT;	max_thrust = MAX_THRUST;	turn_wait = TURN_WAIT;	fuel = 10 * FUEL_TANK_SCALE;	for (i = 0; i < NUM_MODULE_SLOTS; i++)	{		switch (GLOBAL_SIS (ModuleSlots[i])) {			case FUEL_TANK:				fuel += FUEL_TANK_CAPACITY;				break;			case HIGHEFF_FUELSYS:				fuel += HEFUEL_TANK_CAPACITY;				break;			case DYNAMO_UNIT:				energy_wait -= 2;				if (energy_wait < 4)					energy_wait = 4;				break;			case SHIVA_FURNACE:				energy_regeneration++;				break;		}	}	for (i = 0; i < NUM_DRIVE_SLOTS; ++i)		if (GLOBAL_SIS (DriveSlots[i]) == FUSION_THRUSTER)			max_thrust += 2;	for (i = 0; i < NUM_JET_SLOTS; ++i)		if (GLOBAL_SIS (JetSlots[i]) == TURNING_JETS)			turn_wait -= 2;	/* END collect stats */	OldContext = SetContext (SpaceContext);	OldFont = SetContextFont (StarConFont);	GetContextFontLeading (&leading);	/* we need room to play.  full screen width, 4 lines tall */	r.corner.x = 0;	r.corner.y = SIS_SCREEN_HEIGHT - (4 * leading);	r.extent.width = SIS_SCREEN_WIDTH;	r.extent.height = (4 * leading);	OldColor = SetContextForeGroundColor (BLACK_COLOR);	DrawFilledRectangle (&r);	/*	   now that we've cleared out our playground, compensate for the	   fact that the leading is way more than is generally needed.	*/	leading -= 3;	t.pStr = buf;	t.baseline.x = SIS_SCREEN_WIDTH / 6; //wild-assed guess, but it worked	t.baseline.y = r.corner.y + leading + 3;	t.align = ALIGN_RIGHT;	t.CharCount = (COUNT)~0;	SetContextFontEffect (GRADIENT_EFFECT, 			BUILD_COLOR_RGBA (0x00, 0x00, 0xC0, 0xFF),			BUILD_COLOR_RGBA (0x60, 0x6C, 0xFC, 0xFF));	wsprintf (buf, "nose:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "spread:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "side:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "tail:");	font_DrawText (&t);	t.baseline.x += 5;	t.baseline.y = r.corner.y + leading + 3;	t.align = ALIGN_LEFT;	wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[15])));	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[14])));	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[13])));	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[0])));	font_DrawText (&t);	t.baseline.x = r.extent.width - 25;	t.baseline.y = r.corner.y + leading + 3;	t.align = ALIGN_RIGHT;	SetContextFontEffect (GRADIENT_EFFECT, 			BUILD_COLOR_RGBA (0x00, 0x44, 0x64, 0xFF),			BUILD_COLOR_RGBA (0x58, 0x9C, 0xBC, 0xFF));	wsprintf (buf, "maximum velocity:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "turning rate:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "combat energy:");	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "maximum fuel:");	font_DrawText (&t);	t.baseline.x = r.extent.width - 2;	t.baseline.y = r.corner.y + leading + 3;	wsprintf (buf, "%4u", max_thrust * 4);	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "%4u", 1 + TURN_WAIT - turn_wait);	font_DrawText (&t);	t.baseline.y += leading;	{		unsigned int energy_per_10_sec =				(((100 * BATTLE_FRAME_RATE * energy_regeneration) /				(1 + energy_wait)) + 5) / 10;		wsprintf (buf, "%2u.%1u",				energy_per_10_sec / 10,				energy_per_10_sec % 10);	}	font_DrawText (&t);	t.baseline.y += leading;	wsprintf (buf, "%4lu", (fuel / FUEL_TANK_SCALE));	font_DrawText (&t);	SetContextFontEffect (0, 0, 0);	SetContextForeGroundColor (OldColor);	SetContextFont (OldFont);	SetContext (OldContext);}