bodies.cc

Go to the documentation of this file.
00001 /*
00002  *  bodies.cc - Associate bodies with 'live' shapes.
00003  *
00004  *  Copyright (C) 2000-2001  The Exult Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #  include <config.h>
00023 #endif
00024 
00025 #include "bodies.h"
00026 #include "hash_utils.h"
00027 #include "game.h"
00028 
00029 using std::size_t;
00030 
00031 /*
00032  *  Each triple here is <live shape>, <body shape>, <body frame>.
00033  */
00034 
00035 short Body_lookup::bg_table[] = { // BLACK GATE.
00036 /*
00037                               Artaxerxes
00038   Hi,
00039   here is the newest (Oct 4 2000 11am EST) bodies.cc file
00040   hope it helps
00041 */
00042 
00043   154, 762, 22,       // x mage
00044   155, 762, 2,        // X Ferryman
00045   226, 892, 29,       // X flying gargoyle
00046   227, 400, 5,        // X monk male
00047   228, 414, 28,       // X naked man
00048   229, 414, 27,       // X naked woman
00049   230, 762, 0,        // x ethereal monster -- there should
00050           //    not be a body.. just blood
00051   247, 762, 23,       // x paladin
00052   259, 400, 20,       // x fighter
00053   265, 400, 27,       // X townsman
00054   274, 414, 2,        // X gargoyle -- Healer (?)
00055   299, 762, 0,        // x ghost
00056   304, 400, 28,       // X forger
00057   317, 762, 0,        // x ghost
00058   318, 400, 5,        // x monk
00059   319, 400, 9,        // x male peasant
00060   337, 762, 0,        // x ghost (invisible)
00061   354, 762, 8,        // x liche
00062   375, 778, 2,        // X unicorn
00063   380, 778, 4,        // X cyclop
00064   381, 778, 3,        // x three headed hydra
00065   382, 414, 7,        // x Kissme
00066   394, 892, 10,       // x guard
00067   401, 762, 25,       // x pirate
00068   401, 400, 16,       // x pirate.
00069   403, 414, 16,       // x Batlin
00070   445, 400, 3,        // X mage male
00071   446, 400, 4,        // X mage female
00072   447, 892, 11,       // x wounded man
00073   448, 400, 6,        // X monk female
00074   449, 400, 7,        // X beggar
00075   450, 400, 8,        // X beggar
00076   451, 400, 13,       // x male noble.
00077   452, 400, 10,       // x female peasant.
00078   454, 400, 12,       // x female shopkeeper.
00079   455, 400, 11,       // x male shopkeeper.
00080   456, 400, 14,       // x female noble.
00081   457, 400, 15,       // x male gypsy 
00082   458, 400, 16,       // x pirate.
00083   459, 400, 17,       // x female gypsy
00084   460, 400, 18,       // x male ranger
00085   461, 400, 19,       // x female ranger
00086   462, 400, 20,       // x male fighter.
00087   463, 400, 21,       // x female fighter.
00088   464, 400, 22,       // X paladin
00089   465, 414, 18,       // x Iolo.
00090   466, 414, 13,       // x Lord British
00091   467, 400, 24,       // X chuck jester
00092   468, 400, 25,       // x male entertainer.
00093   469, 400, 26,       // x female entertainer.
00094   471, 400, 30,       // X kid
00095   472, 400, 31,       // X noble Kid
00096   473, 414, 1,        // X noble Gargoyle
00097   475, 892, 4,        // X Gargoyle -- Forksis (?)
00098   476, 778, 1,        // X Smith (?) -- Iolo's Horse
00099   477, 414, 6,        // X Honest fox
00100   478, 414, 10,       // X Sherry
00101   479, 414, 11,       // X emp
00102   480, 414, 14,       // X noble Gargoyle
00103   482, 414, 16,       // x Batlin
00104   485, 414, 17,       // X thief -- Isle of the Avatar
00105   487, 414, 19,       // X Shamino
00106   488, 414, 20,       // X Dupre
00107   489, 414, 21,       // x Spark.
00108   490, 414, 22,       // X Jaana
00109   491, 892, 12,       // x acid slug
00110   492, 892, 13,       // x alligator
00111   493, 762, 0,        // x bat -- there is no body for 
00112           //   bat... just blood
00113   494, 892, 15,       // x bee
00114   495, 892, 18,       // x cat
00115   496, 892, 24,       // x dog 
00116   498, 892, 20,       // x chicken
00117   499, 892, 21,       // x corpser
00118   500, 778, 11,       // x cow
00119   501, 778, 6,        // x cyclops
00120   502, 778, 12,       // x deer
00121   504, 778, 7,        // x dragon
00122   505, 778, 8,        // x drake
00123   506, 892, 19,       // x Hook.
00124   509, 892, 26,       // x fish
00125   510, 892, 27,       // x fox
00126   511, 762, 2,        // x gazer
00127   513, 762, 4,        // x gremlin
00128   514, 762, 6,        // x headless
00129   517, 762, 7,        // X insects 
00130   519, 762, 8,        // X black shadow dead
00131   521, 762, 10,       // x mouse
00132   523, 762, 11,       // x rat
00133   524, 762, 12,       // x reaper
00134   525, 762, 13,       // X sea serpent -- should disappear
00135   528, 762, 16,       // x skeleton
00136   529, 762, 17,       // X slime
00137   530, 762, 18,       // x snake
00138   532, 762, 5,        // x harpie
00139   533, 778, 5,        // x troll
00140   534, 762, 0,        // x wisp
00141   536, 762, 0,        // x tentacles (invisible).
00142   537, 762, 21,       // x wolf
00143   617, 414, 23,       // X Time Lord (live shape = 617:16)
00144   661, 762, 9,        // x mongbat
00145   706, 762, 26,       // x scorpion
00146   716, 892, 16,       // x bird
00147   720, 400, 23,       // x Guard
00148   721, 400, 1,        // X Avatar male
00149   727, 778, 9,        // x horse
00150   753, 762, 20,       // x stone harpie
00151   784, 892, 25,       // x emp
00152   805, 892, 4,        // x Forksis
00153   806, 892, 7,        // x guard
00154   811, 892, 17,       // x rabbit
00155   861, 778, 5,        // X troll
00156   864, 400, 29,       // X Baby
00157   865, 762, 19,       // x spider
00158   881, 892, 2,        // x Elizabeth
00159   882, 892, 1,        // x Abraham
00160   883, 762, 1,        // x wingless Gargoyle
00161   884, 892, 5,        // x Fellowship member
00162   929, 400, 10,       // x Fellowship member
00163   946, 892, 8,        // x guard
00164   952, 762, 2,        // X Skara Brae Liche
00165   957, 400, 11,       // X shopkeeper
00166   965, 400, 30,       // X little boy
00167   970, 762, 14,       // x sheep
00168   989, 400, 2,        // X avatar female
00169   1015, 414, 4        // x Stone Golem
00170   };
00171 
00172 short Body_lookup::si_table[] = { // SERPENT_ISLE.
00173  /*
00174  Artaxerxes
00175 
00176  Hi,
00177  here again another set of body frame numbers for Exult.
00178  Took me a few hours but now it's done...
00179  Hope that helps.
00180  */
00181 
00182  /*
00183  the dead shapes
00184  */
00185 
00186  //0, 400, 0, // dead bodies
00187 //0, 402, 0, // more dead bodies
00188 //0, 414, 0, // more more dead bodies
00189 //0, 762, 0, // dead bodies
00190 //0, 778, 0, // more dead bodies
00191 //0, 892, 0, // more dead bodies
00192 
00193  /*
00194  living shapes, dead shape, frame number
00195  */
00196 
00197  179, 402, 23, // black robe mage no face
00198 214, 402, 3, // male gwani
00199 226, 414, 10, // old red robe mage
00200 228, 402, 11, // pikeman
00201 229, 414, 8, // naked white man brown hair
00202 230, 414, 27, // naked white woman blonde hair
00203 247, 400, 24, // jester
00204 250, 414, 23, // xenka monk (male?) no face gold belt
00205 259, 402, 12, // male ranger (winemaker) with mask
00206 265, 400, 27, // male shopkeeper (red outfit)
00207 274, 414, 15, // female noble (green dress) wth green crown
00208 298, 892, 16, // pinguin (Linux?)
00209 299, 414, 21, // Cantra (little girl from Monitor)
00210 302, 762, 3, // grizzly bear (brown)
00211 304, 400, 28, // male forger
00212 312, 892, 19, // kid goblins
00213 317, 402, 13, // possessed Shamino
00214 318, 414, 16, // Batlin
00215 319, 400, 9, // male peasant (brown outfit)
00216 329, 892, 25, // boar
00217 334, 762, 22, // green monster with long neck
00218 337, 762, 15, // phantom
00219 354, 762, 11, // Gurnodir (king Goblin)
00220 363, 892, 14, // magic gremlins
00221 372, 778, 1, // ice troll
00222 373, 402, 31, // skeletton with ripped robe
00223 375, 778, 2, // unicorn
00224 381, 414, 17, // male thief (black band on eyes)
00225 382, 762, 10, // ratman
00226 401, 402, 15, // male noble-mage with orange-red coat and blue undies
00227 446, 400, 4, // old female wild mage
00228 447, 402, 18, // red eye wolf
00229 449, 762, 29, // polar bear (white)
00230 451, 400, 13, // male mayor (blue outfit)
00231 454, 400, 12, // female citizen (orange outfit)
00232 455, 400, 11, // male citizen (orange outfit)
00233 457, 400, 15, // male gypsy
00234 458, 400, 16, // male pirate
00235 460, 778, 7, // skeletal dragon
00236 461, 400, 19, // female ranger (no mask)
00237 462, 400, 20, // male fighter (mail arms and legs)
00238 464, 400, 22, // paladin (square helm)
00239 465, 414, 18, // Iolo
00240 468, 400, 25, // male shopkeeper (beige outfit)
00241 469, 400, 26, // female gypsie
00242 472, 892, 29, // noble little boy
00243 478, 414, 4, // male goblins
00244 480, 414, 1, // noble winged gargoyle
00245 487, 414, 19, // Shamino
00246 488, 414, 20, // Dupre
00247 491, 892, 12, // acid slug
00248 492, 762, 1, // alligator
00249 493, 892, 9, // bat
00250 494, 402, 19, // Goul (?)
00251 495, 892, 18, // cat
00252 496, 892, 24, // dog
00253 498, 892, 11, // chicken
00254 499, 892, 13, // corpser
00255 500, 778, 11, // cow
00256 501, 778, 4, // cyclop
00257 502, 778, 12, // deer
00258 509, 892, 26, // trout
00259 510, 892, 27, // fox
00260 511, 892, 1, // gazer
00261 512, 400, 0, // red worm/snake (whack-a-snake)
00262 514, 762, 6, // headless
00263 517, 892, 2, // insect
00264 521, 400, 0, // flying serpent/dragon (dreamland)
00265 523, 892, 4, // rat
00266 524, 762, 12, // reaper
00267 528, 762, 16, // skelet
00268 529, 892, 8, // slime
00269 530, 892, 6, // serpent
00270 532, 762, 5, // harpie
00271 533, 778, 5, // Troll
00272 536, 400, 0, // sea tentacle
00273 537, 892, 7, // wolf (normal)
00274 550, 762, 7, // brass automaton
00275 560, 400, 3, // female beauty priestess
00276 565, 400, 6, // Caladin
00277 581, 400, 7, // old male mage with cane (green outfit)
00278 588, 762, 8, // male vampire (very blue outfit)
00279 647, 400, 5, // female fighter
00280 652, 400, 17, // female mayor (blue outfit)
00281 658, 400, 30, // Petra
00282 660, 400, 10, // no skin gwani (?)
00283 661, 762, 9, // Mongbat
00284 665, 402, 22, // female mage (black outfit, red belt)
00285 669, 400, 8, // trapper (Gwenno)
00286 691, 414, 4, // male goblins
00287 702, 892, 20, // phoenix
00288 703, 400, 0, // ice corpser
00289 706, 762, 26, // scorpio
00290 716, 892, 10, // bird
00291 720, 400, 23, // male guard (purple/red outfit + chain helm)
00292 721, 400, 1, // male bonde avatar
00293 725, 414, 4, // male goblins
00294 734, 402, 21, // gold automaton
00295 742, 400, 21, // female worker (black top, white skirt)
00296 744, 414, 5, // female goblins
00297 747, 762, 27, // iron automaton
00298 753, 762, 20, // stone harpie
00299 754, 762, 2, // snow leopard
00300 763, 892, 28, // ice snake
00301 766, 402, 2, // female spanish dancer
00302 772, 892, 31, // parrot
00303 798, 402, 16, // small ice dragon
00304 805, 402, 4, // black male fighter
00305 809, 414, 2, // young male mage (dark blue coat + gold trim)
00306 811, 892, 17, // rabbit
00307 814, 402, 5, // male artist (blue outfit)
00308 815, 402, 6, // tall male individual (ripped clothes)
00309 816, 402, 7, // male fighter (orange outfit + chain mail)
00310 817, 402, 14, // young male mage (brown coat + grey undies)
00311 818, 402, 9, // Zulith (?)
00312 830, 402, 8, // Chancellor (Monitor)
00313 832, 778, 8, // ice sea serpent
00314 846, 762, 24, // snake woman
00315 855, 414, 6, // Great Captain
00316 861, 762, 23, // fire elemental
00317 862, 414, 7, // male gwani
00318 865, 762, 19, // spider
00319 867, 892, 30, // baby gwani
00320 874, 762, 17, // St-Bernard (Hound)
00321 877, 778, 6, // Big ice dragon
00322 880, 762, 18, // possessed Iolo
00323 882, 892, 21, // flying red snake
00324 883, 414, 3, // wingless gargoyle
00325 885, 778, 3, // magic black horse
00326 888, 414, 11, // female spanish dancer
00327 906, 762, 21, // possessed Dupre
00328 915, 400, 0, // brown tentacle
00329 916, 414, 12, // male artist (purple coat + blue undies)
00330 917, 402, 10, // male trapper (?)
00331 945, 402, 29, // dressed iron automaton
00332 946, 402, 27, // male mage (very blue outfit)
00333 947, 402, 28, // gold male fighter (Silver Seed)
00334 957, 402, 30, // catman creature (SS)
00335 968, 402, 17, // ice golem
00336 970, 892, 5, // sheep
00337 975, 400, 20, // male fighter (brown outfit + chain mail)
00338 978, 778, 9, // green dragon
00339 979, 778, 10, // man spider
00340 981, 402, 25, // liche
00341 989, 400, 2, // white female avatar
00342 1015, 402, 26, // female citizen (blue dress + green sleeves)
00343 1024, 414, 28, // black male avatar
00344 1025, 414, 29, // black female avatar
00345 1026, 414, 30, // brown male avatar
00346 1027, 414, 31, // brown female avatar
00347 1028, 400, 1, // blonde male avatar
00348 1029, 400, 2 // blonde female avatar
00349 
00350  /*
00351  the missing shapes
00352  */
00353 
00354  //392, 0, 0, // old female mage with gold belt
00355 //482, 0, 0, // insivible woman
00356 //793, 0, 0, // Lord British
00357 //853, 0, 0, // invisible man
00358 //891, 0, 0, // naked male brown avatar
00359 //893, 0, 0, // naked male black avatar
00360 //921, 0, 0, // naked male blonde avatar
00361 //930, 0, 0, // naked female bonde avatar
00362 //933, 0, 0, // naked female black avatar
00363 //938, 0, 0, // naked female brown avatar
00364 //1030, 0, 0, // naked black male avatar
00365 //1031, 0, 0, // naked black female avatar
00366 //1032, 0, 0, // naked brown male avatar
00367 //1033, 0, 0, // naked brown female avatar
00368 //1034, 0, 0, // naked blonde male avatar
00369 //1035, 0, 0, // naked blonde female avatar
00370 
00371   };
00372 
00373 #ifndef DONT_HAVE_HASH_SET
00374 
00375 /*
00376  *  Hash function for triples in table:
00377  */
00378 class Hash_shapes
00379   {
00380 public:
00381           // Return 'live' shape.
00382   size_t operator() (const short *t) const
00383     { return t[0]; }
00384   };
00385 
00386 /*
00387  *  For testing if two triples match.
00388  */
00389 class Equal_shapes
00390   {
00391 public:
00392       bool operator() (const short *a, const short *b) const
00393         { return a[0] == b[0]; }
00394   };
00395 
00396 #else
00397 
00398 /*
00399  *  For testing whether one shape is less than another
00400  */
00401 class Less_shapes
00402   {
00403 public:
00404       bool operator() (const short *a, const short *b) const
00405         { return a[0] < b[0]; }
00406   };
00407 
00408 #endif
00409 
00410 /*
00411  *  Lookup a shape's body.
00412  *
00413  *  Output: 0 if not found.
00414  */
00415 
00416 int Body_lookup::find
00417   (
00418   int liveshape,      // Live actor's shape.
00419   int& deadshape,     // Dead shape returned.
00420   int& deadframe      // Dead frame returned.
00421   )
00422   {
00423 #ifndef DONT_HAVE_HASH_SET
00424   static hash_set<short *, Hash_shapes, Equal_shapes> *htable = 0;
00425 #else
00426   static std::set<short *, Less_shapes> *htable = 0;
00427 #endif
00428 
00429   if (!htable)      // First time?
00430     {
00431 #ifndef DONT_HAVE_HASH_SET
00432     htable = new hash_set<short *, Hash_shapes, Equal_shapes>(300);
00433 #else
00434     htable = new std::set<short *, Less_shapes>();
00435 #endif
00436     short *ptr;
00437     int cnt;
00438     if (Game::get_game_type() == BLACK_GATE)
00439       {
00440       cnt = sizeof(bg_table)/(3*sizeof(bg_table[0]));
00441       ptr = &bg_table[0];
00442       }
00443     else
00444       {
00445       cnt = sizeof(si_table)/(3*sizeof(si_table[0]));
00446       ptr = &si_table[0];
00447       }
00448     while (cnt--)   // Add values.
00449       {
00450       htable->insert(ptr);
00451       ptr += 3;
00452       }
00453     }
00454   short key = (short) liveshape;
00455 #ifndef DONT_HAVE_HASH_SET
00456   hash_set<short *, Hash_shapes, Equal_shapes>::iterator it =
00457               htable->find(&key);
00458 #else
00459   std::set<short *, Less_shapes>::iterator it = htable->find(&key);
00460 #endif
00461   if (it != htable->end())
00462     {
00463     short *triple = *it;
00464     deadshape = triple[1];
00465     deadframe = triple[2];
00466     return 1;
00467     }
00468   else
00469     return 0;
00470   }
00471 
00472 
00473 /*
00474  *  Recognize dead body shapes.  +++++++Hopefully, there's a better way.
00475  */
00476 
00477 int Is_body
00478   (
00479   int shapeid
00480   )
00481   {
00482   switch (shapeid)
00483     {
00484   case 400:
00485   case 414:
00486   case 762:
00487   case 778:
00488   case 892:
00489     return 1;
00490   case 402:
00491     return Game::get_game_type() == SERPENT_ISLE;
00492   default:
00493     return 0;
00494     }
00495   }

Generated on Mon Jul 9 14:42:50 2007 for ExultEngine by  doxygen 1.5.1