123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- /*
- ===========================================================================
- Doom 3 BFG Edition GPL Source Code
- Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
- This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
- Doom 3 BFG Edition Source Code 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.
- Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
- In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
- If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
- ===========================================================================
- */
- #pragma hdrstop
- #include "../idlib/precompiled.h"
- /*
- ========================
- idSWF::idSWFDictionaryEntry::idSWFDictionaryEntry
- ========================
- */
- idSWFDictionaryEntry::idSWFDictionaryEntry() :
- type( SWF_DICT_NULL ),
- material( NULL ),
- shape( NULL ),
- sprite( NULL ),
- font( NULL ),
- text( NULL ),
- edittext( NULL ),
- imageSize( 0, 0 ),
- imageAtlasOffset( 0, 0 ),
- channelScale( 1.0f, 1.0f, 1.0f, 1.0f ) {
- }
- /*
- ========================
- idSWF::idSWFDictionaryEntry::idSWFDictionaryEntry
- ========================
- */
- idSWFDictionaryEntry::~idSWFDictionaryEntry() {
- delete shape;
- delete sprite;
- delete font;
- delete text;
- delete edittext;
- }
- /*
- ========================
- idSWF::idSWFDictionaryEntry::operator=
- This exists mostly so idList works right
- ========================
- */
- idSWFDictionaryEntry & idSWFDictionaryEntry::operator=( idSWFDictionaryEntry & other ) {
- type = other.type;
- material = other.material;
- shape = other.shape;
- sprite = other.sprite;
- font = other.font;
- text = other.text;
- edittext = other.edittext;
- imageSize = other.imageSize;
- imageAtlasOffset = other.imageAtlasOffset;
- other.type = SWF_DICT_NULL;
- other.material = NULL;
- other.shape = NULL;
- other.sprite = NULL;
- other.font = NULL;
- other.text = NULL;
- other.edittext = NULL;
- return *this;
- }
- /*
- ========================
- idSWF::AddDictionaryEntry
- ========================
- */
- idSWFDictionaryEntry * idSWF::AddDictionaryEntry( int characterID, swfDictType_t type ) {
- if ( dictionary.Num() < characterID + 1 ) {
- dictionary.SetNum( characterID + 1 );
- }
- if ( dictionary[ characterID ].type != SWF_DICT_NULL ) {
- idLib::Warning( "%s: Duplicate character %d", filename.c_str(), characterID );
- return NULL;
- }
- dictionary[ characterID ].type = type;
- if ( ( type == SWF_DICT_SHAPE ) || ( type == SWF_DICT_MORPH ) ) {
- dictionary[ characterID ].shape = new (TAG_SWF) idSWFShape;
- } else if ( type == SWF_DICT_SPRITE ) {
- dictionary[ characterID ].sprite = new (TAG_SWF) idSWFSprite( this );
- } else if ( type == SWF_DICT_FONT ) {
- dictionary[ characterID ].font = new (TAG_SWF) idSWFFont;
- } else if ( type == SWF_DICT_TEXT ) {
- dictionary[ characterID ].text = new (TAG_SWF) idSWFText;
- } else if ( type == SWF_DICT_EDITTEXT ) {
- dictionary[ characterID ].edittext = new (TAG_SWF) idSWFEditText;
- }
- return &dictionary[ characterID ];
- }
- /*
- ========================
- FindDictionaryEntry
- ========================
- */
- idSWFDictionaryEntry * idSWF::FindDictionaryEntry( int characterID, swfDictType_t type ) {
- if ( dictionary.Num() < characterID + 1 ) {
- idLib::Warning( "%s: Could not find character %d", filename.c_str(), characterID );
- return NULL;
- }
- if ( dictionary[ characterID ].type != type ) {
- idLib::Warning( "%s: Character %d is the wrong type", filename.c_str(), characterID );
- return NULL;
- }
- return &dictionary[ characterID ];
- }
- /*
- ========================
- FindDictionaryEntry
- ========================
- */
- idSWFDictionaryEntry * idSWF::FindDictionaryEntry( int characterID ) {
- if ( dictionary.Num() < characterID + 1 ) {
- idLib::Warning( "%s: Could not find character %d", filename.c_str(), characterID );
- return NULL;
- }
- return &dictionary[ characterID ];
- }
|