Map format
#3
That is exactly what I thought, yet using a log of the map writing, I got something more like 516.
Log: http://pastebin.com/raw.php?i=cuKYBMKt

Code that generated the log:
loopk(cubicsize)
    {
        sqr *s = &world[k];
        #define c(f) (s->f==t->f)
        // 4 types of blocks, to compress a bit:
        // 255 (2): same as previous block + count
        // 254 (3): same as previous, except light // deprecated
        // SOLID (5)
        // anything else (9)
        if (!py) conoutf("Adding cube %d. Type %d", k, s->type );

        if(SOLID(s))
        {
            if(t && c(type) && c(wtex) && c(vdelta))
            {
                sc++;
                if (!py) conoutf("\tDuplicate");
            }
            else
            {
                spurge;
                if (!py) conoutf("\tSolid! vtex: %d vdelta: %d", s->wtex, s->vdelta );
                f->putchar(s->type);
                f->putchar(s->wtex);
                f->putchar(s->vdelta);
            }
        }
        else
        {
            if(t && c(type) && c(floor) && c(ceil) && c(ctex) && c(ftex) && c(utex) && c(wtex) && c(vdelta) && c(tag))
            {
                sc++;
                if (!py) conoutf("\tDuplicate");
            }
            else
            {
                spurge;
                if (!py) conoutf("\tNot Solid! floor: %d ceil: %d wtex: %d ftex: %d, ctex: %d, vdelta: %d, utex: %d, tag: %d", s->floor, s->ceil, s->wtex, s->ftex, s->ctex, s->vdelta, s->utex, s->tag );
                f->putchar(s->type);
                f->putchar(s->floor);
                f->putchar(s->ceil);
                f->putchar(s->wtex);
                f->putchar(s->ftex);
                f->putchar(s->ctex);
                f->putchar(s->vdelta);
                f->putchar(s->utex);
                f->putchar(s->tag);
            }
        }
        t = s;
    }
    spurge;
    delete f;
    conoutf("wrote map file %s", cgzname);
}

And a read out of the values of n when I loaded the map, I got this:
n: 255
n: 255
n: 9

code that generated that:
if(!t || (n = f->getchar()) < 0) { delete f; f = NULL; k--; continue; }
                conoutf("n: %d", n);

This is the code that I think I am misunderstanding, memset and memcpy to be specific. I am more associated with AC C(++) rather than standard use C(++).
memset(c, tmp, n);
                for(int i = 0; i<n; i++, k++) memcpy(&world[k], t, sizeof(sqr));
Thanks given by:


Messages In This Thread
Map format - by Ronald_Reagan - 21 Dec 11, 03:27AM
RE: Map format - by MasterKaen - 21 Dec 11, 04:02AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 04:13AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:01AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:32AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:34AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:35AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:44AM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 05:51AM
RE: Map format - by MasterKaen - 21 Dec 11, 05:55AM
RE: Map format - by Mael - 21 Dec 11, 03:42PM
RE: Map format - by Ronald_Reagan - 21 Dec 11, 09:35PM
RE: Map format - by V-Man - 22 Dec 11, 08:27AM
RE: Map format - by Ronald_Reagan - 22 Dec 11, 08:48AM