Compare commits

..

578 Commits

Author SHA1 Message Date
Kevin Granade 7c8d5009ac Release 0.7.1 2013-07-18 21:47:16 -05:00
Kevin Granade 210273f3ca Merge remote-tracking branch 'dda/master' into dda-master 2013-07-18 21:47:02 -05:00
GalenEvil 2bc5d630b5 Merge branch 'origin/master' 2013-07-18 21:35:02 -05:00
GalenEvil d9414565ff Merge remote-tracking branch 'origin/pr/2113' 2013-07-18 21:29:50 -05:00
Kevin Granade 5590d9beb9 Merge pull request #2098 from kevingranade/update-msvc-versioning
Update version for MSVC project builds.
2013-07-18 17:58:23 -07:00
Kevin Granade e62ca51fd6 Merge branch 'master' of github.com:CuriousRaven/Cataclysm-DDA into dda-master 2013-07-18 19:55:22 -05:00
GalenEvil 4d31482045 Merge branch 'origin/master' 2013-07-18 19:25:22 -05:00
GalenEvil f116c1bad6 Merge remote-tracking branch 'origin/pr/2105' 2013-07-18 19:19:34 -05:00
GalenEvil 93031408ff Merge remote-tracking branch 'origin/pr/2102' 2013-07-18 19:19:10 -05:00
Kevin Granade 76e3ca7292 Move check for ammo effect outside of time_to_fire() to avoid dereferencing (potentially null) currammo. 2013-07-18 19:09:34 -05:00
GalenEvil 220fec1701 Merge remote-tracking branches 'origin/pr/2104', 'origin/pr/2100' and 'origin/pr/2099' 2013-07-18 19:08:23 -05:00
Kevin Granade ab998b1734 Merge fix to gunmod attachment check. 2013-07-18 18:16:12 -05:00
somerandomlogin b052ca9871 Fix for weapon mods with no ammo types 2013-07-18 17:38:23 +04:00
GalenEvil 9396c17c02 Change in how Vehicle Examination window is displayed so it works in 12x12 View Screens
Added a logging ability for constant values to DebugLog.
2013-07-17 23:45:24 -05:00
Kevin Granade 734cfc40f9 Strip out references to a removed ammunition in spawn lists. 2013-07-17 22:40:02 -05:00
Kevin Granade 401dd4c319 Don't draw item glyphs on top of furniture glyphs. 2013-07-17 21:47:26 -05:00
Kevin Granade f830f19fe0 Merge some sleep fixes. 2013-07-17 20:51:01 -05:00
Kevin Granade 766a707722 Fix typo in spawn list. 2013-07-17 20:03:22 -05:00
Kevin Granade 03f59c5c4b Supress pickup from vehicle when doing autopickup. 2013-07-17 19:07:43 -05:00
Kevin Granade 336820e22e Remove coverage property from wristwatch to prevent ensumberance. 2013-07-17 18:56:58 -05:00
Kevin Granade eeede6a039 Update version for MSVC project builds. 2013-07-17 18:05:42 -05:00
Peter Lacey-Bordeaux 945fe528ff made coughing from smoke wake you up 2013-07-17 16:18:13 -04:00
somerandomlogin b2547996be Vehicle bed sleepiness fix. 2013-07-17 19:47:53 +04:00
Kevin Granade 7f7b54571b Final updates for 0.7 release. 2013-07-16 22:11:59 -05:00
Christian Buskirk ce89fe960d Merge PR #2078 - Autosave option fix 2013-07-16 19:31:13 -07:00
Christian Buskirk 66261402ff Merge PR #2080 - Vehicle saving 2013-07-16 19:30:17 -07:00
Christian Buskirk 7f46a542fe Merge PR #2077 - Folding bike improvements 2013-07-16 19:29:09 -07:00
Kevin Granade 40e85b0353 Allow saving while in a vehicle. Fixes #2064 2013-07-16 20:58:22 -05:00
Kevin Granade c00cd7b9bb Serialize flags and passenger_id members of vehicle components. 2013-07-16 20:57:40 -05:00
Kevin Granade a9e420dc61 Set minimum number of turns between autosave to 1 to prevent div/0 error. Fixes #1922. 2013-07-16 20:07:46 -05:00
Kevin Granade f0271b1cec Convert a manual check for watch flag to use a handy helper method. 2013-07-16 20:03:27 -05:00
Kevin Granade 824b10ea1d Merge remote-tracking branch 'dda/pr/2076' into dda-master 2013-07-16 19:41:19 -05:00
Kevin Granade 4e7d34e05e Merge Accuracy rebalance, AltGr fix, and Blade trap placement fix. 2013-07-16 19:25:35 -05:00
Kevin Granade 38d2a07c65 Drop folding bicycle box items on ground when folding bicycle. 2013-07-16 19:12:54 -05:00
Kevin Granade b2a08ee4e1 Add construction recipe for folding bicycle. 2013-07-16 19:12:01 -05:00
Kevin Granade f772977184 Add folding bicycle to a few spawn groups. 2013-07-16 19:11:33 -05:00
OzoneH3 d0c4519b0d Added wristwatch to itemgroups. 2013-07-16 21:08:01 +02:00
OzoneH3 9cac01cd22 Added a wristwatch. If worn show exact time, otherwise only show the current position of the sun/moon. 2013-07-16 20:59:16 +02:00
Peter Lacey-Bordeaux 7458ef8655 fixed blade trap problem 2013-07-16 12:24:43 -04:00
OzoneH3 8580f7f78f Sun/Moon position instead of precise time for people without a watch. 2013-07-16 17:13:07 +02:00
utunnels 2d200f5af7 Now use left alt to input alt+number because AltGr is right alt in sdl. 2013-07-16 16:17:06 +08:00
Christian Buskirk 3ae6a1a8de Extend rebalance to new weapons/ammo 2013-07-15 23:35:19 -07:00
Christian Buskirk 0667b20125 Solve merge conflicts 2013-07-15 23:32:19 -07:00
Christian Buskirk ff57ac89f5 Syntax fix 2013-07-15 22:52:37 -07:00
Christian Buskirk e09af5d70c Update NPC targeting confidence function 2013-07-15 22:27:38 -07:00
Christian Buskirk 5a689e44c8 Made perception and Dexterity no longer display 0 as a "bonus" 2013-07-15 21:57:20 -07:00
Christian Buskirk 682174ce74 Overall dispersion reduction
Total ammo+gun reduction of 14
2013-07-15 20:59:54 -07:00
Kevin Granade d2a3acd821 Catch up changelog to current feature list. 2013-07-15 22:51:46 -05:00
Stevensonz e91193ee04 New Revolvers Ammo, Recipe
Some Revolver love
2013-07-15 21:49:16 -05:00
Kevin Granade 9f03f153da Fix bad material labels, addresses #2028. 2013-07-15 19:29:01 -05:00
Kevin Granade c24c775694 Merge too much stuff to list. 2013-07-15 18:21:24 -05:00
Peter Lacey-Bordeaux 37fd1058cc removed unused variable 2013-07-15 13:27:15 -04:00
Peter Lacey-Bordeaux 8e4b775338 changed get_direction in bionics to choose_adjacent 2013-07-15 13:24:20 -04:00
Christian Buskirk 2218ca1009 Fix typo
Thanks to OzoneH3 for catching that.
2013-07-15 05:05:10 -07:00
Christian Buskirk a39dfc3ab4 Fix Advanced UPS plutonium cell duplication
Closes issue #1780
2013-07-15 04:55:23 -07:00
Christian Buskirk 95abc56e14 Unify painkiller usage
Closes issue #1880
2013-07-15 04:31:31 -07:00
Christian Buskirk 5ea66d8bdf Clean outside cache logic 2013-07-15 03:23:40 -07:00
Christian Buskirk 00e5091d61 Clean pocket logic 2013-07-15 03:23:31 -07:00
OzoneH3 9e32ac83d4 Fixed list items compare feature 2013-07-15 12:22:46 +02:00
OzoneH3 3c23b7dadb Added option to enable/disable zombie revival 2013-07-15 11:25:06 +02:00
utunnels 31899327e2 Quick fix to missing popup printf parameters. 2013-07-15 17:13:16 +08:00
carnie 94f93110b5 Split game::autosave() into two - quicksave() handles the vehicle, movement and item checks (i.e. anything that could potentially lead to problems by saving rapidly or due to bugs) and then handles the saving. autosave() handles the time-delay checks and then calls quicksave()
Removed some copypasta'd autosave() code and replaced it with quicksave().

keymap not updated, I'd recommend 'q' as the quicksave key.
2013-07-15 10:10:56 +01:00
Christian Buskirk 7081984ab4 Merge PR#1998 - Ammotype to std::string
Conflicts:
	data/raw/items/ammo.json
	veh_interact.cpp
	vehicle.cpp
2013-07-15 02:02:15 -07:00
OzoneH3 49448b0f54 Added Auto Pickup Safemode 2013-07-15 10:59:17 +02:00
Christian Buskirk cfa8ac17e3 Merge PR#2058 - Fix NPC item give crash 2013-07-15 01:42:00 -07:00
Christian Buskirk f14d24ec56 Mrege PR#2038 - Remove inside dynamic spawns 2013-07-15 01:32:45 -07:00
Christian Buskirk f5a8fe533b Merge PR#2056 - Turret drop nerf 2013-07-15 01:19:20 -07:00
Christian Buskirk 9ac3e63f0a Merge PR#2051 - Vehicle fling fix 2013-07-15 01:16:22 -07:00
Christian Buskirk 392ca258c0 Merge PR#2054 - Power armor/Mutation interaction 2013-07-15 01:10:22 -07:00
Christian Buskirk 0bac7ba12b Merge PR#2046 - Classic monster fix 2013-07-15 01:02:05 -07:00
OzoneH3 8b3eb919aa Added a border to the vehicle menu and centered it. 2013-07-15 10:01:49 +02:00
GalenEvil 12f57e1871 Fiddled with the popup message for when an NPC gives the player something to avert a segfault. 2013-07-15 01:18:33 -05:00
Kevin Granade eb37236a3a Merge text wrap and key entry fix, increased food ingredient spawns, destructable and stocked ovens, and a fix to a friendly monster movement induced hang. 2013-07-14 22:35:32 -05:00
Kevin Granade c5ecb9b2b5 Reduce volume of items dropped by turrets, and ratio of junk parts to ammo. 2013-07-14 14:31:09 -05:00
TireExaminer 82772439ba Fixes friendly monster movements. 2013-07-14 15:27:15 -04:00
Kevin Granade 16ae0f2ba0 Use player::takeoff() to handle shedding armor due to mutation. 2013-07-14 13:17:51 -05:00
Kevin Granade ad76ca8fea Auto-drop power-armor components if power armor is removed. 2013-07-14 13:17:20 -05:00
Kevin Granade 7ad9c75e7f Clear controlling_vehicle flag when dismounting a player from a vehicle. 2013-07-14 10:51:55 -05:00
somerandomlogin 4729e4ac69 Cleaning up. 2013-07-14 18:22:27 +04:00
somerandomlogin 441a6ee6ee Ovens and cupboards fixes. 2013-07-14 18:01:29 +04:00
utunnels 23a1d95d18 Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into wwfix 2013-07-14 10:58:59 +08:00
utunnels fb09d161e0 Fix % format string bug for @ menu info window. 2013-07-14 10:58:01 +08:00
Kevin Granade 0b4f01b5ee Disable monster spawn generation of non classic monsters in classic zombie mode. 2013-07-13 20:23:18 -05:00
Kevin Granade 4edd31d66c Make counterattacks a free action to avoid counter-locking the player. 2013-07-13 18:38:49 -05:00
cib be968a9dff Made salt more common. 2013-07-14 00:27:03 +02:00
Kevin Granade d7577cbae6 Prevent dynamic spawning creatures inside houses. 2013-07-13 17:05:57 -05:00
Christian Buskirk 44507e7a24 Merge PR#2034 - Examine crash fix 2013-07-13 13:56:58 -07:00
Christian Buskirk f399387738 Merge PR#1962 - No negative divergence 2013-07-13 13:48:50 -07:00
Christian Buskirk 39a2073959 Merge PR#2014 - FMJ cleanup 2013-07-13 13:24:22 -07:00
Christian Buskirk ff7d545aa3 Merge PR#2032 - new recipes 2013-07-13 13:03:53 -07:00
Christian Buskirk ac460114c5 Further merge fixes 2013-07-13 12:31:32 -07:00
Christian Buskirk e623d9285e Merge PR#1890 - Folding bicycles
Conflicts:
	data/raw/items/tools.json
	item_factory.cpp
	iuse.cpp
	iuse.h
2013-07-13 12:18:46 -07:00
somerandomlogin 0ddd311674 Bugfix: crash when listing items around the player 2013-07-13 22:49:45 +04:00
utunnels 020534ef18 Use only right alt key to input alt+number combinations. 2013-07-13 23:53:24 +08:00
utunnels 2a70cc6231 Merge branch 'wwfix' of github.com:utunnels/Cataclysm-DDA into wwfix 2013-07-13 23:51:20 +08:00
RexWolf163ru 27615c07b0 Some new crafting recipes. 2013-07-13 01:57:14 -05:00
Kevin Granade 6bb5133271 Rejigger towel effect to remove wet morale penalty instead of trying to counteract it. Spelling change. 2013-07-13 01:28:42 -05:00
Kevin Granade 755587c7ba Cleanup missing brackets and NPC skullsplosions (TM Nickboom). 2013-07-13 01:28:42 -05:00
Kevin Granade 6454dd6936 Merge towels, NPC vehicle interactions, cap smoke damage, and consumable accounting. 2013-07-13 01:26:12 -05:00
utunnels dd992ef821 Fix player info menu word wrapping. 2013-07-13 13:30:54 +08:00
Christian Buskirk 9ffd98c43b Merge PR#1833 - translation.h file addition 2013-07-12 21:57:32 -07:00
Kevin Granade b1289f2f0c Fix logic fail preventing removal of parts on mount points. 2013-07-12 22:12:54 -05:00
Kevin Granade a5d360858d Fix a typo. 2013-07-12 21:11:05 -05:00
Kevin Granade 6c2a0abc71 Move tire change operation to its own menu item. 2013-07-12 21:02:54 -05:00
cib 8d56d5fb94 Fix issue #2000
Only go into the new item use case for boots, not for any item that has an iuse.
2013-07-12 19:23:13 +02:00
cib be8e2a50dc Put a cap on the duration of smoke effect.
Losing the torso health bar 5x over fully because you spent a while in an underground cellar with fire, trying to wait for it to go out is ridiculous.
2013-07-12 15:39:02 +02:00
GalenEvil dd5a9aad31 Added missing iuse_function_list value for Towels so they can actually be used. 2013-07-11 21:07:47 -05:00
Kevin Granade 5cb0826632 Merge pull request #2015 from bxshi/fix_contributing_link_in_readme
change link of CONTRIBUTING.md to CleverRaven's repo
2013-07-11 16:56:10 -07:00
Kevin Granade 7a265293f9 Merge bionic menu simplification. 2013-07-11 18:55:23 -05:00
Costin Olteanu df871a1446 NPC checks path before attempting to leave vehicle 2013-07-11 10:22:37 +03:00
Christian Buskirk 44eaf8e4e9 Merge PR#2008 - Solar panel fix 2013-07-11 00:13:29 -07:00
Costin Olteanu f37a8d1feb NPCs no longer enter moving vehicles 2013-07-11 10:06:18 +03:00
Baoxu Shi ba33cf8704 change link of CONTRIBUTING.md to CleverRaven's repo 2013-07-11 14:01:44 +08:00
Kevin Granade d2978b2c19 Change ammo type identifiers to lower case. 2013-07-10 23:44:45 -05:00
Christian Buskirk 27b71c7703 Merge PR#2011 - Add skewers to food recipes 2013-07-10 20:29:56 -07:00
Christian Buskirk 1f4603ba26 Merge PR#2010 - Fix quest book materials 2013-07-10 20:29:12 -07:00
Kevin Granade f724c9da04 Remove some redundant FMJ variants, and make the descriptions clearer that FMJ isn't armor piercing. 2013-07-10 22:25:57 -05:00
Peter Lacey-Bordeaux e7b444debb fixed typo 2013-07-10 22:29:04 -04:00
Peter Lacey-Bordeaux fe37756898 fixed battery error 2013-07-10 22:15:12 -04:00
Peter Lacey-Bordeaux e64767b28c removed legacy bionics code 2013-07-10 22:08:06 -04:00
Kevin Granade 835e098b09 Add skewer to cooking recipes. 2013-07-10 21:04:33 -05:00
Kevin Granade 71b8df3f4b Fix incorrect material labels on quest targets. 2013-07-10 20:57:12 -05:00
Kevin Granade dc7ce68266 Remove redundant default argument assignment to make Clang happy. 2013-07-10 20:47:21 -05:00
Kevin Granade 8fe6aee088 Merge autopickup improvements. 2013-07-10 19:24:56 -05:00
Peter Lacey-Bordeaux 58e1a7dfc3 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-10 20:22:26 -04:00
Kevin Granade efb547710a Towel function, typo corrections, container JSONification, and MAC compile fixes. 2013-07-10 18:58:18 -05:00
Kevin Granade 9d30a62045 Base power production from solar panels on sunlight at the panel's location instead of the vehicle origin, and ignore vehicle roof. 2013-07-10 17:47:35 -05:00
cib 90c6469c19 JSONize container templates. 2013-07-10 21:40:38 +02:00
Joseph C af817c6b6a Gihub, the best site for all your gi needs 2013-07-10 14:23:03 -05:00
OzoneH3 f7171fe70d Autopickup rules are now case insensitive. 2013-07-10 11:48:55 +02:00
mattbrk eaf93728ff Merge branch 'osx' of https://github.com/mattkelr/Cataclysm-DDA into osx 2013-07-10 02:07:37 -04:00
mattbrk 346f78da6b edit 2013-07-10 02:05:36 -04:00
Matt Keller f0bd034cb2 Update COMPILING_osx.md 2013-07-10 01:59:29 -04:00
Matt Keller 34ba3160d2 Update COMPILING_osx.md 2013-07-10 01:56:14 -04:00
mattbrk 482f33f92b tighten up howto 2013-07-10 01:52:28 -04:00
Kevin Granade b716753531 Convert ammotype from an enum to a std::string to allow more values. 2013-07-09 22:47:29 -05:00
GalenEvil 1ee77c56fd ... and left off the c_str() on the messages. Fixed now. 2013-07-09 19:17:30 -05:00
GalenEvil 50cb9acbec typo in morale modifier name 2013-07-09 19:14:58 -05:00
GalenEvil 640571556c Added iuse function for absorbant materials, namely towels, so that the player can dry themself. Adds morale bonus for going from wet->dry 2013-07-09 19:12:44 -05:00
OzoneH3 0fa471a267 Added funktion to test all items against a rule and see the matching results. 2013-07-09 20:30:38 +02:00
Peter Lacey-Bordeaux c31d362b05 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-09 11:17:03 -04:00
OzoneH3 7c480131a3 Merge branch 'autopickup' of https://github.com/OzoneH3/Cataclysm-DDA into autopickup 2013-07-09 17:03:54 +02:00
OzoneH3 5d64700e69 Auto pickup with characterspecific rules. Advanced rules matching with * wildcard. 2013-07-09 17:03:21 +02:00
GalenEvil 8922640a45 Stupid additional typo... 2013-07-09 02:31:19 -05:00
GalenEvil ea27ba067f Fixed typos for floatation_vest armor id/name
Fixed typos for floatation_vest tag "FLOATATION" and references to it in game::vertical_move(...) and player::swim_speed(...)
2013-07-09 02:07:41 -05:00
mattbrk 510cdd5ec1 edit 2013-07-09 02:28:19 -04:00
mattbrk 8ce5a3a28a use -lSDL, -lSDL_ttf or frameworks for osx 2013-07-09 02:16:09 -04:00
GalenEvil 501cc69330 Signed SIGNOFF file 2013-07-08 23:43:20 -05:00
GalenEvil 280a27c422 Merge remote-tracking branch 'origin/pr/1979' 2013-07-08 22:34:51 -05:00
GlyphGryph 4e6bd58d2e Merge remote-tracking branch 'core/pr/1920'
Conflicts:
	data/raw/items/ammo.json
2013-07-08 22:37:01 -04:00
Kevin Granade 2f6895476c Merge code cleanups, performance enhancements, and pickles.
Conflicts:
	data/raw/item_groups.json
	data/raw/items/comestibles.json
2013-07-08 20:38:34 -05:00
Kevin Granade e2029587f0 Add floatation vest and associated logic. 2013-07-08 19:38:40 -05:00
OzoneH3 b6d8cd5978 Merge branch 'autopickup' of https://github.com/OzoneH3/Cataclysm-DDA into autopickup 2013-07-08 18:31:11 +02:00
OzoneH3 f76074b8bc Auto pickup preparations for characterspecific rules and options 2013-07-08 17:16:02 +02:00
Darth Servo 6d741ccb52 Directional Antenna fix 2013-07-08 10:55:54 -04:00
Peter Lacey-Bordeaux 94c06e68f2 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-08 08:48:56 -04:00
utunnels 5ad6920325 Minor fix to waddch to avoid extra erease_utf8_by_cw call. 2013-07-08 11:43:49 +08:00
utunnels ab2d34ea01 Try to reduce cursorx_to_position call for map window. Move cursor options after sdl window is created to prevent random segfaults. 2013-07-08 11:32:13 +08:00
RJ Costanzo a738de0474 Pickles 2013-07-07 21:35:46 -04:00
Zaweri Runewright 9cc2d5ccd6 Add new fmj rounds to item spawn lists. 2013-07-07 18:12:59 -05:00
Zaweri Runewright caaea1f0f2 Add gold as a crafting material and add it to ammunition crafting recipes. 2013-07-07 18:12:58 -05:00
Zaweri Runewright 8cf7fada84 Add FMJ versions of many ammunition types. 2013-07-07 18:12:58 -05:00
Kevin Granade a022c908bd Merge pull request #1967 from narc0tiq/osx-cross-detect
Compiling OSX doesn't automatically imply OSX tar.
2013-07-07 16:12:17 -07:00
Octav Sandulescu 85e5683d46 Compiling OSX doesn't automatically imply OSX tar.
Hopefully, detecting the underlying OS will help there.
2013-07-08 00:02:04 +01:00
Peter Lacey-Bordeaux dec0d7a7e2 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-07 16:12:04 -04:00
Kevin Granade e519a0fe77 Add entries for auto_pickup files to windows project files. 2013-07-07 15:06:48 -05:00
cib 811c412200 Removed game argument from player::add_disease 2013-07-07 21:59:46 +02:00
Kevin Granade 32c4ea9e54 Merge autopickup option menu. 2013-07-07 14:37:53 -05:00
Peter Lacey-Bordeaux a6ea4f7941 Merge remote-tracking branch 'myfork/master' into choose_adjacent 2013-07-07 15:22:00 -04:00
Peter Lacey-Bordeaux b19df88301 finished changing over getting direction inputs to choose_adjacent 2013-07-07 15:20:14 -04:00
Kevin Granade 186a5aa954 Remove unused variables. 2013-07-07 13:52:14 -05:00
Kevin Granade 9301114316 Merge a batch of small fixes. 2013-07-07 13:46:52 -05:00
Kevin Granade c0cfc62e10 Merge more i18n and disease identifier change. 2013-07-07 13:43:47 -05:00
Kevin Granade a15abe7185 Fix a typo in ranged.json. 2013-07-07 13:43:39 -05:00
Kevin Granade b802684082 Merge a pile of new items.
Conflicts:
	data/raw/recipes.json
2013-07-07 13:19:26 -05:00
Peter Lacey-Bordeaux 2bed854469 debugging direction changes 2013-07-07 13:55:10 -04:00
Peter Lacey-Bordeaux e60739392e Changed iuse and iexamine to use choose_adjacent 2013-07-07 13:25:41 -04:00
Kevin Granade 615feebe5f floor divergence contributed from skills and stats at 0, no negative divergence. 2013-07-07 11:31:48 -05:00
Peter Lacey-Bordeaux 4b29d396f3 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-07 11:37:39 -04:00
mattbrk d1889b2061 Merge branch 'osx' of https://github.com/mattbrk/Cataclysm-DDA into osx 2013-07-07 10:47:07 -04:00
mattbrk 0c51a373da remove unneeded osx var, tar -s for osx bindist
use command line/env variables for osx CXXFLAGS, LDFLAGS.
`make bindist' works for osx build:
`tar --transform' doesn't work on osx, use `tar -s' instead.
add all targets/obj dirs to 'clean' target
2013-07-07 10:45:46 -04:00
Matt K 7433e4f552 Update COMPILING_osx.md 2013-07-07 10:43:31 -04:00
Matt K 0f8e60b717 Update COMPILING_osx.md 2013-07-07 09:50:42 -04:00
mattbrk 892cdb6237 remove unneeded osx var, tar -s for osx bindist
use command line/env variables for osx CXXFLAGS, LDFLAGS.
`make bindist' works for osx build:
`tar --transform' doesn't work on osx, use `tar -s' instead.
2013-07-07 09:29:54 -04:00
Voker57 35fc6ddd90 Make glass jars more common 2013-07-07 13:49:00 +04:00
Voker57 a48dda91dc Buffed wood burning to compensate for field code changes 2013-07-07 13:47:31 +04:00
Voker57 f4f411937a Added woods soup 2013-07-07 13:47:10 +04:00
Voker57 1bdcda2a7c Added kompot 2013-07-07 13:46:49 +04:00
OzoneH3 13847fb6a0 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA into autopickup 2013-07-07 10:45:59 +02:00
RJ Costanzo 89ffbe1b8f Pipe shotgun+sawn version 2013-07-06 23:01:43 -04:00
Jonathan Frederick 5660c816e9 Fix spelling error in 'code_doc/GAME_BALANCE' 2013-07-06 18:50:10 -07:00
Vollch 0de109a437 Size check 2013-07-07 03:45:26 +04:00
Eric 5f4416c10a Monsters killed by bio_ods or quills/spines mutation drop corpses/loot 2013-07-06 16:26:03 -07:00
Kevin Granade 923db00ead Revert conditional setting of CXX and removal of CSSFLAGS from linker line. 2013-07-06 18:22:47 -05:00
Kevin Granade f8000e1438 Revert conditional assignment of LD, which is not working as expected. 2013-07-06 17:50:37 -05:00
Kevin Granade 472a993be6 New items, item name fix, clang build fix and sweep attack fix. 2013-07-06 17:42:00 -05:00
RJ Costanzo 4a111367d8 Nail rifle 2013-07-06 18:35:49 -04:00
Vollch 75cb306055 A bit cleaner and name fix 2013-07-07 01:17:29 +04:00
Kevin Granade ab10751ee6 Add folding bicycle and associated logic. 2013-07-06 15:28:01 -05:00
Kevin Granade 41426c2c99 Add vehicle tags field to hold vehicle metadata. 2013-07-06 15:22:03 -05:00
Kevin Granade 710c77fcb6 Cleanup veh_interact::cant_do() and fix tire change requirement checking. 2013-07-06 15:22:03 -05:00
Kevin Granade aaf4af0d8a Remove game *g parameter from palyer::i_rem(). 2013-07-06 15:15:57 -05:00
RJ Costanzo 1e410d8de1 Useful stuff final hopefully 2013-07-06 13:46:35 -04:00
Vollch 76642f5e89 Boot knife 2013-07-06 21:16:34 +04:00
cib fa893b308f Removed non-existing file from windows code::blocks project. 2013-07-06 17:44:43 +02:00
Eric 55c06c8802 Monsters killed by wide attacks drop corpses/loot 2013-07-06 08:34:58 -07:00
cib 8ef9408864 Merge remote-tracking branch 'main/master' into disease_as_string 2013-07-06 17:14:42 +02:00
OzoneH3 d27a45675d Remove Codeblocks file 2013-07-06 16:32:47 +02:00
OzoneH3 ca2f4f52bd Missing Files .. 2013-07-06 16:28:04 +02:00
OzoneH3 895ac666bd Added Auto Pickup Rules Manager in help menu ?3
Fixed an itemcompare Bug.
2013-07-06 16:26:42 +02:00
cib bf73d905c4 Converted disease identifiers from enum to string. 2013-07-06 15:21:58 +02:00
Tommy a59d6883ca Fix minor spacing issue and convert a couple missed strings. 2013-07-06 23:20:25 +12:00
cib b6bd2f3ea7 Make cataclysm compile in clang.
1. clang didn't like `point look_debug(point point=point(-256,-256));`
2. CXX is now set with ?= so if you have CXX=clang++ set in your environment, it won't be overriden.
3. Even though $(LD) was used to compile the cataclysm executable, it was passed arguments that only gcc and not ld accepts. Thus changed it from $(LD) to $(CXX)
2013-07-06 13:16:50 +02:00
cib a8c83640c4 item.name is now initialized from itype in constructor 2013-07-06 12:50:29 +02:00
Tommy 5f5a5c82a0 Update lang/po/cataclysm-dda.pot. 2013-07-06 18:05:50 +12:00
Tommy 2c5685be49 Finish i18n for newcharacter.cpp. 2013-07-06 18:04:24 +12:00
Tommy 71d8814b4a newcharacter.cpp: description tab i18n. 2013-07-06 17:52:31 +12:00
Tommy a416764149 newcharacter.cpp: skills tab i18n. 2013-07-06 17:28:56 +12:00
Tommy 6968084578 Remove unnecessary \n's from data/raw/skills.json. 2013-07-06 17:28:36 +12:00
Tommy 3ce1b2009a newcharacter.cpp: professions tab i18n. 2013-07-06 17:21:36 +12:00
Tommy 0543803a10 Remove unnecesary \n's from data/raw/professions.json. 2013-07-06 17:21:01 +12:00
Tommy 43e7c09cba newcharacter.cpp: traits tab i18n. 2013-07-06 17:12:17 +12:00
Tommy 0394870246 Getextify traits and mutations. 2013-07-06 17:03:26 +12:00
Tommy 180faffc65 newcharacter.cpp: stats tab i18n. 2013-07-06 16:42:59 +12:00
Tommy f925d544c5 Add skills, professions and bionics to lang/extract_json_strings.py. 2013-07-06 16:22:43 +12:00
Tommy 6814c82b4a utf8_width(): Try to continue parsing even when unknown character is found. 2013-07-06 14:54:47 +12:00
Tommy bad2f57b94 Fix utf8_getch incorrectly identifying some obscure characters as overlong. 2013-07-06 14:53:41 +12:00
Kevin Granade 13b3711822 Fix auto_pickup typo. 2013-07-05 21:42:04 -05:00
Kevin Granade 5286878d8a Merge autopickup, bionic cleanup, sludge crawler, new professions, fix monster group decay, and limit teleportation distance.
Conflicts:
	mapdata.h
2013-07-05 21:36:51 -05:00
Kevin Granade c43bfe41fd Merge removal of map::itypes. 2013-07-05 18:23:03 -05:00
Darth Servo 546a8a4a13 Recipes for Plastic and Steel Jerrycans 2013-07-05 15:17:39 -04:00
Eric 8565b77409 Woops, forgot to cancel the tunnel. Also, add different error message. 2013-07-05 11:57:48 -07:00
Eric d84bccd7aa Limit max probability travel distance 2013-07-05 11:49:04 -07:00
Octav Sandulescu 3625b660e4 Remove unused map.itypes; use g->itypes where needed.
It was only two places.
2013-07-05 19:21:20 +01:00
OzoneH3 7a37eb14e5 Merge pull request #1927 from yobbobanana/german
Add raw translation file for de_DE.
2013-07-05 11:00:34 -07:00
Tommy 58a1c6d486 Add raw translation file for de_DE. 2013-07-06 04:28:58 +12:00
Kevin Granade 75b5e97d7b Merge pull request #1897 from GlyphGryph/remove_fourth
Removed 4th of July profession.  Bit late, maybe no one will notice.
2013-07-05 08:31:56 -07:00
Fergus Dall c6499013f1 Make mongroups die propperly, even if the queen dies at a distance 2013-07-05 15:02:58 +09:30
Fergus Dall d50a0a3a8b Save/load monster group dying status properly 2013-07-05 15:02:57 +09:30
Fergus Dall f48fff8f42 Add triffid hearts and fungal spires to the appropriate monster groups 2013-07-05 15:02:48 +09:30
utunnels e2dab3aaaf Bind textdomain with UTF-8. 2013-07-05 11:47:45 +08:00
Kevin Granade 8c464145e7 Convert ammo_effects field to a tags set instead of a binary flag field. 2013-07-04 18:46:15 -05:00
Kevin Granade 829275266e Add tags_from_json() method to load a list of strings into a set. 2013-07-04 18:46:15 -05:00
Kevin Granade 3a1b75af35 Move final few ammo definitions to JSON. 2013-07-04 18:46:15 -05:00
GlyphGryph f360bb1195 Removed the speed penalty from the sludge field until the sludge crawler can ignore it. 2013-07-04 18:42:52 -04:00
GlyphGryph 3d48f8b209 Moved field definitions to their own header file. 2013-07-04 18:27:47 -04:00
GlyphGryph 78db4ecb9c Included logic for reducing moves based on fields.
Unfortunately, this logic leads to some making it extremely dfficult to track move penalty exclusions, so the sludge crawler currently slows himself to a standstill with his slime.
2013-07-04 18:06:15 -04:00
NicholasDV 7d11865807 Fix of syntax error in recipes.json
Closes #1911

First aid kit had a small syntax error in the form of a comma at
a place where a comma should not be. This fixes it.
2013-07-04 17:47:35 -04:00
Peter Lacey-Bordeaux 26a04f918f Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA 2013-07-04 16:59:43 -04:00
Peter Lacey-Bordeaux ba03815a81 moved +powerlvl outside of the for loop 2013-07-04 16:46:28 -04:00
Peter Lacey-Bordeaux 23d459606b fixed small bug with water extractor 2013-07-04 16:35:39 -04:00
Peter Lacey-Bordeaux 63ace3b7f6 simplified both of the bionics that handle water, now uses g->handle_liquid 2013-07-04 16:33:23 -04:00
OzoneH3 a05431eeab Auto Pickup all items with 0 Volume and Weight 2013-07-04 21:55:57 +02:00
Kevin Granade fbcd715536 Merge first aid recipe, opsolete code cleanup, monster property fixes, armor menu reformat, utf8 handling fixes, building positioning fix, and furniture handling fix. 2013-07-04 14:45:34 -05:00
GlyphGryph 98c812aae8 Added basic sludge crawler monster
Monster exists, drops fields appropriately, fields do nothing at the moment
2013-07-04 14:48:48 -04:00
Christian Buskirk 6f4e4a9332 Fix FEMA tents 2013-07-04 11:41:03 -07:00
Christian Buskirk 71333c8f9c Fix tents not counting as indoors 2013-07-04 11:40:56 -07:00
Vollch 9bc2402b22 Correct placement of big buildings 2013-07-04 20:58:50 +04:00
OzoneH3 2a6821ff56 Merge branch 'autopickup' of https://github.com/OzoneH3/Cataclysm-DDA into autopickup 2013-07-04 18:30:20 +02:00
utunnels 7f91455cf5 Merge branch 'patch-1' of github.com:utunnels/Cataclysm-DDA into test 2013-07-04 23:56:07 +08:00
utunnels ca2c33abbf Merge branch 'alt-code' of github.com:utunnels/Cataclysm-DDA into test 2013-07-04 23:53:48 +08:00
utunnels 68f25feb5f Misc fixes. 2013-07-04 23:44:49 +08:00
OzoneH3 4c7713ad20 Autopickup 0 Volume Items 2013-07-04 17:18:45 +02:00
utunnels eaf15056cf Misc fixes. New utf_substr function to cut utf8 string. Rewrite many scattered string wrapping code using functions from output.cpp. 2013-07-04 23:14:23 +08:00
OzoneH3 8281db69c4 Small Inventory menu display enahncement. 2013-07-04 12:28:12 +02:00
OzoneH3 12d061aaa1 Reworked sort_armor (+) page to fit on 80x25 and centered it. 2013-07-04 11:56:52 +02:00
cib 155b363140 Removed the mapitems global and all references to it.
This global has been superceded by data/raw/item_groups.json
2013-07-04 10:05:40 +02:00
NicholasDV fdee5ee937 Merge branch 'master' into smallFixes 2013-07-04 01:09:41 -04:00
GlyphGryph ad6b1aea7e Removed 4th of July profession 2013-07-04 00:39:05 -04:00
utunnels 6982c8eeb7 Terminus!
Since sdlcurse changes its font scanning order, fixedsys should be renamed to fixedsysTTF because there are system fonts called Fixedsys as well. Besides wincurse uses data/termfont as the default font, SDL can just use the same one to avoid troubles.
2013-07-04 12:33:38 +08:00
Christian Buskirk 5a7ec3edb1 Merge 4th of July Effects 2013-07-03 21:26:18 -07:00
NicholasDV 4b67092933 Fixes a few flag issues on monsters
Closes #1878
Closes #1879

Specifically deals with 1878 by making the moose aggressive to those that are
near it, and to those that harm it. Deals with 1879 by giving the jabberwock
the MF_POISON flag, so that when it is butchered it will give tainted flesh
rather than regular flesh.

Note: The fix to 1878 might need small balancing changes, and feel free to tell
me if it does so that I may fix it.
2013-07-04 00:15:56 -04:00
utunnels 8208cc6c3c Bug fix. 2013-07-04 11:50:27 +08:00
utunnels c1f2c34695 Simulate alt+number input for SDL version. 2013-07-04 11:17:07 +08:00
Kevin Granade 02e4099bb5 Merge too many fixes to name. 2013-07-03 21:40:56 -05:00
cib 1ca7f2a6c8 Generated item_groups.json weights based on item rarities. 2013-07-04 02:22:59 +02:00
utunnels 380b52643f Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into utf8 2013-07-04 08:18:37 +08:00
cib 3725fbc9e0 Completely converted over all item spawns to item_groups.json
This includes:
- Map spawn functions
- NPC random gear
- Monster clothing drops

Furthermore this commit includes:
- Replaced all mi_ enum instances with strings
- Added a helper function to check if an item is in a group
- Removed the mi_ enum itself
- Emptied mapitemsdef.cpp (will remove later)
2013-07-04 00:26:01 +02:00
Vollch 4dfd730eb2 Fixes #1884 2013-07-04 01:03:00 +04:00
GlyphGryph 40f73f671b Fixed accidently changing the chain smoker profession. 2013-07-03 16:38:56 -04:00
cib 9763d53e5f Monster drops now use item_groups.json
This requires several changes:
- monitemsdef.cpp to use strings for item groups instead of mi_foobar
- the spawn code in monster.cpp to use the new item_controller->id_from random item selection function instead of manually selecting an item
2013-07-03 22:22:27 +02:00
cib 7b7c95eedc Ported all the item groups from mapitemsdef.cpp to item_groups.json
Script used for conversion.
2013-07-03 22:17:43 +02:00
Voker57 ecae49a0c2 Restored burning wood yield buff, lost in merge 2013-07-04 00:15:19 +04:00
Darth Servo 4f66ede64a Recipe for First Aid 2013-07-03 14:51:15 -04:00
Voker57 f54ad1a0f5 150% more heat from fires
Because standing close to a raging fire at 18C shouldn't leave you chilly
2013-07-03 22:08:01 +04:00
Christian Buskirk f38fdeed58 Merge PR #1866 - Further recipe fixes
Conflicts:
	data/raw/recipes.json
2013-07-03 10:50:10 -07:00
Christian Buskirk 51c27dadbf Merge PR #1875 - Small Fixes 2013-07-03 10:31:44 -07:00
utunnels aabbec53b7 Filter out '\0' for wincurse, because unprintable characters causes deadly slowdown. 2013-07-03 23:51:49 +08:00
utunnels dc396fe954 Fix curses and cursesport conflict. 2013-07-03 23:28:19 +08:00
utunnels 7ba00561e8 Add missing cursesport.cpp. Remove unused headers in sdlcurse.cpp. 2013-07-03 21:28:19 +08:00
Tommy dec2dc7bf0 Tweak the curses header. 2013-07-03 23:10:21 +12:00
NicholasDV 46be778aee Added primitive_hammer as a possible tool for certain recipes
Recipes altered: stone hammer, brazier, metal tank, crowbar. Each of these
were capable of being built already by a regular 'hammer' object or by a
'rock'. As a result, the rock hammer (primitive_hammer) is completely reasonable
to be a possible tool as well.
2013-07-03 03:38:46 -04:00
utunnels eb8e823b66 Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into utf8 2013-07-03 15:22:50 +08:00
NicholasDV dbf295d0e2 Small fix to last commit
Specifically, forgot a few commas that led to syntax errors. My fault,
but fixed up in this small commit.
2013-07-03 03:06:31 -04:00
utunnels 64bf5e2306 GDI version can now print utf8 characters normally. 2013-07-03 14:54:22 +08:00
utunnels 12128cc347 Move shared code in wincurse.cpp and sdlcurse.cpp to cursesport.cpp. Let SDL version use same font file as GDI version. 2013-07-03 14:51:03 +08:00
NicholasDV c5132d553f Allows the Integrated Toolset to be used in a few newer crafting recipes
Fixes #1734

Specifically, adds it as an available tool in the chainsaw recipe, as well
as the three crossbow recipes to replace common tools.
2013-07-03 02:18:57 -04:00
NicholasDV d1d96ef1d0 Small correction to 'Survival' skill description
Closes #1751

Specifically removes the line about being able to 'clean' tainted meat
when you have a high survival skill, due to the fact that this is not
true. Easier (and frankly, makes more sense) to correct that small
detail than it is to add in a system of cleaning the tainted meat due
to it. If anyone does so, feel free to re-add the line, as it is only
a tiny change.
2013-07-03 01:55:26 -04:00
NicholasDV 26565dbef6 Small spelling error fixes
Closes #1853 by changing all instances of, "oepn_sarcophogus" with "open_sarcophogus",
thereby fixing the typo.
2013-07-03 01:45:08 -04:00
GlyphGryph 3f13bd6bc1 Added wine, a new shirt, and the patriot profession. The last bit should be removed after the 4th of July has passed, the wine can stay. 2013-07-03 00:30:31 -04:00
Kevin Granade 3d931cd9ab Merge pull request #1862 from yobbobanana/po_files_2
Commit raw translation files for fr_FR, ru_RU, zh_CN, pt_PT.
2013-07-02 21:01:20 -07:00
mattbrk 3c1251c366 edit 2013-07-02 23:06:00 -04:00
mattbrk 1b5d082db5 edit 2013-07-02 23:03:27 -04:00
mattbrk 001849272f edit 2013-07-02 23:02:48 -04:00
mattbrk 7d0983c839 edit 2013-07-02 22:59:16 -04:00
mattbrk 89d2f9893c learnin' markdown... 2013-07-02 22:53:28 -04:00
mattbrk 66a61e239f edit 2013-07-02 22:41:39 -04:00
mattbrk 51b7cef821 edit 2013-07-02 22:24:58 -04:00
mattbrk 07bd0879e9 edit 2013-07-02 22:23:39 -04:00
mattbrk 1b23bde3af edit 2013-07-02 22:21:26 -04:00
mattbrk 419db6875c edit 2013-07-02 22:15:09 -04:00
mattbrk db2c8526f6 edit 2013-07-02 22:03:19 -04:00
mattbrk 86f6857dd0 edit 2013-07-02 21:59:16 -04:00
mattbrk a397e1ea4a handle osx/sdl/libs 2013-07-02 21:46:04 -04:00
mattbrk 9a61b00dc1 edit howto 2013-07-02 21:44:14 -04:00
mattbrk ae64a3f61f rename 2013-07-02 21:42:22 -04:00
Vollch 468b3db3b7 Fixes #1864 2013-07-03 01:49:38 +04:00
Vollch 115252a149 Underground fix 2013-07-03 01:04:34 +04:00
Vollch d3e965ef1a Reworked road placement 2013-07-02 22:24:58 +04:00
Darth Servo 9fe6feb52f Edited recipes requiring hammers to be consistent. 2013-07-02 11:14:49 -04:00
utunnels 9b058378bf Bug fix. 2013-07-02 22:10:43 +08:00
utunnels 5e85552377 Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into utf8
Conflicts:
	output.cpp
2013-07-02 20:59:24 +08:00
Tommy a89185e056 Commit raw translation files for fr_FR, ru_RU, zh_CN, pt_PT.
Now with less FAIL.
2013-07-02 18:56:37 +12:00
Kevin Granade 4445f7f06f Merge a SDL OSX target and font size adjustment. 2013-07-01 20:02:14 -05:00
Kevin Granade f6bafa573b Merge some unification to text wrapping. 2013-07-01 19:32:13 -05:00
Kevin Granade 0c66a3db76 Merge more gettext annotation, soldering charge fix, phup/pgdown support for menus, URL fix, gibbing fix, and drawing fix. 2013-07-01 19:11:04 -05:00
Oddbjørn Olsen 98a51dfaab Made items draw infront of blood splatter
Fixes issue #1844.

The bug was introduced in f176e82253.
2013-07-02 02:01:49 +02:00
Kevin Granade b9220e7d8b Fixup get_combat_style() to no longer pass a game reference. 2013-07-01 18:46:15 -05:00
Goron 2c6ec43e1f remember combat style after cjaracter creation 2013-07-01 18:29:30 -05:00
Goron 3b21826b6a TODO comment to refactor handling of styles 2013-07-01 18:29:30 -05:00
Goron 317ba1c34c remove_weapon uses selected combat style 2013-07-01 18:29:30 -05:00
Goron 95808abc28 Use selected comat style when bio_claws are deactivated and processing active items 2013-07-01 18:29:30 -05:00
Goron 520b90e371 Let i_rem use selected combat style
this catches most cases of freeing hands
2013-07-01 18:29:30 -05:00
Goron b0c5eefee0 Use selected combat style after eating your weapon 2013-07-01 18:29:29 -05:00
Kevin Granade c915ec3af6 Use selected combat style after wearing or throwing your weapon
Conflicts:

	player.cpp
2013-07-01 18:29:20 -05:00
Kevin Granade dd3ea43ee3 Make g a global. 2013-07-01 18:21:10 -05:00
TireExaminer 5a667408f4 Fixed giblet spawning.
Monsters would gib only in respect to the x axis due to a typo.
2013-07-01 17:43:12 -04:00
lethosor be320a8540 Fix link to issue tracker 2013-07-01 11:48:25 -04:00
fnord 76c7519e11 uimenu: page up / page down support for large scrolling lists 2013-07-01 10:09:23 -05:00
Tommy adccca67f9 Gettextify main interface and inventory. 2013-07-02 00:10:56 +12:00
Tommy 470d948fe5 Add some missing full-stops and make some spacing more consistent. 2013-07-01 20:34:04 +12:00
Vollch 0755f6f8b3 Soldering iron fix 2013-07-01 12:29:02 +04:00
Tommy 36347ba62b Reindent dis_name() because i touched all of it. 2013-07-01 19:48:46 +12:00
Tommy 4577cceb9e Make disease descriptions much easier to translate. 2013-07-01 19:48:35 +12:00
Tommy 2f10f7907a Change dis_description() to 4-space indent because i touched most of it. 2013-07-01 18:54:40 +12:00
Tommy eee9970065 disease.cpp: Remove indent on some multiline strings. 2013-07-01 18:41:43 +12:00
Tommy d19c6cf1ab Add missing break statement to case DI_BOULDERING in dis_msg(). 2013-07-01 18:37:59 +12:00
Tommy 5cbe278548 Change dis_msg to 4-space indent because i touched so much of it anyway. 2013-07-01 18:37:04 +12:00
Tommy f44cd9e3d9 Gettextify the rest of disease.cpp. 2013-07-01 18:31:19 +12:00
utunnels 5232c34161 Merge branch 'utf8' of github.com:utunnels/Cataclysm-DDA into utf8
Conflicts:
	crafting.cpp
2013-07-01 12:51:08 +08:00
utunnels 0ed81e758a Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into utf8
Conflicts:
	output.cpp
2013-07-01 12:46:27 +08:00
mattbrk 83da2d8b1d SDL.h 2013-07-01 00:41:15 -04:00
mattbrk 3fbb690d76 edit readme 2013-07-01 00:13:46 -04:00
Tommy 158950e71d Gettextify most of disease.cpp. 2013-07-01 15:28:26 +12:00
utunnels c5b3f9e1ec Font size hack for bitmap fonts (.fon). Also make the font list shorter. 2013-07-01 10:57:10 +08:00
Kevin Granade 150d916981 Merge fire fixes. 2013-06-30 21:40:39 -05:00
TireExaminer 86db34bdf9 Webs burn away. 2013-06-30 22:38:54 -04:00
TireExaminer 51b8b40b68 More Fire Fixes 2013-06-30 22:28:51 -04:00
TireExaminer f27390f53a Gasoline adds to fires. 2013-06-30 20:02:22 -04:00
TireExaminer 1fc7546e96 Fixes Gasoline exploding and Furniture Burning 2013-06-30 20:00:15 -04:00
Kevin Granade 7d91d4f358 Merge furniture updates. 2013-06-30 15:39:19 -05:00
David Holmes 248f8a64f7 Allow deconstruction of refrigerators
...because when you think about it, smashing a refrigerator with the
screwdriver in your hand is not the most sensible way of getting a rubber
tube out of it.

Also enabled deconstruction of glass door refrigerators, in which case you
also get a pane of glass for your effort.
2013-06-30 20:06:33 +01:00
Kevin Granade a9512b5b4c Remove unused includes that might break windows builds. 2013-06-30 12:17:37 -05:00
Kevin Granade 1fcae4b4ef Switch to posix test for whether a path is a directory. 2013-06-30 12:07:18 -05:00
Vollch e6b98ee733 Limited fuel in gas pumps 2013-06-30 20:58:38 +04:00
Kevin Granade f459dabf9d Merge permissions fix, font handling, more i18n, and a vehicle fix. 2013-06-30 11:30:09 -05:00
utunnels a49b02060c Fix crafting menu position under utf8. 2013-06-30 23:00:14 +08:00
utunnels 8d667baf3c Bug fix. 2013-06-30 22:37:43 +08:00
Kevin Granade ad8fdd4819 Merge pull request #1843 from narc0tiq/osx-cross-jenkins
LDFLAGS, not CXXFLAGS
2013-06-30 06:55:01 -07:00
Octav Sandulescu 434ea30026 LDFLAGS, not CXXFLAGS 2013-06-30 14:53:11 +01:00
Kevin Granade 81ce7c6e9a Merge pull request #1842 from narc0tiq/osx-cross-jenkins
Change minimum OSX to 10.5 and add libintl to the Mac builds
2013-06-30 06:47:38 -07:00
Octav Sandulescu b4871d49d7 Change minimum OSX to 10.5 and add libintl to the Mac builds
This is what was necessary to get Cataclysm cross-compiling to OSX in my build environment.
2013-06-30 14:46:07 +01:00
Tommy 17e2380abf Don't let the player drive a vehicle if they won't be carried with it. 2013-07-01 01:29:45 +12:00
Tommy 5749a320bd Someone has been mixing line endings >:(. 2013-07-01 01:27:52 +12:00
Goron 0ecdc3891a added fold_and_print to reduce dublicated code 2013-06-30 15:00:07 +02:00
utunnels 5868686f9d Cache font list in data/fontlist.txt, delete it to rescan all font directories. 2013-06-30 20:09:26 +08:00
Tommy 3108e44fe0 Change en_UK to en_NZ in TRANSLATING.md, and add '-p' to the mkdir line. 2013-06-30 23:57:02 +12:00
Tommy aa50085573 Allow translating of JSON item names and descriptions. 2013-06-30 23:02:58 +12:00
utunnels 959f10e80b Add font blending option for data/FONTDATA 2013-06-30 17:06:30 +08:00
utunnels 4b30f55a72 Scan system font folder first before check font file names. 2013-06-30 16:34:49 +08:00
Tommy 4f0bf666cd Fix some file permissions (775 -> 664). 2013-06-30 20:00:31 +12:00
Kevin Granade 2f9e8e5c52 Work around Cygwin's lack of gettext support in glibc. 2013-06-30 00:28:06 -05:00
Kevin Granade a7f543d60a Merge the rest of new character invlet cleanup. 2013-06-29 22:47:11 -05:00
Kevin Granade f382badf7d Merge pull request #1835 from FunnyMan3595/win_load_gettext
Moved the -l flags for gettext on Windows to a better position.
2013-06-29 19:10:32 -07:00
Charlie Nolan (FunnyMan3595) a2993e3cd8 Moved the -l flags for gettext on Windows to a better position.
... and this should fix the OTHER build.
2013-06-29 20:57:54 -05:00
Kevin Granade da04c902e7 Merge pull request #1834 from FunnyMan3595/win_load_gettext
Added gettext -l flags for Windows builds.
2013-06-29 18:36:30 -07:00
Charlie Nolan (FunnyMan3595) 4059e16396 Added gettext -l flags for Windows builds. 2013-06-29 20:34:28 -05:00
Kevin Granade a47a920a02 Add new translations.h header to windows project files. 2013-06-29 20:17:47 -05:00
Kevin Granade 8600085be3 Merge new character invlet assignment fix, magic number removal, and a start at gettext support. 2013-06-29 19:52:13 -05:00
Kevin Granade aec5108fe9 Merge multi-field per tile support.
Conflicts:
	field.cpp
	game.cpp
	inventory.cpp
	mapdata.h
	npc.cpp
2013-06-29 19:28:54 -05:00
Charlie Nolan (FunnyMan3595) 930b4cf3a3 Merged PRs together (no new ones).
Conflicts:
	newcharacter.cpp
2013-06-29 17:56:38 -05:00
Charlie Nolan (FunnyMan3595) 84b9f4411f Merge PRs #1830 and #1832 2013-06-29 17:45:39 -05:00
Goron cc8006a2b0 replace magic numbers 80, 25 and related with FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT 2013-06-29 23:39:34 +02:00
Tommy 5eb8e1ab41 oops 2013-06-30 08:28:45 +12:00
TireExaminer c909a0f713 Fixes NPC Morale Penalty 2013-06-29 14:53:46 -04:00
Tommy 377bac95d8 Gettext support!
For starters, the main menu is now translatable.

More strings may be made translatable by including "translations.h",
then surrounding strings to translate with _().
For example: add_msg("my message") becomes add_msg(_("my message")).

Instructions for translating, and maintaining translation files,
can be found in TRANSLATING.md.
2013-06-30 06:49:54 +12:00
Goron 8a17c9a0d3 Fix allignment of list_items output 2013-06-29 20:48:03 +02:00
Oddbjørn Olsen e6c3168956 Made advanced inventory sort items
Adresses issue #1826.
2013-06-29 20:43:38 +02:00
Oddbjørn Olsen 39292d183d Made player::create armor equip more robust
Now, the player's profession might give him 10 pairs of pants, but he
can't wear them all at character creation.
2013-06-29 20:25:32 +02:00
Oddbjørn Olsen 1099f6b527 Added non-interactive mode to player::wear
Now, we can use player::wear to "force" the player to wear stuff without
alerting him. Will be useful during character creation.
2013-06-29 20:11:55 +02:00
Oddbjørn Olsen 73a86971ac Converted player::wear to Allman style
Just making it easier for me to modify.
2013-06-29 19:49:23 +02:00
Oddbjørn Olsen 79debd29db Converted player::wear_item to Allman style
For future commits.
2013-06-29 19:44:16 +02:00
Goron ac3a92c219 Added newline befor style technique in itme::info 2013-06-29 19:29:46 +02:00
Goron 3bf8fda4df Removed leading space from item::info
leading space will be broken on line wrap, so lets output handle the placement
of the text
2013-06-29 19:29:46 +02:00
Goron 0086715750 Removed word_rewrap as it is not used anymore 2013-06-29 19:29:46 +02:00
Goron 8bba59aa72 remove word_rewrap from bio itypedef
is the only itypedef that used word_rewrap. Word_wrapping is done when
we know the width
2013-06-29 19:29:46 +02:00
Goron 8cabe87199 full_screen_popup and popup uses foldstring to wordwrap long lines
moved foldsring from ui.cpp to output.cpp
removed word_rewrap from item::info as we don't know the width and have to rewrap again
2013-06-29 19:29:24 +02:00
Kevin Granade 5604434130 Merge variable morale decay, probabilistic teleport fix, use ncursesw, and mapgen fixes. 2013-06-29 11:42:19 -05:00
Charlie Nolan (FunnyMan3595) 66d42195a9 Merge PR #1826 2013-06-29 10:55:41 -05:00
utunnels 4d55dc6fe0 More fix to half utf8 character. 2013-06-29 23:50:03 +08:00
Oddbjørn Olsen 69d48fe953 Corrected faulty invlet assignment in startup
There were some collisions between items in inv and items in worn. I
fixed this by prepopulating inv with every single item from character
creation, and then moving them to worn AFTER all the invlets had been
assigned by inv.
2013-06-29 17:48:24 +02:00
Vollch 10421d4fdc Fix broken parts of mapgen 2013-06-29 18:59:04 +04:00
Tommy 4d99cc7d20 Preliminary Linux unicode support? 2013-06-30 01:44:36 +12:00
Eric b38be2e57f Fix probability travel ending in tile with monster, fix typo in coords 2013-06-29 00:03:31 -07:00
Charlie Nolan (FunnyMan3595) 112e7a7239 Merge PR #1805 2013-06-28 23:31:40 -05:00
TireExaminer 6544b1911e Comments and monster field changes
If a field spawns ontop of you you will now be hit by it immediately.
Also commented things.
2013-06-29 00:25:40 -04:00
Vollch 195350b8af Added comments to quadrants house generator 2013-06-29 07:48:54 +04:00
Charlie Nolan (FunnyMan3595) 0a22d34b4b Merge PR #1816 2013-06-28 20:10:23 -05:00
TireExaminer be52063100 Fixed some weird spreading behavior with smoke and fire.
Smoke now lasts longer and generates faster indoors, but small fires are
much less likely to destroy a building (density 1 fires). Fire will last
a more reasonable length of time.
2013-06-28 20:54:54 -04:00
NaturesWitness 6ef1e6d68d Pistol Crossbow Recipe Skill Fix
Changed pistol crossbow recipe to use archery as secondary skill.
Didn't seem to make much sense that it required firearms skill and all
other bows required archery skill. Even if it's called a pistol crossbow
it's still a crossbow, not a pistol.   Unless there's some other reason
I'm not seeing in which case disregard this pull request.
2013-06-28 20:26:26 -04:00
Charlie Nolan (FunnyMan3595) 2d1c67cbd5 Merge PR #1813. 2013-06-28 15:04:14 -05:00
Peter Lacey-Bordeaux 9a74914720 updated how to start a new world with the option on the main menu. 2013-06-28 14:51:32 -04:00
Charlie Nolan (FunnyMan3595) be6de66c8a Merged PRs #1810, #1806, #1804, #1799, #1766. 2013-06-28 12:38:31 -05:00
TireExaminer 82f39cb588 Refactored fields to support any # of fields.
The field class is now a wrapper that contains a vector of any number of
fields at once. So now you can choke on smoke, burn in fire, and melt in
acid all at the same time. Fields now propagate additively... so if
something is spewing smoke instead of overwriting the old smoke, it adds
to its density.
2013-06-28 13:33:39 -04:00
Oddbjørn Olsen a6c5fb497e Made morale items load correctly 2013-06-28 17:28:24 +02:00
utunnels 79157104e0 Merge branch 'master' of github.com:CleverRaven/Cataclysm-DDA into utf8 2013-06-28 23:18:41 +08:00
utunnels 4fcd90bb37 Revert two unrelated test changes. 2013-06-28 23:15:13 +08:00
utunnels 670135cf86 Fix font y/n window size. 2013-06-28 21:30:31 +08:00
utunnels 26e650d0ab Reuse word_rewrap in compare_split_screen_popup. 2013-06-28 20:58:21 +08:00
Oddbjørn Olsen 142f42c903 Made bionics manifest show correctly 2013-06-28 14:13:51 +02:00
Vollch 3c31a662de Some fixes and improvements to quadrants house generator 2013-06-28 15:12:12 +04:00
Oddbjørn Olsen 2e69cf70bd mp3 player won't be audible if we're deaf. 2013-06-28 12:03:03 +02:00
utunnels 1e204fb105 Update draw_tab to support utf8 string width. 2013-06-28 15:42:44 +08:00
utunnels e6e9feb586 Fix a bug that '\0' is ignored while copying utf8 lines. 2013-06-28 15:22:02 +08:00
mattbrk a4f2cb4972 add cataclysm-tiles to .gitignore 2013-06-28 01:44:39 -04:00
mattbrk 84767fb60c add files for os x/sdl build 2013-06-28 01:42:33 -04:00
mattbrk 695fc87f55 how to build on os x with sdl/sdl_ttf frameworks 2013-06-28 01:41:11 -04:00
mattbrk f1632bd090 update for macosx and tiles with sdl frameworks 2013-06-28 01:37:37 -04:00
mattbrk df837f15d8 update for macosx and tiles with sdl frameworks 2013-06-28 01:36:54 -04:00
mattbrk f01a835d47 update for macosx and tiles with sdl frameworks 2013-06-28 01:36:02 -04:00
Vollch e649f43dd5 Fixes #1798 2013-06-28 06:20:42 +04:00
Kevin Granade d1d6525bbf Merged seperate furniture layer, vehicle caching and interaction fixes, and extension to fire duration. 2013-06-27 18:43:23 -05:00
Charlie Nolan (FunnyMan3595) 570d0b6f72 Beginning to read now reinforces any existing reading morale.
Closes #1198
2013-06-27 16:15:04 -05:00
Peter Lacey-Bordeaux c6cb0b4930 changed add_item in veh_interact so it does not ignore weight/volume checks, overflow radius of 1 atm 2013-06-27 17:04:24 -04:00
Charlie Nolan (FunnyMan3595) 4a0964bd91 Fixed focus gain display when negative. 2013-06-27 15:55:13 -05:00
Charlie Nolan (FunnyMan3595) a9bf334674 Applied custom mood durations and decays.
They've all been looked at now, but a fair number were left at the
default.
2013-06-27 15:44:50 -05:00
Charlie Nolan (FunnyMan3595) 21e377356c Moved item_type to the end of add_morale's prameters.
Also corrected the "new entry" case to include the full moodlet details.
2013-06-27 15:44:50 -05:00
Charlie Nolan (FunnyMan3595) 4bd36d5407 Moodlets now last 60m and decay after 30m by default.
The previous intended behaviour was 30m with instant decay, but
it was actually set to 5h with instant decay.  Oops.
2013-06-27 14:31:31 -05:00
Charlie Nolan (FunnyMan3595) 1819060a76 Extracted the logistic function cutoff, reduced it to 4. 2013-06-27 14:12:22 -05:00
Charlie Nolan (FunnyMan3595) 0e6a8be822 Extended add_morale to support the new decay model. 2013-06-27 14:09:58 -05:00
Charlie Nolan (FunnyMan3595) 7a7e3ebc1a Apply persistent morale effects more aggressively.
Optimist wasn't showing up immediately on game start, and Hoarder
wasn't updating when you examined your morale.
2013-06-27 13:47:02 -05:00
Charlie Nolan (FunnyMan3595) f480c13d25 Save/load alterations for the new morale structure. 2013-06-27 13:38:45 -05:00
utunnels f23a086603 Experimental word_rewrap function with utf8 support (still buggy). 2013-06-28 01:24:31 +08:00
Voker57 91649fe933 Tweaked the fuel consumption code to make wood yield more 2013-06-27 20:32:10 +04:00
Oddbjørn Olsen ff7c2a81f2 Added *.cbTemp and gmon.out to .gitignore 2013-06-27 16:41:48 +02:00
Oddbjørn Olsen 1e4137c847 Made vehicle actually show up when constructing
The vehicle cache wasn't being updated. Fixes bug in issue #976.

Also, made a default vehicle name in case player leaves it blank.
2013-06-27 16:39:06 +02:00
utunnels 0d101e51b8 Move utf8 related functions to catacharset.cpp 2013-06-27 20:40:07 +08:00
Vollch f176e82253 Separate furniture and territory 2013-06-27 12:28:07 +04:00
utunnels 04955a421f Fix a bug utf8 line has an old byte limit. Limit key repeat rate, too fast. 2013-06-27 16:10:17 +08:00
Charlie Nolan (FunnyMan3595) fd59fba0d5 Added logistic-scaled morale decay. 2013-06-26 22:27:43 -05:00
Charlie Nolan (FunnyMan3595) e53e8de76a Comments for player::add_morale. 2013-06-26 22:27:43 -05:00
Charlie Nolan (FunnyMan3595) 8ea78461af Ran player::add_morale through astyle 2013-06-26 22:27:43 -05:00
Charlie Nolan (FunnyMan3595) b55fcbcea1 Extended morale_point structure. 2013-06-26 22:27:43 -05:00
Charlie Nolan (FunnyMan3595) 67d0317a87 Passed morale_point through astyle 2013-06-26 22:27:42 -05:00
utunnels f19762c67d Utf8 support. 2013-06-27 11:09:49 +08:00
Kevin Granade 4fc91e9207 Mergorama.
Conflicts:
	bionics.cpp
2013-06-26 20:15:05 -05:00
cib bb25bebac7 Fix bug with item group loading.
The loader was copying the group, and then adding the items to the copy(which would never be used again anywhere).
2013-06-27 00:26:11 +02:00
Charlie Nolan (FunnyMan3595) 8f439ac7e8 Changed Optimist to be more thematic and balanced.
Instead of a flat +20 to morale, Optimist now gives:

* All positive morale effects get a 25% boost.
* All negative morale effects are reduced by 25%.
* Permanent +4 morale (+5 after the boost)

This represents that optimism is less about always being happier and more
about focusing on good things while disregarding bad things.

Mechanically, the smaller flat boost means that you won't get a free 20%
boost to focus anymore.  This should give Optimist a distinct feel compared
to Fast Learner, rather than being a bigger boost under average conditions.
2013-06-26 16:01:29 -05:00
Charlie Nolan (FunnyMan3595) 51556b70a5 Added a couple coments to morale_level 2013-06-26 15:03:46 -05:00
Charlie Nolan (FunnyMan3595) 6ff073e8f3 Moved persistent morale effects to update_morale 2013-06-26 14:53:49 -05:00
Charlie Nolan (FunnyMan3595) 4c346ab6e3 Ran update_morale through astyle 2013-06-26 14:49:52 -05:00
Charlie Nolan (FunnyMan3595) 7d9b420d93 Removed an unused variable, fixed first morale_level call. 2013-06-26 14:46:18 -05:00
Charlie Nolan (FunnyMan3595) a2a2377a21 Passed player::morale_level through astyle 2013-06-26 14:38:35 -05:00
Charlie Nolan (FunnyMan3595) d7cdeb112c Simplified player::disp_morale, tweaked focus alignment. 2013-06-26 14:17:06 -05:00
Charlie Nolan (FunnyMan3595) a7df33c79c Added comments to player::disp_morale. 2013-06-26 13:51:42 -05:00
Charlie Nolan (FunnyMan3595) 2059b0eac4 Passed player::disp_morale through astyle. 2013-06-26 13:35:50 -05:00
fnord a510ada95e Also scroll if entries won't fit implicitly set w_height 2013-06-26 06:43:11 -05:00
fnord 32e29c9edf uimenu: scroll through entries if they exceed screen height. Title option makes use of the top border. 2013-06-26 06:14:25 -05:00
fnord 532c9f0096 Merge remote branch 'origin/master' into better_menu 2013-06-26 06:12:14 -05:00
Xommers 887338c198 Merge pull request #1 from atomicdryad/fix_cr_and_whitespace
fix cr and whitespace
2013-06-26 02:15:00 -07:00
Eric fc8b8170f7 save space by changing old flashbang() to just call flashbang(x,y,false) 2013-06-26 02:04:28 -07:00
fnord 55a7f31d1d fix cr and whitespace 2013-06-26 04:03:55 -05:00
Eric faa6e0a41f Fix CBM flashbang erroneous deafened message 2013-06-26 01:55:17 -07:00
Xommers c61b0ed4a8 Toggled Metabolic Interchange bionic, active power sources 2013-06-26 04:37:19 -04:00
Christian Buskirk 8531e1149b Nerf fluffy/long tail mutations. 2013-06-25 22:50:55 -07:00
Eric 42dcb1b529 Remove duplicate drowning messages by checking if target is dead 2013-06-25 19:33:09 -07:00
Christian Buskirk 8b3a6d8ce1 Merge PR #1730 - Overkill cap 2013-06-25 18:51:48 -07:00
Stevensonz b6beaa3f8e Display FLAMING TEC
removes A BUG and shows FLAMING TEC
2013-06-26 09:40:13 +08:00
Christian Buskirk d4198865f7 Merge PR #1693 - Streamline lumberjacking 2013-06-25 18:36:07 -07:00
MacrosBlackD b8f57d9bec Updated recipe for heavy field point arrow to require bone, rock, scrap or nails. 2013-06-25 20:16:24 -05:00
Kevin Granade fa9ce18623 So... many... PRs... 2013-06-25 20:00:25 -05:00
Oddbjørn Olsen 5dc2f67c66 Allow rng to accept parameters in swapped order 2013-06-26 02:35:29 +02:00
MacrosBlackD d4043c546b Updated difficulty of Heavy Wood Arrow. Fixes issue #1752 2013-06-25 19:16:25 -05:00
Oddbjørn Olsen a2b6b30794 Support chatting to more than 10 NPCS
Using menu_vec. menu_vec (and probably menu too) needs some work though,
it doesn't scroll if contents go beyond terminal size.
2013-06-26 02:08:53 +02:00
Eric c63088f288 Moved lightmap changes into one loop at end 2013-06-25 17:00:40 -07:00
Eric 682542ec45 Add active message to CBM artificial night 2013-06-25 16:47:20 -07:00
MacrosBlackD f1004a5e4e Added bone material to fix issue #1743 2013-06-25 18:41:19 -05:00
Oddbjørn Olsen f73fb793ff Allow player to cancel options/keybindings
As it was, the new settings were kept in memory (though not written to
disk) even if the player canceled out of options/keybindings.

Fixes issue #385.
2013-06-26 01:34:20 +02:00
Oddbjørn Olsen 7083594e96 Fixes infinite waiting when canceling wait menu
Fixes issue #1738.
2013-06-26 00:56:57 +02:00
Oddbjørn Olsen c0fdab7ce6 Crafting/disassembly now respects MAX_ITEM_IN_SQUARE
Crafting functions were calling map::add_item with default item limit,
which is still 64.

Fixes issue #1737.
2013-06-26 00:05:41 +02:00
Oddbjørn Olsen d63144b7e1 Fix item descriptions flowing off terminal
Fixes issues #1745 and #650.
2013-06-25 23:46:12 +02:00
Oddbjørn Olsen 9ab335dc82 Fixed inconsistent steel requirements in metal arrow shaft recipe
Fixed bug described in issue #1735.
2013-06-25 21:48:28 +02:00
Oddbjørn Olsen 346ea8583a tagging/inscribing no longer wastes charge when canceled.
Fixes bug described in issue #1728.
2013-06-25 21:39:37 +02:00
Hourousha 0759718bd8 Initial skeleton of a guide for editing features of the game that do NOT
require a recompilation of the source code.
2013-06-25 09:52:26 -05:00
zeroDivisible 39a49bbf37 reverted #188 as the flag introduced there is not supported on older versions of GCC (doesn't compile on OSX 10.7.5 and few others 2013-06-25 15:03:24 +01:00
Eric eb4cdbe904 Bio Night v2 2013-06-25 03:56:36 -07:00
Kevin Granade 2c126e7bf5 Cap overkill damage at base damage of attack, preventing gibbing from low-damage sources. 2013-06-25 00:02:49 -05:00
Kevin Granade ca2d29a024 Merge flaming weapons 2013-06-24 21:08:00 -05:00
Kevin Granade 729e9eda04 Merge CBM enhancements, butchering enhancements, drug craving abatement and flaming weapons.
Conflicts:
	bionics.cpp
2013-06-24 20:43:18 -05:00
MacrosBlackD ac24e389b3 Added advanced UPS that runs on plutonium at a rate of 1 plutonium per 500 charges. Doesn't allow the character to unload partially depleted plutonium and won't over fill the device if it can't fit a full plutonium. So no cheesing and no wasting materials :) 2013-06-24 18:49:04 -05:00
Vollch 0036a235ed Drugs remove craving when used 2013-06-25 02:50:14 +04:00
Stevensonz 2d39261a1e FIX #560
Fixes #560
2013-06-25 03:15:48 +08:00
Eric e9f030e164 Add CBM Artificial Night 2013-06-24 12:11:31 -07:00
fnord 2c87aec44a butcher: preserve mtype on meat. iteminfo: "Smells like <original mobtype>", for
players with carnivore, or scentmap, or cheating bastards
2013-06-24 14:09:30 -05:00
Oddbjørn Olsen c77c4d0b2d Updated code documentation for bionics
Why is the documentation stored both in DEVELOPER_FAQ.txt and in
EDITING? These two files should probably be consolidated.
2013-06-24 18:06:30 +02:00
Oddbjørn Olsen 926fdadd32 Made init_bionics() read from bionics.json 2013-06-24 18:06:29 +02:00
Oddbjørn Olsen bd4dc179b8 Added bionics.json 2013-06-24 18:06:29 +02:00
Eric 7f7a779825 minor fix to scentmap, added more colors to scentmap 2013-06-24 04:40:02 -07:00
Eric 23ba3c646b check remaining momentum before calling plswim() 2013-06-24 03:54:20 -07:00
Eric df51e0a4a7 Add check for water tiles in shockwave/knockback 2013-06-24 03:45:02 -07:00
Eric a700541abb Add flaming effect to wide technique attacks 2013-06-24 02:56:14 -07:00
Eric 2c4117cc50 Lit torches set enemies on fire 2013-06-24 02:38:38 -07:00
Eric e97af6b7a1 Add new ammo effects to item factory 2013-06-24 01:44:29 -07:00
Eric 3f1f5f6072 Add CBM Chain Lightning and related ammo effects 2013-06-23 23:48:08 -07:00
Kevin Granade 308f599683 Re-add carving a note into an item with a knife. 2013-06-23 22:00:08 -05:00
Kevin Granade 20577ba42b Extract code to add a note to an item to a helper function. 2013-06-23 21:59:45 -05:00
Kevin Granade c6831b3ea0 Merge converting note code to use marker instead of knife. 2013-06-23 19:57:47 -05:00
Kevin Granade 41aeb9aede Light refactoring on new spoiled food removal code. 2013-06-23 19:25:09 -05:00
Kevin Granade e9081452d5 Merge temperature conversion refactor, small-game arrows, shockwave improvements, and disappearing spoiled food. 2013-06-23 18:46:45 -05:00
MacrosBlackD 38151c4a45 Spoiled (rotten) items will now be removed from the map after twice the time it takes to spoil 2013-06-23 18:04:29 -05:00
fnord 1aff0cbe39 itemvars["carved_note"] > item_vars["item_note"], use marker instead 2013-06-23 17:06:58 -05:00
Eric 10c8928039 add blue shockwave() explosion, add player-victim collision messages 2013-06-23 14:55:04 -07:00
Kevin Granade f0600e428b Append carved message to the end of item description if present. 2013-06-23 16:47:30 -05:00
MacrosBlackD e170b54f9b Added small game arrow and NOGIB tag that caps damage at mon.HP + 10 2013-06-23 16:45:28 -05:00
Kevin Granade c6f4201fc0 Persistent item state tags. 2013-06-23 16:08:28 -05:00
fnord 1f1ac4be07 item_var comment cleanup 2013-06-23 16:06:53 -05:00
Kevin Granade 2afcd12df9 Fix merge error. 2013-06-23 15:11:44 -05:00
MacrosBlackD 6a31d3e093 Added missing check on STR12_DRAW to determine whether or not the player could actually use the bow 2013-06-23 15:10:43 -05:00
Kevin Granade 45266b3f63 Merge long-term healing, teleporting monsters fix, CBM recovery, shockwave generator, and viewport option bounds checking.
Conflicts:
	bionics.cpp
2013-06-23 15:02:08 -05:00
Oddbjørn Olsen 3f20273e38 Implemented print_temperature for conversions 2013-06-23 19:19:16 +02:00
Oddbjørn Olsen 515d7f0906 Added error-checking to load_options() ...
... and minimum values to VIEWPORT_X and VIEWPORT_Y
2013-06-23 17:02:29 +02:00
Eric 13eb8447ac Add CBM shockwave generator, add knockback() to implement it 2013-06-23 04:59:21 -07:00
Vollch df698e66cf Recover CBMs from butchered player corpses 2013-06-23 15:44:04 +04:00
fnord c817d06261 move real_coords to map.h, verbosely comment 2013-06-23 05:15:34 -05:00
Kevin Granade 3ec50c35c1 Adjust real_coords struct to handle arbitrarally negative values. 2013-06-23 05:15:12 -05:00
fnord 67c297c615 Fix: teleporting turrets, and static respawn inaccuracies. Add: real_coords()
to perform the voodoo required to figure out what the shifting player
centric coordinates actually mean in terms of submap & tile in submap
(in or out of bounds)
2013-06-23 05:14:59 -05:00
Julian Snitow d2266eef08 Merge branch 'master' into physician-heal-thyself 2013-06-22 23:15:54 -07:00
Julian Snitow 48d7715b21 Splints are now craftable and (slowly!) heal broken limbs. 2013-06-22 23:06:09 -07:00
Kevin Granade 399d3995c5 Adjust real_coords struct to handle arbitrarally negative values. 2013-06-23 00:02:57 -05:00
Kevin Granade efb83c5d9d Merge fix to longstanding turret and other monster migration bug. 2013-06-22 20:41:44 -05:00
Kevin Granade 0a6f9b3548 Merge improvised lockpick functionality into existing picklock method. 2013-06-22 20:19:58 -05:00
fnord 2befb7106c Fix: teleporting turrets, and static respawn inaccuracies. Add: real_coords()
to perform the voodoo required to figure out what the shifting player
centric coordinates actually mean in terms of submap & tile in submap
(in or out of bounds)
2013-06-22 16:56:29 -05:00
Kevin Granade a94a88d331 Merge remote-tracking branches 'dda/pr/1676', 'dda/pr/1677', 'dda/pr/1678', 'dda/pr/1679', 'dda/pr/1683', 'dda/pr/1684', 'dda/pr/1686', 'dda/pr/1689', 'dda/pr/1690', 'dda/pr/1691' and 'dda/pr/1692' into dda-master 2013-06-22 16:23:43 -05:00
Kevin Granade 2e1e4be90b Fix typo, thanks i2amroy. 2013-06-22 15:26:39 -05:00
Kevin Granade 1f8d32165e Add construction recipe for cutting tree trunk sections into planks in a single step. 2013-06-22 15:16:17 -05:00
Kevin Granade 946489a181 Extract code for cutting logs into planks into a seperate method. 2013-06-22 15:15:39 -05:00
Kevin Granade 7ee01d317d Replace t_log with t_trunk. 2013-06-22 15:10:35 -05:00
David Holmes de09ced18c Re-enable bulletin board base designation 2013-06-22 21:09:38 +01:00
David Holmes 303f6cf569 Update SIGNOFF 2013-06-22 21:09:38 +01:00
Oddbjørn Olsen 9a5694933b Updated Repo Paths in CONTRIBUTING.md
It was erronously referencing TheDarklingWolf's repo, even though the
master is now CleverRaven.
2013-06-22 21:46:59 +02:00
Christian Buskirk 64c61a4f43 Made wild Jabberwocks much more rare 2013-06-22 12:41:07 -07:00
Eric 656a72fb71 add CBM flashbang 2013-06-22 10:20:32 -07:00
Eric f95a2060df add penalty to CBM probability travel 2013-06-22 08:08:49 -07:00
Eric ccbbaeddd6 add CBM railgun 2013-06-22 07:58:53 -07:00
Eric 12b6415e78 check if cursor hidden before hiding in case there's overhead,start cursor hidden for options 1 & 2 2013-06-22 03:32:24 -07:00
Eric e0c988f550 fix saving of mouse options 2013-06-22 00:29:35 -07:00
Octav Sandulescu 73c398015e Set trig_dist to *not* be the default. 2013-06-22 07:53:29 +01:00
Eric a01e32f67b Add SDL mouse hiding options 2013-06-21 21:42:49 -07:00
Kevin Granade 8e898bd2de Final update to motd and makefile for v0.6. 2013-06-21 22:50:51 -05:00
Eric 77b8783db2 added probability travel bionic 2013-06-21 19:50:08 -07:00
Stevensonz 727cbaffa7 Typo Fix 2013-06-22 08:43:57 +08:00
Stevensonz d53896ab9b Lock Pick Changes and some noise balance
New Improvised lockpick! (Hard and slower to use unless skilled but has
benefit of lower alarms activation when picking alarmed doors)

Lockpick sets are now rarer but they now easier to use and more
resistant to
breaking. (Still set's off alarms though)

*Fun Fact*  3000 lockpicks and 5000 improvised lockpicks was used to
test this.

Changed crowbar recipe requirement to 0 as crafting improvised lock pick
is 0 in recipe. (Kind of gives you the path to choose between str or
dex)

added some additional noise to alarm and actions that involves crowbar
usage on prying also general actions regarding normal smashing of
windows.
(Generates a little more noise, fast and easy to use but not preferable
if you want stealth use lock picks) Based on that you are alone in the
game means the area is dead quiet and thus noise is easier to pick up.
2013-06-22 08:35:30 +08:00
Tommy 6dbcaeeeb0 Fix ranged_dex_mod() penalty for dex under 4. 2013-06-22 01:38:27 +12:00
Tommy bf186bf7c2 Don't return negative numbers for dispersion. 2013-06-22 01:34:59 +12:00
Vollch d519b1891b Fixes #1663, multiple gates near one handle work correctly 2013-06-21 17:08:46 +04:00
Tommy 47493be741 s/accuracy/dispersion/g because accuracy is not what it is. 2013-06-22 00:56:26 +12:00
fnord c48b2ae0c9 uimenu wordwrap: Correct '\n' handling for strings < textwidth 2013-06-20 01:46:56 -05:00
fnord 57057593e9 item.item_vars["lets_you_save"] = "arbritrary stringified data";
This uses item tags: on load, any tag starting with ascii 001 (^A) is instead
used to populate std::map<std::string, std::string> item_vars, as so:
"^AvariableName=string" => item.item_vars["variableName"] = "string";
Spaces, line feeds, and tabs are escaped as ^A + hex: ^A0D, ^A20, etc.

e are saved and loaded as special item tags that begin with ascii 001 (^A)
2013-06-19 12:23:16 -05:00
159 changed files with 82617 additions and 13065 deletions
+4
View File
@@ -1,4 +1,5 @@
cataclysm
cataclysm-tiles
data/*.template
save/
obj/
@@ -18,12 +19,15 @@ CataclysmWin.layout
*.user
Cataclysm.sdf
Release*/
Debug*/
*.opensdf
# Temporary and backup files
*~
\#*
*.bak
*.cbTemp
gmon.out
# System Files
Thumbs.db
+73
View File
@@ -0,0 +1,73 @@
# Building Cataclysm-DDA on Mac OS X
Tested with OS X 10.8.4, Xcode 4.6.2.
I haven't played it extensively but it builds and runs.
Not sure if it compiles with older OS/XCode versions.
This worked for me, your mileage may vary.
## Requirements
Cataclysm-DDA uses SDL, SDL\_ttf, ncurses, and gettext.
SDL can be installed as frameworks or shared libraries.
### SDL Frameworks
[**SDL framework**](http://www.libsdl.org/download-1.2.php)
http://www.libsdl.org/release/SDL-1.2.15.dmg
[**SDL\_image framework**](http://www.libsdl.org/projects/SDL_ttf/)
http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.dmg
Copy `SDL.framework` and `SDL_ttf.framework` to `/Library/Frameworks`
or `/Users/name/Library/Frameworks`.
### ncurses, gettext, libsdl, lib\_ttf
Using a package manager:
[Fink](http://fink.thetis.ig42.org), [Homebrew](http://mxcl.github.io/homebrew/),
[MacPorts](http://www.macports.org), or [pkgsrc](http://www.pkgsrc.org/).
Install gettext and ncurses. Also install libsdl and libsdl\_ttf if you're
not using frameworks as above.
Without a package manager, building from source isn't too difficult;
follow instructions in the source archives.
## Build
From the Cataclysm-DDA source folder:
$ export CXXFLAGS="-I/path/to/include" LDFLAGS="-L/path/to/lib"
This adds search paths to find shared libraries outside of /usr and /usr/local.
Multiple `-I/...` or `-L/...` paths can be specified.
$ make NATIVE=osx RELEASE=1 TILES=1 FRAMEWORK=1 OSX_MIN=10.6
## Run
$ ./cataclysm
or
$ ./cataclysm-tiles
### Options
`NATIVE=osx` builds for OS X.
`RELEASE=1` builds an optimized 'release' version.
`TILES=1` builds the SDL version; omit to build the ncurses/console version.
`FRAMEWORK=1` uses frameworks; omit for libsdl, libsdl\_ttf.
`OSX_MIN=version` sets `-mmacosx-version-min=` (mine needs to be 10.6); omit for 10.5.
### Archive
$ make bindist NATIVE=osx TILES=1
Create a .tar.gz archive of the build; omit `TILES=1` for the console version.
+3 -3
View File
@@ -39,7 +39,7 @@ For example, from vi, set marks a and b around the block, then:
$ cd Cataclysm-DDA
# Changes the active directory in the prompt to the newly cloned "Cataclysm-DDA" directory
$ git remote add -f upstream https://github.com/TheDarklingWolf/Cataclysm-DDA.git
$ git remote add -f upstream https://github.com/CleverRaven/Cataclysm-DDA.git
# Assigns the original repository to a remote called "upstream"
#### Update your `master` branch
@@ -113,7 +113,7 @@ You can also set the tracking information at the same time as creating the branc
* Note: Although this makes it easier to pull from `upstream/master`, it doesn't change anything with regards to pushing. `git push` fails because you don't have permission to push to `upstream/master`.
$ git push
error: The requested URL returned error: 403 while accessing https://github.com/TheDarklingWolf/Cataclysm-DDA.git
error: The requested URL returned error: 403 while accessing https://github.com/CleverRaven/Cataclysm-DDA.git
fatal: HTTP request failed
$ git push origin
....
@@ -128,7 +128,7 @@ You can also set the tracking information at the same time as creating the branc
If `git pull --ff-only` shows an error, it means that you've committed directly to your local `master` branch. To fix this, we create a new branch with these commits, find the point at which we diverged from `upstream/master`, and then reset `master` to that point.
$ git pull --ff-only upstream master
From https://github.com/TheDarklingWolf/Cataclysm-DDA
From https://github.com/CleverRaven/Cataclysm-DDA
* branch master -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
$ git branch new_branch master # mark the current commit with a tmp branch
Executable → Regular
+3 -1
View File
@@ -42,6 +42,8 @@
<Unit filename="artifact.cpp" />
<Unit filename="artifact.h" />
<Unit filename="artifactdata.h" />
<Unit filename="auto_pickup.cpp" />
<Unit filename="auto_pickup.h" />
<Unit filename="basecamp.cpp" />
<Unit filename="basecamp.h" />
<Unit filename="bionics.cpp" />
@@ -138,7 +140,6 @@
<Unit filename="mondeath.h" />
<Unit filename="mongroup.h" />
<Unit filename="mongroupdef.cpp" />
<Unit filename="monitemsdef.cpp" />
<Unit filename="monmove.cpp" />
<Unit filename="monster.cpp" />
<Unit filename="monster.h" />
@@ -189,6 +190,7 @@
<Unit filename="text_snippets.h" />
<Unit filename="tileray.cpp" />
<Unit filename="tileray.h" />
<Unit filename="translations.h" />
<Unit filename="trap.h" />
<Unit filename="trapdef.cpp" />
<Unit filename="trapfunc.cpp" />
+30
View File
@@ -108,6 +108,36 @@ Acid resistance values are in materials.json, and defined as such:
2 - very resistant to acid
3 - complete acid resistance
1.6 Adding a bionic
1) Edit data/raw/bionics.json and add your bionic near similar types.
2) Add the required attributes
id : "bio_rocketlauncher" // Text string used as identifier in the code.
name : "CBM: Rocket Launcher" // The bionic's name, as showed to the player.
cost : 10 // How many PUs it costs to use the bionic.
time : 0 // How long, when activated, between drawing cost. If 0, it draws power once.
description : "It's a rocket launcher, inside your arm!!" // A brief description of the bionic, as showed to the player.
3) Add any otional attributes
flags : ["ACTIVE"] // Used to flag the bionic as a specific type.
Supported flags:
"ACTIVE" : The bionic can be manually activated and deactivated.
"POWER" : The bionic provides a source of power.
"FAULTY" : The bionic is an unwanted one, will typically have negative effects.
Flags can be combined like so: ["ACTIVE","POWER","FAULTY"] (Don't add all these at once)
4) If you want the bionic to be available in the gameworld as an item, add it to itypedef.cpp
BIO_SINGLE(id, rarity, price, color, difficulty)
See 1.1 for more information about adding items.
FAQ
Q: What the heck is up with the map objects?
+106
View File
@@ -0,0 +1,106 @@
MODDING
Certain features of the game can be modified without rebuilding the game from
source code; you should be able to just modify the pertinent files and run the
game to see your changes. This attempts to document these features.
1.1 Adding a profession.
The data on professions is contained in data/raw/professions.json
The format of the file follows:
[
{
"ident" : "example", <-- This is a unique string that identifies the
profession; it is used internally by the game as
opposed to in the user interface.
"name": "Example Profession", <-- This is the name that will be displayed
on the user interface; this is
what you actually "see" in-game.
"description": "An example profession.", <-- This field contains the
description of the profession
that will be displayed in the
character creation screen.
"points" : 0, <-- This value describes the point cost of the profession;
note that negative numbers are accecptable. A positive
value will deduct points from the players total whereas
a negative one will give the player creation points.
"items": ["jeans", "tshirt", "sneakers"], <-- This list contains the items
a character will start with
if they choose this
profession.
"addictions" : [ <-- This is the OPTIONAL list of starting addictions.
{
"type": "nicotine", <-- The identifier of the addiction.
"intensity" : 10, <-- The intensity of the addiction.
}
],
"skills" : [ <-- This list is also OPTIONAL; it contains the starting
skills and their modified levels.
{
"name": "melee", <-- The identifier of the skill that will be modified.
"level" : 1 <-- The value that the skill will be modified; note that
this is NOT the starting level of the skill. It is
the value that the player's starting level will be
modified by. In other words, if the player puts 1
point into melee to give themselves level 2 melee,
taking this profession would add one additional level
resulting in level 3.
},
{
"name" : "dodge",
"level" : 1
}, <-- It is possible to list multiple skills for a single profession;
it's an unused feature in the current game.
]
},
]
1.2 Example of adding a profession.
Let's say we want to add a survivalist profession; this profession represents a
character who was already living off the land before the disaster struck. We'll
say this profession starts with archery, survival, traps, beef jerky
and a few survival items. We'll set the starting cost at 3 points since
it modifies skills and items. We could do that with the
following entries:
{
"ident" : "survivalist"
"name": "Wilderness Survivalist",
"description": "You live off the wild and wander the world; you've never
had\na place to live or items other than what you can
scavenge off the land. People called you crazy; now,
after the disaster, you're the sane one."
"points" : 3,
"items": ["pants_cargo", "boots", "beltrig", "selfbow", "jerky", "arrow_field_point"],
"skills" : [
{
"name": "archery",
"level" : 1
},
{
"name" : "survival",
"level" : 1
},
{
"name" : "traps",
"level" : 1
}
]
},
After adding this to the professions.json file, we should see the new profession
show up in the character creation screen.
1.3 IMPORTANT NOTE on JSON FILES:
The following characters: [ { , } ] : "
are *very* important when adding or modifying the JSON files for technical
reasons. This means a single missing , or [ or } can be the difference between
a working file and a hanging game at startup. Many editors have features
that let you track { [ and ] } to see if they're balanced (ie, have a matching
opposite); Notepad++ is a popular, free editor on Windows that contains
this feature. On Linux, there are a plethora of options, and you probably
already have a preferred one :-).
+50 -10
View File
@@ -28,7 +28,7 @@
# WARNINGS will spam hundreds of warnings, mostly safe, if turned on
# DEBUG is best turned on if you plan to debug in gdb -- please do!
# PROFILE is for use with gprof or a similar program -- don't bother generally
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-psabi
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter
# Uncomment below to disable warnings
#WARNINGS = -w
DEBUG = -g
@@ -51,8 +51,7 @@ DEBUG = -g
#DEFINES += -DDEBUG_ENABLE_MAP_GEN
#DEFINES += -DDEBUG_ENABLE_GAME
VERSION = 0.5
VERSION = 0.7.1
TARGET = cataclysm
@@ -106,19 +105,27 @@ endif
# Linux 64-bit
ifeq ($(NATIVE), linux64)
CXXFLAGS += -m64
LDFLAGS += -m64
TARGETSYSTEM=LINUX
else
# Linux 32-bit
ifeq ($(NATIVE), linux32)
CXXFLAGS += -m32
LDFLAGS += -m32
TARGETSYSTEM=LINUX
endif
endif
# OSX
ifeq ($(NATIVE), osx)
CXXFLAGS += -mmacosx-version-min=10.6
OSX_MIN = 10.5
DEFINES += -DMACOSX
CXXFLAGS += -mmacosx-version-min=$(OSX_MIN)
LDFLAGS += -lintl
TARGETSYSTEM=LINUX
ifneq ($(OS), GNU/Linux)
BINDIST_CMD = tar -s"@^$(BINDIST_DIR)@cataclysmdda-$(VERSION)@" -czvf $(BINDIST) $(BINDIST_DIR)
endif
endif
# Win32 (mingw32?)
@@ -138,12 +145,32 @@ ifeq ($(TARGETSYSTEM),WINDOWS)
BINDIST = $(W32BINDIST)
BINDIST_CMD = $(W32BINDIST_CMD)
ODIR = $(W32ODIR)
LDFLAGS += -static -lgdi32
LDFLAGS += -static -lgdi32 -lintl -liconv
W32FLAGS += -Wl,-stack,12000000,-subsystem,windows
endif
ifdef TILES
LDFLAGS += -lSDL -lSDL_ttf -lfreetype -lz
ifeq ($(NATIVE),osx)
ifdef FRAMEWORK
DEFINES += -DOSX_SDL_FW
OSX_INC = -F/Library/Frameworks \
-F$(HOME)/Library/Frameworks \
-I/Library/Frameworks/SDL.framework/Headers \
-I$(HOME)/Library/Frameworks/SDL.framework/Headers \
-I/Library/Frameworks/SDL_ttf.framework/Headers \
-I$(HOME)/Library/Frameworks/SDL_ttf.framework/Headers
LDFLAGS += -F/Library/Frameworks \
-F$(HOME)/Library/Frameworks \
-framework SDL -framework SDL_ttf -framework Cocoa
CXXFLAGS += $(OSX_INC)
else
DEFINES += -DOSX_SDL_LIBS
CXXFLAGS += $(shell sdl-config --cflags)
LDFLAGS += $(shell sdl-config --libs) -lSDL_ttf
endif
else
LDFLAGS += -lSDL -lSDL_ttf -lfreetype -lz
endif
DEFINES += -DTILES
ifeq ($(TARGETSYSTEM),WINDOWS)
LDFLAGS += -lgdi32 -ldxguid -lwinmm
@@ -156,7 +183,11 @@ ifdef TILES
else
# Link to ncurses if we're using a non-tiles, Linux build
ifeq ($(TARGETSYSTEM),LINUX)
LDFLAGS += -lncurses
LDFLAGS += -lncursesw
# Work around Cygwin not including gettext support in glibc
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
LDFLAGS += -lintl -liconv
endif
endif
endif
@@ -169,6 +200,12 @@ HEADERS = $(wildcard *.h)
_OBJS = $(SOURCES:.cpp=.o)
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
ifdef TILES
ifeq ($(NATIVE),osx)
OBJS += $(ODIR)/SDLMain.o
endif
endif
all: version $(TARGET)
@
@@ -193,12 +230,15 @@ $(DDIR):
$(ODIR)/%.o: %.cpp
$(CXX) $(DEFINES) $(CXXFLAGS) -c $< -o $@
$(ODIR)/SDLMain.o: SDLMain.m
$(CC) -c $(OSX_INC) $< -o $@
version.cpp: version
clean: clean-tests
rm -rf $(TARGET) $(W32TARGET) $(ODIR) $(W32ODIR) $(W32BINDIST) \
$(BINDIST)
rm -rf $(BINDIST_DIR)
rm -rf $(TARGET) $(TILESTARGET) $(W32TILESTARGET) $(W32TARGET)
rm -rf $(ODIR) $(W32ODIR) $(W32ODIRTILES)
rm -rf $(BINDIST) $(W32BINDIST) $(BINDIST_DIR)
rm -f version.h
bindist: $(BINDIST)
+3 -3
View File
@@ -20,7 +20,7 @@ The latest instructions on how to compile can be found on [our wiki](http://www.
## Contribute
Please see [CONTRIBUTING.md](https://github.com/TheDarklingWolf/Cataclysm-DDA/blob/master/CONTRIBUTING.md) for details.
Please see [CONTRIBUTING.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/CONTRIBUTING.md) for details.
## Frequently Asked Questions
@@ -35,8 +35,8 @@ Press the `?` key, followed by the `1` key to see the full list of key commands.
#### How can I start a new world?
Simply delete the **save** folder, which can be found in the same directory as the executable.
**Reset** on the main menu will generate a fresh world for you.
#### I've found a bug / I would like to make a suggestion. What should I do?
Please submit an issue on [our GitHub page](https://github.com/TheDarklingWolf/Cataclysm-DDA/issues/). If you're not able to, send an email to `TheDarklingWolf@gmail.com`.
Please submit an issue on [our GitHub page](https://github.com/CleverRaven/Cataclysm-DDA/issues/). If you're not able to, send an email to `TheDarklingWolf@gmail.com`.
+16
View File
@@ -0,0 +1,16 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#ifndef _SDLMain_h_
#define _SDLMain_h_
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end
#endif /* _SDLMain_h_ */
+385
View File
@@ -0,0 +1,385 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#if (defined OSX_SDL_FW)
#include "SDL.h"
#else
#include "SDL/SDL.h"
#endif
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare
it ourselves here. */
@interface NSApplication(SDL_Missing_Methods)
- (void)setAppleMenu:(NSMenu *)menu;
@end
/* Use this flag to determine whether we use SDLMain.nib or not */
#define SDL_USE_NIB_FILE 0
/* Use this flag to determine whether we use CPS (docking) or not */
#define SDL_USE_CPS 1
#ifdef SDL_USE_CPS
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
static BOOL gCalledAppMainline = FALSE;
static NSString *getApplicationName(void)
{
const NSDictionary *dict;
NSString *appName = 0;
/* Determine the application name */
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
return appName;
}
#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
#endif
@interface NSApplication (SDLApplication)
@end
@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
chdir(parentdir); /* chdir to the binary app's parent */
}
CFRelease(url);
CFRelease(url2);
}
}
#if SDL_USE_NIB_FILE
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
}
#else
static void setApplicationMenu(void)
{
/* warning: this code is very odd */
NSMenu *appleMenu;
NSMenuItem *menuItem;
NSString *title;
NSString *appName;
appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Hide " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
[[NSApp mainMenu] addItem:menuItem];
/* Tell the application object that this is now the application menu */
[NSApp setAppleMenu:appleMenu];
/* Finally give up our references to the objects */
[appleMenu release];
[menuItem release];
}
/* Create a window menu */
static void setupWindowMenu(void)
{
NSMenu *windowMenu;
NSMenuItem *windowMenuItem;
NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem];
[menuItem release];
/* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
/* Finally give up our references to the objects */
[windowMenu release];
[windowMenuItem release];
}
/* Replacement for NSApplicationMain */
static void CustomApplicationMain (int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDLMain *sdlMain;
/* Ensure the application object is initialised */
[NSApplication sharedApplication];
#ifdef SDL_USE_CPS
{
CPSProcessSerNum PSN;
/* Tell the dock about us */
if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
#endif /* SDL_USE_CPS */
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu();
setupWindowMenu();
/* Create SDLMain and make it the app delegate */
sdlMain = [[SDLMain alloc] init];
[NSApp setDelegate:sdlMain];
/* Start the main event loop */
[NSApp run];
[sdlMain release];
[pool release];
}
#endif
/*
* Catch document open requests...this lets us notice files when the app
* was launched by double-clicking a document, or when a document was
* dragged/dropped on the app's icon. You need to have a
* CFBundleDocumentsType section in your Info.plist to get this message,
* apparently.
*
* Files are added to gArgv, so to the app, they'll look like command line
* arguments. Previously, apps launched from the finder had nothing but
* an argv[0].
*
* This message may be received multiple times to open several docs on launch.
*
* This message is ignored once the app's mainline has been called.
*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
const char *temparg;
size_t arglen;
char *arg;
char **newargv;
if (!gFinderLaunch) /* MacOS is passing command line args. */
return FALSE;
if (gCalledAppMainline) /* app has started, ignore this document. */
return FALSE;
temparg = [filename UTF8String];
arglen = SDL_strlen(temparg) + 1;
arg = (char *) SDL_malloc(arglen);
if (arg == NULL)
return FALSE;
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
SDL_free(arg);
return FALSE;
}
gArgv = newargv;
SDL_strlcpy(arg, temparg, arglen);
gArgv[gArgc++] = arg;
gArgv[gArgc] = NULL;
return TRUE;
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
#if SDL_USE_NIB_FILE
/* Set the main menu to contain the real app name instead of "SDL App" */
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif
/* Hand off to main application code */
gCalledAppMainline = TRUE;
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
}
#if SDL_USE_NIB_FILE
NSApplicationMain (argc, argv);
#else
CustomApplicationMain (argc, argv);
#endif
return 0;
}
+2
View File
@@ -26,3 +26,5 @@ Tommy <yobbobanana@gmx.com>
teh-sam
Alex Casey (Tamunshin) <tamunshin@hotmail.com>
Stevensonz <money3030@yahoo.com.>
David Holmes <dholmes@dholmes.us>
Sean McLaughlin <galenevil@hotmail.com> / <galenevil.eve@gmail.com>
+92
View File
@@ -0,0 +1,92 @@
Info on translating Cataclysm-DDA into another language.
TRANSLATORS
===========
If there is already a translation available for your language,
and you just want to update or improve it,
you can edit the .po file for your language,
found inside the "lang/po" subdirectory.
After editing this file,
if you are running the dev version and want to test your changes,
perform step 4 from the maintainers section below.
If there is no translation yet,
the .po file will need to be generated.
You can do this yourself by following the instructions below,
or ask one of the CleverRaven devs to do it for you.
When you are done translating,
submit the changes back to CleverRaven for inclusion in Cataclysm-DDA.
MAINTAINERS
===========
Step 1: Extract the translatable strings
----------------------------------------
First we have to extract the translatable strings from the .json files.
The python script lang/extract_json_strings.py will do this for us,
storing them in an intermediate form in lang/json for "xgettext" to read.
python lang/extract_json_strings.py
Now we can use xgettext to collate all the translatable strings,
and store them in the file lang/po/cataclysm-dda.pot.
This needs to be done every time translatable strings are added or modified.
All of the translations depend on this file.
xgettext -d cataclysm-dda -s -o lang/po/cataclysm-dda.pot --keyword=_ *.cpp *.h lang/json/*.py
Step 2(a): Initialize each language file
----------------------------------------
If we're starting a new translation from scratch,
we have to initialize the translation file.
In this example the translation is into New Zealand English (en_NZ).
For other languages change "en_NZ" to the relevant language identifier.
msginit -l en_NZ.utf8 -o lang/po/en_NZ.po -i lang/po/cataclysm-dda.pot
Step 2(b): Update an already existing language file
---------------------------------------------------
If we just want to update a translation,
we'll want to keep all the messages that have already been translated.
In this case we use "msgmerge" in stead of "msginit".
msgmerge -s -U lang/po/en_NZ.po lang/po/cataclysm-dda.pot
Step 3: Translate
-----------------
Now open the .po file in your favorite editor and translate!
The lines beginning with "msgid" must be left in the english form,
only the lines beginning with "msgstr" should be translated.
Step 4: Compile the .po file
----------------------------
If it is a new translation,
you will need to create a subdirectory in lang/mo for it,
and then a subdirectory called "LC_MESSAGES" inside that.
For example:
mkdir -p lang/mo/en_NZ/LC_MESSAGES
Now run the "msgfmt" program to compile the translations for use in game.
msgfmt -c -o lang/mo/en_NZ/LC_MESSAGES/cataclysm-dda.mo lang/po/en_NZ.po
Hooray, that's it :).
+4
View File
@@ -257,6 +257,8 @@ std::string action_ident(action_id act)
return "ignore_enemy";
case ACTION_SAVE:
return "save";
case ACTION_QUICKSAVE:
return "quicksave";
case ACTION_QUIT:
return "quit";
case ACTION_PL_INFO:
@@ -431,6 +433,8 @@ std::string action_name(action_id act)
return "Ignore Nearby Enemy";
case ACTION_SAVE:
return "Save and Quit";
case ACTION_QUICKSAVE:
return "Quicksave";
case ACTION_QUIT:
return "Commit Suicide";
case ACTION_PL_INFO:
+1
View File
@@ -72,6 +72,7 @@ ACTION_TOGGLE_SAFEMODE,
ACTION_TOGGLE_AUTOSAFE,
ACTION_IGNORE_ENEMY,
ACTION_SAVE,
ACTION_QUICKSAVE,
ACTION_QUIT,
// Info Screens
ACTION_PL_INFO,
+22 -8
View File
@@ -28,7 +28,7 @@ void addict_effect(game *g, addiction &add)
g->u.stim--;
if (rng(8, 400) < in) {
g->add_msg("Your hands start shaking... you need it bad!");
g->u.add_disease(DI_SHAKES, 20, g);
g->u.add_disease("shakes", 20);
}
}
break;
@@ -46,9 +46,9 @@ void addict_effect(game *g, addiction &add)
g->add_msg("Your hands start shaking... you need a drink bad!");
g->cancel_activity_query("You have an alcohol craving.");
g->u.add_morale(MORALE_CRAVING_ALCOHOL, -35, -120);
g->u.add_disease(DI_SHAKES, 50, g);
} else if (!g->u.has_disease(DI_HALLU) && rng(10, 1600) < in)
g->u.add_disease(DI_HALLU, 3600, g);
g->u.add_disease("shakes", 50);
} else if (!g->u.has_disease("hallu") && rng(10, 1600) < in)
g->u.add_disease("hallu", 3600);
break;
case ADD_SLEEP:
@@ -75,7 +75,7 @@ void addict_effect(game *g, addiction &add)
g->add_msg("Your hands start shaking... you need some painkillers.");
g->cancel_activity_query("You have an opiate craving.");
g->u.add_morale(MORALE_CRAVING_OPIATE, -40, -200);
g->u.add_disease(DI_SHAKES, 20 + in * 5, g);
g->u.add_disease("shakes", 20 + in * 5);
} else if (one_in(20) && dice(2, 30) < in) {
g->add_msg("You feel anxious. You need your painkillers!");
g->u.add_morale(MORALE_CRAVING_OPIATE, -30, -200);
@@ -107,14 +107,14 @@ void addict_effect(game *g, addiction &add)
g->add_msg("Your hands start shaking... you need a pick-me-up.");
g->cancel_activity_query("You have a speed craving.");
g->u.add_morale(MORALE_CRAVING_SPEED, -25, -200);
g->u.add_disease(DI_SHAKES, in * 20, g);
g->u.add_disease("shakes", in * 20);
} else if (one_in(50) && dice(2, 100) < in) {
g->add_msg("You stop suddenly, feeling bewildered.");
g->cancel_activity();
g->u.moves -= 300;
} else if (!g->u.has_disease(DI_HALLU) && one_in(20) &&
} else if (!g->u.has_disease("hallu") && one_in(20) &&
8 + dice(2, 80) < in)
g->u.add_disease(DI_HALLU, 3600, g);
g->u.add_disease("hallu", 3600);
} break;
case ADD_COKE:
@@ -165,6 +165,20 @@ std::string addiction_name(addiction cur)
}
}
morale_type addiction_craving(add_type cur)
{
switch (cur) {
case ADD_CIG: return MORALE_CRAVING_NICOTINE;
case ADD_CAFFEINE: return MORALE_CRAVING_CAFFEINE;
case ADD_ALCOHOL: return MORALE_CRAVING_ALCOHOL;
case ADD_PKILLER: return MORALE_CRAVING_OPIATE;
case ADD_SPEED: return MORALE_CRAVING_SPEED;
case ADD_COKE: return MORALE_CRAVING_COCAINE;
case ADD_CRACK: return MORALE_CRAVING_CRACK;
default: return MORALE_NULL;
}
}
add_type addiction_type(std::string name)
{
if (name == "nicotine")
+2
View File
@@ -12,6 +12,8 @@ void addict_effect(game *g, addiction &add);
std::string addiction_name(addiction cur);
morale_type addiction_craving(add_type cur);
add_type addiction_type(std::string name);
std::string addiction_text(addiction cur);
+5 -5
View File
@@ -845,11 +845,11 @@ void game::process_artifact(item *it, player *p, bool wielded)
case AEP_EXTINGUISH:
for (int x = p->posx - 1; x <= p->posx + 1; x++) {
for (int y = p->posy - 1; y <= p->posy + 1; y++) {
if (m.field_at(x, y).type == fd_fire) {
if (m.field_at(x, y).density == 0)
m.remove_field(x, y);
if (m.field_at(x, y).findField(fd_fire)) {
if (m.field_at(x, y).findField(fd_fire)->getFieldDensity() == 0)
m.remove_field(x, y, fd_fire);
else
m.field_at(x, y).density--;
m.field_at(x, y).findField(fd_fire)->setFieldDensity(m.field_at(x, y).findField(fd_fire)->getFieldDensity() - 1);
}
}
}
@@ -867,7 +867,7 @@ void game::process_artifact(item *it, player *p, bool wielded)
case AEP_EVIL:
if (one_in(150)) { // Once every 15 minutes, on average
p->add_disease(DI_EVIL, 300, this);
p->add_disease("evil", 300);
if (!wielded && !it->is_armor())
add_msg("You have an urge to %s the %s.",
(it->is_armor() ? "wear" : "wield"), it->tname().c_str());
+755
View File
@@ -0,0 +1,755 @@
#include "game.h"
#include "auto_pickup.h"
#include "output.h"
#include "debug.h"
#include "keypress.h"
#include "item_factory.h"
#include <stdlib.h>
#include <fstream>
#include <string>
std::vector<cPickupRules> vAutoPickupRules[5];
void game::show_auto_pickup()
{
save_reset_changes(false);
const int iHeaderHeight = 4;
const int iContentHeight = FULL_SCREEN_HEIGHT-2-iHeaderHeight;
const int iOffsetX = (TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0;
const int iOffsetY = (TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0;
std::map<int, bool> mapLines;
mapLines[3] = true;
mapLines[50] = true;
mapLines[54] = true;
//mapLines[61] = true;
//mapLines[68] = true;
const int iTotalCols = mapLines.size()-1;
WINDOW* w_auto_pickup_options = newwin(FULL_SCREEN_HEIGHT/2, FULL_SCREEN_WIDTH/2, iOffsetY + (FULL_SCREEN_HEIGHT/2)/2, iOffsetX + (FULL_SCREEN_WIDTH/2)/2);
WINDOW* w_auto_pickup_help = newwin((FULL_SCREEN_HEIGHT/2)-2, FULL_SCREEN_WIDTH * 3/4, 8 + iOffsetY + (FULL_SCREEN_HEIGHT/2)/2, iOffsetX + 19/2);
WINDOW* w_auto_pickup_border = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH, iOffsetY, iOffsetX);
WINDOW* w_auto_pickup_header = newwin(iHeaderHeight, FULL_SCREEN_WIDTH - 2, 1 + iOffsetY, 1 + iOffsetX);
WINDOW* w_auto_pickup = newwin(iContentHeight, FULL_SCREEN_WIDTH - 2, iHeaderHeight + 1 + iOffsetY, 1 + iOffsetX);
wborder(w_auto_pickup_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
mvwputch(w_auto_pickup_border, 3, 0, c_ltgray, LINE_XXXO); // |-
mvwputch(w_auto_pickup_border, 3, 79, c_ltgray, LINE_XOXX); // -|
for (std::map<int, bool>::iterator iter = mapLines.begin(); iter != mapLines.end(); ++iter) {
mvwputch(w_auto_pickup_border, FULL_SCREEN_HEIGHT-1, iter->first + 1, c_ltgray, LINE_XXOX); // _|_
}
mvwprintz(w_auto_pickup_border, 0, 29, c_ltred, " AUTO PICKUP MANAGER ");
wrefresh(w_auto_pickup_border);
mvwprintz(w_auto_pickup_header, 0, 0, c_ltgreen, " A");
wprintz(w_auto_pickup_header, c_white, "dd ");
wprintz(w_auto_pickup_header, c_ltgreen, "R");
wprintz(w_auto_pickup_header, c_white, "emove ");
wprintz(w_auto_pickup_header, c_ltgreen, "C");
wprintz(w_auto_pickup_header, c_white, "opy ");
wprintz(w_auto_pickup_header, c_ltgreen, "M");
wprintz(w_auto_pickup_header, c_white, "ove ");
wprintz(w_auto_pickup_header, c_ltgreen, "E");
wprintz(w_auto_pickup_header, c_white, "nable ");
wprintz(w_auto_pickup_header, c_ltgreen, "D");
wprintz(w_auto_pickup_header, c_white, "isable ");
wprintz(w_auto_pickup_header, c_ltgreen, "T");
wprintz(w_auto_pickup_header, c_white, "est ");
mvwprintz(w_auto_pickup_header, 1, 0, c_ltgreen, " +");
wprintz(w_auto_pickup_header, c_white, "/");
wprintz(w_auto_pickup_header, c_ltgreen, "-");
wprintz(w_auto_pickup_header, c_white, " Move up/down ");
wprintz(w_auto_pickup_header, c_ltgreen, "Enter");
wprintz(w_auto_pickup_header, c_white, "-Edit ");
wprintz(w_auto_pickup_header, c_ltgreen, "Tab");
wprintz(w_auto_pickup_header, c_white, "-Switch Page ");
for (int i = 0; i < 78; i++) {
if (mapLines[i]) {
mvwputch(w_auto_pickup_header, 2, i, c_ltgray, LINE_OXXX);
mvwputch(w_auto_pickup_header, 3, i, c_ltgray, LINE_XOXO);
} else {
mvwputch(w_auto_pickup_header, 2, i, c_ltgray, LINE_OXOX); // Draw line under header
}
}
mvwprintz(w_auto_pickup_header, 3, 0, c_white, "#");
mvwprintz(w_auto_pickup_header, 3, 7, c_white, "Rules");
mvwprintz(w_auto_pickup_header, 3, 51, c_white, "I/E");
//mvwprintz(w_auto_pickup_header, 3, 55, c_white, "Volume");
//mvwprintz(w_auto_pickup_header, 3, 62, c_white, "Weight");
wrefresh(w_auto_pickup_header);
int iCurrentPage = 1;
int iCurrentLine = 0;
int iCurrentCol = 1;
int iStartPos = 0;
bool bStuffChanged = false;
char ch = ' ';
std::stringstream sTemp;
do {
mvwprintz(w_auto_pickup_header, 2, 17 + 0, c_white, "[");
wprintz(w_auto_pickup_header, (iCurrentPage == 1) ? hilite(c_white) : c_white, "Global");
wprintz(w_auto_pickup_header, c_white, "]");
mvwprintz(w_auto_pickup_header, 2, 17 + 9, c_white, "[");
wprintz(w_auto_pickup_header, (iCurrentPage == 2) ? hilite(c_white) : c_white, "Character");
wprintz(w_auto_pickup_header, c_white, "]");
/*
mvwprintz(w_auto_pickup_header, 2, 12 + 21, c_white, "[");
wprintz(w_auto_pickup_header, (iCurrentPage == 3) ? hilite(c_white) : c_white, "Options");
wprintz(w_auto_pickup_header, c_white, "]");
*/
wrefresh(w_auto_pickup_header);
// Clear the lines
for (int i = 0; i < iContentHeight; i++) {
for (int j = 0; j < 79; j++) {
if (mapLines[j]) {
mvwputch(w_auto_pickup, i, j, c_ltgray, LINE_XOXO);
} else {
mvwputch(w_auto_pickup, i, j, c_black, ' ');
}
}
}
if (iCurrentPage == 1 || iCurrentPage == 2) {
if (iCurrentPage == 2 && g->u.name == "") {
vAutoPickupRules[2].clear();
mvwprintz(w_auto_pickup, 8, 15, c_white, "Please load a character first to use this page!");
}
if (vAutoPickupRules[iCurrentPage].size() > iContentHeight) {
iStartPos = iCurrentLine - (iContentHeight - 1) / 2;
if (iStartPos < 0) {
iStartPos = 0;
} else if (iStartPos + iContentHeight > vAutoPickupRules[iCurrentPage].size()) {
iStartPos = vAutoPickupRules[iCurrentPage].size() - iContentHeight;
}
}
// display auto pickup
for (int i = iStartPos; i < vAutoPickupRules[iCurrentPage].size(); i++) {
if (i >= iStartPos && i < iStartPos + ((iContentHeight > vAutoPickupRules[iCurrentPage].size()) ? vAutoPickupRules[iCurrentPage].size() : iContentHeight)) {
nc_color cLineColor = (vAutoPickupRules[iCurrentPage][i].bActive) ? c_white : c_ltgray;
sTemp.str("");
sTemp << i + 1;
mvwprintz(w_auto_pickup, i - iStartPos, 0, cLineColor, sTemp.str().c_str());
mvwprintz(w_auto_pickup, i - iStartPos, 4, cLineColor, "");
if (iCurrentLine == i) {
wprintz(w_auto_pickup, c_yellow, ">> ");
} else {
wprintz(w_auto_pickup, c_yellow, " ");
}
wprintz(w_auto_pickup, (iCurrentLine == i && iCurrentCol == 1) ? hilite(cLineColor) : cLineColor, "%s", ((vAutoPickupRules[iCurrentPage][i].sRule == "") ? "<empty rule>" : vAutoPickupRules[iCurrentPage][i].sRule).c_str());
mvwprintz(w_auto_pickup, i - iStartPos, 52, (iCurrentLine == i && iCurrentCol == 2) ? hilite(cLineColor) : cLineColor, "%s", ((vAutoPickupRules[iCurrentPage][i].bExclude) ? "E" : "I"));
}
}
wrefresh(w_auto_pickup);
} else if (iCurrentPage == 3) {
wborder(w_auto_pickup_options, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
mvwprintz(w_auto_pickup_options, 5, 10, c_white, "Under construction!");
wrefresh(w_auto_pickup);
wrefresh(w_auto_pickup_options);
}
ch = input();
if (iCurrentPage == 3) {
switch(ch) {
case '\t': //Switch to next Page
iCurrentPage++;
if (iCurrentPage > 3) {
iCurrentPage = 1;
iCurrentLine = 0;
}
break;
}
} else if (iCurrentPage == 1 || iCurrentPage == 2) {
if (iCurrentPage == 2 && g->u.name == "" && ch != '\t') {
//Only allow loaded games to use the char sheet
} else if (vAutoPickupRules[iCurrentPage].size() > 0 || ch == 'a' || ch == '\t') {
switch(ch) {
case 'j': //move down
iCurrentLine++;
iCurrentCol = 1;
if (iCurrentLine >= vAutoPickupRules[iCurrentPage].size()) {
iCurrentLine = 0;
}
break;
case 'k': //move up
iCurrentLine--;
iCurrentCol = 1;
if (iCurrentLine < 0) {
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
}
break;
case 'a': //add new rule
case 'A':
bStuffChanged = true;
vAutoPickupRules[iCurrentPage].push_back(cPickupRules("", true, false));
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
break;
case 'r': //remove rule
case 'R':
bStuffChanged = true;
vAutoPickupRules[iCurrentPage].erase(vAutoPickupRules[iCurrentPage].begin() + iCurrentLine);
if (iCurrentLine > vAutoPickupRules[iCurrentPage].size()-1) {
iCurrentLine--;
}
break;
case 'c': //copy rule
case 'C':
bStuffChanged = true;
vAutoPickupRules[iCurrentPage].push_back(cPickupRules(vAutoPickupRules[iCurrentPage][iCurrentLine].sRule, vAutoPickupRules[iCurrentPage][iCurrentLine].bActive, vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude));
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
break;
case 'm': //move rule global <-> character
case 'M':
if ((iCurrentPage == 1 && g->u.name != "") || iCurrentPage == 2) {
bStuffChanged = true;
//copy over
vAutoPickupRules[(iCurrentPage == 1) ? 2 : 1].push_back(cPickupRules(vAutoPickupRules[iCurrentPage][iCurrentLine].sRule, vAutoPickupRules[iCurrentPage][iCurrentLine].bActive, vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude));
//remove old
vAutoPickupRules[iCurrentPage].erase(vAutoPickupRules[iCurrentPage].begin() + iCurrentLine);
iCurrentLine = vAutoPickupRules[(iCurrentPage == 1) ? 2 : 1].size()-1;
iCurrentPage = (iCurrentPage == 1) ? 2 : 1;
}
break;
case '\t': //Switch to next Page
iCurrentPage++;
if (iCurrentPage > 2) {
iCurrentPage = 1;
iCurrentLine = 0;
}
break;
case '\n': //Edit Col in current line
bStuffChanged = true;
if (iCurrentCol == 1) {
mvwprintz(w_auto_pickup_help, 1, 1, c_white, "* is used as a Wildcard. A few Examples:");
mvwprintz(w_auto_pickup_help, 2, 1, c_white, "");
mvwprintz(w_auto_pickup_help, 3, 1, c_white, "wood arrow matches the itemname exactly");
mvwprintz(w_auto_pickup_help, 4, 1, c_white, "wood ar* matches items beginning with wood ar");
mvwprintz(w_auto_pickup_help, 5, 1, c_white, "*rrow matches items ending with rrow");
mvwprintz(w_auto_pickup_help, 6, 1, c_white, "*avy fle*fi*arrow multible * are allowed");
mvwprintz(w_auto_pickup_help, 7, 1, c_white, "heAVY*woOD*arrOW case insesitive search");
mvwprintz(w_auto_pickup_help, 8, 1, c_white, "");
wborder(w_auto_pickup_help, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
wrefresh(w_auto_pickup_help);
vAutoPickupRules[iCurrentPage][iCurrentLine].sRule = trim_rule(string_input_popup("Pickup Rule:", 30, vAutoPickupRules[iCurrentPage][iCurrentLine].sRule));
} else if (iCurrentCol == 2) {
vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude = !vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude;
}
break;
case 'e': //enable rule
case 'E':
bStuffChanged = true;
vAutoPickupRules[iCurrentPage][iCurrentLine].bActive = true;
break;
case 'd': //disable rule
case 'D':
bStuffChanged = true;
vAutoPickupRules[iCurrentPage][iCurrentLine].bActive = false;
break;
case 'h': //move left
iCurrentCol--;
if (iCurrentCol < 1) {
iCurrentCol = iTotalCols;
}
break;
case 'l': //move right
iCurrentCol++;
if (iCurrentCol > iTotalCols) {
iCurrentCol = 1;
}
break;
case '+': //move rule up
bStuffChanged = true;
if (iCurrentLine < vAutoPickupRules[iCurrentPage].size()-1) {
std::swap(vAutoPickupRules[iCurrentPage][iCurrentLine], vAutoPickupRules[iCurrentPage][iCurrentLine+1]);
iCurrentLine++;
iCurrentCol = 1;
}
break;
case '-': //move rule down
bStuffChanged = true;
if (iCurrentLine > 0) {
std::swap(vAutoPickupRules[iCurrentPage][iCurrentLine], vAutoPickupRules[iCurrentPage][iCurrentLine-1]);
iCurrentLine--;
iCurrentCol = 1;
}
break;
case 't': //test rule
case 'T':
test_pattern(iCurrentPage, iCurrentLine);
break;
}
}
}
} while(ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE);
if (bStuffChanged) {
if(query_yn("Save changes?")) {
save_auto_pickup(false);
if (g->u.name != "") {
save_auto_pickup(true);
}
} else {
save_reset_changes(true);
}
}
werase(w_auto_pickup);
werase(w_auto_pickup_border);
werase(w_auto_pickup_header);
werase(w_auto_pickup_options);
werase(w_auto_pickup_help);
}
void test_pattern(int iCurrentPage, int iCurrentLine)
{
std::vector<std::string> vMatchingItems;
std::string sItemName = "";
if (vAutoPickupRules[iCurrentPage][iCurrentLine].sRule == "") {
return;
}
//Loop through all itemfactory items
for (int i = 0; i < standard_itype_ids.size(); i++) {
sItemName = item_controller->find_template(standard_itype_ids[i])->name;
if (auto_pickup_match(sItemName, vAutoPickupRules[iCurrentPage][iCurrentLine].sRule)) {
vMatchingItems.push_back(sItemName);
}
}
const int iOffsetX = 15 + ((TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
const int iOffsetY = 5 + ((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0);
int iStartPos = 0;
const int iContentHeight = FULL_SCREEN_HEIGHT - 8;
const int iContentWidth = FULL_SCREEN_WIDTH - 30;
char ch;
std::stringstream sTemp;
WINDOW* w_test_rule_border = newwin(iContentHeight + 2, iContentWidth, iOffsetY, iOffsetX);
WINDOW* w_test_rule_content = newwin(iContentHeight, iContentWidth - 2, 1 + iOffsetY, 1 + iOffsetX);
wborder(w_test_rule_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
sTemp << vMatchingItems.size() << " items match: " << vAutoPickupRules[iCurrentPage][iCurrentLine].sRule;
mvwprintz(w_test_rule_border, 0, iContentWidth/2 - (sTemp.str()).length()/2, hilite(c_white), sTemp.str().c_str());
wrefresh(w_test_rule_border);
iCurrentLine = 0;
do {
// Clear the lines
for (int i = 0; i < iContentHeight; i++) {
for (int j = 0; j < 79; j++) {
mvwputch(w_test_rule_content, i, j, c_black, ' ');
}
}
if (vMatchingItems.size() > iContentHeight) {
iStartPos = iCurrentLine - (iContentHeight - 1) / 2;
if (iStartPos < 0) {
iStartPos = 0;
} else if (iStartPos + iContentHeight > vMatchingItems.size()) {
iStartPos = vMatchingItems.size() - iContentHeight;
}
}
// display auto pickup
for (int i = iStartPos; i < vMatchingItems.size(); i++) {
if (i >= iStartPos && i < iStartPos + ((iContentHeight > vMatchingItems.size()) ? vMatchingItems.size() : iContentHeight)) {
nc_color cLineColor = c_white;
sTemp.str("");
sTemp << i + 1;
mvwprintz(w_test_rule_content, i - iStartPos, 0, cLineColor, sTemp.str().c_str());
mvwprintz(w_test_rule_content, i - iStartPos, 4, cLineColor, "");
if (iCurrentLine == i) {
wprintz(w_test_rule_content, c_yellow, ">> ");
} else {
wprintz(w_test_rule_content, c_yellow, " ");
}
wprintz(w_test_rule_content, (iCurrentLine == i) ? hilite(cLineColor) : cLineColor, vMatchingItems[i].c_str());
}
}
wrefresh(w_test_rule_content);
ch = input();
switch(ch) {
case 'j': //move down
iCurrentLine++;
if (iCurrentLine >= vMatchingItems.size()) {
iCurrentLine = 0;
}
break;
case 'k': //move up
iCurrentLine--;
if (iCurrentLine < 0) {
iCurrentLine = vMatchingItems.size()-1;
}
break;
}
} while(ch == 'j' || ch == 'k');
werase(w_test_rule_border);
werase(w_test_rule_content);
}
void load_auto_pickup(bool bCharacter)
{
std::ifstream fin;
std::string sFile = "data/auto_pickup.txt";
if (bCharacter) {
sFile = "save/" + g->u.name + ".apu.txt";
}
fin.open(sFile.c_str());
if(!fin.is_open()) {
fin.close();
create_default_auto_pickup(bCharacter);
fin.open(sFile.c_str());
if(!fin.is_open()) {
DebugLog() << "Could neither read nor create " << sFile << "\n";
return;
}
}
vAutoPickupRules[(bCharacter) ? 2 : 1].clear();
while(!fin.eof()) {
std::string sLine;
fin >> sLine;
if(sLine == "") { // Empty line, chomp it
getline(fin, sLine);
} else if(sLine[0] == '#') { // # indicates a comment
getline(fin, sLine);
} else {
int iNum = std::count(sLine.begin(), sLine.end(), ';');
if(iNum != 2) {
/*int iNum = std::count(sLine.begin(), sLine.end(), ' ');
if(iNum == 1) { //its an option! hurray
} else {*/
DebugLog() << "Bad Rule: " << sLine << "\n";
getline(fin, sLine);
//}
} else {
std::string sRule = "";
bool bActive = true;
bool bExclude = false;
int iPos = 0;
int iCol = 1;
do {
iPos = sLine.find(";");
std::string sTemp = (iPos == std::string::npos) ? sLine : sLine.substr(0, iPos);
if (iCol == 1) {
sRule = sTemp;
} else if (iCol == 2) {
bActive = (sTemp == "T" || sTemp == "True") ? true : false;
} else if (iCol == 3) {
bExclude = (sTemp == "T" || sTemp == "True") ? true : false;
}
iCol++;
if (iPos != std::string::npos) {
sLine = sLine.substr(iPos+1, sLine.size());
}
} while(iPos != std::string::npos);
vAutoPickupRules[(bCharacter) ? 2 : 1].push_back(cPickupRules(sRule, bActive, bExclude));
}
}
if(fin.peek() == '\n') {
getline(fin, sLine); // Chomp
}
}
fin.close();
merge_vector();
}
void merge_vector()
{
vAutoPickupRules[0].clear();
for (int i=1; i <= 2; i++) { //Loop through global 1 and character 2
for (int j=0; j < vAutoPickupRules[i].size(); j++) {
if (vAutoPickupRules[i][j].sRule != "") {
vAutoPickupRules[0].push_back(cPickupRules(vAutoPickupRules[i][j].sRule, vAutoPickupRules[i][j].bActive, vAutoPickupRules[i][j].bExclude));
}
}
}
}
void save_reset_changes(bool bReset)
{
for (int i=1; i <= 2; i++) { //Loop through global 1 and character 2
vAutoPickupRules[i + ((bReset) ? 0: 2)].clear();
for (int j=0; j < vAutoPickupRules[i + ((bReset) ? 2: 0)].size(); j++) {
if (vAutoPickupRules[i + ((bReset) ? 2: 0)][j].sRule != "") {
vAutoPickupRules[i + ((bReset) ? 0: 2)].push_back(cPickupRules(vAutoPickupRules[i + ((bReset) ? 2: 0)][j].sRule, vAutoPickupRules[i + ((bReset) ? 2: 0)][j].bActive, vAutoPickupRules[i + ((bReset) ? 2: 0)][j].bExclude));
}
}
}
merge_vector();
}
std::string auto_pickup_header(bool bCharacter)
{
std::string sTemp = (bCharacter) ? "character": "global";
return "# This is the " + sTemp + " auto pickup rules file. The format is\n\
# <pickup rule>;<dis/enabled>;<in/exclude>\n\n\
# <pickup rule> Simple text. No other special characters except spaces and *\n\
# <dis/enabled> Can be T(rue) of F(alse)\n\
# <in/exclude> Can be T(rue) of F(alse)\n\
#\n\
# If # is at the start of a line, it is considered a comment and is ignored.\n\
# In-line commenting is not allowed. I think.\n\
#\n\
# If you want to restore the default auto pickup rules file, simply delete this file.\n\
# A new auto_pickup.txt will be created next time you play.\
\n\n";
}
void save_auto_pickup(bool bCharacter)
{
std::ofstream fout;
std::string sFile = "data/auto_pickup.txt";
if (bCharacter) {
sFile = "save/" + g->u.name + ".apu.txt";
std::ifstream fin;
fin.open(("save/" + g->u.name + ".sav").c_str());
if(!fin.is_open()) {
return;
}
fin.close();
}
fout.open(sFile.c_str());
if(!fout.is_open()) {
return;
}
fout << auto_pickup_header(bCharacter) << std::endl;
for(int i = 0; i < vAutoPickupRules[(bCharacter) ? 2 : 1].size(); i++) {
fout << vAutoPickupRules[(bCharacter) ? 2 : 1][i].sRule << ";";
fout << (vAutoPickupRules[(bCharacter) ? 2 : 1][i].bActive ? "T" : "F") << ";";
fout << (vAutoPickupRules[(bCharacter) ? 2 : 1][i].bExclude ? "T" : "F");
fout << "\n";
}
if (!bCharacter) {
merge_vector();
}
}
void create_default_auto_pickup(bool bCharacter)
{
std::ofstream fout;
std::string sFile = "data/auto_pickup.txt";
if (bCharacter) {
sFile = "save/" + g->u.name + ".apu.txt";
}
fout.open(sFile.c_str());
if(!fout.is_open()) {
return;
}
fout << auto_pickup_header(bCharacter);
fout.close();
}
std::string trim_rule(std::string sPattern)
{
size_t iPos = 0;
//Remove all double ** in pattern
while((iPos = sPattern.find("**")) != std::string::npos) {
sPattern = sPattern.substr(0, iPos) + sPattern.substr(iPos+1, sPattern.length()-iPos-1);
}
return sPattern;
}
bool auto_pickup_match(std::string sText, std::string sPattern)
{
//case insenitive search
/* Possible patterns
*
wooD
wood*
*wood
Wood*aRrOW
wood*arrow*
*wood*arrow
*wood*hard* *x*y*z*arrow*
*/
if (sText == "") {
return false;
} else if (sText == "*") {
return true;
}
size_t iPos;
std::vector<std::string> vPattern;
sPattern = trim_rule(sPattern);
split(sPattern, '*', vPattern);
size_t iNum = vPattern.size();
if (iNum == 0) { //should never happen
return false;
} else if (iNum == 1) { // no * found
if (sText.length() == vPattern[0].length() && ci_find_substr(sText, vPattern[0]) != -1) {
return true;
}
return false;
}
for (int i=0; i < vPattern.size(); i++) {
if (i==0 && vPattern[i] != "") { //beginning: ^vPat[i]
if (sText.length() < vPattern[i].length() || ci_find_substr(sText.substr(0, vPattern[i].length()), vPattern[i]) == -1) {
//debugmsg(("1: sText: " + sText + " | sPattern: ^" + vPattern[i] + " | no match").c_str());
return false;
}
sText = sText.substr(vPattern[i].length(), sText.length()-vPattern[i].length());
} else if (i==vPattern.size()-1 && vPattern[i] != "") { //linenend: vPat[i]$
if (sText.length() < vPattern[i].length() || ci_find_substr(sText.substr(sText.length()-vPattern[i].length(), vPattern[i].length()), vPattern[i]) == -1) {
//debugmsg(("2: sText: " + sText + " | sPattern: " + vPattern[i] + "$ | no match").c_str());
return false;
}
} else { //inbetween: vPat[i]
if ((iPos = ci_find_substr(sText, vPattern[i])) == -1) {
//debugmsg(("3: sText: " + sText + " | sPattern: " + vPattern[i] + " | no match").c_str());
return false;
}
sText = sText.substr(iPos+vPattern[i].length(), sText.length()-iPos);
}
}
return true;
}
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
elems.clear();
while (std::getline(ss, item, delim)) {
elems.push_back(item);
}
if ( s.substr(s.length()-1, 1) == "*") {
elems.push_back("");
}
return elems;
}
/*
// string test
std::string str1 = "FIRST HELLO";
std::string str2 = "hello";
int f1 = ci_find_substr( str1, str2 );
// wstring test
std::wstring wstr1 = L"ОПЯТЬ ПРИВЕТ";
std::wstring wstr2 = L"привет";
int f2 = ci_find_substr( wstr1, wstr2 );
*/
// templated version of my_equal so it could work with both char and wchar_t
template<typename charT>
struct my_equal {
public:
my_equal( const std::locale& loc ) : loc_(loc) {}
bool operator()(charT ch1, charT ch2) {
return std::toupper(ch1, loc_) == std::toupper(ch2, loc_);
}
private:
const std::locale& loc_;
};
// find substring (case insensitive)
template<typename charT>
int ci_find_substr( const charT& str1, const charT& str2, const std::locale& loc )
{
typename charT::const_iterator it = std::search( str1.begin(), str1.end(), str2.begin(), str2.end(), my_equal<typename charT::value_type>(loc) );
if ( it != str1.end() ) return it - str1.begin();
else return -1; // not found
}
+46
View File
@@ -0,0 +1,46 @@
#ifndef _AUTO_PICKUP_H_
#define _AUTO_PICKUP_H_
#include <string>
#include <vector>
#include <locale>
#include <algorithm>
class cPickupRules {
public:
std::string sRule;
bool bActive;
bool bExclude;
cPickupRules() {
this->sRule = "";
this->bActive = false;
this->bExclude = false;
}
cPickupRules(std::string sRuleIn, bool bActiveIn, bool bExcludeIn) {
this->sRule = sRuleIn;
this->bActive = bActiveIn;
this->bExclude = bExcludeIn;
}
~cPickupRules() {};
};
extern std::vector<cPickupRules> vAutoPickupRules[5];
void test_pattern(int iCurrentPage, int iCurrentLine);
std::string trim_rule(std::string sPattern);
void merge_vector();
void save_reset_changes(bool bReset);
void show_auto_pickup();
void load_auto_pickup(bool bCharacter);
void save_auto_pickup(bool bCharacter);
std::string auto_pickup_header(bool bCharacter);
void create_default_auto_pickup(bool bCharacter);
bool auto_pickup_match(std::string sText, std::string sPattern);
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
template<typename charT>
int ci_find_substr( const charT& str1, const charT& str2, const std::locale& loc = std::locale() );
#endif
+173 -544
View File
@@ -5,7 +5,8 @@
#include "keypress.h"
#include "item.h"
#include "bionics.h"
#include "line.h"
#include "line.h"
#include "catajson.h"
#define BATTERY_AMOUNT 4 // How much batteries increase your power
@@ -47,7 +48,7 @@ void show_power_level_in_titlebar(WINDOW* window, player* p)
void player::power_bionics(game *g)
{
int HEIGHT = TERMY;
int WIDTH = 80;
int WIDTH = FULL_SCREEN_WIDTH;
int START_X = (TERMX - WIDTH)/2;
int START_Y = (TERMY - HEIGHT)/2;
WINDOW* wBio = newwin(HEIGHT, WIDTH, START_Y, START_X);
@@ -69,7 +70,7 @@ void player::power_bionics(game *g)
show_power_level_in_titlebar(wBio, this);
int HEADER_LINE_Y = START_Y + 2;
int DESCRIPTION_LINE_Y = DESCRIPTION_START_Y - 1;
int DESCRIPTION_LINE_Y = DESCRIPTION_START_Y - 1;
for (int i = 1; i < 79; i++) {
mvwputch(wBio, HEADER_LINE_Y, i, c_ltgray, LINE_OXOX); // Draw line under title
mvwputch(wBio, DESCRIPTION_LINE_Y, i, c_ltgray, LINE_OXOX); // Draw line above description
@@ -83,8 +84,7 @@ void player::power_bionics(game *g)
mvwputch(wBio, DESCRIPTION_LINE_Y, 79, c_ltgray, LINE_XOXX); // -|
for (int i = 0; i < my_bionics.size(); i++) {
if ( bionics[my_bionics[i].id]->power_source ||
!bionics[my_bionics[i].id]->activated )
if (!bionics[my_bionics[i].id]->activated)
passive.push_back(my_bionics[i]);
else
active.push_back(my_bionics[i]);
@@ -104,10 +104,15 @@ void player::power_bionics(game *g)
if (active.size() > 0) {
mvwprintz(wBio, 3, 33, c_ltblue, "Active:");
for (int i = 0; i < active.size(); i++) {
if (active[i].powered)
if (active[i].powered && !bionics[active[i].id]->power_source)
type = c_red;
else if (bionics[active[i].id]->power_source && !active[i].powered)
type = c_ltcyan;
else if (bionics[active[i].id]->power_source && active[i].powered)
type = c_ltgreen;
else
type = c_ltred;
mvwputch(wBio, 4 + i, 33, type, active[i].invlet);
mvwprintz(wBio, 4 + i, 35, type,
(active[i].powered ? "%s - ON" : "%s - %d PU / %d trns"),
@@ -210,7 +215,6 @@ void player::activate_bionic(int b, game *g)
std::vector<std::string> bad;
WINDOW* w;
int dirx, diry, t, l, index;
InputEvent input;
item tmp_item;
if(bio.id == "bio_painkiller"){
@@ -220,6 +224,9 @@ void player::activate_bionic(int b, game *g)
pkill = pain;
} else if (bio.id == "bio_nanobots"){
healall(4);
} else if (bio.id == "bio_night"){
if (g->turn % 5)
g->add_msg("Artificial night generator active!");
} else if (bio.id == "bio_resonator"){
g->sound(posx, posy, 30, "VRRRRMP!");
for (int i = posx - 1; i <= posx + 1; i++) {
@@ -244,51 +251,51 @@ void player::activate_bionic(int b, game *g)
hurt(g, bp_torso, 0, rng(5, 15));
}
if (one_in(5))
add_disease(DI_TELEGLOW, rng(50, 400), g);
add_disease("teleglow", rng(50, 400));
} else if (bio.id == "bio_teleport"){
g->teleport();
add_disease(DI_TELEGLOW, 300, g);
add_disease("teleglow", 300);
}
// TODO: More stuff here (and bio_blood_filter)
else if(bio.id == "bio_blood_anal"){
w = newwin(20, 40, 3 + ((TERMY > 25) ? (TERMY-25)/2 : 0), 10+((TERMX > 80) ? (TERMX-80)/2 : 0));
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
if (has_disease(DI_FUNGUS))
if (has_disease("fungus"))
bad.push_back("Fungal Parasite");
if (has_disease(DI_DERMATIK))
if (has_disease("dermatik"))
bad.push_back("Insect Parasite");
if (has_disease(DI_POISON))
if (has_disease("poison"))
bad.push_back("Poison");
if (radiation > 0)
bad.push_back("Irradiated");
if (has_disease(DI_PKILL1))
if (has_disease("pkill1"))
good.push_back("Minor Painkiller");
if (has_disease(DI_PKILL2))
if (has_disease("pkill2"))
good.push_back("Moderate Painkiller");
if (has_disease(DI_PKILL3))
if (has_disease("pkill3"))
good.push_back("Heavy Painkiller");
if (has_disease(DI_PKILL_L))
if (has_disease("pkill_l"))
good.push_back("Slow-Release Painkiller");
if (has_disease(DI_DRUNK))
if (has_disease("drunk"))
good.push_back("Alcohol");
if (has_disease(DI_CIG))
if (has_disease("cig"))
good.push_back("Nicotine");
if (has_disease(DI_METH))
if (has_disease("meth"))
good.push_back("Methamphetamines");
if (has_disease(DI_HIGH))
if (has_disease("high"))
good.push_back("Intoxicant: Other");
if (has_disease(DI_HALLU) || has_disease(DI_VISUALS))
if (has_disease("hallu") || has_disease("visuals"))
bad.push_back("Magic Mushroom");
if (has_disease(DI_IODINE))
if (has_disease("iodine"))
good.push_back("Iodine");
if (has_disease(DI_TOOK_XANAX))
if (has_disease("took_xanax"))
good.push_back("Xanax");
if (has_disease(DI_TOOK_PROZAC))
if (has_disease("took_prozac"))
good.push_back("Prozac");
if (has_disease(DI_TOOK_FLUMED))
if (has_disease("took_flumed"))
good.push_back("Antihistamines");
if (has_disease(DI_ADRENALINE))
if (has_disease("adrenaline"))
good.push_back("Adrenaline Spike");
if (good.size() == 0 && bad.size() == 0)
mvwprintz(w, 1, 1, c_white, "No effects.");
@@ -305,76 +312,53 @@ void player::activate_bionic(int b, game *g)
getch();
delwin(w);
} else if(bio.id == "bio_blood_filter"){
rem_disease(DI_FUNGUS);
rem_disease(DI_POISON);
rem_disease(DI_PKILL1);
rem_disease(DI_PKILL2);
rem_disease(DI_PKILL3);
rem_disease(DI_PKILL_L);
rem_disease(DI_DRUNK);
rem_disease(DI_CIG);
rem_disease(DI_HIGH);
rem_disease(DI_HALLU);
rem_disease(DI_VISUALS);
rem_disease(DI_IODINE);
rem_disease(DI_TOOK_XANAX);
rem_disease(DI_TOOK_PROZAC);
rem_disease(DI_TOOK_FLUMED);
rem_disease(DI_ADRENALINE);
rem_disease(DI_METH);
rem_disease("fungus");
rem_disease("poison");
rem_disease("pkill1");
rem_disease("pkill2");
rem_disease("pkill3");
rem_disease("pkill_l");
rem_disease("drunk");
rem_disease("cig");
rem_disease("high");
rem_disease("hallu");
rem_disease("visuals");
rem_disease("iodine");
rem_disease("took_xanax");
rem_disease("took_prozac");
rem_disease("took_flumed");
rem_disease("adrenaline");
rem_disease("meth");
pkill = 0;
stim = 0;
} else if(bio.id == "bio_evap"){
if (query_yn("Drink directly? Otherwise you will need a container.")) {
tmp_item = item(g->itypes["water_clean"], 0);
thirst -= 50;
if (has_trait(PF_GOURMAND) && thirst < -60) {
g->add_msg("You can't finish it all!");
thirst = -60;
} else if (!has_trait(PF_GOURMAND) && thirst < -20) {
g->add_msg("You can't finish it all!");
thirst = -20;
}
} else {
t = g->inv("Choose a container:");
if (i_at(t).type == 0) {
g->add_msg("You don't have that item!");
item water = item(g->itypes["water_clean"], 0);
if (g->handle_liquid(water, true, true))
{
moves -= 100;
}
else if (query_yn("Drink from your hands?"))
{
inv.push_back(water);
water = inv.item_by_type(water.typeId());
eat(g, water.invlet);
moves -= 350;
}
else
{
power_level += bionics["bio_evap"]->power_cost;
} else if (!i_at(t).is_container()) {
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
power_level += bionics["bio_evap"]->power_cost;
} else {
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
if (i_at(t).volume_contained() + 1 > cont->contains) {
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
power_level += bionics["bio_evap"]->power_cost;
} else if (!(cont->flags & con_wtight)) {
g->add_msg("Your %s isn't watertight!", i_at(t).tname().c_str());
power_level += bionics["bio_evap"]->power_cost;
} else {
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
i_at(t).put_in(item(g->itypes["water_clean"], 0));
}
}
}
} else if(bio.id == "bio_lighter"){
g->draw();
mvprintw(0, 0, "Torch in which direction?");
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics["bio_lighter"]->power_cost;
return;
if(!g->choose_adjacent("Start a fire", dirx, diry) ||
(!g->m.add_field(g, dirx, diry, fd_fire, 1))){
g->add_msg_if_player(this,"You can't light a fire there.");
power_level += bionics["bio_lighter"]->power_cost;
}
dirx += posx;
diry += posy;
if (!g->m.add_field(g, dirx, diry, fd_fire, 1)) // Unsuccessful.
g->add_msg("You can't light a fire there.");
} else if(bio.id == "bio_claws"){
if (weapon.type->id == "bio_claws_weapon") {
g->add_msg("You withdraw your claws.");
weapon = ret_null;
weapon = get_combat_style();
} else if(weapon.type->id != "null"){
g->add_msg("Your claws extend, forcing you to drop your %s.",
weapon.tname().c_str());
@@ -403,47 +387,38 @@ void player::activate_bionic(int b, game *g)
g->plfire(false);
weapon = tmp_item;
} else if (bio.id == "bio_emp"){
g->draw();
mvprintw(0, 0, "Fire EMP in which direction?");
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
if(g->choose_adjacent("create an EMP", dirx, diry))
g->emp_blast(dirx, diry);
else{
power_level += bionics["bio_emp"]->power_cost;
return;
}
dirx += posx;
diry += posy;
g->emp_blast(dirx, diry);
} else if (bio.id == "bio_hydraulics"){
g->add_msg("Your muscles hiss as hydraulic strength fills them!");
} else if (bio.id == "bio_water_extractor"){
bool extracted = false;
for (int i = 0; i < g->m.i_at(posx, posy).size(); i++) {
item tmp = g->m.i_at(posx, posy)[i];
if (tmp.type->id == "corpse" && query_yn("Extract water from the %s",
tmp.tname().c_str())) {
i = g->m.i_at(posx, posy).size() + 1; // Loop is finished
t = g->inv("Choose a container:");
if (i_at(t).type == 0) {
g->add_msg("You don't have that item!");
power_level += bionics["bio_water_extractor"]->power_cost;
} else if (!i_at(t).is_container()) {
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
power_level += bionics["bio_water_extractor"]->power_cost;
} else {
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
if (i_at(t).volume_contained() + 1 > cont->contains) {
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
power_level += bionics["bio_water_extractor"]->power_cost;
} else {
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
i_at(t).put_in(item(g->itypes["water"], 0));
}
item water = item(g->itypes["water_clean"], 0);
if (g->handle_liquid(water, true, true))
{
moves -= 100;
}
else if (query_yn("Drink directly from the condensor?"))
{
inv.push_back(water);
water = inv.item_by_type(water.typeId());
eat(g, water.invlet);
moves -= 350;
}
extracted = true;
break;
}
if (i == g->m.i_at(posx, posy).size() - 1) // We never chose a corpse
power_level += bionics["bio_water_extractor"]->power_cost;
}
if (!extracted)
power_level += bionics["bio_water_extractor"]->power_cost;
} else if(bio.id == "bio_magnet"){
for (int i = posx - 10; i <= posx + 10; i++) {
for (int j = posy - 10; j <= posy + 10; j++) {
@@ -481,208 +456,81 @@ void player::activate_bionic(int b, game *g)
}
}
} else if(bio.id == "bio_lockpick"){
g->draw();
mvprintw(0, 0, "Unlock in which direction?");
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
if(!g->choose_adjacent("Activate your bio lockpick", dirx, diry)){
power_level += bionics["bio_lockpick"]->power_cost;
return;
}
dirx += posx;
diry += posy;
if (g->m.ter(dirx, diry) == t_door_locked) {
moves -= 40;
g->add_msg("You unlock the door.");
g->add_msg_if_player(this,"You unlock the door.");
g->m.ter_set(dirx, diry, t_door_c);
} else
g->add_msg("You can't unlock that %s.", g->m.tername(dirx, diry).c_str());
g->add_msg_if_player(this,"You can't unlock that %s.", g->m.tername(dirx, diry).c_str());
} else if(bio.id == "bio_flashbang") {
g->add_msg_if_player(this,"You activate your integrated flashbang generator!");
g->flashbang(posx, posy, true);
} else if(bio.id == "bio_shockwave") {
g->shockwave(posx, posy, 3, 4, 2, 8, true);
g->add_msg_if_player(this,"You unleash a powerful shockwave!");
} else if(bio.id == "bio_chain_lightning"){
tmp_item = weapon;
weapon = item(g->itypes["bio_lightning"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["bio_lightning_ammo"]);
weapon.charges = 10;
g->refresh_all();
g->plfire(false);
weapon = tmp_item;
}
}
bool player::install_bionics(game *g, it_bionic* type)
{
if (type == NULL) {
debugmsg("Tried to install NULL bionic");
return false;
}
if (has_bionic(type->id)){
if (!(type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII")){
popup("You have already installed this bionic.");
return false;
}
}
std::string bio_name = type->name.substr(5); // Strip off "CBM: "
WINDOW* w = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
WINDOW* w_description = newwin(3, 78, 21 + getbegy(w), 1 + getbegx(w));
werase(w);
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
int pl_skill = int_cur +
skillLevel("electronics") * 4 +
skillLevel("firstaid") * 3 +
skillLevel("mechanics") * 2;
int skint = int(pl_skill / 4);
int skdec = int((pl_skill * 10) / 4) % 10;
// Header text
mvwprintz(w, 1, 1, c_white, "Installing bionics:");
mvwprintz(w, 1, 21, type->color, bio_name.c_str());
// Dividing bars
for (int i = 1; i < 79; i++) {
mvwputch(w, 2, i, c_ltgray, LINE_OXOX);
mvwputch(w, 20, i, c_ltgray, LINE_OXOX);
}
mvwputch(w, 2, 0, c_ltgray, LINE_XXXO); // |-
mvwputch(w, 2, 79, c_ltgray, LINE_XOXX); // -|
mvwputch(w, 20, 0, c_ltgray, LINE_XXXO); // |-
mvwputch(w, 20, 79, c_ltgray, LINE_XOXX); // -|
// Init the list of bionics
for (int i = 1; i < type->options.size(); i++) {
bionic_id bio_id = type->options[i];
mvwprintz(w, i + 3, 1, (has_bionic(bio_id) ? c_ltred : c_ltblue),
bionics[bio_id]->name.c_str());
}
// Helper text
mvwprintz(w, 3, 39, c_white, "Difficulty of this module: %d",
type->difficulty);
mvwprintz(w, 4, 39, c_white, "Your installation skill: %d.%d",
skint, skdec);
mvwprintz(w, 5, 39, c_white, "Installation requires high intelligence,");
mvwprintz(w, 6, 39, c_white, "and skill in electronics, first aid, and");
mvwprintz(w, 7, 39, c_white, "mechanics (in that order of importance).");
int chance_of_success = int((100 * pl_skill) /
(pl_skill + 4 * type->difficulty));
mvwprintz(w, 9, 39, c_white, "Chance of success:");
nc_color col_suc;
if (chance_of_success >= 95)
col_suc = c_green;
else if (chance_of_success >= 80)
col_suc = c_ltgreen;
else if (chance_of_success >= 60)
col_suc = c_yellow;
else if (chance_of_success >= 35)
col_suc = c_ltred;
else
col_suc = c_red;
mvwprintz(w, 9, 59, col_suc, "%d%%%%", chance_of_success);
mvwprintz(w, 11, 39, c_white, "Failure may result in crippling damage,");
mvwprintz(w, 12, 39, c_white, "loss of existing bionics, genetic damage");
mvwprintz(w, 13, 39, c_white, "or faulty installation.");
wrefresh(w);
if (type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII") { // No selection list; just confirm
int pow_up = BATTERY_AMOUNT;
if (!query_yn("WARNING: %i percent chance of genetic damage, blood loss, or damage to existing bionics! Install anyway?", 100 - chance_of_success))
return false;
int pow_up = 0;
if (type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII") {
pow_up = BATTERY_AMOUNT;
if (type->id == "bio_power_storage_mkII") {
pow_up = 10;
}
mvwprintz(w, 3, 1, h_ltblue, "Power Storage +%d", pow_up);
mvwprintz(w_description, 0, 0, c_ltblue, "\
Installing this bionic will increase your total power storage by %d.\n\
Power is necessary for most bionics to function. You also require a\n\
charge mechanism, which must be installed from another CBM.", pow_up);
InputEvent input;
wrefresh(w_description);
wrefresh(w);
do
input = get_input();
while (input != Confirm && input != Cancel);
if (input == Confirm) {
practice(g->turn, "electronics", (100 - chance_of_success) * 1.5);
practice(g->turn, "firstaid", (100 - chance_of_success) * 1.0);
practice(g->turn, "mechanics", (100 - chance_of_success) * 0.5);
int success = chance_of_success - rng(1, 100);
if (success > 0) {
g->add_msg("Successfully installed batteries.");
max_power_level += pow_up;
} else
bionics_install_failure(g, this, success);
werase(w);
delwin(w);
g->refresh_all();
return true;
}
werase(w);
delwin(w);
g->refresh_all();
return false;
}
int selection = 0;
InputEvent input;
do {
bionic_id bio_id = type->options[selection];
mvwprintz(w, 3 + selection, 1, (has_bionic(bio_id) ? h_ltred : h_ltblue),
bionics[bio_id]->name.c_str());
// Clear the bottom three lines...
werase(w_description);
// ...and then fill them with the description of the selected bionic
mvwprintz(w_description, 0, 0, c_ltblue, bionics[bio_id]->description.c_str());
wrefresh(w_description);
wrefresh(w);
input = get_input();
switch (input) {
case DirectionS:
mvwprintz(w, 2 + selection, 0, (has_bionic(bio_id) ? c_ltred : c_ltblue),
bionics[bio_id]->name.c_str());
if (selection == type->options.size() - 1)
selection = 0;
else
selection++;
break;
case DirectionN:
mvwprintz(w, 2 + selection, 0, (has_bionic(bio_id) ? c_ltred : c_ltblue),
bionics[bio_id]->name.c_str());
if (selection == 0)
selection = type->options.size() - 1;
else
selection--;
break;
}
if (input == Confirm && has_bionic(bio_id)) {
popup("You already have a %s!", bionics[bio_id]->name.c_str());
input = Nothing;
}
} while (input != Cancel && input != Confirm);
if (input == Confirm) {
practice(g->turn, "electronics", (100 - chance_of_success) * 1.5);
practice(g->turn, "firstaid", (100 - chance_of_success) * 1.0);
practice(g->turn, "mechanics", (100 - chance_of_success) * 0.5);
bionic_id bio_id = type->options[selection];
int success = chance_of_success - rng(1, 100);
if (success > 0) {
g->add_msg("Successfully installed %s.", bionics[bio_id]->name.c_str());
add_bionic(bio_id);
} else
bionics_install_failure(g, this, success);
werase(w);
delwin(w);
g->refresh_all();
return true;
}
werase(w);
delwin(w);
practice(g->turn, "electronics", (100 - chance_of_success) * 1.5);
practice(g->turn, "firstaid", (100 - chance_of_success) * 1.0);
practice(g->turn, "mechanics", (100 - chance_of_success) * 0.5);
int success = chance_of_success - rng(1, 100);
if (success > 0) {
if (pow_up) {
max_power_level += pow_up;
g->add_msg_if_player(this, "Increased storage capacity by %i", pow_up);
} else{
g->add_msg("Successfully installed %s.", bionics[type->id]->name.c_str());
add_bionic(type->id);
}
} else
bionics_install_failure(g, this, success);
g->refresh_all();
return false;
return true;
}
void bionics_install_failure(game *g, player *u, int success)
@@ -772,269 +620,50 @@ void bionics_install_failure(game *g, player *u, int success)
}
void game::init_bionics(){
bionics["bio_null"] = new bionic_data("NULL bionics", false, false, 0, 0, "\
If you're seeing this, it's a bug. (game::init_bionics)");
// NAME ,PW_SRC, ACT ,COST, TIME,
bionics["bio_batteries"] = new bionic_data("Battery System", true, false, 0, 0, "\
You have a battery draining attachment, and thus can make use of the energy\n\
contained in normal, everyday batteries. Use 'E' to consume batteries.");
power_source_bionics.push_back("bio_batteries");
bionics["bio_metabolics"] = new bionic_data("Metabolic Interchange", true, false, 0, 0, "\
Your digestive system and power supply are interconnected. Any drain on\n\
energy instead increases your hunger.");
power_source_bionics.push_back("bio_metabolics");
bionics["bio_solar"] = new bionic_data("Solar Panels", true, false, 0, 0, "\
You have a few solar panels installed. While in direct sunlight, your power\n\
level will slowly recharge.");
power_source_bionics.push_back("bio_solar");
bionics["bio_torsionratchet"] = new bionic_data("Joint Torsion Ratchet", true, false, 0, 0, "\
Your joints have been equipped with torsion ratchets that generate power slowly\n\
when you move.");
power_source_bionics.push_back("bio_torsionratchet");
bionics["bio_furnace"] = new bionic_data("Internal Furnace", true, false, 0, 0, "\
You can burn nearly any organic material as fuel (use 'E'), recharging your\n\
power level. Some materials will burn better than others.");
power_source_bionics.push_back("bio_furnace");
bionics["bio_ethanol"] = new bionic_data("Ethanol Burner", true, false, 0, 0, "\
You burn alcohol as fuel in an extremely efficient reaction. However, you\n\
will still suffer the inebriating effects of the substance.");
power_source_bionics.push_back("bio_ethanol");
bionics["bio_memory"] = new bionic_data("Enhanced Memory Banks", false, false, 1, 0, "\
Your memory has been enhanced with small quantum storage drives. Any time\n\
you start to forget a skill, you have a chance at retaining all knowledge, at\n\
the cost of a small amount of poweron.");
unpowered_bionics.push_back("bio_memory");
bionics["bio_ears"] = new bionic_data("Enhanced Hearing", false, false, 0, 0, "\
Your hearing has been drastically improved, allowing you to hear ten times\n\
better than the average person. Additionally, high-intensity sounds will be\n\
automatically dampened before they can damage your hearing.");
unpowered_bionics.push_back("bio_ears");
void game::init_bionics()
{
catajson bionics_file("data/raw/bionics.json");
bionics["bio_eye_enhancer"] = new bionic_data("Diamond Cornea", false, false, 0, 0, "\
Your vision is greatly enhanced, giving you a +2 bonus to perception.");
unpowered_bionics.push_back("bio_eye_enhancer");
bionics["bio_membrane"] = new bionic_data("Nictating Membrane", false, false, 0, 0, "\
Your eyes have a thin membrane that closes over your eyes while underwater,\n\
negating any vision penalties.");
unpowered_bionics.push_back("bio_membrane");
bionics["bio_targeting"] = new bionic_data("Targeting System", false, false, 0, 0, "\
Your eyes are equipped with range finders, and their movement is synced with\n\
that of your arms, to a degree. Shots you fire will be much more accurate,\n\
particularly at long range.");
unpowered_bionics.push_back("bio_targeting");
bionics["bio_gills"] = new bionic_data("Membrane Oxygenator", false, false, 1, 0, "\
An oxygen interchange system automatically switches on while underwater,\n\
slowly draining your energy reserves but providing oxygen.");
unpowered_bionics.push_back("bio_gills");
bionics["bio_purifier"] = new bionic_data("Air Filtration System", false, false, 1, 0, "\
Implanted in your trachea is an advanced filtration system. If toxins find\n\
their way into your windpipe, the filter will attempt to remove them.");
unpowered_bionics.push_back("bio_purifier");
bionics["bio_climate"] = new bionic_data("Internal Climate Control", false, true, 1, 30, "\
Throughout your body lies a network of thermal piping which eases the effects\n\
of high and low ambient temperatures.");
unpowered_bionics.push_back("bio_climate");
for(bionics_file.set_begin(); bionics_file.has_curr(); bionics_file.next())
{
catajson bio = bionics_file.curr();
bionics["bio_storage"] = new bionic_data("Internal Storage", false, false, 0, 0, "\
Space inside your chest cavity has been converted into a storage area. You\n\
may carry an extra 8 units of volume.");
unpowered_bionics.push_back("bio_storage");
bionics["bio_recycler"] = new bionic_data("Recycler Unit", false, false, 0, 0, "\
Your digestive system has been outfitted with a series of filters and\n\
processors, allowing you to reclaim waste liquid and, to a lesser degree,\n\
nutrients. The net effect is a greatly reduced need to eat and drink.");
unpowered_bionics.push_back("bio_recycler");
bionics["bio_digestion"] = new bionic_data("Expanded Digestive System", false, false, 0, 0, "\
You have been outfitted with three synthetic stomachs and industrial-grade\n\
intestines. Not only can you extract much more nutrition from food, but you\n\
are highly resistant to foodborne illness, and can sometimes eat rotten food.");
unpowered_bionics.push_back("bio_digestion");
bionics["bio_tools"] = new bionic_data("Integrated Toolset", false, false, 0, 0, "\
Implanted in your hands and fingers is a complete tool set - screwdriver,\n\
hammer, wrench, and heating elements. You can use this in place of many\n\
tools when crafting.");
unpowered_bionics.push_back("bio_tools");
bionics["bio_shock"] = new bionic_data("Electroshock Unit", false, false, 1, 0, "\
While fighting unarmed, or with a weapon that conducts electricity, there is\n\
a chance that a successful hit will shock your opponent, inflicting extra\n\
damage and disabling them temporarily at the cost of some energy.");
unpowered_bionics.push_back("bio_shock");
bionics["bio_heat_absorb"] = new bionic_data("Heat Drain", false, false, 1, 0, "\
While fighting unarmed against a warm-blooded opponent, there is a chance\n\
that a successful hit will drain body heat, inflicting a small amount of\n\
extra damage, and increasing your power reserves slightly.");
unpowered_bionics.push_back("bio_heat_absorb");
bionics["bio_carbon"] = new bionic_data("Subdermal Carbon Filament", false, false, 0, 0, "\
Lying just beneath your skin is a thin armor made of carbon nanotubes. This\n\
reduces bashing damage by 2 and cutting damage by 4.");
unpowered_bionics.push_back("bio_carbon");
bionics["bio_armor_head"] = new bionic_data("Alloy Plating - Head", false, false, 0, 0, "\
The flesh on your head has been replaced by a strong armor, protecting both\n\
your head and jaw regions.");
unpowered_bionics.push_back("bio_armor_head");
bionics["bio_armor_torso"] = new bionic_data("Alloy Plating - Torso", false, false, 0, 0, "\
The flesh on your torso has been replaced by a strong armor, protecting you\n\
greatly.");
unpowered_bionics.push_back("bio_armor_torso");
bionics["bio_armor_arms"] = new bionic_data("Alloy Plating - Arms", false, false, 0, 0, "\
The flesh on your arms has been replaced by a strong armor, protecting you\n\
greatly.");
unpowered_bionics.push_back("bio_armor_arms");
bionics["bio_armor_legs"] = new bionic_data("Alloy Plating - Legs", false, false, 0, 0, "\
The flesh on your legs has been replaced by a strong armor, protecting you\n\
greatly.");
unpowered_bionics.push_back("bio_armor_legs");
std::set<std::string> tags;
bionics["bio_flashlight"] = new bionic_data("Cranial Flashlight", false, true, 1, 30, "\
Mounted between your eyes is a small but powerful LED flashlight.");
bionics["bio_night_vision"] = new bionic_data("Implanted Night Vision", false, true, 1, 20, "\
Your eyes have been modified to amplify existing light, allowing you to see\n\
in the dark.");
bionics["bio_infrared"] = new bionic_data("Infrared Vision", false, true, 1, 4, "\
Your range of vision extends into the infrared, allowing you to see warm-\n\
blooded creatures in the dark, and even through walls.");
bionics["bio_face_mask"] = new bionic_data("Facial Distortion", false, true, 1, 10, "\
Your face is actually made of a compound which may be molded by electrical\n\
impulses, making you impossible to recognize. While not powered, however,\n\
the compound reverts to its default shape.");
bionics["bio_ads"] = new bionic_data("Active Defense System", false, true, 1, 7, "\
A thin forcefield surrounds your body, continually draining power. Anything\n\
attempting to penetrate this field has a chance of being deflected at the\n\
cost of more energy. Melee attacks will be stopped more often than bullets.");
bionics["bio_ods"] = new bionic_data("Offensive Defense System", false, true, 1, 6, "\
A thin forcefield surrounds your body, continually draining power. This\n\
field does not deflect penetration, but rather delivers a very strong shock,\n\
damaging unarmed attackers and those with a conductive weapon.");
bionics["bio_scent_mask"] = new bionic_data("Olfactory Mask", false, true, 1, 8, "\
While this system is powered, your body will produce very little odor, making\n\
it nearly impossible for creatures to track you by scent.");
if(bio.has("flags"))
{
tags = bio.get("flags").as_tags();
}
bionics["bio_scent_vision"] = new bionic_data("Scent Vision", false, true, 1, 30, "\
While this system is powered, you're able to visually sense your own scent,\n\
making it possible for you to recognize your surroundings even if you can't\n\
see it.");
bionics["bio_cloak"] = new bionic_data("Cloaking System", false, true, 2, 1, "\
This high-power system uses a set of cameras and LEDs to make you blend into\n\
your background, rendering you fully invisible to normal vision. However,\n\
you may be detected by infrared, sonar, etc.");
bionics["bio_painkiller"] = new bionic_data("Sensory Dulling", false, true, 2, 0, "\
Your nervous system is wired to allow you to inhibit the signals of pain,\n\
allowing you to dull your senses at will. However, the use of this system\n\
may cause delayed reaction time and drowsiness.");
bionics["bio_nanobots"] = new bionic_data("Repair Nanobots", false, true, 5, 0, "\
Inside your body is a fleet of tiny dormant robots. Once charged from your\n\
energy banks, they will flit about your body, repairing any damage.");
bionics["bio_heatsink"] = new bionic_data("Thermal Dissipation", false, true, 1, 6, "\
Powerful heatsinks supermaterials are woven into your flesh. While powered,\n\
this system will prevent heat damage up to 2000 degrees fahrenheit. Note\n\
that this does not affect your internal temperature.");
bionics["bio_resonator"] = new bionic_data("Sonic Resonator", false, true, 4, 0, "\
Your entire body may resonate at very high power, creating a short-range\n\
shockwave. While it will not to much damage to flexible creatures, stiff\n\
items such as walls, doors, and even robots will be severely damaged.");
// set up all the bionic parameters
std::string id = bio.get("id").as_string();
std::string name = bio.get("name").as_string();
int cost = bio.get("cost").as_int();
int time = bio.get("time").as_int();
std::string description = bio.get("description").as_string();
bool faulty = (tags.find("FAULTY") != tags.end());
bool powersource = (tags.find("POWER") != tags.end());
bool active = (tags.find("ACTIVE") != tags.end());
bionics["bio_time_freeze"] = new bionic_data("Time Dilation", false, true, 3, 0, "\
At an immense cost of power, you may increase your body speed and reactions\n\
dramatically, essentially freezing time. You are still delicate, however,\n\
and violent or rapid movements may damage you due to friction.");
bionics["bio_teleport"] = new bionic_data("Teleportation Unit", false, true, 10, 0, "\
This highly experimental unit folds space over short distances, instantly\n\
transporting your body up to 25 feet at the cost of much power. Note that\n\
prolonged or frequent use may have dangerous side effects.");
bionics["bio_blood_anal"] = new bionic_data("Blood Analysis", false, true, 1, 0, "\
Small sensors have been implanted in your heart, allowing you to analyse your\n\
blood. This will detect many illnesses, drugs, and other conditions.");
bionics["bio_blood_filter"] = new bionic_data("Blood Filter", false, true, 3, 0, "\
A filtration system in your heart allows you to actively filter out chemical\n\
impurities, primarily drugs. It will have limited impact on viruses. Note\n\
that it is not a targeted filter; ALL drugs in your system will be affected.");
bionics["bio_alarm"] = new bionic_data("Alarm System", false, true, 1, 400, "\
A motion-detecting alarm system will notice almost all movement within a\n\
fifteen-foot radius, and will silently alert you. This is very useful during\n\
sleep, or if you suspect a cloaked pursuer.");
bionics["bio_evap"] = new bionic_data("Aero-Evaporator", false, true, 8, 0, "\
This unit draws moisture from the surrounding air, which then is poured from\n\
a fingertip in the form of water. It may fail in very dry environments.");
bionics["bio_lighter"] = new bionic_data("Mini-Flamethrower", false, true, 3, 0, "\
The index fingers of both hands have powerful fire starters which extend from\n\
the tip.");
bionics["bio_claws"] = new bionic_data("Adamantium Claws", false, true, 3, 0, "\
Your fingers can withdraw into your hands, allowing a set of vicious claws to\n\
extend. These do considerable cutting damage, but prevent you from holding\n\
anything else.");
bionics[id] = new bionic_data(name, powersource, active, cost, time, description, faulty);
bionics["bio_blaster"] = new bionic_data("Fusion Blaster Arm", false, true, 2, 0, "\
Your left arm has been replaced by a heavy-duty fusion blaster! You may use\n\
your energy banks to fire a damaging heat ray; however, you are unable to use\n\
or carry two-handed items, and may only fire handguns.");
bionics["bio_laser"] = new bionic_data("Finger-Mounted Laser", false, true, 2, 0, "\
One of your fingers has a small high-powered laser embedded in it. This long\n\
range weapon is not incredibly damaging, but is very accurate, and has the\n\
potential to start fires.");
bionics["bio_emp"] = new bionic_data("Directional EMP", false, true, 4, 0, "\
Mounted in the palms of your hand are small parabolic EMP field generators.\n\
You may use power to fire a short-ranged blast which will disable electronics\n\
and robots.");
bionics["bio_hydraulics"] = new bionic_data("Hydraulic Muscles", false, true, 1, 3, "\
While activated, the muscles in your arms will be greatly enchanced,\n\
increasing your strength by 20.");
bionics["bio_water_extractor"] = new bionic_data("Water Extraction Unit", false, true, 2, 0, "\
Nanotubes embedded in the palm of your hand will pump any available fluid out\n\
of a dead body, cleanse it of impurities and convert it into drinkable water.\n\
You must, however, have a container to store the water in.");
bionics["bio_magnet"] = new bionic_data("Electromagnetic Unit", false, true, 2, 0, "\
Embedded in your hand is a powerful electromagnet, allowing you to pull items\n\
made of iron over short distances.");
bionics["bio_fingerhack"] = new bionic_data("Fingerhack", false, true, 1, 0, "\
One of your fingers has an electrohack embedded in it; an all-purpose hacking\n\
unit used to override control panels and the like (but not computers). Skill\n\
in computers is important, and a failed use may damage your circuits.");
bionics["bio_lockpick"] = new bionic_data("Fingerpick", false, true, 1, 0, "\
One of your fingers has an electronic lockpick embedded in it. This auto-\n\
matic system will quickly unlock all but the most advanced key locks without\n\
any skill required on the part of the user.");
// Don't add bio_null to any vectors.
if(id != "bio_null")
{
if(faulty)
{
faulty_bionics.push_back(id);
}
else if(powersource)
{
power_source_bionics.push_back(id);
}
else if(!active)
{
unpowered_bionics.push_back(id);
}
}
bionics["bio_ground_sonar"] = new bionic_data("Terranian Sonar", false, true, 1, 5, "\
Your feet are equipped with precision sonar equipment, allowing you to detect\n\
the movements of creatures below the ground.");
bionics["bio_power_armor_interface"] = new bionic_data("Power Armor Interface", false, true, 1, 10, "\
Interfaces your power system with the internal charging port on suits of power armor.");
bionics["bio_power_armor_interface_mkII"] = new bionic_data("Power Armor Interface Mk. II", false, true, 1, 50, "\
Interfaces your power system with the internal charging port on suits of power armor.\n\
The Mk. II was designed by DoubleTech Inc., to meet the popularity of the Mk. II\n\
power armor series.");
//Fault Bionics from here on out.
bionics["bio_dis_shock"] = new bionic_data("Electrical Discharge", false, false, 0, 0, "\
A malfunctioning bionic which occasionally discharges electricity through\n\
your body, causing pain and brief paralysis but no damage.",true);
faulty_bionics.push_back("bio_dis_shock");
bionics["bio_dis_acid"] = new bionic_data("Acidic Discharge", false, false, 0, 0, "\
A malfunctioning bionic which occasionally discharges acid into your muscles,\n\
causing sharp pain and minor damage.",true);
faulty_bionics.push_back("bio_dis_shock");
bionics["bio_drain"] = new bionic_data("Electrical Drain", false, false, 0, 0, "\
A malfunctioning bionic. It doesn't perform any useful function, but will\n\
occasionally draw power from your batteries.",true);
faulty_bionics.push_back("bio_drain");
bionics["bio_noise"] = new bionic_data("Noisemaker", false, false, 0, 0, "\
A malfunctioning bionic. It will occasionally emit a loud burst of noise.",true);
faulty_bionics.push_back("bio_noise");
bionics["bio_power_weakness"] = new bionic_data("Power Overload", false, false, 0, 0, "\
Damaged power circuits cause short-circuiting inside your muscles when your\n\
batteries are above 75%%%% capacity, causing greatly reduced strength. This\n\
has no effect if you have no internal batteries.",true);
faulty_bionics.push_back("bio_power_weakness");
bionics["bio_stiff"] = new bionic_data("Wire-induced Stiffness", false, false, 0, 0, "\
Improperly installed wires cause a physical stiffness in most of your body,\n\
causing increased encumberance.",true);
faulty_bionics.push_back("bio_stiff");
}
}
+5 -5
View File
@@ -124,7 +124,7 @@ void mapgen_crater(map *m, mapgendata dat)
}
}
}
m->place_items(mi_wreckage, 83, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, 0);
m->place_items("wreckage", 83, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, 0);
}
void mapgen_field(map *m, int turn)
@@ -151,10 +151,10 @@ void mapgen_field(map *m, int turn)
}
}
else
if (one_in(1000)) { m->ter_set(i,j, t_mutpoppy); }
if (one_in(1000)) { m->furn_set(i,j, f_mutpoppy); }
}
}
m->place_items(mi_field, 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
m->place_items("field", 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
}
void mapgen_dirtlot(map *m, game *g)
@@ -268,7 +268,7 @@ void mapgen_forest_general(map *m, oter_id terrain_type, mapgendata dat, int tur
}
}
}
m->place_items(mi_forest, 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
m->place_items("forest", 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
if (terrain_type == ot_forest_water)
{
@@ -366,7 +366,7 @@ void mapgen_forest_general(map *m, oter_id terrain_type, mapgendata dat, int tur
}
}
if (one_in(300)) { //rare, very bad day for low level characters
if (one_in(10000)) { //1-2 per overmap, very bad day for low level characters
m->add_spawn(mon_jabberwock, 1, SEEX, SEEY);
}
+5
View File
@@ -198,6 +198,11 @@ void calendar::increment()
standardize();
}
int calendar::getHour()
{
return hour;
}
void calendar::standardize()
{
if (second >= 60) {
+2
View File
@@ -75,6 +75,8 @@ public:
void standardize(); // Ensure minutes <= 59, hour <= 23, etc.
int getHour(); // return hour
// Sunlight and day/night calcuations
int minutes_past_midnight() const; // Useful for sunrise/set calculations
moon_phase moon() const; // Find phase of moon
+207
View File
@@ -0,0 +1,207 @@
#include "catacharset.h"
#include <string.h>
#include "wcwidth.c"
//copied from SDL2_ttf code
unsigned UTF8_getch(const char **src, int *srclen)
{
const unsigned char *p = *(const unsigned char**)src;
int left = 0;
bool overlong = false;
bool underflow = false;
unsigned ch = UNKNOWN_UNICODE;
if (*srclen == 0) {
return UNKNOWN_UNICODE;
}
if (p[0] >= 0xFC) {
if ((p[0] & 0xFE) == 0xFC) {
if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) {
overlong = true;
}
ch = (unsigned) (p[0] & 0x01);
left = 5;
}
} else if (p[0] >= 0xF8) {
if ((p[0] & 0xFC) == 0xF8) {
if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) {
overlong = true;
}
ch = (unsigned) (p[0] & 0x03);
left = 4;
}
} else if (p[0] >= 0xF0) {
if ((p[0] & 0xF8) == 0xF0) {
if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) {
overlong = true;
}
ch = (unsigned) (p[0] & 0x07);
left = 3;
}
} else if (p[0] >= 0xE0) {
if ((p[0] & 0xF0) == 0xE0) {
if (p[0] == 0xE0 && (p[1] & 0xE0) == 0x80) {
overlong = true;
}
ch = (unsigned) (p[0] & 0x0F);
left = 2;
}
} else if (p[0] >= 0xC0) {
if ((p[0] & 0xE0) == 0xC0) {
if ((p[0] & 0xDE) == 0xC0) {
overlong = true;
}
ch = (unsigned) (p[0] & 0x1F);
left = 1;
}
} else {
if ((p[0] & 0x80) == 0x00) {
ch = (unsigned) p[0];
}
}
++*src;
--*srclen;
while (left > 0 && *srclen > 0) {
++p;
if ((p[0] & 0xC0) != 0x80) {
ch = UNKNOWN_UNICODE;
break;
}
ch <<= 6;
ch |= (p[0] & 0x3F);
++*src;
--*srclen;
--left;
}
if (left > 0) {
underflow = true;
}
if (overlong || underflow ||
(ch >= 0xD800 && ch <= 0xDFFF) ||
(ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
ch = UNKNOWN_UNICODE;
}
return ch;
}
//Calculate width of a unicode string
//Latin characters have a width of 1
//CJK characters have a width of 2, etc
int utf8_width(const char* s)
{
int len = strlen(s);
const char* ptr = s;
int w = 0;
while(len>0)
{
unsigned ch = UTF8_getch(&ptr, &len);
if(ch!=UNKNOWN_UNICODE) {
w += mk_wcwidth((wchar_t)ch);
} else {
continue;
}
}
return w;
}
//Convert cursor position to byte offset
//returns the first character position in bytes behind the cursor position.
//If the cursor is not on the first half of the character,
//prevpos (which points to the first byte of the cursor located char)
// should be a different value.
int cursorx_to_position(const char* line, int cursorx, int* prevpos)
{
int dummy;
int i=0, c=0, *p=prevpos?prevpos:&dummy;
*p = 0;
while(c<cursorx)
{
const char* utf8str = line+i;
int len = ANY_LENGTH;
unsigned ch = UTF8_getch(&utf8str, &len);
int cw = mk_wcwidth((wchar_t)ch);
len = ANY_LENGTH-len;
if(len<=0) len=1;
i+=len;
if(cw<=0) cw=1;
c+=cw;
if(c<=cursorx) *p = i;
}
return i;
}
//Erase character by unicode char width.
//Fill the characters with spaces.
//returns length modified
int erease_utf8_by_cw( char* t, int cw, int clen, int maxlen)
{
static char buf[8000]; //LOL
int c=0,i=0;
while(c<cw)
{
const char* utf8str = t+i;
int len = ANY_LENGTH;
unsigned ch = UTF8_getch(&utf8str, &len);
int cw = mk_wcwidth((wchar_t)ch);
len = ANY_LENGTH-len;
if(len<=0) len=1;
i+=len;
if(cw<=0) cw=1;
c+=cw;
}
if(cw==c && clen==i)
{
memset(t, ' ', clen);
return 0;
}
else
{
int filled = clen+c-cw;
memcpy(buf, t+i, maxlen-i);
memset(t, ' ', filled);
memcpy(t+filled, buf, maxlen-filled);
return filled-i;
}
}
//cut ut8 string by character size
//utf8_substr("正正正正", 1, 4) returns
// " 正 "
// Broken characters will be filled with space
std::string utf8_substr(std::string s, int start, int size)
{
static char buf[8000];
int len = strlen(s.c_str());
int pos;
strcpy(buf, s.c_str());
int begin = cursorx_to_position(buf, start, &pos);
if(begin!=pos)
{
const char* ts = buf+pos;
int l = ANY_LENGTH;
unsigned tc = UTF8_getch(&ts, &l);
int tw = mk_wcwidth((wchar_t)tc);
erease_utf8_by_cw(buf+pos, tw, tw, len-pos-1);
begin = pos+tw-1;
}
if(size>0)
{
int end = cursorx_to_position(buf, start+size-1, &pos);
if(end!=pos)
{
const char* ts = buf+pos;
int l = ANY_LENGTH;
unsigned tc = UTF8_getch(&ts, &l);
int tw = mk_wcwidth((wchar_t)tc);
erease_utf8_by_cw(buf+pos, tw, tw, len-pos-1);
end = pos+tw-1;
}
buf[end+1] = '\0';
}
return std::string(buf+start);
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef CATACHARSET_H
#define CATACHARSET_H
#include <wchar.h>
#include <string>
#define ANY_LENGTH 5
#define UNKNOWN_UNICODE 0xFFFD
// get a unicode character from a utf8 string
unsigned UTF8_getch(const char **src, int *srclen);
// from wcwidth.c, return "cell" width of a unicode char
int mk_wcwidth(wchar_t ucs);
// convert cursorx value to byte position
int cursorx_to_position(const char* line, int cursorx, int* prevppos=NULL);
//erease for characters insertion
int erease_utf8_by_cw( char* t, int cw, int len, int maxlen);
int utf8_width(const char* s);
std::string utf8_substr(std::string s, int start, int size=-1);
#endif
+10 -4
View File
@@ -45,6 +45,7 @@ typedef struct
typedef struct{
bool touched;
char *chars;
int width_in_bytes;
char *FG;
char *BG;
//cursechar chars [80];
@@ -157,8 +158,13 @@ void set_escdelay(int delay);//PORTABILITY, DUMMY FUNCTION
int echo(void);
int noecho(void);
//non-curses functions, Do not call these in the main game code
void WinDestroy();
bool WinCreate(bool initgl);
void CheckMessages();
int FindWin(WINDOW *wnd);
extern WINDOW* mainwin;
extern pairs *colorpairs;
WINDOW* curses_init();
int curses_destroy();
void curses_drawwindow(WINDOW* win);
void curses_delay(int delay);
void curses_timeout(int t);
int curses_getch(WINDOW* win);
int curses_start_color();
#endif
+28
View File
@@ -83,3 +83,31 @@ ADDITIONS
8) If the armour is made from 2 materials types, then it takes a weighted average of the primary material (66%) and secondary material (33%).
9) Materials resistance factors are given relative to PAPER as a material (this probably needs some fine-tuning for balance).
1.5 Adding a bionic
1) Edit data/raw/bionics.json and add your bionic near similar types.
2) Add the required attributes
id : "bio_rocketlauncher" // Text string used as identifier in the code.
name : "CBM: Rocket Launcher" // The bionic's name, as showed to the player.
cost : 10 // How many PUs it costs to use the bionic.
time : 0 // How long, when activated, between drawing cost. If 0, it draws power once.
description : "It's a rocket launcher, inside your arm!!" // A brief description of the bionic, as showed to the player.
3) Add any otional attributes
flags : ["ACTIVE"] // Used to flag the bionic as a specific type.
Supported flags:
"ACTIVE" : The bionic can be manually activated and deactivated.
"POWER" : The bionic provides a source of power.
"FAULTY" : The bionic is an unwanted one, will typically have negative effects.
Flags can be combined like so: ["ACTIVE","POWER","FAULTY"] (Don't add all these at once)
4) If you want the bionic to be available in the gameworld as an item, add it to itypedef.cpp
BIO_SINGLE(id, rarity, price, color, difficulty)
See 1.1 for more information about adding items.
+1 -1
View File
@@ -18,7 +18,7 @@ Successful dodges negate the attack and impose a cumulative penalty on dodges wi
Dodge Use Cases:
An individual with no skill and nominal stats in ideal circumstances against a basic opponent should occasionally be able to dodge.
An individual with no skill and nominal stats in ideal corcumstances against a skilled opponent should rarely if ever be able to dodge.
An individual with no skill and nominal stats in ideal circumstances against a skilled opponent should rarely if ever be able to dodge.
An individual with world-class dodging ability, in ideal circumstances against a basic opponent should have a negligible chance of failure.
+21 -7
View File
@@ -70,7 +70,9 @@ void computer::shutdown_terminal()
void computer::use(game *g)
{
if (w_terminal == NULL)
w_terminal = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
w_terminal = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH,
(TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0,
(TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
@@ -274,7 +276,7 @@ void computer::activate_function(game *g, computer_action action)
if (g->m.ter(x, y) == t_sewage_pump) {
for (int x1 = x - 1; x1 <= x + 1; x1++) {
for (int y1 = y - 1; y1 <= y + 1; y1++ ) {
if (g->m.ter(x1, y1) == t_counter) {
if (g->m.furn(x1, y1) == f_counter) {
bool found_item = false;
for (int i = 0; i < g->m.i_at(x1, y1).size(); i++) {
item *it = &(g->m.i_at(x1, y1)[i]);
@@ -470,7 +472,7 @@ void computer::activate_function(game *g, computer_action action)
// For each level between here and the surface, remove the missile
for (int level = g->levz; level <= 0; level++)
{
map tmpmap(&g->itypes, &g->mapitems, &g->traps);
map tmpmap(&g->traps);
tmpmap.load(g, g->levx, g->levy, level, false);
if(level < 0)
@@ -512,7 +514,7 @@ void computer::activate_function(game *g, computer_action action)
for (int y = 0; y < SEEY * MAPSIZE; y++) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y)[i].is_bionic()) {
if (names.size() < 9)
if (names.size() < TERMY - 8)
names.push_back(g->m.i_at(x, y)[i].tname());
else
more++;
@@ -520,10 +522,22 @@ void computer::activate_function(game *g, computer_action action)
}
}
}
reset_terminal();
print_line("");
print_line("Bionic access - Manifest:");
print_line("");
for (int i = 0; i < names.size(); i++)
print_line(names[i].c_str());
if (more > 0)
print_line("%d OTHERS FOUND...", more);
print_line("");
print_line("Press any key...");
getch();
} break;
case COMPACT_ELEVATOR_ON:
@@ -624,11 +638,11 @@ INITIATING STANDARD TREMOR TEST...");
case COMPACT_AMIGARA_START:
g->add_event(EVENT_AMIGARA, int(g->turn) + 10, 0, 0, 0);
if (!g->u.has_artifact_with(AEP_PSYSHIELD))
g->u.add_disease(DI_AMIGARA, 20, g);
g->u.add_disease("amigara", 20);
break;
case COMPACT_STEMCELL_TREATMENT:
g->u.add_disease(DI_STEMCELL_TREATMENT, 120, g);
g->u.add_disease("stemcell_treatment", 120);
print_line("The machine injects your eyeball with the solution \n\
of pureed bone & LSD.");
g->u.pain += rng(40,90);
@@ -1125,7 +1139,7 @@ void computer::activate_failure(game *g, computer_failure fail)
case COMPFAIL_AMIGARA:
g->add_event(EVENT_AMIGARA, int(g->turn) + 5, 0, 0, 0);
g->u.add_disease(DI_AMIGARA, 20, g);
g->u.add_disease("amigara", 20);
g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
break;
+201 -156
View File
@@ -8,6 +8,7 @@
#include "skill.h"
#include "crafting.h" // For the use_comps use_tools functions
#include "item_factory.h"
#include "catacharset.h"
bool will_flood_stop(map *m, bool (&fill)[SEEX * MAPSIZE][SEEY * MAPSIZE],
int x, int y);
@@ -69,14 +70,21 @@ void game::init_construction()
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
CONSTRUCT("Chop Tree trunk into logs", 0, &construct::able_trunk, &construct::done_trunk_log);
STAGE(t_dirt, 20);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
STAGE(t_null, 1);
CONSTRUCT("Chop Tree trunk into planks", 0, &construct::able_trunk, &construct::done_trunk_plank);
STAGE(t_dirt, 23);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
TOOLCONT("saw");
CONSTRUCT("Move Furniture", -1, &construct::able_move, &construct::done_move);
STAGE(1);
CONSTRUCT("Clean Broken Window", 0, &construct::able_broken_window,
&construct::done_nothing);
@@ -294,7 +302,7 @@ void game::init_construction()
// Base stuff
CONSTRUCT("Build Bulletin Board", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_bulletin, 10)
STAGE(f_bulletin, 10)
TOOL("saw");
TOOL("hammer");
TOOLCONT("hatchet");
@@ -303,9 +311,9 @@ void game::init_construction()
COMP("nail", 8);
// Household stuff
CONSTRUCT("Build Dresser", 1, &construct::able_indoors,
CONSTRUCT("Build Dresser", 1, &construct::able_empty,
&construct::done_nothing);
STAGE(t_dresser, 20);
STAGE(f_dresser, 20);
TOOL("saw");
TOOL("hammer");
TOOLCONT("primitive_hammer");
@@ -314,9 +322,9 @@ void game::init_construction()
COMP("nail", 8);
COMP("2x4", 6);
CONSTRUCT("Build Bookcase", 1, &construct::able_indoors,
CONSTRUCT("Build Bookcase", 1, &construct::able_empty,
&construct::done_nothing);
STAGE(t_bookcase, 20);
STAGE(f_bookcase, 20);
TOOL("saw");
TOOL("hammer");
TOOLCONT("primitive_hammer");
@@ -325,9 +333,9 @@ void game::init_construction()
COMP("nail", 16);
COMP("2x4", 12);
CONSTRUCT("Build Locker", 1, &construct::able_indoors,
CONSTRUCT("Build Locker", 1, &construct::able_empty,
&construct::done_nothing);
STAGE(t_locker, 20);
STAGE(f_locker, 20);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
@@ -335,18 +343,18 @@ void game::init_construction()
COMP("sheet_metal", 2);
COMP("pipe", 8);
CONSTRUCT("Build Metal Rack", 1, &construct::able_indoors,
CONSTRUCT("Build Metal Rack", 1, &construct::able_empty,
&construct::done_nothing);
STAGE(t_rack, 20);
STAGE(f_rack, 20);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOL("wrench");
COMP("pipe", 12);
CONSTRUCT("Build Counter", 0, &construct::able_indoors,
CONSTRUCT("Build Counter", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_counter, 20);
STAGE(f_counter, 20);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
@@ -354,9 +362,9 @@ void game::init_construction()
COMP("nail", 8);
COMP("2x4", 6);
CONSTRUCT("Build Makeshift Bed", 0, &construct::able_indoors,
CONSTRUCT("Build Makeshift Bed", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_makeshift_bed, 20);
STAGE(f_makeshift_bed, 20);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
@@ -367,12 +375,12 @@ void game::init_construction()
CONSTRUCT("Tape up window", 0, &construct::able_window_pane,
&construct::done_tape);
STAGE(t_null, 2);
STAGE(2);
COMP("duct_tape", 50);
CONSTRUCT("Deconstruct Furniture", 0, &construct::able_deconstruct,
&construct::done_deconstruct);
STAGE(t_null, 20);
STAGE(20);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
@@ -381,7 +389,7 @@ void game::init_construction()
TOOLCONT("toolset");
CONSTRUCT("Start vehicle construction", 0, &construct::able_empty, &construct::done_vehicle);
STAGE(t_null, 10);
STAGE(10);
COMP("frame", 1);
CONSTRUCT("Fence Posts", 0, &construct::able_dig,
@@ -400,14 +408,14 @@ void game::init_construction()
CONSTRUCT("Build Wood Stove", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_woodstove, 10);
STAGE(f_woodstove, 10);
TOOL("hacksaw");
COMP("metal_tank", 1);
COMP("pipe", 1);
CONSTRUCT("Build Stone Fireplace", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_fireplace, 40);
STAGE(f_fireplace, 40);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("shovel");
@@ -489,10 +497,16 @@ void game::construction_menu()
int posx = 33, posy = 2;
for (int n = 0; n < current_con->stages.size(); n++) {
nc_color color_stage = (player_can_build(u, total_inv, current_con, n,
false, true) ?
c_white : c_dkgray);
mvwprintz(w_con, posy, 31, color_stage, "Stage %d: %s", n + 1,
current_con->stages[n].terrain == t_null? "" : terlist[current_con->stages[n].terrain].name.c_str());
false, true) ? c_white : c_dkgray);
const char* mes;
if (current_con->stages[n].terrain != t_null)
mes = terlist[current_con->stages[n].terrain].name.c_str();
else if (current_con->stages[n].furniture != f_null)
mes = furnlist[current_con->stages[n].furniture].name.c_str();
else
mes = "";
mvwprintz(w_con, posy, 31, color_stage, "Stage %d: %s", n + 1, mes);
posy++;
// Print tools
construction_stage stage = current_con->stages[n];
@@ -517,7 +531,7 @@ void game::construction_menu()
has_tool[i] = true;
col = c_green;
}
int length = item_controller->find_template(tool)->name.length();
int length = utf8_width(item_controller->find_template(tool)->name.c_str());
if (posx + length > 79) {
posy++;
posx = 33;
@@ -562,7 +576,7 @@ void game::construction_menu()
has_component[i] = true;
col = c_green;
}
int length = item_controller->find_template(comp.type)->name.length();
int length = utf8_width(item_controller->find_template(comp.type)->name.c_str());
if (posx + length > 79) {
posy++;
posx = 33;
@@ -742,7 +756,10 @@ void game::place_construction(constructable *con)
construct test;
bool place_okay = (test.*(con->able))(this, point(x, y));
for (int i = 0; i < con->stages.size() && !place_okay; i++) {
if (m.ter(x, y) == con->stages[i].terrain)
ter_id t = con->stages[i].terrain; furn_id f = con->stages[i].furniture;
if ((t != t_null || f != f_null) &&
(m.ter(x, y) == t || t == t_null) &&
(m.furn(x, y) == f || f == f_null))
place_okay = true;
}
@@ -750,7 +767,10 @@ void game::place_construction(constructable *con)
// Make sure we're not trying to continue a construction that we can't finish
int starting_stage = 0, max_stage = -1;
for (int i = 0; i < con->stages.size(); i++) {
if (m.ter(x, y) == con->stages[i].terrain)
ter_id t = con->stages[i].terrain; furn_id f = con->stages[i].furniture;
if ((t != t_null || f != f_null) &&
(m.ter(x, y) == t || t == t_null) &&
(m.furn(x, y) == f || f == f_null))
starting_stage = i + 1;
}
for(int i = starting_stage; i < con->stages.size(); i++) {
@@ -791,7 +811,10 @@ void game::place_construction(constructable *con)
// Figure out what stage to start at, and what stage is the maximum
int starting_stage = 0, max_stage = 0;
for (int i = 0; i < con->stages.size(); i++) {
if (m.ter(dirx, diry) == con->stages[i].terrain)
ter_id t = con->stages[i].terrain; furn_id f = con->stages[i].furniture;
if ((t != t_null || f != f_null) &&
(m.ter(dirx, diry) == t || t == t_null) &&
(m.furn(dirx, diry) == f || f == f_null))
starting_stage = i + 1;
if (player_can_build(u, total_inv, con, i, true))
max_stage = i;
@@ -827,6 +850,8 @@ void game::complete_construction()
int terx = u.activity.placement.x, tery = u.activity.placement.y;
if (stage.terrain != t_null)
m.ter_set(terx, tery, stage.terrain);
if (stage.furniture != f_null)
m.furn_set(terx, tery, stage.furniture);
// Strip off the first stage in our list...
u.activity.values.erase(u.activity.values.begin());
@@ -845,7 +870,8 @@ void game::complete_construction()
bool construct::able_empty(game *g, point p)
{
return (g->m.move_cost(p.x, p.y) == 2);
return (g->m.has_flag(flat, p.x, p.y) && !g->m.has_furn(p.x, p.y) &&
g->is_empty(p.x, p.y) && g->m.tr_at(p.x, p.y) == tr_null);
}
bool construct::able_tree(game *g, point p)
@@ -853,15 +879,15 @@ bool construct::able_tree(game *g, point p)
return (g->m.ter(p.x, p.y) == t_tree);
}
bool construct::able_log(game *g, point p)
bool construct::able_trunk(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_log);
return (g->m.ter(p.x, p.y) == t_trunk);
}
bool construct::able_furniture(game *g, point p)
bool construct::able_move(game *g, point p)
{
ter_t terrain_type = terlist[g->m.ter(p.x, p.y)];
int required_str = terrain_type.move_str_req;
furn_t furniture_type = furnlist[g->m.furn(p.x, p.y)];
int required_str = furniture_type.move_str_req;
// Object can not be moved
if (required_str < 0)
@@ -930,11 +956,6 @@ bool construct::able_wall_wood(game *g, point p)
return (g->m.ter(p.x, p.y) == t_wall_wood);
}
bool construct::able_indoors(game *g, point p)
{
return g->m.has_flag(indoors, p.x, p.y) && able_empty(g, p);
}
bool construct::able_dig(game *g, point p)
{
return (g->m.has_flag(diggable, p.x, p.y));
@@ -971,7 +992,7 @@ void construct::done_window_pane(game *g, point p)
g->m.spawn_item(g->u.posx, g->u.posy, "glass_sheet", 0);
}
void construct::done_furniture(game *g, point p)
void construct::done_move(game *g, point p)
{
mvprintz(0, 0, c_red, "Press a direction for the furniture to move (. to cancel):");
int x = 0, y = 0;
@@ -984,16 +1005,16 @@ void construct::done_furniture(game *g, point p)
return;
x += p.x;
y += p.y;
if(g->m.ter(x, y) != t_floor || !g->is_empty(x, y)) {
if(!able_empty(g, point(x, y))) {
mvprintz(0, 0, c_red, "Can't move furniture there! Choose a direction with open floor.");
continue;
}
break;
}
g->sound(x, y, terlist[g->m.ter(p.x, p.y)].move_str_req * 2, "a scraping noise");
g->m.ter_set(x, y, g->m.ter(p.x, p.y));
g->m.ter_set(p.x, p.y, t_floor);
g->sound(x, y, furnlist[g->m.furn(p.x, p.y)].move_str_req * 2, "a scraping noise");
g->m.furn_set(x, y, g->m.furn(p.x, p.y));
g->m.furn_set(p.x, p.y, f_null);
//Move all Items within a container
std::vector <item> vItemMove = g->m.i_at(p.x, p.y);
@@ -1015,19 +1036,33 @@ void construct::done_tree(game *g, point p)
std::vector<point> tree = line_to(p.x, p.y, x, y, rng(1, 8));
for (int i = 0; i < tree.size(); i++) {
g->m.destroy(g, tree[i].x, tree[i].y, true);
g->m.ter_set(tree[i].x, tree[i].y, t_log);
g->m.ter_set(tree[i].x, tree[i].y, t_trunk);
}
}
void construct::done_log(game *g, point p)
void construct::done_trunk_log(game *g, point p)
{
g->m.spawn_item(p.x, p.y, "log", int(g->turn), rng(5, 15));
g->m.spawn_item(p.x, p.y, "log", int(g->turn), rng(5, 15));
}
void construct::done_trunk_plank(game *g, point p)
{
int num_logs = rng(5, 15);
for( int i = 0; i < num_logs; ++i ) {
item tmplog(g->itypes["log"], int(g->turn), g->nextinv);
iuse::cut_log_into_planks( g, &(g->u), &tmplog);
}
}
void construct::done_vehicle(game *g, point p)
{
std::string name = string_input_popup("Enter new vehicle name", 20);
std::string name = string_input_popup("Enter new vehicle name:", 20);
if(name.empty())
{
name = "Car";
}
vehicle *veh = g->m.add_vehicle (g, veh_custom, p.x, p.y, 270, 0, 0);
if (!veh)
{
@@ -1036,6 +1071,10 @@ void construct::done_vehicle(game *g, point p)
}
veh->name = name;
veh->install_part (0, 0, vp_frame_v2);
//Update the vehicle cache immediately, or the vehicle will be invisible for the first couple of turns.
g->m.update_vehicle_cache(veh, true);
}
void construct::done_tape(game *g, point p)
@@ -1057,111 +1096,117 @@ void construct::done_tape(game *g, point p)
void construct::done_deconstruct(game *g, point p)
{
g->add_msg("You disassemble the %s.", g->m.tername(p.x, p.y).c_str());
switch (g->m.ter(p.x, p.y))
{
case t_makeshift_bed:
case t_bed:
case t_armchair:
g->m.spawn_item(p.x, p.y, "2x4", 0, 10);
g->m.spawn_item(p.x, p.y, "rag", 0, rng(10,15));
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,8));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_door_c:
case t_door_o:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_door_frame);
break;
case t_window_domestic:
g->m.spawn_item(p.x, p.y, "stick", 0);
g->m.spawn_item(p.x, p.y, "sheet", 0, 2);
g->m.spawn_item(p.x, p.y, "glass_sheet", 0);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(3,4));
g->m.spawn_item(p.x, p.y, "string_36", 0, 0, 1);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_window:
g->m.spawn_item(p.x, p.y, "glass_sheet", 0);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_backboard:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_pavement);
break;
case t_sandbox:
case t_bench:
case t_crate_o:
case t_crate_c:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_chair:
case t_cupboard:
case t_desk:
case t_bulletin:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_slide:
g->m.spawn_item(p.x, p.y, "sheet_metal", 0);
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(4,8));
g->m.ter_set(p.x, p.y, t_grass);
break;
case t_locker:
g->m.spawn_item(p.x, p.y, "sheet_metal", 0, rng(1,2));
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(4,8));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_rack:
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_monkey_bars:
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_grass);
break;
case t_fridge:
g->m.spawn_item(p.x, p.y, "scrap", 0, rng(2,6));
g->m.spawn_item(p.x, p.y, "steel_chunk", 0, rng(2,3));
g->m.spawn_item(p.x, p.y, "hose", 0, 1);
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_counter:
case t_dresser:
case t_table:
g->m.spawn_item(p.x, p.y, "2x4", 0, 6);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,8));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_pool_table:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "rag", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_bookcase:
g->m.spawn_item(p.x, p.y, "2x4", 0, 12);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(12,16));
g->m.ter_set(p.x, p.y, t_floor);
break;
if (g->m.has_furn(p.x, p.y)) {
g->add_msg("You disassemble the %s.", g->m.furnname(p.x, p.y).c_str());
switch (g->m.furn(p.x, p.y)){
case f_makeshift_bed:
case f_bed:
case f_armchair:
g->m.spawn_item(p.x, p.y, "2x4", 0, 10);
g->m.spawn_item(p.x, p.y, "rag", 0, rng(10,15));
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,8));
g->m.furn_set(p.x, p.y, f_null);
case f_bench:
case f_crate_o:
case f_crate_c:
case f_chair:
case f_cupboard:
case f_desk:
case f_bulletin:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.furn_set(p.x, p.y, f_null);
break;
case f_locker:
g->m.spawn_item(p.x, p.y, "sheet_metal", 0, rng(1,2));
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(4,8));
g->m.furn_set(p.x, p.y, f_null);
break;
case f_rack:
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(6,12));
g->m.furn_set(p.x, p.y, f_null);
break;
case f_oven:
g->m.spawn_item(p.x, p.y, "scrap", 0, rng(2,6));
g->m.spawn_item(p.x, p.y, "steel_chunk", 0, rng(2,3));
g->m.spawn_item(p.x, p.y, "element", 0, rng(1,4));
g->m.furn_set(p.x, p.y, f_null);
case f_fridge:
g->m.spawn_item(p.x, p.y, "scrap", 0, rng(2,6));
g->m.spawn_item(p.x, p.y, "steel_chunk", 0, rng(2,3));
g->m.spawn_item(p.x, p.y, "hose", 0, 1);
g->m.furn_set(p.x, p.y, f_null);
break;
case f_glass_fridge:
g->m.spawn_item(p.x, p.y, "scrap", 0, rng(2,6));
g->m.spawn_item(p.x, p.y, "steel_chunk", 0, rng(2,3));
g->m.spawn_item(p.x, p.y, "hose", 0, 1);
g->m.spawn_item(p.x, p.y, "glass_sheet", 0, 1);
g->m.furn_set(p.x, p.y, f_null);
break;
case f_counter:
case f_dresser:
case f_table:
g->m.spawn_item(p.x, p.y, "2x4", 0, 6);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,8));
g->m.furn_set(p.x, p.y, f_null);
break;
case f_pool_table:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "rag", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.furn_set(p.x, p.y, f_null);
break;
case f_bookcase:
g->m.spawn_item(p.x, p.y, "2x4", 0, 12);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(12,16));
g->m.furn_set(p.x, p.y, f_null);
break;
default:
g->add_msg("You have to push away %s first.", g->m.furnname(p.x, p.y).c_str());
break;
}
} else {
g->add_msg("You disassemble the %s.", g->m.tername(p.x, p.y).c_str());
switch (g->m.ter(p.x, p.y))
{
case t_door_c:
case t_door_o:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_door_frame);
break;
case t_window_domestic:
g->m.spawn_item(p.x, p.y, "stick", 0);
g->m.spawn_item(p.x, p.y, "sheet", 0, 2);
g->m.spawn_item(p.x, p.y, "glass_sheet", 0);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(3,4));
g->m.spawn_item(p.x, p.y, "string_36", 0, 0, 1);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_window:
g->m.spawn_item(p.x, p.y, "glass_sheet", 0);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_backboard:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_pavement);
break;
case t_sandbox:
g->m.spawn_item(p.x, p.y, "2x4", 0, 4);
g->m.spawn_item(p.x, p.y, "nail", 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_slide:
g->m.spawn_item(p.x, p.y, "sheet_metal", 0);
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(4,8));
g->m.ter_set(p.x, p.y, t_grass);
break;
case t_monkey_bars:
g->m.spawn_item(p.x, p.y, "pipe", 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_grass);
break;
}
}
}
+11 -6
View File
@@ -7,12 +7,17 @@ struct construct;
struct construction_stage
{
ter_id terrain;
furn_id furniture;
int time; // In minutes, i.e. 10 turns
std::vector<component> tools[10];
std::vector<component> components[10];
construction_stage(ter_id Terrain, int Time) :
terrain (Terrain), time (Time) { };
terrain (Terrain), furniture(f_null), time (Time) { };
construction_stage(furn_id Furniture, int Time) :
terrain (t_null), furniture (Furniture), time (Time) { };
construction_stage(int Time) :
terrain (t_null), furniture (f_null), time (Time) { };
};
struct constructable
@@ -49,7 +54,6 @@ struct construct // Construction functions.
bool able_wall (game *, point); // Able if tile is wall
bool able_wall_wood(game *g, point); // Only player-built walls
bool able_indoors(game *g, point); // Able on floors
bool able_between_walls(game *, point); // Flood-fill contained by walls
@@ -58,9 +62,9 @@ struct construct // Construction functions.
bool able_pit(game *, point); // Able only on pits
bool able_tree(game *, point); // Able on trees
bool able_log(game *, point); // Able on logs
bool able_trunk(game *, point); // Able on tree trunks
bool able_furniture(game *, point); // Able on furniture
bool able_move(game *, point); // Able on furniture
bool able_deconstruct(game *, point);
@@ -69,8 +73,9 @@ struct construct // Construction functions.
void done_window_pane(game *, point);
void done_vehicle(game *, point);
void done_tree(game *, point);
void done_log(game *, point);
void done_furniture(game *, point);
void done_trunk_log(game *, point);
void done_trunk_plank(game *, point);
void done_move(game *, point);
void done_tape(game *, point);
void done_deconstruct(game *, point);
+34 -30
View File
@@ -10,6 +10,7 @@
#include "crafting.h"
#include "inventory.h"
#include "item_factory.h"
#include "catacharset.h"
//apparently we can't declare this in crafting.h? Complained about multiple definition.
std::vector<craft_cat> craft_cat_list;
@@ -355,7 +356,7 @@ bool game::check_enough_materials(recipe *r, inventory crafting_inv)
}
++comp_it;
}
if (!atleast_one_available)
// this set doesn't have any components available, so the recipe can't be crafted
{
@@ -364,7 +365,7 @@ bool game::check_enough_materials(recipe *r, inventory crafting_inv)
++comp_set_it;
}
std::vector<std::vector<component> > &tools = r->tools;
std::vector<std::vector<component> >::iterator tool_set_it = tools.begin();
while (tool_set_it != tools.end())
@@ -434,7 +435,7 @@ bool game::check_enough_materials(recipe *r, inventory crafting_inv)
}
++tool_it;
}
if (!atleast_one_available)
// this set doesn't have any tools available, so the recipe can't be crafted
{
@@ -442,7 +443,7 @@ bool game::check_enough_materials(recipe *r, inventory crafting_inv)
}
++tool_set_it;
}
return RET_VAL;
}
@@ -508,8 +509,8 @@ recipe* game::select_crafting_recipe()
const int dataLines=(int)(dataHalfLines*2); // old: 18
const int dataHeight=dataLines+4; // old: 22
WINDOW *w_head = newwin( 3, 80, 0, (TERMX > 80) ? (TERMX -80)/2 : 0);
WINDOW *w_data = newwin(dataHeight, 80, 3, (TERMX > 80) ? (TERMX -80)/2 : 0);
WINDOW *w_head = newwin( 3, FULL_SCREEN_WIDTH, 0, (TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
WINDOW *w_data = newwin(dataHeight, FULL_SCREEN_WIDTH, 3, (TERMX > FULL_SCREEN_WIDTH) ? (TERMX -FULL_SCREEN_WIDTH)/2 : 0);
craft_cat tab = "CC_WEAPON";
@@ -543,22 +544,22 @@ recipe* game::select_crafting_recipe()
mvwprintz(w_data, dataLines+1, 5, c_white, "[?/E]: Describe, [F]ind , [R]eset");
}
else
{
{
mvwprintz(w_data, dataLines+1, 5, c_white, "[?/E]: Describe, [F]ind");
}
mvwprintz(w_data, dataLines+2, 5, c_white, "Press <ENTER> to attempt to craft object.");
for (int i = 0; i < 80; i++)
for (int i = 0; i < FULL_SCREEN_WIDTH; i++)
{
mvwputch(w_data, dataHeight-1, i, c_ltgray, LINE_OXOX);
if (i < dataHeight-1)
{
mvwputch(w_data, i, 0, c_ltgray, LINE_XOXO);
mvwputch(w_data, i, 79, c_ltgray, LINE_XOXO);
mvwputch(w_data, i, FULL_SCREEN_WIDTH-1, c_ltgray, LINE_XOXO);
}
}
mvwputch(w_data, dataHeight-1, 0, c_ltgray, LINE_XXOO); // _|
mvwputch(w_data, dataHeight-1, 79, c_ltgray, LINE_XOOX); // |_
mvwputch(w_data, dataHeight-1, FULL_SCREEN_WIDTH-1, c_ltgray, LINE_XOOX); // |_
int recmin = 0, recmax = current.size();
if(recmax > dataLines)
@@ -682,7 +683,7 @@ recipe* game::select_crafting_recipe()
itype_id type = current[line]->tools[i][j].type;
int charges = current[line]->tools[i][j].count;
nc_color toolcol = c_red;
if (current[line]->tools[i][j].available == 0)
{
toolcol = c_brown;
@@ -704,16 +705,16 @@ recipe* game::select_crafting_recipe()
toolinfo << "(" << charges << " charges) ";
}
std::string toolname = toolinfo.str();
if (xpos + toolname.length() >= 80)
if (xpos + utf8_width(toolname.c_str()) >= FULL_SCREEN_WIDTH)
{
xpos = 32;
ypos++;
}
mvwprintz(w_data, ypos, xpos, toolcol, toolname.c_str());
xpos += toolname.length();
xpos += utf8_width(toolname.c_str());
if (j < current[line]->tools[i].size() - 1)
{
if (xpos >= 77)
if (xpos >= FULL_SCREEN_WIDTH-3)
{
xpos = 32;
ypos++;
@@ -758,16 +759,16 @@ recipe* game::select_crafting_recipe()
std::stringstream dump;
dump << abs(count) << "x " << item_controller->find_template(type)->name << " ";
std::string compname = dump.str();
if (xpos + compname.length() >= 80)
if (xpos + utf8_width(compname.c_str()) >= FULL_SCREEN_WIDTH)
{
ypos++;
xpos = 32;
}
mvwprintz(w_data, ypos, xpos, compcol, compname.c_str());
xpos += compname.length();
xpos += utf8_width(compname.c_str());
if (j < current[line]->components[i].size() - 1)
{
if (xpos >= 77)
if (xpos >= FULL_SCREEN_WIDTH-3)
{
ypos++;
xpos = 32;
@@ -848,7 +849,7 @@ recipe* game::select_crafting_recipe()
redraw = true;
break;
case Filter:
filterstring = string_input_popup("Search :",55,filterstring);
filterstring = string_input_popup("Search:", 55, filterstring);
redraw = true;
break;
case Reset:
@@ -879,7 +880,7 @@ recipe* game::select_crafting_recipe()
void draw_recipe_tabs(WINDOW *w, craft_cat tab,bool filtered)
{
werase(w);
for (int i = 0; i < 80; i++)
for (int i = 0; i < FULL_SCREEN_WIDTH; i++)
{
mvwputch(w, 2, i, c_ltgray, LINE_OXOX);
}
@@ -1036,12 +1037,12 @@ void game::complete_craft()
if (making->difficulty != 0 && diff_roll > skill_roll * (1 + 0.1 * rng(1, 5))) {
add_msg("You fail to make the %s, and waste some materials.",
item_controller->find_template(making->result)->name.c_str());
for (int i = 0; i < making->components.size(); i++)
for (int i = 0; i < making->components.size(); i++)
{
if (making->components[i].size() > 0)
consume_items(&u, making->components[i]);
}
}
for (int i = 0; i < making->tools.size(); i++) {
if (making->tools[i].size() > 0)
consume_tools(&u, making->tools[i], false);
@@ -1122,11 +1123,11 @@ void game::complete_craft()
if (iter == inv_chars.size() || u.volume_carried()+newit.volume() > u.volume_capacity()) {
add_msg("There's no room in your inventory for the %s, so you drop it.",
newit.tname().c_str());
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
} else if (u.weight_carried() + newit.volume() > u.weight_capacity()) {
add_msg("The %s is too heavy to carry, so you drop it.",
newit.tname().c_str());
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
} else {
newit = u.i_add(newit);
add_msg("%c - %s", newit.invlet, newit.tname().c_str());
@@ -1470,7 +1471,7 @@ void game::disassemble(char ch)
// all tools present, so assign the activity
if (have_all_tools)
{
if (OPTIONS[OPT_QUERY_DISASSEMBLE] && !(query_yn("Really disassemble your %s?", dis_item->tname(this).c_str())))
{
return;
@@ -1497,7 +1498,7 @@ void game::complete_disassemble()
add_msg("You disassemble the item into its components.");
// remove any batteries or ammo first
if (dis_item->is_gun() && dis_item->curammo != NULL && dis_item->ammo_type() != AT_NULL)
if (dis_item->is_gun() && dis_item->curammo != NULL && dis_item->ammo_type() != "NULL")
{
item ammodrop;
ammodrop = item(dis_item->curammo, turn);
@@ -1505,17 +1506,20 @@ void game::complete_disassemble()
if (ammodrop.made_of(LIQUID))
handle_liquid(ammodrop, false, false);
else
m.add_item(u.posx, u.posy, ammodrop);
m.add_item(u.posx, u.posy, ammodrop, MAX_ITEM_IN_SQUARE);
}
if (dis_item->is_tool() && dis_item->charges > 0 && dis_item->ammo_type() != AT_NULL)
if (dis_item->is_tool() && dis_item->charges > 0 && dis_item->ammo_type() != "NULL")
{
item ammodrop;
ammodrop = item(item_controller->find_template(default_ammo(dis_item->ammo_type())), turn);
ammodrop.charges = dis_item->charges;
if (dis_item->typeId() == "adv_UPS_off" || dis_item->typeId() == "adv_UPS_on") {
ammodrop.charges /= 500;
}
if (ammodrop.made_of(LIQUID))
handle_liquid(ammodrop, false, false);
else
m.add_item(u.posx, u.posy, ammodrop);
m.add_item(u.posx, u.posy, ammodrop, MAX_ITEM_IN_SQUARE);
}
u.i_rem(u.activity.values[0]); // remove the item
@@ -1572,7 +1576,7 @@ void game::complete_disassemble()
} else
{
if (dis->difficulty == 0 || comp_success)
m.add_item(u.posx, u.posy, newit);
m.add_item(u.posx, u.posy, newit, MAX_ITEM_IN_SQUARE);
else
add_msg("You fail to recover a component.");
compcount--;
+3 -3
View File
@@ -2,11 +2,11 @@
#define _CURSES_DEF_H_
#if (defined TILES || defined _WIN32 || defined WINDOWS)
#include "catacurse.h"
#include "catacurse.h"
#elif (defined __CYGWIN__)
#include "ncurses/curses.h"
#include "ncurses/curses.h"
#else
#include <curses.h>
#include <curses.h>
#endif
#endif // CURSES_DEF_H
+604
View File
@@ -0,0 +1,604 @@
#if (defined TILES || defined _WIN32 || defined WINDOWS)
#include "catacurse.h"
#include "output.h"
#include "color.h"
#include "catacharset.h"
//***********************************
//Globals *
//***********************************
WINDOW *mainwin;
pairs *colorpairs; //storage for pair'ed colored, should be dynamic, meh
int echoOn; //1 = getnstr shows input, 0 = doesn't show. needed for echo()-ncurses compatibility.
//***********************************
//Psuedo-Curses Functions *
//***********************************
//Basic Init, create the font, backbuffer, etc
WINDOW *initscr(void)
{
return curses_init();
}
WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
{
if (begin_y < 0 || begin_x < 0) {
return NULL; //it's the caller's problem now (since they have logging functions declared)
}
// default values
if (ncols == 0)
{
ncols = TERMX - begin_x;
}
if (nlines == 0)
{
nlines = TERMY - begin_y;
}
int i,j;
WINDOW *newwindow = new WINDOW;
//newwindow=&_windows[WindowCount];
newwindow->x=begin_x;
newwindow->y=begin_y;
newwindow->width=ncols;
newwindow->height=nlines;
newwindow->inuse=true;
newwindow->draw=false;
newwindow->BG=0;
newwindow->FG=8;
newwindow->cursorx=0;
newwindow->cursory=0;
newwindow->line = new curseline[nlines];
for (j=0; j<nlines; j++)
{
newwindow->line[j].chars= new char[ncols*4];
newwindow->line[j].FG= new char[ncols];
newwindow->line[j].BG= new char[ncols];
newwindow->line[j].touched=true;//Touch them all !?
newwindow->line[j].width_in_bytes = ncols;
for (i=0; i<ncols; i++)
{
newwindow->line[j].chars[i]=0;
newwindow->line[j].chars[i+1]=0;
newwindow->line[j].chars[i+2]=0;
newwindow->line[j].chars[i+3]=0;
newwindow->line[j].FG[i]=0;
newwindow->line[j].BG[i]=0;
}
}
//WindowCount++;
return newwindow;
}
//Deletes the window and marks it as free. Clears it just in case.
int delwin(WINDOW *win)
{
int j;
win->inuse=false;
win->draw=false;
for (j=0; j<win->height; j++){
delete win->line[j].chars;
delete win->line[j].FG;
delete win->line[j].BG;
}
delete win->line;
delete win;
return 1;
}
inline int newline(WINDOW *win){
if (win->cursory < win->height - 1){
win->cursory++;
win->cursorx=0;
return 1;
}
return 0;
}
inline void addedchar(WINDOW *win){
win->cursorx++;
win->line[win->cursory].touched=true;
if (win->cursorx > win->width)
newline(win);
}
//Borders the window with fancy lines!
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
{
/*
ncurses does not do this, and this prevents: wattron(win, c_customBordercolor); wborder(win, ...); wattroff(win, c_customBorderColor);
wattron(win, c_white);
*/
int i, j;
int oldx=win->cursorx;//methods below move the cursor, save the value!
int oldy=win->cursory;//methods below move the cursor, save the value!
if (ls>0)
for (j=1; j<win->height-1; j++)
mvwaddch(win, j, 0, LINE_XOXO);
if (rs>0)
for (j=1; j<win->height-1; j++)
mvwaddch(win, j, win->width-1, LINE_XOXO);
if (ts>0)
for (i=1; i<win->width-1; i++)
mvwaddch(win, 0, i, LINE_OXOX);
if (bs>0)
for (i=1; i<win->width-1; i++)
mvwaddch(win, win->height-1, i, LINE_OXOX);
if (tl>0)
mvwaddch(win,0, 0, LINE_OXXO);
if (tr>0)
mvwaddch(win,0, win->width-1, LINE_OOXX);
if (bl>0)
mvwaddch(win,win->height-1, 0, LINE_XXOO);
if (br>0)
mvwaddch(win,win->height-1, win->width-1, LINE_XOOX);
//_windows[w].cursorx=oldx;//methods above move the cursor, put it back
//_windows[w].cursory=oldy;//methods above move the cursor, put it back
wmove(win,oldy,oldx);
wattroff(win, c_white);
return 1;
}
//Refreshes a window, causing it to redraw on top.
int wrefresh(WINDOW *win)
{
if (win==0) win=mainwin;
if (win->draw)
curses_drawwindow(win);
return 1;
}
//Refreshes window 0 (stdscr), causing it to redraw on top.
int refresh(void)
{
return wrefresh(mainwin);
}
int getch(void)
{
return wgetch(mainwin);
}
int wgetch(WINDOW* win)
{
return curses_getch(win);
}
int mvgetch(int y, int x)
{
move(y,x);
return getch();
}
int mvwgetch(WINDOW* win, int y, int x)
{
move(y, x);
return wgetch(win);
}
int getnstr(char *str, int size)
{
int startX = mainwin->cursorx;
int count = 0;
char input;
while(true)
{
input = getch();
// Carriage return, Line feed and End of File terminate the input.
if( input == '\r' || input == '\n' || input == '\x04' )
{
str[count] = '\x00';
return count;
}
else if( input == 127 ) // Backspace, remapped from \x8 in ProcessMessages()
{
if( count == 0 )
continue;
str[count] = '\x00';
if(echoOn == 1)
mvaddch(mainwin->cursory, startX + count, ' ');
--count;
if(echoOn == 1)
move(mainwin->cursory, startX + count);
}
else
{
if( count >= size - 1 ) // Still need space for trailing 0x00
continue;
str[count] = input;
++count;
if(echoOn == 1)
{
move(mainwin->cursory, startX + count);
mvaddch(mainwin->cursory, startX + count, input);
}
}
}
return count;
}
//The core printing function, prints characters to the array, and sets colors
inline int printstring(WINDOW *win, char *fmt)
{
int size = strlen(fmt);
if(size>0)
{
int j, i, p=win->cursorx;
int x = (win->line[win->cursory].width_in_bytes==win->width)?win->cursorx:cursorx_to_position(win->line[win->cursory].chars, win->cursorx, &p);
if(p!=x)//so we start inside a wide character, erase it for good
{
const char* ts = win->line[win->cursory].chars+p;
int len = ANY_LENGTH;
unsigned tc = UTF8_getch(&ts, &len);
int tw = mk_wcwidth((wchar_t)tc);
erease_utf8_by_cw(win->line[win->cursory].chars+p, tw, tw, win->width*4-p-1);
x = p+tw-1;
}
for (j=0; j<size; j++){
if (!(fmt[j]==10)){//check that this isnt a newline char
const char* utf8str = fmt+j;
int len = ANY_LENGTH;
unsigned ch = UTF8_getch(&utf8str, &len);
int cw = mk_wcwidth((wchar_t)ch);
len = ANY_LENGTH-len;
if(cw<1) cw = 1;
if(len<1) len = 1;
if (win->cursorx+cw <= win->width && win->cursory <= win->height - 1) {
win->line[win->cursory].width_in_bytes += erease_utf8_by_cw(win->line[win->cursory].chars+x, cw, len, win->width*4-x-1);
for(i=0; i<len; i++)
{
win->line[win->cursory].chars[x+i]=fmt[j+i];
}
for(i=0; i<cw; i++)
{
win->line[win->cursory].FG[win->cursorx]=win->FG;
win->line[win->cursory].BG[win->cursorx]=win->BG;
addedchar(win);
}
win->line[win->cursory].touched=true;
j += len-1;
x+=len;
} else if (win->cursory <= win->height - 1) {
// don't write outside the window, but don't abort if there are still lines to write.
//j += len-1;
//x+=len;
} else {
return 0; //if we try and write anything outside the window, abort completely
}
} else {// if the character is a newline, make sure to move down a line
if (newline(win)==0){
return 0;
}
x = 0;
}
}
}
win->draw=true;
return 1;
}
//Prints a formatted string to a window at the current cursor, base function
int wprintw(WINDOW *win, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
return printstring(win,printbuf);
}
//Prints a formatted string to a window, moves the cursor
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
if (wmove(win,y,x)==0) return 0;
return printstring(win,printbuf);
}
//Prints a formatted string to window 0 (stdscr), moves the cursor
int mvprintw(int y, int x, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
if (move(y,x)==0) return 0;
return printstring(mainwin,printbuf);
}
//Prints a formatted string to window 0 (stdscr) at the current cursor
int printw(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2078];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
return printstring(mainwin,printbuf);
}
//erases a window of all text and attributes
int werase(WINDOW *win)
{
int j,i;
for (j=0; j<win->height; j++)
{
for (i=0; i<win->width; i++) {
win->line[j].chars[i]=0;
win->line[j].chars[i+1]=0;
win->line[j].chars[i+2]=0;
win->line[j].chars[i+3]=0;
win->line[j].FG[i]=0;
win->line[j].BG[i]=0;
}
win->line[j].touched=true;
win->line[j].width_in_bytes = win->width;
}
win->draw=true;
wmove(win,0,0);
// wrefresh(win);
return 1;
}
//erases window 0 (stdscr) of all text and attributes
int erase(void)
{
return werase(mainwin);
}
//pairs up a foreground and background color and puts it into the array of pairs
int init_pair(short pair, short f, short b)
{
colorpairs[pair].FG=f;
colorpairs[pair].BG=b;
return 1;
}
//moves the cursor in a window
int wmove(WINDOW *win, int y, int x)
{
if (x>=win->width)
{return 0;}//FIXES MAP CRASH -> >= vs > only
if (y>=win->height)
{return 0;}// > crashes?
if (y<0)
{return 0;}
if (x<0)
{return 0;}
win->cursorx=x;
win->cursory=y;
return 1;
}
//Clears windows 0 (stdscr) I'm not sure if its suppose to do this?
int clear(void)
{
return wclear(mainwin);
}
//Ends the terminal, destroy everything
int endwin(void)
{
return curses_destroy();
}
//adds a character to the window
int mvwaddch(WINDOW *win, int y, int x, const chtype ch)
{
if (wmove(win,y,x)==0) return 0;
return waddch(win, ch);
}
//clears a window
int wclear(WINDOW *win)
{
werase(win);
clearok(win);
return 1;
}
int clearok(WINDOW *win)
{
for (int i=0; i<win->y; i++)
{
win->line[i].touched = true;
}
return 1;
}
//gets the max x of a window (the width)
int getmaxx(WINDOW *win)
{
if (win==0) return mainwin->width; //StdScr
return win->width;
}
//gets the max y of a window (the height)
int getmaxy(WINDOW *win)
{
if (win==0) return mainwin->height; //StdScr
return win->height;
}
//gets the beginning x of a window (the x pos)
int getbegx(WINDOW *win)
{
if (win==0) return mainwin->x; //StdScr
return win->x;
}
//gets the beginning y of a window (the y pos)
int getbegy(WINDOW *win)
{
if (win==0) return mainwin->y; //StdScr
return win->y;
}
int start_color(void)
{
return curses_start_color();
}
int keypad(WINDOW *faux, bool bf)
{
return 1;
}
int cbreak(void)
{
return 1;
}
int keypad(int faux, bool bf)
{
return 1;
}
int curs_set(int visibility)
{
return 1;
}
int mvaddch(int y, int x, const chtype ch)
{
return mvwaddch(mainwin,y,x,ch);
}
int wattron(WINDOW *win, int attrs)
{
bool isBold = !!(attrs & A_BOLD);
bool isBlink = !!(attrs & A_BLINK);
int pairNumber = (attrs & A_COLOR) >> 17;
win->FG=colorpairs[pairNumber].FG;
win->BG=colorpairs[pairNumber].BG;
if (isBold) win->FG += 8;
if (isBlink) win->BG += 8;
return 1;
}
int wattroff(WINDOW *win, int attrs)
{
win->FG=8; //reset to white
win->BG=0; //reset to black
return 1;
}
int attron(int attrs)
{
return wattron(mainwin, attrs);
}
int attroff(int attrs)
{
return wattroff(mainwin,attrs);
}
int waddch(WINDOW *win, const chtype ch)
{
char charcode;
charcode=ch;
switch (ch){ //LINE_NESW - X for on, O for off
case LINE_XOXO: //#define LINE_XOXO 4194424
charcode=LINE_XOXO_C;
break;
case LINE_OXOX: //#define LINE_OXOX 4194417
charcode=LINE_OXOX_C;
break;
case LINE_XXOO: //#define LINE_XXOO 4194413
charcode=LINE_XXOO_C;
break;
case LINE_OXXO: //#define LINE_OXXO 4194412
charcode=LINE_OXXO_C;
break;
case LINE_OOXX: //#define LINE_OOXX 4194411
charcode=LINE_OOXX_C;
break;
case LINE_XOOX: //#define LINE_XOOX 4194410
charcode=LINE_XOOX_C;
break;
case LINE_XXOX: //#define LINE_XXOX 4194422
charcode=LINE_XXOX_C;
break;
case LINE_XXXO: //#define LINE_XXXO 4194420
charcode=LINE_XXXO_C;
break;
case LINE_XOXX: //#define LINE_XOXX 4194421
charcode=LINE_XOXX_C;
break;
case LINE_OXXX: //#define LINE_OXXX 4194423
charcode=LINE_OXXX_C;
break;
case LINE_XXXX: //#define LINE_XXXX 4194414
charcode=LINE_XXXX_C;
break;
default:
charcode = (char)ch;
break;
}
int cury=win->cursory;
int p = win->cursorx;
int curx=(win->line[cury].width_in_bytes==win->width)?win->cursorx:cursorx_to_position(win->line[cury].chars, win->cursorx, &p);
if(curx!=p)
{
const char* ts = win->line[cury].chars+p;
int len = ANY_LENGTH;
unsigned tc = UTF8_getch(&ts, &len);
int tw = mk_wcwidth((wchar_t)tc);
win->line[cury].width_in_bytes += erease_utf8_by_cw(win->line[cury].chars+p, tw, tw, win->width*4-p-1);
curx = p+tw-1;
}
else if(win->line[cury].width_in_bytes!=win->width)
{
win->line[cury].width_in_bytes += erease_utf8_by_cw(win->line[cury].chars+p, 1, 1, win->width*4-p-1);
}
//if (win2 > -1){
win->line[cury].chars[curx]=charcode;
win->line[cury].FG[win->cursorx]=win->FG;
win->line[cury].BG[win->cursorx]=win->BG;
win->draw=true;
addedchar(win);
return 1;
// else{
// win2=win2+1;
}
//Move the cursor of windows 0 (stdscr)
int move(int y, int x)
{
return wmove(mainwin,y,x);
}
//Set the amount of time getch waits for input
void timeout(int delay)
{
curses_timeout(delay);
}
void set_escdelay(int delay) { } //PORTABILITY, DUMMY FUNCTION
int echo()
{
echoOn = 1;
return 0; // 0 = OK, -1 = ERR
}
int noecho()
{
echoOn = 0;
return 0;
}
#endif
+1 -1
View File
@@ -1,3 +1,3 @@
fixedsys
Terminus
8
16
Executable → Regular
View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Executable → Regular
+81 -1
View File
@@ -1,4 +1,84 @@
Changelog will be a little light for the early entries due to me being really bad at documenting things.
0.7.1 (bugfix point release)
Vehicle bed sleepiness fix.
Made coughing from smoke wake you up.
Update version for MSVC project builds.
Remove coverage property from wristwatch to prevent ensumberance.
Supress pickup from vehicle when doing autopickup.
Fix typo in spawn list.
Don't draw item glyphs on top of furniture glyphs.
Strip out references to a removed ammunition in spawn lists.
Change in how Vehicle Examination window is displayed so it works in 12x12 View Screens
Fix for weapon mods with no ammo types.
0.7
Highlights:
---
Use ncursesw and gettext for i18n support and expanded character palette.
Configurable Autopickup feature.
Configurable item spawning lists, now with more configurable spawn frequencies.
New advanced bionics.
Features:
---
Use ncursesw and gettext for i18n support and expanded character palette.
Configurable Autopickup feature.
Configurable item spawning lists, now with more configurable spawn frequencies.
Probability Travel Bionic (walk through walls!)
Railgun Bionic (throw metal items at the speed of electricity!)
Flashbang bionic.
Shockwave Generator bionic.
Chain Lightning bionic.
Artificial Night bionic.
Streamlined lumberjacking tasks.
Splints are now craftable and (slowly!) heal broken limbs.
Recover CBMs from butchered player corpses
Small game arrow.
Spoiled (rotten) items will now be removed from the map after twice the time it takes to spoil.
Lit torches set enemies on fire.
Toggled Metabolic Interchange bionic, active power sources.
Changed Optimist to be more thematic and balanced.
Morale effects have more flexible durations.
Extensively reworked fire handling, e.g. campfires should last a more reasonable duration.
Preserve martial art style selection across wielding/unwielding weapons.
Simulate alt+number input for SDL version.
Quicksave command.
Added basic sludge crawler monster
More crafting recipes.
Stash knives in your boots.
Folding bicycle you can stash in a trunk.
New improvised guns.
More survival-ish foods.
Added some more heavy pistols and ammunition.
New Improvised lockpick!
Floatation Vest.
Added wine and a new shirt.
Towels.
Fuzzy time display, and precise time with wristwatch item.
Bugfixes:
---
Multiple gates near one handle work correctly.
Made wild Jabberwocks much more rare.
Fix turrets shuffing around when off map.
Prevent gibbing from low-damage sources.
House generation fixes.
Allow deconstruction of refrigerators.
More consistent road placement.
Make mongroups die propperly, even if the queen dies at a distance
Monsters killed by wide attacks drop corpses/loot
Fix solar panel power production on vehicles.
Cleanup tire changing activity.
Fix stunlock caused by counterattacks.
Keep Jabberwocks from spawning in classic mode.
Fix turret drops.
Extensive text handling fixes.
Menu beautification.
Allow saving while in a vehicle.
Fix div0 on bad option setting.
======
0.6
+1 -1
View File
@@ -4,7 +4,7 @@
Original author: Project Manager: Website/Forum:
Whales (retired) TheDarklingWolf GlyphGryph
Main Developers/Gihub Managers:
Main Developers/Github Managers:
Kevingranade, Ozone, TheDarklingWolf, zpmorgan
Active Contributors:
+8 -8
View File
@@ -1,18 +1,18 @@
# This message may be 16 lines long at maximum.
# Max length of a line is 68 characters; the following line is for reference
####################################################################
New features v0.5:
* Todo
* Fixes, fixes and more fixes.
New features v0.7 Lindqvist:
* Preliminary i18n support.
* More advanced bionics.
* Autopickup
For latest discussions and news on Cataclysm DDA, please visit:
Homepage: http://www.cataclysmdda.com/
Forum: http://www.cataclysmdda.com/smf/
Forum: http://smf.cataclysmdda.com/
Wiki: http://wiki.cataclysmdda.com/
The game now has new configurable options:
Customizeable Viewport, Spawntype: Classic/Static, Starting time
Static NPCs, Randomly spawning NPCs, Seasons
New configurable options:
Autosave frequency, Trigonometric (circular) distance,
Trait points cap, radiation lethality.
Ingame you can access the options via the help menu (?2).
+543
View File
@@ -0,0 +1,543 @@
[
{
"id" : "bio_null",
"name" : "NULL bionics",
"cost" : 0,
"time" : 0,
"description": "If you're seeing this, it's a bug. (game::init_bionics)"
},
{
"id" : "bio_batteries",
"name" : "Battery System",
"cost" : 0,
"time" : 0,
"flags" : ["POWER"],
"description": "You have a battery draining attachment, and thus can make use of the energy\ncontained in normal, everyday batteries. Use 'E' to consume batteries."
},
{
"id" : "bio_metabolics",
"name" : "Metabolic Interchange",
"cost" : 0,
"time" : 100,
"flags" : ["POWER", "ACTIVE"],
"description": "Your digestive system and power supply are interconnected. Any drain on\nenergy instead increases your hunger."
},
{
"id" : "bio_solar",
"name" : "Solar Panels",
"cost" : 0,
"time" : 0,
"flags" : ["POWER"],
"description": "You have a few solar panels installed. While in direct sunlight, your power\nlevel will slowly recharge."
},
{
"id" : "bio_torsionratchet",
"name" : "Joint Torsion Ratchet",
"cost" : 0,
"time" : 0,
"flags" : ["POWER"],
"description": "Your joints have been equipped with torsion ratchets that generate power slowly\nwhen you move."
},
{
"id" : "bio_furnace",
"name" : "Internal Furnace",
"cost" : 0,
"time" : 0,
"flags" : ["POWER"],
"description": "You can burn nearly any organic material as fuel (use 'E'), recharging your\npower level. Some materials will burn better than others."
},
{
"id" : "bio_ethanol",
"name" : "Ethanol Burner",
"cost" : 0,
"time" : 0,
"flags" : ["POWER"],
"description": "You burn alcohol as fuel in an extremely efficient reaction. However, you\nwill still suffer the inebriating effects of the substance."
},
{
"id" : "bio_memory",
"name" : "Enhanced Memory Banks",
"cost" : 1,
"time" : 0,
"description": "Your memory has been enhanced with small quantum storage drives. Any time\nyou start to forget a skill, you have a chance at retaining all knowledge, at\nthe cost of a small amount of poweron."
},
{
"id" : "bio_ears",
"name" : "Enhanced Hearing",
"cost" : 0,
"time" : 0,
"description": "Your hearing has been drastically improved, allowing you to hear ten times\nbetter than the average person. Additionally, high-intensity sounds will be\nautomatically dampened before they can damage your hearing."
},
{
"id" : "bio_eye_enhancer",
"name" : "Diamond Cornea",
"cost" : 0,
"time" : 0,
"description": "Your vision is greatly enhanced, giving you a +2 bonus to perception."
},
{
"id" : "bio_membrane",
"name" : "Nictating Membrane",
"cost" : 0,
"time" : 0,
"description": "Your eyes have a thin membrane that closes over your eyes while underwater,\nnegating any vision penalties."
},
{
"id" : "bio_targeting",
"name" : "Targeting System",
"cost" : 0,
"time" : 0,
"description": "Your eyes are equipped with range finders, and their movement is synced with\nthat of your arms, to a degree. Shots you fire will be much more accurate,\nparticularly at long range."
},
{
"id" : "bio_gills",
"name" : "Membrane Oxygenator",
"cost" : 1,
"time" : 0,
"description": "An oxygen interchange system automatically switches on while underwater,\nslowly draining your energy reserves but providing oxygen."
},
{
"id" : "bio_purifier",
"name" : "Air Filtration System",
"cost" : 1,
"time" : 0,
"description": "Implanted in your trachea is an advanced filtration system. If toxins find\ntheir way into your windpipe, the filter will attempt to remove them."
},
{
"id" : "bio_climate",
"name" : "Internal Climate Control",
"cost" : 1,
"time" : 30,
"flags" : ["ACTIVE"],
"description": "Throughout your body lies a network of thermal piping which eases the effects\nof high and low ambient temperatures."
},
{
"id" : "bio_storage",
"name" : "Internal Storage",
"cost" : 0,
"time" : 0,
"description": "Space inside your chest cavity has been converted into a storage area. You\nmay carry an extra 8 units of volume."
},
{
"id" : "bio_recycler",
"name" : "Recycler Unit",
"cost" : 0,
"time" : 0,
"description": "Your digestive system has been outfitted with a series of filters and\nprocessors, allowing you to reclaim waste liquid and, to a lesser degree,\nnutrients. The net effect is a greatly reduced need to eat and drink."
},
{
"id" : "bio_digestion",
"name" : "Expanded Digestive System",
"cost" : 0,
"time" : 0,
"description": "You have been outfitted with three synthetic stomachs and industrial-grade\nintestines. Not only can you extract much more nutrition from food, but you\nare highly resistant to foodborne illness, and can sometimes eat rotten food."
},
{
"id" : "bio_tools",
"name" : "Integrated Toolset",
"cost" : 0,
"time" : 0,
"description": "Implanted in your hands and fingers is a complete tool set - screwdriver,\nhammer, wrench, and heating elements. You can use this in place of many\ntools when crafting."
},
{
"id" : "bio_shock",
"name" : "Electroshock Unit",
"cost" : 1,
"time" : 0,
"description": "While fighting unarmed, or with a weapon that conducts electricity, there is\na chance that a successful hit will shock your opponent, inflicting extra\ndamage and disabling them temporarily at the cost of some energy."
},
{
"id" : "bio_heat_absorb",
"name" : "Heat Drain",
"cost" : 1,
"time" : 0,
"description": "While fighting unarmed against a warm-blooded opponent, there is a chance\nthat a successful hit will drain body heat, inflicting a small amount of\nextra damage, and increasing your power reserves slightly."
},
{
"id" : "bio_carbon",
"name" : "Subdermal Carbon Filament",
"cost" : 0,
"time" : 0,
"description": "Lying just beneath your skin is a thin armor made of carbon nanotubes. This\nreduces bashing damage by 2 and cutting damage by 4."
},
{
"id" : "bio_armor_head",
"name" : "Alloy Plating - Head",
"cost" : 0,
"time" : 0,
"description": "The flesh on your head has been replaced by a strong armor, protecting both\nyour head and jaw regions."
},
{
"id" : "bio_armor_torso",
"name" : "Alloy Plating - Torso",
"cost" : 0,
"time" : 0,
"description": "The flesh on your torso has been replaced by a strong armor, protecting you\ngreatly."
},
{
"id" : "bio_armor_arms",
"name" : "Alloy Plating - Arms",
"cost" : 0,
"time" : 0,
"description": "The flesh on your arms has been replaced by a strong armor, protecting you\ngreatly."
},
{
"id" : "bio_armor_legs",
"name" : "Alloy Plating - Legs",
"cost" : 0,
"time" : 0,
"description": "The flesh on your legs has been replaced by a strong armor, protecting you\ngreatly."
},
{
"id" : "bio_flashlight",
"name" : "Cranial Flashlight",
"cost" : 1,
"time" : 30,
"flags" : ["ACTIVE"],
"description": "Mounted between your eyes is a small but powerful LED flashlight."
},
{
"id" : "bio_night_vision",
"name" : "Implanted Night Vision",
"cost" : 1,
"time" : 20,
"flags" : ["ACTIVE"],
"description": "Your eyes have been modified to amplify existing light, allowing you to see\nin the dark."
},
{
"id" : "bio_infrared",
"name" : "Infrared Vision",
"cost" : 1,
"time" : 4,
"flags" : ["ACTIVE"],
"description": "Your range of vision extends into the infrared, allowing you to see warm-\nblooded creatures in the dark, and even through walls."
},
{
"id" : "bio_face_mask",
"name" : "Facial Distortion",
"cost" : 1,
"time" : 10,
"flags" : ["ACTIVE"],
"description": "Your face is actually made of a compound which may be molded by electrical\nimpulses, making you impossible to recognize. While not powered, however,\nthe compound reverts to its default shape."
},
{
"id" : "bio_ads",
"name" : "Active Defense System",
"cost" : 1,
"time" : 7,
"flags" : ["ACTIVE"],
"description": "A thin forcefield surrounds your body, continually draining power. Anything\nattempting to penetrate this field has a chance of being deflected at the\ncost of more energy. Melee attacks will be stopped more often than bullets."
},
{
"id" : "bio_ods",
"name" : "Offensive Defense System",
"cost" : 1,
"time" : 6,
"flags" : ["ACTIVE"],
"description": "A thin forcefield surrounds your body, continually draining power. This\nfield does not deflect penetration, but rather delivers a very strong shock,\ndamaging unarmed attackers and those with a conductive weapon."
},
{
"id" : "bio_scent_mask",
"name" : "Olfactory Mask",
"cost" : 1,
"time" : 8,
"flags" : ["ACTIVE"],
"description": "While this system is powered, your body will produce very little odor, making\nit nearly impossible for creatures to track you by scent."
},
{
"id" : "bio_scent_vision",
"name" : "Scent Vision",
"cost" : 1,
"time" : 30,
"flags" : ["ACTIVE"],
"description": "While this system is powered, you're able to visually sense your own scent,\nmaking it possible for you to recognize your surroundings even if you can't\nsee it."
},
{
"id" : "bio_cloak",
"name" : "Cloaking System",
"cost" : 2,
"time" : 1,
"flags" : ["ACTIVE"],
"description": "This high-power system uses a set of cameras and LEDs to make you blend into\nyour background, rendering you fully invisible to normal vision. However,\nyou may be detected by infrared, sonar, etc."
},
{
"id" : "bio_painkiller",
"name" : "Sensory Dulling",
"cost" : 2,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Your nervous system is wired to allow you to inhibit the signals of pain,\nallowing you to dull your senses at will. However, the use of this system\nmay cause delayed reaction time and drowsiness."
},
{
"id" : "bio_nanobots",
"name" : "Repair Nanobots",
"cost" : 5,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Inside your body is a fleet of tiny dormant robots. Once charged from your\nenergy banks, they will flit about your body, repairing any damage."
},
{
"id" : "bio_heatsink",
"name" : "Thermal Dissipation",
"cost" : 1,
"time" : 6,
"flags" : ["ACTIVE"],
"description": "Powerful heatsinks supermaterials are woven into your flesh. While powered,\nthis system will prevent heat damage up to 2000 degrees fahrenheit. Note\nthat this does not affect your internal temperature."
},
{
"id" : "bio_resonator",
"name" : "Sonic Resonator",
"cost" : 4,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Your entire body may resonate at very high power, creating a short-range\nshockwave. While it will not to much damage to flexible creatures, stiff\nitems such as walls, doors, and even robots will be severely damaged."
},
{
"id" : "bio_time_freeze",
"name" : "Time Dilation",
"cost" : 3,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "At an immense cost of power, you may increase your body speed and reactions\ndramatically, essentially freezing time. You are still delicate, however,\nand violent or rapid movements may damage you due to friction."
},
{
"id" : "bio_teleport",
"name" : "Teleportation Unit",
"cost" : 10,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "This highly experimental unit folds space over short distances, instantly\ntransporting your body up to 25 feet at the cost of much power. Note that\nprolonged or frequent use may have dangerous side effects."
},
{
"id" : "bio_blood_anal",
"name" : "Blood Analysis",
"cost" : 1,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Small sensors have been implanted in your heart, allowing you to analyse your\nblood. This will detect many illnesses, drugs, and other conditions."
},
{
"id" : "bio_blood_filter",
"name" : "Blood Filter",
"cost" : 3,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "A filtration system in your heart allows you to actively filter out chemical\nimpurities, primarily drugs. It will have limited impact on viruses. Note\nthat it is not a targeted filter; ALL drugs in your system will be affected."
},
{
"id" : "bio_alarm",
"name" : "Alarm System",
"cost" : 1,
"time" : 400,
"flags" : ["ACTIVE"],
"description": "A motion-detecting alarm system will notice almost all movement within a\nfifteen-foot radius, and will silently alert you. This is very useful during\nsleep, or if you suspect a cloaked pursuer."
},
{
"id" : "bio_evap",
"name" : "Aero-Evaporator",
"cost" : 8,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "This unit draws moisture from the surrounding air, which then is poured from\na fingertip in the form of water. It may fail in very dry environments."
},
{
"id" : "bio_lighter",
"name" : "Mini-Flamethrower",
"cost" : 3,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "The index fingers of both hands have powerful fire starters which extend from\nthe tip."
},
{
"id" : "bio_claws",
"name" : "Adamantium Claws",
"cost" : 3,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Your fingers can withdraw into your hands, allowing a set of vicious claws to\nextend. These do considerable cutting damage, but prevent you from holding\nanything else."
},
{
"id" : "bio_blaster",
"name" : "Fusion Blaster Arm",
"cost" : 2,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Your left arm has been replaced by a heavy-duty fusion blaster! You may use\nyour energy banks to fire a damaging heat ray; however, you are unable to use\nor carry two-handed items, and may only fire handguns."
},
{
"id" : "bio_laser",
"name" : "Finger-Mounted Laser",
"cost" : 2,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "One of your fingers has a small high-powered laser embedded in it. This long\nrange weapon is not incredibly damaging, but is very accurate, and has the\npotential to start fires."
},
{
"id" : "bio_emp",
"name" : "Directional EMP",
"cost" : 4,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Mounted in the palms of your hand are small parabolic EMP field generators.\nYou may use power to fire a short-ranged blast which will disable electronics\nand robots."
},
{
"id" : "bio_hydraulics",
"name" : "Hydraulic Muscles",
"cost" : 1,
"time" : 3,
"flags" : ["ACTIVE"],
"description": "While activated, the muscles in your arms will be greatly enchanced,\nincreasing your strength by 20."
},
{
"id" : "bio_water_extractor",
"name" : "Water Extraction Unit",
"cost" : 2,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Nanotubes embedded in the palm of your hand will pump any available fluid out\nof a dead body, cleanse it of impurities and convert it into drinkable water.\nYou must, however, have a container to store the water in."
},
{
"id" : "bio_magnet",
"name" : "Electromagnetic Unit",
"cost" : 2,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Embedded in your hand is a powerful electromagnet, allowing you to pull items\nmade of iron over short distances."
},
{
"id" : "bio_fingerhack",
"name" : "Fingerhack",
"cost" : 1,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "One of your fingers has an electrohack embedded in it; an all-purpose hacking\nunit used to override control panels and the like (but not computers). Skill\nin computers is important, and a failed use may damage your circuits."
},
{
"id" : "bio_lockpick",
"name" : "Fingerpick",
"cost" : 1,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "One of your fingers has an electronic lockpick embedded in it. This auto-\nmatic system will quickly unlock all but the most advanced key locks without\nany skill required on the part of the user."
},
{
"id" : "bio_ground_sonar",
"name" : "Terranian Sonar",
"cost" : 1,
"time" : 5,
"flags" : ["ACTIVE"],
"description": "Your feet are equipped with precision sonar equipment, allowing you to detect\nthe movements of creatures below the ground."
},
{
"id" : "bio_power_armor_interface",
"name" : "Power Armor Interface",
"cost" : 1,
"time" : 10,
"flags" : ["ACTIVE"],
"description": "Interfaces your power system with the internal charging port on suits of power armor."
},
{
"id" : "bio_power_armor_interface_mkII",
"name" : "Power Armor Interface Mk. II",
"cost" : 1,
"time" : 50,
"flags" : ["ACTIVE"],
"description": "Interfaces your power system with the internal charging port on suits of power armor.\nThe Mk. II was designed by DoubleTech Inc., to meet the popularity of the Mk. II\npower armor series."
},
{
"id" : "bio_flashbang",
"name" : "Flashbang Generator",
"cost" : 5,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Light emitting diodes integrated into your skin can release a flash comparable\nto a flashbang grenade, blinding nearby enemies. Speakers integrated into your\nbody mimic the loud sound, deafening those nearby."
},
{
"id" : "bio_railgun",
"name" : "Railgun",
"cost" : 1,
"time" : 100,
"flags" : ["ACTIVE"],
"description": "EM field generators in your arms double the range and damage of thrown\niron and steel objects at a cost of 1 power per throw, causing them to\nleave a trail of electricity that can cause additional damage."
},
{
"id" : "bio_probability_travel",
"name" : "Probability Travel",
"cost" : 1,
"time" : 100,
"flags" : ["ACTIVE"],
"description": "Increases your body's wavelength, allowing you to quantum tunnel through\nwalls, reappearing on the other side. Power drain in standby is minimal,\nbut each tile tunneled through costs 10 bionic power."
},
{
"id" : "bio_shockwave",
"name" : "Shockwave Generator",
"cost" : 10,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "You generate a powerful shockwave, knocking back all nearby creatures.\nTargets are stunned briefly, take damage and additional stun upon impact\nwith impassable terrain, and knockback any creatures they collide with."
},
{
"id" : "bio_chain_lightning",
"name" : "Chain Lightning",
"cost" : 5,
"time" : 0,
"flags" : ["ACTIVE"],
"description": "Your body is equipped with a chain lightning generator, allowing you to\n emit a blast of lightning at a target, leaving a trail of lightning in\n its wake, jumping to additional targets within 4 tiles of the previous target."
},
{
"id" : "bio_night",
"name" : "Artificial Night Generator",
"cost" : 1,
"time" : 2,
"flags" : ["ACTIVE"],
"description": "Destructive interference eliminates all light within a 15 tile radius."
},
{
"id" : "bio_dis_shock",
"name" : "Electrical Discharge",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "A malfunctioning bionic which occasionally discharges electricity through\nyour body, causing pain and brief paralysis but no damage."
},
{
"id" : "bio_dis_acid",
"name" : "Acidic Discharge",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "A malfunctioning bionic which occasionally discharges acid into your muscles,\ncausing sharp pain and minor damage."
},
{
"id" : "bio_drain",
"name" : "Electrical Drain",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "A malfunctioning bionic. It doesn't perform any useful function, but will\noccasionally draw power from your batteries."
},
{
"id" : "bio_noise",
"name" : "Noisemaker",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "A malfunctioning bionic. It will occasionally emit a loud burst of noise."
},
{
"id" : "bio_power_weakness",
"name" : "Power Overload",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "Damaged power circuits cause short-circuiting inside your muscles when your\nbatteries are above 75%%%% capacity, causing greatly reduced strength. This\nhas no effect if you have no internal batteries."
},
{
"id" : "bio_stiff",
"name" : "Wire-induced Stiffness",
"cost" : 0,
"time" : 0,
"flags" : ["FAULTY"],
"description": "Improperly installed wires cause a physical stiffness in most of your body,\ncausing increased encumberance."
}
]
+3055 -10
View File
File diff suppressed because it is too large Load Diff
+434 -136
View File
File diff suppressed because it is too large Load Diff
+58 -34
View File
@@ -14,11 +14,11 @@
"bashing" : 1,
"cutting" : 0,
"to_hit" : 0,
"ammo_type" : "none",
"ammo_type" : "NULL",
"damage" : 0,
"pierce" : 0,
"range" : 0,
"accuracy" : 0,
"dispersion" : 0,
"recoil" : 0,
"count" : 10
},
@@ -37,11 +37,11 @@
"bashing" : 1,
"cutting" : 0,
"to_hit" : 0,
"ammo_type" : "none",
"ammo_type" : "NULL",
"damage" : 0,
"pierce" : 0,
"range" : 0,
"accuracy" : 0,
"dispersion" : 0,
"recoil" : 0,
"count" : 10
},
@@ -64,7 +64,7 @@
"damage" : 0,
"pierce" : 0,
"range" : 0,
"accuracy" : 40,
"dispersion" : 34,
"recoil" : 0,
"count" : 10
},
@@ -87,7 +87,7 @@
"damage" : 2,
"pierce" : 0,
"range" : 1,
"accuracy" : 35,
"dispersion" : 29,
"recoil" : 0,
"count" : 10
},
@@ -110,7 +110,7 @@
"damage" : 3,
"pierce" : 0,
"range" : 3,
"accuracy" : 30,
"dispersion" : 24,
"recoil" : 0,
"count" : 10
},
@@ -133,7 +133,7 @@
"damage" : 3,
"pierce" : 0,
"range" : 2,
"accuracy" : 35,
"dispersion" : 29,
"recoil" : 0,
"count" : 10
},
@@ -156,10 +156,34 @@
"damage" : 6,
"pierce" : 1,
"range" : 2,
"accuracy" : 35,
"dispersion" : 29,
"recoil" : 0,
"count" : 10
},
{
"type" : "AMMO",
"id" : "arrow_small_game",
"rarity" : 0,
"price" : 30,
"name" : "small game arrow",
"symbol" : "=",
"color" : "green",
"description" : "A simple arrow shaft that has a wide blunt head. Useful for hunting small woodland creatures without splattering them all over the ground.",
"material" : "wood",
"volume" : 1,
"weight" : 13,
"bashing" : 4,
"cutting" : 0,
"to_hit" : 0,
"ammo_type" : "arrow",
"damage" : 2,
"pierce" : 0,
"range" : 2,
"dispersion" : 29,
"recoil" : 0,
"count" : 10,
"flags" : ["NOGIB"]
},
{
"type" : "AMMO",
"id" : "arrow_fire_hardened_fletched",
@@ -179,7 +203,7 @@
"damage" : 4,
"pierce" : 0,
"range" : 6,
"accuracy" : 20,
"dispersion" : 14,
"recoil" : 0,
"count" : 10
},
@@ -202,7 +226,7 @@
"damage" : 7,
"pierce" : 2,
"range" : 6,
"accuracy" : 20,
"dispersion" : 14,
"recoil" : 0,
"count" : 10
},
@@ -225,7 +249,7 @@
"damage" : 10,
"pierce" : 3,
"range" : 7,
"accuracy" : 15,
"dispersion" : 9,
"recoil" : 0,
"count" : 10
},
@@ -248,7 +272,7 @@
"damage" : 5,
"pierce" : 2,
"range" : 7,
"accuracy" : 15,
"dispersion" : 9,
"recoil" : 0,
"count" : 10
},
@@ -271,7 +295,7 @@
"damage" : 6,
"pierce" : 3,
"range" : 7,
"accuracy" : 15,
"dispersion" : 9,
"recoil" : 0,
"count" : 10
},
@@ -294,7 +318,7 @@
"damage" : 12,
"pierce" : 5,
"range" : 8,
"accuracy" : 10,
"dispersion" : 4,
"recoil" : 0,
"count" : 10
},
@@ -317,7 +341,7 @@
"damage" : 5,
"pierce" : 3,
"range" : 5,
"accuracy" : 25,
"dispersion" : 19,
"recoil" : 0,
"count" : 10
},
@@ -340,7 +364,7 @@
"damage" : 14,
"pierce" : 7,
"range" : 10,
"accuracy" : 10,
"dispersion" : 4,
"recoil" : 0,
"count" : 10
},
@@ -363,7 +387,7 @@
"damage" : 10,
"pierce" : 5,
"range" : 8,
"accuracy" : 15,
"dispersion" : 9,
"recoil" : 0,
"count" : 8
},
@@ -386,7 +410,7 @@
"damage" : 15,
"pierce" : 9,
"range" : 5,
"accuracy" : 25,
"dispersion" : 19,
"recoil" : 0,
"count" : 5,
"effects" : ["EXPLOSIVE"]
@@ -427,7 +451,7 @@
"damage" : 15,
"pierce" : 9,
"range" : 5,
"accuracy" : 25,
"dispersion" : 19,
"recoil" : 0,
"count" : 5,
"effects" : ["IGNITE"]
@@ -451,7 +475,7 @@
"damage" : 10,
"pierce" : 1,
"range" : 0,
"accuracy" : 16,
"dispersion" : 10,
"recoil" : 0,
"count" : 15
},
@@ -474,7 +498,7 @@
"damage" : 20,
"pierce" : 10,
"range" : 6,
"accuracy" : 15,
"dispersion" : 9,
"recoil" : 0,
"count" : 10
},
@@ -498,7 +522,7 @@
"to_hit" : 0,
"ranged_damage" : 4,
"range" : 5,
"accuracy" : 28,
"dispersion" : 20,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -525,7 +549,7 @@
"to_hit" : 0,
"ranged_damage" : 3,
"range" : 6,
"accuracy" : 22,
"dispersion" : 14,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -552,7 +576,7 @@
"to_hit" : 1,
"ranged_damage" : 5,
"range" : 10,
"accuracy" : 20,
"dispersion" : 12,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -579,7 +603,7 @@
"to_hit" : 0,
"ranged_damage" : 7,
"range" : 12,
"accuracy" : 18,
"dispersion" : 10,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -606,7 +630,7 @@
"to_hit" : 0,
"ranged_damage" : 9,
"range" : 14,
"accuracy" : 16,
"dispersion" : 8,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -633,7 +657,7 @@
"to_hit" : 0,
"ranged_damage" : 11,
"range" : 16,
"accuracy" : 14,
"dispersion" : 6,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -660,7 +684,7 @@
"to_hit" : 0,
"ranged_damage" : 7,
"range" : 20,
"accuracy" : 26,
"dispersion" : 18,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -687,7 +711,7 @@
"to_hit" : 0,
"ranged_damage" : 15,
"range" : 18,
"accuracy" : 16,
"dispersion" : 8,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -714,7 +738,7 @@
"to_hit" : -0,
"ranged_damage" : -6,
"range" : 6,
"accuracy" : 20,
"dispersion" : 12,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -741,7 +765,7 @@
"to_hit" : 1,
"ranged_damage" : 0,
"range" : 10,
"accuracy" : 18,
"dispersion" : 10,
"recoil" : 0,
"durability" : 6,
"burst" : 0,
@@ -768,7 +792,7 @@
"to_hit" : -1,
"ranged_damage" : 30,
"range" : 30,
"accuracy" : 30,
"dispersion" : 22,
"recoil" : 30,
"durability" : 6,
"burst" : 0,
@@ -795,7 +819,7 @@
"to_hit" : -1,
"ranged_damage" : -2,
"range" : 8,
"accuracy" : 30,
"dispersion" : 22,
"recoil" : 15,
"durability" : 6,
"burst" : 3,
+84 -6
View File
@@ -95,7 +95,8 @@
"bashing" : 1,
"flags" : ["VARSIZE"],
"coverage" : 95,
"material_thickness" : 4
"material_thickness" : 4,
"use_action" : "BOOTS"
},
{
"type" : "ARMOR",
@@ -120,7 +121,8 @@
"bashing" : 1,
"flags" : ["VARSIZE"],
"coverage" : 95,
"material_thickness" : 6
"material_thickness" : 6,
"use_action" : "BOOTS"
},
{
"type" : "ARMOR",
@@ -145,7 +147,8 @@
"bashing" : 4,
"flags" : ["VARSIZE"],
"coverage" : 95,
"material_thickness" : 4
"material_thickness" : 4,
"use_action" : "BOOTS"
},
{
"type" : "ARMOR",
@@ -170,7 +173,8 @@
"bashing" : 0,
"flags" : ["VARSIZE"],
"coverage" : 95,
"material_thickness" : 8
"material_thickness" : 8,
"use_action" : "BOOTS"
},
{
"type" : "ARMOR",
@@ -768,6 +772,31 @@
"coverage" : 80,
"material_thickness" : 1
},
{
"type" : "ARMOR",
"id" : "flag_shirt",
"name" : "flag shirt",
"weight" : 2,
"color" : "light_red",
"covers" : ["TORSO"],
"to_hit" : 0,
"storage" : 0,
"symbol" : "[",
"description" : "A t-shirt embroided with the pattern of an American flag.",
"price" : 300,
"material" : ["cotton", "null"],
"volume" : 3,
"cutting" : 0,
"warmth" : 10,
"phase" : "solid",
"enviromental_protection" : 0,
"rarity" : 80,
"encumberance" : 1,
"bashing" : -5,
"flags" : ["VARSIZE"],
"coverage" : 80,
"material_thickness" : 1
},
{
"type" : "ARMOR",
"id" : "polo_shirt",
@@ -1143,6 +1172,31 @@
"coverage" : 95,
"material_thickness" : 3
},
{
"type" : "ARMOR",
"id" : "floatation_vest",
"name" : "floataion vest",
"weight" : 8,
"color" : "cyan",
"covers" : ["TORSO"],
"to_hit" : -3,
"storage" : 0,
"symbol" : "[",
"description" : "A brightly-colored vest designed to keep you upright and floating in water.",
"price" : 100,
"material" : ["plastic", "cotton"],
"volume" : 20,
"cutting" : 0,
"warmth" : 5,
"phase" : "solid",
"enviromental_protection" : 0,
"rarity" : 30,
"encumberance" : 1,
"bashing" : 2,
"flags" : ["FLOATATION"],
"coverage" : 40,
"material_thickness" : 5
},
{
"type" : "ARMOR",
"id" : "trenchcoat_leather",
@@ -2902,10 +2956,10 @@
"initial_charges": 0,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "none",
"ammo": "NULL",
"revert_to": "null",
"phase" : "solid",
"use_action" : "RAD_BADGE"
"use_action" : "RAD_BADGE"
},
{
"type" : "ARMOR",
@@ -3523,5 +3577,29 @@
"bashing" : -5,
"coverage" : 70,
"material_thickness" : 4
},
{
"type" : "ARMOR",
"id" : "wristwatch",
"name" : "wrist watch",
"volume" : 0,
"material_thickness" : 0,
"storage" : 0,
"description" : "A simple wristwatch.",
"weight" : 0,
"to_hit" : -1,
"color" : "white",
"encumberance" : 0,
"price" : 50,
"material" : ["plastic", "steel"],
"flags" : ["WATCH", "ALARM"],
"coverage" : 1,
"rarity" : 5,
"symbol" : "[",
"bashing" : 0,
"cutting" : 0,
"warmth" : 0,
"enviromental_protection" : 0,
"phase" : "solid"
}
]
+2 -2
View File
@@ -1066,7 +1066,7 @@
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"material" : ["paper", "null"],
"volume" : 3,
"bashing" : 3,
"cutting" : 0,
@@ -1088,7 +1088,7 @@
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"material" : ["paper", "null"],
"volume" : 3,
"bashing" : 3,
"cutting" : 0,
+336 -34
View File
@@ -1,32 +1,32 @@
[
{
"id": "water",
"type": "COMESTIBLE",
"symbol": "~",
"color": "light_cyan",
"name": "water",
"description": "Water, the stuff of life, the best thirst-quencher available.",
"rarity": 90,
"price": 50,
"weight": 1,
"volume": 2,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"comestible_type": "DRINK",
"tool": "null",
"container": "bottle_plastic",
"quench": 40,
"nutrition": 0,
"spoils_in": 0,
"addiction_potential": 0,
"addiction_type" : "none",
"charges": 1,
"heal": 0,
"fun": 0,
"stim": 0,
"phase": "liquid"
},
{
"id": "water",
"type": "COMESTIBLE",
"symbol": "~",
"color": "light_cyan",
"name": "water",
"description": "Water, the stuff of life, the best thirst-quencher available.",
"rarity": 90,
"price": 50,
"weight": 1,
"volume": 2,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"comestible_type": "DRINK",
"tool": "null",
"container": "bottle_plastic",
"quench": 40,
"nutrition": 0,
"spoils_in": 0,
"addiction_potential": 0,
"addiction_type" : "none",
"charges": 1,
"heal": 0,
"fun": 0,
"stim": 0,
"phase": "liquid"
},
{
"type" : "COMESTIBLE",
"id" : "water_clean",
@@ -452,6 +452,37 @@
"flags" : ["EATEN_HOT"],
"fun" : 2
},
{
"type" : "COMESTIBLE",
"id" : "soup_woods",
"name" : "woods soup",
"weight" : 1,
"color" : "red",
"addiction_type" : "none",
"spoils_in" : 120,
"use_action" : "NONE",
"stim" : 0,
"container" : "can_food",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : 100,
"heal" : 1,
"addiction_potential" : 0,
"nutrition" : 140,
"description" : "A nutritious and delicious soup, made of gifts of nature.",
"price" : 50,
"material" : "flesh",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 1,
"rarity" : 15,
"bashing" : 0,
"flags" : ["EATEN_HOT"],
"fun" : 1
},
{
"type" : "COMESTIBLE",
"id" : "soup_human",
@@ -483,6 +514,126 @@
"flags" : ["EATEN_HOT"],
"fun" : 2
},
{
"type" : "COMESTIBLE",
"id" : "wine_riesling",
"name" : "riesling",
"weight" : 1,
"color" : "white",
"addiction_type" : "alcohol",
"spoils_in" : 0,
"use_action" : "ALCOHOL",
"stim" : -12,
"container" : "bottle_glass",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -10,
"heal" : -2,
"addiction_potential" : 5,
"nutrition" : 4,
"description" : "Sparkling white wine, made from the world's noblest grape.",
"price" : 85,
"material" : "null",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 5,
"rarity" : 16,
"bashing" : 0,
"fun" : 15
},
{
"type" : "COMESTIBLE",
"id" : "wine_chardonnay",
"name" : "chardonnay",
"weight" : 1,
"color" : "white",
"addiction_type" : "alcohol",
"spoils_in" : 0,
"use_action" : "ALCOHOL",
"stim" : -12,
"container" : "bottle_glass",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -10,
"heal" : -2,
"addiction_potential" : 5,
"nutrition" : 4,
"description" : "America's most popular wine, and for good reason.",
"price" : 85,
"material" : "null",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 5,
"rarity" : 24,
"bashing" : 0,
"fun" : 15
},
{
"type" : "COMESTIBLE",
"id" : "wine_cabernet",
"name" : "cabernet sauvignon",
"weight" : 1,
"color" : "red",
"addiction_type" : "alcohol",
"spoils_in" : 0,
"use_action" : "ALCOHOL",
"stim" : -12,
"container" : "bottle_glass",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -10,
"heal" : -2,
"addiction_potential" : 5,
"nutrition" : 4,
"description" : "The heavily disputed king of red wines. Pairs well red meats and pasta.",
"price" : 85,
"material" : "null",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 5,
"rarity" : 16,
"bashing" : 0,
"fun" : 15
},
{
"type" : "COMESTIBLE",
"id" : "wine_noir",
"name" : "pinot noir",
"weight" : 1,
"color" : "red",
"addiction_type" : "alcohol",
"spoils_in" : 0,
"use_action" : "ALCOHOL",
"stim" : -12,
"container" : "bottle_glass",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -10,
"heal" : -2,
"addiction_potential" : 5,
"nutrition" : 4,
"description" : "Prized by collectors and adored by critics, it is one of the rarer and more elegant wines.",
"price" : 85,
"material" : "null",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 5,
"rarity" : 12,
"bashing" : 0,
"fun" : 16
},
{
"type" : "COMESTIBLE",
"id" : "whiskey",
@@ -1367,6 +1518,37 @@
"flags" : ["EATEN_HOT"],
"fun" : 6
},
{
"type" : "COMESTIBLE",
"id" : "kompot",
"name" : "kompot",
"weight" : 1,
"color" : "red",
"addiction_type" : "none",
"spoils_in" : 180,
"use_action" : "NONE",
"stim" : 0,
"container" : "jar_glass",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : 60,
"heal" : 1,
"addiction_potential" : 0,
"nutrition" : 5,
"description" : "Clear juice obtained by cooking fruit in a large volume of water",
"price" : 70,
"material" : "null",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 5,
"rarity" : 1,
"bashing" : 0,
"flags" : [],
"fun" : 8
},
{
"type" : "COMESTIBLE",
"id" : "coffee",
@@ -4045,7 +4227,8 @@
"color" : "cyan",
"addiction_type" : "none",
"spoils_in" : 0,
"use_action" : "PKILL_1",
"use_action" : "PKILL",
"flags" : "PKILL_1",
"stim" : 0,
"container" : "null",
"to_hit" : 0,
@@ -4255,7 +4438,8 @@
"color" : "cyan",
"addiction_type" : "opiate",
"spoils_in" : 0,
"use_action" : "PKILL_2",
"use_action" : "PKILL",
"flags" : "PKILL_2",
"stim" : -2,
"container" : "null",
"to_hit" : 0,
@@ -4285,7 +4469,8 @@
"color" : "cyan",
"addiction_type" : "opiate",
"spoils_in" : 0,
"use_action" : "PKILL_3",
"use_action" : "PKILL",
"flags" : "PKILL_3",
"stim" : -4,
"container" : "null",
"to_hit" : 0,
@@ -4315,7 +4500,8 @@
"color" : "cyan",
"addiction_type" : "opiate",
"spoils_in" : 0,
"use_action" : "PKILL_L",
"use_action" : "PKILL",
"flags" : "PKILL_L",
"stim" : 0,
"container" : "null",
"to_hit" : 0,
@@ -4585,7 +4771,8 @@
"color" : "brown",
"addiction_type" : "opiate",
"spoils_in" : 0,
"use_action" : "PKILL_4",
"use_action" : "PKILL",
"flags" : "PKILL_4",
"stim" : -10,
"container" : "null",
"to_hit" : 0,
@@ -4705,7 +4892,8 @@
"color" : "pink",
"addiction_type" : "none",
"spoils_in" : 0,
"use_action" : "PKILL_2",
"use_action" : "PKILL",
"flags" : "PKILL_2",
"stim" : 0,
"container" : "null",
"to_hit" : 0,
@@ -4786,5 +4974,119 @@
"rarity" : 35,
"bashing" : 0,
"fun" : 0
},
{
"id": "mayonnaise",
"type": "COMESTIBLE",
"symbol": "~",
"color": "white",
"name": "mayonnaise",
"description": "Good old mayo, tastes great on sandwiches.",
"rarity": 60,
"price": 50,
"weight": 1,
"volume": 2,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"comestible_type": "DRINK",
"tool": "null",
"container": "bottle_plastic",
"quench": 15,
"nutrition": 15,
"spoils_in": 160,
"addiction_potential": 0,
"addiction_type" : "none",
"charges": 1,
"heal": 0,
"fun": 10,
"stim": 0,
"phase": "liquid"
},
{
"id": "ketchup",
"type": "COMESTIBLE",
"symbol": "~",
"color": "red",
"name": "ketchup",
"description": "Good old ketchup, tastes great on hotdogs.",
"rarity": 60,
"price": 50,
"weight": 1,
"volume": 2,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"comestible_type": "DRINK",
"tool": "null",
"container": "bottle_plastic",
"quench": 20,
"nutrition": 10,
"spoils_in": 300,
"addiction_potential": 0,
"addiction_type" : "none",
"charges": 1,
"heal": 0,
"fun": 15,
"stim": 0,
"phase": "liquid"
},
{
"id": "mustard",
"type": "COMESTIBLE",
"symbol": "~",
"color": "yellow",
"name": "mustard",
"description": "Good old mustard, tastes great on hamburgers.",
"rarity": 60,
"price": 50,
"weight": 1,
"volume": 2,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"comestible_type": "DRINK",
"tool": "null",
"container": "bottle_plastic",
"quench": 10,
"nutrition": 20,
"spoils_in": 300,
"addiction_potential": 0,
"addiction_type" : "none",
"charges": 1,
"heal": 0,
"fun": 15,
"stim": 0,
"phase": "liquid"
},
{
"type" : "COMESTIBLE",
"id" : "pickle",
"name" : "pickle",
"weight" : 1,
"color" : "green",
"addiction_type" : "none",
"spoils_in" : 0,
"use_action" : "NONE",
"stim" : 0,
"container" : "null",
"to_hit" : 0,
"comestible_type" : "FOOD",
"symbol" : "%",
"quench" : 5,
"heal" : 0,
"addiction_potential" : 0,
"nutrition" : 25,
"description" : "A pickled cucumber, rather sour but good and basically lasts forever.",
"price" : 25,
"material" : "veggy",
"tool" : "null",
"volume" : 1,
"cutting" : 0,
"phase" : "solid",
"charges" : 1,
"rarity" : 9,
"bashing" : 0,
"fun" : 5
}
]
+253
View File
@@ -0,0 +1,253 @@
[
{
"id": "bag_plastic",
"type": "CONTAINER",
"symbol": ")",
"color": "light_gray",
"name": "plastic bag",
"description": "A small, open plastic bag. Essentially trash.",
"rarity": 90,
"price": 1,
"weight": 0,
"volume": 1,
"bashing": -4,
"cutting": 0,
"to_hit": -8,
"contains": 24,
"material": "plastic"
},
{
"id": "bottle_plastic",
"type": "CONTAINER",
"symbol": ")",
"color": "light_cyan",
"name": "plastic bottle",
"description": "A resealable plastic bottle, holds 500mls of liquid.",
"rarity": 90,
"price": 8,
"weight": 0,
"volume": 2,
"bashing": -8,
"cutting": 0,
"to_hit": 1,
"material": "plastic",
"contains": 2,
"flags": ["RIGID", "WATERTIGHT", "SEALS"]
},
{
"id": "bottle_glass",
"type": "CONTAINER",
"symbol": ")",
"color": "cyan",
"name": "glass bottle",
"description": "A resealable glass bottle, holds 750mls of liquid.",
"rarity": 90,
"price": 1,
"weight": 2,
"volume": 3,
"bashing": -8,
"cutting": 0,
"to_hit": 1,
"material": "glass",
"contains": 3,
"flags": ["RIGID", "WATERTIGHT", "SEALS"]
},
{
"id": "can_drink",
"type": "CONTAINER",
"symbol": ")",
"color": "light_blue",
"name": "aluminum can",
"description": "An aluminum can, like what soda comes in.",
"rarity": 70,
"price": 1,
"weight": 0,
"volume": 1,
"bashing": 0,
"cutting": 0,
"to_hit": 0,
"material": "steel",
"contains": 1,
"flags": ["RIGID", "WATERTIGHT"]
},
{
"id": "can_food",
"type": "CONTAINER",
"symbol": ")",
"color": "blue",
"name": "tin can",
"description": "A tin can, like what beans come in.",
"rarity": 65,
"price": 2,
"weight": 0,
"volume": 1,
"bashing": -1,
"cutting": 0,
"to_hit": 1,
"material": "iron",
"contains": 1,
"flags": ["RIGID", "WATERTIGHT"]
},
{
"id": "box_small",
"type": "CONTAINER",
"symbol": ")",
"color": "brown",
"name": "sm. cardboard box",
"description": "A small cardboard box. No bigger than a foot in dimension.",
"rarity": 50,
"price": 0,
"weight": 0,
"volume": 4,
"bashing": -5,
"cutting": 0,
"to_hit": 1,
"material": "paper",
"contains": 4,
"flags": ["RIGID"]
},
{
"id": "canteen",
"type": "CONTAINER",
"symbol": ")",
"color": "green",
"name": "plastic canteen",
"description": "A large military-style water canteen, with a 1.5 liter capacity and strap.",
"rarity": 20,
"price": 1000,
"weight": 2,
"volume": 6,
"bashing": -8,
"cutting": 0,
"to_hit": 1,
"material": "plastic",
"contains": 6,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "jerrycan",
"type": "CONTAINER",
"symbol": ")",
"color": "green",
"name": "plastic jerrycan",
"description": "A bulky plastic jerrycan, meant to carry fuel, but can carry other liquids\nin a pinch. It has a capacity of 10 liters.",
"rarity": 10,
"price": 2500,
"weight": 4,
"volume": 40,
"bashing": -2,
"cutting": 0,
"to_hit": -2,
"material": "plastic",
"contains": 40,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "jug_plastic",
"type": "CONTAINER",
"symbol": ")",
"color": "light_cyan",
"name": "gallon jug",
"description": "A standard plastic jug used for household cleaning chemicals.",
"rarity": 10,
"price": 2500,
"weight": 2,
"volume": 10,
"bashing": -8,
"cutting": 0,
"to_hit": 1,
"material": "plastic",
"contains": 10,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "flask_glass",
"type": "CONTAINER",
"symbol": ")",
"color": "light_cyan",
"name": "glass flask",
"description": "A 250 ml laboratory conical flask, with a rubber bung.",
"rarity": 10,
"price": 2500,
"weight": 0,
"volume": 1,
"bashing": 8,
"cutting": 0,
"to_hit": 1,
"material": "glass",
"contains": 1,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "waterskin",
"type": "CONTAINER",
"symbol": ")",
"color": "brown",
"name": "waterskin",
"description": "A watertight leather bag, can hold 1.5 liters of water.",
"rarity": 0,
"price": 0,
"weight": 4,
"volume": 6,
"bashing": -8,
"cutting": 0,
"to_hit": -5,
"material": "leather",
"contains": 6,
"flags": ["SEALS", "WATERTIGHT"]
},
{
"id": "jerrycan_big",
"type": "CONTAINER",
"symbol": ")",
"color": "green",
"name": "steel jerrycan",
"description": "A steel jerrycan, meant to carry fuel, but can carry other liquids\nin a pinch. It has a capacity of 25 liters.",
"rarity": 20,
"price": 5000,
"weight": 7,
"volume": 100,
"bashing": -3,
"cutting": 0,
"to_hit": -3,
"material": "steel",
"contains": 100,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "keg",
"type": "CONTAINER",
"symbol": ")",
"color": "light_cyan",
"name": "aluminum keg",
"description": "A reusable aluminum keg, used for shipping beer.\nIt has a capacity of 50 liters.",
"rarity": 20,
"price": 6000,
"weight": 12,
"volume": 200,
"bashing": -4,
"cutting": 0,
"to_hit": -4,
"material": "steel",
"contains": 200,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
},
{
"id": "jar_glass",
"type": "CONTAINER",
"symbol": ")",
"color": "light_cyan",
"name": "glass jar",
"description": "A half-litre glass jar with a metal screw top lid, used for canning.",
"rarity": 50,
"price": 2500,
"weight": 1,
"volume": 1,
"bashing": 8,
"cutting": 0,
"to_hit": 1,
"material": "glass",
"contains": 1,
"flags": ["RIGID", "SEALS", "WATERTIGHT"]
}
]
+38 -3
View File
@@ -1567,12 +1567,12 @@
"id" : "spike",
"name" : "spike",
"description" : "A large and slightly misshapen spike, could do some damage mounted on a vehicle.",
"weight" : 2,
"weight" : 1,
"to_hit" : -2,
"color" : "cyan",
"symbol" : ";",
"material" : ["steel", "null"],
"volume" : 2,
"volume" : 1,
"bashing" : 2,
"cutting" : 10,
"flags" : ["STAB"],
@@ -1958,5 +1958,40 @@
"bashing": -20,
"cutting": 0,
"to_hit": 1
}
},
{
"id" : "money_bundle",
"name" : "money bundle",
"description" : "A bundle holding many 20 dollar bills, pretty useless now though",
"weight" : 3,
"to_hit" : -3,
"color" : "green",
"symbol" : ",",
"material" : ["paper", "null"],
"volume" : 3,
"bashing" : -8,
"cutting": -3,
"max_charges": 20,
"initial_charges": 20,
"charges_per_use": 1,
"turns_per_charge": 0,
"cutting" : 0,
"rarity" : 50,
"price" : 0
},
{
"id" : "cell_phone",
"name" : "cell phone",
"description" : "A broken cell phone only useful for parts now.",
"weight" : 0,
"to_hit" : -3,
"color" : "light_gray",
"symbol" : ",",
"material" : ["plastic", "steel"],
"volume" : 1,
"bashing" : -8,
"cutting" : 0,
"rarity" : 50,
"price" : 100
}
]
+53 -53
View File
@@ -13,24 +13,24 @@
"bashing": 3,
"cutting": 0,
"to_hit": -1,
"accuracy_modifier": 2,
"dispersion_modifier": 2,
"damage_modifier": 0,
"loudness_modifier": 0,
"ammo_modifier": ".45",
"ammo_modifier": "45",
"recoil_modifier": 2,
"burst_modifier": 0,
"clip_size_modifier": 0,
"mod_targets": ["pistol", "smg"],
"acceptable_ammo": ["9MM", "38", "40", "44"]
"acceptable_ammo": ["9mm", "38", "40", "44"]
},
{
"type" : "GUNMOD",
"id" : "suppressor",
"name" : "suppressor",
"clip_size_modifier" : 0,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"damage_modifier" : -4,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "Using a suppressor is almost an imperative in zombie-infested regions. Gunfire is very noisy, and will attract predators. Its only drawback is a reduced muzzle velocity, resulting in less accuracy and damage.",
"weight" : 1,
"to_hit" : 2,
@@ -52,9 +52,9 @@
"id" : "grip",
"name" : "enhanced grip",
"clip_size_modifier" : 0,
"accuracy_modifier" : 2,
"dispersion_modifier" : -2,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "A grip placed forward on the barrel allows for greater control and accuracy. Aside from increased weight, there are no drawbacks.",
"weight" : 1,
"to_hit" : -1,
@@ -76,9 +76,9 @@
"id" : "barrel_big",
"name" : "barrel extension",
"clip_size_modifier" : 0,
"accuracy_modifier" : 6,
"dispersion_modifier" : -6,
"damage_modifier" : 1,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "A longer barrel increases the muzzle velocity of a firearm, contributing to both accuracy and damage. However, the longer barrel tends to vibrate after firing, greatly increasing recoil.",
"weight" : 1,
"to_hit" : 2,
@@ -100,9 +100,9 @@
"id" : "barrel_small",
"name" : "shortened barrel",
"clip_size_modifier" : 0,
"accuracy_modifier" : -5,
"dispersion_modifier" : 5,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "A shortened barrel results in markedly reduced accuracy, and a minor increase in noise, but also reduces recoil greatly as a result of the improved managability of the firearm.",
"weight" : 1,
"to_hit" : -1,
@@ -124,9 +124,9 @@
"id" : "barrel_rifled",
"name" : "rifled barrel",
"clip_size_modifier" : 0,
"accuracy_modifier" : 10,
"dispersion_modifier" : -10,
"damage_modifier" : -20,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "Rifling a shotgun barrel is mainly done in order to improve its accuracy when firing slugs. The rifling makes the gun less suitable for shot, however.",
"weight" : 1,
"to_hit" : 1,
@@ -148,9 +148,9 @@
"id" : "clip",
"name" : "extended magazine",
"clip_size_modifier" : 50,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "Increases the ammunition capacity of your firearm by 50%, but the added bulk reduces accuracy slightly.",
"weight" : 1,
"to_hit" : -1,
@@ -172,9 +172,9 @@
"id" : "clip2",
"name" : "double magazine",
"clip_size_modifier" : 100,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "Completely doubles the ammunition capacity of your firearm, but the added bulk reduces accuracy and increases recoil.",
"weight" : 2,
"to_hit" : 0,
@@ -196,9 +196,9 @@
"id" : "spare_mag",
"name" : "spare magazine",
"clip_size_modifier" : 0,
"accuracy_modifier" : 0,
"dispersion_modifier" : 0,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "A spare magazine you can keep on hand to make reloads faster, but must itself be reloaded before it can be used again.",
"weight" : 1,
"to_hit" : 0,
@@ -220,9 +220,9 @@
"id" : "brass_catcher",
"name" : "brass catcher",
"clip_size_modifier" : 0,
"accuracy_modifier" : 0,
"dispersion_modifier" : 0,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "A bag that hangs off the side of your gun and catches ejected casings so you don't have to pick them up.",
"weight" : 1,
"to_hit" : 0,
@@ -244,9 +244,9 @@
"id" : "stabilizer",
"name" : "gyroscopic stabilizer",
"clip_size_modifier" : -10,
"accuracy_modifier" : 2,
"dispersion_modifier" : -2,
"damage_modifier" : -2,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "An advanced unit that straps onto the side of your firearm and reduces vibration, greatly reducing recoil and increasing accuracy. However, it also takes up space in the magazine slot, reducing ammo capacity.",
"weight" : 2,
"to_hit" : -3,
@@ -268,9 +268,9 @@
"id" : "blowback",
"name" : "rapid blowback",
"clip_size_modifier" : 0,
"accuracy_modifier" : -3,
"dispersion_modifier" : 3,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "An improved blowback mechanism makes your firearm's automatic fire faster, at the cost of reduced accuracy and increased noise.",
"weight" : 1,
"to_hit" : 0,
@@ -296,7 +296,7 @@
"burst_modifier" : 3,
"loudness_modifier" : 2,
"to_hit" : -1,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"price" : 650,
"clip_size_modifier" : 0,
"description" : "A simple mechanism that converts a pistol to a fully-automatic weapon, with a burst size of three rounds. However, it reduces accuracy, and increases noise and recoil.",
@@ -306,11 +306,11 @@
"cutting" : 0,
"recoil_modifier" : 2,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38", "40", "57", "46"],
"acceptable_ammo" : ["22", "9mm", "38", "40", "57", "46"],
"mod_targets" : ["pistol"],
"rarity" : 2,
"bashing" : 2,
"ammo_modifier" : "none"
"ammo_modifier" : "NULL"
},
{
"type" : "GUNMOD",
@@ -321,7 +321,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"price" : 420,
"clip_size_modifier" : 0,
"description" : "Replacing several key parts of a .38, .40, .44 or .45 firearm converts it to a 9mm firearm. The conversion results in a slight reduction in accuracy.",
@@ -346,7 +346,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"price" : 320,
"clip_size_modifier" : 0,
"description" : "Replacing several key parts of a 9mm, .38, .40, 5.7mm, 4.6mm, 7.62mm or .223 firearm converts it to a .22 firearm. The conversion results in a slight reduction in accuracy.",
@@ -356,11 +356,11 @@
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["9MM", "38", "40", "57", "46", "762", "223"],
"acceptable_ammo" : ["9mm", "38", "40", "57", "46", "762", "223"],
"mod_targets" : ["pistol", "smg", "rifle"],
"rarity" : 2,
"bashing" : -2,
"ammo_modifier" : ".22"
"ammo_modifier" : "22"
},
{
"type" : "GUNMOD",
@@ -371,7 +371,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"price" : 460,
"clip_size_modifier" : 0,
"description" : "FN Hestal sells a conversion kit, used to convert .22, 9mm, or .38 firearms to their proprietary 5.7x28mm, a round designed for accuracy and armor penetration.",
@@ -381,11 +381,11 @@
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38"],
"acceptable_ammo" : ["22", "9mm", "38"],
"mod_targets" : ["pistol", "smg"],
"rarity" : 1,
"bashing" : -3,
"ammo_modifier" : "5.7mm"
"ammo_modifier" : "57"
},
{
"type" : "GUNMOD",
@@ -396,7 +396,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"dispersion_modifier" : 1,
"price" : 460,
"clip_size_modifier" : 0,
"description" : "Heckler and Koch sells a conversion kit, used to convert .22, 9mm, or .38 firearms to their proprietary 4.6x30mm, a round designed for accuracy and armor penetration.",
@@ -406,11 +406,11 @@
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38"],
"acceptable_ammo" : ["22", "9mm", "38"],
"mod_targets" : ["pistol", "smg"],
"rarity" : 1,
"bashing" : -3,
"ammo_modifier" : "4.6mm"
"ammo_modifier" : "46"
},
{
"type" : "GUNMOD",
@@ -421,7 +421,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : 1,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"price" : 520,
"clip_size_modifier" : -20,
"description" : "This kit is used to convert a shotgun or 7.62mm, .223 or .30-06 rifle to the popular and powerful .308 caliber. The conversion results in reduced ammo capacity and a slight reduction in accuracy.",
@@ -431,11 +431,11 @@
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["SHOT", "762", "223", "3006"],
"acceptable_ammo" : ["shot", "762", "223", "3006"],
"mod_targets" : ["shotgun", "rifle"],
"rarity" : 2,
"bashing" : 4,
"ammo_modifier" : ".308"
"ammo_modifier" : "308"
},
{
"type" : "GUNMOD",
@@ -446,7 +446,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : 1,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"price" : 500,
"clip_size_modifier" : -10,
"description" : "This kit is used to convert a shotgun or 7.62mm, .30-06, or .308 rifle to the popular, accurate, and damaging .223 caliber. The conversion results in slight reductions in both accuracy and ammo capacity.",
@@ -456,20 +456,20 @@
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["SHOT", "762", "3006", "308"],
"acceptable_ammo" : ["shot", "762", "3006", "308"],
"mod_targets" : ["shotgun", "rifle"],
"rarity" : 2,
"bashing" : 4,
"ammo_modifier" : ".223"
"ammo_modifier" : "223"
},
{
"type" : "GUNMOD",
"id" : "conversion_battle",
"name" : "battle rifle conversion",
"clip_size_modifier" : 20,
"accuracy_modifier" : -6,
"dispersion_modifier" : 6,
"damage_modifier" : 6,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "This is a complete conversion kit, designed to turn a rifle into a powerful battle rifle. It reduces accuracy, and increases noise and recoil, but also increases damage, ammo capacity, and fire rate.",
"weight" : 3,
"to_hit" : -1,
@@ -491,9 +491,9 @@
"id" : "conversion_sniper",
"name" : "sniper conversion",
"clip_size_modifier" : -15,
"accuracy_modifier" : 10,
"dispersion_modifier" : -10,
"damage_modifier" : 8,
"ammo_modifier" : "none",
"ammo_modifier" : "NULL",
"description" : "This is a complete conversion kit, designed to turn a rifle into a deadly sniper rifle. It decreases ammo capacity, and removes any automatic fire capabilities, but also increases accuracy and damage.",
"weight" : 2,
"to_hit" : -1,
@@ -519,7 +519,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"price" : 650,
"clip_size_modifier" : 1,
"description" : "The M203 was originally designed for use with M16 variants but today can be attached to almost any rifle. It allows a single 40mm grenade to be loaded and fired.",
@@ -544,7 +544,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -3,
"accuracy_modifier" : 0,
"dispersion_modifier" : 0,
"price" : 400,
"clip_size_modifier" : 0,
"description" : "A bayonet is a stabbing weapon that can be attached to the front of a shotgun, sub-machinegun or rifle, allowing a melee attack to deal piercing damage. The added length increases recoil slightly.",
@@ -558,7 +558,7 @@
"rarity" : 6,
"bashing" : 0,
"flags" : ["STAB"],
"ammo_modifier" : "none"
"ammo_modifier" : "NULL"
},
{
"type" : "GUNMOD",
@@ -569,7 +569,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -2,
"dispersion_modifier" : 2,
"price" : 650,
"clip_size_modifier" : 2,
"description" : "A miniaturized shotgun with 2 barrels, which can be mounted under the barrel of many rifles. It allows two shotgun shells to be loaded and fired.",
@@ -594,7 +594,7 @@
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : 0,
"dispersion_modifier" : 0,
"price" : 500,
"clip_size_modifier" : 1,
"description" : "A kit to attach a pair of crossbow arms and a firing rail to the barrel of a long firearm. It allows crossbow bolts to be fired.",
+250 -116
View File
File diff suppressed because it is too large Load Diff
+291 -151
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -142,6 +142,19 @@
"fire_resist" : 2,
"density" : 10
},
{
"ident" : "bone",
"name" : "Bone",
"bash_resist" : 2,
"cut_resist" : 3,
"bash_dmg_verb" : "cracked",
"cut_dmg_verb" : "chipped",
"dmg_adj" : ["scratched", "cut", "cracked", "shattered"],
"acid_resist" : 1,
"elec_resist" : 2,
"fire_resist" : 4,
"density" : 7
},
{
"ident" : "stone",
"name" : "Stone",
+4 -2
View File
@@ -66,7 +66,8 @@
"monsters" : [
{ "monster" : "mon_triffid_young", "freq" : 300, "multiplier" : 0 },
{ "monster" : "mon_vinebeast", "freq" : 160, "multiplier" : 10 },
{ "monster" : "mon_triffid_queen", "freq" : 60, "multiplier" : 0 }
{ "monster" : "mon_triffid_queen", "freq" : 60, "multiplier" : 0 },
{ "monster" : "mon_triffid_heart", "freq" : 0, "multiplier" : 0 }
]
},
{
@@ -78,7 +79,8 @@
{ "monster" : "mon_zombie_fungus", "freq" : 300, "multiplier" : 0 },
{ "monster" : "mon_boomer_fungus", "freq" : 30, "multiplier" : 0 },
{ "monster" : "mon_spore", "freq" : 0, "multiplier" : 0 },
{ "monster" : "mon_fungal_wall", "freq" : 0, "multiplier" : 0 }
{ "monster" : "mon_fungal_wall", "freq" : 0, "multiplier" : 0 },
{ "monster" : "mon_fungaloid_queen", "freq" : 0, "multiplier" : 0 }
]
},
+8 -9
View File
@@ -3,7 +3,7 @@
"ident": "unemployed",
"name": "Unemployed",
"description":
"They say you don't have any 'useful skills', but at least your clothes fit\nwell.",
"They say you don't have any 'useful skills', but at least your clothes fit well.",
"points": 0,
"items": ["jeans", "tshirt", "sneakers"]
},
@@ -12,7 +12,7 @@
"ident": "tailor",
"name": "Tailor",
"description":
"You've made and adjusted clothing for some of the biggest names in town.\nNow, their undead bodies are trying to eat your brains. At least you'll be\nable to keep your own clothing repaired.",
"You've made and adjusted clothing for some of the biggest names in town. Now, their undead bodies are trying to eat your brains. At least you'll be able to keep your own clothing repaired.",
"points": 1,
"items": ["polo_shirt", "blazer", "pants", "dress_shoes", "sewing_kit", "scissors", "manual_tailor"]
},
@@ -21,7 +21,7 @@
"ident": "labtech",
"name": "Lab Technician",
"description":
"It was your first day in the lab when the cataclysm hit. You were evacuated\nwith all the civilians, but at least you kept your lab gear.",
"It was your first day in the lab when the cataclysm hit. You were evacuated with all the civilians, but at least you kept your lab gear.",
"points": 1,
"items": ["dress_shirt", "pants", "boots", "coat_lab", "gloves_rubber", "glasses_safety"]
},
@@ -30,7 +30,7 @@
"ident": "mechanic",
"name": "Wannabe Mechanic",
"description":
"Although you never got your driver's license, you've always loved cars.\nYou start with a wrench, a toolbelt, and some car-related reading material.",
"Although you never got your driver's license, you've always loved cars. You start with a wrench, a toolbelt, and some car-related reading material.",
"points": 2,
"items": ["tank_top", "jeans", "boots", "beltrig", "wrench", "mag_cars", "manual_mechanics"]
},
@@ -39,7 +39,7 @@
"ident": "scoundrel",
"name": "Scoundrel",
"description":
"Your flexible outlook on law has ensured your survival, but now what?\nYou start with cargo pants, a hoodie, \"sundries\", and one additional level of melee.",
"Your flexible outlook on law has ensured your survival, but now what? You start with cargo pants, a hoodie, \"sundries\", and one additional level of melee.",
"points": 2,
"items": ["tank_top", "hoodie", "pants_cargo", "sneakers", "weed", "picklocks"],
"skills" : [
@@ -53,14 +53,13 @@
{
"ident": "smoker",
"name": "Chain Smoker",
"description":
"Everyone at work knew you as the person who always had a cigarette or two\nin hand. Now, you're down to a single pack, and you hope you find more soon.\nYou start out with a strong nicotine addiction, and 10 cigarettes.",
"description": "Everyone at work knew you as the person who always had a cigarette or two in hand. now, you're down to a single pack, and you hope you find more soon. You start out with a strong nicotine addiction, and 10 cigarettes.",
"points": -1,
"items": ["pants", "dress_shirt", "dress_shoes", "cig"],
"addictions": [
{
"type": "nicotine",
"intensity": 10
"type": "nicotine",
"intensity": 10
}
]
}
+758 -77
View File
File diff suppressed because it is too large Load Diff
+27 -27
View File
@@ -2,163 +2,163 @@
[
"dodge",
"dodge",
"Your skill at dodging, whether it be from an attack, a trap, or a natural\noccurrence. It is also used when attempting to fall gracefully, or in other\nacrobatic feats.",
"Your skill at dodging, whether it be from an attack, a trap, or a natural occurrence. It is also used when attempting to fall gracefully, or in other acrobatic feats.",
[]
],
[
"melee",
"melee",
"Your skill at hand-to-hand combat, both with and without a weapon. At low\nlevels this merely increases your chance to hit, but at higher levels it also\nincreases the damage done significantly.",
"Your skill at hand-to-hand combat, both with and without a weapon. At low levels this merely increases your chance to hit, but at higher levels it also increases the damage done significantly.",
[]
],
[
"unarmed",
"unarmed combat",
"Your skill at combat without a weapon. While at low levels, unarmed combat is\na good way to die quickly, those skilled in it can eventually use throws and\ncrushing blows to quickly dispatch enemies.",
"Your skill at combat without a weapon. While at low levels, unarmed combat is a good way to die quickly, those skilled in it can eventually use throws and crushing blows to quickly dispatch enemies.",
[]
],
[
"bashing",
"bashing weapons",
"Your skill at combat with weapons that club or bash your enemies. This\nincludes everything from rocks to baseball bats, and even the butt of rifles.\nThis increases damage, and at higher levels will improve your chance to hit.",
"Your skill at combat with weapons that club or bash your enemies. This includes everything from rocks to baseball bats, and even the butt of rifles. This increases damage, and at higher levels will improve your chance to hit.",
[]
],
[
"cutting",
"cutting weapons",
"Your skill at combat with weapons that cut or slice your enemies. At first\nthis will simply slightly increase accuracy and damage; later on it will\nhelp you bypass armor and thick hides.",
"Your skill at combat with weapons that cut or slice your enemies. At first this will simply slightly increase accuracy and damage; later on it will help you bypass armor and thick hides.",
[]
],
[
"stabbing",
"piercing weapons",
"Your skill at combat that involves piercing weapons. This includes spears,\nwhich only have a stabbing attack, and things like knives, which can cut or\npierce. This increases your accuracy and chance of a deadly critical.",
"Your skill at combat that involves piercing weapons. This includes spears, which only have a stabbing attack, and things like knives, which can cut or pierce. This increases your accuracy and chance of a deadly critical.",
[]
],
[
"throw",
"throwing",
"Your skill at throwing items and getting them to go where you want. Increases\nboth accuracy and, at higher levels, range.",
"Your skill at throwing items and getting them to go where you want. Increases both accuracy and, at higher levels, range.",
[]
],
[
"gun",
"firearms",
"Your general skill at firearms. This increases your accuracy with any gun,\nbut not as much as the skill associated with the gun in question.",
"Your general skill at firearms. This increases your accuracy with any gun, but not as much as the skill associated with the gun in question.",
[]
],
[
"pistol",
"handguns",
"Your skill with handguns. These have poor accuracy, but generally are fired\nand reloaded faster than other guns, and are good in close quarters.",
"Your skill with handguns. These have poor accuracy, but generally are fired and reloaded faster than other guns, and are good in close quarters.",
["gun_type"]
],
[
"shotgun",
"shotguns",
"Your skill with shotguns. Shot is easy to hit with, and does massive damage,\nbut has short range. Shotguns may also be loaded with slugs, which go further\nand do as much damage, but are not very accurate.",
"Your skill with shotguns. Shot is easy to hit with, and does massive damage, but has short range. Shotguns may also be loaded with slugs, which go further and do as much damage, but are not very accurate.",
["gun_type"]
],
[
"smg",
"submachine guns",
"Your skill with submachine guns and machine pistols. Halfway between a pistol\nand an assault rifle, these weapons fire and reload quickly, and may fire in\nbursts, but they are not very accurate.",
"Your skill with submachine guns and machine pistols. Halfway between a pistol and an assault rifle, these weapons fire and reload quickly, and may fire in bursts, but they are not very accurate.",
["gun_type"]
],
[
"rifle",
"rifles",
"Your skill with rifles, both assault rifles and semi-auto hunting rifles.\nThese have terrific range and accuracy, but are very slow to fire and reload,\nand are not very good in close quarters.",
"Your skill with rifles, both assault rifles and semi-auto hunting rifles. These have terrific range and accuracy, but are very slow to fire and reload, and are not very good in close quarters.",
["gun_type"]
],
[
"archery",
"archery",
"Your skill with all kinds of bows, from crossbows to handmade long bows.\nThese are quiet, but require some amount of strength to use, and are not\nterribly accurate. They can only be deadly in skilled hands.",
"Your skill with all kinds of bows, from crossbows to handmade long bows. These are quiet, but require some amount of strength to use, and are not terribly accurate. They can only be deadly in skilled hands.",
[]
],
[
"launcher",
"grenade launcher",
"Your skill with grenade launchers, whether standalone or as a rifle mod.\nThese launchers fire a variety of 40mm grenades with different uses,\nbut they and their rounds are hard to find.",
"Your skill with grenade launchers, whether standalone or as a rifle mod. These launchers fire a variety of 40mm grenades with different uses, but they and their rounds are hard to find.",
[]
],
[
"computer",
"computers",
"Your skill with computers, both in terms of legitimate use, and hacking. This\nwill help you use complex systems, and bypass their security.",
"Your skill with computers, both in terms of legitimate use, and hacking. This will help you use complex systems, and bypass their security.",
[]
],
[
"mechanics",
"mechanics",
"Your skill with repairs to mechanical systems, and the crafting of many items\nthat use complex parts, but are not electronics.",
"Your skill with repairs to mechanical systems, and the crafting of many items that use complex parts, but are not electronics.",
[]
],
[
"electronics",
"electronics",
"Your skill with repairs to electrical systems, and the crafting of many items\nthat use electrical parts.",
"Your skill with repairs to electrical systems, and the crafting of many items that use electrical parts.",
[]
],
[
"cooking",
"cooking",
"Your skill in combining food ingredients to make other, tastier food items.\nThis may also be used in mixing chemicals and other more esoteric tasks.",
"Your skill in combining food ingredients to make other, tastier food items. This may also be used in mixing chemicals and other more esoteric tasks.",
[]
],
[
"carpentry",
"construction",
"Your general knowledge in construction. This is used primarily when building\nterrain, via the * screen.",
"Your general knowledge in construction. This is used primarily when building terrain, via the * screen.",
[]
],
[
"survival",
"survival",
"Your skill in wilderness survival. This helps you butcher meat from a corpse\nand craft various basic survival items. High levels may allow you to remove\npoison from tainted meat. Also used for skinning corpses to acquire pelts.",
"Your skill in wilderness survival. This helps you butcher meat from a corpse and craft various basic survival items. Also used for skinning corpses to acquire pelts.",
[]
],
[
"traps",
"traps",
"Your skill at setting and disarming traps safely and effectively. Note that\nthis does not help you detect traps, or avoid their effects if you activate\nthem.",
"Your skill at setting and disarming traps safely and effectively. Note that this does not help you detect traps, or avoid their effects if you activate them.",
[]
],
[
"tailor",
"tailoring",
"Your skill at repairing clothing, and at higher levels, creating clothing\nfrom basic materials. Generally a sewing kit is needed. Also applies to\nother methods of clothing repair and textile crafting.",
"Your skill at repairing clothing, and at higher levels, creating clothing from basic materials. Generally a sewing kit is needed. Also applies to other methods of clothing repair and textile crafting.",
[]
],
[
"firstaid",
"first aid",
"Your skill at emergency medical treatment, such as that from first aid kits\nand bandages. High levels of this skill may help heal more HP. Some drugs\nmay be more effective as well.",
"Your skill at emergency medical treatment, such as that from first aid kits and bandages. High levels of this skill may help heal more HP. Some drugs may be more effective as well.",
[]
],
[
"speech",
"speech",
"Your skill at talking to people, convincing them of things, lying, and many\nothers. Works best in conjunction with a high intelligence.",
"Your skill at talking to people, convincing them of things, lying, and many others. Works best in conjunction with a high intelligence.",
[]
],
[
"barter",
"barter",
"Your skill at getting a good deal when trading with others. Very high levels\nmight even see you getting freebies.",
"Your skill at getting a good deal when trading with others. Very high levels might even see you getting freebies.",
[]
],
[
"swimming",
"swimming",
"Your skill at swimming. This affects speed, your ability to swim while\nwearing clothes or carrying weights, and in-water combat.",
"Your skill at swimming. This affects speed, your ability to swim while wearing clothes or carrying weights, and in-water combat.",
[]
],
[
"driving",
"driving",
"Your skill at driving. This affects how well you can control a vehicle,\nas well as the penalty of shooting while driving.",
"Your skill at driving. This affects how well you can control a vehicle, as well as the penalty of shooting while driving.",
[]
]
]
+5
View File
@@ -94,6 +94,11 @@ struct DebugLog
fout << t;
return *this;
}
template <class T>
DebugLog& operator<<(const T& t){
fout << t;
return *this;
}
private:
std::ofstream fout;
+18 -18
View File
@@ -111,7 +111,7 @@ void defense_game::pre_action(game *g, action_id &act)
g->add_msg("You don't need to sleep!");
act = ACTION_NULL;
}
if (act == ACTION_SAVE) {
if (act == ACTION_SAVE || act == ACTION_QUICKSAVE) {
g->add_msg("You cannot save in defense mode!");
act = ACTION_NULL;
}
@@ -257,7 +257,7 @@ void defense_game::init_map(game *g)
// Round down to the nearest even number
mx -= mx % 2;
my -= my % 2;
tinymap tm(&g->itypes, &g->mapitems, &g->traps);
tinymap tm(&g->traps);
tm.generate(g, g->cur_om, mx, my, 0, int(g->turn));
tm.clear_spawns();
tm.clear_traps();
@@ -440,7 +440,7 @@ void defense_game::init_to_style(defense_style new_style)
void defense_game::setup()
{
WINDOW* w = newwin(25, 80, 0, 0);
WINDOW* w = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH, 0, 0);
int selection = 1;
refresh_setup(w, selection);
@@ -801,7 +801,7 @@ void defense_game::caravan(game *g)
int total_price = 0;
WINDOW *w = newwin(25, 80, 0, 0);
WINDOW *w = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH, 0, 0);
int offset = 0, item_selected = 0, category_selected = 0;
@@ -1117,25 +1117,25 @@ void draw_caravan_borders(WINDOW *w, int current_window)
mvwputch(w, i, 39, col, LINE_XOXO);
}
for (int i = 1; i <= 38; i++)
mvwputch(w, 24, i, c_ltgray, LINE_OXOX);
mvwputch(w, FULL_SCREEN_HEIGHT-1, i, c_ltgray, LINE_OXOX);
mvwputch(w, 24, 0, c_ltgray, LINE_XXOO);
mvwputch(w, 24, 39, c_ltgray, LINE_XXOX);
mvwputch(w, FULL_SCREEN_HEIGHT-1, 0, c_ltgray, LINE_XXOO);
mvwputch(w, FULL_SCREEN_HEIGHT-1, 39, c_ltgray, LINE_XXOX);
// Finally, draw the item section borders
for (int i = 40; i <= 78; i++) {
for (int i = 40; i <= FULL_SCREEN_WIDTH-2; i++) {
mvwputch(w, 0, i, col, LINE_OXOX);
mvwputch(w, 24, i, col, LINE_OXOX);
mvwputch(w, FULL_SCREEN_HEIGHT-1, i, col, LINE_OXOX);
}
for (int i = 1; i <= 23; i++)
mvwputch(w, i, 79, col, LINE_XOXO);
for (int i = 1; i <= FULL_SCREEN_HEIGHT-2; i++)
mvwputch(w, i, FULL_SCREEN_WIDTH-1, col, LINE_XOXO);
mvwputch(w, 24, 39, col, LINE_XXOX);
mvwputch(w, 0, 79, col, LINE_OOXX);
mvwputch(w, 24, 79, col, LINE_XOOX);
mvwputch(w, FULL_SCREEN_HEIGHT-1, 39, col, LINE_XXOX);
mvwputch(w, 0, FULL_SCREEN_WIDTH-1, col, LINE_OOXX);
mvwputch(w, FULL_SCREEN_HEIGHT-1, FULL_SCREEN_WIDTH-1, col, LINE_XOOX);
// Quick reminded about help.
mvwprintz(w, 24, 2, c_red, "Press ? for help.");
mvwprintz(w, FULL_SCREEN_HEIGHT-1, 2, c_red, "Press ? for help.");
wrefresh(w);
}
@@ -1165,7 +1165,7 @@ void draw_caravan_items(WINDOW *w, game *g, std::vector<itype_id> *items,
// will corrupt the item list.
// Actually, clear the item info first.
for (int i = 12; i <= 23; i++)
for (int i = 12; i <= FULL_SCREEN_HEIGHT-2; i++)
mvwprintz(w, i, 1, c_black, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// THEN print it--if item_selected is valid
if (item_selected < items->size()) {
@@ -1173,10 +1173,10 @@ void draw_caravan_items(WINDOW *w, game *g, std::vector<itype_id> *items,
mvwprintz(w, 12, 0, c_white, tmp.info().c_str());
}
// Next, clear the item list on the right
for (int i = 1; i <= 23; i++)
for (int i = 1; i <= FULL_SCREEN_HEIGHT-2; i++)
mvwprintz(w, i, 40, c_black, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
// Finally, print the item list on the right
for (int i = offset; i <= offset + 23 && i < items->size(); i++) {
for (int i = offset; i <= offset + FULL_SCREEN_HEIGHT-2 && i < items->size(); i++) {
mvwprintz(w, i - offset + 1, 40, (item_selected == i ? h_white : c_white),
g->itypes[ (*items)[i] ]->name.c_str());
wprintz(w, c_white, " x %s%d", ((*counts)[i] >= 10 ? "" : " "), (*counts)[i]);
+966 -661
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -20,4 +20,6 @@ std::string dis_name(disease dis);
std::string dis_description(disease dis);
dis_type disease_for_body_part(dis_type base, int body_part);
#endif
+1089 -713
View File
File diff suppressed because it is too large Load Diff
+340
View File
@@ -0,0 +1,340 @@
#ifndef _FIELD_H_
#define _FIELD_H_
#include <vector>
#include <string>
#include "color.h"
#include "item.h"
#include "trap.h"
#include "monster.h"
#include "enums.h"
#include "computer.h"
#include "vehicle.h"
#include "graffiti.h"
#include "basecamp.h"
#include "iexamine.h"
#include <iosfwd>
/*
struct field_t
Used to store the master field effects list metadata. Not used to store a field, just queried to find out specifics
of an existing field.
*/
struct field_t {
std::string name[3]; //The display name of the given density (ie: light smoke, smoke, heavy smoke)
char sym; //The symbol to draw for this field. Note that some are reserved like * and %. You will have to check the draw function for specifics.
nc_color color[3]; //The color the field will be drawn as on the screen, by density.
/*
If true, does not invoke a check to block line of sight. If false, may block line of sight.
Note that this does nothing by itself. You must go to the code block in lightmap.cpp and modify
transparancy code there with a case statement as well!
*/
bool transparent[3];
//Dangerous tiles ask you before you step in them.
bool dangerous[3];
//Controls, albeit randomly, how long a field of a given type will last before going down in density.
int halflife; // In turns
//cost of moving into and out of this field
int move_cost[3];
};
//The master list of id's for a field, corresponding to the fieldlist array.
enum field_id {
fd_null = 0,
fd_blood,
fd_bile,
fd_gibs_flesh,
fd_gibs_veggy,
fd_web,
fd_slime,
fd_acid,
fd_sap,
fd_sludge,
fd_fire,
fd_rubble,
fd_smoke,
fd_toxic_gas,
fd_tear_gas,
fd_nuke_gas,
fd_gas_vent,
fd_fire_vent,
fd_flame_burst,
fd_electricity,
fd_fatigue,
fd_push_items,
fd_shock_vent,
fd_acid_vent,
num_fields
};
/*
Controls the master listing of all possible field effects, indexed by a field_id. Does not store active fields, just metadata.
*/
const field_t fieldlist[] = {
{
{"", "", ""}, '%',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
},
{
{"blood splatter", "blood stain", "puddle of blood"}, '%',
{c_red, c_red, c_red}, {true, true, true}, {false, false, false}, 2500,
{0,0,0}
},
{
{"bile splatter", "bile stain", "puddle of bile"}, '%',
{c_pink, c_pink, c_pink}, {true, true, true}, {false, false, false},2500,
{0,0,0}
},
{
{"scraps of flesh", "bloody meat chunks", "heap of gore"}, '~',
{c_brown, c_ltred, c_red}, {true, true, true}, {false, false, false}, 2500,
{0,0,0}
},
{
{"shredded leaves and twigs", "shattered branches and leaves", "broken vegetation tangle"}, '~',
{c_ltgreen, c_ltgreen, c_green}, {true, true, true}, {false, false, false}, 2500,
{0,0,0}
},
{
{"cobwebs","webs", "thick webs"}, '}',
{c_white, c_white, c_white}, {true, true, false},{false, false, false}, 0,
{0,0,0}
},
{
{"slime trail", "slime stain", "puddle of slime"}, '%',
{c_ltgreen, c_ltgreen, c_green},{true, true, true},{false, false, false},2500,
{0,0,0}
},
{
{"acid splatter", "acid streak", "pool of acid"}, '5',
{c_ltgreen, c_green, c_green}, {true, true, true}, {true, true, true}, 10,
{0,0,0}
},
{
{"sap splatter", "glob of sap", "pool of sap"}, '5',
{c_yellow, c_brown, c_brown}, {true, true, true}, {true, true, true}, 20,
{0,0,0}
},
{
{"thin sludge trail", "sludge trail", "thick sludge trail"}, '5',
{c_ltgray, c_dkgray, c_black}, {true, true, true}, {false, false, false}, 900,
{0,0,0}
},
{
{"small fire", "fire", "raging fire"}, '4',
{c_yellow, c_ltred, c_red}, {true, true, true}, {true, true, true}, 800,
{0,0,0}
},
{
{"rubble heap", "rubble pile", "mountain of rubble"}, '#',
{c_dkgray, c_dkgray, c_dkgray}, {true, true, false},{false, false, false}, 0,
{0,0,0}
},
{
{"thin smoke", "smoke", "thick smoke"}, '8',
{c_white, c_ltgray, c_dkgray}, {true, false, false},{false, true, true}, 300,
{0,0,0}
},
{
{"hazy cloud","toxic gas","thick toxic gas"}, '8',
{c_white, c_ltgreen, c_green}, {true, false, false},{false, true, true}, 900,
{0,0,0}
},
{
{"hazy cloud","tear gas","thick tear gas"}, '8',
{c_white, c_yellow, c_brown}, {true, false, false},{true, true, true}, 600,
{0,0,0}
},
{
{"hazy cloud","radioactive gas", "thick radioactive gas"}, '8',
{c_white, c_ltgreen, c_green}, {true, true, false}, {true, true, true}, 1000,
{0,0,0}
},
{
{"gas vent", "gas vent", "gas vent"}, '%',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
},
{ // Fire Vents
{"", "", ""}, '&',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
},
{
{"fire", "fire", "fire"}, '5',
{c_red, c_red, c_red}, {true, true, true}, {true, true, true}, 0,
{0,0,0}
},
{
{"sparks", "electric crackle", "electric cloud"}, '9',
{c_white, c_cyan, c_blue}, {true, true, true}, {true, true, true}, 2,
{0,0,0}
},
{
{"odd ripple", "swirling air", "tear in reality"}, '*',
{c_ltgray, c_dkgray, c_magenta},{true, true, false},{false, false, false}, 0,
{0,0,0}
},
{ //Push Items
{"", "", ""}, '&',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
},
{ // shock vents
{"", "", ""}, '&',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
},
{ // acid vents
{"", "", ""}, '&',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0,
{0,0,0}
}
};
/*
Class: field_entry
An active or passive effect existing on a tile. Multiple different types can exist on one tile
but there can be only one of each type (IE: one fire, one smoke cloud, etc). Each effect
can vary in intensity (density) and age (usually used as a time to live).
*/
class field_entry {
public:
field_entry() {
type = fd_null;
density = 1;
age = 0;
is_alive = false;
};
field_entry(field_id t, unsigned char d, unsigned int a) {
type = t;
density = d;
age = a;
is_alive = true;
}
//returns the move cost of this field
int move_cost() const;
//Returns the field_id of the current field entry.
field_id getFieldType() const;
//Returns the current density (aka intensity) of the current field entry.
signed char getFieldDensity() const;
//Returns the age (usually turns to live) of the current field entry.
int getFieldAge() const;
//Allows you to modify the field_id of the current field entry.
field_id setFieldType(const field_id new_field_id);
//Allows you to modify the density of the current field entry.
signed char setFieldDensity(const signed char new_density);
//Allows you to modify the age of the current field entry.
int setFieldAge(const int new_age);
//Get the move cost for this field
int getFieldMoveCost();
//Returns if the current field is dangerous or not.
bool is_dangerous() const
{
return fieldlist[type].dangerous[density - 1];
}
//Returns the display name of the current field given its current density.
//IE: light smoke, smoke, heavy smoke
std::string name() const
{
return fieldlist[type].name[density - 1];
}
//Returns true if this is an active field, false if it should be removed.
bool isAlive(){
return is_alive;
}
private:
field_id type; //The field identifier.
signed char density; //The density, or intensity (higher is stronger), of the field entry.
int age; //The age, or time to live, of the field effect. 0 is permanent.
bool is_alive; //True if this is an active field, false if it should be destroyed next check.
};
//Represents a variable sized collection of field entries on a given map square.
class field{
public:
//Field constructor
field();
//Frees all memory assigned to the field's field_entry vector and general cleanup.
~field();
//Returns a field entry corresponding to the field_id parameter passed in.
//If no fields are found then a field_entry with type fd_null is returned.
field_entry* findField(const field_id field_to_find);
const field_entry* findFieldc(const field_id field_to_find); //for when you want a const field_entry.
//Inserts the given field_id into the field list for a given tile if it does not already exist.
//Returns false if the field_id already exists, true otherwise.
//If you wish to modify an already existing field use findField and modify the result.
//Density defaults to 1, and age to 0 (permanent) if not specified.
bool addField(const field_id field_to_add,const unsigned char new_density=1, const int new_age=0);
//Removes the field entry with a type equal to the field_id parameter. Returns true if removed, false otherwise.
bool removeField(const field_id field_to_remove);
//Returns the number of fields existing on the current tile.
unsigned int fieldCount() const;
//Returns the last added field from the tile for drawing purposes.
//This can be changed to return whatever you think the most important field to draw is.
field_id fieldSymbol() const;
//Returns the vector iterator to begin searching through the list.
//Note: If you are using "field_at" function, set the return to a temporary field variable! If you somehow
//query an out of bounds field location it returns a different field every inquery. This means that
//the start and end iterators won't match up and will crash the system.
std::vector<field_entry*>::iterator getFieldStart();
//Returns the vector iterator to end searching through the list.
std::vector<field_entry*>::iterator getFieldEnd();
//Returns the total move cost from all fields
int move_cost() const;
private:
std::vector<field_entry*> field_list; //A listing of all field effects on the current tile.
//Draw_symbol currently is equal to the last field added to the square. You can modify this behavior in the class functions if you wish.
field_id draw_symbol;
bool dirty; //true if this is a copy of the class, false otherwise.
};
#endif
+1269 -734
View File
File diff suppressed because it is too large Load Diff
+31 -11
View File
@@ -23,6 +23,7 @@
#include "mutation.h"
#include "gamemode.h"
#include "action.h"
#include "translations.h"
#include <vector>
#include <map>
#include <list>
@@ -52,6 +53,9 @@
#define MAX_ITEM_IN_VEHICLE_STORAGE MAX_ITEM_IN_SQUARE // no reason to differ
#define MAX_VOLUME_IN_VEHICLE_STORAGE 500 // todo: variation. semi trailer square could hold more. the real limit would be weight
// The reference to the one and only game instance.
extern game *g;
#define PICKUP_RANGE 2
extern bool trigdist;
enum tut_type {
@@ -138,7 +142,7 @@ class game
// Explosion at (x, y) of intensity (power), with (shrapnel) chunks of shrapnel
void explosion(int x, int y, int power, int shrapnel, bool fire);
// Flashback at (x, y)
void flashbang(int x, int y);
void flashbang(int x, int y, bool player_immune = false);
// Move the player vertically, if (force) then they fell
void vertical_move(int z, bool force);
void use_computer(int x, int y);
@@ -159,7 +163,7 @@ class game
void revive_corpse(int x, int y, int n); // revives a corpse from an item pile
void revive_corpse(int x, int y, item *it); // revives a corpse by item pointer, caller handles item deletion
// hit_monster_with_flags processes ammo flags (e.g. incendiary, etc)
void hit_monster_with_flags(monster &z, unsigned int flags);
void hit_monster_with_flags(monster &z, const std::set<std::string> &effects);
void plfire(bool burst); // Player fires a gun (target selection)...
// ... a gun is fired, maybe by an NPC (actual damage, etc.).
void fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
@@ -168,7 +172,7 @@ class game
std::vector<point> &trajectory);
void cancel_activity();
void cancel_activity_query(const char* message, ...);
bool cancel_activity_or_ignore_query(const char* reason, ...);
bool cancel_activity_or_ignore_query(const char* reason, ...);
void moving_vehicle_dismount(int tox, int toy);
// Get input from the player to choose an adjacent tile (for examine() etc)
bool choose_adjacent(std::string verb, int &x, int&y);
@@ -225,7 +229,7 @@ class game
void add_artifact_messages(std::vector<art_effect_passive> effects);
void peek();
point look_debug(point point=point(-256,-256));
point look_debug(point pnt=point(-256,-256));
point look_around();// Look at nearby terrain ';'
void list_items(); //List all items around the player
bool list_items_match(std::string sText, std::string sPattern);
@@ -239,8 +243,8 @@ class game
std::string sFilter; // this is a member so that it's remembered over time
std::string list_item_upvote;
std::string list_item_downvote;
char inv(std::string title = "Inventory:");
char inv_type(std::string title = "Inventory:", item_cat inv_item_type = IC_NULL);
char inv(std::string title);
char inv_type(std::string title, item_cat inv_item_type = IC_NULL);
int inventory_item_menu(char chItem, int startx = 0, int width = 50);
std::vector<item> multidrop();
faction* list_factions(std::string title = "FACTIONS:");
@@ -261,7 +265,6 @@ class game
recipe_map recipes; // The list of valid recipes
std::vector<constructable*> constructions; // The list of constructions
std::vector <itype_id> mapitems[num_itloc]; // Items at various map types
std::vector <items_location_and_chance> monitems[num_monsters];
std::vector <mission_type> mission_types; // The list of mission templates
mutation_branch mutation_data[PF_MAX2]; // Mutation data
@@ -315,6 +318,20 @@ class game
void load_artifacts(); // Load artifact data
// Needs to be called by main() before MAPBUFFER.load
// Knockback functions: knock target at (tx,ty) along a line, either calculated
// from source position (sx,sy) using force parameter or passed as an argument;
// force determines how far target is knocked, if trajectory is calculated
// force also determines damage along with dam_mult;
// stun determines base number of turns target is stunned regardless of impact
// stun == 0 means no stun, stun == -1 indicates only impact stun (wall or npc/monster)
void knockback(int sx, int sy, int tx, int ty, int force, int stun, int dam_mult);
void knockback(std::vector<point>& traj, int force, int stun, int dam_mult);
// shockwave applies knockback to all targets within radius of (x,y)
// parameters force, stun, and dam_mult are passed to knockback()
// ignore_player determines if player is affected, useful for bionic, etc.
void shockwave(int x, int y, int radius, int force, int stun, int dam_mult, bool ignore_player);
private:
// Game-start procedures
bool opening_screen();// Warn about screen size, then present the main menu
@@ -336,7 +353,6 @@ class game
void init_itypes(); // Initializes item types
void init_skills();
void init_bionics(); // Initializes bionics... for now.
void init_mapitems(); // Initializes item placement
void init_mtypes(); // Initializes monster types
void init_mongroups(); // Initualizes monster groups
void init_monitems(); // Initializes monster inventory selection
@@ -347,6 +363,7 @@ class game
void init_mutations(); // Initializes mutation "tech tree"
void init_vehicles(); // Initializes vehicle types
void init_autosave(); // Initializes autosave parameters
void init_diseases(); // Initializes disease lookup table.
void load_keyboard_settings(); // Load keybindings from disk
@@ -426,7 +443,8 @@ class game
void chat(); // Talk to a nearby NPC 'C'
void plthrow(char chInput = '.'); // Throw an item 't'
void help(); // Help screen '?'
void show_options(); // Options screen '?'
void show_options(); // Options screen '?1'
void show_auto_pickup(); // Auto pickup manage screen '?3'
// Target is an interactive function which allows the player to choose a nearby
// square. It display information on any monster/NPC on that square, and also
@@ -457,14 +475,16 @@ class game
bool handle_action();
void update_scent(); // Updates the scent map
bool is_game_over(); // Returns true if the player quit or died
void place_corpse(); // Place player corpse
void death_screen(); // Display our stats, "GAME OVER BOO HOO"
void gameover(); // Ends the game
void write_msg(); // Prints the messages in the messages list
void msg_buffer(); // Opens a window with old messages in it
void draw_minimap(); // Draw the 5x5 minimap
void draw_HP(); // Draws the player's HP and Power level
int autosave_timeout(); // If autosave enabled, how long we should wait for user inaction before saving.
void autosave(); // Saves map
// int autosave_timeout(); // If autosave enabled, how long we should wait for user inaction before saving.
void autosave(); // automatic quicksaves - Performs some checks before calling quicksave()
void quicksave(); // Saves the game without quitting
// On-request draw functions
void draw_overmap(); // Draws the overmap, allows note-taking etc.
+49 -21
View File
@@ -18,8 +18,12 @@
void game::help()
{
WINDOW* w_help_border = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
WINDOW* w_help = newwin(23, 78, 1 + (int)((TERMY > 25) ? (TERMY-25)/2 : 0), 1 + (int)((TERMX > 80) ? (TERMX-80)/2 : 0));
WINDOW* w_help_border = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH,
(TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0,
(TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
WINDOW* w_help = newwin(FULL_SCREEN_HEIGHT-2, FULL_SCREEN_WIDTH-2,
1 + (int)((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0),
1 + (int)((TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0));
char ch;
action_id movearray[] = {ACTION_MOVE_NW,ACTION_MOVE_N,ACTION_MOVE_NE,
@@ -46,10 +50,11 @@ h: Radioactivity and Mutation\n\
\n\
1: List of all commands (you can change key commands here)\n\
2: List of all options (you can change options here)\n\
3: List of item types and data\n\
4: Description of map symbols\n\
5: Description of gun types\n\
6: Frequently Asked Questions (Some spoilers!)\n\
3: Auto pickup manager (you can change pickup rules here)\n\
4: List of item types and data\n\
5: Description of map symbols\n\
6: Description of gun types\n\
7: Frequently Asked Questions (Some spoilers!)\n\
\n\
q: Return to game");
@@ -550,7 +555,12 @@ extremities from frostbite and to keep your distance from large fires.");
getch();
break;
// Keybindings
case '1': {
// Remember what the keybindings were originally so we can restore them if player cancels.
std::map<char, action_id> keymap_old = keymap;
werase(w_help);
int offset = 1;
char remapch = ' ';
@@ -573,10 +583,10 @@ extremities from frostbite and to keep your distance from large fires.");
needs_refresh = false;
}
// Clear the lines
for (int i = 0; i < 23; i++)
for (int i = 0; i < FULL_SCREEN_HEIGHT-2; i++)
mvwprintz(w_help, i, 0, c_black, " ");
for (int i = 0; i < 23 && offset + i < NUM_ACTIONS; i++) {
for (int i = 0; i < FULL_SCREEN_HEIGHT-2 && offset + i < NUM_ACTIONS; i++) {
std::vector<char> keys = keys_bound_to( action_id(offset + i) );
nc_color col = (keys.empty() ? c_ltred : c_white);
mvwprintz(w_help, i, 3, col, "%s: ", action_name( action_id(offset + i) ).c_str());
@@ -601,7 +611,7 @@ extremities from frostbite and to keep your distance from large fires.");
offset++;
if (remapch == '-' || remapch == '+') {
needs_refresh = true;
for (int i = 0; i < 23 && i + offset < NUM_ACTIONS; i++) {
for (int i = 0; i < FULL_SCREEN_HEIGHT-2 && i + offset < NUM_ACTIONS; i++) {
mvwprintz(w_help, i, 0, c_ltblue, "%c", 'a' + i);
mvwprintz(w_help, i, 1, c_white, ":");
}
@@ -626,8 +636,21 @@ extremities from frostbite and to keep your distance from large fires.");
}
}
} while (remapch != 'q' && remapch != 'Q' && remapch != KEY_ESCAPE);
if (changed_keymap && query_yn("Save changes?"))
save_keymap();
if (changed_keymap)
{
if(query_yn("Save changes?"))
{
save_keymap();
}
else
{
// Player wants to keep the old keybindings. Revert!
keymap = keymap_old;
}
}
werase(w_help);
} break;
@@ -636,7 +659,12 @@ extremities from frostbite and to keep your distance from large fires.");
werase(w_help);
} break;
case '3':
case '3': {
show_auto_pickup();
werase(w_help);
} break;
case '4':
werase(w_help);
mvwprintz(w_help, 0, 0, c_white, "\
ITEM TYPES:\n\
@@ -682,7 +710,7 @@ ITEM TYPES:\n\
fired%s. Some have automatic fire, which may be used%s at a\n\
penalty to accuracy. The color refers to the type; handguns are gray,\n\
shotguns are red, submachine guns are cyan, rifles are brown, assault rifles\n\
are blue, and heavy machine guns are light red. Each has an accuracy rating,\n\
are blue, and heavy machine guns are light red. Each has a dispersion rating,\n\
a bonus to damage, a rate of fire, and a maximum load. Note that most\n\
firearms load fully in one action, while shotguns must be loaded one\n\
shell at a time.\n\
@@ -690,7 +718,7 @@ ITEM TYPES:\n\
= Ammunition\n\
Ammunition is worthless without a gun to load it into. Generally,\n\
there are several variants for any particular calibre. Ammunition has\n\
a damage rating, an accuracy, a range, and an armor-piercing quality.\n\
damage, dispersion, and range ratings, and an armor-piercing quality.\n\
Press any key to continue...",
press_x(ACTION_WEAR, " with the ", " key","").c_str(),
press_x(ACTION_TAKE_OFF, " with the "," key","").c_str(),
@@ -722,7 +750,7 @@ ITEM TYPES:\n\
getch();
break;
case '4':
case '5':
werase(w_help);
mvwprintz(w_help, 0, 0, c_ltgray, "MAP SYMBOLS:");
mvwprintz(w_help, 1, 0, c_brown, "\
@@ -780,7 +808,7 @@ O Parking lot - Empty lot, few items. Mostly useless.");
getch();
break;
case '5':
case '6':
werase(w_help);
mvwprintz(w_help, 0, 0, c_white, "Gun types:");
mvwprintz(w_help, 2, 0, c_ltgray, "( Handguns");
@@ -806,7 +834,7 @@ one given enough Mechanics skill. Likewise, it is possible to make\n\
wooden bolts from any number of wooden objects, though these are much\n\
less effective than steel bolts.\n\
Crossbows use the handgun skill.");
mvwprintz(w_help, 24, 0, c_white, "Press any key to continue...");
mvwprintz(w_help, FULL_SCREEN_HEIGHT-1, 0, c_white, "Press any key to continue...");
wrefresh(w_help);
refresh();
@@ -832,7 +860,7 @@ of bullets. However, they are more effective when firing single shots, so\n\
use discretion. They mainly use the 9mm and .45 ammunition; however, other\n\
SMGs exist. They reload moderately quickly, and are suitable for close or\n\
medium-long range combat.");
mvwprintz(w_help, 22, 0, c_white, "Press any key to continue...");
mvwprintz(w_help, FULL_SCREEN_HEIGHT-3, 0, c_white, "Press any key to continue...");
wrefresh(w_help);
refresh();
@@ -858,7 +886,7 @@ fire, so save it for when you're highly skilled.\n\
Assault rifles are an excellent choice for medium or long range combat, or\n\
even close-range bursts again a large number of enemies. They are difficult\n\
to use, and are best saved for skilled riflemen.");
mvwprintz(w_help, 24, 0, c_white, "Press any key to continue...");
mvwprintz(w_help, FULL_SCREEN_HEIGHT-1, 0, c_white, "Press any key to continue...");
wrefresh(w_help);
refresh();
@@ -883,14 +911,14 @@ Energy weapons have no recoil at all; they are nearly silent, have a long\n\
range, and are fairly damaging. The biggest drawback to energy weapons is\n\
scarcity of ammunition; it is wise to reserve the precious ammo for when\n\
you really need it.");
mvwprintz(w_help, 24, 0, c_white, "Press any key to continue...");
mvwprintz(w_help, FULL_SCREEN_HEIGHT-1, 0, c_white, "Press any key to continue...");
wrefresh(w_help);
refresh();
getch();
break;
case '6':
case '7':
werase(w_help);
mvwprintz(w_help, 0, 0, c_white, "\
Q: What is Safe Mode, and why does it prevent me from moving?\n\
Executable → Regular
View File
+32 -20
View File
@@ -17,7 +17,7 @@
#include <sstream>
void iexamine::none (game *g, player *p, map *m, int examx, int examy) {
g->add_msg("That is a %s.", m->tername(examx, examy).c_str());
g->add_msg("That is a %s.", m->name(examx, examy).c_str());
};
void iexamine::gaspump(game *g, player *p, map *m, int examx, int examy) {
@@ -25,20 +25,32 @@ void iexamine::gaspump(game *g, player *p, map *m, int examx, int examy) {
none(g, p, m, examx, examy);
return;
}
bool use_pump = false;
item gas(g->itypes["gasoline"], g->turn);
if (one_in(10 + p->dex_cur)) {
g->add_msg("You accidentally spill the gasoline.");
m->add_item(p->posx, p->posy, gas);
use_pump = true;
} else {
p->moves -= 300;
use_pump = g->handle_liquid(gas, false, true);
}
if (use_pump && one_in(10)) {
g->add_msg("With a clang and a shudder, the gas pump goes silent.");
m->ter_set(examx, examy, t_gas_pump_empty);
for (int i = 0; i < m->i_at(examx, examy).size(); i++) {
if (m->i_at(examx, examy)[i].made_of(LIQUID)) {
item* liq = &(m->i_at(examx, examy)[i]);
if (one_in(10 + p->dex_cur)) {
g->add_msg("You accidentally spill the %s.", liq->type->name.c_str());
item spill(liq->type, g->turn);
spill.charges = rng(dynamic_cast<it_ammo*>(liq->type)->count,
dynamic_cast<it_ammo*>(liq->type)->count * (float)(8 / p->dex_cur));
m->add_item_or_charges(p->posx, p->posy, spill, 1);
liq->charges -= spill.charges;
if (liq->charges < 1) {
m->i_at(examx, examy).erase(m->i_at(examx, examy).begin() + i);
}
} else {
p->moves -= 300;
if (g->handle_liquid(*liq, true, false)) {
g->add_msg("With a clang and a shudder, the %s pump goes silent.", liq->type->name.c_str());
m->i_at(examx, examy).erase(m->i_at(examx, examy).begin() + i);
}
}
return;
}
}
g->add_msg("Out of order.");
}
void iexamine::elevator(game *g, player *p, map *m, int examx, int examy){
@@ -175,21 +187,21 @@ void iexamine::tent(game *g, player *p, map *m, int examx, int examy) {
p->moves -= 200;
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
m->ter_set(examx + i, examy + j, t_dirt);
m->furn_set(examx + i, examy + j, f_null);
g->add_msg("You take down the tent");
item dropped(g->itypes["tent_kit"], g->turn);
m->add_item(examx, examy, dropped);
}
void iexamine::shelter(game *g, player *p, map *m, int examx, int examy) {
if (!query_yn("Take down %s?",m->tername(examx, examy).c_str())) {
if (!query_yn("Take down %s?",m->furnname(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
p->moves -= 200;
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
m->ter_set(examx + i, examy + j, t_dirt);
m->furn_set(examx + i, examy + j, f_null);
g->add_msg("You take down the shelter");
item dropped(g->itypes["shelter_kit"], g->turn);
m->add_item(examx, examy, dropped);
@@ -521,7 +533,7 @@ void iexamine::fswitch(game *g, player *p, map *m, int examx, int examy) {
}
void iexamine::flower_poppy(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Pick %s?",m->tername(examx, examy).c_str())) {
if(!query_yn("Pick %s?",m->furnname(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
@@ -537,13 +549,13 @@ void iexamine::flower_poppy(game *g, player *p, map *m, int examx, int examy) {
// Should user player::infect, but can't!
// player::infect needs to be restructured to return a bool indicating success.
g->add_msg("You fall asleep...");
p->add_disease(DI_SLEEP, 1200, g);
p->add_disease("sleep", 1200);
g->add_msg("Your legs are covered by flower's roots!");
p->hurt(g,bp_legs, 0, 4);
p->moves-=50;
}
m->ter_set(examx, examy, t_dirt);
m->furn_set(examx, examy, f_null);
m->spawn_item(examx, examy, "poppy_flower", 0);
m->spawn_item(examx, examy, "poppy_bud", 0);
}
+10 -8
View File
@@ -242,7 +242,7 @@ inventory inventory::filter_by_category(item_cat cat, const player& u) const
case IC_CONTAINER: // containers for liquid handling
if (it.is_tool() || it.is_gun())
{
if (it.ammo_type() == AT_GAS)
if (it.ammo_type() == "gasoline")
{
reduced_inv += *iter;
}
@@ -448,17 +448,20 @@ void inventory::form_from_map(game *g, point origin, int range)
items.clear();
for (int x = origin.x - range; x <= origin.x + range; x++) {
for (int y = origin.y - range; y <= origin.y + range; y++) {
if (g->m.has_flag(sealed, x, y))
continue;
for (int i = 0; i < g->m.i_at(x, y).size(); i++)
if (!g->m.i_at(x, y)[i].made_of(LIQUID))
add_item(g->m.i_at(x, y)[i]);
// Kludges for now!
ter_id terrain_id = g->m.ter(x, y);
if ((g->m.field_at(x, y).type == fd_fire) || (terrain_id == t_lava)) {
furn_id furniture_id = g->m.furn(x, y);
if ((g->m.field_at(x, y).findField(fd_fire)) || (terrain_id == t_lava)) {
item fire(g->itypes["fire"], 0);
fire.charges = 1;
add_item(fire);
}
if (terrain_id == t_toilet || terrain_id == t_water_sh || terrain_id == t_water_dp){
if (furniture_id == f_toilet || terrain_id == t_water_sh || terrain_id == t_water_dp){
item water(g->itypes["water"], 0);
water.charges = 50;
add_item(water);
@@ -472,11 +475,11 @@ void inventory::form_from_map(game *g, point origin, int range)
if (kpart >= 0) {
item hotplate(g->itypes["hotplate"], 0);
hotplate.charges = veh->fuel_left(AT_BATT, true);
hotplate.charges = veh->fuel_left("battery", true);
add_item(hotplate);
item water(g->itypes["water_clean"], 0);
water.charges = veh->fuel_left(AT_WATER);
water.charges = veh->fuel_left("water");
add_item(water);
item pot(g->itypes["pot"], 0);
@@ -743,7 +746,7 @@ std::vector<item*> inventory::all_ammo(ammotype type)
}
// Handle gasoline nested in containers
else if (type == AT_GAS && stack_iter->is_container() &&
else if (type == "gasoline" && stack_iter->is_container() &&
!stack_iter->contents.empty() && stack_iter->contents[0].is_ammo() &&
dynamic_cast<it_ammo*>(stack_iter->contents[0].type)->type == type)
{
@@ -1154,8 +1157,7 @@ item& inventory::watertight_container()
item& it = iter->front();
if (it.is_container() && it.contents.empty())
{
it_container* cont = dynamic_cast<it_container*>(it.type);
if (cont->flags & mfb(con_wtight) && cont->flags & mfb(con_seals))
if (it.has_flag("WATERTIGHT") && it.has_flag("SEALS"))
{
return it;
}
+39 -51
View File
@@ -2,6 +2,7 @@
#include "output.h"
#include "uistate.h"
#include "keypress.h"
#include "translations.h"
#include <string>
#include <vector>
#include <map>
@@ -10,8 +11,9 @@
const int iCategorieNum = 11;
std::string CATEGORIES[iCategorieNum] =
{"GROUND:", "FIREARMS:", "AMMUNITION:", "CLOTHING:", "FOOD/DRINKS:",
"TOOLS:", "BOOKS:", "WEAPONS:", "MODS/BIONICS", "MEDICINE/DRUGS", "OTHER:"};
{_("GROUND:"), _("FIREARMS:"), _("AMMUNITION:"), _("CLOTHING:"),
_("FOOD/DRINKS:"), _("TOOLS:"), _("BOOKS:"), _("WEAPONS:"),
_("MODS/BIONICS"), _("MEDICINE/DRUGS"), _("OTHER:")};
//TODO: make this function not have issues with items that are classed as multiple things
std::vector<int> find_firsts(invslice &slice)
@@ -57,7 +59,7 @@ std::vector<int> find_firsts(invslice &slice)
void print_inv_weight_vol(game *g, WINDOW* w_inv, int weight_carried, int vol_carried)
{
// Print weight
mvwprintw(w_inv, 0, 43, "Weight: ");
mvwprintw(w_inv, 0, 43, _("Weight: "));
if (weight_carried >= g->u.weight_capacity() * .25)
{
wprintz(w_inv, c_red, "%4d", weight_carried);
@@ -69,7 +71,7 @@ void print_inv_weight_vol(game *g, WINDOW* w_inv, int weight_carried, int vol_ca
wprintz(w_inv, c_ltgray, "/%-4d", int(g->u.weight_capacity() * .25));//, g->u.weight_capacity());
// Print volume
mvwprintw(w_inv, 0, 61, "Volume: ");
mvwprintw(w_inv, 0, 61, _("Volume: "));
if (vol_carried > g->u.volume_capacity() - 2)
{
wprintz(w_inv, c_red, "%3d", vol_carried);
@@ -91,7 +93,7 @@ void print_inv_statics(game *g, WINDOW* w_inv, std::string title,
// Print our weapon
int n_items = 0;
mvwprintz(w_inv, 2, 45, c_magenta, "WEAPON:");
mvwprintz(w_inv, 2, 45, c_magenta, _("WEAPON:"));
int dropping_weapon = false;
for (int i = 0; i < dropped_items.size() && !dropping_weapon; i++) {
if (dropped_items[i] == g->u.weapon.invlet)
@@ -113,7 +115,7 @@ void print_inv_statics(game *g, WINDOW* w_inv, std::string title,
mvwprintz(w_inv, 3, 45, c_ltgray, g->u.weapname().c_str());
// Print worn items
if (g->u.worn.size() > 0)
mvwprintz(w_inv, 5, 45, c_magenta, "ITEMS WORN:");
mvwprintz(w_inv, 5, 45, c_magenta, _("ITEMS WORN:"));
for (int i = 0; i < g->u.worn.size(); i++) {
n_items++;
bool dropping_armor = false;
@@ -134,13 +136,13 @@ void print_inv_statics(game *g, WINDOW* w_inv, std::string title,
invlet != inv_chars.end(); invlet++) {
n_items += ((g->u.inv.item_by_letter(*invlet).is_null()) ? 0 : 1);
}
mvwprintw(w_inv, 1, 62, "Items: %d/%d ", n_items, inv_chars.size());
mvwprintw(w_inv, 1, 62, _("Items: %d/%d "), n_items, inv_chars.size());
}
// Display current inventory.
char game::inv(std::string title)
{
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? FULL_SCREEN_WIDTH : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int ch = (int)'.';
int start = 0, cur_it, max_it;
@@ -172,7 +174,7 @@ char game::inv(std::string title)
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
if ( selected < start && selected > -1 ) selected = start;
if ( selected < start && selected > -1 ) selected = start;
}
int cur_line = 2;
max_it = 0;
@@ -182,7 +184,7 @@ char game::inv(std::string title)
// Print category header
for (int i = 1; i < iCategorieNum; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
mvwprintz(w_inv, cur_line, 0, c_magenta, _(CATEGORIES[i].c_str()));
cur_line++;
}
}
@@ -204,9 +206,9 @@ char game::inv(std::string title)
cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
mvwprintw(w_inv, maxitems + 4, 0, _("< Go Back"));
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
mvwprintw(w_inv, maxitems + 4, 12, _("> More items"));
wrefresh(w_inv);
ch = getch();
@@ -237,7 +239,7 @@ char game::inv(std::string title)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
}
}
} else if ( ch == '\n' || ch == KEY_RIGHT ) {
// if ( uistate.last_inv_start > -2 && uistate.last_inv_sel > -2 ) {
uistate.last_inv_start=start;
@@ -258,7 +260,7 @@ char game::inv_type(std::string title, item_cat inv_item_type)
// this function lists inventory objects by type
// refer to enum item_cat in itype.h for list of categories
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? FULL_SCREEN_WIDTH : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int ch = (int)'.';
int start = 0, cur_it, max_it;
@@ -301,7 +303,7 @@ char game::inv_type(std::string title, item_cat inv_item_type)
for (int i = 1; i < iCategorieNum; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
mvwprintz(w_inv, cur_line, 0, c_magenta, _(CATEGORIES[i].c_str()));
cur_line++;
}
}
@@ -326,9 +328,9 @@ char game::inv_type(std::string title, item_cat inv_item_type)
// cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
mvwprintw(w_inv, maxitems + 4, 0, _("< Go Back"));
if (cur_it < reduced_inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
mvwprintw(w_inv, maxitems + 4, 12, _("> More items"));
wrefresh(w_inv);
ch = getch();
@@ -359,7 +361,7 @@ char game::inv_type(std::string title, item_cat inv_item_type)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
}
}
} else if ( ch == '\n' || ch == KEY_RIGHT ) {
ch = selected_char;
}
@@ -376,7 +378,7 @@ std::vector<item> game::multidrop()
{
u.inv.sort();
u.inv.restack(&u);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? FULL_SCREEN_WIDTH : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
int drp_line_width=getmaxx(w_inv)-90;
const std::string drp_line_padding = ( drp_line_width > 1 ? std::string(drp_line_width, ' ') : " ");
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
@@ -384,7 +386,7 @@ std::vector<item> game::multidrop()
int count = 0; // The current count
std::vector<char> weapon_and_armor; // Always single, not counted
bool warned_about_bionic = false; // Printed add_msg re: dropping bionics
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
print_inv_statics(this, w_inv, _("Multidrop:"), weapon_and_armor);
int base_weight = u.weight_carried();
int base_volume = u.volume_carried();
@@ -448,7 +450,7 @@ std::vector<item> game::multidrop()
// Print category header
for (int i = 1; i < iCategorieNum; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
mvwprintz(w_inv, cur_line, 0, c_magenta, _(CATEGORIES[i].c_str()));
cur_line++;
}
}
@@ -492,9 +494,9 @@ std::vector<item> game::multidrop()
max_it=cur_it;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
mvwprintw(w_inv, maxitems + 4, 0, _("< Go Back"));
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
mvwprintw(w_inv, maxitems + 4, 12, _("> More items"));
wrefresh(w_inv);
/* back to (int)getch() as input() mangles arrow keys
ch = input();
@@ -564,18 +566,18 @@ std::vector<item> game::multidrop()
if (weapon_and_armor[i] == ch) {
weapon_and_armor.erase(weapon_and_armor.begin() + i);
found = true;
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
print_inv_statics(this, w_inv, _("Multidrop:"), weapon_and_armor);
}
}
if (!found) {
if ( ch == u.weapon.invlet &&
std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(), u.weapon.type->id) != unreal_itype_ids.end()){
if (!warned_about_bionic)
add_msg("You cannot drop your %s.", u.weapon.tname(this).c_str());
add_msg(_("You cannot drop your %s."), u.weapon.tname(this).c_str());
warned_about_bionic = true;
} else {
weapon_and_armor.push_back(ch);
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
print_inv_statics(this, w_inv, _("Multidrop:"), weapon_and_armor);
}
}
} else {
@@ -632,7 +634,7 @@ std::vector<item> game::multidrop()
else if (it->second && u.inv.item_by_letter( it->first).count_by_charges()) {
int charges = u.inv.item_by_letter( it->first).charges;// >= it->second ? : it->second;
ret.push_back( u.inv.remove_item_by_charges( it->first, it->second > charges ? charges : it->second));
} else if (it->second)
} else if (it->second)
for (int j = it->second; j > 0; j--)
ret.push_back( u.inv.remove_item_by_letter( it->first));
}
@@ -657,31 +659,17 @@ std::vector<item> game::multidrop()
void game::compare(int iCompareX, int iCompareY)
{
int examx, examy;
std::vector <item> grounditems;
int ch = (int)'.';
if (iCompareX != -999 && iCompareX != -999) {
examx = iCompareX;
examy = iCompareY;
} else {
mvwprintw(w_terrain, 0, 0, "Compare where? (Direction button)");
wrefresh(w_terrain);
ch = input();
last_action += ch;
if (ch == KEY_ESCAPE || ch == 'q')
return;
if (ch == '\n' || ch == 'I')
ch = '.';
get_direction(this, examx, examy, ch);
if (examx == -2 || examy == -2) {
add_msg("Invalid direction.");
return;
}
examx = u.posx + iCompareX;
examy = u.posy + iCompareY;
} else if (!choose_adjacent("Compare",examx,examy)) {
return;
}
examx += u.posx;
examy += u.posy;
std::vector <item> here = m.i_at(examx, examy);
std::vector <item> grounditems;
//Filter out items with the same name (keep only one of them)
std::map <std::string, bool> dups;
for (int i = 0; i < here.size(); i++) {
@@ -694,7 +682,7 @@ void game::compare(int iCompareX, int iCompareY)
const int groundsize = (grounditems.size() > 10 ? 10 : grounditems.size());
u.inv.sort();
u.inv.restack(&u);
invslice stacks = u.inv.slice(0, u.inv.size());
WINDOW* w_inv = newwin(TERMY-VIEW_OFFSET_Y*2, TERMX-VIEW_OFFSET_X*2, VIEW_OFFSET_Y, VIEW_OFFSET_X);
@@ -741,7 +729,7 @@ void game::compare(int iCompareX, int iCompareY)
// Print category header
for (int i = iHeaderOffset; i < iCategorieNum; i++) {
if (cur_it == firsts[i-iHeaderOffset]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
mvwprintz(w_inv, cur_line, 0, c_magenta, _(CATEGORIES[i].c_str()));
cur_line++;
}
}
@@ -772,9 +760,9 @@ void game::compare(int iCompareX, int iCompareY)
cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
mvwprintw(w_inv, maxitems + 4, 0, _("< Go Back"));
if (cur_it < u.inv.size() + groundsize)
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
mvwprintw(w_inv, maxitems + 4, 12, _("> More items"));
wrefresh(w_inv);
ch = getch();
if (u.has_item(ch)) {
+193 -104
View File
@@ -9,6 +9,7 @@
#include "text_snippets.h"
#include "material.h"
#include "item_factory.h"
#include "options.h"
// mfb(n) converts a flag to its appropriate position in covers's bitfield
#ifndef mfb
@@ -59,6 +60,7 @@ item::item(itype* it, unsigned int turn)
player_id = -1;
if (it == NULL)
return;
name = it->name;
if (it->is_gun())
charges = 0;
else if (it->is_ammo()) {
@@ -76,7 +78,7 @@ item::item(itype* it, unsigned int turn)
charges = -1;
} else {
charges = tool->def_charges;
if (tool->ammo != AT_NULL) {
if (tool->ammo != "NULL") {
curammo = dynamic_cast<it_ammo*>(item_controller->find_template(default_ammo(tool->ammo)));
}
}
@@ -104,7 +106,7 @@ item::item(itype *it, unsigned int turn, char let)
type = it;
}
bday = turn;
name = "";
name = it->name;
damage = 0;
burnt = 0;
poison = 0;
@@ -199,6 +201,7 @@ void item::clear()
// should we be clearing contents, as well?
// Seems risky to - there aren't any reported content-clearing bugs
item_tags.clear();
item_vars.clear();
}
bool item::is_null() const
@@ -275,6 +278,7 @@ void item::put_in(item payload)
{
contents.push_back(payload);
}
const char ivaresc=001;
std::string item::save_info() const
{
@@ -299,13 +303,32 @@ std::string item::save_info() const
std::stringstream dump;
dump << " " << int(invlet) << " " << typeId() << " " << int(charges) <<
" " << int(damage) << " ";
dump << item_tags.size() << " ";
/////
int stags=item_tags.size() + item_vars.size();
/////
dump << stags << " ";
for( std::set<std::string>::const_iterator it = item_tags.begin();
it != item_tags.end(); ++it )
{
dump << *it << " ";
}
/////
for( std::map<std::string, std::string>::const_iterator it = item_vars.begin(); it != item_vars.end(); ++it ) {
std::string itstr="";
std::string itval="";
dump << ivaresc << it->first << "=";
for(std::string::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit ) {
switch(*sit) {
case '\n': dump << ivaresc << "0A"; break;
case '\r': dump << ivaresc << "0D"; break;
case '\t': dump << ivaresc << "09"; break;
case ' ': dump << ivaresc << "20"; break;
default: dump << *sit; break;
}
}
dump << " ";
}
////
dump << burnt << " " << poison << " " << ammotmp <<
" " << owned << " " << int(bday) << " " << mode;
@@ -328,6 +351,39 @@ std::string item::save_info() const
return dump.str();
}
bool itag2ivar( std::string &item_tag, std::map<std::string, std::string> &item_vars ) {
if(item_tag.at(0) == ivaresc && item_tag.find('=') != -1 && item_tag.find('=') >= 2 ) {
std::string var_name, val_decoded;
int svarlen, svarsep;
svarsep=item_tag.find('=');
svarlen=item_tag.size();
var_name="";
val_decoded="";
var_name=item_tag.substr(1,svarsep-1); // will assume sanity here for now
for(int s = svarsep+1; s < svarlen; s++ ) { // cheap and temporary, afaik stringstream IFS = [\r\n\t ];
if(item_tag[s] == ivaresc && s < svarlen-2 ){
if ( item_tag[s+1] == '0' && item_tag[s+2] == 'A' ) {
s+=2; val_decoded.append(1, '\n');
} else if ( item_tag[s+1] == '0' && item_tag[s+2] == 'D' ) {
s+=2; val_decoded.append(1, '\r');
} else if ( item_tag[s+1] == '0' && item_tag[s+2] == '6' ) {
s+=2; val_decoded.append(1, '\t');
} else if ( item_tag[s+1] == '2' && item_tag[s+2] == '0' ) {
s+=2; val_decoded.append(1, ' ');
} else {
val_decoded.append(1, item_tag[s]); // hhrrrmmmmm should be passing \a?
}
} else {
val_decoded.append(1, item_tag[s]);
}
}
item_vars[var_name]=val_decoded;
return true;
} else {
return false;
}
}
void item::load_info(std::string data, game *g)
{
clear();
@@ -340,7 +396,9 @@ void item::load_info(std::string data, game *g)
for( int i = 0; i < tag_count; ++i )
{
dump >> item_tag;
if( itag2ivar(item_tag, item_vars ) == false ) {
item_tags.insert( item_tag );
}
}
dump >> burnt >> poison >> ammotmp >> owned >> bday >>
@@ -378,63 +436,78 @@ std::string item::info(bool showtext)
return info(showtext, &dummy);
}
std::string item::info(bool showtext, std::vector<iteminfo> *dump)
std::string item::info(bool showtext, std::vector<iteminfo> *dump, game *g, bool debug)
{
std::stringstream temp1, temp2;
if ( g != NULL && debug == false &&
( g->debugmon == true || g->u.has_artifact_with(AEP_SUPER_CLAIRVOYANCE) )
) debug=true;
if( !is_null() )
{
dump->push_back(iteminfo("BASE", " Volume: ", "", int(volume()), "", false, true));
dump->push_back(iteminfo("BASE", " Weight: ", "", int(weight()), "", true, true));
dump->push_back(iteminfo("BASE", " Bash: ", "", int(type->melee_dam), "", false));
dump->push_back(iteminfo("BASE", (has_flag("SPEAR") ? " Pierce: " : " Cut: "), "", int(type->melee_cut), "", false));
dump->push_back(iteminfo("BASE", " To-hit bonus: ", ((type->m_to_hit > 0) ? "+" : ""), int(type->m_to_hit), ""));
dump->push_back(iteminfo("BASE", " Moves per attack: ", "", int(attack_time()), "", true, true));
if (type->techniques != 0)
dump->push_back(iteminfo("BASE", "Volume: ", "", int(volume()), "", false, true));
dump->push_back(iteminfo("BASE", " Weight: ", "", int(weight()), "", true, true));
dump->push_back(iteminfo("BASE", "Bash: ", "", int(type->melee_dam), "", false));
dump->push_back(iteminfo("BASE", (has_flag("SPEAR") ? " Pierce: " : " Cut: "), "", int(type->melee_cut), "", false));
dump->push_back(iteminfo("BASE", " To-hit bonus: ", ((type->m_to_hit > 0) ? "+" : ""), int(type->m_to_hit), ""));
dump->push_back(iteminfo("BASE", "Moves per attack: ", "", int(attack_time()), "", true, true));
if ( debug == true ) {
if( g != NULL ) {
dump->push_back(iteminfo("BASE", "age: ", "", (int(g->turn) - bday) / (10 * 60), "", true, true));
}
dump->push_back(iteminfo("BASE", "burn: ", "", burnt, "", true, true));
}
if (type->techniques != 0)
for (int i = 1; i < NUM_TECHNIQUES; i++)
if (type->techniques & mfb(i))
dump->push_back(iteminfo("TECHNIQUE", " +",default_technique_name( technique_id(i) )));
dump->push_back(iteminfo("TECHNIQUE", "+",default_technique_name( technique_id(i) )));
}
if (is_food()) {
it_comest* food = dynamic_cast<it_comest*>(type);
dump->push_back(iteminfo("FOOD", " Nutrition: ", "", int(food->nutr)));
dump->push_back(iteminfo("FOOD", " Quench: ", "", int(food->quench)));
dump->push_back(iteminfo("FOOD", " Enjoyability: ", "", int(food->fun)));
dump->push_back(iteminfo("FOOD", "Nutrition: ", "", int(food->nutr)));
dump->push_back(iteminfo("FOOD", "Quench: ", "", int(food->quench)));
dump->push_back(iteminfo("FOOD", "Enjoyability: ", "", int(food->fun)));
if (corpse != NULL &&
( debug == true ||
( g != NULL &&
( g->u.has_bionic("bio_scent_vision") || g->u.has_trait(PF_CARNIVORE) || g->u.has_artifact_with(AEP_SUPER_CLAIRVOYANCE) )
)
)
) {
dump->push_back(iteminfo("FOOD", "Smells like: " + corpse->name));
}
} else if (is_food_container()) {
// added charge display for debugging
it_comest* food = dynamic_cast<it_comest*>(contents[0].type);
dump->push_back(iteminfo("FOOD", " Nutrition: ", "", int(food->nutr)));
dump->push_back(iteminfo("FOOD", " Quench: ", "", int(food->quench)));
dump->push_back(iteminfo("FOOD", " Enjoyability: ", "", int(food->fun)));
dump->push_back(iteminfo("FOOD", " Portions: ", "", abs(int(contents[0].charges))));
dump->push_back(iteminfo("FOOD", "Nutrition: ", "", int(food->nutr)));
dump->push_back(iteminfo("FOOD", "Quench: ", "", int(food->quench)));
dump->push_back(iteminfo("FOOD", "Enjoyability: ", "", int(food->fun)));
dump->push_back(iteminfo("FOOD", "Portions: ", "", abs(int(contents[0].charges))));
} else if (is_ammo()) {
// added charge display for debugging
it_ammo* ammo = dynamic_cast<it_ammo*>(type);
dump->push_back(iteminfo("AMMO", " Type: ", ammo_name(ammo->type)));
dump->push_back(iteminfo("AMMO", " Damage: ", "", int(ammo->damage)));
dump->push_back(iteminfo("AMMO", " Armor-pierce: ", "", int(ammo->pierce)));
dump->push_back(iteminfo("AMMO", " Range: ", "", int(ammo->range)));
dump->push_back(iteminfo("AMMO", " Accuracy: ", "", int(100 - ammo->accuracy)));
dump->push_back(iteminfo("AMMO", " Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", " Count: ", "", int(ammo->count)));
dump->push_back(iteminfo("AMMO", "Type: ", ammo_name(ammo->type)));
dump->push_back(iteminfo("AMMO", "Damage: ", "", int(ammo->damage)));
dump->push_back(iteminfo("AMMO", "Armor-pierce: ", "", int(ammo->pierce)));
dump->push_back(iteminfo("AMMO", "Range: ", "", int(ammo->range)));
dump->push_back(iteminfo("AMMO", "Dispersion: ", "", int(ammo->dispersion)));
dump->push_back(iteminfo("AMMO", "Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", "Count: ", "", int(ammo->count)));
} else if (is_ammo_container()) {
it_ammo* ammo = dynamic_cast<it_ammo*>(contents[0].type);
dump->push_back(iteminfo("AMMO", " Type: ", ammo_name(ammo->type)));
dump->push_back(iteminfo("AMMO", " Damage: ", "", int(ammo->damage)));
dump->push_back(iteminfo("AMMO", " Armor-pierce: ", "", int(ammo->pierce)));
dump->push_back(iteminfo("AMMO", " Range: ", "", int(ammo->range)));
dump->push_back(iteminfo("AMMO", " Accuracy: ", "", int(100 - ammo->accuracy)));
dump->push_back(iteminfo("AMMO", " Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", " Count: ", "", int(contents[0].charges)));
dump->push_back(iteminfo("AMMO", "Type: ", ammo_name(ammo->type)));
dump->push_back(iteminfo("AMMO", "Damage: ", "", int(ammo->damage)));
dump->push_back(iteminfo("AMMO", "Armor-pierce: ", "", int(ammo->pierce)));
dump->push_back(iteminfo("AMMO", "Range: ", "", int(ammo->range)));
dump->push_back(iteminfo("AMMO", "Dispersion: ", "", int(ammo->dispersion)));
dump->push_back(iteminfo("AMMO", "Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", "Count: ", "", int(contents[0].charges)));
} else if (is_gun()) {
it_gun* gun = dynamic_cast<it_gun*>(type);
@@ -446,8 +519,8 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
ammo_recoil = curammo->recoil;
}
dump->push_back(iteminfo("GUN", " Skill used: ", gun->skill_used->name()));
dump->push_back(iteminfo("GUN", " Ammunition: ", "", int(clip_size()), " rounds of " + ammo_name(ammo_type())));
dump->push_back(iteminfo("GUN", "Skill used: ", gun->skill_used->name()));
dump->push_back(iteminfo("GUN", "Ammunition: ", "", int(clip_size()), " rounds of " + ammo_name(ammo_type())));
temp1.str("");
if (has_ammo)
@@ -459,7 +532,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
if (has_ammo)
temp2 << " = " << gun_damage();
dump->push_back(iteminfo("GUN", " Damage: ", temp1.str(), int(gun_damage(false)), temp2.str()));
dump->push_back(iteminfo("GUN", "Damage: ", temp1.str(), int(gun_damage(false)), temp2.str()));
temp1.str("");
if (has_ammo) {
@@ -472,9 +545,9 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
temp2 << " = " << range(NULL);
}
dump->push_back(iteminfo("GUN", " Range: ", temp1.str(), int(gun->range), temp2.str()));
dump->push_back(iteminfo("GUN", "Range: ", temp1.str(), int(gun->range), temp2.str()));
dump->push_back(iteminfo("GUN", " Accuracy: ", "", int(100 - accuracy())));
dump->push_back(iteminfo("GUN", "Dispersion: ", "", int(dispersion())));
temp1.str("");
@@ -487,17 +560,17 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
if (has_ammo)
temp2 << " = " << recoil();
dump->push_back(iteminfo("GUN"," Recoil: ", temp1.str(), int(recoil(false)), temp2.str(), true, true));
dump->push_back(iteminfo("GUN","Recoil: ", temp1.str(), int(recoil(false)), temp2.str(), true, true));
dump->push_back(iteminfo("GUN", " Reload time: ", "", int(gun->reload_time), ((has_flag("RELOAD_ONE")) ? " per round" : ""), true, true));
dump->push_back(iteminfo("GUN", "Reload time: ", "", int(gun->reload_time), ((has_flag("RELOAD_ONE")) ? " per round" : ""), true, true));
if (burst_size() == 0) {
if (gun->skill_used == Skill::skill("pistol") && has_flag("RELOAD_ONE"))
dump->push_back(iteminfo("GUN", " Revolver."));
dump->push_back(iteminfo("GUN", "Revolver."));
else
dump->push_back(iteminfo("GUN", " Semi-automatic."));
dump->push_back(iteminfo("GUN", "Semi-automatic."));
} else
dump->push_back(iteminfo("GUN", " Burst size: ", "", int(burst_size())));
dump->push_back(iteminfo("GUN", "Burst size: ", "", int(burst_size())));
if (contents.size() > 0)
dump->push_back(iteminfo("GUN", "\n"));
@@ -511,22 +584,22 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
} else if (is_gunmod()) {
it_gunmod* mod = dynamic_cast<it_gunmod*>(type);
if (mod->accuracy != 0)
dump->push_back(iteminfo("GUNMOD", " Accuracy: ", ((mod->accuracy > 0) ? "+" : ""), int(mod->accuracy)));
if (mod->dispersion != 0)
dump->push_back(iteminfo("GUNMOD", "Dispersion: ", ((mod->dispersion > 0) ? "+" : ""), int(mod->dispersion)));
if (mod->damage != 0)
dump->push_back(iteminfo("GUNMOD", " Damage: ", ((mod->damage > 0) ? "+" : ""), int(mod->damage)));
dump->push_back(iteminfo("GUNMOD", "Damage: ", ((mod->damage > 0) ? "+" : ""), int(mod->damage)));
if (mod->clip != 0)
dump->push_back(iteminfo("GUNMOD", " Magazine: ", ((mod->clip > 0) ? "+" : ""), int(mod->clip), "%%"));
dump->push_back(iteminfo("GUNMOD", "Magazine: ", ((mod->clip > 0) ? "+" : ""), int(mod->clip), "%%"));
if (mod->recoil != 0)
dump->push_back(iteminfo("GUNMOD", " Recoil: ", ((mod->recoil > 0) ? "+" : ""), int(mod->recoil), "", true, true));
dump->push_back(iteminfo("GUNMOD", "Recoil: ", ((mod->recoil > 0) ? "+" : ""), int(mod->recoil), "", true, true));
if (mod->burst != 0)
dump->push_back(iteminfo("GUNMOD", " Burst: ", (mod->burst > 0 ? "+" : ""), int(mod->burst)));
dump->push_back(iteminfo("GUNMOD", "Burst: ", (mod->burst > 0 ? "+" : ""), int(mod->burst)));
if (mod->newtype != AT_NULL)
dump->push_back(iteminfo("GUNMOD", " " + ammo_name(mod->newtype)));
if (mod->newtype != "NULL")
dump->push_back(iteminfo("GUNMOD", "" + ammo_name(mod->newtype)));
temp1.str("");
temp1 << " Used on: ";
temp1 << "Used on: ";
if (mod->used_on_pistol)
temp1 << "Pistols. ";
if (mod->used_on_shotgun)
@@ -542,7 +615,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
it_armor* armor = dynamic_cast<it_armor*>(type);
temp1.str("");
temp1 << " Covers: ";
temp1 << "Covers: ";
if (armor->covers & mfb(bp_head))
temp1 << "The head. ";
if (armor->covers & mfb(bp_eyes))
@@ -561,43 +634,43 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
temp1 << "The feet. ";
dump->push_back(iteminfo("ARMOR", temp1.str()));
dump->push_back(iteminfo("ARMOR", " Coverage: ", "", int(armor->coverage), " percent"));
dump->push_back(iteminfo("ARMOR", "Coverage: ", "", int(armor->coverage), " percent"));
if (has_flag("FIT"))
{
dump->push_back(iteminfo("ARMOR", " Encumberment: ", "", int(armor->encumber) - 1, " (fits)", true, true));
dump->push_back(iteminfo("ARMOR", "Encumberment: ", "", int(armor->encumber) - 1, " (fits)", true, true));
}
else
{
dump->push_back(iteminfo("ARMOR", " Encumberment: ", "", int(armor->encumber), "", true, true));
dump->push_back(iteminfo("ARMOR", "Encumberment: ", "", int(armor->encumber), "", true, true));
}
dump->push_back(iteminfo("ARMOR", " Protection: Bash: ", "", int(bash_resist()), "", false, true));
dump->push_back(iteminfo("ARMOR", " Cut: ", "", int(cut_resist()), "", true, true));
dump->push_back(iteminfo("ARMOR", " Environmental protection: ", "", int(armor->env_resist)));
dump->push_back(iteminfo("ARMOR", " Warmth: ", "", int(armor->warmth)));
dump->push_back(iteminfo("ARMOR", " Storage: ", "", int(armor->storage)));
dump->push_back(iteminfo("ARMOR", "Protection: Bash: ", "", int(bash_resist()), "", false));
dump->push_back(iteminfo("ARMOR", " Cut: ", "", int(cut_resist()), "", true));
dump->push_back(iteminfo("ARMOR", "Environmental protection: ", "", int(armor->env_resist)));
dump->push_back(iteminfo("ARMOR", "Warmth: ", "", int(armor->warmth)));
dump->push_back(iteminfo("ARMOR", "Storage: ", "", int(armor->storage)));
} else if (is_book()) {
it_book* book = dynamic_cast<it_book*>(type);
if (!book->type)
dump->push_back(iteminfo("BOOK", " Just for fun."));
dump->push_back(iteminfo("BOOK", "Just for fun."));
else {
dump->push_back(iteminfo("BOOK", " Can bring your ", book->type->name() + " skill to ", int(book->level)));
dump->push_back(iteminfo("BOOK", "Can bring your ", book->type->name() + " skill to ", int(book->level)));
if (book->req == 0)
dump->push_back(iteminfo("BOOK", " It can be understood by beginners."));
dump->push_back(iteminfo("BOOK", "It can be understood by beginners."));
else
dump->push_back(iteminfo("BOOK", " Requires ", book->type->name() + " level ", int(book->req), " to understand.", true, true));
dump->push_back(iteminfo("BOOK", "Requires ", book->type->name() + " level ", int(book->req), " to understand.", true, true));
}
dump->push_back(iteminfo("BOOK", " Requires intelligence of ", "", int(book->intel), " to easily read.", true, true));
dump->push_back(iteminfo("BOOK", "Requires intelligence of ", "", int(book->intel), " to easily read.", true, true));
if (book->fun != 0)
dump->push_back(iteminfo("BOOK", " Reading this book affects your morale by ", (book->fun > 0 ? "+" : ""), int(book->fun)));
dump->push_back(iteminfo("BOOK", "Reading this book affects your morale by ", (book->fun > 0 ? "+" : ""), int(book->fun)));
dump->push_back(iteminfo("BOOK", " This book takes ", "", int(book->time), " minutes to read.", true, true));
dump->push_back(iteminfo("BOOK", "This book takes ", "", int(book->time), " minutes to read.", true, true));
if (book->recipes.size() > 0) {
dump->push_back(iteminfo("BOOK", " This book contains ", "", book->recipes.size(), " crafting recipes.", true, true));
dump->push_back(iteminfo("BOOK", "This book contains ", "", book->recipes.size(), " crafting recipes.", true, true));
}
} else if (is_tool()) {
@@ -605,15 +678,15 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
if ((tool->max_charges)!=0) {
if (has_flag("DOUBLE_AMMO")) {
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges*2), " charges (doubled)" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
dump->push_back(iteminfo("TOOL", "Maximum ", "", int(tool->max_charges*2), " charges (doubled)" + ((tool->ammo == "NULL") ? "" : (" of " + ammo_name(tool->ammo))) + "."));
} else {
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges), " charges" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
dump->push_back(iteminfo("TOOL", "Maximum ", "", int(tool->max_charges), " charges" + ((tool->ammo == "NULL") ? "" : (" of " + ammo_name(tool->ammo))) + "."));
}
}
} else if (is_style()) {
it_style* style = dynamic_cast<it_style*>(type);
dump->push_back(iteminfo("STYLE", ""));
for (int i = 0; i < style->moves.size(); i++) {
dump->push_back(iteminfo("STYLE", default_technique_name(style->moves[i].tech), ". Requires Unarmed Skill of ", int(style->moves[i].level)));
}
@@ -657,6 +730,11 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("DESCRIPTION", "\n\n"));
dump->push_back(iteminfo("DESCRIPTION", "This tool has double the normal maximum charges."));
}
std::map<std::string, std::string>::iterator item_note = item_vars.find("item_note");
if ( item_note != item_vars.end() ) {
dump->push_back(iteminfo("DESCRIPTION", "\n" ));
dump->push_back(iteminfo("DESCRIPTION", item_note->second ));
}
if (contents.size() > 0) {
if (is_gun()) {
for (int i = 0; i < contents.size(); i++)
@@ -787,7 +865,7 @@ std::string item::tname(game *g)
for (int i = 0; i < contents.size(); i++)
ret << "+";
} else if (contents.size() == 1)
ret << type->name << " of " << contents[0].tname();
ret << type->name << (contents[0].made_of(LIQUID) ? " of " : " with ") << contents[0].tname();
else if (contents.size() > 0)
ret << type->name << ", full";
else
@@ -1029,20 +1107,22 @@ bool item::rotten(game *g)
bool item::ready_to_revive(game *g)
{
if (type->id != "corpse" || corpse->species != species_zombie || damage >= 4)
{
return false;
}
int age_in_hours = (int(g->turn) - bday) / (10 * 60);
age_in_hours -= ((float)burnt/volume()) * 24;
if (damage > 0)
{
age_in_hours /= (damage + 1);
}
int rez_factor = 48 - age_in_hours;
if (age_in_hours > 6 && (rez_factor <= 0 || one_in(rez_factor)))
{
return true;
if (OPTIONS[OPT_REVIVE_ZOMBIES]) {
if (type->id != "corpse" || corpse->species != species_zombie || damage >= 4)
{
return false;
}
int age_in_hours = (int(g->turn) - bday) / (10 * 60);
age_in_hours -= ((float)burnt/volume()) * 24;
if (damage > 0)
{
age_in_hours /= (damage + 1);
}
int rez_factor = 48 - age_in_hours;
if (age_in_hours > 6 && (rez_factor <= 0 || one_in(rez_factor)))
{
return true;
}
}
return false;
}
@@ -1070,7 +1150,7 @@ bool item::craft_has_charges()
{
if (count_by_charges())
return true;
else if (ammo_type() == AT_NULL)
else if (ammo_type() == "NULL")
return true;
return false;
@@ -1104,7 +1184,7 @@ int item::weapon_value(player *p) const
gun_value += gun->dmg_bonus;
gun_value += int(gun->burst / 2);
gun_value += int(gun->clip / 3);
gun_value -= int(gun->accuracy / 5);
gun_value -= int(gun->dispersion / 5);
gun_value *= (.5 + (.3 * p->skillLevel("gun")));
gun_value *= (.3 + (.7 * p->skillLevel(gun->skill_used)));
my_value += gun_value;
@@ -1340,9 +1420,9 @@ bool item::is_silent() const
// So far only gun code uses this check
return type->is_gun() && (
noise() < 5 || // almost silent
curammo->type == AT_BOLT || // crossbows
curammo->type == AT_ARROW ||// bows
curammo->type == AT_PEBBLE // sling[shot]
curammo->type == "bolt" || // crossbows
curammo->type == "arrow" ||// bows
curammo->type == "pebble" // sling[shot]
);
}
@@ -1382,7 +1462,7 @@ bool item::is_food(player const*u) const
return true;
if (u->has_bionic("bio_batteries") && is_ammo() &&
(dynamic_cast<it_ammo*>(type))->type == AT_BATT)
(dynamic_cast<it_ammo*>(type))->type == "battery")
return true;
if (u->has_bionic("bio_furnace") && flammable() && typeId() != "corpse")
return true;
@@ -1741,17 +1821,18 @@ int item::clip_size()
return ret;
}
int item::accuracy()
int item::dispersion()
{
if (!is_gun())
return 0;
it_gun* gun = dynamic_cast<it_gun*>(type);
int ret = gun->accuracy;
int ret = gun->dispersion;
for (int i = 0; i < contents.size(); i++) {
if (contents[i].is_gunmod())
ret -= (dynamic_cast<it_gunmod*>(contents[i].type))->accuracy;
ret += (dynamic_cast<it_gunmod*>(contents[i].type))->dispersion;
}
ret += damage * 2;
if (ret < 0) ret = 0;
return ret;
}
@@ -1889,7 +1970,7 @@ ammotype item::ammo_type() const
for (int i = 0; i < contents.size(); i++) {
if (contents[i].is_gunmod() && !contents[i].has_flag("MODE_AUX")) {
it_gunmod* mod = dynamic_cast<it_gunmod*>(contents[i].type);
if (mod->newtype != AT_NULL)
if (mod->newtype != "NULL")
ret = mod->newtype;
}
}
@@ -1904,7 +1985,7 @@ ammotype item::ammo_type() const
it_gunmod* mod = dynamic_cast<it_gunmod*>(type);
return mod->newtype;
}
return AT_NULL;
return "NULL";
}
char item::pick_reload_ammo(player &u, bool interactive)
@@ -1957,7 +2038,7 @@ char item::pick_reload_ammo(player &u, bool interactive)
char am_invlet = 0;
if (am.size() > 1 && interactive) {// More than one option; list 'em and pick
WINDOW* w_ammo = newwin(am.size() + 1, 80, VIEW_OFFSET_Y, VIEW_OFFSET_X);
WINDOW* w_ammo = newwin(am.size() + 1, FULL_SCREEN_WIDTH, VIEW_OFFSET_Y, VIEW_OFFSET_X);
char ch;
clear();
it_ammo* ammo_def;
@@ -1971,7 +2052,7 @@ Choose ammo type: Damage Armor Pierce Range Accuracy");
mvwprintw(w_ammo, i + 1, 27, "%d", ammo_def->damage);
mvwprintw(w_ammo, i + 1, 38, "%d", ammo_def->pierce);
mvwprintw(w_ammo, i + 1, 55, "%d", ammo_def->range);
mvwprintw(w_ammo, i + 1, 65, "%d", 100 - ammo_def->accuracy);
mvwprintw(w_ammo, i + 1, 65, "%d", 100 - ammo_def->dispersion);
}
refresh();
wrefresh(w_ammo);
@@ -2088,6 +2169,13 @@ bool item::reload(player &u, char ammo_invlet)
if (single_load || max_load == 1) { // Only insert one cartridge!
reload_target->charges++;
ammo_to_use->charges--;
}
else if (reload_target->typeId() == "adv_UPS_off" || reload_target->typeId() == "adv_UPS_on") {
int charges_per_plut = 500;
int max_plut = std::floor( (max_load - reload_target->charges) / charges_per_plut );
int charges_used = std::min(ammo_to_use->charges, max_plut);
reload_target->charges += (charges_used * charges_per_plut);
ammo_to_use->charges -= charges_used;
} else {
reload_target->charges += ammo_to_use->charges;
ammo_to_use->charges = 0;
@@ -2154,6 +2242,7 @@ std::string default_technique_name(technique_id tech)
case TEC_DISARM: return "Disarm";
case TEC_DEF_THROW: return "Defensive throw";
case TEC_DEF_DISARM: return "Defense disarm";
case TEC_FLAMING: return "FLAMING";
default: return "A BUG! (item.cpp:default_technique_name (default))";
}
return "A BUG! (item.cpp:default_technique_name)";
+3 -3
View File
@@ -59,7 +59,7 @@ public:
// Firearm specifics
int reload_time(player &u);
int clip_size();
int accuracy();
int dispersion();
int gun_damage(bool with_ammo = true);
int noise() const;
int burst_size();
@@ -74,7 +74,7 @@ public:
void load_info(std::string data, game *g);
//std::string info(bool showtext = false); // Formatted for human viewing
std::string info(bool showtext = false);
std::string info(bool showtext, std::vector<iteminfo> *dump);
std::string info(bool showtext, std::vector<iteminfo> *dump, game *g = NULL, bool debug = false);
char symbol() const;
nc_color color() const;
int price() const;
@@ -178,7 +178,7 @@ public:
unsigned item_counter; // generic counter to be used with item flags
int mission_id;// Refers to a mission in game's master list
int player_id; // Only give a mission to the right player!
std::map<std::string, std::string> item_vars;
static itype * nullitem();
item clone();
+75 -150
View File
@@ -3,6 +3,7 @@
#include "enums.h"
#include "catajson.h"
#include "addiction.h"
#include "translations.h"
#include <algorithm>
#include <cstdlib>
#include <iostream>
@@ -20,8 +21,8 @@ Item_factory* item_controller = new Item_factory();
Item_factory::Item_factory(){
init();
m_missing_item = new itype();
m_missing_item->name = "Error: Item Missing.";
m_missing_item->description = "There is only the space where an object should be, but isn't. No item template of this type exists.";
m_missing_item->name = _("Error: Item Missing.");
m_missing_item->description = _("There is only the space where an object should be, but isn't. No item template of this type exists.");
m_templates["MISSING_ITEM"]=m_missing_item;
}
@@ -38,11 +39,7 @@ void Item_factory::init(){
iuse_function_list["CAFF"] = &iuse::caff;
iuse_function_list["ALCOHOL"] = &iuse::alcohol;
iuse_function_list["ALCOHOL_WEAK"] = &iuse::alcohol_weak;
iuse_function_list["PKILL_1"] = &iuse::pkill_1;
iuse_function_list["PKILL_2"] = &iuse::pkill_2;
iuse_function_list["PKILL_3"] = &iuse::pkill_3;
iuse_function_list["PKILL_4"] = &iuse::pkill_4;
iuse_function_list["PKILL_L"] = &iuse::pkill_l;
iuse_function_list["PKILL"] = &iuse::pkill;
iuse_function_list["XANAX"] = &iuse::xanax;
iuse_function_list["CIG"] = &iuse::cig;
iuse_function_list["ANTIBIOTIC"] = &iuse::antibiotic;
@@ -147,6 +144,8 @@ void Item_factory::init(){
iuse_function_list["TURRET"] = &iuse::turret;
iuse_function_list["UPS_OFF"] = &iuse::UPS_off;
iuse_function_list["UPS_ON"] = &iuse::UPS_on;
iuse_function_list["adv_UPS_OFF"] = &iuse::adv_UPS_off;
iuse_function_list["adv_UPS_ON"] = &iuse::adv_UPS_on;
iuse_function_list["TAZER"] = &iuse::tazer;
iuse_function_list["MP3"] = &iuse::mp3;
iuse_function_list["MP3_ON"] = &iuse::mp3_on;
@@ -173,6 +172,9 @@ void Item_factory::init(){
iuse_function_list["HEATPACK"] = &iuse::heatpack;
iuse_function_list["DEJAR"] = &iuse::dejar;
iuse_function_list["RAD_BADGE"] = &iuse::rad_badge;
iuse_function_list["BOOTS"] = &iuse::boots;
iuse_function_list["ABSORBENT"] = &iuse::towel;
iuse_function_list["UNFOLD_BICYCLE"] = &iuse::unfold_bicycle;
// MACGUFFINS
iuse_function_list["MCG_NOTE"] = &iuse::mcg_note;
// ARTIFACTS
@@ -191,6 +193,7 @@ void Item_factory::init(){
techniques_list["FEINT"] = mfb(TEC_FEINT);
techniques_list["THROW"] = mfb(TEC_THROW);
techniques_list["DISARM"] = mfb(TEC_DISARM);
techniques_list["FLAMING"] = mfb(TEC_FLAMING);
// Defensive Techniques
techniques_list["BLOCK"] = mfb(TEC_BLOCK);
techniques_list["BLOCK_LEGS"] = mfb(TEC_BLOCK_LEGS);
@@ -202,55 +205,6 @@ void Item_factory::init(){
techniques_list["DEF_THROW"] = mfb(TEC_DEF_THROW);
techniques_list["DEF_DISARM"] = mfb(TEC_DEF_DISARM);
//Ammo lists
ammo_flags_list["NULL"] = mfb(AT_NULL);
ammo_flags_list["THREAD"] = mfb(AT_THREAD);
ammo_flags_list["BATT"] = mfb(AT_BATT);
ammo_flags_list["PLUT"] = mfb(AT_PLUT);
ammo_flags_list["NAIL"] = mfb(AT_NAIL);
ammo_flags_list["BB"] = mfb(AT_BB);
ammo_flags_list["BOLT"] = mfb(AT_BOLT);
ammo_flags_list["ARROW"] = mfb(AT_ARROW);
ammo_flags_list["SHOT"] = mfb(AT_SHOT);
ammo_flags_list["22"] = mfb(AT_22);
ammo_flags_list["9MM"] = mfb(AT_9MM);
ammo_flags_list["762x25"] = mfb(AT_762x25);
ammo_flags_list["38"] = mfb(AT_38);
ammo_flags_list["40"] = mfb(AT_40);
ammo_flags_list["44"] = mfb(AT_44);
ammo_flags_list["45"] = mfb(AT_45);
ammo_flags_list["57"] = mfb(AT_57);
ammo_flags_list["46"] = mfb(AT_46);
ammo_flags_list["762"] = mfb(AT_762);
ammo_flags_list["223"] = mfb(AT_223);
ammo_flags_list["3006"] = mfb(AT_3006);
ammo_flags_list["308"] = mfb(AT_308);
ammo_flags_list["40MM"] = mfb(AT_40MM);
ammo_flags_list["66MM"] = mfb(AT_66MM);
ammo_flags_list["GAS"] = mfb(AT_GAS);
ammo_flags_list["FUSION"] = mfb(AT_FUSION);
ammo_flags_list["MUSCLE"] = mfb(AT_MUSCLE);
ammo_flags_list["12MM"] = mfb(AT_12MM);
ammo_flags_list["PLASMA"] = mfb(AT_PLASMA);
ammo_flags_list["WATER"] = mfb(AT_WATER);
ammo_flags_list["PEBBLE"] = mfb(AT_PEBBLE);
ammo_effects_list["FLAME"] = mfb(AMMO_FLAME);
ammo_effects_list["INCENDIARY"] = mfb(AMMO_INCENDIARY);
ammo_effects_list["IGNITE"] = mfb(AMMO_IGNITE);
ammo_effects_list["EXPLOSIVE"] = mfb(AMMO_EXPLOSIVE);
ammo_effects_list["FRAG"] = mfb(AMMO_FRAG);
ammo_effects_list["NAPALM"] = mfb(AMMO_NAPALM);
ammo_effects_list["ACIDBOMB"] = mfb(AMMO_ACIDBOMB);
ammo_effects_list["EXPLOSIVE_BIG"] = mfb(AMMO_EXPLOSIVE_BIG);
ammo_effects_list["TEARGAS"] = mfb(AMMO_TEARGAS);
ammo_effects_list["SMOKE"] = mfb(AMMO_SMOKE);
ammo_effects_list["TRAIL"] = mfb(AMMO_TRAIL);
ammo_effects_list["FLASHBANG"] = mfb(AMMO_FLASHBANG);
ammo_effects_list["STREAM"] = mfb(AMMO_STREAM);
ammo_effects_list["COOKOFF"] = mfb(AMMO_COOKOFF);
ammo_effects_list["LASER"] = mfb(AMMO_LASER);
bodyparts_list["TORSO"] = mfb(bp_torso);
bodyparts_list["HEAD"] = mfb(bp_head);
bodyparts_list["EYES"] = mfb(bp_eyes);
@@ -343,6 +297,15 @@ Item_list Item_factory::create_random(int created_at, int quantity){
return new_items;
}
bool Item_factory::group_contains_item(Item_tag group_tag, Item_tag item) {
Item_group *current_group = m_template_groups.find(group_tag)->second;
if(current_group) {
return current_group->has_item(item);
} else {
return 0;
}
}
///////////////////////
// DATA FILE READING //
///////////////////////
@@ -353,6 +316,7 @@ void Item_factory::load_item_templates(){
load_item_templates_from("data/raw/items/ammo.json");
load_item_templates_from("data/raw/items/mods.json");
load_item_templates_from("data/raw/items/tools.json");
load_item_templates_from("data/raw/items/containers.json");
load_item_templates_from("data/raw/items/comestibles.json");
load_item_templates_from("data/raw/items/armor.json");
load_item_templates_from("data/raw/items/books.json");
@@ -402,16 +366,19 @@ void Item_factory::load_item_templates_from(const std::string file_name){
it_gunmod* gunmod_template = new it_gunmod();
gunmod_template->damage = entry.get("damage_modifier").as_int();;
gunmod_template->loudness = entry.get("loudness_modifier").as_int();
gunmod_template->newtype = ammo_from_string(entry.get("ammo_modifier").as_string());
gunmod_template->newtype = entry.get("ammo_modifier").as_string();
gunmod_template->used_on_pistol = is_mod_target(entry.get("mod_targets"), "pistol");
gunmod_template->used_on_shotgun = is_mod_target(entry.get("mod_targets"), "shotgun");
gunmod_template->used_on_smg = is_mod_target(entry.get("mod_targets"), "smg");
gunmod_template->used_on_rifle = is_mod_target(entry.get("mod_targets"), "rifle");
gunmod_template->accuracy = entry.get("accuracy_modifier").as_int();
gunmod_template->dispersion = entry.get("dispersion_modifier").as_int();
gunmod_template->recoil = entry.get("recoil_modifier").as_int();
gunmod_template->burst = entry.get("burst_modifier").as_int();
gunmod_template->clip = entry.get("clip_size_modifier").as_int();
gunmod_template->acceptible_ammo_types = (!entry.has("acceptable_ammo") ? 0 : flags_from_json(entry.get("acceptable_ammo"), "ammo"));
if( entry.has("acceptable_ammo") ) {
tags_from_json( entry.get("acceptable_ammo"),
gunmod_template->acceptible_ammo_types );
}
new_item_template = gunmod_template;
}
else if (type_label == "COMESTIBLE")
@@ -434,11 +401,11 @@ void Item_factory::load_item_templates_from(const std::string file_name){
else if (type_label == "GUN")
{
it_gun* gun_template = new it_gun();
gun_template->ammo = ammo_from_string(entry.get("ammo").as_string());
gun_template->ammo = entry.get("ammo").as_string();
gun_template->skill_used = Skill::skill(entry.get("skill").as_string());
gun_template->dmg_bonus = entry.get("ranged_damage").as_int();
gun_template->range = entry.get("range").as_int();
gun_template->accuracy = entry.get("accuracy").as_int();
gun_template->dispersion = entry.get("dispersion").as_int();
gun_template->recoil = entry.get("recoil").as_int();
gun_template->durability = entry.get("durability").as_int();
gun_template->burst = entry.get("burst").as_int();
@@ -450,7 +417,7 @@ void Item_factory::load_item_templates_from(const std::string file_name){
else if (type_label == "TOOL")
{
it_tool* tool_template = new it_tool();
tool_template->ammo = ammo_from_string(entry.get("ammo").as_string());
tool_template->ammo = entry.get("ammo").as_string();
tool_template->max_charges = entry.get("max_charges").as_int();
tool_template->def_charges = entry.get("initial_charges").as_int();
tool_template->charges_per_use = entry.get("charges_per_use").as_int();
@@ -462,20 +429,17 @@ void Item_factory::load_item_templates_from(const std::string file_name){
else if (type_label == "AMMO")
{
it_ammo* ammo_template = new it_ammo();
ammo_template->type =
ammo_from_string(
entry.get("ammo_type").as_string());
ammo_template->type = entry.get("ammo_type").as_string();
ammo_template->damage = entry.get("damage").as_int();
ammo_template->pierce = entry.get("pierce").as_int();
ammo_template->range = entry.get("range").as_int();
ammo_template->accuracy =
entry.get("accuracy").as_int();
ammo_template->dispersion =
entry.get("dispersion").as_int();
ammo_template->recoil = entry.get("recoil").as_int();
ammo_template->count = entry.get("count").as_int();
ammo_template->ammo_effects =
(!entry.has("effects") ? 0 :
flags_from_json(entry.get("effects"),
"ammo_effects"));
if( entry.has("effects") ) {
tags_from_json(entry.get("effects"), ammo_template->ammo_effects);
}
new_item_template = ammo_template;
}
@@ -508,6 +472,14 @@ void Item_factory::load_item_templates_from(const std::string file_name){
new_item_template = book_template;
}
else if (type_label == "CONTAINER")
{
it_container* container_template = new it_container();
container_template->contains = entry.get("contains").as_int();
new_item_template = container_template;
}
else
{
debugmsg("Item definition for %s skipped, unrecognized type: %s", new_id.c_str(),
@@ -521,10 +493,10 @@ void Item_factory::load_item_templates_from(const std::string file_name){
// And then proceed to assign the correct field
new_item_template->rarity = entry.get("rarity").as_int();
new_item_template->price = entry.get("price").as_int();
new_item_template->name = entry.get("name").as_string();
new_item_template->name = _(entry.get("name").as_string().c_str());
new_item_template->sym = entry.get("symbol").as_char();
new_item_template->color = color_from_string(entry.get("color").as_string());
new_item_template->description = entry.get("description").as_string();
new_item_template->description = _(entry.get("description").as_string().c_str());
if(entry.has("material")){
set_material_from_json(new_id, entry.get("material"));
} else {
@@ -552,6 +524,13 @@ void Item_factory::load_item_templates_from(const std::string file_name){
OVERSIZE - Can always be worn no matter encumberance/mutations/bionics/etc
HOOD - Will increase warmth for head if head is cold and player is not wearing a helmet (headwear of material that is not wool or cotton)
POCKETS - Will increase warmth for hands if hands are cold and the player is wielding nothing
WATCH - Shows the current time, instead of sun/moon position
ALARM - Has a alarmclock feature
Container-only flags:
SEALS
RIGID
WATERTIGHT
*/
}
@@ -587,6 +566,9 @@ void Item_factory::load_item_groups_from(const std::string file_name){
//Crawl through once and create an entry for every definition
const picojson::array& all_items = input_value.get<picojson::array>();
for (picojson::array::const_iterator entry = all_items.begin(); entry != all_items.end(); ++entry) {
// TODO: Make sure we have at least an item or group child, as otherwise
// later things will bug out.
if( !(entry->is<picojson::object>()) ){
std::cerr << "Invalid group definition, entry not a JSON object" << std::endl;
}
@@ -608,7 +590,7 @@ void Item_factory::load_item_groups_from(const std::string file_name){
const picojson::value::object& entry_body = entry->get<picojson::object>();
Item_tag group_id = entry_body.find("id")->second.get<std::string>();
Item_group current_group = *m_template_groups.find(group_id)->second;
Item_group *current_group = m_template_groups.find(group_id)->second;
//Add items
picojson::value::object::const_iterator key_pair = entry_body.find("items");
@@ -630,7 +612,7 @@ void Item_factory::load_item_groups_from(const std::string file_name){
if(!item_frequency_array[0].is<std::string>() || !item_frequency_array[1].is<double>() ){
std::cerr << "Invalid item list for group definition '"+group_id+"', element is not a valid tag/frequency pair." << std::endl;
} else {
current_group.add_entry(item_frequency_array[0].get<std::string>(), (int)item_frequency_array[1].get<double>());
current_group->add_entry(item_frequency_array[0].get<std::string>(), (int)item_frequency_array[1].get<double>());
}
}
}
@@ -658,7 +640,7 @@ void Item_factory::load_item_groups_from(const std::string file_name){
std::cerr << "Invalid group list for group definition '"+group_id+"', element is not a valid tag/frequency pair." << std::endl;
} else {
Item_group* subgroup = m_template_groups.find(item_frequency_array[0].get<std::string>())->second;
current_group.add_group(subgroup, (int)item_frequency_array[1].get<double>());
current_group->add_group(subgroup, (int)item_frequency_array[1].get<double>());
}
}
}
@@ -705,75 +687,6 @@ nc_color Item_factory::color_from_string(std::string new_color){
}
}
ammotype Item_factory::ammo_from_string(std::string new_ammo){
if("nail"==new_ammo){
return AT_NAIL;
} else if ("BB" == new_ammo) {
return AT_BB;
} else if ("pebble" == new_ammo) {
return AT_PEBBLE;
} else if ("bolt" == new_ammo) {
return AT_BOLT;
} else if ("arrow" == new_ammo) {
return AT_ARROW;
} else if ("shot" == new_ammo) {
return AT_SHOT;
} else if (".22" == new_ammo) {
return AT_22;
} else if ("9mm" == new_ammo) {
return AT_9MM;
} else if ("7.62x25mm" == new_ammo) {
return AT_762x25;
} else if (".38" == new_ammo) {
return AT_38;
} else if (".40" == new_ammo) {
return AT_40;
} else if (".44" == new_ammo) {
return AT_44;
} else if (".45" == new_ammo) {
return AT_45;
} else if ("5.7mm" == new_ammo) {
return AT_57;
} else if ("4.6mm" == new_ammo) {
return AT_46;
} else if ("7.62x39mm" == new_ammo) {
return AT_762;
} else if (".223" == new_ammo) {
return AT_223;
} else if (".30-06" == new_ammo) {
return AT_3006;
} else if (".308" == new_ammo) {
return AT_308;
} else if ("40mm" == new_ammo) {
return AT_40MM;
} else if ("66mm" == new_ammo) {
return AT_66MM;
} else if ("gasoline" == new_ammo) {
return AT_GAS;
} else if ("thread" == new_ammo) {
return AT_THREAD;
} else if ("battery" == new_ammo) {
return AT_BATT;
} else if ("plutonium" == new_ammo) {
return AT_PLUT;
} else if ("muscle" == new_ammo) {
return AT_MUSCLE;
} else if ("fusion" == new_ammo) {
return AT_FUSION;
} else if ("12mm" == new_ammo) {
return AT_12MM;
} else if ("plasma" == new_ammo) {
return AT_PLASMA;
} else if ("water" == new_ammo) {
return AT_WATER;
} else if ("none" == new_ammo) {
return AT_NULL; // NX17 and other special weapons
} else {
debugmsg("Read invalid ammo %s.", new_ammo.c_str());
return AT_NULL;
}
}
Use_function Item_factory::use_from_string(std::string function_name){
std::map<Item_tag, Use_function>::iterator found_function = iuse_function_list.find(function_name);
@@ -790,12 +703,8 @@ Use_function Item_factory::use_from_string(std::string function_name){
void Item_factory::set_flag_by_string(unsigned& cur_flags, std::string new_flag, std::string flag_type)
{
std::map<Item_tag, unsigned> flag_map;
if(flag_type=="ammo"){
flag_map = ammo_flags_list;
} else if(flag_type=="techniques"){
if(flag_type=="techniques"){
flag_map = techniques_list;
} else if(flag_type=="ammo_effects"){
flag_map = ammo_effects_list;
} else if(flag_type=="bodyparts"){
flag_map = bodyparts_list;
}
@@ -816,6 +725,22 @@ void Item_factory::set_bitmask_by_string(std::map<Item_tag, unsigned> flag_map,
}
}
void Item_factory::tags_from_json(catajson tag_list, std::set<std::string> &tags)
{
if (tag_list.is_array())
{
for (tag_list.set_begin(); tag_list.has_curr(); tag_list.next())
{
tags.insert( tag_list.curr().as_string() );
}
}
else
{
//we should have gotten a string, if not an array, and catajson will do error checking
tags.insert( tag_list.as_string() );
}
}
unsigned Item_factory::flags_from_json(catajson flag_list, std::string flag_type){
//If none is found, just use the standard none action
unsigned flag = 0;
+2 -5
View File
@@ -35,6 +35,7 @@ public:
itype* template_from(Item_tag group_tag);
const Item_tag random_id();
const Item_tag id_from(Item_tag group_tag);
bool group_contains_item(Item_tag group_tag, Item_tag item);
//Production methods
item create(Item_tag id, int created_at);
@@ -56,11 +57,11 @@ private:
nc_color color_from_string(std::string color);
Use_function use_from_string(std::string name);
void tags_from_json(catajson tag_list, std::set<std::string> &tags);
unsigned flags_from_json(catajson flags, std::string flag_type="");
void set_material_from_json(Item_tag new_id, catajson mats);
bool is_mod_target(catajson targets, std::string weapon);
phase_id phase_from_tag(Item_tag name);
ammotype ammo_from_string(std::string ammo);
//two convenience functions that just call into set_bitmask_by_string
void set_flag_by_string(unsigned& cur_flags, std::string new_flag, std::string flag_type);
@@ -72,10 +73,6 @@ private:
std::map<Item_tag, Use_function> iuse_function_list;
//techniques stuff
std::map<Item_tag, unsigned> techniques_list;
//ammo stuff
std::map<Item_tag, unsigned> ammo_flags_list;
//ammo effects
std::map<Item_tag, unsigned> ammo_effects_list;
//bodyparts
std::map<Item_tag, unsigned> bodyparts_list;
};
+10
View File
@@ -86,3 +86,13 @@ bool Item_group_group::check(int value) const{
const Item_tag Item_group_group::get(std::vector<Item_tag> recursion_list){
return m_group->get_id(recursion_list);
}
bool Item_group::has_item(const Item_tag item_id) {
for(int i=0; i<m_entries.size(); i++) {
if(m_entries[i]->get() == item_id) {
return 1;
}
}
return 0;
}
+3
View File
@@ -17,6 +17,9 @@ public:
const Item_tag get_id(std::vector<Item_tag> recursion_list);
void add_entry(const Item_tag item_id, int chance);
void add_group(Item_group*, int chance);
// Does this item group contain the given item?
bool has_item(const Item_tag item_id);
private:
const Item_tag m_id;
int m_max_odds;
+21 -80
View File
@@ -42,27 +42,7 @@ extern std::vector<std::string> artifact_itype_ids;
extern std::vector<std::string> standard_itype_ids;
extern std::vector<std::string> pseudo_itype_ids;
// IMPORTANT: If adding a new AT_*** ammotype, add it to the ammo_name function
// at the end of itypedef.cpp
enum ammotype {
AT_NULL, AT_THREAD,
AT_BATT, AT_PLUT,
AT_NAIL, AT_BB, AT_BOLT, AT_ARROW,
AT_SHOT,
AT_22, AT_9MM, AT_762x25, AT_38, AT_40, AT_44, AT_45,
AT_57, AT_46,
AT_762, AT_223, AT_3006, AT_308,
AT_40MM,
AT_66MM,
AT_GAS,
AT_FUSION,
AT_MUSCLE,
AT_12MM,
AT_PLASMA,
AT_WATER,
AT_PEBBLE,
NUM_AMMO_TYPES
};
typedef std::string ammotype;
enum software_type {
SW_NULL,
@@ -74,25 +54,6 @@ SW_DATA,
NUM_SOFTWARE_TYPES
};
enum ammo_effect {
AMMO_FLAME, // Sets fire to terrain and monsters
AMMO_INCENDIARY, // Sparks explosive terrain
AMMO_IGNITE, // Sets fire to some monsters
AMMO_EXPLOSIVE, // Small explosion
AMMO_FRAG, // Frag explosion
AMMO_NAPALM, // Firey explosion
AMMO_ACIDBOMB, // Acid bomb ammo
AMMO_EXPLOSIVE_BIG, // Big explosion!
AMMO_TEARGAS, // Teargas burst
AMMO_SMOKE, // Smoke burst
AMMO_TRAIL, // Leaves a trail of smoke
AMMO_FLASHBANG, // Disorients and blinds
AMMO_STREAM, // Doesn't stop once it hits a monster
AMMO_COOKOFF, // Explodes when burned instead of just burning
AMMO_LASER, // laser effects
NUM_AMMO_EFFECTS
};
enum technique_id {
TEC_NULL,
// Offensive Techniques
@@ -105,6 +66,7 @@ TEC_RAPID, // Hits faster
TEC_FEINT, // Misses take less time
TEC_THROW, // Attacks may throw your opponent
TEC_DISARM, // Remove an NPC's weapon
TEC_FLAMING, // Sets victim on fire
// Defensive Techniques
TEC_BLOCK, // Block attacks, reducing them to 25% damage
TEC_BLOCK_LEGS, // Block attacks, but with your legs
@@ -351,11 +313,11 @@ struct it_ammo : public itype
unsigned char damage; // Average damage done
unsigned char pierce; // Armor piercing; static reduction in armor
unsigned char range; // Maximum range
signed char accuracy; // Accuracy (low is good)
signed char dispersion;// Dispersion (low is good)
unsigned char recoil; // Recoil; modified by strength
unsigned char count; // Default charges
unsigned ammo_effects : NUM_AMMO_EFFECTS;
std::set<std::string> ammo_effects;
virtual bool is_ammo() { return true; }
// virtual bool count_by_charges() { return id != "gasoline"; }
@@ -363,14 +325,13 @@ struct it_ammo : public itype
it_ammo() : itype()
{
type = AT_NULL;
type = "NULL";
damage = 0;
pierce = 0;
range = 0;
accuracy = 0;
dispersion = 0;
recoil = 0;
count = 0;
ammo_effects = 0;
}
it_ammo(std::string pid, unsigned char prarity, unsigned int pprice,
@@ -378,10 +339,10 @@ struct it_ammo : public itype
char psym, nc_color pcolor, std::string pm1, phase_id pphase,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned effects,
std::set<std::string> effects,
ammotype ptype, unsigned char pdamage, unsigned char ppierce,
signed char paccuracy, unsigned char precoil, unsigned char prange,
signed char pdispersion, unsigned char precoil, unsigned char prange,
unsigned char pcount)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, "null", pphase,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, 0) {
@@ -389,7 +350,7 @@ struct it_ammo : public itype
damage = pdamage;
pierce = ppierce;
range = prange;
accuracy = paccuracy;
dispersion = pdispersion;
recoil = precoil;
count = pcount;
ammo_effects = effects;
@@ -402,7 +363,7 @@ struct it_gun : public itype
Skill *skill_used;
signed char dmg_bonus;
signed char range;
signed char accuracy;
signed char dispersion;
signed char recoil;
signed char durability;
unsigned char burst;
@@ -418,7 +379,7 @@ struct it_gun : public itype
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
const char *pskill_used, ammotype pammo, signed char pdmg_bonus, signed char prange,
signed char paccuracy, signed char precoil, unsigned char pdurability,
signed char pdispersion, signed char precoil, unsigned char pdurability,
unsigned char pburst, int pclip, int preload_time)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
@@ -426,7 +387,7 @@ struct it_gun : public itype
ammo = pammo;
dmg_bonus = pdmg_bonus;
range = prange;
accuracy = paccuracy;
dispersion = pdispersion;
recoil = precoil;
durability = pdurability;
burst = pburst;
@@ -439,9 +400,9 @@ struct it_gun : public itype
struct it_gunmod : public itype
{
signed char accuracy, damage, loudness, clip, recoil, burst;
signed char dispersion, damage, loudness, clip, recoil, burst;
ammotype newtype;
unsigned acceptible_ammo_types : NUM_AMMO_TYPES;
std::set<std::string> acceptible_ammo_types;
bool used_on_pistol;
bool used_on_shotgun;
bool used_on_smg;
@@ -456,14 +417,14 @@ struct it_gunmod : public itype
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit,
signed char paccuracy, signed char pdamage, signed char ploudness,
signed char pdispersion, signed char pdamage, signed char ploudness,
signed char pclip, signed char precoil, signed char pburst,
ammotype pnewtype, long a_a_t, bool pistol,
ammotype pnewtype, std::set<std::string> a_a_t, bool pistol,
bool shotgun, bool smg, bool rifle)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
accuracy = paccuracy;
dispersion = pdispersion;
damage = pdamage;
loudness = ploudness;
clip = pclip;
@@ -485,7 +446,7 @@ struct it_armor : public itype
unsigned char covers; // Bitfield of enum body_part
signed char encumber;
unsigned char coverage;
unsigned char thickness;
unsigned char thickness;
unsigned char env_resist; // Resistance to environmental effects
signed char warmth;
unsigned char storage;
@@ -573,31 +534,11 @@ struct it_book : public itype
}
};
enum container_flags {
con_rigid,
con_wtight,
con_seals,
num_con_flags
};
struct it_container : public itype
{
unsigned char contains; // Internal volume
unsigned flags : num_con_flags;
virtual bool is_container() { return true; }
it_container(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, std::string pm1, std::string pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit,
unsigned char pcontains, unsigned pflags)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
contains = pcontains;
flags = pflags;
}
it_container() {};
};
struct it_tool : public itype
@@ -615,7 +556,7 @@ struct it_tool : public itype
it_tool() :itype()
{
ammo = AT_NULL;
ammo = "NULL";
max_charges = 0;
def_charges = 0;
charges_per_use = 0;
@@ -833,7 +774,7 @@ struct it_artifact_tool : public it_tool
}
it_artifact_tool() :it_tool(){
ammo = AT_NULL;
ammo = "NULL";
price = 0;
def_charges = 0;
charges_per_use = 1;
+84 -178
View File
@@ -39,6 +39,7 @@ void game::init_itypes ()
itypes["corpse"]=
new itype("corpse", 0, 0, "corpse", "A dead body.", '%', c_white, "null", "null", PNULL, 0, 0,
0, 0, 1, 0);
itypes["corpse"]->item_tags.insert("NO_UNLOAD");
// Fire - only appears in crafting recipes
itypes["fire"]=
new itype("fire", 0, 0, "nearby fire",
@@ -118,23 +119,6 @@ VAR_VEH_PART("v8_combustion", "V8 engine", 2, 250, ':', c_ltcyan, "iron", "n
25, 600, 15, 0, -5, 0, 380, 700, BIGNESS_ENGINE_DISPLACEMENT, "\
A large and very powerful 8-cylinder combustion engine.");
// AMMUNITION
// Material should be the wrapper--even though shot is made of iron, because
// it can survive a dip in water and be okay, its material here is "plastic".
// dmg is damage done, in an average hit. Note that the average human has
// 80 health. Headshots do 8x damage; vital hits do 2x-4x; glances do 0x-1x.
// Weight and price is per 100 rounds.
// AP is a reduction in the armor of the target.
// Accuracy is in quarter-degrees, and measures the maximum this ammo will
// contribute to the angle of difference. HIGH ACC IS BAD.
// Recoil is cumulative between shots. 4 recoil = 1 accuracy.
// IMPORTANT: If adding a new AT_*** ammotype, add it to the ammo_name function
// at the end of this file.
#define AMMO(id, name,rarity,price,ammo_type,color,mat,volume,wgt,dmg,AP,range,\
accuracy,recoil,count,des,effects) \
itypes[id]=new it_ammo(id,rarity,price,name,des,'=',\
color,mat,SOLID,volume,wgt,1,0,0,effects,ammo_type,dmg,AP,accuracy,recoil,range,count);
// GUNS
// ammo_type matches one of the ammo_types above.
// dmg is ADDED to the damage of the corresponding ammo. +/-, should be small.
@@ -144,28 +128,11 @@ color,mat,SOLID,volume,wgt,1,0,0,effects,ammo_type,dmg,AP,accuracy,recoil,range,
// clip is how many shots we get before reloading.
#define GUN(id,name,rarity,price,color,mat1,mat2,skill,ammo,volume,wgt,melee_dam,\
to_hit,dmg,range,accuracy,recoil,durability,burst,clip,reload_time,des) \
to_hit,dmg,range,dispersion,recoil,durability,burst,clip,reload_time,des) \
itypes[id]=new it_gun(id,rarity,price,name,des,'(',\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,skill,ammo,dmg,range,accuracy,\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,skill,ammo,dmg,range,dispersion,\
recoil,durability,burst,clip,reload_time)
// CONTAINERS
// These are containers you hold in your hand--ones you wear are _armor_!
// These only have two attributes; contains, which is the volume it holds, and
// the flags. There are only three flags, con_rigid, con_wtight and con_seals.
// con_rigid is used if the item's total volume is constant.
// Otherwise, its volume is calculated as VOL + volume of the contents
// con_wtight is used if you can store liquids in this container
// con_seals is used if it seals--this has many implications
// * Won't spill
// * Can be used as an icebox
// * Others??
#define CONT(id, name,rarity,price,color,mat1,mat2,volume,wgt,melee_dam,to_hit,\
contains,flags,des) \
itypes[id]=new it_container(id,rarity,price,name,des,\
')',color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,contains,flags)
// NAME RAR PRC COLOR MAT1 MAT2
/* TOOLS
* MAX is the maximum number of charges help.
* DEF is the default number of charges--items will be generated with this
@@ -173,7 +140,7 @@ itypes[id]=new it_container(id,rarity,price,name,des,\
* USE is how many charges are used up when 'a'pplying the object.
* SEC is how many turns will pass before a charge is drained if the item is
* active; generally only used in the "<whatever> (on)" forms
* FUEL is the type of charge the tool uses; set to AT_NULL if the item is
* FUEL is the type of charge the tool uses; set to "NULL" if the item is
* unable to be recharged.
* REVERT is the item type that the tool will revert to once its charges are
* drained
@@ -188,70 +155,9 @@ itypes[id]=new it_tool(id,rarity,price,name,des,sym,\
color,mat1,mat2,SOLID,volume,wgt,melee_dam,melee_cut,to_hit,max_charge,\
def_charge,charge_per_use,charge_per_sec,fuel,revert,func)
CONT("bag_plastic", "plastic bag", 50, 1, c_ltgray, "plastic","null",
// VOL WGT DAM HIT VOL FLAGS
1, 0, -8, -4, 24, 0, "\
A small, open plastic bag. Essentially trash.");
CONT("bottle_plastic", "plastic bottle", 70, 8, c_ltcyan, "plastic","null",
2, 0, -8, 1, 2, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A resealable plastic bottle, holds 500mls of liquid.");
CONT("bottle_glass", "glass bottle", 70, 12, c_cyan, "glass", "null",
3, 2, 8, 1, 3, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A resealable glass bottle, holds 750mls of liquid.");
CONT("can_drink", "aluminum can", 70, 1, c_ltblue, "steel", "null",
1, 0, 0, 0, 1, mfb(con_rigid)|mfb(con_wtight), "\
An aluminum can, like what soda comes in.");
CONT("can_food", "tin can", 65, 2, c_blue, "iron", "null",
1, 0, -1, 1, 1, mfb(con_rigid)|mfb(con_wtight), "\
A tin can, like what beans come in.");
CONT("box_small", "sm. cardboard box",50, 0, c_brown, "paper", "null",
4, 0, -5, 1, 4, mfb(con_rigid), "\
A small cardboard box. No bigger than a foot in any dimension.");
CONT("canteen", "plastic canteen", 20, 1000, c_green, "plastic","null",
6, 2, -8, 1, 6, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A large military-style water canteen, with a 1.5 liter capacity and strap.");
CONT("jerrycan", "plastic jerrycan", 10, 2500, c_green, "plastic","null",
40, 4, -2, -2, 40, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A bulky plastic jerrycan, meant to carry fuel, but can carry other liquids\n\
in a pinch. It has a capacity of 10 liters.");
CONT("jug_plastic", "gallon jug", 10, 2500, c_ltcyan, "plastic","null",
10, 2, -8, 1, 10, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A standard plastic jug used for household cleaning chemicals.");
CONT("flask_glass", "glass flask", 10, 2500, c_ltcyan, "glass","null",
1, 0, 8, 1, 1, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A 250 ml laboratory conical flask, with a rubber bung.");
CONT("waterskin", "waterskin", 0, 0, c_brown, "leather", "null",
// VOL WGT DAM HIT VOL FLAGS
6, 4, -8, -5, 6, mfb(con_wtight)|mfb(con_seals), "\
A watertight leather bag, can hold 1.5 liters of water.");
CONT("jerrycan_big", "steel jerrycan", 20, 5000, c_green, "steel", "null",
100, 7, -3, -3, 100, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A steel jerrycan, meant to carry fuel, but can carry other liquds\n\
in a pinch. It has a capacity of 25 liters.");
CONT("keg", "aluminum keg", 20, 6000, c_ltcyan, "steel", "null",
200, 12, -4, -4, 200, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A reusable aluminum keg, used for shipping beer.\n\
It has a capcity of 50 liters.");
CONT("jar_glass", "glass jar", 50, 2500, c_ltcyan, "glass","null",
1, 1, 8, 1, 1, mfb(con_rigid)|mfb(con_wtight)|mfb(con_seals),"\
A half-litre glass jar with a metal screw top lid, used for canning.");
TOOL("jack", "jack", 30, 86, ';', c_ltgray, "iron", "null",
// VOL WGT DAM CUT HIT FLAGS
5, 10, 11, 0, 2, 0, 0, 0, 0, AT_NULL, "null", &iuse::none, "\
5, 10, 11, 0, 2, 0, 0, 0, 0, "NULL", "null", &iuse::none, "\
A common hydraulic jack, used when changing tires.");
// BIONICS
@@ -264,7 +170,7 @@ color, "steel", "plastic", 10, 18, 8, 0, 0, difficulty)
#define BIO_SINGLE(id,rarity,price,color,difficulty) \
BIO(id, std::string("CBM: ")+bionics[id]->name, rarity,price,color,difficulty, \
word_rewrap(bionics[id]->description, 50)) \
bionics[id]->description) \
// Name RAR PRICE COLOR DIFFICULTY
BIO("bio_power_storage", "CBM: Power Storage", 24, 3800, c_green, 1, "\
@@ -338,6 +244,7 @@ BIO_SINGLE("bio_water_extractor", 3, 5500, c_green, 5);
BIO_SINGLE("bio_shock", 2, 5500, c_red, 5);
BIO_SINGLE("bio_heat_absorb", 2, 5500, c_red, 5);
BIO_SINGLE("bio_claws", 2, 5500, c_red, 5);
BIO_SINGLE("bio_shockwave", 2, 5500, c_red, 5);
// armor:
BIO_SINGLE("bio_carbon", 3, 7500, c_cyan, 9);
BIO_SINGLE("bio_armor_head", 3, 3500, c_cyan, 5);
@@ -348,7 +255,8 @@ BIO_SINGLE("bio_armor_legs", 3, 3500, c_cyan, 3);
BIO_SINGLE("bio_face_mask", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_scent_mask", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_cloak", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2);
BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2);
BIO_SINGLE("bio_night", 1, 8500, c_magenta, 5);
// defensive
BIO_SINGLE("bio_ads", 1, 9500, c_ltblue, 7);
BIO_SINGLE("bio_ods", 1, 9500, c_ltblue, 7);
@@ -360,11 +268,15 @@ BIO_SINGLE("bio_resonator", 2, 12000, c_dkgray, 11);
BIO_SINGLE("bio_hydraulics", 3, 4000, c_dkgray, 6);
// super soldier
BIO_SINGLE("bio_time_freeze", 1, 14000, c_white, 11);
BIO_SINGLE("bio_teleport", 1, 7000, c_white, 7);
BIO_SINGLE("bio_teleport", 1, 7000, c_white, 7);
BIO_SINGLE("bio_probability_travel", 1, 14000, c_white, 11);
// ranged combat
BIO_SINGLE("bio_blaster", 13, 2200, c_red, 3);
BIO_SINGLE("bio_laser", 2, 7200, c_red, 5);
BIO_SINGLE("bio_emp", 2, 7200, c_red, 5);
BIO_SINGLE("bio_emp", 2, 7200, c_red, 5);
BIO_SINGLE("bio_flashbang", 2, 7200, c_red, 5);
BIO_SINGLE("bio_railgun", 5, 2200, c_red, 3);
BIO_SINGLE("bio_chain_lightning", 5, 2200, c_red, 3);
// power armor
BIO_SINGLE("bio_power_armor_interface", 20, 1200, c_yellow, 1);
BIO_SINGLE("bio_power_armor_interface_mkII", 8, 10000, c_yellow, 8);
@@ -403,23 +315,21 @@ for(std::map<std::string,itype*>::iterator iter = itypes.begin(); iter != itypes
}
}
// NAME RARE TYPE COLOR MAT
AMMO("bio_fusion_ammo", "Fusion blast", 0,0, AT_FUSION,c_dkgray, "null",
// VOL WGT DMG AP RNG ACC REC COUNT
0, 0, 40, 0, 10, 1, 0, 5, "", mfb(AMMO_INCENDIARY));
// NAME RARE COLOR MAT1 MAT2
GUN("bio_blaster_gun", "fusion blaster", 0,0,c_magenta, "steel", "plastic",
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", AT_FUSION, 12, 0, 0, 0, 0, 0, 4, 0, 10, 0, 1, 500,
"rifle", "fusion", 12, 0, 0, 0, 0, 0, 4, 0, 10, 0, 1, 500,
"");
// NAME RARE COLOR MAT1 MAT2
GUN("bio_lightning", "Chain Lightning", 0,0,c_magenta, "steel", "plastic",
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", "fusion", 12, 0, 0, 0, 0, 0, 4, 0, 10, 1, 10, 500,
"");
// Unarmed Styles
// TODO: refactor handling of styles see #1771
#define STYLE(id, name, dam, description, ...) \
itypes[id]=new it_style(id, 0, 0, name, description, '$', \
c_white, "null", "null", 0, 0, dam, 0, 0); \
@@ -641,73 +551,69 @@ attacks with no penalty.",
std::string ammo_name(ammotype t)
{
switch (t) {
case AT_NAIL: return "nails";
case AT_BB: return "BBs";
case AT_BOLT: return "bolts";
case AT_ARROW: return "arrows";
case AT_PEBBLE: return "pebbles";
case AT_SHOT: return "shot";
case AT_22: return ".22";
case AT_9MM: return "9mm";
case AT_762x25: return "7.62x25mm";
case AT_38: return ".38";
case AT_40: return ".40";
case AT_44: return ".44";
case AT_45: return ".45";
case AT_57: return "5.7mm";
case AT_46: return "4.6mm";
case AT_762: return "7.62x39mm";
case AT_223: return ".223";
case AT_3006: return ".30-06";
case AT_308: return ".308";
case AT_40MM: return "40mm grenade";
case AT_66MM: return "High Explosive Anti Tank Warhead";
case AT_GAS: return "gasoline";
case AT_THREAD: return "thread";
case AT_BATT: return "batteries";
case AT_PLUT: return "plutonium";
case AT_MUSCLE: return "Muscle";
case AT_FUSION: return "fusion cell";
case AT_12MM: return "12mm slugs";
case AT_PLASMA: return "hydrogen";
case AT_WATER: return "clean water";
default: return "XXX";
}
if( t == "nail") return "nails";
if( t == "BB" ) return "BBs";
if( t == "bolt" ) return "bolts";
if( t == "arrow" ) return "arrows";
if( t == "pebble" )return "pebbles";
if( t == "shot" ) return "shot";
if( t == "22" ) return ".22";
if( t == "9mm" ) return "9mm";
if( t == "762x25" )return "7.62x25mm";
if( t == "38" ) return ".38";
if( t == "40" ) return ".40";
if( t == "44" ) return ".44";
if( t == "45" ) return ".45";
if( t == "57" ) return "5.7mm";
if( t == "46" ) return "4.6mm";
if( t == "762" ) return "7.62x39mm";
if( t == "223" ) return ".223";
if( t == "3006" ) return ".30-06";
if( t == "308" ) return ".308";
if( t == "40mm" ) return "40mm grenade";
if( t == "66mm" ) return "High Explosive Anti Tank Warhead";
if( t == "gasoline" ) return "gasoline";
if( t == "THREAD" )return "thread";
if( t == "battery" ) return "batteries";
if( t == "plutonium" ) return "plutonium";
if( t == "muscle" )return "Muscle";
if( t == "fusion" )return "fusion cell";
if( t == "12mm" ) return "12mm slugs";
if( t == "plasma" )return "hydrogen";
if( t == "water" )return "clean water";
return "XXX";
}
itype_id default_ammo(ammotype guntype)
{
switch (guntype) {
case AT_NAIL: return "nail";
case AT_BB: return "bb";
case AT_BOLT: return "bolt_wood";
case AT_ARROW: return "arrow_wood";
case AT_PEBBLE:return "pebble";
case AT_SHOT: return "shot_00";
case AT_22: return "22_lr";
case AT_9MM: return "9mm";
case AT_762x25:return "762_25";
case AT_38: return "38_special";
case AT_40: return "10mm";
case AT_44: return "44magnum";
case AT_45: return "45_acp";
case AT_57: return "57mm";
case AT_46: return "46mm";
case AT_762: return "762_m43";
case AT_223: return "223";
case AT_308: return "308";
case AT_3006: return "270";
case AT_40MM: return "40mm_concussive";
case AT_66MM: return "66mm_HEAT";
case AT_BATT: return "battery";
case AT_FUSION:return "laser_pack";
case AT_12MM: return "12mm";
case AT_PLASMA:return "plasma";
case AT_PLUT: return "plut_cell";
case AT_GAS: return "gasoline";
case AT_THREAD:return "thread";
case AT_WATER:return "water_clean";
}
return "null";
if( guntype == "nail" ) return "nail";
if( guntype == "BB" ) return "bb";
if( guntype == "bolt" ) return "bolt_wood";
if( guntype == "arrow" ) return "arrow_wood";
if( guntype == "pebble" )return "pebble";
if( guntype == "shot" ) return "shot_00";
if( guntype == "22" ) return "22_lr";
if( guntype == "9mm" ) return "9mm";
if( guntype == "762x25" )return "762_25";
if( guntype == "38" ) return "38_special";
if( guntype == "40" ) return "10mm";
if( guntype == "44" ) return "44magnum";
if( guntype == "45" ) return "45_acp";
if( guntype == "57" ) return "57mm";
if( guntype == "46" ) return "46mm";
if( guntype == "762" ) return "762_m43";
if( guntype == "223" ) return "223";
if( guntype == "308" ) return "308";
if( guntype == "3006" ) return "270";
if( guntype == "40mm" ) return "40mm_concussive";
if( guntype == "66mm" ) return "66mm_HEAT";
if( guntype == "battery" ) return "battery";
if( guntype == "fusion" )return "laser_pack";
if( guntype == "12mm" ) return "12mm";
if( guntype == "plasma" )return "plasma";
if( guntype == "plutonium" ) return "plut_cell";
if( guntype == "gasoline" ) return "gasoline";
if( guntype == "THREAD" )return "thread";
if( guntype == "water" ) return "water_clean";
return "null";
}
+601 -497
View File
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -22,11 +22,7 @@ class iuse
void caff (game *g, player *p, item *it, bool t);
void alcohol (game *g, player *p, item *it, bool t);
void alcohol_weak (game *g, player *p, item *it, bool t);
void pkill_1 (game *g, player *p, item *it, bool t);
void pkill_2 (game *g, player *p, item *it, bool t);
void pkill_3 (game *g, player *p, item *it, bool t);
void pkill_4 (game *g, player *p, item *it, bool t);
void pkill_l (game *g, player *p, item *it, bool t);
void pkill (game *g, player *p, item *it, bool t);
void xanax (game *g, player *p, item *it, bool t);
void cig (game *g, player *p, item *it, bool t);
void antibiotic (game *g, player *p, item *it, bool t);
@@ -81,6 +77,7 @@ class iuse
void roadmap_a_target (game *g, player *p, item *it, bool t, int target);
void roadmap_targets(game *g, player *p, item *it, bool t, int target, int target_range, int distance, int reveal_distance);
void picklock (game *g, player *p, item *it, bool t);
void improvised_picklock (game *g, player *p, item *it, bool t);
void crowbar (game *g, player *p, item *it, bool t);
void makemound (game *g, player *p, item *it, bool t);
void dig (game *g, player *p, item *it, bool t);
@@ -129,6 +126,8 @@ class iuse
void turret (game *g, player *p, item *it, bool t);
void UPS_off (game *g, player *p, item *it, bool t);
void UPS_on (game *g, player *p, item *it, bool t);
void adv_UPS_off (game *g, player *p, item *it, bool t);
void adv_UPS_on (game *g, player *p, item *it, bool t);
void tazer (game *g, player *p, item *it, bool t);
void mp3 (game *g, player *p, item *it, bool t);
void mp3_on (game *g, player *p, item *it, bool t);
@@ -136,6 +135,7 @@ class iuse
void dog_whistle (game *g, player *p, item *it, bool t);
void vacutainer (game *g, player *p, item *it, bool t);
void knife (game *g, player *p, item *it, bool t);
static void cut_log_into_planks(game *g, player *p, item *it);
void lumber (game *g, player *p, item *it, bool t);
void hacksaw (game *g, player *p, item *it, bool t);
void tent (game *g, player *p, item *it, bool t);
@@ -156,6 +156,9 @@ class iuse
void dejar (game *g, player *p, item *it, bool t);
void devac (game *g, player *p, item *it, bool t);
void rad_badge (game *g, player *p, item *it, bool t);
void boots (game *g, player *p, item *it, bool t);
void towel (game *g, player *p, item *it, bool t);
void unfold_bicycle (game *g, player *p, item *it, bool t);
// MACGUFFINS
void mcg_note (game *g, player *p, item *it, bool t);
// ARTIFACTS
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env python
"Extract translatable strings from the .json files in data/raw."
from __future__ import print_function
import json
import os
# allow running from main directory, or from script subdirectory
if os.path.exists("data/raw"):
raw_folder = "data/raw"
to_folder = "lang/json"
elif os.path.exists("../data/raw"):
raw_folder = "../data/raw"
to_folder = "../lang/json"
else:
print("Error: Couldn't find the 'data/raw' subdirectory.")
exit(1)
def gettextify(string):
"Put the string in a fake gettext call, and add a newline."
return "_(%r)\n" % string
# create the output directory, if it does not already exist
if not os.path.exists(to_folder):
os.mkdir(to_folder)
# extract "name" and "description" fields from json to fake-python
def convert(infilename, outfile):
"open infilename, read data, write names and descriptions to outfile."
jsondata = json.loads(open(infilename).read())
names = [item["name"] for item in jsondata]
descriptions = [item["description"] for item in jsondata]
for n, d in zip(names, descriptions):
outfile.write(gettextify(n))
outfile.write(gettextify(d))
# data/raw/items/*
with open(os.path.join(to_folder,"json_items.py"), 'w') as items_jtl:
for filename in os.listdir(os.path.join(raw_folder,"items")):
jsonfile = os.path.join(raw_folder, "items", filename)
convert(jsonfile, items_jtl)
# data/raw/skills.json
with open(os.path.join(to_folder, "json_skills.py"), 'w') as skills_jtl:
jsonfile = os.path.join(raw_folder, "skills.json")
jsondata = json.loads(open(jsonfile).read())
names = [item[1] for item in jsondata]
descriptions = [item[2] for item in jsondata]
for n, d in zip(names, descriptions):
skills_jtl.write(gettextify(n))
skills_jtl.write(gettextify(d))
# data/raw/professions.json
with open(os.path.join(to_folder,"json_professions.py"), 'w') as prof_jtl:
prof_json = os.path.join(raw_folder, "professions.json")
convert(prof_json, prof_jtl)
# data/raw/bionics.json
with open(os.path.join(to_folder,"json_bionics.py"), 'w') as bio_jtl:
bio_json = os.path.join(raw_folder, "bionics.json")
convert(bio_json, bio_jtl)
+5
View File
@@ -0,0 +1,5 @@
# ignore everything in this directory
*
# except this file and the README
!.gitignore
!README
+5
View File
@@ -0,0 +1,5 @@
This directory is for storing translatable strings,
automatically generated from the .json files in data/raw.
Any files in here (other than this one) should not be edited by hand,
and should not be added to the git repository.
File diff suppressed because it is too large Load Diff
+9533
View File
File diff suppressed because it is too large Load Diff
+9533
View File
File diff suppressed because it is too large Load Diff
+9533
View File
File diff suppressed because it is too large Load Diff
+9534
View File
File diff suppressed because it is too large Load Diff
+9532
View File
File diff suppressed because it is too large Load Diff
+21 -6
View File
@@ -51,7 +51,7 @@ void map::generate_lightmap(game* g)
for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy) {
const ter_id terrain = g->m.ter(sx, sy);
const std::vector<item> &items = g->m.i_at(sx, sy);
const field &current_field = g->m.field_at(sx, sy);
field current_field = g->m.field_at(sx, sy);
// When underground natural_light is 0, if this changes we need to revisit
if (natural_light > LIGHT_AMBIENT_LOW) {
if (!g->m.is_outside(sx, sy)) {
@@ -88,12 +88,16 @@ void map::generate_lightmap(game* g)
if(terrain == t_emergency_light)
apply_light_source(sx, sy, 3, false);
field_entry *cur = NULL;
for(std::vector<field_entry*>::iterator field_list_it = current_field.getFieldStart(); field_list_it != current_field.getFieldEnd(); ++field_list_it){
cur = (*field_list_it);
if(cur == NULL) continue;
// TODO: [lightmap] Attach light brightness to fields
switch(current_field.type) {
switch(cur->getFieldType()) {
case fd_fire:
if (3 == current_field.density)
if (3 == cur->getFieldDensity())
apply_light_source(sx, sy, 160, trigdist);
else if (2 == current_field.density)
else if (2 == cur->getFieldDensity())
apply_light_source(sx, sy, 60, trigdist);
else
apply_light_source(sx, sy, 16, trigdist);
@@ -103,14 +107,15 @@ void map::generate_lightmap(game* g)
apply_light_source(sx, sy, 8, trigdist);
break;
case fd_electricity:
if (3 == current_field.density)
if (3 == cur->getFieldDensity())
apply_light_source(sx, sy, 8, trigdist);
else if (2 == current_field.density)
else if (2 == cur->getFieldDensity())
apply_light_source(sx, sy, 1, trigdist);
else
apply_light_source(sx, sy, LIGHT_SOURCE_LOCAL, trigdist); // kinda a hack as the square will still get marked
break;
}
}
}
}
@@ -172,6 +177,16 @@ void map::generate_lightmap(game* g)
}
}
}
for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx)
{
for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy)
{
if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15)
{
lm[sx][sy] = 0;
}
}
}
}
lit_level map::light_at(int dx, int dy)
+16 -2
View File
@@ -14,6 +14,14 @@
#include <sys/stat.h>
#include <cstdlib>
#include <signal.h>
#include <clocale>
#include <libintl.h>
#include "translations.h"
#if (defined OSX_SDL_FW)
#include "SDL.h"
#elif (defined OSX_SDL_LIBS)
#include "SDL/SDL.h"
#endif
void exit_handler(int s);
@@ -31,6 +39,12 @@ int main(int argc, char *argv[])
#endif
int seed = time(NULL);
// set locale to system default
setlocale(LC_ALL, "");
bindtextdomain("cataclysm-dda", "lang/mo");
bind_textdomain_codeset("cataclysm-dda", "UTF-8");
textdomain("cataclysm-dda");
//args: world seeding only.
argc--; argv++;
while (argc){
@@ -59,7 +73,7 @@ int main(int argc, char *argv[])
bool quit_game = false;
bool delete_world = false;
game *g = new game;
g = new game;
g->init_ui();
MAPBUFFER.set_game(g);
g->load_artifacts(); //artifacts have to be loaded before any items are created
@@ -100,7 +114,7 @@ void exit_handler(int s) {
bool bExit = false;
if (s == 2) {
if (query_yn("Really Quit? All unsaved changes will be lost.")) {
if (query_yn(_("Really Quit? All unsaved changes will be lost."))) {
bExit = true;
}
} else if (s == -999) {
+25 -22
View File
@@ -1,10 +1,11 @@
#include "game.h"
#include "input.h"
#include "keypress.h"
#include "debug.h"
#include "input.h"
#include "mapbuffer.h"
#include "cursesdef.h"
#include "overmapbuffer.h"
#include "translations.h"
#include <sys/stat.h>
#ifdef _MSC_VER
@@ -26,7 +27,7 @@ void game::print_menu(WINDOW* w_open, int iSel, const int iMenuOffsetX, int iMen
for (int i = 1; i < 79; i++)
mvwputch(w_open, 23, i, c_white, LINE_OXOX);
mvwprintz(w_open, 24, 5, c_red, "Please report bugs to TheDarklingWolf@gmail.com or post on the forums.");
mvwprintz(w_open, 24, 5, c_red, _("Please report bugs to kevin.granade@gmail.com or post on the forums."));
int iLine = 0;
const int iOffsetX1 = 3;
@@ -64,15 +65,15 @@ void game::print_menu(WINDOW* w_open, int iSel, const int iMenuOffsetX, int iMen
}
std::vector<std::string> vMenuItems;
vMenuItems.push_back("MOTD");
vMenuItems.push_back("New Game");
vMenuItems.push_back("Load");
vMenuItems.push_back("Reset");
vMenuItems.push_back("Special");
vMenuItems.push_back("Options");
vMenuItems.push_back("Help");
vMenuItems.push_back("Credits");
vMenuItems.push_back("Quit");
vMenuItems.push_back(_("MOTD"));
vMenuItems.push_back(_("New Game"));
vMenuItems.push_back(_("Load"));
vMenuItems.push_back(_("Reset"));
vMenuItems.push_back(_("Special"));
vMenuItems.push_back(_("Options"));
vMenuItems.push_back(_("Help"));
vMenuItems.push_back(_("Credits"));
vMenuItems.push_back(_("Quit"));
print_menu_items(w_open, vMenuItems, iSel, iMenuOffsetY, iMenuOffsetX);
@@ -104,14 +105,16 @@ bool game::opening_screen()
werase(w_background);
wrefresh(w_background);
WINDOW* w_open = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
WINDOW* w_open = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH,
(TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0,
(TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
const int iMenuOffsetX = 2;
int iMenuOffsetY = 22;
int iMenuOffsetY = FULL_SCREEN_HEIGHT-3;
std::vector<std::string> vSubItems;
vSubItems.push_back("Custom Character");
vSubItems.push_back("Preset Character");
vSubItems.push_back("Random Character");
vSubItems.push_back(_("Custom Character"));
vSubItems.push_back(_("Preset Character"));
vSubItems.push_back(_("Random Character"));
print_menu(w_open, 0, iMenuOffsetX, iMenuOffsetY);
@@ -155,7 +158,7 @@ bool game::opening_screen()
std::ifstream motd_file;
motd_file.open("data/motd");
if (!motd_file.is_open())
motd.push_back("No message today.");
motd.push_back(_("No message today."));
else {
while (!motd_file.eof()) {
std::string tmp;
@@ -170,7 +173,7 @@ bool game::opening_screen()
std::ifstream credits_file;
credits_file.open("data/credits");
if (!credits_file.is_open())
credits.push_back("No message today.");
credits.push_back(_("No message today."));
else {
while (!credits_file.eof()) {
std::string tmp;
@@ -218,7 +221,7 @@ bool game::opening_screen()
} else if (chInput == 'o' || chInput == 'O') {
sel1 = 5;
chInput = '\n';
} else if (chInput == 'H') {
} else if (chInput == 'H' || chInput == '?') {
sel1 = 6;
chInput = '\n';
} else if (chInput == 'c' || chInput == 'C') {
@@ -305,7 +308,7 @@ bool game::opening_screen()
}
} else if (sel1 == 2) { // Load Character
if (savegames.size() == 0)
mvwprintz(w_open, iMenuOffsetY - 2, 19 + iMenuOffsetX, c_red, "No save games found!");
mvwprintz(w_open, iMenuOffsetY - 2, 19 + iMenuOffsetX, c_red, _("No save games found!"));
else {
for (int i = 0; i < savegames.size(); i++) {
int line = iMenuOffsetY - 2 - i;
@@ -339,7 +342,7 @@ bool game::opening_screen()
}
}
} else if (sel1 == 3) { // Delete world
if (query_yn("Delete the world and all saves?")) {
if (query_yn(_("Delete the world and all saves?"))) {
delete_save();
savegames.clear();
MAPBUFFER.reset();
@@ -386,7 +389,7 @@ bool game::opening_screen()
}
} else if (layer == 3) { // Character Templates
if (templates.size() == 0)
mvwprintz(w_open, iMenuOffsetY-4, iMenuOffsetX+27, c_red, "No templates found!");
mvwprintz(w_open, iMenuOffsetY-4, iMenuOffsetX+27, c_red, _("No templates found!"));
else {
for (int i = 0; i < templates.size(); i++) {
int line = iMenuOffsetY - 4 - i;
+424 -346
View File
File diff suppressed because it is too large Load Diff
+78 -12
View File
@@ -39,14 +39,73 @@ struct wrapped_vehicle{
typedef std::vector<wrapped_vehicle> VehicleList;
// translate game.levx/y + game->object.posx/y to submap and submap row/col, and deal with !INBOUND correctly
// usage: rc real_coords( levx, levy, g->u.posx, g->u.posy );
// popup("I'm on submap %d, %d, row %d, column %d.", rc.sub.x, rc.sub.y, rc.sub_pos.x, rc.sub_pos.y );
//
// point rcom=rc.overmap(); point gom=g->om_location();
// popup("Oh, and this is really overmap %d,%d, but everything uses %d,%d anyway.",
// rcom.x, rcom.y, gom.x, gom.y );
//
// real_coords( lx, ly, px, py, true ); // will precalculate overmap as .true_om (point)
//
struct real_coords {
point rel_lev; // in: as in game.levx/y. The true coordinate of submap at pos 0,0 in playing area
// (Which is a 11x11 grid of submaps that shifts to ensure player remains in
// the center submap.)
point rel_pos; // in: as in game->object.posx/y; Tile offset from position 0,0 of
// game.levx/y (submap 0,0 of playing area, aka rel_lev)
point sub; // out: 'real' levxy; actual submap coordinate (maps.txt: first line of record)
point sub_pos; // out: coordinate (0-11) in submap (maps.txt: xy of tile definitions, items, traps,
// spawns)
point true_om; // >>>> must initialize with getom=true or use initialized_real_coords.overmap() <<<<
// >>>> this does not handle overmap boundaries yet, check for < 0 || >= OMAPX (180) <<<<
// this is the actual overmap tile of sub.x, sub.y (unlike what game->om_location
// returns; the overmap tile of levx/y aka rel_lev. Most game functions are written
// for the latter.);
real_coords(int lx, int ly, int px, int py, bool getom=false ) {
rel_lev.x=lx;
rel_lev.y=ly;
rel_pos.x=px;
rel_pos.y=py;
sub.x = lx + ( px / SEEX );
sub.y = ly + ( py / SEEX );
sub_pos.x = px % SEEX;
sub_pos.y = py % SEEY;
/* deal with !INBOUND (negative) coordinates.
if ( px < 0 ) { sub.x += -1; sub_pos.x += 12; };
in -some- cases (?) this isn't enough and must be
redone @ pos=-24, -48, -96 ....
*/
while( sub_pos.x < 0 ) {
sub.x--;
sub_pos.x += 12;
}
while( sub_pos.y < 0 ) {
sub.y--;
sub_pos.y += 12;
}
if ( getom == true ) { // special case, thus optional
true_om.x=int( (sub.x + int(MAPSIZE / 2)) / 2);
true_om.y=int( (sub.y + int(MAPSIZE / 2)) / 2);
}
};
point overmap () {
true_om.x=int( (sub.x + int(MAPSIZE / 2)) / 2);
true_om.y=int( (sub.y + int(MAPSIZE / 2)) / 2);
return true_om;
};
};
class map
{
public:
// Constructors & Initialization
map();
map(std::map<std::string, itype*>* itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
map(std::vector<trap*> *trptr);
~map();
// Visual Output
@@ -68,7 +127,7 @@ class map
// Cost to move through; 0 = impassible, 1 = 50 moves, 2 = 100 etc
int move_cost(const int x, const int y);
// Same as above, but don't take vehicles into account
int move_cost_ter_only(const int x, const int y);
int move_cost_ter_furn(const int x, const int y);
// Cost to move out of one tile and into the next,
// returns player/monster moves (50, 75, 100, etc), unlike move_cost
int combined_movecost(const int x1, const int y1, const int x2, const int y2);
@@ -111,15 +170,23 @@ class map
// move water under wheels. true if moved
bool displace_water (const int x, const int y);
// Furniture
void set(const int x, const int y, const ter_id new_terrain, const furn_id new_furniture);
std::string name(const int x, const int y);
bool has_furn(const int x, const int y);
furn_id furn(const int x, const int y); // Furniture at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
void furn_set(const int x, const int y, const furn_id new_furniture);
std::string furnname(const int x, const int y);
// Terrain
ter_id ter(const int x, const int y) const; // Terrain at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
void ter_set(const int x, const int y, const ter_id new_terrain);
std::string tername(const int x, const int y) const; // Name of terrain at (x, y)
std::string features(const int x, const int y); // Words relevant to terrain (sharp, etc)
bool has_flag(const t_flag flag, const int x, const int y); // checks terrain and vehicles
bool has_flag_ter_only(const t_flag flag, const int x, const int y) const; // only checks terrain
bool has_flag(const t_flag flag, const int x, const int y); // checks terrain, furniture and vehicles
bool has_flag_ter_or_furn(const t_flag flag, const int x, const int y); // checks terrain or furniture
bool has_flag_ter_and_furn(const t_flag flag, const int x, const int y); // checks terrain and furniture
bool is_destructable(const int x, const int y); // checks terrain and vehicles
bool is_destructable_ter_only(const int x, const int y); // only checks terrain
bool is_destructable_ter_furn(const int x, const int y); // only checks terrain
bool is_outside(const int x, const int y);
bool flammable_items_at(const int x, const int y);
bool moppable_items_at(const int x, const int y);
@@ -132,7 +199,8 @@ class map
// bash: if res pointer is supplied, res will contain absorbed impact or -1
bool bash(const int x, const int y, const int str, std::string &sound, int *res = 0);
void destroy(game *g, const int x, const int y, const bool makesound);
void shoot(game *g, const int x, const int y, int &dam, const bool hit_items, const unsigned flags);
void shoot(game *g, const int x, const int y, int &dam, const bool hit_items,
const std::set<std::string>& ammo_effects);
bool hit_with_acid(game *g, const int x, const int y);
bool hit_with_fire(game *g, const int x, const int y);
void marlossify(const int x, const int y);
@@ -173,7 +241,7 @@ class map
// Fields
field& field_at(const int x, const int y);
bool add_field(game *g, const int x, const int y, const field_id t, const unsigned char density);
void remove_field(const int x, const int y);
void remove_field(const int x, const int y, const field_id field_to_remove);
bool process_fields(game *g); // See fields.cpp
bool process_fields_in_submap(game *g, const int gridn); // See fields.cpp
void step_in_field(const int x, const int y, game *g); // See fields.cpp
@@ -197,6 +265,7 @@ class map
void post_process(game *g, unsigned zones);
void place_spawns(game *g, std::string group, const int chance,
const int x1, const int y1, const int x2, const int y2, const float density);
void place_gas_pump(const int x, const int y, const int charges);
int place_items(items_location loc, const int chance, const int x1, const int y1,
const int x2, const int y2, bool ongrass, const int turn);
// put_items_from puts exactly num items, based on chances
@@ -217,7 +286,6 @@ class map
float ambient_light_at(int dx, int dy); // Raw values for tilesets
bool pl_sees(int fx, int fy, int tx, int ty, int max_range);
std::map<std::string, itype*>* itypes;
std::set<vehicle*> vehicle_list;
std::map< std::pair<int,int>, std::pair<vehicle*,int> > veh_cached_parts;
bool veh_exists_at [SEEX * MAPSIZE][SEEY * MAPSIZE];
@@ -251,7 +319,6 @@ protected:
int nulrad; // OOB &radiation()
std::vector <trap*> *traps;
std::vector <itype_id> (*mapitems)[num_itloc];
bool veh_in_active_range;
@@ -276,8 +343,7 @@ class tinymap : public map
{
public:
tinymap();
tinymap(std::map<std::string, itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
tinymap(std::vector<trap*> *trptr);
~tinymap();
protected:
+25 -8
View File
@@ -113,6 +113,14 @@ void mapbuffer::save()
}
fout << std::endl;
// Furniture
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
if (sm->frn[i][j] != f_null)
fout << "f " << i << " " << j << " " << sm->frn[i][j] <<
std::endl;
}
}
// Items section; designate it with an I. Then check itm[][] for each square
// in the grid and print the coords and the item's details.
// Designate it with a C if it's contained in the prior item.
@@ -140,13 +148,17 @@ void mapbuffer::save()
}
// Output the fields
field tmpf;
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
tmpf = sm->fld[i][j];
if (tmpf.type != fd_null)
fout << "F " << i << " " << j << " " << int(tmpf.type) << " " <<
int(tmpf.density) << " " << tmpf.age << std::endl;
if (sm->fld[i][j].fieldCount() > 0){
for(std::vector<field_entry*>::iterator it = sm->fld[i][j].getFieldStart();
it != sm->fld[i][j].getFieldEnd(); ++it){
if((*it) != NULL){
fout << "F " << i << " " << j << " " << int((*it)->getFieldType()) << " " <<
int((*it)->getFieldDensity()) << " " << (*it)->getFieldAge() << std::endl;
}
}
}
}
}
// Output the spawn points
@@ -220,9 +232,10 @@ void mapbuffer::load()
int tmpter;
fin >> tmpter;
sm->ter[i][j] = ter_id(tmpter);
sm->frn[i][j] = f_null;
sm->itm[i][j].clear();
sm->trp[i][j] = tr_null;
sm->fld[i][j] = field();
//sm->fld[i][j] = field(); //not needed now
sm->graf[i][j] = graffiti();
}
}
@@ -261,10 +274,14 @@ void mapbuffer::load()
} else if (string_identifier == "T") {
fin >> itx >> ity >> t;
sm->trp[itx][ity] = trap_id(t);
} else if (string_identifier == "f") {
fin >> itx >> ity >> t;
sm->frn[itx][ity] = furn_id(t);
} else if (string_identifier == "F") {
fin >> itx >> ity >> t >> d >> a;
sm->fld[itx][ity] = field(field_id(t), d, a);
sm->field_count++;
if(!sm->fld[itx][ity].findField(field_id(t)))
sm->field_count++;
sm->fld[itx][ity].addField(field_id(t), d, a);
} else if (string_identifier == "S") {
char tmpfriend;
int tmpfac = -1, tmpmis = -1;
+408 -489
View File
File diff suppressed because it is too large Load Diff
+2250 -2296
View File
File diff suppressed because it is too large Load Diff
+43 -1
View File
@@ -13,6 +13,48 @@
namespace mapf
{
void formatted_set_simple(map* m, const int startx, const int starty, const char* cstr,
internal::format_effect* ter_b, internal::format_effect* furn_b)
{
internal::format_data tdata;
internal::format_data fdata;
ter_b->execute(tdata);
furn_b->execute(fdata);
if (tdata.bindings.find(' ') == tdata.bindings.end())
tdata.bindings[' '] = new internal::statically_determine_terrain();
if (fdata.bindings.find(' ') == fdata.bindings.end())
fdata.bindings[' '] = new internal::statically_determine_terrain();
const char* p = cstr;
int x = startx;
int y = starty;
while (*p != 0) {
if (*p == '\n') {
y++;
x = startx;
}
else {
if (tdata.bindings.find(*p) == tdata.bindings.end())
tdata.bindings[*p] = new internal::statically_determine_terrain();
if (fdata.bindings.find(*p) == fdata.bindings.end())
fdata.bindings[*p] = new internal::statically_determine_terrain();
ter_id ter = (ter_id)(*tdata.bindings[*p])(m, x, y);
furn_id furn = (furn_id)(*fdata.bindings[*p])(m, x, y);
if (ter != t_null)
m->ter_set(x, y, ter);
if (furn != f_null)
m->furn_set(x, y, furn);
x++;
}
p++;
}
for(std::map<char, internal::determine_terrain*>::iterator it = fdata.bindings.begin(); it != fdata.bindings.end(); ++it)
{
delete it->second;
}
}
void formatted_set_terrain(map* m, const int startx, const int starty, const char* cstr, ...)
{
internal::format_data fdata;
@@ -44,7 +86,7 @@ void formatted_set_terrain(map* m, const int startx, const int starty, const cha
debugmsg("No binding for \'%c.\'", *p);
fdata.bindings[*p] = new internal::statically_determine_terrain();
}
ter_id id = (*fdata.bindings[*p])(m, x, y);
ter_id id = (ter_id)(*fdata.bindings[*p])(m, x, y);
if(id != t_null)
m->ter_set(x, y, id);
x++;
+9 -7
View File
@@ -19,6 +19,8 @@ namespace mapf
* You will have specify the values you want to track with a parameter.
*/
void formatted_set_terrain(map* m, const int startx, const int starty, const char* cstr, ...);
void formatted_set_simple(map* m, const int startx, const int starty, const char* cstr,
internal::format_effect* ter_b, internal::format_effect* furn_b);
internal::format_effect* basic_bind(std::string characters, ...);
internal::format_effect* simple_method_bind(std::string characters, ...);
@@ -51,18 +53,18 @@ namespace internal
{
public:
virtual ~determine_terrain() {}
virtual ter_id operator ()(map* m, const int x, const int y) = 0;
virtual int operator ()(map* m, const int x, const int y) = 0;
};
class statically_determine_terrain : public determine_terrain
{
private:
ter_id id;
int id;
public:
statically_determine_terrain():id(t_null) {}
statically_determine_terrain(ter_id pid):id(pid) {}
statically_determine_terrain():id(0) {}
statically_determine_terrain(int pid):id(pid) {}
virtual ~statically_determine_terrain() {}
virtual ter_id operator ()(map* m, const int x, const int y){return id;}
virtual int operator ()(map* m, const int x, const int y){return id;}
};
class determine_terrain_with_simple_method : public determine_terrain
@@ -75,7 +77,7 @@ namespace internal
determine_terrain_with_simple_method():f(NULL) {}
determine_terrain_with_simple_method(ter_id_func pf):f(pf) {}
virtual ~determine_terrain_with_simple_method() {}
virtual ter_id operator ()(map* m, const int x, const int y){return f();}
virtual int operator ()(map* m, const int x, const int y){return f();}
};
//TODO: make use of this
@@ -87,7 +89,7 @@ namespace internal
determine_terrain_with_complex_method():f(NULL) {}
determine_terrain_with_complex_method(ter_id (*pf)(map*, const int, const int)):f(pf) {}
virtual ~determine_terrain_with_complex_method() {}
virtual ter_id operator ()(map* m, const int x, const int y){return f(m,x,y);}
virtual int operator ()(map* m, const int x, const int y){return f(m,x,y);}
};
+4 -56
View File
@@ -1,61 +1,9 @@
#ifndef _MAPITEMS_H_
#define _MAPITEMS_H_
enum items_location {
mi_none, mi_child_items,
mi_field, mi_forest, mi_hive, mi_hive_center,
mi_road,
mi_livingroom, mi_kitchen, mi_knifeblock, mi_fridge, mi_home_hw, mi_bedroom, mi_homeguns,
mi_dresser, mi_dining,
mi_snacks, mi_fridgesnacks, mi_fast_food,
mi_coffee_shop, mi_behindcounter, mi_magazines,
mi_softdrugs, mi_harddrugs,
mi_cannedfood, mi_pasta, mi_produce,
mi_cleaning,
mi_hardware, mi_tools, mi_bigtools, mi_mischw,
mi_consumer_electronics,
mi_sports, mi_camping, mi_allsporting,
mi_alcohol,
mi_pool_table,
mi_trash,
mi_ammo, mi_pistols, mi_shotguns, mi_rifles, mi_smg, mi_assault, mi_allguns,
mi_gunxtras,
mi_shoes, mi_pants, mi_shirts, mi_jackets, mi_winter, mi_bags, mi_allclothes,
mi_novels, mi_manuals, mi_textbooks,
mi_cop_shoes, mi_cop_torso, mi_cop_pants, mi_cop_weapons, mi_cop_evidence,
mi_lab_shoes, mi_lab_torso, mi_lab_pants,
mi_hospital_lab, mi_hospital_samples, mi_surgery,
mi_office, mi_cubical_office, mi_school, mi_church, mi_vault,
mi_medieval, mi_art, mi_pawn, mi_mil_surplus,
mi_shelter, mi_mechanics,
mi_chemistry, mi_teleport, mi_goo, mi_cloning_vat, mi_dissection,
mi_hydro, mi_electronics, mi_monparts, mi_bionics, mi_bionics_common,
mi_bots, mi_launchers, mi_mil_rifles, mi_grenades, mi_mil_armor,
mi_mil_accessories, mi_mil_armor_torso, mi_mil_armor_helmet, mi_mil_armor_pants,
mi_mil_food,
mi_mil_food_nodrugs, mi_bionics_mil,
mi_weapons, mi_survival_armor, mi_survival_tools,
mi_sewage_plant,
mi_construction_worker,
mi_mine_storage, mi_mine_equipment,
mi_spiral,
mi_radio,
mi_toxic_dump_equipment,
mi_subway, mi_sewer,
mi_cavern,
mi_spider,
mi_ant_food, mi_ant_egg,
// Monster drops
mi_biollante, mi_bugs, mi_bees, mi_wasps, mi_robots, mi_eyebot,
mi_manhack, mi_skitterbot, mi_secubot, mi_copbot, mi_molebot,
mi_tripod, mi_chickenbot, mi_tankbot, mi_turret,
// Map Extras
mi_helicopter, mi_military, mi_science, mi_rare, mi_stash_food, mi_stash_ammo,
mi_stash_wood, mi_stash_drugs, mi_drugdealer, mi_wreckage,
// Shopkeeps &c
mi_npc_hacker,
mi_trader_avoid,
num_itloc
};
typedef std::string items_location;
static const int num_itloc = 0;
// This is used only for monsters; they get a list of items_locations, and
// a chance that each one will be used.
-1026
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More