From d93f2c14864a197124082f6f0fabe74ef15a11ad Mon Sep 17 00:00:00 2001 From: avolkov Date: Tue, 8 Aug 2006 22:42:53 +0000 Subject: [PATCH] misc code cleanups; from meep git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2403 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/colors.h | 75 +++++++++++++++++++++++++------------- sc2/src/sc2code/ipdisp.c | 4 +- sc2/src/sc2code/pickship.c | 7 ++-- sc2/src/sc2code/ship.c | 4 +- sc2/src/sc2code/util.c | 3 +- 5 files changed, 57 insertions(+), 36 deletions(-) diff --git a/sc2/src/sc2code/colors.h b/sc2/src/sc2code/colors.h index 711c684bc..22f9ac3ef 100644 --- a/sc2/src/sc2code/colors.h +++ b/sc2/src/sc2code/colors.h @@ -17,36 +17,61 @@ #define _COLORS_H -#define BLACK_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) -#define LTGRAY_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07) -#define DKGRAY_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08) -#define WHITE_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) +#define BLACK_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) +#define LTGRAY_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07) +#define DKGRAY_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08) +#define WHITE_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) -#define NORMAL_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) -#define NORMAL_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08) -#define HIGHLIGHT_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x0A), 0x0C) -#define HIGHLIGHT_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) -#define MENU_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07) -#define MENU_FOREGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08) -#define MENU_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) -#define MENU_HIGHLIGHT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +#define NORMAL_ILLUMINATED_COLOR \ + WHITE_COLOR +#define NORMAL_SHADOWED_COLOR \ + DKGRAY_COLOR +#define HIGHLIGHT_ILLUMINATED_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x0A), 0x0C) +#define HIGHLIGHT_SHADOWED_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +#define MENU_BACKGROUND_COLOR \ + LTGRAY_COLOR +#define MENU_FOREGROUND_COLOR \ + DKGRAY_COLOR +#define MENU_TEXT_COLOR \ + BLACK_COLOR +#define MENU_HIGHLIGHT_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) -#define STATUS_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) -#define STATUS_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08) -#define STATUS_SHAPE_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00) -#define STATUS_SHAPE_OUTLINE_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F) +#define STATUS_ILLUMINATED_COLOR \ + WHITE_COLOR +#define STATUS_SHADOWED_COLOR \ + DKGRAY_COLOR +#define STATUS_SHAPE_COLOR \ + BLACK_COLOR +#define STATUS_SHAPE_OUTLINE_COLOR \ + WHITE_COLOR -#define CONTROL_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) +#define CONTROL_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) -#define ALLIANCE_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) -#define HIERARCHY_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) -#define ALLIANCE_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B) -#define HIERARCHY_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E) -#define ALLIANCE_BOX_HIGHLIGHT_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) -#define HIERARCHY_BOX_HIGHLIGHT_COLOR HIERARCHY_BACKGROUND_COLOR +#define ALLIANCE_BACKGROUND_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) +#define HIERARCHY_BACKGROUND_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +#define ALLIANCE_TEXT_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B) +#define HIERARCHY_TEXT_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E) +#define ALLIANCE_BOX_HIGHLIGHT_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) +#define HIERARCHY_BOX_HIGHLIGHT_COLOR \ + HIERARCHY_BACKGROUND_COLOR -#define MESSAGE_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) -#define MESSAGE_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E) +#define MESSAGE_BACKGROUND_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01) +#define MESSAGE_TEXT_COLOR \ + BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E) #endif /* _COLORS_H */ diff --git a/sc2/src/sc2code/ipdisp.c b/sc2/src/sc2code/ipdisp.c index d15c1ea84..8d01f3f49 100644 --- a/sc2/src/sc2code/ipdisp.c +++ b/sc2/src/sc2code/ipdisp.c @@ -690,9 +690,7 @@ flag_ship_preprocess (PELEMENT ElementPtr) SIZE vdx, vdy, radius; POINT pt; - GetCurrentVelocityComponents ( - &GLOBAL (velocity), &vdx, &vdy - ); + GetCurrentVelocityComponents (&GLOBAL (velocity), &vdx, &vdy); if (pSolarSysState->pBaseDesc == pSolarSysState->MoonDesc) { diff --git a/sc2/src/sc2code/pickship.c b/sc2/src/sc2code/pickship.c index 776ffda7a..bf3703f4e 100644 --- a/sc2/src/sc2code/pickship.c +++ b/sc2/src/sc2code/pickship.c @@ -301,9 +301,11 @@ GetEncounterStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player) HSTARSHIP hBattleShip; if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) + // Get the next ship from the battle group. hBattleShip = GetHeadLink (&race_q[which_player]); else if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE) { + // Let the player chose his own ship. (May be a computer player). hBattleShip = GetMeleeStarShip (LastStarShipPtr, which_player); } else @@ -389,13 +391,11 @@ GetEncounterStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player) if (LastStarShipPtr->special_counter == 0) /* died in the line of duty */ GLOBAL_SIS (CrewEnlisted) = (COUNT)~0; -#ifndef TESTING else if (GLOBAL_SIS (FuelOnBoard) > RUN_AWAY_FUEL_COST) GLOBAL_SIS (FuelOnBoard) -= RUN_AWAY_FUEL_COST; else GLOBAL_SIS (FuelOnBoard) = 0; -#endif /* TESTING */ } } } @@ -403,8 +403,7 @@ GetEncounterStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_player) if (hBattleShip) { SPtr = LockStarShip (&race_q[which_player], hBattleShip); - OwnStarShip (SPtr, - SPtr->cur_status_flags, + OwnStarShip (SPtr, SPtr->cur_status_flags, SPtr->captains_name_index); UnlockStarShip (&race_q[which_player], hBattleShip); } diff --git a/sc2/src/sc2code/ship.c b/sc2/src/sc2code/ship.c index 82b62681e..675319bf3 100644 --- a/sc2/src/sc2code/ship.c +++ b/sc2/src/sc2code/ship.c @@ -489,9 +489,7 @@ spawn_ship (STARSHIPPTR StarShipPtr) } BOOLEAN -GetNextStarShip (STARSHIPPTR - LastStarShipPtr, - COUNT which_side) +GetNextStarShip (STARSHIPPTR LastStarShipPtr, COUNT which_side) { HSTARSHIP hBattleShip; diff --git a/sc2/src/sc2code/util.c b/sc2/src/sc2code/util.c index 0bc2a4b7e..6e508f75c 100644 --- a/sc2/src/sc2code/util.c +++ b/sc2/src/sc2code/util.c @@ -104,7 +104,8 @@ SeedRandomNumbers (void) { DWORD cur_time; - TFB_SeedRandom (cur_time = GetTimeCounter ()); + cur_time = GetTimeCounter (); + TFB_SeedRandom (cur_time); return (cur_time); }