#ifndef __DEFINES__
#define __DEFINES__

// 3d players mod, uncomment for use
#define PLAYERS_3D             // Enable 3d players
#define PLAYERS_3D_NO_HEAD     // No head slot
#define PLAYERS_3D_VAULT_SUITE // Vault suite by default, not naked

// Global variables
// Possible types:
// int8, int16, int32, int64, int,
// uint8, uint16, uint32, uint64, uint,
// bool, float, double, string.
// Default value is zero.
// To set start value use '=' after var name.
// This vars works like engine global vars.
// Also recommended use "__" prefix in var name.
#ifndef SKIP_PRAGMAS
#pragma globalvar "bool __MainStoryLineActive = true"
#pragma globalvar "uint __PermanentDeath = 0" // Number of deaths to account blocking, zero to disable

#pragma globalvar "uint __HitAimEyes  = 60"
#pragma globalvar "uint __HitAimHead  = 40"
#pragma globalvar "uint __HitAimGroin = 30"
#pragma globalvar "uint __HitAimTorso =  0"
#pragma globalvar "uint __HitAimArms  = 30"
#pragma globalvar "uint __HitAimLegs  = 20"
#endif

// Say types
#define SAY_NORM                    (1)
#define SAY_NORM_ON_HEAD            (2)
#define SAY_SHOUT                   (3)
#define SAY_SHOUT_ON_HEAD           (4)
#define SAY_EMOTE                   (5)
#define SAY_EMOTE_ON_HEAD           (6)
#define SAY_WHISP                   (7)
#define SAY_WHISP_ON_HEAD           (8)
#define SAY_SOCIAL                  (9)
#define SAY_RADIO                   (10)
#define SAY_NETMSG                  (11)
#define SAY_DIALOG                  (12)
#define SAY_APPEND                  (13)
#define SAY_ENCOUNTER_ANY           (14) // Activate dialog box on global map, using before encounter
#define SAY_ENCOUNTER_RT            (15) // Activate dialog box on global map, using before encounter
#define SAY_ENCOUNTER_TB            (16) // Activate dialog box on global map, using before encounter
#define SAY_FIX_RESULT              (17)
#define SAY_DIALOGBOX_TEXT          (18)
#define SAY_DIALOGBOX_BUTTON #(b)   (19+(b)) // Max 20 buttons (0..19)
#define SAY_SAY_TITLE               (39)
#define SAY_SAY_TEXT                (40)
#define SAY_FLASH_WINDOW            (41) // Only flash window in tray and beep

// Msg nums
#define TEXTMSG_TEXT                (0)
#define TEXTMSG_DLG                 (1)
#define TEXTMSG_ITEM                (2)
#define TEXTMSG_GAME                (3)
#define TEXTMSG_GM                  (4)
#define TEXTMSG_COMBAT              (5)
#define TEXTMSG_QUEST               (6)
#define TEXTMSG_HOLO                (7)
#define TEXTMSG_CRAFT               (8)
#define TEXTMSG_INTERNAL            (9)
#define DLGSTR #(dialogId,strNum)   (1000000000+(dialogId)*100000+(strNum))

// Critter conditions
#define COND_LIFE                   (1)
#define COND_KNOCKOUT               (2)
#define COND_DEAD                   (3)

// Gender
#define GENDER_MALE                 (0)
#define GENDER_FEMALE               (1)
#define GENDER_IT                   (2)

// Items accessory
#define ACCESSORY_NONE              (0)
#define ACCESSORY_CRITTER           (1)
#define ACCESSORY_HEX               (2)
#define ACCESSORY_CONTAINER         (3)

// Items types
#define ITEM_TILE                   (0)
#define ITEM_ARMOR                  (1)
#define ITEM_DRUG                   (2)
#define ITEM_WEAPON                 (3)
#define ITEM_AMMO                   (4)
#define ITEM_MISC                   (5)
#define ITEM_MISC_EX                (6)
#define ITEM_KEY                    (7)
#define ITEM_CONTAINER              (8)
#define ITEM_DOOR                   (9)
#define ITEM_GRID                   (10)
#define ITEM_GENERIC                (11)
#define ITEM_WALL                   (12)

// Item flags
#define ITEM_HIDDEN                 (0x00000001)
#define ITEM_FLAT                   (0x00000002)
#define ITEM_NO_BLOCK               (0x00000004)
#define ITEM_SHOOT_THRU             (0x00000008)
#define ITEM_LIGHT_THRU             (0x00000010)
#define ITEM_MULTI_HEX              (0x00000020) // Not used
#define ITEM_WALL_TRANS_END         (0x00000040) // Not used
#define ITEM_TWO_HANDS              (0x00000080)
#define ITEM_BIG_GUN                (0x00000100)
#define ITEM_ALWAYS_VIEW            (0x00000200)
#define ITEM_HAS_TIMER              (0x00000400)
#define ITEM_BAD_ITEM               (0x00000800)
#define ITEM_NO_HIGHLIGHT           (0x00001000)
#define ITEM_SHOW_ANIM              (0x00002000)
#define ITEM_SHOW_ANIM_EXT          (0x00004000)
#define ITEM_LIGHT                  (0x00008000)
#define ITEM_GECK                   (0x00010000)
#define ITEM_TRAP                   (0x00020000)
#define ITEM_NO_LIGHT_INFLUENCE     (0x00040000)
#define ITEM_NO_LOOT                (0x00080000)
#define ITEM_NO_STEAL               (0x00100000)
#define ITEM_GAG                    (0x00200000)
#define ITEM_COLORIZE               (0x00400000)
#define ITEM_COLORIZE_INV           (0x00800000)
#define ITEM_CAN_USE_ON_SMTH        (0x01000000)
#define ITEM_CAN_LOOK               (0x02000000)
#define ITEM_CAN_TALK               (0x04000000)
#define ITEM_CAN_PICKUP             (0x08000000)
#define ITEM_CAN_USE                (0x10000000)
#define ITEM_HOLODISK               (0x20000000)
#define ITEM_RADIO                  (0x40000000)
#define ITEM_CACHED                 (0x80000000) // Not used

// Damage types
#define DAMAGE_UNCALLED             (0)
#define DAMAGE_NORMAL               (1)
#define DAMAGE_LASER                (2)
#define DAMAGE_FIRE                 (3)
#define DAMAGE_PLASMA               (4)
#define DAMAGE_ELECTR               (5)
#define DAMAGE_EMP                  (6)
#define DAMAGE_EXPLODE              (7)

// Critter events, description see in templates.fos
#define CRITTER_EVENT_IDLE                    (0)
#define CRITTER_EVENT_FINISH                  (1)
#define CRITTER_EVENT_DEAD                    (2)
#define CRITTER_EVENT_RESPAWN                 (3)
#define CRITTER_EVENT_SHOW_CRITTER            (4)
#define CRITTER_EVENT_SHOW_CRITTER_1          (5)
#define CRITTER_EVENT_SHOW_CRITTER_2          (6)
#define CRITTER_EVENT_SHOW_CRITTER_3          (7)
#define CRITTER_EVENT_HIDE_CRITTER            (8)
#define CRITTER_EVENT_HIDE_CRITTER_1          (9)
#define CRITTER_EVENT_HIDE_CRITTER_2          (10)
#define CRITTER_EVENT_HIDE_CRITTER_3          (11)
#define CRITTER_EVENT_SHOW_ITEM_ON_MAP        (12)
#define CRITTER_EVENT_CHANGE_ITEM_ON_MAP      (13)
#define CRITTER_EVENT_HIDE_ITEM_ON_MAP        (14)
#define CRITTER_EVENT_ATTACK                  (15)
#define CRITTER_EVENT_ATTACKED                (16)
#define CRITTER_EVENT_STEALING                (17)
#define CRITTER_EVENT_MESSAGE                 (18)
#define CRITTER_EVENT_USE_ITEM                (19)
#define CRITTER_EVENT_USE_ITEM_ON_ME          (20)
#define CRITTER_EVENT_USE_SKILL               (21)
#define CRITTER_EVENT_USE_SKILL_ON_ME         (22)
#define CRITTER_EVENT_DROP_ITEM               (23)
#define CRITTER_EVENT_MOVE_ITEM               (24)
#define CRITTER_EVENT_KNOCKOUT                (25)
#define CRITTER_EVENT_SMTH_DEAD               (26)
#define CRITTER_EVENT_SMTH_STEALING           (27)
#define CRITTER_EVENT_SMTH_ATTACK             (28)
#define CRITTER_EVENT_SMTH_ATTACKED           (29)
#define CRITTER_EVENT_SMTH_USE_ITEM           (30)
#define CRITTER_EVENT_SMTH_USE_SKILL          (31)
#define CRITTER_EVENT_SMTH_DROP_ITEM          (32)
#define CRITTER_EVENT_SMTH_MOVE_ITEM          (33)
#define CRITTER_EVENT_SMTH_KNOCKOUT           (34)
#define CRITTER_EVENT_PLANE_BEGIN             (35)
#define CRITTER_EVENT_PLANE_END               (36)
#define CRITTER_EVENT_PLANE_RUN               (37)
#define CRITTER_EVENT_BARTER                  (38)
#define CRITTER_EVENT_TALK                    (39)
#define CRITTER_EVENT_GLOBAL_PROCESS          (40)
#define CRITTER_EVENT_GLOBAL_INVITE           (41)
#define CRITTER_EVENT_TURN_BASED_PROCESS      (42)
#define CRITTER_EVENT_SMTH_TURN_BASED_PROCESS (43)
#define CRITTER_EVENT_MAX                     (44)

// Return values for CRITTER_EVENT_PLANE_ BEGIN/END/RUN events
#define PLANE_RUN_GLOBAL                      (0)
#define PLANE_KEEP                            (1)
#define PLANE_DISCARD                         (2)

// Map events, description see in templates.fos
#define MAP_EVENT_FINISH              (0)
#define MAP_EVENT_LOOP_0              (1)
#define MAP_EVENT_LOOP_1              (2)
#define MAP_EVENT_LOOP_2              (3)
#define MAP_EVENT_LOOP_3              (4)
#define MAP_EVENT_LOOP_4              (5)
#define MAP_EVENT_IN_CRITTER          (6)
#define MAP_EVENT_OUT_CRITTER         (7)
#define MAP_EVENT_CRITTER_DEAD        (8)
#define MAP_EVENT_TURN_BASED_BEGIN    (9)
#define MAP_EVENT_TURN_BASED_END      (10)
#define MAP_EVENT_TURN_BASED_PROCESS  (11)
#define MAP_EVENT_MAX                 (12)

// Item events, description see in templates.fos
#define ITEM_EVENT_FINISH             (0)
#define ITEM_EVENT_ATTACK             (1)
#define ITEM_EVENT_USE                (2)
#define ITEM_EVENT_USE_ON_ME          (3)
#define ITEM_EVENT_SKILL              (4)
#define ITEM_EVENT_DROP               (5)
#define ITEM_EVENT_MOVE               (6)
#define ITEM_EVENT_WALK               (7)
#define ITEM_EVENT_MAX                (8)

// Item perks
#define WEAPON_PERK_LONG_RANGE        (1)
#define WEAPON_PERK_ACCURATE          (2)
#define WEAPON_PERK_PENETRATE         (3)
#define WEAPON_PERK_KNOCKBACK         (4)
#define WEAPON_PERK_SCOPE_RANGE       (5)
#define WEAPON_PERK_FAST_RELOAD       (6)
#define WEAPON_PERK_NIGHT_SIGHT       (7)
#define WEAPON_PERK_FLAMEBOY          (8)
#define WEAPON_PERK_ENHANCED_KNOCKOUT (9)
#define ARMOR_PERK_POWERED            (1) // +3 strength, +30 radiation resist
#define ARMOR_PERK_COMBAT             (2) // +20 radiation resist
#define ARMOR_PERK_ADVANCED_I         (3) // +4 strength, +60 radiation resist
#define ARMOR_PERK_ADVANCED_II        (4) // +4 strength, +75 radiation resist
#define ARMOR_PERK_CHARISMA           (5) // 1+ charisma
#define SLOT_PERK_MIRROR_SHADES       (0x01) // +1 charisma
#define SLOT_PERK_COSMETIC_CASE       (0x02) // +1 charisma to female
#define SLOT_PERK_MOTION_SENSOR       (0x04) // +20 outdoorsman
#define SLOT_PERK_STEALTH_BOY         (0x08) // +20 sneak

// In SendMessage
#define MESSAGE_TO_WHO_SEES_ME      (0) // Отослать сообщения всем кто видет криттера.
#define MESSAGE_TO_I_SEE            (1) // Отослать сообщения всем кого видит криттер.
#define MESSAGE_TO_ALL_ON_MAP       (2) // Отослать всем на карте.

// Critter actions
// Flags for chosen:
// l - hardcoded local call
// s - hardcoded server call
// for all others critters actions call only server
//                                          flags    actionExt                                                      item
#define ACTION_MOVE                 (0)  // l
#define ACTION_RUN                  (1)  // l
#define ACTION_SHOW_ITEM            (2)  // l s      prev slot                                                      +
#define ACTION_HIDE_ITEM            (3)  // l s      prev slot                                                      +
#define ACTION_MOVE_ITEM            (4)  // l s      prev slot                                                      +
#define ACTION_USE_ITEM             (5)  // l s                                                                     +
#define ACTION_DROP_ITEM            (6)  // l s      prev slot                                                      +
#define ACTION_USE_WEAPON           (7)  // l        fail attack 8 bit, use index (0-2) 4-7 bits, aim 0-3 bits      +
#define ACTION_RELOAD_WEAPON        (8)  // l s                                                                     +
#define ACTION_USE_SKILL            (9)  // l s      skill index (see SK_*)
#define ACTION_PICK_ITEM            (10) // l s                                                                     +
#define ACTION_PICK_CRITTER         (11) // l        0 - loot, 1 - steal, 2 - push
#define ACTION_OPERATE_CONTAINER    (12) // l s      transfer type * 10 + [0 - get, 1 - get all, 2 - put]           + (exclude get all)
#define ACTION_BARTER               (13) //   s      0 - item taken, 1 - item given                                 +
#define ACTION_DODGE                (14) //          0 - front, 1 - back
#define ACTION_DAMAGE               (15) //          0 - front, 1 - back
#define ACTION_DAMAGE_FORCE			(24) //          0 - front, 1 - back
#define ACTION_KNOCKOUT             (16) //   s      0 - knockout anim2begin
#define ACTION_STANDUP              (17) //   s      0 - knockout anim2end
#define ACTION_FIDGET               (18) // l
#define ACTION_DEAD                 (19) //   s      dead type anim2 (see Anim2 in _animation.fos)
#define ACTION_CONNECT              (20) //
#define ACTION_DISCONNECT           (21) //
#define ACTION_RESPAWN              (22) //   s
#define ACTION_REFRESH              (23) //   s

// Slots
#define SLOT_INV                    (0) // Inventory
#define SLOT_HAND1                  (1) // Weapon slot
#define SLOT_HAND2                  (2) // Extended slot
#define SLOT_ARMOR                  (3) // Armor slot
#ifdef PLAYERS_3D
 #ifndef PLAYERS_3D_NO_HEAD
  #define SLOT_HEAD                 (4) // Head slot
 #endif
#endif
#define SLOT_GROUND                 (255) // Ground slot, used when critter drop/pick item

// Critter timeevents identifiers
#define CTE_POISON                  (1)
#define CTE_RADIATION               (2)
#define CTE_TRADER                  (3)
#define CTE_OBSERVING               (4)
#define CTE_AUTOKILL                (5)
// Drugs time events                40 (PID_STIMPAK) .. 1000

// Parameters
	/// Ranges
#ifndef SKIP_PRAGMAS
#pragma crdata "Stat           0 199"
#pragma crdata "Skill        200 217"
#pragma crdata "TagSkill     226 229"
#pragma crdata "Timeout      230 249"
#pragma crdata "Kill         260 280"
#pragma crdata "Perk         300 469"
#pragma crdata "Addiction    470 476"
#pragma crdata "Karma        480 497"
#pragma crdata "Damage       500 506"
#pragma crdata "Mode         510 549"
#pragma crdata "Trait        550 565"
#pragma crdata "Reputation   570 599"
//#pragma crdata "GoodEvilList 600 799"
#pragma crdata "Merc         800 829"
#endif
	/// Stats
#define STAT_BEGIN                 (0)
#define STAT_END                   (199)
#define STAT_COUNT                 (STAT_END-STAT_BEGIN+1)
#define STAT_EXT_BEGIN             (32)
#define STAT_EXT_END               (63)
#define ST_STRENGTH                 (0) // Hardcoded
#define ST_PERCEPTION               (1) // Hardcoded
#define ST_ENDURANCE                (2) // Hardcoded
#define ST_CHARISMA                 (3) // Hardcoded
#define ST_INTELLECT                (4) // Hardcoded
#define ST_AGILITY                  (5) // Hardcoded
#define ST_LUCK                     (6) // Hardcoded
#define ST_MAX_LIFE                 (7) // Hardcoded
#define ST_ACTION_POINTS            (8) // Hardcoded
#define ST_ARMOR_CLASS              (9) // Hardcoded
#define ST_MELEE_DAMAGE             (10) // Hardcoded
#define ST_CARRY_WEIGHT             (11) // Hardcoded
#define ST_SEQUENCE                 (12) // Hardcoded
#define ST_HEALING_RATE             (13) // Hardcoded
#define ST_CRITICAL_CHANCE          (14) // Hardcoded
#define ST_MAX_CRITICAL             (15)
#define ST_NORMAL_ABSORB            (16)
#define ST_LASER_ABSORB             (17)
#define ST_FIRE_ABSORB              (18)
#define ST_PLASMA_ABSORB            (19)
#define ST_ELECTRO_ABSORB           (20)
#define ST_EMP_ABSORB               (21)
#define ST_EXPLODE_ABSORB           (22)
#define ST_NORMAL_RESIST            (23) // Hardcoded
#define ST_LASER_RESIST             (24)
#define ST_FIRE_RESIST              (25)
#define ST_PLASMA_RESIST            (26)
#define ST_ELECTRO_RESIST           (27)
#define ST_EMP_RESIST               (28)
#define ST_EXPLODE_RESIST           (29)
#define ST_RADIATION_RESISTANCE     (30) // Hardcoded
#define ST_POISON_RESISTANCE        (31) // Hardcoded
#define ST_STRENGTH_EXT             (32)
#define ST_PERCEPTION_EXT           (33)
#define ST_ENDURANCE_EXT            (34)
#define ST_CHARISMA_EXT             (35)
#define ST_INTELLECT_EXT            (36)
#define ST_AGILITY_EXT              (37)
#define ST_LUCK_EXT                 (38)
#define ST_MAX_LIFE_EXT             (39)
#define ST_ACTION_POINTS_EXT        (40)
#define ST_ARMOR_CLASS_EXT          (41)
#define ST_MELEE_DAMAGE_EXT         (42)
#define ST_CARRY_WEIGHT_EXT         (43)
#define ST_SEQUENCE_EXT             (44)
#define ST_HEALING_RATE_EXT         (45)
#define ST_CRITICAL_CHANCE_EXT      (46)
#define ST_MAX_CRITICAL_EXT         (47)
#define ST_NORMAL_ABSORB_EXT        (48)
#define ST_LASER_ABSORB_EXT         (49)
#define ST_FIRE_ABSORB_EXT          (50)
#define ST_PLASMA_ABSORB_EXT        (51)
#define ST_ELECTRO_ABSORB_EXT       (52)
#define ST_EMP_ABSORB_EXT           (53)
#define ST_EXPLODE_ABSORB_EXT       (54)
#define ST_NORMAL_RESIST_EXT        (55)
#define ST_LASER_RESIST_EXT         (56)
#define ST_FIRE_RESIST_EXT          (57)
#define ST_PLASMA_RESIST_EXT        (58)
#define ST_ELECTRO_RESIST_EXT       (59)
#define ST_EMP_RESIST_EXT           (60)
#define ST_EXPLODE_RESIST_EXT       (61)
#define ST_RADIATION_RESISTANCE_EXT (62)
#define ST_POISON_RESISTANCE_EXT    (63)
#define ST_TOXIC                    (64)
#define ST_RADIOACTIVE              (65)
#define ST_KILL_EXPERIENCE          (66)
#define ST_BODY_TYPE                (67)
#define ST_LOCOMOTION_TYPE          (68) // See Locomotion types
#define ST_DAMAGE_TYPE              (69)
#define ST_AGE                      (70) // Hardcoded
#define ST_GENDER                   (71) // Hardcoded
#define ST_CURRENT_HP               (72) // Hardcoded
#define ST_POISONING_LEVEL          (73) // Hardcoded
#define ST_RADIATION_LEVEL          (74) // Hardcoded
#define ST_CURRENT_AP               (75) // Hardcoded
#define ST_EXPERIENCE               (76) // Hardcoded
#define ST_LEVEL                    (77) // Hardcoded
#define ST_UNSPENT_SKILL_POINTS     (78) // Hardcoded
#define ST_UNSPENT_PERKS            (79) // Hardcoded
#define ST_KARMA                    (80) // Hardcoded
#define ST_FOLLOW_CRIT              (81) // Hardcoded
#define ST_REPLICATION_MONEY        (82) // Hardcoded
#define ST_REPLICATION_COUNT        (83) // Hardcoded
#define ST_REPLICATION_TIME         (84) // Hardcoded
#define ST_REPLICATION_COST         (85) // Hardcoded
#define ST_TURN_BASED_AC            (86) // Hardcoded
#define ST_MAX_MOVE_AP              (87) // Hardcoded
#define ST_MOVE_AP                  (88) // Hardcoded
#define ST_NPC_ROLE                 (89) // Hardcoded
#define ST_VAR0                     (90)
#define ST_VAR1                     (91)
#define ST_VAR2                     (92)
#define ST_VAR3                     (93)
#define ST_VAR4                     (94)
#define ST_VAR5                     (95)
#define ST_VAR6                     (96)
#define ST_VAR7                     (97)
#define ST_VAR8                     (98)
#define ST_VAR9                     (99)
#define ST_PLAYER_KARMA             (100)
#define ST_BONUS_LOOK               (101) // Hardcoded
#define ST_HANDS_ITEM_AND_MODE      (102) // Hardcoded
#define ST_FREE_BARTER_PLAYER       (103) // Hardcoded
#define ST_DIALOG_ID                (104) // Hardcoded
#define ST_AI_ID                    (105) // Hardcoded
#define ST_TEAM_ID                  (106) // Hardcoded
#define ST_BAG_ID                   (107) // Hardcoded
#define ST_LAST_STEAL_CR_ID         (108)
#define ST_STEAL_COUNT              (109)
#define ST_LAST_WEAPON_ID           (110) // Hardcoded
#define ST_LAST_WEAPON_USE          (111)
#define ST_BASE_CRTYPE              (112) // Hardcoded
#define ST_DEAD_BLOCKER_ID          (113)
#define ST_CURRENT_ARMOR_PERK       (114)
#define ST_TALK_DISTANCE            (115) // Hardcoded, if zero than taked __TalkDistance
#define ST_SCALE_FACTOR             (116) // Hardcoded
#define ST_WALK_TIME                (117) // Hardcoded
#define ST_RUN_TIME                 (118) // Hardcoded
// 119..149
#ifdef PLAYERS_3D
	// Initial values of animation 3d layers
#define ST_ANIM3D_LAYERS            (150) // Hardcoded
// 150..179 reserved for 30 layers
#endif
// 180..199

	/// Skills
#define SKILL_BEGIN                (__SkillBegin)
#define SKILL_END                  (__SkillEnd)
#define SKILL_COUNT                (SKILL_END-SKILL_BEGIN+1)
#define MAX_SKILL_VAL              (300) // Hardcoded
#define SK_SMALL_GUNS               (200)
#define SK_BIG_GUNS                 (201)
#define SK_ENERGY_WEAPONS           (202)
#define SK_UNARMED                  (203) // Hardcoded
#define SK_MELEE_WEAPONS            (204)
#define SK_THROWING                 (205)
#define SK_FIRST_AID                (206) // Hardcoded
#define SK_DOCTOR                   (207) // Hardcoded
#define SK_SNEAK                    (208) // Hardcoded
#define SK_LOCKPICK                 (209) // Hardcoded
#define SK_STEAL                    (210) // Hardcoded
#define SK_TRAPS                    (211) // Hardcoded
#define SK_SCIENCE                  (212) // Hardcoded
#define SK_REPAIR                   (213) // Hardcoded
#define SK_SPEECH                   (214) // Hardcoded
#define SK_BARTER                   (215) // Hardcoded
#define SK_GAMBLING                 (216)
#define SK_OUTDOORSMAN              (217)
// 218..225

	/// Tag skills
#define TAG_SKILL1                  (226) // Hardcoded
#define TAG_SKILL2                  (227) // Hardcoded
#define TAG_SKILL3                  (228) // Hardcoded
#define TAG_SKILL4                  (229) // Hardcoded

	/// Timeouts
#define TIMEOUT_BEGIN              (__TimeoutBegin)
#define TIMEOUT_END                (__TimeoutEnd)
#define TIMEOUT_COUNT              (TIMEOUT_END-TIMEOUT_BEGIN+1)
#define TO_SK_FIRST_AID             (230)
#define TO_SK_DOCTOR                (231)
#define TO_SK_REPAIR                (232) // Hardcoded
#define TO_SK_SCIENCE               (233) // Hardcoded
#define TO_SK_LOCKPICK              (234)
#define TO_SK_STEAL                 (235)
#define TO_SK_OUTDOORSMAN           (236)
// 237
#define TO_BATTLE                   (238) // Hardcoded
#define TO_TRANSFER                 (239) // Hardcoded
#define TO_REMOVE_FROM_GAME         (240) // Hardcoded
#define TO_REPLICATION              (241)
#define TO_KARMA_VOTING             (242) // Hardcoded
#define TO_SNEAK                    (243)
#define TO_HEALING                  (244)
// 245..247
#define TO_STEALING                 (248)
#define TO_AGGRESSOR                (249)
// 250..259

	/// Kills
// Reserved 260..299 (BT_MEN..BT_GIANT_WASP)
#define KILL_BEGIN                 (__KillBegin)
#define KILL_END                   (__KillEnd)
#define KILL_COUNT                 (KILL_END-KILL_BEGIN+1)
// 281..299

	/// Perks
#define PERK_BEGIN                 (__PerkBegin)
#define PERK_END                   (__PerkEnd)
#define PERK_COUNT                 (PERK_END-PERK_BEGIN+1)
#define PE_BOOKWORM                 (300) // Todo
#define PE_AWARENESS                (301)
#define PE_BONUS_HTH_ATTACKS        (302)
#define PE_BONUS_HTH_DAMAGE         (303)
#define PE_BONUS_MOVE               (304)
#define PE_BONUS_RANGED_DAMAGE      (305)
#define PE_BONUS_RATE_OF_FIRE       (306)
#define PE_EARLIER_SEQUENCE         (307)
#define PE_FASTER_HEALING           (308)
#define PE_MORE_CRITICALS           (309)
#define PE_NIGHT_VISION             (310) // Todo
#define PE_PRESENCE                 (311) // Todo
#define PE_RAD_RESISTANCE           (312)
#define PE_TOUGHNESS                (313)
#define PE_STRONG_BACK              (314)
#define PE_SHARPSHOOTER             (315)
#define PE_SILENT_RUNNING           (316) // Hardcoded
#define PE_SURVIVALIST              (317)
#define PE_MASTER_TRADER            (318) // Hardcoded
#define PE_EDUCATED                 (319)
#define PE_HEALER                   (320)
#define PE_FORTUNE_FINDER           (321)
#define PE_BETTER_CRITICALS         (322)
#define PE_EMPATHY                  (323) // Todo
#define PE_SLAYER                   (324)
#define PE_SNIPER                   (325)
#define PE_SILENT_DEATH             (326)
#define PE_ACTION_BOY               (327)
#define PE_MENTAL_BLOCK             (328) // Todo
#define PE_LIFEGIVER                (329)
#define PE_DODGER                   (330)
#define PE_SNAKEATER                (331)
#define PE_MR_FIXIT                 (332)
#define PE_MEDIC                    (333)
#define PE_MASTER_THIEF             (334)
#define PE_SPEAKER                  (335)
#define PE_HEAVE_HO                 (336)
#define PE_FRIENDLY_FOE             (337) // Todo
#define PE_PICKPOCKET               (338)
#define PE_GHOST                    (339)
#define PE_CULT_OF_PERSONALITY      (340) // Todo
#define PE_SCROUNGER                (341) // Todo
#define PE_EXPLORER                 (342)
#define PE_FLOWER_CHILD             (343) // Todo
#define PE_PATHFINDER               (344)
#define PE_ANIMAL_FRIEND            (345) // Todo
#define PE_SCOUT                    (346) // Hardcoded
#define PE_MYSTERIOUS_STRANGER      (347) // Todo
#define PE_RANGER                   (348)
#define PE_QUICK_POCKETS            (349) // Hardcoded
#define PE_SMOOTH_TALKER            (350) // Hardcoded
#define PE_SWIFT_LEARNER            (351)
#define PE_TAG                      (352) // Todo
#define PE_MUTATE                   (353) // Todo
// 354..379
#define PE_ADRENALINE_RUSH          (380)
#define PE_CAUTIOUS_NATURE          (381)
#define PE_COMPREHENSION            (382)
#define PE_DEMOLITION_EXPERT        (383)
#define PE_GAMBLER                  (384)
#define PE_GAIN_STRENGTH            (385)
#define PE_GAIN_PERCEPTION          (386)
#define PE_GAIN_ENDURANCE           (387)
#define PE_GAIN_CHARISMA            (388)
#define PE_GAIN_INTELLIGENCE        (389)
#define PE_GAIN_AGILITY             (390)
#define PE_GAIN_LUCK                (391)
#define PE_HARMLESS                 (392)
#define PE_HERE_AND_NOW             (393)
#define PE_HTH_EVADE                (394)
#define PE_KAMA_SUTRA_MASTER        (395)
#define PE_KARMA_BEACON             (396)
#define PE_LIGHT_STEP               (397)
#define PE_LIVING_ANATOMY           (398)
#define PE_MAGNETIC_PERSONALITY     (399)
#define PE_NEGOTIATOR               (400)
#define PE_PACK_RAT                 (401)
#define PE_PYROMANIAC               (402)
#define PE_QUICK_RECOVERY           (403)
#define PE_SALESMAN                 (404)
#define PE_STONEWALL                (405)
#define PE_THIEF                    (406)
#define PE_WEAPON_HANDLING          (407)
#define PE_VAULT_CITY_TRAINING      (408)
#define PE_ALCOHOL_RAISED_HP        (409)
#define PE_ALCOHOL_RAISED_HP_II     (410)
#define PE_ALCOHOL_LOWERED_HP       (411)
#define PE_ALCOHOL_LOWERED_HP_II    (412)
#define PE_AUTODOC_RAISED_HP        (413)
#define PE_AUTODOC_RAISED_HP_II     (414)
#define PE_AUTODOC_LOWERED_HP       (415)
#define PE_AUTODOC_LOWERED_HP_II    (416)
#define PE_EXPERT_EXCREMENT         (417)
// 418
#define PE_JINXED_II                (419)
#define PE_TERMINATOR               (420)
// 421..429
// Quest perks
#define PE_GECKO_SKINNING           (430)
#define PE_VAULT_CITY_INOCULATIONS  (431)
#define PE_DERMAL_IMPACT            (432)
#define PE_DERMAL_IMPACT_ENH        (433)
#define PE_PHOENIX_IMPLANTS         (434)
#define PE_PHOENIX_IMPLANTS_ENH     (435)
#define PE_NCR_PERCEPTION           (436)
#define PE_NCR_ENDURANCE            (437)
#define PE_NCR_BARTER               (438)
#define PE_NCR_REPAIR               (439)
// 440..469

	/// Addictions
#define ADDICTION_BEGIN            (__AddictionBegin)
#define ADDICTION_END              (__AddictionEnd)
#define ADDICTION_COUNT            (ADDICTION_END-ADDICTION_BEGIN+1)
#define ADDICTION_NUKA_COLA         (470)
#define ADDICTION_BUFFOUT           (471)
#define ADDICTION_MENTATS           (472)
#define ADDICTION_PSYCHO            (473)
#define ADDICTION_RADAWAY           (474)
#define ADDICTION_JET               (475)
#define ADDICTION_TRAGIC            (476)
// 376..379

	/// Karma perks
#define KARMA_BEGIN                (__KarmaBegin)
#define KARMA_END                  (__KarmaEnd)
#define KARMA_COUNT                (KARMA_END-KARMA_BEGIN+1)
#define KARMA_BERSERKER             (480)
#define KARMA_CHAMPION              (481)
#define KARMA_CHILDKILLER           (482)
#define KARMA_SEXPERT               (483)
#define KARMA_PRIZEFIGHTER          (484)
#define KARMA_GIGOLO                (485)
#define KARMA_GRAVE_DIGGER          (486)
#define KARMA_MARRIED               (487)
#define KARMA_PORN_STAR             (488)
#define KARMA_SLAVER                (489)
#define KARMA_VIRGIN_WASTES         (490)
#define KARMA_MAN_SALVATORE         (491)
#define KARMA_MAN_BISHOP            (492)
#define KARMA_MAN_MORDINO           (493)
#define KARMA_MAN_WRIGHT            (494)
#define KARMA_SEPARATED             (495)
#define KARMA_PEDOBEAR              (496)
#define KARMA_VC_GUARDSMAN          (497)
// 498..499

	/// Damages
#define DAMAGE_BEGIN               (__DamageBegin)
#define DAMAGE_END                 (__DamageEnd)
#define DAMAGE_COUNT               (DAMAGE_END-DAMAGE_BEGIN+1)
#define DAMAGE_POISONED             (500) // Hardcoded
#define DAMAGE_RADIATED             (501) // Hardcoded
#define DAMAGE_EYE                  (502)
#define DAMAGE_RIGHT_ARM            (503) // Hardcoded
#define DAMAGE_LEFT_ARM             (504) // Hardcoded
#define DAMAGE_RIGHT_LEG            (505) // Hardcoded
#define DAMAGE_LEFT_LEG             (506) // Hardcoded
// 507..509

	/// Modes
#define MODE_BEGIN                 (510)
#define MODE_END                   (549)
#define MODE_COUNT                 (MODE_END-MODE_BEGIN+1)
#define MODE_HIDE                   (510) // Состояние скрытности                                   Hardcoded
#define MODE_NO_STEAL               (511) // Нельзя обворовать                                      Hardcoded
#define MODE_NO_BARTER              (512) // Нельзя тоговать                                        Hardcoded
#define MODE_NO_ENEMY_STACK         (513) // Нпц не запоминает врагов                               Hardcoded
#define MODE_NO_PVP                 (514) // Запрещает ПвП для игрока                               Hardcoded
#define MODE_END_COMBAT             (515) // Согласен ли игрок закончить пошаговый бой              Hardcoded
#define MODE_DEFAULT_COMBAT         (516) // Режим боя по-умолчанию                                 Hardcoded
#define MODE_NO_HOME                (517) // Нпц не возвращается в домашнюю позицию автоматически   Hardcoded
#define MODE_GECK                   (518) // Локация не удаляется при наличии такого нпц            Hardcoded
#define MODE_NO_FAVORITE_ITEM       (519) // Режим установки итемов по-умолчанию                    Hardcoded
#define MODE_NO_ITEM_GARBAGER       (520) // Итемы не удаляются движком                             Hardcoded
#define MODE_DLG_SCRIPT_BARTER      (521) // Возможно торговать при активном скрипте на диалоге     Hardcoded
#define MODE_UNLIMITED_AMMO         (522) // Бесконечные патроны                                    Hardcoded
#define MODE_NO_DROP                (523) // Нельзя сбрасывать предметы
#define MODE_NO_LOOSE_LIMBS         (524) // Не может терять конечности
#define MODE_DEAD_AGES              (525) // Мёртвое тело не исчезает
#define MODE_NO_HEAL                (526) // Повреждения не излечиваются с течением времени
#define MODE_INVULNERABLE           (527) // Неуязвимый                                             Hardcoded
#define MODE_NO_FLATTEN             (528) // Не помещать труп на задний план после смерти           Hardcoded
#define MODE_SPECIAL_DEAD           (529) // Есть особый вид смерти
#define MODE_RANGE_HTH              (530) // Возможна рукопашная атака на расстоянии                Hardcoded
#define MODE_NO_KNOCK               (531) // Не может быть сбит с ног
#define MODE_NO_LOOT                (532) // Нельзя лутать                                          Hardcoded
#define MODE_NO_SUPPLY              (533) // Не приходят охотники за головами при смерти нпц
#define MODE_NO_KARMA_ON_KILL       (534) // При смерти не производится перерасчета кармы игрока-убийцы
#define MODE_BARTER_ONLY_CASH       (535) // При бартере нпц принимает оплату только наличными
#define MODE_NO_PUSH                (536) // Can't be pushed                                        Hardcoded
#define MODE_NO_UNARMED             (537) // Not have unarmed attacks                               Hardcoded
#define MODE_NO_AIM                 (538) // Critter can't do aim attacks                           Hardcoded
#define MODE_NO_WALK                (539) // Critter can't walk                                     Hardcoded
#define MODE_NO_RUN                 (540) // Critter can't run                                      Hardcoded
// 541..549

	/// Traits
#define TRAIT_BEGIN                (__TraitBegin)
#define TRAIT_END                  (__TraitEnd)
#define TRAIT_COUNT                (TRAIT_END-TRAIT_BEGIN+1)
#define TRAIT_FAST_METABOLISM       (550)
#define TRAIT_BRUISER               (551)
#define TRAIT_SMALL_FRAME           (552)
#define TRAIT_ONE_HANDER            (553)
#define TRAIT_FINESSE               (554)
#define TRAIT_KAMIKAZE              (555)
#define TRAIT_HEAVY_HANDED          (556)
#define TRAIT_FAST_SHOT             (557)
#define TRAIT_BLOODY_MESS           (558)
#define TRAIT_JINXED                (559)
#define TRAIT_GOOD_NATURED          (560)
#define TRAIT_CHEM_RELIANT          (561)
#define TRAIT_CHEM_RESISTANT        (562)
#define TRAIT_SEX_APPEAL            (563)
#define TRAIT_SKILLED               (564)
#define TRAIT_NIGHT_PERSON          (565)
//#define TRAIT_GIFTED                (566)
// 17..19

	/// Reputation
// Used range in engine character screen __ReputationBegin..__ReputationEnd
#define REPUTATION_BEGIN           (__ReputationBegin)
#define REPUTATION_END             (__ReputationEnd)
#define REPUTATION_COUNT           (REPUTATION_END-REPUTATION_BEGIN+1)
#define REPUTATION_DEN              (570)
#define REPUTATION_KLAMATH          (571)
#define REPUTATION_MODOC            (572)
#define REPUTATION_VAULT_CITY       (573)
#define REPUTATION_GECKO            (574)
#define REPUTATION_BROKEN_HILLS     (575)
#define REPUTATION_NEW_RENO         (576)
#define REPUTATION_SIERRA           (577)
#define REPUTATION_VAULT15          (578)
#define REPUTATION_NCR              (579)
#define REPUTATION_CATHEDRAL        (580)
#define REPUTATION_SAD              (581)
#define REPUTATION_REDDING          (582)
#define REPUTATION_SF               (583)
#define REPUTATION_NAVARRO          (584)
#define REPUTATION_ARROYO           (585)
#define REPUTATION_PRIMAL_TRIBE     (586)
#define REPUTATION_RANGERS          (587)
#define REPUTATION_VAULT13          (588)
#define REPUTATION_SACRAMENTO       (589)
// 590..599

//	/// Good / Evil list (not used)
//#define GOOD_EVIL_LIST_BEGIN       (600)
//#define GOOD_EVIL_LIST_END         (799)
//#define GOOD_EVIL_LIST_COUNT       (GOOD_EVIL_LIST_END-GOOD_EVIL_LIST_BEGIN+1)

	/// Mercenary settings
#define MERC_BEGIN                  (800)
#define MERC_END                    (809)
#define MERC_COUNT                  (MERC_END-MERC_BEGIN+1)
#define MERC_MASTER_ID              (800) // Id хозяина мерка
#define MERC_ALWAYS_RUN             (801) // Признак, мерк перемещаетя бегом при следовании за хозяином
#define MERC_CANCEL_ON_ATTACK       (802) // Признак, отменяет ли мерк службу, если хозяин атакует самого мерка.
#define MERC_LOSE_DIST              (803) // Дистанция, при превышении которой мерк "отстает" от хозяина и отменяет режиме мерка.
#define MERC_MASTER_DIST            (804) // Дистанция, которой придерживается мерк в режиме следования за хозяином
#define MERC_TYPE                   (805) // Тип мерка. См. merc_h
#define MERC_DEFEND_MASTER          (806) // Признак: мерк защищает хозяина, если тот атакован
#define MERC_ASSIST_MASTER          (807) // Признак: если хозяин атакует цель, мерк присоединяется к атаке
#define MERC_CANCEL_TIME            (808) // Время завершения службы
#define MERC_CANCEL_ON_GLOBAL       (809) // Признак: мерк отменяет службу, если хозяин вышел на глобальную карту.

//
// 830..999
//

#define PARAMS_COUNT                (1000)

// Planes types
#define AI_PLANE_MISC               (0)
#define AI_PLANE_ATTACK             (1)
#define AI_PLANE_WALK               (2)
#define AI_PLANE_PICK               (3)
#define AI_PLANE_PATROL             (4) // WIP
#define AI_PLANE_COURIER            (5) // WIP

// Planes deault priority
#define AI_PLANE_MISC_PRIORITY      (10)
#define AI_PLANE_ATTACK_PRIORITY    (50)
#define AI_PLANE_WALK_PRIORITY      (20)
#define AI_PLANE_PICK_PRIORITY      (35)
#define AI_PLANE_PATROL_PRIORITY    (25)
#define AI_PLANE_COURIER_PRIORITY   (30)

// Plane begin/end/run reasons
	// Begin
#define REASON_GO_HOME              (10)
#define REASON_FOUND_IN_ENEMY_STACK (11)
#define REASON_FROM_DIALOG          (12)
#define REASON_FROM_SCRIPT          (13)
#define REASON_RUN_AWAY             (14)
	// End
#define REASON_SUCCESS              (30)
#define REASON_HEX_TOO_FAR          (31)
#define REASON_HEX_BUSY             (32)
#define REASON_HEX_BUSY_RING        (33)
#define REASON_DEADLOCK             (34)
#define REASON_TRACE_FAIL           (35)
#define REASON_POSITION_NOT_FOUND   (36)
#define REASON_FIND_PATH_ERROR      (37)
#define REASON_CANT_WALK            (38)
#define REASON_TARGET_DISAPPEARED   (39)
#define REASON_USE_ITEM_NOT_FOUND   (40)
#define REASON_GAG_CRITTER          (41)
#define REASON_GAG_ITEM             (42)
#define REASON_NO_UNARMED           (43)
	// Run
#define REASON_ATTACK_TARGET        (50)
#define REASON_ATTACK_WEAPON        (51)
#define REASON_ATTACK_DISTANTION    (52)
#define REASON_ATTACK_USE_AIM       (53)

// Locker
#define LOCKER_ISOPEN               (0x01) // Hardcoded
#define LOCKER_LOCKED               (0x02)
#define LOCKER_JAMMED               (0x04)
#define LOCKER_BROKEN               (0x08)
#define LOCKER_NOOPEN               (0x10)
#define LOCKER_ELECTRO              (0x20)

// Timer
#define TIMER_MIN_VALUE             (1)
#define TIMER_MAX_VALUE             (599)

// Timeouts in real seconds, generic values
#define FIRST_AID_TIMEOUT     #(cr) (__FullSecond+(__TimeMultiplier*100/(((cr.Skill[SK_FIRST_AID])>3?cr.Skill[SK_FIRST_AID]:3)*100/MAX_SKILL_VAL))*60) // Orig 3 time on day, 5 min - sk
#define DOCTOR_TIMEOUT        #(cr) (__FullSecond+(__TimeMultiplier*100/(((cr.Skill[SK_DOCTOR])>3?cr.Skill[SK_DOCTOR]:3)*100/MAX_SKILL_VAL)*3)*60) // Orig 1 time on day, 20 min - sk
#define REPAIR_TIMEOUT        #(cr) (__FullSecond+REAL_MINUTE(1)) // Orig 4 time on day, 1 min
#define SCIENCE_TIMEOUT       #(cr) (__FullSecond+REAL_MINUTE(1)) // Orig 6 time on day, 1 min
#define LOCKPICK_TIMEOUT      #(cr) (__FullSecond+REAL_MINUTE(2)) // Orig 15 minutes, 2 min
#define STEAL_TIMEOUT         #(cr) (__FullSecond+REAL_MINUTE(2)) // 2 minutes
#define TRANSFER_TIMEOUT      #(cr) (__FullSecond+__TimeoutTransfer)
#define BATTLE_TIMEOUT        #(cr) (__FullSecond+MAX(__TimeoutBattle-REAL_SECOND(cr.Stat[ST_ARMOR_CLASS]),int(REAL_SECOND(12))))
#define TRAPS_TIMEOUT         #(cr) (__FullSecond+REAL_MINUTE(1))
#define SNEAK_TIMEOUT         #(cr) (__FullSecond+REAL_SECOND(MAX(34-cr.Stat[ST_SEQUENCE],3))) // 34 second - sequence
#define HEALING_TIMEOUT       #(cr) (__FullSecond+REAL_MINUTE(2)) // 2 minutes
#define IS_TURN_BASED_TIMEOUT #(cr) (cr.Timeout[TO_BATTLE]>10000000)
#define MAXIMUM_TIMEOUT             (REAL_HOUR(5)) // Doctor timeout with min skill

// Transfer types
#define TRANSFER_CLOSE              (0)
#define TRANSFER_HEX_CONT_UP        (1)
#define TRANSFER_HEX_CONT_DOWN      (2)
#define TRANSFER_SELF_CONT          (3)
#define TRANSFER_CRIT_LOOT          (4)
#define TRANSFER_CRIT_STEAL         (5)
#define TRANSFER_CRIT_BARTER        (6)
#define TRANSFER_FAR_CONT           (7)
#define TRANSFER_FAR_CRIT           (8)

// Scores
#define SCORE_EVIL_OF_HOUR          (0)
#define SCORE_HERO_OF_HOUR          (1)
#define SCORE_KARMA_ON_HOUR         (2)
#define SCORE_SPEAKER               (3) // Hardcoded
#define SCORE_TRADER                (4) // Hardcoded
#define SCORE_ZOMBY                 (5)
#define SCORE_PATY                  (6)
#define SCORE_MANIAC                (7)
#define SCORE_SCAUT                 (8)
#define SCORE_DOCTOR                (9)
#define SCORE_SHOOTER               (10)
#define SCORE_MELEE                 (11)
#define SCORE_UNARMED               (12)
#define SCORE_THIEF                 (13)
#define SCORE_DRIVER                (14)
#define SCORE_KILLER                (15)
#define SCORE_SNIPER                (16)
#define SCORE_ADVENTURER            (17)
#define SCORE_CRACKER               (18)
#define SCORE_UNARMED_DAMAGE        (19)
#define SCORE_RITCH                 (20)
#define SCORE_CHOSEN_ONE            (21)
#define SCORE_SIERRA_CUR            (40)
#define SCORE_MARIPOSA_CUR          (41)
#define SCORE_CATHEDRAL_CUR         (42)
#define SCORE_SIERRA_BEST           (43)
#define SCORE_MARIPOSA_BEST         (44)
#define SCORE_CATHEDRAL_BEST        (45)
#define SCORE_SIERRA_ORG            (46)
#define SCORE_MARIPOSA_ORG          (47)
#define SCORE_CATHEDRAL_ORG         (48)
#define SCORE_BASE_BEST_ORG         (49)
#define SCORES_MAX                  (50)

// Car flags
#define CAR_BIO_ENGINE              (0x0001)
#define CAR_NO_LOCKPICK             (0x0002)

// Body types
#define BT_MEN                      (0)
#define BT_WOMEN                    (1)
#define BT_CHILDREN                 (2)
#define BT_SUPER_MUTANT             (3)
#define BT_GHOUL                    (4)
#define BT_BRAHMIN                  (5)
#define BT_RADSCORPION              (6)
#define BT_RAT                      (7)
#define BT_FLOATER                  (8)
#define BT_CENTAUR                  (9)
#define BT_ROBOT                    (10)
#define BT_DOG                      (11)
#define BT_MANTI                    (12)
#define BT_DEADCLAW                 (13)
#define BT_PLANT                    (14)
#define BT_GECKO                    (15)
#define BT_ALIEN                    (16)
#define BT_GIANT_ANT                (17)
#define BT_BIG_BAD_BOSS             (18)
#define BT_GIANT_BEETLE             (19)
#define BT_GIANT_WASP               (20)
#define MAX_BODY_TYPES              (21)

// Locomotion types
#define LOCOMOTION_BIPED            (0)
#define LOCOMOTION_QUADRUPED        (1)
#define LOCOMOTION_ROBOTIC          (2)
#define LOCOMOTION_FLY              (3)

// Other
#define FLUSH_SCREEN_DEFAULT        (1000) // Flush screen time

// Dilalog functions
#define IS_DIALOG_END #(str)        (not valid(str))
#define IS_DIALOG_GENERATED #(str)  (valid(str) && str.length()==0)
#define IS_DIALOG_SAY_MODE #(str)   (valid(str) && str.length()>0)

// Time
#define IS_MORNING #(hour)          ((hour)>=7 && (hour)<=11) // 5 hours
#define IS_AFTERNOON #(hour)        ((hour)>=12 && (hour)<=21) // 10 hours
#define IS_NIGHT #(hour)            ((hour)>=22 || (hour)<=6) // 9 hours

// Item broken info
#define WEAR_MAX					(30000)
#define BROKEN_MAX					(10)
	// Flags
#define BI_LOWBROKEN				(0x01)
#define BI_NORMBROKEN				(0x02)
#define BI_HIGHBROKEN				(0x04)
#define BI_NOTRESC					(0x08)
#define BI_BROKEN					(0x0F)
#define BI_SERVICE					(0x10)
#define BI_SERVICE_EXT				(0x20)
#define BI_ETERNAL					(0x40)

// Combat modes
#define COMBAT_MODE_ANY             (0)
#define COMBAT_MODE_REAL_TIME       (1)
#define COMBAT_MODE_TURN_BASED      (2)

// Show screen modes
// Ouput: it is 'uint param' in Critter::ShowScreen.
// Input: I - integer value 'uint answerI', S - string value 'string& answerS' in 'answer_' function.
#define SCREEN_CLOSE                (0)  // Close top window.
#define SCREEN_TIMER                (1)  // Timer box. Output: picture index in INVEN.LST. Input I: time in game minutes (1..599).
#define SCREEN_DIALOGBOX            (2)  // Dialog box. Output: buttons count - 0..20 (exit button added automatically). Input I: Choosed button - 0..19.
#define SCREEN_SKILLBOX             (3)  // Skill box. Input I: selected skill.
#define SCREEN_BAG                  (4)  // Bag box. Input I: id of selected item.
#define SCREEN_SAY                  (5)  // Say box. Output: all symbols - 0 or only numbers - any other number. Input S: typed string.
#define SCREEN_ELEVATOR             (6)  // Elevator. Output: look ELEVATOR_* macro. Input I: Choosed level button.
#define SCREEN_INVENTORY            (7)  // Inventory.
#define SCREEN_CHARACTER            (8)  // Character.
#define SCREEN_FIXBOY               (9)  // Fix-boy.
#define SCREEN_PIPBOY               (10) // Pip-boy.
#define SCREEN_MINIMAP              (11) // Mini-map.

// Global map fog
#define FOG_FULL                    (0)
#define FOG_SELF                    (1)
#define FOG_SELF2                   (2)
#define FOG_NONE                    (3)

// Critter extra flags, only for read
#define CRITTER_PLAYER              (0x00010000) // Игрок.
#define CRITTER_NPC                 (0x00020000) // Нпц.
#define CRITTER_DISCONNECT          (0x00080000) // В оффлайне.
#define CRITTER_CHOSEN              (0x00100000) // Криттер игрока. Используется только при отправке сообщения клиенту для идентификации его персонажа.
#define CRITTER_RULEGROUP           (0x00200000) // Рулевой в группе на глобале.

// Hit locations
#define HIT_LOCATION_NONE           (0)
#define HIT_LOCATION_HEAD           (1)
#define HIT_LOCATION_LEFT_ARM       (2)
#define HIT_LOCATION_RIGHT_ARM      (3)
#define HIT_LOCATION_TORSO          (4)
#define HIT_LOCATION_RIGHT_LEG      (5)
#define HIT_LOCATION_LEFT_LEG       (6)
#define HIT_LOCATION_EYES           (7)
#define HIT_LOCATION_GROIN          (8)
#define HIT_LOCATION_UNCALLED       (9)

// Sound types
	// Generic <Type Subtype SoundId SoundIdExt X X X X>
	// Weapon <Type Subtype SoundId SoundIdExt X X X [Random 1 or 2]>
#define SOUND_WEAPON                'W'
#define SOUND_WEAPON_USE             'A'
#define SOUND_WEAPON_FLY             'F'
#define SOUND_WEAPON_MISS            'H'
#define SOUND_WEAPON_EMPTY           'O'
#define SOUND_WEAPON_RELOAD          'R'
	// Door <Type Subtype D O O R S SoundId>
#define SOUND_DOOR                  'S'
#define SOUND_DOOR_OPEN              'O'
#define SOUND_DOOR_LOCK              'L'
#define SOUND_DOOR_CLOSE             'C'
#define SOUND_DOOR_NOT_OPEN          'N'

// Critter find types
// Combine groups with | operator
#define FIND_LIFE                   (0x01) // First group
#define FIND_KO                     (0x02)
#define FIND_DEAD                   (0x04)
#define FIND_LIFE_AND_KO             (0x03)
#define FIND_LIFE_AND_DEAD           (0x05)
#define FIND_KO_AND_DEAD             (0x06)
#define FIND_ALL                     (0x0F)
#define FIND_ONLY_PLAYERS           (0x10) // Second group
#define FIND_ONLY_NPC               (0x20)

// Elevators
#define ELEVATOR_X   #(elevator,current_level)     ((uint((current_level)&0xFFFF)<<16)|(elevator)&0xFFFF)
#define ELEVATOR_BOS_1234     #(current_level)     (ELEVATOR_X(0,current_level))
#define ELEVATOR_BOS_01       #(current_level)     (ELEVATOR_X(1,current_level))
#define ELEVATOR_MASTER_123   #(current_level)     (ELEVATOR_X(2,current_level))
#define ELEVATOR_MASTER_34    #(current_level)     (ELEVATOR_X(3,current_level))
#define ELEVATOR_MILITARY_123 #(current_level)     (ELEVATOR_X(4,current_level))
#define ELEVATOR_MILITARY_34  #(current_level)     (ELEVATOR_X(5,current_level))
#define ELEVATOR_MILITARY_346 #(current_level)     (ELEVATOR_X(6,current_level)) // Use 6 level as 5
#define ELEVATOR_MILITARY_456 #(current_level)     (ELEVATOR_X(7,current_level))
#define ELEVATOR_VAULT_123    #(current_level)     (ELEVATOR_X(8,current_level))

// Dialog links
#define DIALOG_END                  uint(-1)
#define DIALOG_BACK                 uint(-2)
#define DIALOG_BARTER               uint(-3)
#define DIALOG_ATTACK               uint(-4)

// Fix boy function call states
#define FIXBOY_LIST                (0)
#define FIXBOY_BUTTON              (1)
#define FIXBOY_CRAFT               (2)

// Fix boy craft results
#define FIXBOY_ALLOW_CRAFT         (0x0001)
#define FIXBOY_CHECK_TIMEOUT       (0x0002)
#define FIXBOY_SET_TIMEOUT         (0x0004)
#define FIXBOY_CHECK_PARAMS        (0x0008)
#define FIXBOY_CHECK_MATERIALS     (0x0010)
#define FIXBOY_CHECK_TOOLS         (0x0020)
#define FIXBOY_SUB_MATERIALS       (0x0040)
#define FIXBOY_ADD_CRAFT_ITEMS     (0x0080)
#define FIXBOY_ADD_EXPERIENCE      (0x0100)
#define FIXBOY_SEND_SUCC_MESSAGE   (0x0200)
#define FIXBOY_SEND_FAIL_MESSAGE   (0x0400)
#define FIXBOY_DEFAULT             (0xFFFF)

// Access levels
#define ACCESS_CLIENT              (0)
#define ACCESS_TESTER              (1)
#define ACCESS_MODER               (2)
#define ACCESS_ADMIN               (3)

// Special skill values
#define SKILL_PICK_ON_GROUND       (-1)
#define SKILL_PUT_CONT             (-2)
#define SKILL_TAKE_CONT            (-3)
#define SKILL_TAKE_ALL_CONT        (-4)
#define SKILL_LOOT_CRITTER         (-5)
#define SKILL_PUSH_CRITTER         (-6)
#define SKILL_TALK                 (-7)

// Look checks
#define LOOK_CHECK_DIR              (0x01) // Nerfe look by directions of look
#define LOOK_CHECK_SNEAK_DIR        (0x02) // Nerfe opponent sneak by directions of look
#define LOOK_CHECK_SNEAK_WEIGHT     (0x04) // Nerfe sneak by current weight
#define LOOK_CHECK_TRACE            (0x08) // Tracing for wall aviablility
#define LOOK_CHECK_SCRIPT           (0x10) // Allow bool check_look(...) in main.fos, all other defines ignored

// Critter base types
#ifndef PLAYERS_3D
#define CRTYPE_DEFAULT_M            (CRTYPE_DW_JUMPSUIT_M)
#define CRTYPE_DEFAULT_F            (CRTYPE_DW_JUMPSUIT_F)
#endif
#ifdef PLAYERS_3D
#define CRTYPE_DEFAULT_M            (CRTYPE_3D_MALE_NORMAL)
#define CRTYPE_DEFAULT_F            (CRTYPE_3D_FEMALE_NORMAL)
#endif
#define CRTYPE_NONE                 (0) // Used with ST_BASE_CRTYPE as default
	// Dweller
#define CRTYPE_DW_JUMPSUIT_M        (11)
#define CRTYPE_DW_JUMPSUIT_F        (4)
#define CRTYPE_DW_LEATHER_JACKET_F  (6)
#define CRTYPE_DW_LEATHER_ARMOR_M   (12)
#define CRTYPE_DW_LEATHER_JACKET_M  (13)
#define CRTYPE_DW_METAL_ARMOR_M     (14)
#define CRTYPE_DW_TRIBAL_F          (63)
#define CRTYPE_DW_TRIBAL_M          (64)
	// Vault citizen
#define CRTYPE_VAULT_M              (69)
#define CRTYPE_VAULT_F              (74)
	// Robots
#define CRTYPE_ROBOT                (66)
	// Long Hair Dude
#define CRTYPE_LHD_JUMPSUIT         (106) // Used with ST_BASE_CRTYPE
#define CRTYPE_LHD_LEATHER_ARMOR    (107)
#define CRTYPE_LHD_LEATHER_JACKET   (108)
#define CRTYPE_LHD_METAL_ARMOR      (109)
#define CRTYPE_LHD_TRIBAL           (110)
	// Other
#define CRTYPE_VAULT_BOY            (249)
	// 3d critters
#define CRTYPE_3D_MALE_NORMAL       (290)
#define CRTYPE_3D_MALE_WIRY         (291)
#define CRTYPE_3D_MALE_STRONG       (292)
#define CRTYPE_3D_MALE_FAT          (293)
#define CRTYPE_3D_MALE_SKELETON     (294)
#define CRTYPE_3D_FEMALE_NORMAL     (295)
#define CRTYPE_3D_FEMALE_WIRY       (296)
#define CRTYPE_3D_FEMALE_STRONG     (297)
#define CRTYPE_3D_FEMALE_FAT        (298)
#define CRTYPE_3D_FEMALE_SKELETON   (299)
#define CRTYPE_3D_ANT               (300)
#define CRTYPE_3D_ANT_QUEEN         (301)
#define CRTYPE_3D_BAT               (302)
#define CRTYPE_3D_BEETLE            (303)
#define CRTYPE_3D_CENTIPEDE         (304)
#define CRTYPE_3D_COUGAR            (305)
#define CRTYPE_3D_COW               (306)
#define CRTYPE_3D_DEATHCLAW         (307)
#define CRTYPE_3D_DESERT_STALKER    (308)
#define CRTYPE_3D_DOG               (309)
#define CRTYPE_3D_GILA              (310)
#define CRTYPE_3D_MANTRAP           (311)
#define CRTYPE_3D_RAD_TOAD          (312)
#define CRTYPE_3D_RAT               (313)
#define CRTYPE_3D_THORN_SLINGER     (314)
#define CRTYPE_3D_WASP_GIANT        (315)
#define CRTYPE_3D_WEEDLING          (316)
	// Arcanum
#define CRTYPE_ARCANUM_GEN_CR_BEGIN (600)
#define CRTYPE_ARCANUM_GEN_CR_END   (699)

// Global map events
#define GLOBAL_PROCESS_MOVE         (0)
#define GLOBAL_PROCESS_ENTER        (1)
#define GLOBAL_PROCESS_START_FAST   (2)
#define GLOBAL_PROCESS_START        (3)
#define GLOBAL_PROCESS_SET_MOVE     (4)
#define GLOBAL_PROCESS_STOPPED      (5)
#define GLOBAL_PROCESS_NPC_IDLE     (6) // Called every __CritterIdleTick
//#define GLOBAL_PROCESS_NEW_ZONE     (6) not implemented
#define GLOBAL_MAP_BASE_SPEED       (2000) // Base speed, 0.5 second per pixel, 1000 is 1 second per pixel

// Global map walk types
#define GM_WALK_GROUND              (0)
#define GM_WALK_FLY                 (1)
#define GM_WALK_WATER               (2)

// Global map relief (GetGlobalMapRelief)
#define GM_RELIEF_WATER             (15)
//  0,    1,    2,    3,    4,    5,     6,    7,     8,    9,    10,   11,    12,   13,    14
// 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1.0f, 0.95f, 0.9f, 0.85f, 0.8f, 0.75f, 0.7f, 0.65f, 0.6f, 0.55f

// AngelScript properties
#define AS_ALLOW_UNSAFE_REFERENCES      (1)  // true
#define AS_OPTIMIZE_BYTECODE            (2)  // true
#define AS_COPY_SCRIPT_SECTIONS         (3)  // true
#define AS_MAX_STACK_SIZE               (4)  // 0 (unlimited)
#define AS_USE_CHARACTER_LITERALS       (5)  // false
#define AS_ALLOW_MULTILINE_STRINGS      (6)  // false
#define AS_ALLOW_IMPLICIT_HANDLE_TYPES  (7)  // false
#define AS_BUILD_WITHOUT_LINE_CUES      (8)  // false
#define AS_INIT_GLOBAL_VARS_AFTER_BUILD (9)  // true
#define AS_REQUIRE_ENUM_SCOPE           (10) // false
#define AS_SCRIPT_SCANNER               (11) // 0
#define AS_INCLUDE_JIT_INSTRUCTIONS     (12) // false
#define AS_STRING_ENCODING              (13) // 0 (ascii)
#define AS_PROPERTY_ACCESSOR_MODE       (14) // 0 disable, 1 app registered only, 2 app and script created (default)

// Item data masks
#define ITEM_DATA_MASK_CHOSEN       (0)
#define ITEM_DATA_MASK_CRITTER      (1)
#define ITEM_DATA_MASK_CRITTER_EXT  (2)
#define ITEM_DATA_MASK_CONTAINER    (3)
#define ITEM_DATA_MASK_MAP          (4)

// Radio
	// Flags, Item/ItemCl::RadioFlags
#define RADIO_DISABLE_SEND          (0x0001) // Hardcoded
#define RADIO_DISABLE_RECV          (0x0002) // Hardcoded
#define RADIO_DISABLE_SHIFT_SEND    (0x0100)
#define RADIO_DISABLE_SHIFT_RECV    (0x0200)
#define RADIO_DISABLE_SHIFT_BC_SEND (0x0400)
#define RADIO_DISABLE_SHIFT_BC_RECV (0x0800)
#define RADIO_DISABLE_SHIFT_CHANNEL (0x1000)
	// Broadcast, Item/ItemCl::RadioBroadcastSend/RadioBroadcastRecv, Hardcoded
#define RADIO_BROADCAST_WORLD       (0)       // Send/recv in all world
#define RADIO_BROADCAST_MAP         (20)      // Send/recv only on one map
#define RADIO_BROADCAST_LOCATION    (40)      // Send/recv only on one location
#define RADIO_BROADCAST_ZONE #(x)   (100+(x)) // Send/recv only in x (1..100) zones radius on global map
#define RADIO_BROADCAST_FORCE_ALL   (250)     // Force send/recv in any place

// Extended methods
#ifndef SKIP_PRAGMAS
#ifdef __SERVER
#pragma bindfunc "bool Critter::IsInjured()    -> fonline_tla.dll Critter_IsInjured   "
#pragma bindfunc "bool Critter::IsDmgEye()     -> fonline_tla.dll Critter_IsDmgEye    "
#pragma bindfunc "bool Critter::IsDmgLeg()     -> fonline_tla.dll Critter_IsDmgLeg    "
#pragma bindfunc "bool Critter::IsDmgTwoLeg()  -> fonline_tla.dll Critter_IsDmgTwoLeg "
#pragma bindfunc "bool Critter::IsDmgArm()     -> fonline_tla.dll Critter_IsDmgArm    "
#pragma bindfunc "bool Critter::IsDmgTwoArm()  -> fonline_tla.dll Critter_IsDmgTwoArm "
#pragma bindfunc "bool Critter::IsAddicted()   -> fonline_tla.dll Critter_IsAddicted  "
#pragma bindfunc "bool Critter::IsOverweight() -> fonline_tla.dll Critter_IsOverweight"

#pragma bindfunc "bool Item::Weapon_IsHtHAttack(uint8 mode)    -> fonline_tla.dll Item_Weapon_IsHtHAttack   "
#pragma bindfunc "bool Item::Weapon_IsGunAttack(uint8 mode)    -> fonline_tla.dll Item_Weapon_IsGunAttack   "
#pragma bindfunc "bool Item::Weapon_IsRangedAttack(uint8 mode) -> fonline_tla.dll Item_Weapon_IsRangedAttack"
#endif

#ifdef __CLIENT
#pragma bindfunc "bool CritterCl::IsInjured()    -> fonline_tla_client.dll Critter_IsInjured  "
#pragma bindfunc "bool CritterCl::IsDmgEye()     -> fonline_tla_client.dll Critter_IsDmgEye   "
#pragma bindfunc "bool CritterCl::IsDmgLeg()     -> fonline_tla_client.dll Critter_IsDmgLeg   "
#pragma bindfunc "bool CritterCl::IsDmgTwoLeg()  -> fonline_tla_client.dll Critter_IsDmgTwoLeg"
#pragma bindfunc "bool CritterCl::IsDmgArm()     -> fonline_tla_client.dll Critter_IsDmgArm   "
#pragma bindfunc "bool CritterCl::IsDmgTwoArm()  -> fonline_tla_client.dll Critter_IsDmgTwoArm"
#pragma bindfunc "bool CritterCl::IsAddicted()   -> fonline_tla_client.dll Critter_IsAddicted "
#pragma bindfunc "bool CritterCl::IsOverweight() -> fonline_tla_client.dll Critter_IsOverweight"

#pragma bindfunc "bool ItemCl::Weapon_IsHtHAttack(uint8 mode)    -> fonline_tla_client.dll Item_Weapon_IsHtHAttack   "
#pragma bindfunc "bool ItemCl::Weapon_IsGunAttack(uint8 mode)    -> fonline_tla_client.dll Item_Weapon_IsGunAttack   "
#pragma bindfunc "bool ItemCl::Weapon_IsRangedAttack(uint8 mode) -> fonline_tla_client.dll Item_Weapon_IsRangedAttack"
#endif
#endif

#endif // __DEFINES__














