diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index b2e38477..f55b2342 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -534,27 +534,27 @@ void AddMercToWorld( INT32 iMapIndex ) memset( &gTempBasicPlacement, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - gTempBasicPlacement.bBodyType = -1; + gTempBasicPlacement.ubBodyType = -1; //calculate specific information based on the team. switch( iDrawMode ) { case DRAW_MODE_ENEMY: gTempBasicPlacement.bTeam = ENEMY_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; gTempBasicPlacement.ubSoldierClass = gubSoldierClass; break; case DRAW_MODE_CREATURE: gTempBasicPlacement.bTeam = CREATURE_TEAM; - gTempBasicPlacement.bBodyType = gbCurrCreature; + gTempBasicPlacement.ubBodyType = gbCurrCreature; break; case DRAW_MODE_REBEL: gTempBasicPlacement.bTeam = MILITIA_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; break; case DRAW_MODE_CIVILIAN: gTempBasicPlacement.bTeam = CIV_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; gTempBasicPlacement.ubCivilianGroup = gubCivGroup; if( giCurrentTilesetID == 1 ) //caves { @@ -2119,10 +2119,10 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only for( x = 0; x < iMax; x++ ) { iIndex = pbArray[ x ]; - if( iIndex == gpSelected->pBasicPlacement->bBodyType ) + if( iIndex == gpSelected->pBasicPlacement->ubBodyType ) break; } - Assert( iIndex == gpSelected->pBasicPlacement->bBodyType ); + Assert( iIndex == gpSelected->pBasicPlacement->ubBodyType ); //now we have a match, so go to the next element (depending on offset value) x += bOffset; if( x >= iMax ) @@ -2168,10 +2168,10 @@ void ChangeBodyType( INT8 bOffset ) //+1 or -1 only gpSelected->pSoldier->ConvertAniCodeToAniFrame( 0 ); } //Update the placement's info as well. - gpSelected->pBasicPlacement->bBodyType = (INT8)iIndex; + gpSelected->pBasicPlacement->ubBodyType = (INT8)iIndex; if( gpSelected->pDetailedPlacement ) { - gpSelected->pDetailedPlacement->bBodyType = (INT8)iIndex; + gpSelected->pDetailedPlacement->ubBodyType = (INT8)iIndex; } if( gpSelected->pSoldier->bTeam == CREATURE_TEAM ) { @@ -2473,7 +2473,7 @@ void SetMercEditingMode( UINT8 ubNewMode ) void DisplayBodyTypeInfo() { CHAR16 str[20]; - switch( gpSelected->pBasicPlacement->bBodyType ) + switch( gpSelected->pBasicPlacement->ubBodyType ) { case RANDOM: swprintf( str, pDisplayBodyTypeInfoText[0] ); break; case REGMALE: swprintf( str, pDisplayBodyTypeInfoText[1] ); break; @@ -3756,27 +3756,27 @@ void PasteMercPlacement( INT32 iMapIndex ) memcpy( &gTempBasicPlacement, &gSaveBufferBasicPlacement, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); - gTempBasicPlacement.bBodyType = -1; + gTempBasicPlacement.ubBodyType = -1; //calculate specific information based on the team. switch( iDrawMode ) { case DRAW_MODE_ENEMY: gTempBasicPlacement.bTeam = ENEMY_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; gTempBasicPlacement.ubSoldierClass = gubSoldierClass; break; case DRAW_MODE_CREATURE: gTempBasicPlacement.bTeam = CREATURE_TEAM; - gTempBasicPlacement.bBodyType = gbCurrCreature; + gTempBasicPlacement.ubBodyType = gbCurrCreature; break; case DRAW_MODE_REBEL: gTempBasicPlacement.bTeam = MILITIA_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; break; case DRAW_MODE_CIVILIAN: gTempBasicPlacement.bTeam = CIV_TEAM; - gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubBodyType = RANDOM; gTempBasicPlacement.ubCivilianGroup = gubCivGroup; if( giCurrentTilesetID == 1 ) //caves { diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 44d86826..f68936fe 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -1307,7 +1307,7 @@ void recieveAI (RPCParameters *rpcParameters) new_standard_data.bAgility = send_inv->standard_data.bAgility; new_standard_data.bAIMorale = send_inv->standard_data.bAIMorale; new_standard_data.bAttitude = send_inv->standard_data.bAttitude; - new_standard_data.bBodyType = send_inv->standard_data.bBodyType; + new_standard_data.ubBodyType = send_inv->standard_data.ubBodyType; new_standard_data.bDexterity = send_inv->standard_data.bDexterity; new_standard_data.ubDirection = send_inv->standard_data.ubDirection; new_standard_data.bExpLevel = send_inv->standard_data.bExpLevel; diff --git a/Tactical/Enemy Soldier Save.cpp b/Tactical/Enemy Soldier Save.cpp index 1adf96fe..a008dbac 100644 --- a/Tactical/Enemy Soldier Save.cpp +++ b/Tactical/Enemy Soldier Save.cpp @@ -32,6 +32,7 @@ #include "Game Clock.h" #include "Queen Command.h" #include "Scheduling.h" + #include "Soldier macros.h" // added by Flugente #endif #include "GameVersion.h" @@ -299,7 +300,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile() curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude; - curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType; + curr->pBasicPlacement->ubBodyType = curr->pDetailedPlacement->ubBodyType; curr->pBasicPlacement->fOnRoof = curr->pDetailedPlacement->fOnRoof; curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; @@ -349,9 +350,9 @@ BOOLEAN LoadEnemySoldiersFromTempFile() } break; case SOLDIER_CLASS_TANK: - if( curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) + if ( TANK( curr->pBasicPlacement ) ) { - ubNumTanks++; + ++ubNumTanks; if( ubNumTanks < ubStrategicTanks ) { AddPlacementToWorld( curr ); @@ -915,7 +916,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude; - curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType; + curr->pBasicPlacement->ubBodyType = curr->pDetailedPlacement->ubBodyType; curr->pBasicPlacement->fOnRoof = curr->pDetailedPlacement->fOnRoof; curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; @@ -959,9 +960,9 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() } break; case SOLDIER_CLASS_TANK: - if( curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) + if ( TANK( curr->pBasicPlacement ) ) { - ubNumTanks++; + ++ubNumTanks; if( ubNumTanks <= ubStrategicTanks ) { //def: AddPlacementToWorld( curr ); @@ -1244,7 +1245,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile() curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude; - curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType; + curr->pBasicPlacement->ubBodyType = curr->pDetailedPlacement->ubBodyType; curr->pBasicPlacement->fOnRoof = curr->pDetailedPlacement->fOnRoof; curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; @@ -1610,20 +1611,16 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 ubSectorID; // UINT8 ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0; // UINT8 ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures; - - - + //make sure the variables are initialized *pubNumElites = 0; *pubNumRegulars = 0; *pubNumAdmins = 0; *pubNumTanks = 0; *pubNumCreatures = 0; - - + //STEP ONE: Set up the temp file to read from. - - + //Convert the current sector location into a file name // GetMapFileName( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, zTempName, FALSE ); @@ -1697,8 +1694,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( #endif goto FAIL_LOAD; } - - + FileRead( hfile, &bSectorZ, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) { @@ -1723,7 +1719,6 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( return TRUE; } - if( slots < 0 || slots >= (int)gGameExternalOptions.ubGameMaximumNumberOfEnemies ) { //bad IO! #ifdef JA2TESTVERSION @@ -1759,7 +1754,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( } */ - for( i = 0; i < slots; i++ ) + for( i = 0; i < slots; ++i ) { if ( !tempDetailedPlacement.Load(hfile, gEnemyPreservedTempFileVersion[SECTOR( sSectorX,sSectorY)], true) ) { @@ -1785,7 +1780,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( (*pubNumCreatures)++; break; case SOLDIER_CLASS_TANK: - if( tempDetailedPlacement.bBodyType == TANK_NE || tempDetailedPlacement.bBodyType == TANK_NW ) + if ( TANK( (&tempDetailedPlacement) ) ) { (*pubNumTanks)++; } @@ -1810,7 +1805,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection; curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders; curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude; - curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType; + curr->pBasicPlacement->ubBodyType = curr->pDetailedPlacement->ubBodyType; curr->pBasicPlacement->fOnRoof = curr->pDetailedPlacement->fOnRoof; curr->pBasicPlacement->ubSoldierClass = curr->pDetailedPlacement->ubSoldierClass; curr->pBasicPlacement->ubCivilianGroup = curr->pDetailedPlacement->ubCivilianGroup; @@ -1888,9 +1883,10 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( //various checks failed for hacker validation. If we reach this point, the "error: exit game" //dialog would appear in a non-testversion. FileClose( hfile ); - #ifdef JA2TESTVERSION - AssertMsg( 0, zReason ); - #endif +#ifdef JA2TESTVERSION + AssertMsg( 0, zReason ); +#endif + return FALSE; } diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index 02279f60..8c93f84f 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -76,7 +76,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; - MercCreateStruct.bBodyType = gpUIPlannedSoldier->ubBodyType; + MercCreateStruct.ubBodyType = gpUIPlannedSoldier->ubBodyType; MercCreateStruct.sInsertionGridNo = sGridNo; // Get Grid Corrdinates of mouse @@ -158,7 +158,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; - MercCreateStruct.bBodyType = gpUIPlannedSoldier->ubBodyType; + MercCreateStruct.ubBodyType = gpUIPlannedSoldier->ubBodyType; MercCreateStruct.sInsertionGridNo = sGridNo; // Get Grid Corrdinates of mouse diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 3b6265b0..2bc59cd4 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -2023,7 +2023,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) swprintf( NameStr, zGrod[0] ); } //Legion - else if ( pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW ) + else if ( TANK( pSoldier ) ) { swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); } diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index fa7045c1..45cbc441 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -19,6 +19,7 @@ #include "Game Clock.h" #include "message.h" #include "Tactical Save.h" // added by Flugente + #include "Soldier macros.h" // added by Flugente #endif /* @@ -241,28 +242,24 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 UINT32 i; INT8 bEquipmentModifier; UINT8 ubMaxSpecialWeaponRoll; - - + Assert( pp ); // kids don't get anything 'cause they don't have any weapon animations and the rest is inappropriate - if ( ( pp->bBodyType == HATKIDCIV ) || ( pp->bBodyType == KIDCIV ) ) + if ( ( pp->ubBodyType == HATKIDCIV ) || ( pp->ubBodyType == KIDCIV ) ) { return; } - - - if ( ( pp->bBodyType == TANK_NE ) || ( pp->bBodyType == TANK_NW ) ) + + if ( TANK( pp ) ) { EquipTank( pp ); return; } - Assert( ( bSoldierClass >= SOLDIER_CLASS_NONE ) && ( bSoldierClass <= SOLDIER_CLASS_ELITE_MILITIA ) || bSoldierClass == SOLDIER_CLASS_TANK ); Assert( ( bEquipmentRating >= 0 ) && ( bEquipmentRating <= 4 ) ); - // equipment level is modified by 1/10 of the difficulty percentage, -5, so it's between -5 to +5 // (on normal, this is actually -4 to +4, easy is -5 to +3, and hard is -3 to +5) //bEquipmentModifier = bEquipmentRating + ( ( CalcDifficultyModifier( bSoldierClass ) / 10 ) - 5 ); diff --git a/Tactical/Map Information.cpp b/Tactical/Map Information.cpp index de4fc1a9..ad4a0bda 100644 --- a/Tactical/Map Information.cpp +++ b/Tactical/Map Information.cpp @@ -469,10 +469,10 @@ void UpdateOldVersionMap() while( curr ) { //Bug 11) Convert all wheelchaired placement bodytypes to cows. Result of change in the animation database. - if( curr->pDetailedPlacement && curr->pDetailedPlacement->bBodyType == CRIPPLECIV ) + if( curr->pDetailedPlacement && curr->pDetailedPlacement->ubBodyType == CRIPPLECIV ) { - curr->pDetailedPlacement->bBodyType = COW; - curr->pBasicPlacement->bBodyType = COW; + curr->pDetailedPlacement->ubBodyType = COW; + curr->pBasicPlacement->ubBodyType = COW; } curr = curr->next; } @@ -614,7 +614,7 @@ void UpdateOldVersionMap() if( curr->pBasicPlacement->bTeam == CIV_TEAM && !curr->pDetailedPlacement ) { curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_MINER; - curr->pBasicPlacement->bBodyType = -1; + curr->pBasicPlacement->ubBodyType = -1; } curr = curr->next; } diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 715c425b..bae05cd2 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1164,7 +1164,7 @@ INT16 FindNearestRottingCorpse( SOLDIERTYPE *pSoldier ) void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) { SOLDIERCREATE_STRUCT MercCreateStruct; - INT8 bBodyType = CROW; + INT8 ubBodyType = CROW; UINT8 iNewIndex; INT32 sGridNo; UINT8 ubDirection; @@ -1183,7 +1183,7 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = bBodyType; + MercCreateStruct.ubBodyType = ubBodyType; MercCreateStruct.ubDirection = SOUTH; MercCreateStruct.bTeam = CIV_TEAM; MercCreateStruct.sInsertionGridNo = pCorpse->def.sGridNo; @@ -2717,7 +2717,7 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo ) MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = pCorpse->def.ubBodyType; + MercCreateStruct.ubBodyType = pCorpse->def.ubBodyType; MercCreateStruct.ubDirection = pCorpse->def.ubDirection; MercCreateStruct.fOnRoof = pCorpse->def.bLevel > 0 ? TRUE : FALSE; @@ -2759,7 +2759,7 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo ) } // FIX: something's wrong with the FATCIV-bodytype when dying... this is to ensure they die absolutely fast - //if ( MercCreateStruct.bBodyType == FATCIV ) + //if ( MercCreateStruct.ubBodyType == FATCIV ) //MercCreateStruct.bLifeMax = OKLIFE; MercCreateStruct.bExpLevel = 1; diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 5fa90140..d114beaa 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -45,6 +45,7 @@ #include "math.h" #include "Game Clock.h" // added this one - SANDRO #include "Interface.h" // added by Flugente + #include "Soldier macros.h" // added by Flugente #endif #include "connect.h" @@ -136,7 +137,7 @@ OLD_SOLDIERCREATE_STRUCT_101& OLD_SOLDIERCREATE_STRUCT_101::operator=(SOLDIERCRE this->bAgility = src.bAgility; this->bAIMorale = src.bAIMorale; this->bAttitude = src.bAttitude; - this->bBodyType = src.bBodyType; + this->ubBodyType = src.ubBodyType; this->bDexterity = src.bDexterity; this->ubDirection = src.ubDirection; this->bExpLevel = src.bExpLevel; @@ -209,7 +210,7 @@ SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const OLD_SOLDIERCREATE_ST this->bAgility = src.bAgility; this->bAIMorale = src.bAIMorale; this->bAttitude = src.bAttitude; - this->bBodyType = src.bBodyType; + this->ubBodyType = src.ubBodyType; this->bDexterity = src.bDexterity; this->ubDirection = src.ubDirection; this->bExpLevel = src.bExpLevel; @@ -273,7 +274,7 @@ SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const SOLDIERTYPE& Soldier this->bOrders = Soldier.aiData.bOrders; this->bMorale = Soldier.aiData.bMorale; this->bAIMorale = Soldier.aiData.bAIMorale; - this->bBodyType = Soldier.ubBodyType; + this->ubBodyType = Soldier.ubBodyType; this->ubCivilianGroup = Soldier.ubCivilianGroup; this->ubScheduleID = Soldier.ubScheduleID; this->fHasKeys = Soldier.flags.bHasKeys; @@ -322,7 +323,7 @@ UINT16 SOLDIERCREATE_STRUCT::GetChecksum() this->bWisdom * 11 + this->bMorale * 7 + this->bAIMorale * 3 - - this->bBodyType * 7 + + this->ubBodyType * 7 + 4 * 6 + this->sSectorX * 7 - this->ubSoldierClass * 4 + @@ -370,7 +371,7 @@ SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const _OLD_SOLDIERCREATE_S bAgility = src.bAgility; bAIMorale = src.bAIMorale; bAttitude = src.bAttitude; - bBodyType = src.bBodyType; + ubBodyType = src.ubBodyType; bDexterity = src.bDexterity; ubDirection = src.ubDirection; bExpLevel = src.bExpLevel; @@ -605,7 +606,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * pCreateStruct->fPlayerPlan = 0; } - if ( is_networked && (pCreateStruct->bBodyType == TANK_NW || pCreateStruct->bBodyType == TANK_NE) ) + if ( is_networked && TANK( pCreateStruct ) ) { ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"skipping tank"); return NULL; @@ -680,7 +681,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * else { // LOOK AT BODY TYPE! - switch ( pCreateStruct->bBodyType ) + switch ( pCreateStruct->ubBodyType ) { case REGMALE: case BIGMALE: @@ -1694,7 +1695,7 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT pSoldier->aiData.bMorale = pCreateStruct->bMorale; pSoldier->aiData.bAIMorale = pCreateStruct->bAIMorale; pSoldier->bVocalVolume = MIDVOLUME; - pSoldier->ubBodyType = pCreateStruct->bBodyType; + pSoldier->ubBodyType = pCreateStruct->ubBodyType; pSoldier->ubCivilianGroup = pCreateStruct->ubCivilianGroup; pSoldier->ubScheduleID = pCreateStruct->ubScheduleID; @@ -1703,7 +1704,7 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT // Flugente: soldier profiles // silversurfer: Don't replace tanks! - if ( pCreateStruct->bBodyType != TANK_NE && pCreateStruct->bBodyType != TANK_NW ) + if ( !TANK( pCreateStruct ) ) { // We have a function for this INT8 type = pSoldier->GetSoldierProfileType( pCreateStruct->bTeam ); @@ -2271,7 +2272,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenBasicPlacementInfo: choose body type")); //Choose a body type randomly if none specified. - if( bp->bBodyType < 0 ) + if( bp->ubBodyType < 0 ) { switch ( bp->bTeam ) { @@ -2280,10 +2281,10 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B case MILITIA_TEAM: switch( Random( 4 ) ) { - case 0: pp->bBodyType = REGMALE; break; - case 1: pp->bBodyType = BIGMALE; break; - case 2: pp->bBodyType = STOCKYMALE; break; - case 3: pp->bBodyType = REGFEMALE; break; + case 0: pp->ubBodyType = REGMALE; break; + case 1: pp->ubBodyType = BIGMALE; break; + case 2: pp->ubBodyType = STOCKYMALE; break; + case 3: pp->ubBodyType = REGFEMALE; break; } break; case CIV_TEAM: @@ -2291,9 +2292,9 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B { switch( Random( 3 ) ) { //only strong and fit men can be miners. - case 0: pp->bBodyType = REGMALE; break; - case 1: pp->bBodyType = BIGMALE; break; - case 2: pp->bBodyType = MANCIV; break; + case 0: pp->ubBodyType = REGMALE; break; + case 1: pp->ubBodyType = BIGMALE; break; + case 2: pp->ubBodyType = MANCIV; break; } } else @@ -2302,27 +2303,27 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B iRandom = Random( 100 ); if( iRandom < 8 ) { //8% chance FATCIV - pp->bBodyType = FATCIV; + pp->ubBodyType = FATCIV; } else if( iRandom < 38 ) { //30% chance MANCIV - pp->bBodyType = MANCIV; + pp->ubBodyType = MANCIV; } else if( iRandom < 57 ) { //19% chance MINICIV - pp->bBodyType = MINICIV; + pp->ubBodyType = MINICIV; } else if( iRandom < 76 ) { //19% chance DRESSCIV - pp->bBodyType = DRESSCIV; + pp->ubBodyType = DRESSCIV; } else if( iRandom < 88 ) { //12% chance HATKIDCIV - pp->bBodyType = HATKIDCIV; + pp->ubBodyType = HATKIDCIV; } else { //12% chance KIDCIV - pp->bBodyType = KIDCIV; + pp->ubBodyType = KIDCIV; } } break; @@ -2330,7 +2331,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B } else { - pp->bBodyType = bp->bBodyType; + pp->ubBodyType = bp->ubBodyType; } //Pass over mandatory information specified from the basic placement @@ -2423,7 +2424,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B break; case SOLDIER_CLASS_CREATURE: - switch( bp->bBodyType ) + switch( bp->ubBodyType ) { case LARVAE_MONSTER: pp->bExpLevel = 1 + bExpLevelModifier; @@ -2610,9 +2611,9 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT //Only creatures have mandatory body types specified. if( spp->bTeam == CREATURE_TEAM ) - spp->bBodyType = bp->bBodyType; + spp->ubBodyType = bp->ubBodyType; else - spp->bBodyType = -1; + spp->ubBodyType = -1; //Set up all possible static values. //By setting them all to -1, that signifies that the attribute isn't static. @@ -2685,7 +2686,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( pp->bOrders = bp->bOrders; pp->bAttitude = bp->bAttitude; pp->ubDirection = bp->ubDirection; - pp->bBodyType = bp->bBodyType; + pp->ubBodyType = bp->ubBodyType; pp->bPatrolCnt = bp->bPatrolCnt; memcpy( pp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT32 ) * MAXPATROLGRIDS ); pp->fHasKeys = bp->fHasKeys; @@ -2867,7 +2868,7 @@ void UpdateStaticDetailedPlacementWithProfileInformation( SOLDIERCREATE_STRUCT * spp->bMechanical = pProfile->bMechanical; spp->bExplosive = pProfile->bExplosive; - spp->bBodyType = pProfile->ubBodyType; + spp->ubBodyType = pProfile->ubBodyType; // Copy over inv if we want to UINT32 invsize = pProfile->inv.size(); @@ -3002,7 +3003,7 @@ SOLDIERTYPE* TacticalCreateAdministrator() bp.bTeam = ENEMY_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = -1; + bp.ubBodyType = -1; bp.ubSoldierClass = SOLDIER_CLASS_ADMINISTRATOR; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); pSoldier = TacticalCreateSoldier( &pp, &ubID ); @@ -3035,7 +3036,7 @@ SOLDIERTYPE* TacticalCreateArmyTroop() bp.bTeam = ENEMY_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = -1; + bp.ubBodyType = -1; bp.ubSoldierClass = SOLDIER_CLASS_ARMY; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); pSoldier = TacticalCreateSoldier( &pp, &ubID ); @@ -3069,7 +3070,7 @@ SOLDIERTYPE* TacticalCreateEliteEnemy() bp.bTeam = ENEMY_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = -1; + bp.ubBodyType = -1; bp.ubSoldierClass = SOLDIER_CLASS_ELITE; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); @@ -3113,7 +3114,7 @@ SOLDIERTYPE* TacticalCreateEnemyTank() bp.bTeam = ENEMY_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = TANK_NW; + bp.ubBodyType = TANK_NW; bp.ubSoldierClass = SOLDIER_CLASS_TANK; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); @@ -3154,7 +3155,7 @@ SOLDIERTYPE* TacticalCreateJeep() bp.bTeam = CIV_TEAM; bp.bOrders = STATIONARY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = JEEP; + bp.ubBodyType = JEEP; bp.ubSoldierClass = SOLDIER_CLASS_NONE; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); pp.ubProfile = 199; @@ -3191,7 +3192,7 @@ SOLDIERTYPE* TacticalCreateJeep() bp.bTeam = CREATURE_TEAM;//ZOMBIE_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = AGGRESSIVE; - bp.bBodyType = -1; + bp.ubBodyType = -1; bp.ubSoldierClass = SOLDIER_CLASS_ZOMBIE; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); pSoldier = TacticalCreateSoldier( &pp, &ubID ); @@ -3268,7 +3269,7 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY ) bp.bOrders = STATIONARY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); //bp.bAttitude = AGGRESSIVE; - bp.bBodyType = -1; + bp.ubBodyType = -1; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp, sX, sY ); pSoldier = TacticalCreateSoldier( &pp, &ubID ); @@ -3295,7 +3296,7 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType ) bp.ubSoldierClass = SOLDIER_CLASS_CREATURE; bp.bOrders = SEEKENEMY; bp.bAttitude = AGGRESSIVE; - bp.bBodyType = bCreatureBodyType; + bp.ubBodyType = bCreatureBodyType; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); return TacticalCreateSoldier( &pp, &ubID ); } @@ -3322,7 +3323,7 @@ SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass ) bp.bTeam = CIV_TEAM; bp.bOrders = FARPATROL; bp.bAttitude = (INT8)Random( MAXATTITUDES ); - bp.bBodyType = Random( 4 ); + bp.ubBodyType = Random( 4 ); bp.ubSoldierClass = usSoldierClass; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); @@ -3376,7 +3377,7 @@ SOLDIERTYPE* TacticalCreateEnemyAssassin(UINT8 disguisetype) bp.bTeam = CIV_TEAM; bp.bOrders = SEEKENEMY; bp.bAttitude = (INT8) Random( MAXATTITUDES ); - bp.bBodyType = Random(4); + bp.ubBodyType = Random(4); bp.ubSoldierClass = SOLDIER_CLASS_ELITE; CreateDetailedPlacementGivenBasicPlacementInfo( &pp, &bp ); @@ -3557,7 +3558,7 @@ void CreatePrisonerOfWar() MercCreateStruct.bSectorZ = gbWorldSectorZ; MercCreateStruct.sInsertionGridNo = insertiongridno; MercCreateStruct.ubDirection = Random(NUM_WORLD_DIRECTIONS); - MercCreateStruct.bBodyType = bPowBodyType; + MercCreateStruct.ubBodyType = bPowBodyType; ++bPowBodyType; if ( bPowBodyType > REGFEMALE ) @@ -5321,7 +5322,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre } // MARTIAL ARTS - old traits - if ( (!ATraitAssigned || !BTraitAssigned) && !gGameOptions.fNewTraitSystem && (pCreateStruct->bBodyType == REGMALE) ) + if ( (!ATraitAssigned || !BTraitAssigned) && !gGameOptions.fNewTraitSystem && (pCreateStruct->ubBodyType == REGMALE) ) { // setup basic chances based on soldier type if ( ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA ) diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index 6a48ebb2..e5555d2d 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -71,7 +71,7 @@ typedef struct UINT8 ubDirection; //1 of 8 values (always mandatory) INT8 bOrders; INT8 bAttitude; - INT8 bBodyType; //up to 128 body types, -1 means random + INT8 ubBodyType; //up to 128 body types, -1 means random INT16 sPatrolGrid[OLD_MAXPATROLGRIDS];//dnl ch27 230909 Possible locations to visit, patrol, etc. INT8 bPatrolCnt; BOOLEAN fOnRoof; @@ -93,7 +93,7 @@ public: UINT8 ubDirection; // 1 of 8 values (always mandatory) INT8 bOrders; INT8 bAttitude; - INT8 bBodyType; // Up to 128 body types, -1 means random + INT8 ubBodyType; // Up to 128 body types, -1 means random INT32 sPatrolGrid[MAXPATROLGRIDS]; // Possible locations to visit, patrol, etc. INT8 bPatrolCnt; BOOLEAN fOnRoof; @@ -148,7 +148,7 @@ public: // Can force a team, but needs flag set INT8 bTeam; - INT8 bBodyType; + INT8 ubBodyType; //Orders and attitude settings INT8 bAttitude; @@ -268,7 +268,7 @@ public: // Can force a team, but needs flag set INT8 bTeam; - INT8 bBodyType; + INT8 ubBodyType; //Orders and attitude settings INT8 bAttitude; @@ -354,7 +354,7 @@ public: // Can force a team, but needs flag set INT8 bTeam; - INT8 bBodyType; + INT8 ubBodyType; //Orders and attitude settings INT8 bAttitude; diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 9d194846..ea3913f7 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -58,6 +58,7 @@ #include "Town Militia.h" // added by Flugente #include "PreBattle Interface.h" // added by Flugente #include "LuaInitNPCs.h" // added by Flugente +#include "Soldier macros.h" // added by Flugente BOOLEAN gfOriginalList = TRUE; @@ -227,7 +228,7 @@ BASIC_SOLDIERCREATE_STRUCT& BASIC_SOLDIERCREATE_STRUCT::operator=(const _OLD_BAS ubDirection = src.ubDirection; bOrders = src.bOrders; bAttitude = src.bAttitude; - bBodyType = src.bBodyType; + ubBodyType = src.ubBodyType; bPatrolCnt = src.bPatrolCnt; fOnRoof = src.fOnRoof; ubSoldierClass = src.ubSoldierClass; @@ -268,7 +269,7 @@ BOOLEAN BASIC_SOLDIERCREATE_STRUCT::Save(HWFILE hFile, FLOAT dMajorMapVersion, U OldBasicSoldierCreateStruct.ubDirection = ubDirection; OldBasicSoldierCreateStruct.bOrders = bOrders; OldBasicSoldierCreateStruct.bAttitude = bAttitude; - OldBasicSoldierCreateStruct.bBodyType = bBodyType; + OldBasicSoldierCreateStruct.ubBodyType = ubBodyType; OldBasicSoldierCreateStruct.bPatrolCnt = bPatrolCnt; OldBasicSoldierCreateStruct.fOnRoof = fOnRoof; OldBasicSoldierCreateStruct.ubSoldierClass = ubSoldierClass; @@ -342,7 +343,7 @@ BOOLEAN LoadSoldiersFromMap(INT8** hBuffer, FLOAT dMajorMapVersion, UINT8 ubMino pNode->pBasicPlacement->ubCivilianGroup = gMercProfiles[tempDetailedPlacement.ubProfile].ubCivilianGroup; } } - if(tempBasicPlacement.bBodyType == COW) + if(tempBasicPlacement.ubBodyType == COW) fCowInSector = TRUE; } if(fCowInSector) @@ -590,8 +591,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) // First check if this guy has a profile and if so check his location such that it matches! // Get profile from placement info - if (curr->pBasicPlacement->bBodyType == TANK_NW || - curr->pBasicPlacement->bBodyType == TANK_NE) + if ( TANK( curr->pBasicPlacement ) ) { while (1) { @@ -634,7 +634,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) // CJC, August 18, 1999: don't do this code unless the ice cream truck is on our team if ( FindSoldierByProfileID( ICECREAMTRUCK, TRUE ) != NULL ) { - if( curr->pDetailedPlacement->bBodyType == ICECREAMTRUCK ) + if( curr->pDetailedPlacement->ubBodyType == ICECREAMTRUCK ) { //Check to see if Hamous is here and not recruited. If so, add truck if( gMercProfiles[ HAMOUS ].sSectorX != gWorldSectorX || gMercProfiles[ HAMOUS ].sSectorY != gWorldSectorY || @@ -745,7 +745,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { // Tixa prison, once liberated, should not have any civs without profiles unless // they are kids - if( !StrategicMap[ TIXA_SECTOR_X + TIXA_SECTOR_Y * MAP_WORLD_X ].fEnemyControlled && tempDetailedPlacement.ubProfile == NO_PROFILE && tempDetailedPlacement.bBodyType != HATKIDCIV && tempDetailedPlacement.bBodyType != KIDCIV ) + if( !StrategicMap[ TIXA_SECTOR_X + TIXA_SECTOR_Y * MAP_WORLD_X ].fEnemyControlled && tempDetailedPlacement.ubProfile == NO_PROFILE && tempDetailedPlacement.ubBodyType != HATKIDCIV && tempDetailedPlacement.ubBodyType != KIDCIV ) { // not there return( TRUE ); @@ -755,7 +755,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { if ( CheckFact( FACT_KIDS_ARE_FREE, 0 ) ) { - if ( tempDetailedPlacement.bBodyType == HATKIDCIV || tempDetailedPlacement.bBodyType == KIDCIV ) + if ( tempDetailedPlacement.ubBodyType == HATKIDCIV || tempDetailedPlacement.ubBodyType == KIDCIV ) { // not there any more! kids have been freeeeed! return( TRUE ); @@ -804,12 +804,11 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: create soldier")); - if(is_networked && (tempDetailedPlacement.bBodyType==23 || tempDetailedPlacement.bBodyType==24 || tempDetailedPlacement.fOnRoof==1))return TRUE; - - + if ( is_networked && ( TANK( (&tempDetailedPlacement) ) || tempDetailedPlacement.fOnRoof ) ) + return TRUE; + pSoldier = TacticalCreateSoldier( &tempDetailedPlacement, &ubID ); - - + if( pSoldier ) { curr->pSoldier = pSoldier; @@ -896,7 +895,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) if( curr->pBasicPlacement->bTeam == CIV_TEAM && !curr->pDetailedPlacement ) { curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_MINER; - curr->pBasicPlacement->bBodyType = -1; + curr->pBasicPlacement->ubBodyType = -1; } curr = curr->next; } @@ -1094,7 +1093,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr ubTroopBSlots++; break; case SOLDIER_CLASS_TANK: - if( curr->pDetailedPlacement->bBodyType == TANK_NW ||curr->pDetailedPlacement->bBodyType == TANK_NE ) + if ( TANK( curr->pDetailedPlacement ) ) { if( curr->pBasicPlacement->fPriorityExistance && curr->pDetailedPlacement ) ubTankPDSlots++; @@ -1315,7 +1314,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr else if( iRandom < ubTotalElite + ubTotalTroops + ubTotalAdmin + ubTotalTanks ) { curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_TANK; - curr->pBasicPlacement->bBodyType = TANK_NW; + curr->pBasicPlacement->ubBodyType = TANK_NW; ubTotalTanks--; } else @@ -1406,7 +1405,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr if( !curr->pSoldier && curr->pBasicPlacement->bTeam == ENEMY_TEAM && ubTotalTanks && !GridNoIndoors( curr->pBasicPlacement->usStartingGridNo )) { curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_TANK; - curr->pBasicPlacement->bBodyType = TANK_NW; + curr->pBasicPlacement->ubBodyType = TANK_NW; ubTotalTanks--; if( AddPlacementToWorld( curr ) ) { @@ -1450,7 +1449,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr else if( iRandom < ubTotalElite + ubTotalTroops + ubTotalAdmin + ubTotalTanks ) { curr->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_TANK; - curr->pBasicPlacement->bBodyType = TANK_NW; + curr->pBasicPlacement->ubBodyType = TANK_NW; ubTotalTanks--; } else @@ -1543,18 +1542,18 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl // silversurfer: Replace body type. Militia tanks are not allowed. if( curr->pBasicPlacement->fDetailedPlacement ) { - if( curr->pDetailedPlacement->bBodyType == TANK_NE || curr->pDetailedPlacement->bBodyType == TANK_NW ) + if ( TANK( curr->pDetailedPlacement ) ) { - curr->pBasicPlacement->bBodyType = PreRandom( REGFEMALE + 1 ); + curr->pBasicPlacement->ubBodyType = PreRandom( REGFEMALE + 1 ); // check for better spot next to the tank so the militia doesn't get stuck in the tank INT32 iNewSpot = FindNearestPassableSpot( curr->pBasicPlacement->usStartingGridNo ); if( iNewSpot != NOWHERE) curr->pBasicPlacement->usStartingGridNo = iNewSpot; } } - else if( curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) + else if ( TANK( curr->pBasicPlacement ) ) { - curr->pBasicPlacement->bBodyType = PreRandom( REGFEMALE + 1 ); + curr->pBasicPlacement->ubBodyType = PreRandom( REGFEMALE + 1 ); // check for better spot next to the tank so the militia doesn't get stuck in the tank INT32 iNewSpot = FindNearestPassableSpot( curr->pBasicPlacement->usStartingGridNo ); if( iNewSpot != NOWHERE) @@ -1721,10 +1720,11 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl curr->pBasicPlacement->bTeam = MILITIA_TEAM; curr->pBasicPlacement->bOrders = STATIONARY; curr->pBasicPlacement->bAttitude = (INT8) Random( MAXATTITUDES ); + // silversurfer: Replace body type. Militia tanks are not allowed. - if( curr->pBasicPlacement->bBodyType == TANK_NE || curr->pBasicPlacement->bBodyType == TANK_NW ) + if ( TANK(curr->pBasicPlacement) ) { - curr->pBasicPlacement->bBodyType = PreRandom( REGFEMALE + 1 ); + curr->pBasicPlacement->ubBodyType = PreRandom( REGFEMALE + 1 ); // check for better spot next to the tank so the militia doesn't get stuck in the tank INT32 iNewSpot = FindNearestPassableSpot( curr->pBasicPlacement->usStartingGridNo ); if( iNewSpot != NOWHERE) @@ -1842,7 +1842,7 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum curr = gSoldierInitHead; while( curr ) { - if( !curr->pSoldier && curr->pBasicPlacement->bTeam == CREATURE_TEAM && curr->pBasicPlacement->bBodyType == QUEENMONSTER ) + if( !curr->pSoldier && curr->pBasicPlacement->bTeam == CREATURE_TEAM && curr->pBasicPlacement->ubBodyType == QUEENMONSTER ) { if( !AddPlacementToWorld( curr ) ) { @@ -1869,17 +1869,17 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum if( curr->pBasicPlacement->bTeam == CREATURE_TEAM ) { //Matching team, now check the soldier class... - if( ubNumLarvae && curr->pBasicPlacement->bBodyType == LARVAE_MONSTER ) + if( ubNumLarvae && curr->pBasicPlacement->ubBodyType == LARVAE_MONSTER ) ubNumLarvae--; - else if( ubNumInfants && curr->pBasicPlacement->bBodyType == INFANT_MONSTER ) + else if( ubNumInfants && curr->pBasicPlacement->ubBodyType == INFANT_MONSTER ) ubNumInfants--; - else if( ubNumYoungMales && curr->pBasicPlacement->bBodyType == YAM_MONSTER ) + else if( ubNumYoungMales && curr->pBasicPlacement->ubBodyType == YAM_MONSTER ) ubNumYoungMales--; - else if( ubNumYoungFemales && curr->pBasicPlacement->bBodyType == YAF_MONSTER ) + else if( ubNumYoungFemales && curr->pBasicPlacement->ubBodyType == YAF_MONSTER ) ubNumYoungFemales--; - else if( ubNumAdultMales && curr->pBasicPlacement->bBodyType == AM_MONSTER ) + else if( ubNumAdultMales && curr->pBasicPlacement->ubBodyType == AM_MONSTER ) ubNumAdultMales--; - else if( ubNumAdultFemales && curr->pBasicPlacement->bBodyType == ADULTFEMALEMONSTER ) + else if( ubNumAdultFemales && curr->pBasicPlacement->ubBodyType == ADULTFEMALEMONSTER ) ubNumAdultFemales--; else fDoPlacement = FALSE; @@ -1924,32 +1924,32 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNum if( ubNumLarvae && iRandom < ubNumLarvae ) { ubNumLarvae--; - curr->pBasicPlacement->bBodyType = LARVAE_MONSTER; + curr->pBasicPlacement->ubBodyType = LARVAE_MONSTER; } else if( ubNumInfants && iRandom < ubNumLarvae + ubNumInfants ) { ubNumInfants--; - curr->pBasicPlacement->bBodyType = INFANT_MONSTER; + curr->pBasicPlacement->ubBodyType = INFANT_MONSTER; } else if( ubNumYoungMales && iRandom < ubNumLarvae + ubNumInfants + ubNumYoungMales ) { ubNumYoungMales--; - curr->pBasicPlacement->bBodyType = YAM_MONSTER; + curr->pBasicPlacement->ubBodyType = YAM_MONSTER; } else if( ubNumYoungFemales && iRandom < ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales ) { ubNumYoungFemales--; - curr->pBasicPlacement->bBodyType = YAF_MONSTER; + curr->pBasicPlacement->ubBodyType = YAF_MONSTER; } else if( ubNumAdultMales && iRandom < ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales ) { ubNumAdultMales--; - curr->pBasicPlacement->bBodyType = AM_MONSTER; + curr->pBasicPlacement->ubBodyType = AM_MONSTER; } else if( ubNumAdultFemales && iRandom < ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales ) { ubNumAdultFemales--; - curr->pBasicPlacement->bBodyType = ADULTFEMALEMONSTER; + curr->pBasicPlacement->ubBodyType = ADULTFEMALEMONSTER; } else Assert(0); @@ -2219,7 +2219,7 @@ void AddSoldierInitListBloodcats() curr = gSoldierInitHead; while( curr ) { - if( curr->pBasicPlacement->bBodyType == BLOODCAT ) + if( curr->pBasicPlacement->ubBodyType == BLOODCAT ) { bBloodCatPlacements++; } @@ -2280,7 +2280,7 @@ void AddSoldierInitListBloodcats() curr = gSoldierInitHead; while( curr ) { - if( curr->pBasicPlacement->bBodyType == BLOODCAT && curr->pSoldier ) + if( curr->pBasicPlacement->ubBodyType == BLOODCAT && curr->pSoldier ) ubNumAdded++; //already one here! curr = curr->next; } @@ -2290,7 +2290,7 @@ void AddSoldierInitListBloodcats() //First fill up all of the priority existance slots... while( curr && curr->pBasicPlacement->fPriorityExistance && ubNumAdded < ubMaxNum ) { - if( curr->pBasicPlacement->bBodyType == BLOODCAT ) + if( curr->pBasicPlacement->ubBodyType == BLOODCAT ) { //Matching team, so add this placement. if( AddPlacementToWorld( curr ) ) @@ -2311,7 +2311,7 @@ void AddSoldierInitListBloodcats() ubSlotsToFill = ubMaxNum - ubNumAdded; while( curr && !curr->pSoldier && ubNumAdded < ubMaxNum ) { - if( curr->pBasicPlacement->bBodyType == BLOODCAT ) + if( curr->pBasicPlacement->ubBodyType == BLOODCAT ) ubSlotsAvailable++; curr = curr->next; } @@ -2327,7 +2327,7 @@ void AddSoldierInitListBloodcats() //we have slots available, process the list to add new soldiers. while( curr && !curr->pSoldier && ubNumAdded < ubMaxNum && ubSlotsAvailable ) { - if( curr->pBasicPlacement->bBodyType == BLOODCAT ) + if( curr->pBasicPlacement->ubBodyType == BLOODCAT ) { if( ubSlotsAvailable <= ubSlotsToFill || Random( ubSlotsAvailable ) < ubSlotsToFill ) { @@ -2712,7 +2712,7 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated() curr->pDetailedPlacement = NULL; curr->pBasicPlacement->fDetailedPlacement = FALSE; curr->pBasicPlacement->fPriorityExistance = FALSE; - curr->pBasicPlacement->bBodyType = -1; + curr->pBasicPlacement->ubBodyType = -1; RandomizeRelativeLevel( &( curr->pBasicPlacement->bRelativeAttributeLevel ), curr->pBasicPlacement->ubSoldierClass ); RandomizeRelativeLevel( &( curr->pBasicPlacement->bRelativeEquipmentLevel ), curr->pBasicPlacement->ubSoldierClass ); } diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index e04e0296..7fa9462d 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1703,7 +1703,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) // Create a new one! MercCreateStruct.bTeam = ubTeam; MercCreateStruct.ubProfile = pSoldier->ubProfile; - MercCreateStruct.bBodyType = pSoldier->ubBodyType; + MercCreateStruct.ubBodyType = pSoldier->ubBodyType; MercCreateStruct.sSectorX = pSoldier->sSectorX; MercCreateStruct.sSectorY = pSoldier->sSectorY; MercCreateStruct.bSectorZ = pSoldier->bSectorZ; diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index cc8a937e..587fc91b 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -5068,27 +5068,27 @@ void RandomizeMercProfile() void CreateNextCivType() { - INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; INT32 usMapPos; - static INT8 bBodyType = FATCIV; + static INT8 ubBodyType = FATCIV; + // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &usMapPos ) ) { INT8 iNewIndex; MercCreateStruct.ubProfile = NO_PROFILE; - MercCreateStruct.sSectorX = gWorldSectorX; - MercCreateStruct.sSectorY = gWorldSectorY; - MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = bBodyType; - MercCreateStruct.ubDirection = SOUTH; + MercCreateStruct.sSectorX = gWorldSectorX; + MercCreateStruct.sSectorY = gWorldSectorY; + MercCreateStruct.bSectorZ = gbWorldSectorZ; + MercCreateStruct.ubBodyType = ubBodyType; + MercCreateStruct.ubDirection = SOUTH; - bBodyType++; + ++ubBodyType; - if ( bBodyType > KIDCIV ) + if ( ubBodyType > KIDCIV ) { - bBodyType = FATCIV; + ubBodyType = FATCIV; } MercCreateStruct.bTeam = CIV_TEAM; @@ -5101,7 +5101,6 @@ void CreateNextCivType() // So we can see them! AllTeamsLookForAll(NO_INTERRUPTS); - } } } @@ -5126,21 +5125,21 @@ void ToggleCliffDebug() void CreateCow() { - INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; INT32 usMapPos; + // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &usMapPos ) ) { INT8 iNewIndex; MercCreateStruct.ubProfile = NO_PROFILE; - MercCreateStruct.sSectorX = gWorldSectorX; - MercCreateStruct.sSectorY = gWorldSectorY; - MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = COW; + MercCreateStruct.sSectorX = gWorldSectorX; + MercCreateStruct.sSectorY = gWorldSectorY; + MercCreateStruct.bSectorZ = gbWorldSectorZ; + MercCreateStruct.ubBodyType = COW; //MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; - MercCreateStruct.bTeam = CIV_TEAM; + MercCreateStruct.bTeam = CIV_TEAM; MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); @@ -5150,28 +5149,27 @@ void CreateCow() // So we can see them! AllTeamsLookForAll(NO_INTERRUPTS); - } } } void CreateBloodCat() { - INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; INT32 usMapPos; + // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &usMapPos ) ) { INT8 iNewIndex; MercCreateStruct.ubProfile = NO_PROFILE; - MercCreateStruct.sSectorX = gWorldSectorX; - MercCreateStruct.sSectorY = gWorldSectorY; - MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = BLOODCAT; + MercCreateStruct.sSectorX = gWorldSectorX; + MercCreateStruct.sSectorY = gWorldSectorY; + MercCreateStruct.bSectorZ = gbWorldSectorZ; + MercCreateStruct.ubBodyType = BLOODCAT; //MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; - MercCreateStruct.bTeam = CREATURE_TEAM; + MercCreateStruct.bTeam = CREATURE_TEAM; MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); @@ -5181,29 +5179,28 @@ void CreateBloodCat() // So we can see them! AllTeamsLookForAll(NO_INTERRUPTS); - } } } void CreatePlayerControlledCow() { - INT16 sWorldX, sWorldY; SOLDIERCREATE_STRUCT MercCreateStruct; INT32 usMapPos; + // Get Grid Corrdinates of mouse - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &usMapPos ) ) { INT8 iNewIndex; MercCreateStruct.ubProfile = 12; - MercCreateStruct.sSectorX = gWorldSectorX; - MercCreateStruct.sSectorY = gWorldSectorY; - MercCreateStruct.bSectorZ = gbWorldSectorZ; - MercCreateStruct.bBodyType = COW; + MercCreateStruct.sSectorX = gWorldSectorX; + MercCreateStruct.sSectorY = gWorldSectorY; + MercCreateStruct.bSectorZ = gbWorldSectorZ; + MercCreateStruct.ubBodyType = COW; MercCreateStruct.sInsertionGridNo = usMapPos; - MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; - MercCreateStruct.fPlayerMerc = TRUE; + MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; + MercCreateStruct.fPlayerMerc = TRUE; RandomizeNewSoldierStats( &MercCreateStruct ); @@ -5267,9 +5264,8 @@ void GrenadeTest3() */ void CreatePlayerControlledMonster() { - INT16 sWorldX, sWorldY; INT32 usMapPos; - if ( GetMouseWorldCoordsInCenter( &sWorldX, &sWorldY ) && GetMouseMapPos( &usMapPos ) ) + if ( GetMouseMapPos( &usMapPos ) ) { SOLDIERCREATE_STRUCT MercCreateStruct; INT8 iNewIndex; @@ -5281,10 +5277,10 @@ void CreatePlayerControlledMonster() //Note: only gets called if Alt and/or Ctrl isn't pressed! if ( _KeyDown( INSERT ) ) - MercCreateStruct.bBodyType = QUEENMONSTER; - //MercCreateStruct.bBodyType = LARVAE_MONSTER; + MercCreateStruct.ubBodyType = QUEENMONSTER; + //MercCreateStruct.ubBodyType = LARVAE_MONSTER; else - MercCreateStruct.bBodyType = ADULTFEMALEMONSTER; + MercCreateStruct.ubBodyType = ADULTFEMALEMONSTER; MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); @@ -5372,8 +5368,7 @@ void HandleHandCursorClick( INT32 usMapPos, UINT32 *puiNewEvent ) STRUCTURE *pStructure = NULL; ITEM_POOL *pItemPool; BOOLEAN fIgnoreItems = FALSE; - - + if( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { // If we are out of breath, no cursor... @@ -5877,8 +5872,6 @@ void TestMeanWhile( INT32 iID ) pSoldier->sSectorY = gModSettings.ubMeanwhileInterrogatePOWSectorY; //14 } } - - } ScheduleMeanwhileEvent( &MeanwhileDef, 10 ); diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 2d5b9f92..0bf4da61 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2701,9 +2701,9 @@ BOOLEAN EvaluateWorld(STR8 pSector, UINT8 ubLevel) { if(priority.ubScheduleID) pSummary->ubCivSchedules++; - if(priority.bBodyType == COW) + if(priority.ubBodyType == COW) pSummary->ubCivCows++; - else if(priority.bBodyType == BLOODCAT) + else if(priority.ubBodyType == BLOODCAT) pSummary->ubCivBloodcats++; } } @@ -2751,7 +2751,7 @@ BOOLEAN EvaluateWorld(STR8 pSector, UINT8 ubLevel) } else if(basic.bTeam == CREATURE_TEAM) { - if(basic.bBodyType == BLOODCAT) + if(basic.ubBodyType == BLOODCAT) pTeam->ubNumAnimals++; } pTeam->ubTotal++;