added opencorner tiles
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 26 Sep 2021 02:34:39 +0000 (05:34 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 26 Sep 2021 02:34:39 +0000 (05:34 +0300)
src/level.c
src/level.h
src/tileset.c

index 44c0bba..c17c03a 100644 (file)
@@ -245,49 +245,59 @@ static int detect_cell_tile(struct level *lvl, int x, int y, int *rot)
                return TILE_OPEN;
 
        case 0745:
-       case 0744:
-
        case 0645:
-       case 0644:
-       case 0740:
        case 0741:
-       case 0640:
        case 0641:
                return TILE_CORNER;
-       case 0715:
-       case 0711:
 
+       case 0744:
+       case 0644:
+       case 0740:
+       case 0640:
+               return TILE_OPENCORNER;
+
+       case 0715:
        case 0315:
-       case 0311:
-       case 0710:
        case 0714:
-       case 0310:
        case 0314:
                *rot = 1;
                return TILE_CORNER;
-       case 0547:
-       case 0447:
 
-       case 0047:
+       case 0711:
+       case 0311:
+       case 0710:
+       case 0310:
+               *rot = 1;
+               return TILE_OPENCORNER;
+
+       case 0547:
        case 0147:
-       case 0446:
        case 0546:
-       case 0046:
        case 0146:
                *rot = 3;
                return TILE_CORNER;
-       case 0517:
-       case 0117:
 
-       case 0017:
+       case 0447:
+       case 0047:
+       case 0446:
+       case 0046:
+               *rot = 3;
+               return TILE_OPENCORNER;
+
+       case 0517:
        case 0417:
-       case 0113:
        case 0513:
-       case 0013:
        case 0413:
                *rot = 2;
                return TILE_CORNER;
 
+       case 0117:
+       case 0017:
+       case 0113:
+       case 0013:
+               *rot = 2;
+               return TILE_OPENCORNER;
+
        case 0507:      /* N tee */
                *rot = 3;
                return TILE_TEE;
index d1e9931..cbf6642 100644 (file)
@@ -10,6 +10,7 @@ enum {
        TILE_OPEN,
        TILE_STR,
        TILE_CORNER,
+       TILE_OPENCORNER,
        TILE_TEE,
        TILE_CROSS,
        TILE_STR2OPEN,
index 79e9f38..28adf31 100644 (file)
@@ -21,6 +21,8 @@ int load_tileset(struct tileset *tset, const char *fname)
        int type;
        float xform[16], *vec;
 
+       memset(tset, 0, sizeof *tset);
+
        if(!(ts = ts_load(fname))) {
                fprintf(stderr, "failed to load tileset: %s\n", fname);
                return -1;
@@ -169,7 +171,7 @@ struct tile *get_tile(struct tileset *tset, int ttype)
 int tile_type(const char *tstr)
 {
        static const char *typenames[] = {
-               "open", "straight", "corner", "tee", "cross", "str2open", "stropen", 0
+               "open", "straight", "corner", "opencorner", "tee", "cross", "str2open", "stropen", 0
        };
        int i;