@@ -163,12 +163,12 @@ glArchivItem_Bitmap_Player* Loader::GetNationPlayerImage(Nation nation, unsigned
163163 return checkedCast<glArchivItem_Bitmap_Player*>(GetNationImageN (nation, nr));
164164}
165165
166- glArchivItem_Bitmap* Loader::GetMapImageN (unsigned nr)
166+ glArchivItem_Bitmap* Loader::GetMapImage (unsigned nr)
167167{
168168 return convertChecked<glArchivItem_Bitmap*>(map_gfx->get (nr));
169169}
170170
171- ITexture* Loader::GetMapTexN (unsigned nr)
171+ ITexture* Loader::GetMapTexture (unsigned nr)
172172{
173173 return convertChecked<ITexture*>(map_gfx->get (nr));
174174}
@@ -343,6 +343,47 @@ void Loader::LoadDummyGUIFiles()
343343 }
344344}
345345
346+ void Loader::LoadDummyMapFiles ()
347+ {
348+ libsiedler2::Archiv& map = files_[" map_0_z" ].archive ;
349+ if (!map.empty ())
350+ return ;
351+ const auto pushRange = [&map](unsigned from, unsigned to) {
352+ map.alloc_inc (to - map.size () + 1 );
353+ libsiedler2::PixelBufferBGRA buffer (1 , 1 );
354+ for (unsigned i = from; i <= to; i++)
355+ {
356+ auto bmp = std::make_unique<glArchivItem_Bitmap_Raw>();
357+ bmp->create (buffer);
358+ map.set (i, std::move (bmp));
359+ };
360+ };
361+ map_gfx = ↦
362+
363+ // Some ID ranges as found in map_0_z.lst
364+ pushRange (20 , 23 );
365+ pushRange (40 , 46 );
366+ pushRange (50 , 55 );
367+ pushRange (59 , 67 );
368+ pushRange (200 , 282 );
369+ pushRange (290 , 334 );
370+ pushRange (350 , 432 );
371+ pushRange (440 , 484 );
372+ pushRange (500 , 527 );
373+
374+ for (int j = 0 ; j <= 5 ; j++)
375+ {
376+ libsiedler2::Archiv& bobs = files_[ResourceId (" mis" + std::to_string (j) + " bobs" )].archive ;
377+ libsiedler2::PixelBufferBGRA buffer (1 , 1 );
378+ for (unsigned i = 0 ; i <= 10 ; i++)
379+ {
380+ auto bmp = std::make_unique<glArchivItem_Bitmap_Raw>();
381+ bmp->create (buffer);
382+ bobs.push (std::move (bmp));
383+ }
384+ }
385+ }
386+
346387namespace {
347388struct NationResourcesSource
348389{
@@ -473,17 +514,17 @@ void Loader::fillCaches()
473514
474515 bmp.reset ();
475516
476- bmp.add (GetMapImageN (ANIMALCONSTS[species].walking_id
477- + ANIMALCONSTS[species].animation_steps * rttr::enum_cast (dir + 3u ) + ani_step));
517+ bmp.add (GetMapImage (ANIMALCONSTS[species].walking_id
518+ + ANIMALCONSTS[species].animation_steps * rttr::enum_cast (dir + 3u ) + ani_step));
478519
479520 if (ANIMALCONSTS[species].shadow_id )
480521 {
481522 if (species == Species::Duck)
482523 // Ente Sonderfall, da gibts nur einen Schatten für jede Richtung!
483- bmp.addShadow (GetMapImageN (ANIMALCONSTS[species].shadow_id ));
524+ bmp.addShadow (GetMapImage (ANIMALCONSTS[species].shadow_id ));
484525 else
485526 // ansonsten immer pro Richtung einen Schatten
486- bmp.addShadow (GetMapImageN (ANIMALCONSTS[species].shadow_id + rttr::enum_cast (dir + 3u )));
527+ bmp.addShadow (GetMapImage (ANIMALCONSTS[species].shadow_id + rttr::enum_cast (dir + 3u )));
487528 }
488529
489530 stp->add (bmp);
@@ -496,11 +537,11 @@ void Loader::fillCaches()
496537
497538 if (ANIMALCONSTS[species].dead_id )
498539 {
499- bmp.add (GetMapImageN (ANIMALCONSTS[species].dead_id ));
540+ bmp.add (GetMapImage (ANIMALCONSTS[species].dead_id ));
500541
501542 if (ANIMALCONSTS[species].shadow_dead_id )
502543 {
503- bmp.addShadow (GetMapImageN (ANIMALCONSTS[species].shadow_dead_id ));
544+ bmp.addShadow (GetMapImage (ANIMALCONSTS[species].shadow_dead_id ));
504545 }
505546
506547 stp->add (bmp);
@@ -593,7 +634,7 @@ void Loader::fillCaches()
593634 bob_jobs->getBody (spriteData.isFat (), imgDir, ani_step)));
594635 bmp.add (dynamic_cast <glArchivItem_Bitmap_Player*>(
595636 bob_jobs->getOverlay (spriteData.getBobId (Nation (nation)), spriteData.isFat (), imgDir, ani_step)));
596- bmp.addShadow (GetMapImageN (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
637+ bmp.addShadow (GetMapImage (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
597638
598639 stp->add (bmp);
599640 }
@@ -611,7 +652,7 @@ void Loader::fillCaches()
611652
612653 bmp.add (dynamic_cast <glArchivItem_Bitmap_Player*>(bob_jobs->getBody (true , imgDir, ani_step)));
613654 bmp.add (dynamic_cast <glArchivItem_Bitmap_Player*>(bob_jobs->getOverlay (0 , true , imgDir, ani_step)));
614- bmp.addShadow (GetMapImageN (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
655+ bmp.addShadow (GetMapImage (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
615656
616657 stp->add (bmp);
617658 }
@@ -681,10 +722,10 @@ void Loader::fillCaches()
681722
682723 bmp.reset();
683724
684- bmp.add(static_cast<glArchivItem_Bitmap_Player *>(GetMapImageN (3162+ani_step)));
725+ bmp.add(static_cast<glArchivItem_Bitmap_Player *>(GetMapTexture (3162+ani_step)));
685726
686727 int a, b, c, d;
687- static_cast<glArchivItem_Bitmap_Player *>(GetMapImageN (3162+ani_step))->getVisibleArea(a, b, c, d);
728+ static_cast<glArchivItem_Bitmap_Player *>(GetMapTexture (3162+ani_step))->getVisibleArea(a, b, c, d);
688729 fprintf(stderr, "%i,%i (%ix%i)\n", a, b, c, d);
689730
690731
@@ -700,8 +741,8 @@ void Loader::fillCaches()
700741
701742 bmp.reset ();
702743
703- bmp.add (GetMapImageN (200 + type * 15 + ani_step));
704- bmp.addShadow (GetMapImageN (350 + type * 15 + ani_step));
744+ bmp.add (GetMapImage (200 + type * 15 + ani_step));
745+ bmp.addShadow (GetMapImage (350 + type * 15 + ani_step));
705746
706747 stp->add (bmp);
707748 }
@@ -716,8 +757,8 @@ void Loader::fillCaches()
716757
717758 bmp.reset ();
718759
719- bmp.add (GetMapImageN (516 + rttr::enum_cast (type) * 6 + size));
720- bmp.addShadow (GetMapImageN (616 + rttr::enum_cast (type) * 6 + size));
760+ bmp.add (GetMapImage (516 + rttr::enum_cast (type) * 6 + size));
761+ bmp.addShadow (GetMapImage (616 + rttr::enum_cast (type) * 6 + size));
721762
722763 stp->add (bmp);
723764 }
@@ -732,8 +773,8 @@ void Loader::fillCaches()
732773
733774 bmp.reset ();
734775
735- bmp.add (GetMapImageN (532 + type * 5 + size));
736- bmp.addShadow (GetMapImageN (632 + type * 5 + size));
776+ bmp.add (GetMapImage (532 + type * 5 + size));
777+ bmp.addShadow (GetMapImage (632 + type * 5 + size));
737778
738779 stp->add (bmp);
739780 }
@@ -748,8 +789,8 @@ void Loader::fillCaches()
748789
749790 bmp.reset ();
750791
751- bmp.add (GetMapImageN (2000 + rttr::enum_cast (dir + 3u ) * 8 + ani_step));
752- bmp.addShadow (GetMapImageN (2048 + rttr::enum_cast (dir) % 3 ));
792+ bmp.add (GetMapImage (2000 + rttr::enum_cast (dir + 3u ) * 8 + ani_step));
793+ bmp.addShadow (GetMapImage (2048 + rttr::enum_cast (dir) % 3 ));
753794
754795 stp->add (bmp);
755796 }
@@ -765,7 +806,7 @@ void Loader::fillCaches()
765806 bmp.reset ();
766807
767808 bmp.add (GetPlayerImage (" boat" , rttr::enum_cast (dir + 3u ) * 8 + ani_step));
768- bmp.addShadow (GetMapImageN (2048 + rttr::enum_cast (dir) % 3 ));
809+ bmp.addShadow (GetMapImage (2048 + rttr::enum_cast (dir) % 3 ));
769810
770811 stp->add (bmp);
771812 }
@@ -796,7 +837,7 @@ void Loader::fillCaches()
796837 bmp.add (dynamic_cast <glArchivItem_Bitmap_Player*>(bob_carrier->getBody (fat, imgDir, ani_step)));
797838 bmp.add (
798839 dynamic_cast <glArchivItem_Bitmap_Player*>(bob_carrier->getOverlay (id, fat, imgDir, ani_step)));
799- bmp.addShadow (GetMapImageN (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
840+ bmp.addShadow (GetMapImage (900 + static_cast <unsigned >(imgDir) * 8 + ani_step));
800841
801842 stp->add (bmp);
802843 }
@@ -810,8 +851,8 @@ void Loader::fillCaches()
810851 const unsigned char color_count = 4 ;
811852
812853 libsiedler2::ArchivItem_Palette* palette = GetPaletteN (" pal5" );
813- glArchivItem_Bitmap * image = GetMapImageN (561 );
814- glArchivItem_Bitmap * shadow = GetMapImageN (661 );
854+ auto * image = GetMapImage (561 );
855+ auto * shadow = GetMapImage (661 );
815856
816857 if ((image) && (shadow) && (palette))
817858 {
0 commit comments