X-Git-Url: http://git.draconx.ca/gitweb/upkg.git/blobdiff_plain/a0efa108741b6cb53ddc3b1228a91b2e0c75a56a..52c1b4699e8f5c396e3316a813d73de8075df97a:/src/engine/texture.gob
diff --git a/src/engine/texture.gob b/src/engine/texture.gob
index 3db176e..165f48a 100644
--- a/src/engine/texture.gob
+++ b/src/engine/texture.gob
@@ -1,23 +1,27 @@
%alltop{
/*
- * upkg: tool for manipulating Unreal Tournament packages.
- * Copyright © 2009-2011 Nick Bowler
+ * upkg: tool for manipulating Unreal Tournament packages.
+ * Copyright © 2009-2012, 2020, 2022 Nick Bowler
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
%}
+%ctop{
+#include
+%}
+
%{
#include
#include
@@ -25,8 +29,8 @@
#include
#include
#include
-#include "pack.h"
-#include "pcx.h"
+#include
+#include
%}
%h{
@@ -52,7 +56,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 +88,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 +121,10 @@ class Engine:Texture from U:Object (dynamic)
private unsigned VClamp;
private unsigned VBits;
- private Engine:Palette *Palette;
+ private float DrawScale;
+
+ private Engine:Palette *Palette = NULL destroywith g_object_unref;
+ private Engine:Texture *DetailTexture = NULL destroywith g_object_unref;
private struct engine_texture_data **mipmap_data;
private unsigned char mipmap_count;
@@ -136,6 +145,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 +276,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
+ );
}