Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make code comments in game_constants.h uniform #35505

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 60 additions & 48 deletions src/game_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "calendar.h"
#include "units.h"

// Fixed window sizes
// Fixed window sizes.
#define HP_HEIGHT 14
#define HP_WIDTH 7
#define MINIMAP_HEIGHT 7
Expand All @@ -22,11 +22,11 @@
#define BLINK_SPEED 300
#define EXPLOSION_MULTIPLIER 7

// Really just a sanity check for functions not tested beyond this. in theory 4096 works (`InvletInvlet)
// Really just a sanity check for functions not tested beyond this. in theory 4096 works (`InvletInvlet).
#define MAX_ITEM_IN_SQUARE 4096
// no reason to differ
// no reason to differ.
#define MAX_ITEM_IN_VEHICLE_STORAGE MAX_ITEM_IN_SQUARE
// only can wear a maximum of two of any type of clothing
// only can wear a maximum of two of any type of clothing.
#define MAX_WORN_PER_TYPE 2

#define MAPSIZE 11
Expand All @@ -45,123 +45,135 @@

#define MAX_VIEW_DISTANCE ( SEEX * HALF_MAPSIZE )

// Size of the overmap. This is the number of overmap terrain tiles per dimension in one overmap,
// it's just like SEEX/SEEY for submaps.
/**
* Size of the overmap. This is the number of overmap terrain tiles per dimension in one overmap,
* it's just like SEEX/SEEY for submaps.
*/
#define OMAPX 180
#define OMAPY 180

// Size of a square unit of terrain saved to a directory.
#define SEG_SIZE 32

// Items on the map with at most this distance to the player are considered available for crafting,
// see inventory::form_from_map
/**
* Items on the map with at most this distance to the player are considered available for crafting,
* see inventory::form_from_map
*/
#define PICKUP_RANGE 6

/** Number of z-levels below 0 (not including 0). */
// Number of z-levels below 0 (not including 0).
#define OVERMAP_DEPTH 10
/** Number of z-levels above 0 (not including 0). */
// Number of z-levels above 0 (not including 0).
#define OVERMAP_HEIGHT 10
/** Total number of z-levels */
// Total number of z-levels.
#define OVERMAP_LAYERS (1 + OVERMAP_DEPTH + OVERMAP_HEIGHT)

/** Maximum move cost when handling an item */
// Maximum move cost when handling an item.
#define MAX_HANDLING_COST 400
/** Move cost of accessing an item in inventory. */
// Move cost of accessing an item in inventory.
#define INVENTORY_HANDLING_PENALTY 100
/** Move cost of accessing an item lying on the map. TODO: Less if player is crouching */
// Move cost of accessing an item lying on the map. TODO: Less if player is crouching.
#define MAP_HANDLING_PENALTY 80
/** Move cost of accessing an item lying on a vehicle. */
// Move cost of accessing an item lying on a vehicle.
#define VEHICLE_HANDLING_PENALTY 80

/** Amount by which to charge an item for each unit of plutonium cell */
// Amount by which to charge an item for each unit of plutonium cell.
#define PLUTONIUM_CHARGES 500

/** Temperature constants */
// Temperature constants.
namespace temperatures
{
/** temperature at which something starts is considered HOT */
// temperature at which something starts is considered HOT.
constexpr int hot = 100; // ~ 38 Celsius

/** the "normal" temperature midpoint between cold and hot */
// the "normal" temperature midpoint between cold and hot.
constexpr int normal = 70; // ~ 21 Celsius

/** Temperature inside an active fridge in Fahrenheit */
// Temperature inside an active fridge in Fahrenheit.
constexpr int fridge = 37; // ~ 2.7 Celsius

/** Temperature at which things are considered "cold" */
// Temperature at which things are considered "cold".
constexpr int cold = 40; // ~4.4 C

/** Temperature inside an active freezer in Fahrenheit */
// Temperature inside an active freezer in Fahrenheit.
constexpr int freezer = 23; // -5 Celsius

/** Temperature in which water freezes in Fahrenheit */
// Temperature in which water freezes in Fahrenheit.
constexpr int freezing = 32; // 0 Celsius
} // namespace temperatures

// Shelf life of corpse. This should be kept same as raw flesh.
constexpr time_duration CORPSE_ROT_TIME = 24_hours;

/** Weight per level of LIFT/JACK tool quality */
// Weight per level of LIFT/JACK tool quality.
#define TOOL_LIFT_FACTOR 500_kilogram // 500kg/level

/** Cap JACK requirements to support arbitrarily large vehicles */
// Cap JACK requirements to support arbitrarily large vehicles.
#define JACK_LIMIT 8500_kilogram // 8500kg ( 8.5 metric tonnes )

/** Slowest speed at which a gun can be aimed */
// Slowest speed at which a gun can be aimed.
#define MAX_AIM_COST 10

/** Maximum (effective) level for a skill */
// Maximum (effective) level for a skill.
#define MAX_SKILL 10

/** Maximum (effective) level for a stat */
// Maximum (effective) level for a stat.
#define MAX_STAT 20

/** Maximum range at which ranged attacks can be executed */
// Maximum range at which ranged attacks can be executed.
#define RANGE_HARD_CAP 60

/** Accuracy levels which a shots tangent must be below */
// Accuracy levels which a shots tangent must be below.
constexpr double accuracy_headshot = 0.1;
constexpr double accuracy_critical = 0.2;
constexpr double accuracy_goodhit = 0.5;
constexpr double accuracy_standard = 0.8;
constexpr double accuracy_grazing = 1.0;

/** Minimum item damage output of relevant type to allow using with relevant weapon skill */
// Minimum item damage output of relevant type to allow using with relevant weapon skill.
#define MELEE_STAT 5

/** Effective lower bound to combat skill levels when CQB bionic is active */
// Effective lower bound to combat skill levels when CQB bionic is active.
#define BIO_CQB_LEVEL 5

/** Minimum size of a horde to show up on the minimap. */
// Minimum size of a horde to show up on the minimap.
#define HORDE_VISIBILITY_SIZE 3

/** Average annual temperature in F used for climate, weather and temperature calculation */
/** Average New England temperature = 43F/6C rounded to int */
/**
* Average annual temperature in F used for climate, weather and temperature calculation.
* Average New England temperature = 43F/6C rounded to int.
*/
#define AVERAGE_ANNUAL_TEMPERATURE 43

/** Base starting spring temperature in F used for climate, weather and temperature calculation */
/** New England base spring temperature = 65F/18C rounded to int */
/**
* Base starting spring temperature in F used for climate, weather and temperature calculation.
* New England base spring temperature = 65F/18C rounded to int.
*/
#define SPRING_TEMPERATURE 65

/** Used to limit the random seed during noise calculation. A large value flattens the noise generator to zero.
Windows has a rand limit of 32768, other operating systems can have higher limits. */
/**
* Used to limit the random seed during noise calculation. A large value flattens the noise generator to zero.
* Windows has a rand limit of 32768, other operating systems can have higher limits.
*/
constexpr int SIMPLEX_NOISE_RANDOM_SEED_LIMIT = 32768;

// activity levels, used for BMR
// these levels are normally used over the length of
// days to weeks in order to calculate your total BMR
// but we are making it more granular to be able to have
// variable activity levels.
// as such, when determining your activity level
// in the json, think about what it would be if you
// did this activity for a longer period of time.
/**
* activity levels, used for BMR.
* these levels are normally used over the length of
* days to weeks in order to calculate your total BMR
* but we are making it more granular to be able to have
* variable activity levels.
* as such, when determining your activity level
* in the json, think about what it would be if you
* did this activity for a longer period of time.
*/
constexpr float NO_EXERCISE = 1.2f;
constexpr float LIGHT_EXERCISE = 1.375f;
constexpr float MODERATE_EXERCISE = 1.55f;
constexpr float ACTIVE_EXERCISE = 1.725f;
constexpr float EXTRA_EXERCISE = 1.9f;

// these are the lower bounds of each of the weight classes
// these are the lower bounds of each of the weight classes.
namespace character_weight_category
{
constexpr float emaciated = 14.0f;
Expand Down