Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / tile_edit_qt / browser_model.cpp
blob23edc2204d3d44fdfd4000c7250716481cfd0d23
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "common.h"
21 #include "browser_model.h"
23 using namespace std;
24 using namespace NL3D;
25 using namespace NLMISC;
27 extern CTileBank tileBankBrowser;
28 static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
30 static bool loadPic(const string &path, std::vector<NLMISC::CBGRA> &tampon, uint &width, uint &height)
32 try
34 NLMISC::CIFile file;
35 if (file.open(path.c_str()))
37 NLMISC::CBitmap bitmap;
38 bitmap.load(file);
39 width = bitmap.getWidth();
40 height = bitmap.getHeight();
41 tampon.resize(width * height);
42 bitmap.convertToType(NLMISC::CBitmap::RGBA);
43 for (uint y = 0; y < height; ++y)
45 for (uint x = 0; x < width; ++x)
47 NLMISC::CRGBA c = bitmap.getPixelColor(x, y, 0);
48 c.R = (c.R * c.A) / 255;
49 c.G = (c.G * c.A) / 255;
50 c.B = (c.B * c.A) / 255;
51 tampon[(y * width) + x] = c;
54 return true;
57 catch (const NLMISC::Exception& ) { }
58 return false;
61 bool RemovePath (std::string& path, const char* absolutePathToRemplace);
63 // Rotate a buffer
64 void rotateBuffer (std::vector<NLMISC::CBGRA> &Buffer, uint &Width, uint &Height)
66 // Make a copy
67 std::vector<NLMISC::CBGRA> copy = Buffer;
69 // Rotate
70 for (uint y=0; y<Width; y++)
72 // Line offset
73 uint tmp=y*Width;
74 for (uint x=0; x<Width; x++)
76 Buffer[y+(Width-x-1)*Height]=copy[x+tmp];
80 // New size
81 uint tmp=Width;
82 Width=Height;
83 Height=tmp;
86 /////////////////////////////////////////////////////////////////////////////
87 // Load a Pic and apply Alpha & Rotation
88 int loadPixmapBuffer(const std::string& path, std::vector<NLMISC::CBGRA>& Buffer, std::vector<NLMISC::CBGRA>* Alpha, int rot)
90 uint Width;
91 uint Height;
92 if (loadPic(path, Buffer, Width, Height))
94 while (rot)
96 // Rotate the buffer
97 rotateBuffer (Buffer, Width, Height);
98 rot--;
101 if ( (Alpha) && (Alpha->size()==Buffer.size()) )
103 // Pre mul RGB componates by Alpha one
104 int nPixelCount=(int)(Width*Height);
105 for (int p=0; p<nPixelCount; p++)
107 // Invert alpha ?
108 int alpha=(*Alpha)[p].A;
109 Buffer[p].R=(uint8)(((int)Buffer[p].R*alpha)>>8);
110 Buffer[p].G=(uint8)(((int)Buffer[p].G*alpha)>>8);
111 Buffer[p].B=(uint8)(((int)Buffer[p].B*alpha)>>8);
115 return 1;
117 else
118 return 0;
122 /////////////////////////////////////////////////////////////////////////////
123 //TileInfo
126 TileInfo::TileInfo():tileType(UnSet)
128 this->loaded = 0;
129 this->nightLoaded = 0;
130 this->alphaLoaded = 0;
135 TileInfo::TileInfo(int id, TileType tileType):id(id), tileType(tileType)
137 this->loaded = 0;
138 this->nightLoaded = 0;
139 this->alphaLoaded = 0;
142 void TileInfo::Init(int id, TileType tileType)
144 this->id = id;
145 this->tileType = tileType;
146 this->loaded = 0;
147 this->nightLoaded = 0;
148 this->alphaLoaded = 0;
152 bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
154 bool bRes=true;
155 if (!loaded && !getRelativeFileName (Diffuse, index).empty())
157 path = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (Diffuse, index));
161 if ( !loadPixmapBuffer( path, Bits, Alpha, 0))
163 bRes=false;
164 QMessageBox::information( NULL, QObject::tr("Can't load Diffuse file"), QString( (path.c_str()) ));
167 else
168 loaded=1;
170 if (!nightLoaded && !getRelativeFileName (Additive, index).empty())
172 nightPath = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (Additive, index));
173 if (!loadPixmapBuffer( nightPath, nightBits, Alpha, 0))
175 bRes=false;
176 QMessageBox::information( NULL, QObject::tr("Can't load Additive file"), QString( nightPath.c_str() ) );
178 else
179 nightLoaded=1;
181 if (!alphaLoaded && !getRelativeFileName (::Alpha, index).empty())
183 alphaPath = fixPath(tileBankBrowser.getAbsPath() + getRelativeFileName (::Alpha, index));
184 if (!loadPixmapBuffer( alphaPath, alphaBits, NULL, tileBankBrowser.getTile (index)->getRotAlpha ()))
186 bRes=false;
187 QMessageBox::information( NULL, QObject::tr("Can't load Alpha file"), QString( alphaPath.c_str() ) );
190 else
191 alphaLoaded=1;
194 return bRes;
197 std::string TileInfo::fixPath(const std::string &path) {
198 // Fix the Windows path issues for subpaths.
199 std::string searchStr("\\");
200 std::string replaceStr("/");
201 string::size_type pos = 0;
202 std::string pathStr = path;
204 while( (pos = pathStr.find(searchStr, pos)) != std::string::npos) {
205 pathStr.replace(pos, searchStr.size(), replaceStr);
206 pos++;
208 return pathStr;
211 void TileInfo::Delete ()
213 loaded=0;
214 Bits.resize(0);
216 nightLoaded=0;
217 nightBits.resize(0);
219 alphaLoaded=0;
220 alphaBits.resize(0);
223 const std::string TileInfo::getRelativeFileName (TileTexture texture, int index)
225 nlassert(this->tileType != UnSet);
227 std::string currentPath;
228 if (tileType != Displace)
230 currentPath = tileBankBrowser.getTile(index)->getRelativeFileName ((CTile::TBitmap)texture);
232 else
234 if (texture == Diffuse)
236 currentPath = tileBankBrowser.getDisplacementMap(index);
238 //TODO titegus: remove MAGIC STRING "EmptyDisplacementMap" in Nel \tile_bank.cpp\void CTileNoise::setEmpty () or add an IsEmpty() method !!!!
239 if (currentPath == "EmptyDisplacementMap")
240 currentPath.clear();
244 return currentPath;
249 //TileList
250 TileList::TileList()
252 _tileSet = -1;
254 // Add 48 transitions
255 int i;
256 for (i=0; i<CTileSet::count; i++)
258 TileInfo info(i, Transition);
259 theListTransition.push_back (info);
262 // Add 16 displacements
263 for (i=0; i<CTileSet::CountDisplace; i++)
265 TileInfo info(i, Displace);
266 theListDisplacement.push_back (info);
271 int TileList::addTile128 ()
274 int index;
275 tileBankBrowser.getTileSet (_tileSet)->addTile128 (index, tileBankBrowser);
276 nlassert (index==(sint)theList128.size());
278 TileInfo info(index, _128x128);
279 theList128.push_back (info);
281 return index;
284 int TileList::addTile256 ()
286 int index;
287 tileBankBrowser.getTileSet (_tileSet)->addTile256 (index, tileBankBrowser);
288 nlassert (index==(sint)theList256.size());
290 TileInfo info(index, _256x256);
291 theList256.push_back (info);
293 return index;
296 bool TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
298 // Remove the absolute path from the path name
299 std::string troncated = name;
300 if (RemovePath(troncated, tileBankBrowser.getAbsPath ().c_str()))
302 vector<NLMISC::CBGRA> tampon;
303 uint Width;
304 uint Height;
305 if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height))
307 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No));
309 else
311 CTileBorder border;
312 border.set (Width, Height, tampon);
314 CTileSet::TError error;
315 int pixel=-1;
316 int composante=4;
317 if (type == CTile::additive)
318 error=CTileSet::ok;
319 else
320 error=tileBankBrowser.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
322 if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128))
324 QString pixelMessage = QObject::tr("%1\nPixel: %2(%3).\nContinue ?").arg(CTileSet::getErrorMessage (error)).arg(pixel).arg(comp[composante]);
325 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't set Bitmap"), pixelMessage, QMessageBox::Yes | QMessageBox::No) );
327 else
329 if (error==CTileSet::addFirstA128128)
330 tileBankBrowser.getTileSet(_tileSet)->setBorder (type, border);
332 tileBankBrowser.getTileSet(_tileSet)->setTile128 (tile, troncated, type, tileBankBrowser);
333 switch (type)
335 case CTile::diffuse:
336 theList128[tile].loaded=0;
337 break;
338 case CTile::additive:
339 theList128[tile].nightLoaded=0;
340 break;
341 case CTile::alpha:
342 theList128[tile].alphaLoaded=0;
343 break;
344 default:
345 break;
347 Reload(tile, tile + 1, _128x128);
351 else
353 // Error: bitmap not in the absolute path..
354 QString notInAbsolutePathMessage = QObject::tr("The bitmap %1 is not in the absolute path %2.\nContinue ?").arg(name.c_str()).arg(tileBankBrowser.getAbsPath ().c_str());
355 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Load error"), notInAbsolutePathMessage, QMessageBox::Yes | QMessageBox::No));
358 return true;
361 bool TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
363 // Remove the absolute path from the path name
364 std::string troncated=name;
365 if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str()))
367 vector<NLMISC::CBGRA> tampon;
368 uint Width;
369 uint Height;
370 if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height))
372 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) );
375 else
377 CTileBorder border;
378 border.set (Width, Height, tampon);
380 CTileSet::TError error;
381 int pixel=-1;
382 int composante=4;
384 if (type == CTile::additive)
385 error=CTileSet::ok;
386 else
387 error=tileBankBrowser.getTileSet(_tileSet)->checkTile256 (type, border, pixel, composante);
388 if ((error!=CTileSet::ok))
390 QString pixelMessage = QObject::tr("%1\nPixel: %2(%3).\nContinue ?").arg(CTileSet::getErrorMessage (error)).arg(pixel).arg(comp[composante]);
391 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't set Bitmap"), pixelMessage, QMessageBox::Yes | QMessageBox::No) );
393 else
395 tileBankBrowser.getTileSet(_tileSet)->setTile256 (tile, troncated, type, tileBankBrowser);
396 switch (type)
398 case CTile::diffuse:
399 theList256[tile].loaded=0;
400 break;
401 case CTile::additive:
402 theList256[tile].nightLoaded=0;
403 break;
404 case CTile::alpha:
405 theList256[tile].alphaLoaded=0;
406 break;
407 default:
408 break;
410 Reload(tile, tile + 1, _256x256);
414 else
416 // Error: bitmap not in the absolute path..
417 QString notInAbsolutePathMessage = QObject::tr("The bitmap %1 is not in the absolute path %2.\nContinue ?").arg(name.c_str()).arg(tileBankBrowser.getAbsPath ().c_str());
418 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Load error"), notInAbsolutePathMessage, QMessageBox::Yes | QMessageBox::No));
421 return true;
424 bool TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile::TBitmap type)
426 // Remove the absolute path from the path name
427 std::string troncated=name;
428 if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str()))
430 // No alpha, use setTileTransitionAlpha
431 nlassert (CTile::alpha!=type);
433 vector<NLMISC::CBGRA> tampon;
434 uint Width;
435 uint Height;
436 if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height))
438 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) );
440 else
442 CTileBorder border;
443 border.set (Width, Height, tampon);
445 CTileSet::TError error;
446 int pixel=-1;
447 int composante=4;
448 if (type == CTile::additive)
449 error=CTileSet::ok;
450 else
451 error=tileBankBrowser.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
452 if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128))
454 QString pixelMessage = QObject::tr("%1\nPixel: %2(%3).\nContinue ?").arg(CTileSet::getErrorMessage (error)).arg(pixel).arg(comp[composante]);
455 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't set Bitmap"), pixelMessage, QMessageBox::Yes | QMessageBox::No) );
457 else
459 if (error==CTileSet::addFirstA128128)
460 tileBankBrowser.getTileSet(_tileSet)->setBorder (type, border);
461 tileBankBrowser.getTileSet(_tileSet)->setTileTransition ((CTileSet::TTransition)tile, troncated, type, tileBankBrowser, border);
462 switch (type)
464 case CTile::diffuse:
465 theListTransition[tile].loaded=0;
466 break;
467 case CTile::additive:
468 theListTransition[tile].nightLoaded=0;
469 break;
470 case CTile::alpha:
471 theListTransition[tile].alphaLoaded=0;
472 break;
473 default:
474 break;
476 Reload(tile, tile + 1, Transition);
480 else
482 // Error: bitmap not in the absolute path..
483 QString notInAbsolutePathMessage = QObject::tr("The bitmap %1 is not in the absolute path %2.\nContinue ?").arg(name.c_str()).arg(tileBankBrowser.getAbsPath ().c_str());
484 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Load error"), notInAbsolutePathMessage, QMessageBox::Yes | QMessageBox::No) );
487 return true;
490 bool TileList::setDisplacement (int tile, const std::string& name, NL3D::CTile::TBitmap type)
492 // Remove the absolute path from the path name
493 std::string troncated=name;
494 if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str()))
497 vector<NLMISC::CBGRA> tampon;
498 uint Width;
499 uint Height;
500 if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height))
502 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap"), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) );
504 else
506 // Check the size
507 if ( (Width!=32) || (Height!=32) )
509 // Error message
510 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't set Bitmap"), QString( (troncated+"\nInvalid size: displacement map must be 32x32 8 bits.\nContinue ?").c_str()), QMessageBox::Yes | QMessageBox::No) );
512 else
514 // change the file name of the displacement map
515 tileBankBrowser.getTileSet(_tileSet)->setDisplacement ((CTileSet::TDisplacement)tile, troncated, tileBankBrowser);
517 // Loaded
518 theListDisplacement[tile].loaded=0;
519 Reload(tile, tile + 1, Displace);
524 else
526 // Error: bitmap not in the absolute path..
527 QString notInAbsolutePathMessage = QObject::tr("The bitmap %1 is not in the absolute path %2.\nContinue ?").arg(name.c_str()).arg(tileBankBrowser.getAbsPath ().c_str());
528 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Load error"), notInAbsolutePathMessage, QMessageBox::Yes | QMessageBox::No) );
531 return true;
534 bool TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot)
536 // Remove the absolute path from the path name
537 std::string troncated=name;
538 if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str()))
540 vector<NLMISC::CBGRA> tampon;
541 uint Width;
542 uint Height;
543 if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height))
545 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap"), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) );
547 else
549 CTileBorder border;
550 border.set (Width, Height, tampon);
552 // rotate the border
553 int rotBis=rot;
554 while (rotBis)
556 border.rotate ();
557 rotBis--;
560 CTileSet::TError error;
561 int indexError;
562 int pixel=-1;
563 int composante=4;
564 if (((error=tileBankBrowser.getTileSet(_tileSet)->checkTileTransition ((CTileSet::TTransition)tile, CTile::alpha, border, indexError,
565 pixel, composante))!=CTileSet::ok))
567 QString pixelMessage;
568 if ((error==CTileSet::topInterfaceProblem)||(error==CTileSet::bottomInterfaceProblem)||(error==CTileSet::leftInterfaceProblem)
569 ||(error==CTileSet::rightInterfaceProblem)||(error==CTileSet::topBottomNotTheSame)||(error==CTileSet::rightLeftNotTheSame)
570 ||(error==CTileSet::topInterfaceProblem))
572 if (indexError!=-1)
573 pixelMessage = QObject::tr("%1.\nIncompatible with tile nb %4.\nPixel: %2(%3).\nContinue ?").arg(CTileSet::getErrorMessage (error)).arg(pixel).arg(comp[composante]).arg(indexError);
574 else
575 pixelMessage = QObject::tr("%1.\nIncompatible with the 128x128 tile.\nPixel: %2(%3).\nContinue ?").arg(CTileSet::getErrorMessage (error)).arg(pixel).arg(comp[composante]);
578 else
579 pixelMessage = QObject::tr("%1.\nIncompatible filled tile.\nContinue ?").arg(CTileSet::getErrorMessage (error));
581 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't set Bitmap"), pixelMessage, QMessageBox::Yes | QMessageBox::No) );
583 else
585 tileBankBrowser.getTileSet(_tileSet)->setTileTransitionAlpha ((CTileSet::TTransition)tile, troncated, tileBankBrowser, border, rot);
586 theListTransition[tile].alphaLoaded=0;
587 theListTransition[tile].Load (tileBankBrowser.getTileSet(_tileSet)->getTransition(tile)->getTile(), NULL);
591 else
593 // Error: bitmap not in the absolute path..
594 QString notInAbsolutePathMessage = QObject::tr("The bitmap %1 is not in the absolute path %2.\nContinue ?").arg(name.c_str()).arg(tileBankBrowser.getAbsPath ().c_str());
595 return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Load error"), notInAbsolutePathMessage, QMessageBox::Yes | QMessageBox::No) );
598 return true;
601 void TileList::removeTile128 (int index)
603 tileBankBrowser.getTileSet (_tileSet)->removeTile128 (index, tileBankBrowser);
604 theList[0].erase (theList[0].begin()+index);
605 for (int i=0; i<(sint)theList[0].size(); i++)
607 theList[0][i].setId(i);
611 void TileList::removeTile256 (int index)
613 tileBankBrowser.getTileSet (_tileSet)->removeTile256 (index, tileBankBrowser);
614 theList[1].erase (theList[1].begin()+index);
615 for (int i=0; i<(sint)theList[1].size(); i++)
617 theList[1][i].setId(i);
621 void TileList::clearTile128 (int index, CTile::TBitmap bitmap)
623 switch (bitmap)
625 case CTile::diffuse:
626 theList128[index].loaded=0;
627 theList128[index].Bits.resize(0);
628 break;
629 case CTile::additive:
630 theList128[index].nightLoaded=0;
631 theList128[index].nightBits.resize(0);
632 break;
633 case CTile::alpha:
634 nlassert(0);
635 break;
636 default:
637 break;
639 tileBankBrowser.getTileSet (_tileSet)->clearTile128 (index, bitmap, tileBankBrowser);
642 void TileList::clearTile256 (int index, CTile::TBitmap bitmap)
644 switch (bitmap)
646 case CTile::diffuse:
647 theList256[index].loaded=0;
648 theList256[index].Bits.resize(0);
649 break;
650 case CTile::additive:
651 theList256[index].nightLoaded=0;
652 theList256[index].nightBits.resize(0);
653 break;
654 case CTile::alpha:
655 nlassert(0);
656 break;
657 default:
658 break;
660 tileBankBrowser.getTileSet (_tileSet)->clearTile256 (index, bitmap, tileBankBrowser);
663 void TileList::clearTransition (int index, CTile::TBitmap bitmap)
665 switch (bitmap)
667 case CTile::diffuse:
668 theListTransition[index].loaded=0;
669 theListTransition[index].Bits.resize(0);
670 break;
671 case CTile::additive:
672 theListTransition[index].nightLoaded=0;
673 theListTransition[index].nightBits.resize(0);
674 break;
675 case CTile::alpha:
676 theListTransition[index].alphaLoaded=0;
677 theListTransition[index].alphaBits.resize(0);
678 break;
679 default:
680 break;
682 tileBankBrowser.getTileSet (_tileSet)->clearTransition ((CTileSet::TTransition)index, bitmap, tileBankBrowser);
685 void TileList::clearDisplacement (int index, CTile::TBitmap bitmap)
687 switch (bitmap)
689 case CTile::diffuse:
690 theListDisplacement[index].loaded=0;
691 theListDisplacement[index].Bits.resize(0);
692 break;
693 case CTile::additive:
694 nlassert(0);
695 break;
696 case CTile::alpha:
697 nlassert(0);
698 break;
699 default:
700 break;
703 tileBankBrowser.getTileSet (_tileSet)->clearDisplacement ((CTileSet::TDisplacement)index, tileBankBrowser);
706 tilelist::iterator TileList::GetFirst(int n)
708 return theList[n].begin();
711 tilelist::iterator TileList::GetLast(int n)
713 return theList[n].end();
716 tilelist::iterator TileList::Get(int i, int n)
718 return theList[n].begin()+i;
722 int TileList::GetSize(int n)
724 return (int)theList[n].size();
728 void TileList::Reload(int first, int last, TileType n) //recharge en memoire une tranche de tiles
730 for (int i=first; i<last; i++)
732 switch (n)
734 case _128x128:
736 theList[n][i].Load (tileBankBrowser.getTileSet(_tileSet)->getTile128 (i), NULL);
737 break;
739 case _256x256:
741 theList[n][i].Load (tileBankBrowser.getTileSet(_tileSet)->getTile256 (i), NULL);
742 break;
744 case Transition:
746 int index=tileBankBrowser.getTileSet(_tileSet)->getTransition (i)->getTile();
747 if (index!=-1)
748 theList[n][i].Load (index, &theListTransition[i].alphaBits);
749 break;
751 case Displace:
753 int index=tileBankBrowser.getTileSet(_tileSet)->getDisplacementTile ((CTileSet::TDisplacement)i);
754 if (index!=-1)
755 theList[n][i].Load (index, NULL);
756 break;
758 default:
759 break;