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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2003-2005,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2003-2005,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 |
… | |
… | |
42 | #define FABS(x) fabs (x) |
42 | #define FABS(x) fabs (x) |
43 | |
43 | |
44 | #ifdef __NetBSD__ |
44 | #ifdef __NetBSD__ |
45 | # include <sys/param.h> |
45 | # include <sys/param.h> |
46 | #endif |
46 | #endif |
47 | #ifndef MIN |
|
|
48 | # define MIN(x,y) min (x, y) |
|
|
49 | #endif |
|
|
50 | #ifndef MAX |
|
|
51 | # define MAX(x,y) max (x, y) |
|
|
52 | #endif |
|
|
53 | |
47 | |
54 | // maximum length of an object name in the protocol |
48 | // maximum length of an object name in the protocol |
55 | #define NAME_LEN 127 |
49 | #define NAME_LEN 127 |
56 | |
50 | |
57 | /* MAX3 is basically like MAX, but instead does 3 values. */ |
|
|
58 | #ifndef MAX3 |
|
|
59 | # define MAX3(x,y, z) (MAX(x, MAX(y,z))) |
|
|
60 | #endif |
|
|
61 | |
|
|
62 | /* MIN3 is basically like MIN, but instead does 3 values. */ |
|
|
63 | #ifndef MIN3 |
51 | #undef MIN |
64 | # define MIN3(x,y, z) (MIN(x, MIN(y,z))) |
52 | #undef MAX |
65 | #endif |
|
|
66 | |
53 | |
67 | #define MAX_STAT 30 /* The maximum legal value of any stat */ |
54 | #define MAX_STAT 30 /* The maximum legal value of any stat */ |
68 | #define MIN_STAT 1 /* The minimum legal value of any stat */ |
55 | #define MIN_STAT 1 /* The minimum legal value of any stat */ |
69 | |
56 | |
70 | //TODO: not only use more reasonable values, also enforce them |
57 | //TODO: not only use more reasonable values, also enforce them |
… | |
… | |
312 | // maximum supported subtype number + 1, can be increased to 256 |
299 | // maximum supported subtype number + 1, can be increased to 256 |
313 | // currently (2007-09) in use: 50 |
300 | // currently (2007-09) in use: 50 |
314 | #define NUM_SUBTYPES 64 |
301 | #define NUM_SUBTYPES 64 |
315 | |
302 | |
316 | /* Subtypes for BUILDER */ |
303 | /* Subtypes for BUILDER */ |
317 | #define ST_BD_BUILD 1 /* Builds an item */ |
304 | #define ST_BD_BUILD 1 /* Builds an item */ |
318 | #define ST_BD_REMOVE 2 /* Removes an item */ |
305 | #define ST_BD_REMOVE 2 /* Removes an item */ |
319 | |
306 | |
320 | /* Subtypes for MATERIAL */ |
307 | /* Subtypes for MATERIAL */ |
321 | #define ST_MAT_FLOOR 1 /* Floor */ |
308 | #define ST_MAT_FLOOR 1 /* Floor */ |
322 | #define ST_MAT_WALL 2 /* Wall */ |
309 | #define ST_MAT_WALL 2 /* Wall */ |
323 | #define ST_MAT_ITEM 3 /* All other items, including doors & such */ |
310 | #define ST_MAT_ITEM 3 /* All other items, including doors & such */ |
… | |
… | |
394 | * freearr, add these values. <= SIZEOFFREE1 will get you |
381 | * freearr, add these values. <= SIZEOFFREE1 will get you |
395 | * within 1 space. <= SIZEOFFREE2 wll get you withing |
382 | * within 1 space. <= SIZEOFFREE2 wll get you withing |
396 | * 2 spaces, and the entire array (< SIZEOFFREE) is |
383 | * 2 spaces, and the entire array (< SIZEOFFREE) is |
397 | * three spaces |
384 | * three spaces |
398 | */ |
385 | */ |
|
|
386 | #define SIZEOFFREE0 0 |
399 | #define SIZEOFFREE1 8 |
387 | #define SIZEOFFREE1 8 |
400 | #define SIZEOFFREE2 24 |
388 | #define SIZEOFFREE2 24 |
|
|
389 | #define SIZEOFFREE3 48 |
401 | #define SIZEOFFREE 49 |
390 | #define SIZEOFFREE 49 |
402 | |
391 | |
403 | #define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ |
392 | #define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ |
404 | |
393 | |
405 | /* |
394 | /* |
406 | * If any FLAG's are added or changed, make sure the flag_names structure in |
395 | * If any FLAG's are added or changed, make sure the flag_names structure in |
… | |
… | |
533 | |
522 | |
534 | #define FLAG_NO_STEAL 96 /* Item can't be stolen */ |
523 | #define FLAG_NO_STEAL 96 /* Item can't be stolen */ |
535 | #define FLAG_ONE_HIT 97 /* Monster can only hit once before going |
524 | #define FLAG_ONE_HIT 97 /* Monster can only hit once before going |
536 | * away (replaces ghosthit) |
525 | * away (replaces ghosthit) |
537 | */ |
526 | */ |
538 | #define FLAG_CLIENT_SENT 98 /* THIS IS A DEBUG FLAG ONLY. We use it to |
527 | #define FLAG_DEBUG 98 // formerly FLAG_CLIENT_SENT, not used except for debugging |
539 | * detect cases were the server is trying |
|
|
540 | * to send an upditem when we have not |
|
|
541 | * actually sent the item. |
|
|
542 | */ |
|
|
543 | |
528 | |
544 | #define FLAG_BERSERK 99 /* monster will attack closest living |
529 | #define FLAG_BERSERK 99 /* monster will attack closest living |
545 | object */ |
530 | object */ |
546 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
531 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
547 | #define FLAG_NO_ATTACK 101 /* monster doesn't attack */ |
532 | #define FLAG_NO_ATTACK 101 /* monster doesn't attack */ |
… | |
… | |
599 | * |
584 | * |
600 | */ |
585 | */ |
601 | #define OB_TYPE_MOVE_BLOCK(ob1, type) \ |
586 | #define OB_TYPE_MOVE_BLOCK(ob1, type) \ |
602 | ((type) && (ob1->move_type & type) == ob1->move_type) |
587 | ((type) && (ob1->move_type & type) == ob1->move_type) |
603 | |
588 | |
604 | #define SET_GENERATE_TYPE(xyz,va) (xyz)->stats.sp=(va) |
|
|
605 | #define GENERATE_TYPE(xyz) ((xyz)->stats.sp) |
|
|
606 | #define GENERATE_SPEED(xyz) ((xyz)->stats.maxsp) /* if(!RANDOM()%<speed>) */ |
589 | #define GENERATE_SPEED(xyz) ((xyz)->stats.maxsp) /* if(!RANDOM()%<speed>) */ |
607 | |
590 | |
608 | #define EXIT_PATH(xyz) (xyz)->slaying |
591 | #define EXIT_PATH(xyz) (xyz)->slaying |
609 | #define EXIT_LEVEL(xyz) (xyz)->stats.food |
592 | #define EXIT_LEVEL(xyz) (xyz)->stats.food |
610 | #define EXIT_X(xyz) (xyz)->stats.hp |
593 | #define EXIT_X(xyz) (xyz)->stats.hp |
… | |
… | |
772 | // also make sure that this is a float, not double, constant |
755 | // also make sure that this is a float, not double, constant |
773 | #define MIN_ACTIVE_SPEED (1.f / 65536.f) |
756 | #define MIN_ACTIVE_SPEED (1.f / 65536.f) |
774 | |
757 | |
775 | #define RANDOM() (rndm.next () & 0xffffffU) |
758 | #define RANDOM() (rndm.next () & 0xffffffU) |
776 | |
759 | |
777 | /* Returns the weight of the given object. Note: it does not take the number of |
|
|
778 | * items (nrof) into account. |
|
|
779 | * (this looks rather bogus, schmorp) |
|
|
780 | */ |
|
|
781 | #define WEIGHT(op) ((op)->nrof ? (op)->weight : (op)->weight + (op)->carrying) |
|
|
782 | |
|
|
783 | /* |
760 | /* |
784 | * Warning! |
761 | * Warning! |
785 | * If you add message types here, don't forget |
762 | * If you add message types here, don't forget |
786 | * to keep the client up to date too! |
763 | * to keep the client up to date too! |
787 | */ |
764 | */ |