Re: [DM-dev] Dungeon Rendering :)
Brought to you by:
acdalton,
henningsen
From: Stephan B. <ste...@ei...> - 2001-05-02 08:57:42
|
On Tuesday 01 May 2001 00:45, Henningsen wrote: > >> Remember to give doors the number 7;-) like in floor=3D0, wall=3D1, > >> high wall=3D2,... door=3D7! > > > >Ah, yes, I forgot about that. I'll fix that tonight. > > That's just for the internal parameters - when the map is printed, it > can of course be anything... "D" would probably be best i think. When > you talk about "rendering", I presume you mean rendering to the "Map" > object inside the DungeonMaker? You're not putting some kind of > "rendering-to-screen" function in the program, right? That should all > be left to the users IMO. Okay, here's the current state: I've got the Door class basically done, but I've got a bug or two I=20 need to work out. The problem is, it works okay as long as you don't=20 change the orientation of your wall after the Door is placed. Let's say=20 you have a wall which looks like: xxxDxxx (D =3D=3D Door) If you call setOrientation( Vertical ), the wall will look like: x x x x x x x But the Door will be here: x[--D----] x x x x x x and won't be rendered (or rendered incorrectly). I want to fix this=20 before I commit the Door stuff. I know it's not an important fix, but I=20 think it will be handy later for other types of objects, and allows=20 programmers to change their walls after building them without having to=20 move the doors manually. The problem is that I know if I don't fix this=20 now, I'll be scratching my head in 2 months saying, "why does it do=20 that?" because I will have forgotten what the problem was (aus dem=20 Augen, aus den Sinn). The current implementation of setting a wall's orientation is kind of=20 lame, but it works for our simple case: it simply resizes the wall.=20 Each wall has a Length field. If orientation =3D=3D Horiz, then it's=20 resized to length,1. If it's vertical, then it's resized to 1,length.=20 The 1 is currently hardcoded, but can be gotten around by calling=20 resize() or setGeometry() on the wall after setOrientation() is called.=20 I will work around this inconsistency one of these days, and get away=20 from the hard-coded width/height of 1. I spent much of yesterday working on adding convenience functions to=20 the DungeonElement API and getting the Doors done. I've added the=20 following to the DE API: get/setSquareSubType(): by default this returns -1. Subclasses may use=20 this to set a "sub type" for their square. A Wall square could specify,=20 for example, if it's a corner wall, a "high wall", etc. A door could be=20 open, closed, gold-inlaid, etc. This function is used by Door to hold=20 it's type. The subtype can be collected for the object as a whole (the=20 case with most objects, plus the default implementation) or objects may=20 supply a subtype for a square at at a given x/y coordinate. Currently=20 only Door uses these at all, but it's there for future use if we want=20 it. I think client apps will get the most out of it, as it lets them do=20 things with their rooms which DungeonMaker can't do (doesn't specify=20 corner wall joins, for example). I've also added several other convenience functions, like: - removeAllOfType( DungeonElement *de ) removes all child objects which are of the same class as the given=20 DungeonElement *. A Room can use this, for example, to remove all walls while keeping=20 other data (like the chest of gold in the middle):=20 Wall *w =3D new Wall(); removeAllOfType( w ); delete( wall ); Actually, that function is completely untested, but "should work" ;). Load/save is still on the back burner. I spent about 4 hours yesterday=20 completely rewiring the class hierarchy and moving functions around=20 into a hierarchy which made more sense to my brain. We should now have=20 forward-compatible save support so we can drop in binary, XML,=20 GridSlammer, etc. save support with very little pain later on (the pain=20 is only in the parser). We'll simply have to implement new Serializer=20 objects for the new file types. I've still got plenty of work to do on=20 the text-saving version, I think a few more days. See ya! ----- Stephan Beal Generic Universal Computer Guy ste...@ei... - http://www.einsurance.de Office: +49 (89) 552 92 862 Handy: +49 (179) 211 97 67 "Go away or I shall replace you with a very small shell script." |