Skip to content

Commit

Permalink
thanm: Only use the THTX format for conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
xarnonymous committed May 17, 2011
1 parent 68d6472 commit a2ef50a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -3,6 +3,7 @@ What's new in thtk 5:
Make: --enable-combine was removed.
thanm: The sentinel instructions are left out from the scripts.
thecl: Bogus rank flags will not be displayed for TH07.
thanm: The new format will be handled correctly (by ignoring the Format: field).

What's new in thtk 4:

Expand Down
2 changes: 1 addition & 1 deletion image.h
Expand Up @@ -34,10 +34,10 @@
#include <stdio.h>

typedef enum {
FORMAT_RGBA8888 = -1, /* Internal use only. */
FORMAT_BGRA8888 = 1,
FORMAT_BGR565 = 3,
FORMAT_BGRA4444 = 5,
FORMAT_RGBA8888 = 6, /* XXX: Also used internally. */
FORMAT_GRAY8 = 7
} format_t;

Expand Down
15 changes: 2 additions & 13 deletions thanm.c
Expand Up @@ -465,17 +465,6 @@ anm_read_file(
header->version == 7 ||
header->version == 8);

/* XXX: header->format is 0 for at least two entries in TH06. */
#if 0
fprintf(stderr, "%s:%s: %d\n", argv0, current_input, header->format);
assert(
header->format == FORMAT_BGRA8888 ||
header->format == FORMAT_BGR565 ||
header->format == FORMAT_BGRA4444 ||
header->format == FORMAT_RGBA8888 ||
header->format == FORMAT_GRAY8);
#endif

assert(
header->unknown1 == 0 ||
header->unknown1 == 1 ||
Expand Down Expand Up @@ -774,7 +763,7 @@ anm_replace(
anm_entry_t* entry;
list_for_each(&anm->entries, entry) {
if (entry->name == name &&
entry->header->format == formats[f] &&
entry->thtx->format == formats[f] &&
entry->header->hasdata) {
unsigned int y;

Expand Down Expand Up @@ -842,7 +831,7 @@ anm_extract(
for (f = 0; f < sizeof(formats) / sizeof(formats[0]); ++f) {
anm_entry_t* entry;
list_for_each(&anm->entries, entry) {
if (entry->header->hasdata && entry->name == name && formats[f] == entry->header->format) {
if (entry->header->hasdata && entry->name == name && formats[f] == entry->thtx->format) {
unsigned char* temp_data = format_to_rgba(entry->data, entry->thtx->w * entry->thtx->h, entry->thtx->format);
for (y = entry->header->y; y < entry->header->y + entry->thtx->h; ++y) {
memcpy(image.data + y * image.width * 4 + entry->header->x * 4,
Expand Down

0 comments on commit a2ef50a

Please sign in to comment.