[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src pingus_resource.cxx,1.10,1.11 res_des
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src pingus_resource.cxx,1.10,1.11 res_descriptor.cxx,1.3,1.4 xml_helper.cxx,1.4,1.5 |
Date: |
26 Jun 2002 09:29:50 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv19572
Modified Files:
pingus_resource.cxx res_descriptor.cxx xml_helper.cxx
Log Message:
- fixed a few bugs in the rot/flip code
- load save of rot/flip surfaces seems to work
- background color bug on rot/flip surfaces needs a fix in clanlib
Index: pingus_resource.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_resource.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pingus_resource.cxx 25 Jun 2002 21:31:40 -0000 1.10
+++ pingus_resource.cxx 26 Jun 2002 09:29:47 -0000 1.11
@@ -123,46 +123,13 @@
CL_Surface
PingusResource::load_surface(const ResDescriptor& res_desc)
{
- pout(PINGUS_DEBUG_LOADING) << "PingusResource: Loading surface: " <<
res_desc << std::endl;
+ pout(PINGUS_DEBUG_RESOURCES) << "PingusResource: Loading surface: " <<
res_desc << std::endl;
CL_Surface surf(surface_map[res_desc]);
-
- if (surf)
- {
- // FIXME: buggy... and in the wrong place
- switch (res_desc.modifier)
- {
- // FIXME: muahhhaa... I write slower code than you....
- case ROT0:
- return surf;
-
- case ROT90:
- return Blitter::rotate_90(surf);
-
- case ROT180:
- return Blitter::rotate_90(Blitter::rotate_90(surf));
- case ROT270:
- return
Blitter::rotate_90(Blitter::rotate_90(Blitter::rotate_90(surf)));
-
- case ROT0FLIP:
- return Blitter::flip_horizontal(Blitter::rotate_90(surf));
-
- case ROT90FLIP:
- return Blitter::flip_horizontal(Blitter::rotate_90(surf));
-
- case ROT180FLIP:
- return
Blitter::flip_horizontal(Blitter::rotate_90(Blitter::rotate_90(surf)));
-
- case ROT270FLIP:
- return
Blitter::flip_horizontal(Blitter::rotate_90(Blitter::rotate_90(Blitter::rotate_90(surf))));
-
- default:
- std::cout << "PingusResource: Unhandled modifier: " <<
res_desc.modifier << std::endl;
- return surf;
- }
- }
- else
+ std::cout << "Desc.Modifier: " << rs_to_string(res_desc.modifier) <<
std::endl;
+
+ if (!surf)
{
//std::cout << "PingusResource: Loading resource: " << res_desc.type <<
":"
//<< res_desc.datafile << " - " << res_desc.res_name << std::endl;
@@ -185,7 +152,7 @@
}
}
surface_map[res_desc] = surf;
- return surf;
+ break;
case ResDescriptor::RD_FILE:
{
@@ -196,7 +163,7 @@
surf = CL_Surface(new CL_PNGProvider(filename, NULL), false);
pout << "DONE" << std::endl;
surface_map[res_desc] = surf;
- return surf;
+ break;
}
case ResDescriptor::RD_AUTO:
@@ -206,9 +173,42 @@
default:
perr << "PingusResource: Unknown ResDescriptor::type: " <<
res_desc.type << std::endl;
assert (false);
- return CL_Surface();
+ surf = CL_Surface();
+ break;
}
}
+
+ switch (res_desc.modifier)
+ {
+ // FIXME: muahhhaa... I write slower code than you....
+ case ROT0:
+ return surf;
+
+ case ROT90:
+ return Blitter::rotate_90(surf);
+
+ case ROT180:
+ return Blitter::rotate_90(Blitter::rotate_90(surf));
+
+ case ROT270:
+ return Blitter::rotate_90(Blitter::rotate_90(Blitter::rotate_90(surf)));
+
+ case ROT0FLIP:
+ return Blitter::flip_horizontal(surf);
+
+ case ROT90FLIP:
+ return Blitter::flip_horizontal(Blitter::rotate_90(surf));
+
+ case ROT180FLIP:
+ return
Blitter::flip_horizontal(Blitter::rotate_90(Blitter::rotate_90(surf)));
+
+ case ROT270FLIP:
+ return
Blitter::flip_horizontal(Blitter::rotate_90(Blitter::rotate_90(Blitter::rotate_90(surf))));
+
+ default:
+ std::cout << "PingusResource: Unhandled modifier: " << res_desc.modifier
<< std::endl;
+ return surf;
+ }
}
CL_Font*
@@ -264,7 +264,7 @@
void
PingusResource::cleanup ()
{
- pout(PINGUS_DEBUG_RESOURCES) << "XXXX PingusResource::cleanup ()" <<
std::endl;
+ pout(PINGUS_DEBUG_RESOURCES) << "PingusResource::cleanup ()" << std::endl;
for (std::map<ResDescriptor, CL_Surface>::iterator i = surface_map.begin ();
i != surface_map.end (); ++i)
Index: res_descriptor.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/res_descriptor.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- res_descriptor.cxx 25 Jun 2002 21:31:40 -0000 1.3
+++ res_descriptor.cxx 26 Jun 2002 09:29:47 -0000 1.4
@@ -22,11 +22,14 @@
#include "res_descriptor.hxx"
#include "pingus_error.hxx"
+using namespace Pingus;
+
ResDescriptor::ResDescriptor()
{
type = RD_RESOURCE;
res_name = "";
datafile = "global";
+ modifier = ROT0;
}
ResDescriptor::ResDescriptor(const ResDescriptor& res_desc)
@@ -34,7 +37,7 @@
type = res_desc.type;
datafile = res_desc.datafile;
res_name = res_desc.res_name;
- modifier = Pingus::ROT0;
+ modifier = res_desc.modifier;
}
ResDescriptor::ResDescriptor(const std::string& arg_res_name,
Index: xml_helper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_helper.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xml_helper.cxx 25 Jun 2002 12:20:31 -0000 1.4
+++ xml_helper.cxx 26 Jun 2002 09:29:47 -0000 1.5
@@ -22,12 +22,15 @@
#include "xml_helper.hxx"
#include "color.hxx"
#include "res_descriptor.hxx"
+#include "resource_modifier.hxx"
// Hack: if xmlIsBlankNode() is not present, we define an empty dummy
#ifdef NO_XMLISBLANKNODE
int xmlIsBlankNode(xmlNodePtr node) { return 0; }
#endif
+using namespace Pingus;
+
std::string
XMLhelper::encode_entities(const std::string& arg_str)
{
@@ -188,6 +191,17 @@
free(filename);
}
}
+ else if (strcmp((char*) ccur->name, "modifier") == 0)
+ {
+ char* ident = (char*)xmlNodeListGetString(doc,
ccur->children, 1);
+ if (ident)
+ {
+ std::cout << "Seen: modifier: " << ident << std::endl;
+
+ desc.modifier = rs_from_string(ident);
+ free(ident);
+ }
+ }
else
{
std::cout << __FILE__ ":"
@@ -227,6 +241,22 @@
free(ident);
}
}
+ else if (strcmp((char*)ccur->name, "modifier") == 0)
+ {
+ std::cout << "Modifier!!!!!" << std::endl;
+ char* ident = (char*)xmlNodeListGetString(doc,
ccur->children, 1);
+ if (ident)
+ {
+ std::cout << "Seen: modifier: " << ident << std::endl;
+
+ desc.modifier = rs_from_string(ident);
+ free(ident);
+ }
+ }
+ else
+ {
+ std::cout << "XMLHelper:parse_surface: unhandled " <<
ccur->name << std::endl;
+ }
ccur = ccur->next;
}
}
@@ -290,7 +320,8 @@
std::cout << "EditorObj::save_desc_xml(): Unhandled resource type" <<
std::endl;
break;
}
-
+
+ xml << " <modifier>" << rs_to_string(desc.modifier) << "</modifier>" <<
std::endl;
xml << " </resource></surface>" << std::endl;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src pingus_resource.cxx,1.10,1.11 res_descriptor.cxx,1.3,1.4 xml_helper.cxx,1.4,1.5,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.10,1.11
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src prefab_data.hxx,NONE,1.1 resource_modifier.cxx,NONE,1.1 resource_modifier.hxx,NONE,1.1
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.10,1.11
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src prefab_data.hxx,NONE,1.1 resource_modifier.cxx,NONE,1.1 resource_modifier.hxx,NONE,1.1
- Index(es):