eobish

diff src/tileset.c @ 5:0baf4e98315e

depth cueing
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 19 Jan 2015 02:32:01 +0200
parents ce0548d24918
children 6a350c554e46
line diff
     1.1 --- a/src/tileset.c	Sun Jan 18 13:30:30 2015 +0200
     1.2 +++ b/src/tileset.c	Mon Jan 19 02:32:01 2015 +0200
     1.3 @@ -1,6 +1,7 @@
     1.4  #include <stdio.h>
     1.5  #include <stdlib.h>
     1.6  #include <string.h>
     1.7 +#include <stdarg.h>
     1.8  #include <errno.h>
     1.9  #include <ctype.h>
    1.10  #include <assert.h>
    1.11 @@ -198,7 +199,7 @@
    1.12  
    1.13  	printf("loaded tileset %s\n", fname);
    1.14  	for(i=0; i<ntiles; i++) {
    1.15 -		printf("  tile: %s\n", ts->tile[i].name);
    1.16 +		printf("  tile: %s (orig: %d,%d)\n", ts->tile[i].name, ts->tile[i].orig_x, ts->tile[i].orig_y);
    1.17  	}
    1.18  
    1.19  	return 0;
    1.20 @@ -240,6 +241,19 @@
    1.21  	return bsearch(&key, ts->tile, ts->num_tiles, sizeof *ts->tile, tilecmp);
    1.22  }
    1.23  
    1.24 +struct tile *get_tilef(struct tileset *ts, const char *fmt, ...)
    1.25 +{
    1.26 +	va_list ap;
    1.27 +	int sz = strlen(fmt) * 2;
    1.28 +	char *buf = alloca(sz + 1);
    1.29 +
    1.30 +	va_start(ap, fmt);
    1.31 +	vsnprintf(buf, sz, fmt, ap);
    1.32 +	va_end(ap);
    1.33 +
    1.34 +	return get_tile(ts, buf);
    1.35 +}
    1.36 +
    1.37  static struct orig_node *load_origin_list(const char *fname)
    1.38  {
    1.39  	FILE *fp;