--- deliantra/server/include/face.h 2007/07/24 04:55:34 1.20
+++ deliantra/server/include/face.h 2011/04/23 04:56:48 1.36
@@ -1,24 +1,23 @@
/*
- * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
+ * This file is part of Deliantra, the Roguelike Realtime MMORPG.
*
- * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
- * Copyright (©) 1994,2007 Mark Wedel
- * Copyright (©) 1992,2007 Frank Tore Johansen
+ * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
*
- * Crossfire TRT 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.
+ * Deliantra is free software: you can redistribute it and/or modify it under
+ * the terms of the Affero 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.
*
- * 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 Affero GNU General Public License
+ * and the GNU General Public License along with this program. If not, see
+ * .
*
- * The authors can be reached via e-mail to
+ * The authors can be reached via e-mail to
*/
#ifndef FACE_H__
@@ -27,17 +26,22 @@
#include
#include
-#define CHKSUM_SIZE 6
+#define CHKSUM_MAXLEN 15
#define MAX_FACES 10000 // stupid gcfclient artificially limits
typedef uint16 faceidx;
-extern faceidx blank_face, empty_face;
+extern faceidx blank_face, empty_face, magicmouth_face;
struct facedata
{
std::string data;
- uint8 chksum[CHKSUM_SIZE];
+ uint8 chksum[CHKSUM_MAXLEN];
+ uint8 chksum_len;
+
+ facedata ()
+ : chksum_len (0)
+ { }
};
/* New face structure - this enforces the notion that data is face by
@@ -46,9 +50,14 @@
*/
struct faceinfo
{
+ faceinfo ()
+ : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0)
+ {
+ }
+
shstr name;
std::string meta;
- facedata data32, data64; // either 32/64 face or data32 == generic resource
+ facedata face[3]; // indexed by faceset, 0 == 32 bit or generic, 1 == 64, 2 == text
faceidx number; /* This is the image id. It should be the */
/* same value as its position in the array */
faceidx smooth; /* the smooth face for this face, or 0 */
@@ -57,20 +66,19 @@
uint8 visibility;
uint8 magicmap; /* Color to show this in magic map */
- faceinfo ()
- : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0)
- { }
-
facedata *data (int faceset) const;
};
inline void
-object_freezer::put (keyword k, faceinfo *v)
+object_freezer::put (const keyword_string k, faceinfo *v)
{
- put (k, v ? &v->name : (const char *)0);
+ if (expect_true (v))
+ put (k, v->name);
+ else
+ put (k);
}
-typedef std::tr1::unordered_map >, true> facehash_t;
+typedef std::tr1::unordered_map > > facehash_t;
extern facehash_t facehash;
extern std::vector faces;
@@ -99,11 +107,11 @@
struct animation
{
- shstr name; /* Name of the animation sequence */
- animidx number;
- uint8 num_animations; /* How many different faces to animate */
- uint8 facings; /* How many facings (1,2,4,8) */
faceidx *faces; /* The different animations */
+ int num_animations; /* How many different faces to animate */
+ sint8 facings; /* How many facings (1,2,4,8) */
+ animidx number;
+ shstr name; /* Name of the animation sequence */
static animation &create (const char *name, uint8 frames, uint8 facings = 1);
static animation &find (const char *name);
@@ -111,9 +119,8 @@
void resize (int new_size);
};
-typedef std::tr1::unordered_map >, true> animhash_t;
+typedef std::tr1::unordered_map > > animhash_t;
-extern animhash_t animhash;
extern std::vector animations;
#endif