ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/define.h
(Generate patch)

Comparing deliantra/server/include/define.h (file contents):
Revision 1.77 by root, Thu Nov 8 19:43:24 2007 UTC vs.
Revision 1.92 by root, Mon Dec 8 15:40:13 2008 UTC

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
87 74
88#define MAX_ANIMATIONS 256 75#define MAX_ANIMATIONS 256
89 76
90#define MAX_NAME 48 77#define MAX_NAME 48
91#define MAX_EXT_TITLE 98 78#define MAX_EXT_TITLE 98
79
80#define ATTUNE_REPELL 16 // levels diff for attune/repell
92 81
93//TODO: remove all calls to fatal and replace them by cleanup 82//TODO: remove all calls to fatal and replace them by cleanup
94#define OUT_OF_MEMORY 0 83#define OUT_OF_MEMORY 0
95#define MAP_ERROR 1 84#define MAP_ERROR 1
96#define ARCHTABLE_TOO_SMALL 2 // unused 85#define ARCHTABLE_TOO_SMALL 2 // unused
312// maximum supported subtype number + 1, can be increased to 256 301// maximum supported subtype number + 1, can be increased to 256
313// currently (2007-09) in use: 50 302// currently (2007-09) in use: 50
314#define NUM_SUBTYPES 64 303#define NUM_SUBTYPES 64
315 304
316/* Subtypes for BUILDER */ 305/* Subtypes for BUILDER */
317#define ST_BD_BUILD 1 /* Builds an item */ 306#define ST_BD_BUILD 1 /* Builds an item */
318#define ST_BD_REMOVE 2 /* Removes an item */ 307#define ST_BD_REMOVE 2 /* Removes an item */
319 308
320/* Subtypes for MATERIAL */ 309/* Subtypes for MATERIAL */
321#define ST_MAT_FLOOR 1 /* Floor */ 310#define ST_MAT_FLOOR 1 /* Floor */
322#define ST_MAT_WALL 2 /* Wall */ 311#define ST_MAT_WALL 2 /* Wall */
323#define ST_MAT_ITEM 3 /* All other items, including doors & such */ 312#define ST_MAT_ITEM 3 /* All other items, including doors & such */
394 * freearr, add these values. <= SIZEOFFREE1 will get you 383 * freearr, add these values. <= SIZEOFFREE1 will get you
395 * within 1 space. <= SIZEOFFREE2 wll get you withing 384 * within 1 space. <= SIZEOFFREE2 wll get you withing
396 * 2 spaces, and the entire array (< SIZEOFFREE) is 385 * 2 spaces, and the entire array (< SIZEOFFREE) is
397 * three spaces 386 * three spaces
398 */ 387 */
388#define SIZEOFFREE0 0
399#define SIZEOFFREE1 8 389#define SIZEOFFREE1 8
400#define SIZEOFFREE2 24 390#define SIZEOFFREE2 24
391#define SIZEOFFREE3 48
401#define SIZEOFFREE 49 392#define SIZEOFFREE 49
402 393
403#define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ 394#define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */
404 395
405/* 396/*
406 * If any FLAG's are added or changed, make sure the flag_names structure in 397 * If any FLAG's are added or changed, make sure the flag_names structure in
430 421
431#define FLAG_ANIMATE 11 /* The object looks at archetype for faces */ 422#define FLAG_ANIMATE 11 /* The object looks at archetype for faces */
432 423
433/*#define FLAG_SLOW_MOVE 12*//* Uses the stats.exp/1000 to slow down */ 424/*#define FLAG_SLOW_MOVE 12*//* Uses the stats.exp/1000 to slow down */
434/*#define FLAG_FLYING 13*//* Not affected by WALK_ON or SLOW_MOVE) */ 425/*#define FLAG_FLYING 13*//* Not affected by WALK_ON or SLOW_MOVE) */
426#define FLAG_HIDDEN 13 /* hidden monster (not invisible), TODO: used how, what for? TODO: why not saved? */
435 427
436#define FLAG_MONSTER 14 /* Will attack players */ 428#define FLAG_MONSTER 14 /* Will attack players */
437#define FLAG_FRIENDLY 15 /* Will help players */ 429#define FLAG_FRIENDLY 15 /* Will help players */
438#define FLAG_GENERATOR 16 /* Will generate type ob->stats.food */ 430#define FLAG_GENERATOR 16 /* Will generate type ob->stats.food */
439#define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */ 431#define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */
533 525
534#define FLAG_NO_STEAL 96 /* Item can't be stolen */ 526#define FLAG_NO_STEAL 96 /* Item can't be stolen */
535#define FLAG_ONE_HIT 97 /* Monster can only hit once before going 527#define FLAG_ONE_HIT 97 /* Monster can only hit once before going
536 * away (replaces ghosthit) 528 * away (replaces ghosthit)
537 */ 529 */
538#define FLAG_CLIENT_SENT 98 /* THIS IS A DEBUG FLAG ONLY. We use it to 530#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 531
544#define FLAG_BERSERK 99 /* monster will attack closest living 532#define FLAG_BERSERK 99 /* monster will attack closest living
545 object */ 533 object */
546#define FLAG_NEUTRAL 100 /* monster is from type neutral */ 534#define FLAG_NEUTRAL 100 /* monster is from type neutral */
547#define FLAG_NO_ATTACK 101 /* monster doesn't attack */ 535#define FLAG_NO_ATTACK 101 /* monster doesn't attack */
599 * 587 *
600 */ 588 */
601#define OB_TYPE_MOVE_BLOCK(ob1, type) \ 589#define OB_TYPE_MOVE_BLOCK(ob1, type) \
602 ((type) && (ob1->move_type & type) == ob1->move_type) 590 ((type) && (ob1->move_type & type) == ob1->move_type)
603 591
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>) */ 592#define GENERATE_SPEED(xyz) ((xyz)->stats.maxsp) /* if(!RANDOM()%<speed>) */
607 593
608#define EXIT_PATH(xyz) (xyz)->slaying 594#define EXIT_PATH(xyz) (xyz)->slaying
609#define EXIT_LEVEL(xyz) (xyz)->stats.food 595#define EXIT_LEVEL(xyz) (xyz)->stats.food
610#define EXIT_X(xyz) (xyz)->stats.hp 596#define EXIT_X(xyz) (xyz)->stats.hp
611#define EXIT_Y(xyz) (xyz)->stats.sp 597#define EXIT_Y(xyz) (xyz)->stats.sp
612#define EXIT_ALT_X(xyz) (xyz)->stats.maxhp 598#define EXIT_ALT_X(xyz) (xyz)->stats.maxhp
613#define EXIT_ALT_Y(xyz) (xyz)->stats.maxsp 599#define EXIT_ALT_Y(xyz) (xyz)->stats.maxsp
614 600
615/* for use by the lighting code */ 601/* for use by the lighting code */
616#define MAX_LIGHT_RADII 4 /* max radii for 'light' object, really 602#define MAX_LIGHT_RADIUS 9 /* max radius for 'light' object, really
617 * large values allow objects that can 603 * large values allow objects that can
618 * slow down the game */ 604 * slow down the game */
619#define MAX_DARKNESS 5 /* maximum map darkness, there is no 605#define MAX_DARKNESS 5 /* maximum map darkness, there is no
620 * practical reason to exceed this */ 606 * practical reason to exceed this */
607#define LOS_MAX 4 /* max. los value for non-blocked spaces */
608#define LOS_BLOCKED 100 /* fully blocked spaces */
621#define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII? \ 609#define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII? \
622 MAX_LIGHT_RADII:(xyz)->glow_radius; 610 MAX_LIGHT_RADII:(xyz)->glow_radius;
623 611
624#define F_BUY 0 612#define F_BUY 0
625#define F_SELL 1 613#define F_SELL 1
772// also make sure that this is a float, not double, constant 760// also make sure that this is a float, not double, constant
773#define MIN_ACTIVE_SPEED (1.f / 65536.f) 761#define MIN_ACTIVE_SPEED (1.f / 65536.f)
774 762
775#define RANDOM() (rndm.next () & 0xffffffU) 763#define RANDOM() (rndm.next () & 0xffffffU)
776 764
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/* 765/*
784 * Warning! 766 * Warning!
785 * If you add message types here, don't forget 767 * If you add message types here, don't forget
786 * to keep the client up to date too! 768 * to keep the client up to date too!
787 */ 769 */
923#define NDI_CLIENT_MASK 0xff // what the client is allowed to see 905#define NDI_CLIENT_MASK 0xff // what the client is allowed to see
924 906
925#define NDI_UNIQUE 0x1000 /* Print this out immediately, don't buffer */ 907#define NDI_UNIQUE 0x1000 /* Print this out immediately, don't buffer */
926#define NDI_ALL 0x2000 /* Inform all players of this message */ 908#define NDI_ALL 0x2000 /* Inform all players of this message */
927#define NDI_DEF 0x4000 // ignore colour for channel protocol 909#define NDI_DEF 0x4000 // ignore colour for channel protocol
910#define NDI_VERBATIM 0x8000 // do not expand cfpod, send text verbatim
928 911
929#endif /* DEFINE_H */ 912#endif /* DEFINE_H */
930 913

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines