Shipyard "Combat Energy" changed to reflect the recharge rate (bug #522).

Also, some cleanups. Thanks and apologies to Nic.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1384 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2004-06-15 22:23:30 +00:00
parent 93a5344c71
commit 49bb1703d4
2 changed files with 63 additions and 44 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.4: Changes towards version 0.4:
- Shipyard "Combat Energy" changed to reflect the recharge rate (bug #522).
Also, some cleanups. Thanks and apologies to Nic.
- Added lots of debugging functions, SvdB - Added lots of debugging functions, SvdB
- Cleaned up use of the DEBUG define, SvdB - Cleaned up use of the DEBUG define, SvdB
- Talking Pet .txt file corrected to match the .ogg files, - Talking Pet .txt file corrected to match the .ogg files,
+61 -44
View File
@@ -22,6 +22,8 @@
#include "libs/tasklib.h" #include "libs/tasklib.h"
#include "options.h" #include "options.h"
static const UNICODE *describeWeapon (BYTE moduleType);
void void
RepairSISBorder (void) RepairSISBorder (void)
{ {
@@ -410,51 +412,51 @@ DrawFlagshipStats (void)
FONT OldFont; FONT OldFont;
COLOR OldColor; COLOR OldColor;
CONTEXT OldContext; CONTEXT OldContext;
UNICODE buf[60], guns[16][8]; UNICODE buf[60];
SIZE leading; SIZE leading;
BYTE i; BYTE i;
DWORD thrust, turning, dynamo, fuel; BYTE energy_regeneration, energy_wait, turn_wait;
COUNT max_thrust;
DWORD fuel;
/* collect stats */ /* collect stats */
for (i = 0; i < 16; ++i) #define ENERGY_REGENERATION 1
wsprintf (guns[i], "none"); #define ENERGY_WAIT 10
thrust = 40; #define MAX_THRUST 10
turning = 1; #define TURN_WAIT 17
dynamo = 0; energy_regeneration = ENERGY_REGENERATION;
fuel = 1000; 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) for (i = 0; i < NUM_MODULE_SLOTS; i++)
{ {
if (GLOBAL_SIS (ModuleSlots[i]) == DYNAMO_UNIT switch (GLOBAL_SIS (ModuleSlots[i])) {
|| GLOBAL_SIS (ModuleSlots[i]) == SHIVA_FURNACE) case FUEL_TANK:
dynamo += GLOBAL_SIS (ModuleSlots[i]) == DYNAMO_UNIT fuel += FUEL_TANK_CAPACITY;
? 30 : 60; break;
else if (GLOBAL_SIS (ModuleSlots[i]) == FUEL_TANK case HIGHEFF_FUELSYS:
|| GLOBAL_SIS (ModuleSlots[i]) == HIGHEFF_FUELSYS) fuel += HEFUEL_TANK_CAPACITY;
fuel += GLOBAL_SIS (ModuleSlots[i]) == FUEL_TANK break;
? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY; case DYNAMO_UNIT:
else if (GLOBAL_SIS (ModuleSlots[i]) >= GUN_WEAPON energy_wait -= 2;
&& GLOBAL_SIS (ModuleSlots[i]) <= CANNON_WEAPON) if (energy_wait < 4)
{ energy_wait = 4;
if (GLOBAL_SIS (ModuleSlots[i]) == CANNON_WEAPON) break;
wsprintf (guns[i], "cannon"); case SHIVA_FURNACE:
else if (GLOBAL_SIS (ModuleSlots[i]) == BLASTER_WEAPON) energy_regeneration++;
wsprintf (guns[i], "blaster"); break;
else
wsprintf (guns[i], "gun");
} }
else if (GLOBAL_SIS (ModuleSlots[i]) >= BOMB_MODULE_0
&& GLOBAL_SIS (ModuleSlots[i]) <= BOMB_MODULE_5)
wsprintf (guns[i], "n/a");
} }
for (i = 0; i < NUM_DRIVE_SLOTS; ++i) for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
if (GLOBAL_SIS (DriveSlots[i]) == FUSION_THRUSTER) if (GLOBAL_SIS (DriveSlots[i]) == FUSION_THRUSTER)
thrust += 8; max_thrust += 2;
for (i = 0; i < NUM_JET_SLOTS; ++i) for (i = 0; i < NUM_JET_SLOTS; ++i)
if (GLOBAL_SIS (JetSlots[i]) == TURNING_JETS) if (GLOBAL_SIS (JetSlots[i]) == TURNING_JETS)
turning += 2; turn_wait -= 2;
/* END collect stats */ /* END collect stats */
OldContext = SetContext (SpaceContext); OldContext = SetContext (SpaceContext);
@@ -485,10 +487,6 @@ DrawFlagshipStats (void)
BUILD_COLOR_RGBA (0x00, 0x00, 0xC0, 0xFF), BUILD_COLOR_RGBA (0x00, 0x00, 0xC0, 0xFF),
BUILD_COLOR_RGBA (0x60, 0x6C, 0xFC, 0xFF)); BUILD_COLOR_RGBA (0x60, 0x6C, 0xFC, 0xFF));
/* should we pull these strings out of a resource file, to make the
inevitable "let's translate it into Suomi, Klingon and Esperanto"
project easier? */
wsprintf (buf, "nose:"); wsprintf (buf, "nose:");
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
@@ -505,16 +503,16 @@ DrawFlagshipStats (void)
t.baseline.y = r.corner.y + leading + 3; t.baseline.y = r.corner.y + leading + 3;
t.align = ALIGN_LEFT; t.align = ALIGN_LEFT;
wsprintf (buf, "%-7.7s", guns[15]); wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[15])));
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%-7.7s", guns[14]); wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[14])));
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%-7.7s", guns[13]); wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[13])));
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%-7.7s", guns[0]); wsprintf (buf, "%-7.7s", describeWeapon (GLOBAL_SIS (ModuleSlots[0])));
font_DrawText (&t); font_DrawText (&t);
t.baseline.x = r.extent.width - 25; t.baseline.x = r.extent.width - 25;
@@ -540,13 +538,13 @@ DrawFlagshipStats (void)
t.baseline.x = r.extent.width - 2; t.baseline.x = r.extent.width - 2;
t.baseline.y = r.corner.y + leading + 3; t.baseline.y = r.corner.y + leading + 3;
wsprintf (buf, "%4lu", thrust); wsprintf (buf, "%4u", max_thrust * 4);
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%4lu", turning); wsprintf (buf, "%4u", 1 + TURN_WAIT - turn_wait);
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%4lu", dynamo); wsprintf (buf, "%4u", 240 * energy_regeneration / energy_wait);
font_DrawText (&t); font_DrawText (&t);
t.baseline.y += leading; t.baseline.y += leading;
wsprintf (buf, "%4lu", (fuel / FUEL_TANK_SCALE)); wsprintf (buf, "%4lu", (fuel / FUEL_TANK_SCALE));
@@ -556,8 +554,27 @@ DrawFlagshipStats (void)
SetContextForeGroundColor (OldColor); SetContextForeGroundColor (OldColor);
SetContextFont (OldFont); SetContextFont (OldFont);
SetContext (OldContext); SetContext (OldContext);
}
return; static const UNICODE *
describeWeapon (BYTE moduleType) {
switch (moduleType) {
case GUN_WEAPON:
return "gun";
case BLASTER_WEAPON:
return "blaster";
case CANNON_WEAPON:
return "cannon";
case BOMB_MODULE_0:
case BOMB_MODULE_1:
case BOMB_MODULE_2:
case BOMB_MODULE_3:
case BOMB_MODULE_4:
case BOMB_MODULE_5:
return "n/a";
default:
return "none";
}
} }
void void