| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- /*
- ** Command & Conquer Generals(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/>.
- */
- /* $Header: /Commando/Code/Tools/max2w3d/skindata.cpp 7 5/28/98 12:15p Greg_h $ */
- /***********************************************************************************************
- *** Confidential - Westwood Studios ***
- ***********************************************************************************************
- * *
- * Project Name : Commando Tools - WWSkin *
- * *
- * $Archive:: /Commando/Code/Tools/max2w3d/skindata.cpp $*
- * *
- * $Author:: Greg_h $*
- * *
- * $Modtime:: 5/28/98 12:15p $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * SkinDataClass::Save -- save the skindata in the MAX file *
- * SkinDataClass::Load -- load the skindata from a MAX file *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include "skindata.h"
- /***********************************************************************************************
- * SkinDataClass::Save -- save the skindata in the MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
- IOResult SkinDataClass::Save(ISave *isave)
- {
- ULONG nb;
- /*
- ** save the flags
- */
- short flags = 0;
- if (Valid) flags |= 0x01;
- if (Held) flags |= 0x02;
- isave->BeginChunk(FLAGS_CHUNK);
- isave->Write(&flags,sizeof(flags),&nb);
- isave->EndChunk();
- /*
- ** Save the bit array of currently selected vertices
- */
- if (VertSel.NumberSet() > 0) {
- isave->BeginChunk(VERT_SEL_CHUNK);
- VertSel.Save(isave);
- isave->EndChunk();
- }
- /*
- ** Save the named selection sets of vertices
- */
- #if 0
- if (VertSelSets.Count() > 0) {
- isave->BeginChunk(INFLUENCE_DATA_CHUNK);
- VertSelSets.Save(isave);
- isave->EndChunk();
- }
- #endif
- /*
- ** Save the vertex influence data
- */
- if (VertData.Count() > 0) {
- isave->BeginChunk(INFLUENCE_DATA_CHUNK);
- isave->Write(VertData.Addr(0),VertData.Count() * sizeof(InfluenceStruct), &nb);
- isave->EndChunk();
- }
- return IO_OK;
- }
- /***********************************************************************************************
- * SkinDataClass::Load -- load the skindata from a MAX file *
- * *
- * INPUT: *
- * *
- * OUTPUT: *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 10/26/1997 GH : Created. *
- *=============================================================================================*/
- IOResult SkinDataClass::Load(ILoad *iload)
- {
- ULONG nb;
- short flags;
- int n;
- IOResult res;
- while (IO_OK == (res=iload->OpenChunk())) {
- switch (iload->CurChunkID()) {
- case FLAGS_CHUNK:
- res = iload->Read(&flags,sizeof(flags),&nb);
- Valid = (flags & 0x01);
- Held = (flags & 0x02);
- break;
-
- case VERT_SEL_CHUNK:
- res = VertSel.Load(iload);
- break;
-
- case NAMED_SEL_SETS_CHUNK:
- res = VertSelSets.Load(iload);
- break;
- case INFLUENCE_DATA_CHUNK:
- n = iload->CurChunkLength() / sizeof(InfluenceStruct);
- VertData.SetCount(n);
- res = iload->Read(VertData.Addr(0),n*sizeof(InfluenceStruct),&nb);
- break;
- }
-
- iload->CloseChunk();
- if (res != IO_OK) {
- return res;
- }
- }
- /*
- ** ensure that the arrays are sized correctly
- */
- Invalidate();
-
- return IO_OK;
- }
|