1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
461 | } |
461 | } |
462 | else |
462 | else |
463 | move_type = MOVE_WALK; |
463 | move_type = MOVE_WALK; |
464 | } |
464 | } |
465 | } |
465 | } |
|
|
466 | |
|
|
467 | // if the object has an animation, try to provide a default face |
|
|
468 | if (has_anim ()) |
|
|
469 | { |
|
|
470 | const animation &anim_ob = anim (); |
|
|
471 | |
|
|
472 | if (anim_speed) |
|
|
473 | // if this item is time-animated, force the last frame |
|
|
474 | animate_object (this, 0); |
|
|
475 | else if (flag [FLAG_MONSTER]) |
|
|
476 | // if it is a monster, set appropriate facing |
|
|
477 | animate_object (this, direction); |
|
|
478 | } |
466 | } |
479 | } |
467 | |
480 | |
468 | static void |
481 | static void |
469 | set_move (MoveType &mt, const char *str) |
482 | set_move (MoveType &mt, const char *str) |
470 | { |
483 | { |
… | |
… | |
1289 | |
1302 | |
1290 | /* We don't need to worry about the arch's extra fields - they |
1303 | /* We don't need to worry about the arch's extra fields - they |
1291 | * will get taken care of the copy_to method. |
1304 | * will get taken care of the copy_to method. |
1292 | */ |
1305 | */ |
1293 | |
1306 | |
|
|
1307 | if (op->uuid) |
1294 | f.put (KW_uuid, op->uuid.c_str ()); |
1308 | f.put (KW_uuid, op->uuid.c_str ()); |
1295 | |
1309 | |
1296 | #define CMP_OUT(v) if (expect_false (op->v != tmp->v)) f.put (KW_ ## v, op->v) |
1310 | #define CMP_OUT(v) if (expect_false (op->v != tmp->v)) f.put (KW_ ## v, op->v) |
1297 | #define CMP_OUT2(k,v) if (expect_false (op->v != tmp->v)) f.put (KW_ ## k, op->v) |
1311 | #define CMP_OUT2(k,v) if (expect_false (op->v != tmp->v)) f.put (KW_ ## k, op->v) |
1298 | |
1312 | |
1299 | if (object *owner = op->owner) |
1313 | if (object *owner = op->owner) |
… | |
… | |
1430 | * the only place this is not set is when saving the player. |
1444 | * the only place this is not set is when saving the player. |
1431 | */ |
1445 | */ |
1432 | bool |
1446 | bool |
1433 | object::write (object_freezer &f) |
1447 | object::write (object_freezer &f) |
1434 | { |
1448 | { |
1435 | archetype *at = arch ? arch : archetype::empty; |
1449 | if (is_arch ()) |
1436 | |
1450 | { |
|
|
1451 | f.put (KW_object, arch->archname); |
|
|
1452 | write_diff (f, this, archetype::empty); |
|
|
1453 | } |
|
|
1454 | else |
|
|
1455 | { |
1437 | f.put (KW_arch, at->archname); |
1456 | f.put (KW_arch, arch->archname); |
1438 | write_diff (f, this, at); |
1457 | write_diff (f, this, arch); |
|
|
1458 | } |
1439 | |
1459 | |
1440 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1460 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1441 | tmp->write (f); |
1461 | tmp->write (f); |
1442 | |
1462 | |
1443 | f.put (this); |
1463 | f.put (this); |