2D_Engine_Casio_Tool/src/game_data/maps.cpp

121 lines
5.4 KiB
C++

#include <iostream>
#include "maps.hpp"
void verify_maps_integrity(void)
{
std::cout << "Nb Maps : " << NB_MAPS << std::endl;
for(uint32_t map_index = 0; map_index < NB_MAPS; map_index++)
{
const uint32_t NB_ENTITIES = MAPS[map_index]->nb_entities;
const entity_t *ENTITIES = MAPS[map_index]->entities;
std::cout << "Map " << map_index + 1 << std::endl;
std::cout << " - MapName : " << MAPS[map_index]->map_name << std::endl;
std::cout << " - MapWidth : " << MAPS[map_index]->map_width << std::endl;
std::cout << " - MapHeight : " << MAPS[map_index]->map_height << std::endl;
std::cout << " BackgroundLayer1 :";
for(uint32_t tile_index_x = 0; tile_index_x < MAPS[map_index]->map_width; tile_index_x++)
{
std::cout << "\n ";
for(uint32_t tile_index_y = 0; tile_index_y < MAPS[map_index]->map_height; tile_index_y++)
{
std::cout << MAPS[map_index]->map_background_layer1[tile_index_x * MAPS[map_index]->map_width + tile_index_y] << ",";
}
}
std::cout << "\n BackgroundLayer2 :";
for(uint32_t tile_index_x = 0; tile_index_x < MAPS[map_index]->map_width; tile_index_x++)
{
std::cout << "\n ";
for(uint32_t tile_index_y = 0; tile_index_y < MAPS[map_index]->map_height; tile_index_y++)
{
std::cout << MAPS[map_index]->map_background_layer2[tile_index_x * MAPS[map_index]->map_width + tile_index_y] << ",";
}
}
std::cout << "\n BackgroundLayer3 :";
for(uint32_t tile_index_x = 0; tile_index_x < MAPS[map_index]->map_width; tile_index_x++)
{
std::cout << "\n ";
for(uint32_t tile_index_y = 0; tile_index_y < MAPS[map_index]->map_height; tile_index_y++)
{
std::cout << MAPS[map_index]->map_background_layer3[tile_index_x * MAPS[map_index]->map_width + tile_index_y] << ",";
}
}
std::cout << "\n Foreground :";
for(uint32_t tile_index_x = 0; tile_index_x < MAPS[map_index]->map_width; tile_index_x++)
{
std::cout << "\n ";
for(uint32_t tile_index_y = 0; tile_index_y < MAPS[map_index]->map_height; tile_index_y++)
{
std::cout << MAPS[map_index]->map_foreground[tile_index_x * MAPS[map_index]->map_width + tile_index_y] << ",";
}
}
std::cout << "\n - Nb Entities : " << NB_ENTITIES << std::endl;
for(uint32_t entity_index = 0; entity_index < NB_ENTITIES; entity_index++)
{
const uint32_t NB_COMPONENTS = ENTITIES[entity_index].nb_component;
const component_t *COMPONENTS = ENTITIES[entity_index].components;
std::cout << " Entity " << entity_index + 1 << std::endl;
std::cout << " - ID : " << ENTITIES[entity_index].id << std::endl;
std::cout << " - Nb Components : " << NB_COMPONENTS << std::endl;
for(uint32_t component_index = 0; component_index < NB_COMPONENTS; component_index++)
{
const component_t *COMPONENT = &COMPONENTS[component_index];
std::cout << " Component " << component_index + 1 << std::endl;
switch(COMPONENT->component_type)
{
case TRANSFORM_COMPONENT:
{
const transform_component_data_t *component_data = COMPONENT->component_data.transform_component_data;
std::cout << " - TransformComponent :" << std::endl;
std::cout << " - x : " << component_data->x << std::endl;
std::cout << " - y : " << component_data->y << std::endl;
std::cout << " - w : " << component_data->w << std::endl;
std::cout << " - h : " << component_data->h << std::endl;
std::cout << " - Speed : " << component_data->speed << std::endl;
break;
}
case SPRITE_COMPONENT:
{
const sprite_component_data_t *component_data = COMPONENT->component_data.sprite_component_data;
std::cout << " - SpriteComponent :" << std::endl;
std::cout << " - TextureName : " << component_data->texture_name << std::endl;
break;
}
case ANIMATION_SYSTEM:
{
const animation_system_data_t *system_data = COMPONENT->component_data.animation_system_data;
std::cout << " - AnimationSystem :" << std::endl;
std::cout << " - NbFrames : " << system_data->nb_frames << std::endl;
std::cout << " - FrameNb : " << system_data->actual_frame_nb << std::endl;
std::cout << " - FrameDelay : " << system_data->frame_delay_ms << std::endl;
std::cout << " - Play : " << system_data->play << std::endl;
std::cout << " - Loop : " << system_data->loop << std::endl;
std::cout << " - Reverse : " << system_data->reverse << std::endl;
break;
}
}
}
}
}
}