diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 8781e914f..f5ab7376a 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,6 +1,4 @@ Changes towards version 0.3: -- Ships are not sold unless you set their crew level to SCRAP, (bug - #413), from Paxtez - Prevent Syreen crew above 12 getting thrown out the airlock in Roster screen (bug #184); from chmmravatar, Alex - Lander report messages now use the entire panel (bug #36), from chmmravatar diff --git a/sc2/WhatsNew b/sc2/WhatsNew index 4218bd15e..362adb8c2 100644 --- a/sc2/WhatsNew +++ b/sc2/WhatsNew @@ -18,8 +18,6 @@ Changes are broadly classified into the following categories: NEW FEATURES - PC-style shipyard graphics, complete with animated power lines -- Selling ships in the shipyards has slightly different controls - that make it harder to sell ships accidentally - Main menu displays version number - Added a '-g' option to control gamma correction - Planet spin has been improved diff --git a/sc2/src/sc2code/shipyard.c b/sc2/src/sc2code/shipyard.c index 6f78fe84e..8128cc544 100644 --- a/sc2/src/sc2code/shipyard.c +++ b/sc2/src/sc2code/shipyard.c @@ -298,8 +298,6 @@ ShowShipCrew (SHIP_FRAGMENTPTR StarShipPtr, PRECT pRect) if (StarShipPtr->ShipInfo.crew_level >= TemplatePtr->RaceDescPtr->ship_info.crew_level) wsprintf (buf, "%u", StarShipPtr->ShipInfo.crew_level); - else if (StarShipPtr->ShipInfo.crew_level == 0) - wsprintf (buf, "SCRAP"); else wsprintf (buf, "%u/%u", StarShipPtr->ShipInfo.crew_level, @@ -322,9 +320,7 @@ ShowShipCrew (SHIP_FRAGMENTPTR StarShipPtr, PRECT pRect) SetContextForeGroundColor (BLACK_COLOR); DrawFilledRectangle (&r); } - SetContextForeGroundColor ((StarShipPtr->ShipInfo.crew_level != 0) ? - (BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x00), 0x02)): - (BUILD_COLOR (MAKE_RGB15 (0x12, 0x00, 0x00), 0x2B))); + SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x00), 0x02)); font_DrawText (&t); } @@ -777,8 +773,9 @@ DoModifyShips (PMENU_STATE pMS) DrawMenuStateStrings (PM_CREW, SHIPYARD_CREW); SetSemaphore (GraphicsSem); - DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, - -((int)ShipCost[Index])); + DeltaSISGauges ( + UNDEFINED_DELTA, UNDEFINED_DELTA, -((int)ShipCost[Index]) + ); r.corner.x = pMS->flash_rect0.corner.x; r.corner.y = pMS->flash_rect0.corner.y + pMS->flash_rect0.extent.height - 6; @@ -819,25 +816,7 @@ DoModifyShips (PMENU_STATE pMS) } else if (select || cancel) { - - if (StarShipPtr->ShipInfo.crew_level == 0) - { - SetFlashRect (NULL_PTR, (FRAME)0); - ClearSemaphore (GraphicsSem); - ShowCombatShip ((COUNT)pMS->CurState, StarShipPtr); - SetSemaphore (GraphicsSem); - UnlockStarShip (&GLOBAL (built_ship_q), hStarShip); - RemoveQueue (&GLOBAL (built_ship_q), hStarShip); - FreeStarShip (&GLOBAL (built_ship_q), hStarShip); - r.corner.x = pMS->flash_rect0.corner.x; - r.corner.y = pMS->flash_rect0.corner.y; - r.extent.width = SHIP_WIN_WIDTH; - r.extent.height = SHIP_WIN_HEIGHT; - SetContext (SpaceContext); - SetFlashRect (&r, (FRAME)0); - pMS->delta_item ^= MODIFY_CREW_FLAG; - } - else if (!(pMS->delta_item ^= MODIFY_CREW_FLAG)) + if (!(pMS->delta_item ^= MODIFY_CREW_FLAG)) goto ChangeFlashRect; else if (hStarShip == 0) { @@ -867,7 +846,7 @@ DoModifyShips (PMENU_STATE pMS) ); crew_delta = 0; - if (dy < 0) + if (dx < 0 || dy < 0) { if (hStarShip == 0) { @@ -897,19 +876,17 @@ DoModifyShips (PMENU_STATE pMS) TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip ( &GLOBAL (avail_race_q), hTemplate ); - if (GLOBAL_SIS (ResUnits) >= (DWORD)GLOBAL (CrewCost) + if (GLOBAL_SIS (ResUnits) >= + (DWORD)GLOBAL (CrewCost) + && StarShipPtr->ShipInfo.crew_level < + StarShipPtr->ShipInfo.max_crew && StarShipPtr->ShipInfo.crew_level < - StarShipPtr->ShipInfo.max_crew && - StarShipPtr->ShipInfo.crew_level < TemplatePtr->RaceDescPtr->ship_info.crew_level) { - if (StarShipPtr->ShipInfo.crew_level > 0) - DeltaSISGauges (0, 0, -GLOBAL (CrewCost)); - else - DeltaSISGauges (UNDEFINED_DELTA,UNDEFINED_DELTA, - -(COUNT)ShipCost[GET_RACE_ID (StarShipPtr)]); + DeltaSISGauges (0, 0, -GLOBAL (CrewCost)); ++StarShipPtr->ShipInfo.crew_level; crew_delta = 1; + ShowShipCrew (StarShipPtr, &pMS->flash_rect0); r.corner.x = pMS->flash_rect0.corner.x; r.corner.y = pMS->flash_rect0.corner.y @@ -924,7 +901,7 @@ DoModifyShips (PMENU_STATE pMS) ); } } - else if (dy > 0) + else if (dx > 0 || dy > 0) { crew_bought = (SIZE)MAKE_WORD ( GET_GAME_STATE (CREW_PURCHASED0), @@ -935,8 +912,7 @@ DoModifyShips (PMENU_STATE pMS) if (GetCrewCount ()) { DeltaSISGauges (-1, 0, GLOBAL (CrewCost) - - (crew_bought == - CREW_EXPENSE_THRESHOLD ? 2 : 0)); + - (crew_bought == CREW_EXPENSE_THRESHOLD ? 2 : 0)); crew_delta = -1; GetCPodCapacity (&r.corner); @@ -949,20 +925,13 @@ DoModifyShips (PMENU_STATE pMS) SetContext (SpaceContext); } } - else + else if (StarShipPtr->ShipInfo.crew_level > 1) { - if (StarShipPtr->ShipInfo.crew_level > 0) - { - if (StarShipPtr->ShipInfo.crew_level > 1) - DeltaSISGauges (0, 0, GLOBAL (CrewCost) - - (crew_bought == - CREW_EXPENSE_THRESHOLD ? 2 : 0)); - else - DeltaSISGauges (UNDEFINED_DELTA,UNDEFINED_DELTA, - (COUNT)ShipCost[GET_RACE_ID (StarShipPtr)]); - crew_delta = -1; - --StarShipPtr->ShipInfo.crew_level; - } + DeltaSISGauges (0, 0, GLOBAL (CrewCost) + - (crew_bought == CREW_EXPENSE_THRESHOLD ? 2 : 0)); + crew_delta = -1; + --StarShipPtr->ShipInfo.crew_level; + ShowShipCrew (StarShipPtr, &pMS->flash_rect0); r.corner.x = pMS->flash_rect0.corner.x; r.corner.y = pMS->flash_rect0.corner.y @@ -972,6 +941,53 @@ DoModifyShips (PMENU_STATE pMS) SetContext (SpaceContext); SetFlashRect (&r, (FRAME)0); } + else + { + COUNT ResUnits; + + ResUnits = (COUNT)ShipCost[ + GET_RACE_ID (StarShipPtr) + ]; + crew_delta = -(StarShipPtr->ShipInfo.crew_level - 1); + crew_bought = (SIZE)MAKE_WORD ( + GET_GAME_STATE (CREW_PURCHASED0), + GET_GAME_STATE (CREW_PURCHASED1) + ) - CREW_EXPENSE_THRESHOLD; + if (crew_bought <= 0 || (crew_bought += crew_delta) >= 0) + crew_bought = -crew_delta; + else + { + ResUnits += -crew_bought + * (GLOBAL (CrewCost) - 2); + crew_bought -= crew_delta; + } + ResUnits += crew_bought * GLOBAL (CrewCost); + + SetFlashRect (NULL_PTR, (FRAME)0); + ClearSemaphore (GraphicsSem); + ShowCombatShip ((COUNT)pMS->CurState, StarShipPtr); + SetSemaphore (GraphicsSem); + pMS->flash_rect0.extent.width = SHIP_WIN_WIDTH; + SetFlashRect (&pMS->flash_rect0, (FRAME)0); + + UnlockStarShip ( + &GLOBAL (built_ship_q), hStarShip + ); + + RemoveQueue ( + &GLOBAL (built_ship_q), hStarShip + ); + FreeStarShip ( + &GLOBAL (built_ship_q), hStarShip + ); + + DeltaSISGauges ( + UNDEFINED_DELTA, UNDEFINED_DELTA, ResUnits + ); + hStarShip = 0; + + pMS->delta_item ^= MODIFY_CREW_FLAG; + } } if (hStarShip) @@ -979,10 +995,8 @@ DoModifyShips (PMENU_STATE pMS) UnlockStarShip ( &GLOBAL (built_ship_q), hStarShip ); - if ((pMS->delta_item != MODIFY_CREW_FLAG) - && (pMS->delta_item != 0)) - pMS->delta_item = MODIFY_CREW_FLAG; } + CrewTransaction (crew_delta); } }