Compiling for 32 bit arch because of compatibility with SH4 arch
This commit is contained in:
parent
8c14e56846
commit
a6bacb6e8c
6
Makefile
6
Makefile
|
@ -25,12 +25,12 @@ OUTPUT := 2D_Engine_Casio_Tool
|
|||
|
||||
# Compiler and flags
|
||||
CXX = ccache g++
|
||||
CXXFLAGS = -Wall -Wextra -std=c++17 -O2 -no-pie
|
||||
CXXFLAGS = -m32 -Wall -Wextra -std=c++17 -g -no-pie
|
||||
INCLUDE_DIRS = 3rd_party
|
||||
LDFLAGS = -no-pie
|
||||
LDFLAGS = -m32 -no-pie
|
||||
|
||||
# Converter flags
|
||||
FXCONV_FLAGS = --cg --toolchain= --arch=x86-64 --outputtarget=elf64-x86-64
|
||||
FXCONV_FLAGS = --cg --toolchain= --arch=i386 --outputtarget=elf32-x86-64
|
||||
FXCONV_CONVERTERS = assets/maps/map_converter.py
|
||||
|
||||
# Change output location
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"MapWidth": 3,
|
||||
"MapWidth": 2,
|
||||
"MapHeight": 2,
|
||||
|
||||
"BackgroundLayer1": [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import fxconv
|
||||
from fxconv import u16, u32, ref, string
|
||||
from fxconv import u16, u32, ref, chars, string
|
||||
import json
|
||||
|
||||
def convert(input, output, params, target):
|
||||
|
@ -17,6 +17,11 @@ def convert_map(input, output, params, target):
|
|||
SPRITE_COMPONENT = 1
|
||||
ANIMATION_SYSTEM = 2
|
||||
|
||||
background_layer1 = b''.join(u16(tile) for tile in map["BackgroundLayer1"])
|
||||
background_layer2 = b''.join(u16(tile) for tile in map["BackgroundLayer2"])
|
||||
background_layer3 = b''.join(u16(tile) for tile in map["BackgroundLayer3"])
|
||||
foreground = b''.join(u16(tile) for tile in map["Foreground"])
|
||||
|
||||
entities = fxconv.Structure()
|
||||
|
||||
for entity in map["Entities"]:
|
||||
|
@ -24,6 +29,8 @@ def convert_map(input, output, params, target):
|
|||
e += u16(entity["ID"])
|
||||
e += u32(len(entity["Components"]))
|
||||
|
||||
components = fxconv.Structure()
|
||||
|
||||
for component in entity["Components"]:
|
||||
c = fxconv.Structure()
|
||||
c_data = fxconv.Structure()
|
||||
|
@ -54,17 +61,18 @@ def convert_map(input, output, params, target):
|
|||
raise fxconv.FxconvError(f"unknown component type {component['Type']}")
|
||||
|
||||
c += ref(c_data)
|
||||
e += ref(c)
|
||||
components += c
|
||||
|
||||
e += ref(components)
|
||||
entities += e
|
||||
|
||||
o = fxconv.ObjectData()
|
||||
o += string(params["name"])
|
||||
o += u32(map["MapWidth"]) + u32(map["MapHeight"])
|
||||
o += bytes(map["BackgroundLayer1"])
|
||||
o += bytes(map["BackgroundLayer2"])
|
||||
o += bytes(map["BackgroundLayer3"])
|
||||
o += bytes(map["Foreground"])
|
||||
o += ref(background_layer1)
|
||||
o += ref(background_layer2)
|
||||
o += ref(background_layer3)
|
||||
o += ref(foreground)
|
||||
o += u32(len(map["Entities"]))
|
||||
o += ref(entities)
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ typedef struct component_t {
|
|||
|
||||
typedef struct entity_t {
|
||||
uint16_t id;
|
||||
|
||||
unsigned long nb_component;
|
||||
uint32_t nb_component;
|
||||
component_t *components;
|
||||
} entity_t;
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
typedef struct game_data_t {
|
||||
const uint32_t nb_textures = NB_TEXTURES;
|
||||
const texture_t *textures = textures;
|
||||
const texture_t *textures = TEXTURES;
|
||||
|
||||
const uint32_t nb_maps = NB_MAPS;
|
||||
const map_t **maps = maps;
|
||||
const map_t **maps = MAPS;
|
||||
} game_data_t;
|
||||
|
||||
void write_game_data_as_bin_into_file(void);
|
||||
|
|
|
@ -2,46 +2,82 @@
|
|||
|
||||
#include "maps.hpp"
|
||||
|
||||
static inline void verify_layers_integrity(void)
|
||||
{
|
||||
for(uint32_t map_index = 0; map_index < NB_MAPS; map_index++)
|
||||
{
|
||||
std::cout << "Map " << map_index + 1 << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void verify_entities_integrity(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
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_width << std::endl;
|
||||
std::cout << " - Nb Entities : " << NB_ENTITIES << 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->nb_component;
|
||||
const component_t *COMPONENTS = ENTITIES->components;
|
||||
|
||||
std::cout << " - Nb Components : " << NB_COMPONENTS << std::endl;
|
||||
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 << std::endl;
|
||||
std::cout << " Component " << component_index + 1 << std::endl;
|
||||
|
||||
switch(COMPONENT->component_type)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ typedef struct map_t {
|
|||
|
||||
extern map_t map_example;
|
||||
|
||||
static map_t *maps[] = {
|
||||
static const map_t *MAPS[] = {
|
||||
&map_example
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "textures.hpp"
|
||||
|
||||
void verify_textures_integrity(void)
|
||||
{
|
||||
return;
|
||||
std::cout << "NbTexture : " << NB_TEXTURES << std::endl;
|
||||
for(uint32_t texture_index = 0; texture_index < NB_TEXTURES; texture_index++)
|
||||
{
|
||||
const texture_t *TEXTURE = &TEXTURES[texture_index];
|
||||
|
||||
std::cout << "Texture \"" << TEXTURE->name << "\" :" << std::endl;
|
||||
std::cout << " - Width : " << TEXTURE->image->width << std::endl;
|
||||
std::cout << " - Height : " << TEXTURE->image->height << std::endl;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ extern bopti_image_t img_lever_sheet;
|
|||
extern bopti_image_t img_small_chest_sheet;
|
||||
extern bopti_image_t img_big_chest_sheet;
|
||||
|
||||
static texture_t textures[] = {
|
||||
static const texture_t TEXTURES[] = {
|
||||
{"tileset", &img_tileset},
|
||||
{"player_idle_sheet", &img_player_idle_sheet},
|
||||
{"player_walk_sheet", &img_player_walk_sheet},
|
||||
|
|
Loading…
Reference in New Issue