MCPcopy Create free account
hub / github.com/EasyRPG/Player / SetMapData

Method SetMapData

src/tilemap_layer.cpp:686–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686void TilemapLayer::SetMapData(std::vector<short> nmap_data) {
687 // Create the tiles data cache
688 CreateTileCache(nmap_data);
689 memset(autotiles_ab, 0, sizeof(autotiles_ab));
690 memset(autotiles_d, 0, sizeof(autotiles_d));
691
692 if (layer == 0) {
693 autotiles_ab_map.clear();
694 autotiles_d_map.clear();
695 autotiles_ab_next = 0;
696 autotiles_d_next = 0;
697 for (int y = 0; y < height; y++) {
698 for (int x = 0; x < width; x++) {
699
700 if (GetDataCache(x, y).ID < BLOCK_C) {
701 // If blocks A and B
702
703 GenerateAutotileAB(GetDataCache(x, y).ID, 0);
704 GenerateAutotileAB(GetDataCache(x, y).ID, 1);
705 GenerateAutotileAB(GetDataCache(x, y).ID, 2);
706 } else if (GetDataCache(x, y).ID >= BLOCK_D && GetDataCache(x, y).ID < BLOCK_E) {
707 // If block D
708
709 GenerateAutotileD(GetDataCache(x, y).ID);
710 }
711 }
712 }
713 autotiles_ab_screen = GenerateAutotiles(autotiles_ab_next, autotiles_ab_map);
714 autotiles_d_screen = GenerateAutotiles(autotiles_d_next, autotiles_d_map);
715
716 autotiles_ab_screen_effect = Bitmap::Create(autotiles_ab_screen->width(), autotiles_ab_screen->height());
717 autotiles_d_screen_effect = Bitmap::Create(autotiles_d_screen->width(), autotiles_d_screen->height());
718
719 chipset_tone_tiles.clear();
720 }
721
722 map_data = std::move(nmap_data);
723}
724
725static inline bool IsTileFromBlock(int tile_id, int block) {
726 switch (block) {

Callers 2

SetMapDataDownMethod · 0.80
SetMapDataUpMethod · 0.80

Calls 3

widthMethod · 0.80
heightMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected