From 7803342ae2123ecc14384212fb3982dcf85637be Mon Sep 17 00:00:00 2001 From: meep-eep Date: Sun, 23 Apr 2006 06:26:32 +0000 Subject: [PATCH] Cleanups. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2319 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/battle.c | 84 +++++++------ sc2/src/sc2code/ipdisp.c | 7 +- sc2/src/sc2code/melee.c | 141 +++++++++++----------- sc2/src/sc2code/melee.h | 4 +- sc2/src/sc2code/ship.c | 4 +- sc2/src/sc2code/ships/melnorme/melnorme.c | 30 ++--- sc2/src/sc2code/weapon.c | 27 ++--- 7 files changed, 144 insertions(+), 153 deletions(-) diff --git a/sc2/src/sc2code/battle.c b/sc2/src/sc2code/battle.c index 7284eb6ba..115228aed 100644 --- a/sc2/src/sc2code/battle.c +++ b/sc2/src/sc2code/battle.c @@ -33,17 +33,55 @@ QUEUE disp_q; SIZE battle_counter; BOOLEAN instantVictory; +static BOOLEAN +RunAwayAllowed (void) +{ + return (LOBYTE (GLOBAL (CurrentActivity)) == IN_ENCOUNTER + || LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) + && GET_GAME_STATE (STARBASE_AVAILABLE) + && !GET_GAME_STATE (BOMB_CARRIER); +} + +static void +DoRunAway (STARSHIPPTR StarShipPtr) +{ + ELEMENTPTR ElementPtr; + + LockElement (StarShipPtr->hShip, &ElementPtr); + if (GetPrimType (&DisplayArray[ElementPtr->PrimIndex]) == STAMP_PRIM + && ElementPtr->life_span == NORMAL_LIFE + && !(ElementPtr->state_flags & FINITE_LIFE) + && ElementPtr->mass_points != MAX_SHIP_MASS * 10 + && !(ElementPtr->state_flags & APPEARING)) + { + extern void flee_preprocess (PELEMENT); + + battle_counter -= MAKE_WORD (1, 0); + + ElementPtr->turn_wait = 3; + ElementPtr->thrust_wait = MAKE_BYTE (4, 0); + ElementPtr->preprocess_func = flee_preprocess; + ElementPtr->mass_points = MAX_SHIP_MASS * 10; + ZeroVelocityComponents (&ElementPtr->velocity); + StarShipPtr->cur_status_flags &= + ~(SHIP_AT_MAX_SPEED | SHIP_BEYOND_MAX_SPEED); + + SetPrimColor (&DisplayArray[ElementPtr->PrimIndex], + BUILD_COLOR (MAKE_RGB15 (0xB, 0x00, 0x00), 0x2E)); + SetPrimType (&DisplayArray[ElementPtr->PrimIndex], STAMPFILL_PRIM); + + CyborgDescPtr->ship_input_state = 0; + } + UnlockElement (StarShipPtr->hShip); +} + static void ProcessInput (void) { BOOLEAN CanRunAway; - CanRunAway = (BOOLEAN)( - (LOBYTE (GLOBAL (CurrentActivity)) == IN_ENCOUNTER - || LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) - && GET_GAME_STATE (STARBASE_AVAILABLE) - && !GET_GAME_STATE (BOMB_CARRIER) - ); + CanRunAway = RunAwayAllowed (); + for (cur_player = NUM_SIDES - 1; cur_player >= 0; --cur_player) { HSTARSHIP hBattleShip, hNextShip; @@ -83,39 +121,7 @@ ProcessInput (void) if (CanRunAway && cur_player == 0 && (InputState & BATTLE_ESCAPE)) - { - ELEMENTPTR ElementPtr; - - LockElement (StarShipPtr->hShip, &ElementPtr); - if (GetPrimType (&DisplayArray[ - ElementPtr->PrimIndex]) == STAMP_PRIM - && ElementPtr->life_span == NORMAL_LIFE - && !(ElementPtr->state_flags & FINITE_LIFE) - && ElementPtr->mass_points != MAX_SHIP_MASS * 10 - && !(ElementPtr->state_flags & APPEARING)) - { - extern void flee_preprocess (PELEMENT); - - battle_counter -= MAKE_WORD (1, 0); - - ElementPtr->turn_wait = 3; - ElementPtr->thrust_wait = MAKE_BYTE (4, 0); - ElementPtr->preprocess_func = flee_preprocess; - ElementPtr->mass_points = MAX_SHIP_MASS * 10; - ZeroVelocityComponents (&ElementPtr->velocity); - StarShipPtr->cur_status_flags &= - ~(SHIP_AT_MAX_SPEED | SHIP_BEYOND_MAX_SPEED); - - SetPrimColor (&DisplayArray[ElementPtr->PrimIndex], - BUILD_COLOR ( - MAKE_RGB15 (0xB, 0x00, 0x00), 0x2E)); - SetPrimType (&DisplayArray[ - ElementPtr->PrimIndex], STAMPFILL_PRIM); - - CyborgDescPtr->ship_input_state = 0; - } - UnlockElement (StarShipPtr->hShip); - } + DoRunAway (StarShipPtr); } } diff --git a/sc2/src/sc2code/ipdisp.c b/sc2/src/sc2code/ipdisp.c index df7d3ebbe..909502411 100644 --- a/sc2/src/sc2code/ipdisp.c +++ b/sc2/src/sc2code/ipdisp.c @@ -838,16 +838,13 @@ DoMissions (void) SHIP_FRAGMENTPTR StarShipPtr; StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip ( - &GLOBAL (npc_built_ship_q), hStarShip - ); + &GLOBAL (npc_built_ship_q), hStarShip); hNextShip = _GetSuccLink (StarShipPtr); if (StarShipPtr->ShipInfo.crew_level) spawn_ip_group (StarShipPtr); - UnlockStarShip ( - &GLOBAL (npc_built_ship_q), hStarShip - ); + UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip); } } diff --git a/sc2/src/sc2code/melee.c b/sc2/src/sc2code/melee.c index 7329f4e7c..124246070 100644 --- a/sc2/src/sc2code/melee.c +++ b/sc2/src/sc2code/melee.c @@ -188,16 +188,16 @@ DrawShipBox (PMELEE_STATE pMS, BOOLEAN HiLite) DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x7, 0x00, 0xC), 0x3E), BUILD_COLOR (MAKE_RGB15 (0xC, 0x00, 0x14), 0x3C), - (BOOLEAN)(StarShip != (BYTE)~0), + (BOOLEAN)(StarShip != MELEE_NONE), BUILD_COLOR (MAKE_RGB15 (0xA, 0x00, 0x11), 0x3D)); else DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x9), 0x56), BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0xE), 0x54), - (BOOLEAN)(StarShip != (BYTE)~0), + (BOOLEAN)(StarShip != MELEE_NONE), BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0xC), 0x55)); - if (StarShip != (BYTE)~0) + if (StarShip != MELEE_NONE) { STAMP s; HSTARSHIP hStarShip; @@ -640,7 +640,7 @@ DrawMeleeShipStrings (PMELEE_STATE pMS, BYTE NewStarShip) SetContextClipRect (&r); BatchGraphics (); - if (NewStarShip == (BYTE)~0) + if (NewStarShip == MELEE_NONE) { RECT r; TEXT t; @@ -704,13 +704,13 @@ GetTeamValue (TEAM_IMAGE *pTI) BYTE StarShip; StarShip = pTI->ShipList[row][col]; - if (StarShip != (BYTE) ~0) + if (StarShip != MELEE_NONE) { HSTARSHIP hStarShip; hStarShip = GetStarShipFromIndex (&master_q, StarShip); if (hStarShip == 0) - pTI->ShipList[row][col] = (BYTE)~0; + pTI->ShipList[row][col] = MELEE_NONE; else { STARSHIPPTR StarShipPtr; @@ -869,7 +869,7 @@ DrawFileStrings (PMELEE_STATE pMS, int HiLiteState) BYTE StarShip; StarShip = pMS->FileList[bot - top].ShipList[row][col]; - if (StarShip != (BYTE)~0) + if (StarShip != MELEE_NONE) { HSTARSHIP hStarShip; STARSHIPPTR StarShipPtr; @@ -1135,7 +1135,7 @@ DeleteCurrentShip (PMELEE_STATE pMS) StarShipPtr->RaceDescPtr->ship_info.ship_cost; UnlockStarShip (&master_q, hStarShip); - pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col] = (BYTE)~0; + pMS->TeamImage[pMS->side].ShipList[pMS->row][pMS->col] = MELEE_NONE; } LockMutex (GraphicsLock); GetShipBox (&r, pMS->side, pMS->row, pMS->col); @@ -1311,7 +1311,7 @@ DoEdit (PMELEE_STATE pMS) pMS->row = row; pMS->col = col; if (row == NUM_MELEE_ROWS) - pMS->CurIndex = (BYTE)~0; + pMS->CurIndex = MELEE_NONE; else pMS->CurIndex = pMS->TeamImage[side].ShipList[row][col]; UnlockMutex (GraphicsLock); @@ -1583,7 +1583,8 @@ BuildAndDrawShipList (PMELEE_STATE pMS) { BYTE StarShip; - if ((StarShip = pMS->TeamImage[i].ShipList[j][k]) != (BYTE)~0) + StarShip = pMS->TeamImage[i].ShipList[j][k]; + if (StarShip != MELEE_NONE) { BYTE ship_cost; HSTARSHIP hStarShip, hBuiltShip; @@ -1823,11 +1824,11 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[0].ShipList[0][6] = MELEE_SPATHI; pMS->PreBuiltList[0].ShipList[1][0] = MELEE_SYREEN; pMS->PreBuiltList[0].ShipList[1][1] = MELEE_UTWIG; - pMS->PreBuiltList[0].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[0].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[0].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[0].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[0].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[0].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[0].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[0].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[0].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[0].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[1].TeamName, sizeof (pMS->PreBuiltList[1].TeamName), @@ -1843,9 +1844,9 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[1].ShipList[1][1] = MELEE_THRADDASH; pMS->PreBuiltList[1].ShipList[1][2] = MELEE_ZOQFOTPIK; pMS->PreBuiltList[1].ShipList[1][3] = MELEE_SHOFIXTI; - pMS->PreBuiltList[1].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[1].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[1].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[1].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[1].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[1].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[2].TeamName, sizeof (pMS->PreBuiltList[2].TeamName), @@ -1861,9 +1862,9 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[2].ShipList[1][1] = MELEE_SPATHI; pMS->PreBuiltList[2].ShipList[1][2] = MELEE_ILWRATH; pMS->PreBuiltList[2].ShipList[1][3] = MELEE_VUX; - pMS->PreBuiltList[2].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[2].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[2].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[2].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[2].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[2].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[3].TeamName, sizeof (pMS->PreBuiltList[3].TeamName), @@ -1878,10 +1879,10 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[3].ShipList[1][0] = MELEE_URQUAN; pMS->PreBuiltList[3].ShipList[1][1] = MELEE_UTWIG; pMS->PreBuiltList[3].ShipList[1][2] = MELEE_UTWIG; - pMS->PreBuiltList[3].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[3].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[3].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[3].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[3].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[3].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[3].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[3].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[4].TeamName, sizeof (pMS->PreBuiltList[4].TeamName), @@ -1898,8 +1899,8 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[4].ShipList[1][2] = MELEE_DRUUGE; pMS->PreBuiltList[4].ShipList[1][3] = MELEE_PKUNK; pMS->PreBuiltList[4].ShipList[1][4] = MELEE_ORZ; - pMS->PreBuiltList[4].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[4].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[4].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[4].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[5].TeamName, sizeof (pMS->PreBuiltList[5].TeamName), @@ -1910,14 +1911,14 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[5].ShipList[0][3] = MELEE_SUPOX; pMS->PreBuiltList[5].ShipList[0][4] = MELEE_UTWIG; pMS->PreBuiltList[5].ShipList[0][5] = MELEE_UMGAH; - pMS->PreBuiltList[5].ShipList[0][6] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][0] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][1] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[5].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[5].ShipList[0][6] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][0] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][1] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[5].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[6].TeamName, sizeof (pMS->PreBuiltList[6].TeamName), @@ -1927,15 +1928,15 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[6].ShipList[0][2] = MELEE_MYCON; pMS->PreBuiltList[6].ShipList[0][3] = MELEE_ORZ; pMS->PreBuiltList[6].ShipList[0][4] = MELEE_URQUAN; - pMS->PreBuiltList[6].ShipList[0][5] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[0][6] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][0] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][1] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[6].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[6].ShipList[0][5] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[0][6] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][0] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][1] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[6].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[7].TeamName, sizeof (pMS->PreBuiltList[7].TeamName), @@ -1950,10 +1951,10 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[7].ShipList[1][0] = MELEE_ORZ; pMS->PreBuiltList[7].ShipList[1][1] = MELEE_PKUNK; pMS->PreBuiltList[7].ShipList[1][2] = MELEE_SPATHI; - pMS->PreBuiltList[7].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[7].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[7].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[7].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[7].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[7].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[7].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[7].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[8].TeamName, sizeof (pMS->PreBuiltList[8].TeamName), @@ -1982,14 +1983,14 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[9].ShipList[0][3] = MELEE_EARTHLING; pMS->PreBuiltList[9].ShipList[0][4] = MELEE_VUX; pMS->PreBuiltList[9].ShipList[0][5] = MELEE_ZOQFOTPIK; - pMS->PreBuiltList[9].ShipList[0][6] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][0] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][1] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[9].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[9].ShipList[0][6] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][0] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][1] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[9].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[10].TeamName, sizeof (pMS->PreBuiltList[10].TeamName), @@ -2019,13 +2020,13 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[11].ShipList[0][4] = MELEE_SHOFIXTI; pMS->PreBuiltList[11].ShipList[0][5] = MELEE_SYREEN; pMS->PreBuiltList[11].ShipList[0][6] = MELEE_YEHAT; - pMS->PreBuiltList[11].ShipList[1][0] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][1] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[11].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[11].ShipList[1][0] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][1] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[11].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[12].TeamName, sizeof (pMS->PreBuiltList[12].TeamName), @@ -2037,13 +2038,13 @@ InitPreBuilt (PMELEE_STATE pMS) pMS->PreBuiltList[12].ShipList[0][4] = MELEE_UMGAH; pMS->PreBuiltList[12].ShipList[0][5] = MELEE_URQUAN; pMS->PreBuiltList[12].ShipList[0][6] = MELEE_VUX; - pMS->PreBuiltList[12].ShipList[1][0] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][1] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][2] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][3] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][4] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][5] = (BYTE)~0; - pMS->PreBuiltList[12].ShipList[1][6] = (BYTE)~0; + pMS->PreBuiltList[12].ShipList[1][0] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][1] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][2] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][3] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][4] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][5] = MELEE_NONE; + pMS->PreBuiltList[12].ShipList[1][6] = MELEE_NONE; utf8StringCopy (pMS->PreBuiltList[13].TeamName, sizeof (pMS->PreBuiltList[13].TeamName), diff --git a/sc2/src/sc2code/melee.h b/sc2/src/sc2code/melee.h index 692275090..18f909b28 100644 --- a/sc2/src/sc2code/melee.h +++ b/sc2/src/sc2code/melee.h @@ -54,7 +54,9 @@ enum MELEE_YEHAT, MELEE_ZOQFOTPIK, - NUM_MELEE_SHIPS + NUM_MELEE_SHIPS, + + MELEE_NONE = (BYTE) ~0 }; #define NUM_MELEE_ROWS 2 diff --git a/sc2/src/sc2code/ship.c b/sc2/src/sc2code/ship.c index 0c0cb42c1..82b62681e 100644 --- a/sc2/src/sc2code/ship.c +++ b/sc2/src/sc2code/ship.c @@ -268,9 +268,7 @@ ship_preprocess (PELEMENT ElementPtr) if (!OBJECT_CLOAKED (ElementPtr) && LOBYTE (GLOBAL (CurrentActivity)) <= IN_ENCOUNTER) { - extern void spawn_ion_trail - (PELEMENT - ElementPtr); + extern void spawn_ion_trail (PELEMENT ElementPtr); spawn_ion_trail (ElementPtr); } diff --git a/sc2/src/sc2code/ships/melnorme/melnorme.c b/sc2/src/sc2code/ships/melnorme/melnorme.c index 11d33a0d5..e1985c095 100644 --- a/sc2/src/sc2code/ships/melnorme/melnorme.c +++ b/sc2/src/sc2code/ships/melnorme/melnorme.c @@ -133,8 +133,7 @@ pump_up_preprocess (PELEMENT ElementPtr) } ElementPtr->next.image.frame = SetAbsFrameIndex ( - ElementPtr->current.image.frame, frame_index - ); + ElementPtr->current.image.frame, frame_index); ElementPtr->state_flags |= CHANGING; } @@ -178,10 +177,10 @@ pump_up_postprocess (PELEMENT ElementPtr) { ++EPtr->turn_wait; EPtr->current.image.frame = SetRelFrameIndex ( - EPtr->current.image.frame, NUM_PUMP_ANIMS - ); + EPtr->current.image.frame, NUM_PUMP_ANIMS); ProcessSound (SetAbsSoundIndex ( - StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 2), EPtr); + StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 2), + EPtr); } EPtr->thrust_wait = LEVEL_COUNTER; } @@ -210,12 +209,10 @@ pump_up_postprocess (PELEMENT ElementPtr) } EPtr->current.image.frame = SetAbsFrameIndex ( - EPtr->current.image.frame, frame_index - ); + EPtr->current.image.frame, frame_index); } - if (StarShipPtr->cur_status_flags - & StarShipPtr->old_status_flags + if (StarShipPtr->cur_status_flags & StarShipPtr->old_status_flags & WEAPON) { StarShipPtr->weapon_counter = WEAPON_WAIT; @@ -240,10 +237,8 @@ pump_up_postprocess (PELEMENT ElementPtr) UnlockElement (hPumpUp); PutElement (hPumpUp); - SetPrimType ( - &(GLOBAL (DisplayArray))[ElementPtr->PrimIndex], - NO_PRIM - ); + SetPrimType (&(GLOBAL (DisplayArray))[ElementPtr->PrimIndex], + NO_PRIM); ElementPtr->state_flags |= NONSOLID; } } @@ -345,8 +340,7 @@ confuse_preprocess (PELEMENT ElementPtr) { ElementPtr->next.image.frame = SetAbsFrameIndex ( ElementPtr->current.image.frame, - (GetFrameIndex (ElementPtr->current.image.frame) + 1) & 7 - ); + (GetFrameIndex (ElementPtr->current.image.frame) + 1) & 7); ElementPtr->state_flags |= CHANGING; } else if (ElementPtr->hTarget == 0) @@ -388,10 +382,8 @@ confuse_preprocess (PELEMENT ElementPtr) eptr->life_span = 1; eptr->current = eptr->next = ElementPtr->next; eptr->preprocess_func = confuse_preprocess; - SetPrimType ( - &(GLOBAL (DisplayArray))[eptr->PrimIndex], - STAMP_PRIM - ); + SetPrimType (&(GLOBAL (DisplayArray))[eptr->PrimIndex], + STAMP_PRIM); GetElementStarShip (ElementPtr, &StarShipPtr); SetElementStarShip (eptr, StarShipPtr); diff --git a/sc2/src/sc2code/weapon.c b/sc2/src/sc2code/weapon.c index 1153d0289..22febccd1 100644 --- a/sc2/src/sc2code/weapon.c +++ b/sc2/src/sc2code/weapon.c @@ -130,11 +130,8 @@ initialize_missile (PMISSILE_BLOCK pMissileBlock) } HELEMENT -weapon_collision (PELEMENT - WeaponElementPtr, PPOINT - pWPt, PELEMENT - HitElementPtr, PPOINT - pHPt) +weapon_collision (PELEMENT WeaponElementPtr, PPOINT pWPt, + PELEMENT HitElementPtr, PPOINT pHPt) { SIZE damage; HELEMENT hBlastElement; @@ -202,21 +199,19 @@ weapon_collision (PELEMENT if ((blast_offs = WeaponElementPtr->blast_offset) > 0) { BlastElementPtr->current.location.x += - COSINE (angle, - DISPLAY_TO_WORLD (blast_offs)); + COSINE (angle, DISPLAY_TO_WORLD (blast_offs)); BlastElementPtr->current.location.y += - SINE (angle, - DISPLAY_TO_WORLD (blast_offs)); + SINE (angle, DISPLAY_TO_WORLD (blast_offs)); } - blast_index = NORMALIZE_FACING ( - ANGLE_TO_FACING (angle + HALF_CIRCLE) - ); - blast_index = ((blast_index >> 2) << 1) + (blast_index & 0x3 ? 1 : 0); + blast_index = + NORMALIZE_FACING (ANGLE_TO_FACING (angle + HALF_CIRCLE)); + blast_index = ((blast_index >> 2) << 1) + + (blast_index & 0x3 ? 1 : 0); - if ((num_blast_frames = - GetFrameCount (WeaponElementPtr->next.image.frame)) <= - ANGLE_TO_FACING (FULL_CIRCLE)) + num_blast_frames = + GetFrameCount (WeaponElementPtr->next.image.frame); + if (num_blast_frames <= ANGLE_TO_FACING (FULL_CIRCLE)) { BlastElementPtr->life_span = 2; BlastElementPtr->current.image.farray = blast;