]> git.draconx.ca Git - upkg.git/blobdiff - src/engine/texture.gob
uobject: Add support for float properties.
[upkg.git] / src / engine / texture.gob
index 3db176e045982b31de94268bed9031a7f63cf889..49af5381a37b43c19d9babf16ce11e5ccea77be6 100644 (file)
@@ -52,7 +52,7 @@ struct engine_texture_data *decode_mipmap(UObject *uo)
        long datalen;
 
        buflen = upkg_export_read(f, buf, sizeof buf);
-       if (uo->pkg->version >= 63) {
+       if (f->pkg->version >= 63) {
                /*
                 * There's an offset to the end of the image data here; not
                 * clear why it's useful since it's implied by the very next
@@ -84,8 +84,10 @@ struct engine_texture_data *decode_mipmap(UObject *uo)
 
        /* At this point, the current file offset should match the one recorded
         * above. */
-       if (uo->pkg->version >= 63 && end_offset != (f->base + f->offset))
+       if (f->pkg->version >= 63 && end_offset != (f->base + f->offset)) {
+               u_err(uo, "mipmap end offset does not match data size");
                goto err_free;
+       }
 
        /* Read in the remaining fields */
        buflen = upkg_export_read(f, buf, 10);
@@ -115,7 +117,10 @@ class Engine:Texture from U:Object (dynamic)
        private unsigned VClamp;
        private unsigned VBits;
 
+       private float DrawScale;
+
        private Engine:Palette *Palette;
+       private Engine:Texture *DetailTexture;
 
        private struct engine_texture_data **mipmap_data;
        private unsigned char mipmap_count;
@@ -136,6 +141,8 @@ class Engine:Texture from U:Object (dynamic)
                for (int i = 0; i < self->_priv->mipmap_count; i++) {
                        data[i] = decode_mipmap(uo);
                        if (!data[i]) {
+                               u_err(uo, "error decoding mipmap level %d", i);
+
                                /* Unwind the allocations. */
                                for (; i >= 0; i--)
                                        free(data[i]);
@@ -265,10 +272,23 @@ class Engine:Texture from U:Object (dynamic)
                , link
                );
 
+       property FLOAT DrawScale
+               ( nick = "Draw Scale"
+               , blurb = "Relative size to parent surface"
+               , link
+               );
+
        property OBJECT Palette
                ( nick = "Palette"
                , blurb = "Reference to the texture's palette."
                , object_type = Engine:Palette
                , link
                );
+
+       property OBJECT DetailTexture
+               ( nick = "Detail Texture"
+               , blurb = "Reference to the corresponding detail texture."
+               , object_type = Engine:Texture
+               , link
+               );
 }