| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Combat *
- * *
- * $Archive:: /Commando/Code/Combat/buildingaggregate.cpp $*
- * *
- * Original Author:: Greg Hjelstrom *
- * *
- * $Author:: Bhayes $*
- * *
- * $Modtime:: 1/07/03 1:38p $*
- * *
- * $Revision:: 14 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * BuildingAggregateClass::BuildingAggregateClass -- Constructor *
- * BuildingAggregateClass::BuildingAggregateClass -- Constructor *
- * BuildingAggregateClass::~BuildingAggregateClass -- Destructor *
- * BuildingAggregateClass::Init -- Initialze from a definition *
- * BuildingAggregateClass::Get_Current_State -- returns the current state *
- * BuildingAggregateClass::Set_Current_State -- Sets the current state *
- * BuildingAggregateClass::Is_MCT -- is this aggregate an MCT? *
- * BuildingAggregateClass::Save -- Get the persist factory for this clas *
- * BuildingAggregateClass::Save -- Save the state of this object *
- * BuildingAggregateClass::Load -- Load the state of this object *
- * BuildingAggregateClass::On_Post_Load -- post-load processing *
- * BuildingAggregateDefClass::BuildingAggregateDefClass -- Constructor *
- * BuildingAggregateDefClass::Get_Class_ID -- returns the definition class ID *
- * BuildingAggregateDefClass::Create -- creates an instance of a BuildingAggregateClass *
- * BuildingAggregateDefClass::Get_Factory -- returns the persist factory *
- * BuildingAggregateDefClass::Save -- Saves the contents of this object *
- * BuildingAggregateDefClass::Save_State_Animation_Data -- Save the data for one of the buil *
- * BuildingAggregateDefClass::Load -- Load the contents of this object *
- * BuildingAggregateDefClass::Load_State_Animation_Data -- Load anim data for a building sta *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include "buildingaggregate.h"
- #include "simpledefinitionfactory.h"
- #include "persistfactory.h"
- #include "wwphysids.h"
- #include "hanim.h"
- #include "combat.h"
- #include "wwaudio.h"
- #include "wwdebug.h"
- #include "wwhack.h"
- #include "wwprofile.h"
- DECLARE_FORCE_LINK( buildingaggregate );
- /*************************************************************************************************************
- **
- ** BuildingAggregateClass (BAG) Implementation
- **
- *************************************************************************************************************/
- SimplePersistFactoryClass<BuildingAggregateClass, PHYSICS_CHUNKID_BUILDINGAGGREGATE> _BuildingAggregatePersistFactory;
- enum
- {
- BAG_CHUNK_STATICANIMPHYS = 8281529,
- BAG_CHUNK_VARIABLES,
- BAG_VARIABLE_CURRENTSTATE = 0,
- };
- /***********************************************************************************************
- * BuildingAggregateClass::BuildingAggregateClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
- BuildingAggregateClass::BuildingAggregateClass(void) :
- CurrentState(BuildingStateClass::HEALTH100_POWERON)
- {
- }
- /***********************************************************************************************
- * BuildingAggregateClass::~BuildingAggregateClass -- Destructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- *=============================================================================================*/
- BuildingAggregateClass::~BuildingAggregateClass(void)
- {
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Init -- Initialze from a definition *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- void BuildingAggregateClass::Init(const BuildingAggregateDefClass & def)
- {
- StaticAnimPhysClass::Init(def);
- AnimCollisionManagerClass & anim_mgr = Get_Animation_Manager();
- anim_mgr.Set_Current_Frame(def.Frame0[CurrentState]);
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Get_Current_State -- returns the current state *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/8/2000 gth : Created. *
- *=============================================================================================*/
- int BuildingAggregateClass::Get_Current_State(void)
- {
- return CurrentState;
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Set_Current_State -- Sets the current state *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/8/2000 gth : Created. *
- *=============================================================================================*/
- void BuildingAggregateClass::Set_Current_State(int new_state,bool force_update)
- {
- if ((new_state != CurrentState) || (force_update == true)) {
- AnimCollisionManagerClass & anim_mgr = Get_Animation_Manager();
- const BuildingAggregateDefClass * def = Get_BuildingAggregateDef();
- WWASSERT(def != NULL);
-
- switch (def->AnimLogicMode)
- {
- case BuildingAggregateDefClass::ANIM_LOGIC_LOOP:
- {
- /*
- ** Calculate the fractional position in our current loop
- */
- float normalized_frame = 0.0f;
- float cur_loop_len = def->Frame1[CurrentState] - def->Frame0[CurrentState];
-
- if (cur_loop_len > 0.0f) {
- normalized_frame = (anim_mgr.Get_Current_Frame() - def->Frame0[CurrentState]) /
- (def->Frame1[CurrentState] - def->Frame0[CurrentState]);
- }
- /*
- ** Switch the loop start and end
- */
- anim_mgr.Set_Loop_Start(def->Frame0[new_state]);
- anim_mgr.Set_Loop_End(def->Frame1[new_state]);
- /*
- ** Jump to the same fractional position in the new loop
- */
- anim_mgr.Set_Current_Frame(def->Frame0[new_state] + normalized_frame * (def->Frame1[new_state] - def->Frame0[new_state]));
- /*
- ** If animation is disabled, set the animation mode to manual, otherwise set it to loop
- */
- if (def->AnimationEnabled[new_state] == true) {
- anim_mgr.Set_Animation_Mode(AnimCollisionManagerClass::ANIMATE_LOOP);
- } else {
- anim_mgr.Set_Animation_Mode(AnimCollisionManagerClass::ANIMATE_MANUAL);
- }
- break;
- }
- case BuildingAggregateDefClass::ANIM_LOGIC_LINEAR:
- {
- /*
- ** The new target frame is determined by the new state
- */
- anim_mgr.Set_Target_Frame(def->Frame0[new_state]);
- anim_mgr.Set_Animation_Mode(AnimCollisionManagerClass::ANIMATE_TARGET);
- /*
- ** If we changed power states or animation is disabled, then we need to warp the current frame
- */
- if ( (BuildingStateClass::Is_Power_On(new_state) != BuildingStateClass::Is_Power_On(CurrentState)) ||
- (def->AnimationEnabled[new_state] == false))
- {
- anim_mgr.Set_Current_Frame(def->Frame0[new_state]);
- }
- break;
- }
- case BuildingAggregateDefClass::ANIM_LOGIC_SEQUENCE:
- {
- /*
- ** The current and target frames are determined by the new state. If the new sequence
- ** is the same as the previous sequence, don't do anything.
- */
- if ((def->Frame0[CurrentState] != def->Frame0[new_state]) || (def->Frame1[CurrentState] != def->Frame1[new_state])) {
- anim_mgr.Set_Animation_Mode(AnimCollisionManagerClass::ANIMATE_TARGET);
- anim_mgr.Set_Current_Frame(def->Frame0[new_state]);
- anim_mgr.Set_Target_Frame(def->Frame1[new_state]);
- }
- break;
- }
- }
- CurrentState = new_state;
- }
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Is_MCT -- is this aggregate an MCT? *
- * *
- * MCT's are weak points for the building. The building will use an alternate skin type *
- * when applying damage that was done to the MCT. *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/24/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateClass::Is_MCT(void)
- {
- return Get_BuildingAggregateDef()->IsMCT;
- }
- /*
- ** Save and Load
- */
- /***********************************************************************************************
- * BuildingAggregateClass::Save -- Get the persist factory for this class *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- const PersistFactoryClass & BuildingAggregateClass::Get_Factory(void) const
- {
- return _BuildingAggregatePersistFactory;
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Save -- Save the state of this object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateClass::Save(ChunkSaveClass & csave)
- {
- csave.Begin_Chunk(BAG_CHUNK_STATICANIMPHYS);
- StaticAnimPhysClass::Save(csave);
- csave.End_Chunk();
- csave.Begin_Chunk(BAG_CHUNK_VARIABLES);
- WRITE_MICRO_CHUNK(csave, BAG_VARIABLE_CURRENTSTATE, CurrentState );
- csave.End_Chunk();
- return true;
- }
- /***********************************************************************************************
- * BuildingAggregateClass::Load -- Load the state of this object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateClass::Load( ChunkLoadClass &cload )
- {
- while (cload.Open_Chunk()) {
- switch(cload.Cur_Chunk_ID()) {
- case BAG_CHUNK_STATICANIMPHYS:
- StaticAnimPhysClass::Load( cload );
- break;
-
- case BAG_CHUNK_VARIABLES:
- while (cload.Open_Micro_Chunk()) {
- switch(cload.Cur_Micro_Chunk_ID()) {
- READ_MICRO_CHUNK(cload, BAG_VARIABLE_CURRENTSTATE, CurrentState );
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregate Variable chunkID\n" ));
- break;
- }
- cload.Close_Micro_Chunk();
- }
- break;
- default:
- WWDEBUG_SAY(("Unrecognized BuildingAggregate Chunk: 0x%x in file %s, line %d\n",cload.Cur_Chunk_ID(),__FILE__,__LINE__));
- break;
- }
- cload.Close_Chunk();
- }
- SaveLoadSystemClass::Register_Post_Load_Callback(this);
- return true;
- }
- /***********************************************************************************************
- * BuildingAggregateClass::On_Post_Load -- post-load processing *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 9/8/2000 gth : Created. *
- *=============================================================================================*/
- void BuildingAggregateClass::On_Post_Load(void)
- {
- StaticAnimPhysClass::On_Post_Load();
- Set_Current_State(CurrentState,true);
- }
- /*
- **
- */
- void BuildingAggregateClass::Save_State( ChunkSaveClass & csave )
- {
- csave.Begin_Chunk( BAG_CHUNK_STATICANIMPHYS );
- StaticAnimPhysClass::Save_State(csave);
- csave.End_Chunk();
- csave.Begin_Chunk(BAG_CHUNK_VARIABLES);
- WRITE_MICRO_CHUNK(csave, BAG_VARIABLE_CURRENTSTATE, CurrentState );
- csave.End_Chunk();
- }
- /*
- **
- */
- void BuildingAggregateClass::Load_State( ChunkLoadClass &cload )
- {
- while (cload.Open_Chunk()) {
- switch(cload.Cur_Chunk_ID()) {
- case BAG_CHUNK_STATICANIMPHYS:
- StaticAnimPhysClass::Load_State( cload );
- break;
-
- case BAG_CHUNK_VARIABLES:
- while (cload.Open_Micro_Chunk()) {
- switch(cload.Cur_Micro_Chunk_ID()) {
- READ_MICRO_CHUNK(cload, BAG_VARIABLE_CURRENTSTATE, CurrentState );
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregate Variable chunkID\n" ));
- break;
- }
- cload.Close_Micro_Chunk();
- }
- break;
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregate chunkID\n" ));
- break;
- }
- cload.Close_Chunk();
- }
- }
- /*************************************************************************************************
- **
- ** BuildingAggregateDefClass Implementation
- **
- *************************************************************************************************/
- /*
- ** Persist Factory for BuildingAggregateDefClass, this makes them save and load.
- */
- SimplePersistFactoryClass<BuildingAggregateDefClass, PHYSICS_CHUNKID_BUILDINGAGGREGATEDEF> _BuildingAggregateDefPersistFactory;
- /*
- ** Definition Factory for BuildingAggregateDefClass, this makes them show up in the editor
- */
- DECLARE_DEFINITION_FACTORY(BuildingAggregateDefClass, CLASSID_BUILDINGAGGREGATEDEF, "BuildingAggregate") _BuildingAggregateDefDefFactory;
- /*
- ** Chunk ID's used by BuildingAggregateDefClass
- */
- enum
- {
- BAGDEF_CHUNK_STATICANIMPHYS = 8281441,
- BAGDEF_CHUNK_VARIABLES,
- BAGDEF_CHUNK_HEALTH100_POWERON_VARIABLES,
- BAGDEF_CHUNK_HEALTH75_POWERON_VARIABLES,
- BAGDEF_CHUNK_HEALTH50_POWERON_VARIABLES,
- BAGDEF_CHUNK_HEALTH25_POWERON_VARIABLES,
- BAGDEF_CHUNK_DESTROYED_POWERON_VARIABLES,
- BAGDEF_CHUNK_HEALTH100_POWEROFF_VARIABLES,
- BAGDEF_CHUNK_HEALTH75_POWEROFF_VARIABLES,
- BAGDEF_CHUNK_HEALTH50_POWEROFF_VARIABLES,
- BAGDEF_CHUNK_HEALTH25_POWEROFF_VARIABLES,
- BAGDEF_CHUNK_DESTROYED_POWEROFF_VARIABLES,
- BAGDEF_VARIABLE_ANIMLOGICMODE = 0,
- BAGDEF_VARIABLE_FRAME0,
- BAGDEF_VARIABLE_FRAME1,
- BAGDEF_VARIABLE_ANIMATIONENABLED,
- BAGDEF_VARIABLE_ISMCT,
- };
- /***********************************************************************************************
- * BuildingAggregateDefClass::BuildingAggregateDefClass -- Constructor *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- BuildingAggregateDefClass::BuildingAggregateDefClass( void ) :
- StaticAnimPhysDefClass(),
- AnimLogicMode(ANIM_LOGIC_LOOP),
- IsMCT(false)
- {
- int i;
- for (i=0; i<BuildingStateClass::STATE_COUNT; i++) {
- Frame0[i] = 0;
- Frame1[i] = 0;
- AnimationEnabled[i] = true;
- }
- #ifdef PARAM_EDITING_ON
- PARAM_SEPARATOR(BuildingAggregateDefClass, "Building Behavior Settings");
- EnumParameterClass * anim_logic_param = new EnumParameterClass(&AnimLogicMode);
- anim_logic_param->Set_Name ("AnimLogicMode");
- anim_logic_param->Add_Value("ANIM_LOGIC_LINEAR",ANIM_LOGIC_LINEAR);
- anim_logic_param->Add_Value("ANIM_LOGIC_LOOP",ANIM_LOGIC_LOOP);
- anim_logic_param->Add_Value("ANIM_LOGIC_SEQUENCE",ANIM_LOGIC_SEQUENCE);
- GENERIC_EDITABLE_PARAM( BuildingAggregateDefClass, anim_logic_param);
- EDITABLE_PARAM(BuildingAggregateDefClass, ParameterClass::TYPE_BOOL, IsMCT);
- for (i=0; i<BuildingStateClass::STATE_COUNT; i++) {
-
- PARAM_SEPARATOR(BuildingAggregateDefClass, BuildingStateClass::Get_State_Name(i))
- NAMED_EDITABLE_PARAM(BuildingAggregateDefClass, ParameterClass::TYPE_INT, Frame0[i], "Frame0");
- NAMED_EDITABLE_PARAM(BuildingAggregateDefClass, ParameterClass::TYPE_INT, Frame1[i], "Frame1");
- NAMED_EDITABLE_PARAM(BuildingAggregateDefClass, ParameterClass::TYPE_BOOL, AnimationEnabled[i], "AnimationEnabled");
-
- }
- #endif
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Get_Class_ID -- returns the definition class ID *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- uint32 BuildingAggregateDefClass::Get_Class_ID(void) const
- {
- return CLASSID_BUILDINGAGGREGATEDEF;
- }
- bool BuildingAggregateDefClass::Is_Type(const char * type_name)
- {
- if (stricmp(type_name,BuildingAggregateDefClass::Get_Type_Name()) == 0) {
- return true;
- } else {
- return StaticAnimPhysDefClass::Is_Type(type_name);
- }
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Create -- creates an instance of a BuildingAggregateClass *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- PersistClass * BuildingAggregateDefClass::Create(void) const
- {
- BuildingAggregateClass * obj = new BuildingAggregateClass;
- obj->Init( *this );
- return obj;
- }
- /*
- ** Save and Load
- */
- /***********************************************************************************************
- * BuildingAggregateDefClass::Get_Factory -- returns the persist factory *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- const PersistFactoryClass & BuildingAggregateDefClass::Get_Factory(void) const
- {
- return _BuildingAggregateDefPersistFactory;
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Save -- Saves the contents of this object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateDefClass::Save(ChunkSaveClass & csave)
- {
- csave.Begin_Chunk( BAGDEF_CHUNK_STATICANIMPHYS );
- StaticAnimPhysDefClass::Save( csave );
- csave.End_Chunk();
- csave.Begin_Chunk( BAGDEF_CHUNK_VARIABLES );
- WRITE_MICRO_CHUNK( csave, BAGDEF_VARIABLE_ANIMLOGICMODE, AnimLogicMode );
- WRITE_MICRO_CHUNK( csave, BAGDEF_VARIABLE_ISMCT, IsMCT );
- csave.End_Chunk();
- for (int i=0; i<BuildingStateClass::STATE_COUNT; i++) {
- Save_State_Animation_Data(csave,i);
- }
- return true;
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Save_State_Animation_Data -- Save the data for one of the buildi *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateDefClass::Save_State_Animation_Data(ChunkSaveClass & csave,int state_index)
- {
- WWASSERT(state_index >= 0);
- WWASSERT(state_index < BuildingStateClass::STATE_COUNT);
- csave.Begin_Chunk(BAGDEF_CHUNK_HEALTH100_POWERON_VARIABLES + state_index);
- WRITE_MICRO_CHUNK(csave,BAGDEF_VARIABLE_FRAME0,Frame0[state_index]);
- WRITE_MICRO_CHUNK(csave,BAGDEF_VARIABLE_FRAME1,Frame1[state_index]);
- WRITE_MICRO_CHUNK(csave,BAGDEF_VARIABLE_ANIMATIONENABLED,AnimationEnabled[state_index]);
- csave.End_Chunk();
- return true;
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Load -- Load the contents of this object *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateDefClass::Load( ChunkLoadClass &cload )
- {
- while (cload.Open_Chunk()) {
- switch(cload.Cur_Chunk_ID()) {
- case BAGDEF_CHUNK_STATICANIMPHYS:
- StaticAnimPhysDefClass::Load( cload );
- break;
-
- case BAGDEF_CHUNK_VARIABLES:
- while (cload.Open_Micro_Chunk()) {
- switch(cload.Cur_Micro_Chunk_ID()) {
- READ_MICRO_CHUNK( cload, BAGDEF_VARIABLE_ANIMLOGICMODE,AnimLogicMode );
- READ_MICRO_CHUNK( cload, BAGDEF_VARIABLE_ISMCT, IsMCT );
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregateDef Variable chunkID\n" ));
- break;
- }
- cload.Close_Micro_Chunk();
- }
- break;
-
- case BAGDEF_CHUNK_HEALTH100_POWERON_VARIABLES:
- case BAGDEF_CHUNK_HEALTH75_POWERON_VARIABLES:
- case BAGDEF_CHUNK_HEALTH50_POWERON_VARIABLES:
- case BAGDEF_CHUNK_HEALTH25_POWERON_VARIABLES:
- case BAGDEF_CHUNK_DESTROYED_POWERON_VARIABLES:
- case BAGDEF_CHUNK_HEALTH100_POWEROFF_VARIABLES:
- case BAGDEF_CHUNK_HEALTH75_POWEROFF_VARIABLES:
- case BAGDEF_CHUNK_HEALTH50_POWEROFF_VARIABLES:
- case BAGDEF_CHUNK_HEALTH25_POWEROFF_VARIABLES:
- case BAGDEF_CHUNK_DESTROYED_POWEROFF_VARIABLES:
- Load_State_Animation_Data(cload,cload.Cur_Chunk_ID() - BAGDEF_CHUNK_HEALTH100_POWERON_VARIABLES);
- break;
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregateDef chunkID\n" ));
- break;
- }
- cload.Close_Chunk();
- }
- return true;
- }
- /***********************************************************************************************
- * BuildingAggregateDefClass::Load_State_Animation_Data -- Load anim data for a building state *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 8/29/2000 gth : Created. *
- *=============================================================================================*/
- bool BuildingAggregateDefClass::Load_State_Animation_Data(ChunkLoadClass & cload,int state_index)
- {
- WWASSERT(state_index >= 0);
- WWASSERT(state_index < BuildingStateClass::STATE_COUNT);
- while (cload.Open_Micro_Chunk()) {
- switch(cload.Cur_Micro_Chunk_ID()) {
- READ_MICRO_CHUNK(cload,BAGDEF_VARIABLE_FRAME0,Frame0[state_index]);
- READ_MICRO_CHUNK(cload,BAGDEF_VARIABLE_FRAME1,Frame1[state_index]);
- READ_MICRO_CHUNK(cload,BAGDEF_VARIABLE_ANIMATIONENABLED,AnimationEnabled[state_index]);
- default:
- WWDEBUG_SAY(( "Unrecognized BuildingAggregateDef Variable chunkID\n" ));
- break;
- }
- cload.Close_Micro_Chunk();
- }
- return true;
- }
|