Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird extra semicolons being added to C tilesets #49

Closed
ecdye opened this issue Feb 26, 2020 · 0 comments
Closed

Weird extra semicolons being added to C tilesets #49

ecdye opened this issue Feb 26, 2020 · 0 comments
Assignees
Labels
need to do like this week. or month.

Comments

@ecdye
Copy link

ecdye commented Feb 26, 2020

Using a 320x240 image and this convimg.yaml I end up with a weird behavior where convimg is adding illegal semicolons to the end of functions in the C code.

convimg.yaml:

output: appvar
  include-file: var_gfx.h
  name: var_gfx
  source-format: c
  palettes:
    - tiles_gfx
  converts:
    - tileset

palette: tiles_gfx
  images: automatic

convert: tileset
  palette: tiles_gfx
  tilesets: {tile-width:80, tile-height:80}
  compress: zx7
    - tileset.png

var_gfx.c:

#include "var_gfx.h"
#include <fileioc.h>

unsigned char *var_gfx_appvar[2] =
{
    (unsigned char*)0,
    (unsigned char*)176,
};

unsigned char *tileset_tiles_compressed[12] =
{
    (unsigned char*)0,
    (unsigned char*)307,
    (unsigned char*)1644,
    (unsigned char*)2870,
    (unsigned char*)3053,
    (unsigned char*)3840,
    (unsigned char*)4738,
    (unsigned char*)6021,
    (unsigned char*)6451,
    (unsigned char*)7029,
    (unsigned char*)8642,
    (unsigned char*)10278,
};

unsigned char var_gfx_init(void)
{
    unsigned int data, i;
    ti_var_t appvar;

    ti_CloseAll();

    appvar = ti_Open("var_gfx", "r");
    if (appvar == 0)
    {
        return 0;
    }

    data = (unsigned int)ti_GetDataPtr(appvar) - (unsigned int)var_gfx_appvar[0];
    for (i = 0; i < 2; i++)
    {
        var_gfx_appvar[i] += data;
    }

    ti_CloseAll();

    data = (unsigned int)var_gfx_appvar[1] - (unsigned int)tileset_tiles_compressed[0];
    for (i = 0; i < tileset_tiles_num; i++)
    {
        tileset_tiles_compressed[i] += data;
    }

    return 1;
}; // This right here is what I am talking about

While it can be manually corrected it is still rather annoying and I figured was worth reporting.

@mateoconlechuga mateoconlechuga added the need to do like this week. or month. label Feb 26, 2020
@mateoconlechuga mateoconlechuga self-assigned this Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need to do like this week. or month.
Projects
None yet
Development

No branches or pull requests

2 participants