Compare commits

..

420 Commits

Author SHA1 Message Date
TheDarklingWolf 0437a6a1da Update Changelog 2013-04-07 21:11:02 +01:00
TheDarklingWolf 8ffd80bc3c Fix an issue in iexamine.cpp 2013-04-07 21:06:18 +01:00
TheDarklingWolf 8161d5e05c Remove iexamine::tent from canvas walls. 2013-04-07 19:31:50 +01:00
TheDarklingWolf 0d0c76ddc1 Fix non fittable clothing not being possible to reinforce. 2013-04-07 18:46:14 +01:00
TheDarklingWolf 78f5684d99 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-07 13:25:07 +01:00
TheDarklingWolf 3b29b27771 Added option to wish for an item in its container to the wish menu. Thanks to jwo(lotsofsevens) for the idea. Closes #415 2013-04-07 13:23:19 +01:00
Kevin Granade db84695991 Set vehicle interiours to inside, not outside. 2013-04-07 00:00:15 -05:00
Kevin Granade de34f5b77c Rebuild map cache after a map update. 2013-04-06 23:59:45 -05:00
Kevin Granade 696a172d0a Make ammunition explode instead of merely burning. 2013-04-06 23:59:16 -05:00
Kevin Granade a639ccbe28 Merge remote-tracking branch 'dda/pr/406' into dda-master 2013-04-06 21:11:32 -05:00
Kyratzes Talvadore 787201a31e Merge pull request #411 from Voker57/tweaks
Make Aero-evaporator produce 'clean water' (instead of clean 'water')
2013-04-06 11:31:43 -07:00
TheDarklingWolf ff56b067c4 Chitinous guantlets are no longer hats. Closes #413 2013-04-06 19:30:45 +01:00
Voker57 d93650de66 Make Aero-evaporator produce 'clean water' (instead of clean 'water') 2013-04-06 20:25:19 +04:00
TheDarklingWolf 1ca87176c4 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-06 12:50:01 +01:00
TheDarklingWolf a82df535fa Fitted clothing can be reinforced. Closes #410 2013-04-06 12:48:26 +01:00
aspolito 01b7ecc18b use_if_avail 2013-04-05 21:30:35 -07:00
Kevin Granade 197e609124 Perform correct inventory bounds checking. 2013-04-05 22:29:09 -05:00
Kevin Granade 545dc8bbbc Merge pull request #404 from ethankaminski/elec-crafts
Add lightstrip and noise emitter (new electronics crafts)
2013-04-05 19:58:30 -07:00
Kevin Granade 01da9c940f Merge pull request #405 from ethankaminski/shocker-drop-fix
Fix shocker drops, rename Internal Battery to Power Storage
2013-04-05 18:57:46 -07:00
ethankaminski 817344154c Fix shocker drops, rename Internal Battery to Power Storage
So, apparently shocker zombies were supposed to drop CBMs that boost internal power storage. Making reality line up with intention :).

Also, why do we have bio_battery and bio_batteries? Renaming the former to bio_power_storage.
2013-04-06 14:33:39 +13:00
Kevin Granade 1c558a9c0d Remove ~ from list of inventory keys as it's not readily available on spanish keyboards. 2013-04-05 20:01:12 -05:00
ethankaminski e95c9aa28d Add lightstrips as a 0-level electronics craft
Meant to last for about 5 days on 15 charges of batteries, and provide 1 light. Not able to be deactivated, but can be disassembled once dead.
2013-04-06 13:59:49 +13:00
Kevin Granade 62737a7950 Adjust help test on guns to include firing modes. 2013-04-05 19:43:50 -05:00
Kevin Granade 43693bbae7 Disassemble some obsolete caching code, slight performance increase. 2013-04-05 18:35:37 -05:00
Kevin Granade baf791b5d3 Fix up ordering of body parts in character screen. 2013-04-05 17:56:49 -05:00
Kevin Granade cd615422bb Merge remote-tracking branch 'dda/pr/402' into fix-history 2013-04-05 17:36:28 -05:00
Kevin Granade cae16d32b1 Return a copy of a ter_id instead of a reference to avoid crashing. 2013-04-05 17:21:06 -05:00
ethankaminski 95620911c0 Add noise emitter as a new electronics craft
Noise emitter: meant to draw zombies to a given location. Uses 1 battery/turn.
2013-04-06 11:07:07 +13:00
ethankaminski 40d9591981 Fix up ordering of body parts in character screen 2013-04-06 10:37:50 +13:00
ethankaminski d7bf561fad Fix tab display after starting a new preset/random character 2013-04-06 10:21:55 +13:00
TheDarklingWolf acb0fa8425 Clothing can now be made fitted using a sewing kit. 2013-04-05 17:36:38 +01:00
TheDarklingWolf c9aca9e2dc Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-05 17:24:08 +01:00
TheDarklingWolf 2d8e2a2088 Bandages & First aid no longer display uninjured body parts (This is purely visual, still WIP) 2013-04-05 17:23:41 +01:00
Kyratzes Talvadore 2e5906ef0c Merge pull request #399 from origamiwolf/CDDA-itemflag
Using IF_VARSIZE and IF_FIT flags to generate fitted clothing
2013-04-05 09:23:27 -07:00
origamiwolf 6cbf21e7fe Item description shows clothing fit status 2013-04-05 23:37:12 +08:00
origamiwolf a6dbb75cce Crafted clothing comes fitted 2013-04-05 23:37:08 +08:00
origamiwolf 4cc6ae7edd Remove fitted items, added IF_VARSIZE flags to fittable clothing
Updated to new profession code.
2013-04-05 23:37:02 +08:00
origamiwolf 0979d8c71e Use IF_FIT flag to determine encumbrance reductions 2013-04-05 23:36:57 +08:00
origamiwolf 57868c74bc Added random fitted clothing generation in add_item 2013-04-05 23:36:52 +08:00
origamiwolf a3abd5bcc6 Added flags for sized and fitted clothing 2013-04-05 23:36:48 +08:00
Kevin Granade 00cdb03cea Final cleanup after rewriting history to remove erronaeous merge of mass-update of code style. 2013-04-05 08:46:14 -05:00
ethankaminski 4d1bba8bbe Re-add pocket knife and matches as all-profession starter gear 2013-04-05 08:43:32 -05:00
Matthew Ammann c733e4b9af Spelling and grammar fixes in item descriptions 2013-04-05 08:41:29 -05:00
jason.gilbert@nbed.nb.ca 9e47869388 Added messages to main screen about cold body parts
Conflicts:

	player.cpp
2013-04-05 08:37:36 -05:00
jason.gilbert@nbed.nb.ca cf96d030a9 Updated cold messages 2013-04-05 08:35:46 -05:00
jason.gilbert@nbed.nb.ca ece990ec01 Update changelog
Conflicts:

	data/changelog.txt
2013-04-05 08:35:19 -05:00
ethankaminski c533fcf832 Fix indent/missing brace issue. 2013-04-05 08:34:11 -05:00
ethankaminski 07b34d7ef2 Make the large new function conform to indent style 2013-04-05 08:34:11 -05:00
ethankaminski 82e243c07f Make new files conform to indentation standard 2013-04-05 08:34:11 -05:00
jason.gilbert@nbed.nb.ca 7daae41cf4 Added detail and polish to the warmth colors in the @ menu 2013-04-05 08:34:11 -05:00
jason.gilbert@nbed.nb.ca 9d6d2f24c4 Uncommented body equalization code 2013-04-05 08:34:11 -05:00
jason.gilbert@nbed.nb.ca 5656841982 Fixed blood loss code
Conflicts:

	player.cpp
2013-04-05 08:33:46 -05:00
ethankaminski c76a403b55 Actually check that we've got the points for our profession 2013-04-05 08:33:00 -05:00
ethankaminski 5c112e1480 Give the player an ordered profession list during chargen 2013-04-05 08:33:00 -05:00
ethankaminski 17ae49dd4a Make removing professions emit a warning, not crash 2013-04-05 08:33:00 -05:00
ethankaminski 7d9689028f Actually give mechanic profession books. Also, bump it to 2 points.
Conflicts:

	data/raw/professions.json
2013-04-05 08:32:46 -05:00
ethankaminski a339407086 Add professions to character creation, affecting starter gear
Profession code based in part on skill code. Breaks save files and templates, but as currently written, adding new professions does not break compatibility.

Also add 4 sample professions: Unemployed (unchanged from current), Lab Technician (starts with labwear), Nudist (starts with nothing, -1 point cost), Wannabe Mechanic (starts with toolbelt, wrench, some books).

Conflicts:

	data/raw/professions.json
	newcharacter.cpp
2013-04-05 08:30:51 -05:00
Shoes01 ad3de43e6a Added cold mouth and hot mouth DIs 2013-04-05 08:28:15 -05:00
jason.gilbert@nbed.nb.ca ece782625a Init'd temp_conv, and removed blood loss (not working) 2013-04-05 08:28:15 -05:00
jason.gilbert@nbed.nb.ca 2f8d827c8e Update changelog
Conflicts:

	data/changelog.txt
2013-04-05 08:27:55 -05:00
jason.gilbert@nbed.nb.ca 4b46b78be8 Minor frostbite fix regarding pain 2013-04-05 08:27:18 -05:00
jason.gilbert@nbed.nb.ca f56ae59586 Encum screen now colors warmth values for body parts if they are adequate 2013-04-05 08:27:18 -05:00
jason.gilbert@nbed.nb.ca 1d8805f3fa Remaining hp affects body temp. Fixed bio_climate name 2013-04-05 08:27:18 -05:00
jason.gilbert@nbed.nb.ca 5bfa00de3f Fixed body temp not warming up. Cleaned up.
Conflicts:

	data/changelog.txt
2013-04-05 08:26:58 -05:00
jason.gilbert@nbed.nb.ca 9c5677b5f5 Fixed body temperature equalization, cleaned up code 2013-04-05 08:23:58 -05:00
jason.gilbert@nbed.nb.ca 2bb67b30a6 Rate of heat loss increases for torso/head, and if in water/sewage 2013-04-05 08:23:58 -05:00
jason.gilbert@nbed.nb.ca b2c9ec1577 Bodyheat now tied to hp 2013-04-05 08:23:58 -05:00
jason.gilbert@nbed.nb.ca 65bb5e001e WIP bodytemp equalization
Conflicts:

	player.cpp
2013-04-05 08:23:43 -05:00
jason.gilbert@nbed.nb.ca 85b1ebc033 Commented out body temperature equalization code; it was not working correctly 2013-04-05 08:21:50 -05:00
Shoes01 e7183e60a4 Common cold now lowers body temperature 2013-04-05 08:21:50 -05:00
Shoes01 a368fefb0f Update changelog
Conflicts:

	data/changelog.txt
2013-04-05 08:21:38 -05:00
Kevin Granade 2041eee0a9 Indention foxups in construction recipes. 2013-04-04 23:55:39 -05:00
Kevin Granade 307db0d9e0 Allow finishing a window from any stage of construction. Thanks Vexification for reporting. 2013-04-04 23:55:39 -05:00
Kevin Granade d5883b5fb1 Convert writing accesses to map terain to use the new ter_set() method. 2013-04-04 23:55:39 -05:00
Kevin Granade 6a75336347 The payoff, qualify map::ter() as fully const. 2013-04-04 23:55:38 -05:00
Kevin Granade d3f0d9e289 Add write accessor to set terrain values. 2013-04-04 23:55:38 -05:00
jason.gilbert@nbed.nb.ca 8340844cd8 Reduced GUI clutter from bodytemp info
Conflicts:

	player.cpp
2013-04-04 23:55:14 -05:00
ethankaminski 2a0dfe1868 Remove nudist profession - was mostly an example of negative point value 2013-04-04 23:53:13 -05:00
ethankaminski 22d20a9cf8 Add Chain Smoker profession, and let professions give addictions
Conflicts:

	newcharacter.cpp
2013-04-04 23:52:49 -05:00
ethankaminski 483e0ff312 Re-add pocket knife and matches as all-profession starter gear
Conflicts:

	data/raw/professions.json
	newcharacter.cpp
2013-04-04 23:50:29 -05:00
Voker57 1f58f281c5 Fixed too complex books being possible even when depressed 2013-04-04 23:49:04 -05:00
Voker57 49f5e895ed Additional heat sources for javelins 2013-04-04 23:49:04 -05:00
Voker57 03ee927084 Added thread to wooden javelin recipe 2013-04-04 23:49:04 -05:00
Voker57 46831513b5 Typo fix 2013-04-04 23:49:04 -05:00
TheDarklingWolf 9262b40ae4 Added fences to iuse::hammer. Updated style. 2013-04-04 23:49:04 -05:00
TheDarklingWolf e4bc1b7c57 Made copbots blue. 2013-04-04 23:49:04 -05:00
TheDarklingWolf 6be0f9009e Added welding goggles to various recipes which require a welder. 2013-04-04 23:49:04 -05:00
TheDarklingWolf eff3d172ad Small typo fix in welding goggles. Added welding goggles to mechanics mapitem definition. 2013-04-04 23:49:04 -05:00
TheDarklingWolf 6c7d45cc16 You can no longer cauterize yourself if you are not bleeding or bitten. 2013-04-04 23:49:04 -05:00
Kyratzes Talvadore 5fd829aa52 Corrected readme email 2013-04-04 16:15:15 +02:00
Kyratzes Talvadore d5f89e5dc7 Merge pull request #379 from origamiwolf/CDDA
Fix container unloading.
2013-04-04 07:13:35 -07:00
TheDarklingWolf 504403e0ce Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-04 15:09:52 +01:00
origamiwolf 90fc36b064 Fix container unloading. 2013-04-04 22:09:34 +08:00
TheDarklingWolf 49dc432d8f Fixed cutting rags/string in scissors and knives.
Made skewers 0 weight, increased amount generated by cutting wood with a knife.
Cutting wood with a knife no longer generates a splinter.
Reformatted iuse::scissors and iuse::knife as per style changes.
Modified CataclysmWin.cbp to output executable into project directory.
2013-04-04 15:06:22 +01:00
Kyratzes Talvadore 3e2e6fe7f8 Merge pull request #372 from ethankaminski/reload-fix
Make multiple types of ammo stop freaking out item examination
2013-04-04 05:12:16 -07:00
Kyratzes Talvadore 82fb42c93c Merge pull request #374 from ethankaminski/labcomputer-fix
Add missing numeric value to print statement of lab computers
2013-04-04 05:10:50 -07:00
ethankaminski 7113766aa4 Add missing numeric value to print statement 2013-04-04 17:39:57 +13:00
Kevin Granade b67916f9cd Default to warnings on since they're manageable now. 2013-04-03 21:58:24 -05:00
Kevin Granade 2d77a2a3af Remove unused variable. 2013-04-03 21:57:55 -05:00
Kevin Granade 7fd45e85d0 Invoke player constructor from npc copy constructor. 2013-04-03 21:57:38 -05:00
Kevin Granade 009bd0458c Fully bracket to avoid ambiguity. 2013-04-03 21:57:02 -05:00
Kevin Granade dc35824b53 Rearange tileray struct initialization to make the compiler happy. 2013-04-03 21:46:33 -05:00
Kevin Granade 48c7e1fe2a Actually apply move penalty for getting a weapon stuck in a monster. 2013-04-03 21:46:00 -05:00
Kevin Granade 4c4f5e9f56 Fully bracket some expressions to avoid ambiguity. 2013-04-03 21:45:24 -05:00
Kevin Granade ef744c5525 Remove some unused variables. 2013-04-03 21:44:38 -05:00
Kevin Granade 7e1e43d186 Fully parenthesize logic statements. 2013-04-03 21:43:56 -05:00
Kevin Granade 4c0daa7b57 Warning cleanup. 2013-04-03 21:03:00 -05:00
Kevin Granade 5198b22302 Remove unused variables 2013-04-03 20:54:23 -05:00
Kevin Granade 293b61c714 Remove unused variable. 2013-04-03 20:51:12 -05:00
Kevin Granade 171f72276b Warning cleanup and style changes in game.cpp. 2013-04-03 20:47:42 -05:00
ethankaminski 59f3f4039f Make multiple types of ammo stop freaking out item examination
Whoops, introduced this bug with my action hinting code.
2013-04-04 14:33:09 +13:00
Kevin Granade c23e4aed6c Cleanup misc warnings in monmove.cpp 2013-04-03 19:25:48 -05:00
Kevin Granade 439a5fb9ed Misc warning cleanup in field.cpp. 2013-04-03 19:18:41 -05:00
Kevin Granade 8645051fab Rearange intialization order of parameters to make compiler happy. 2013-04-03 19:00:22 -05:00
Kevin Granade cfb9e3fe21 Remove unnecessary const qualifier. 2013-04-03 18:56:49 -05:00
TheDarklingWolf d7cba9f752 Removed Herobr.. Grack. 2013-04-03 18:56:53 +01:00
TheDarklingWolf 518d9b5bc0 Fix waterskins holding more water than they should. Closes #367 2013-04-03 18:24:30 +01:00
TheDarklingWolf b04f1eb44a Added trail flag to 66mm, added (Currently not used) backblast flag to LAWs. 2013-04-03 16:49:07 +01:00
TheDarklingWolf 52c3ee670e Boot crafting and butcher knife cutting fixed. Closes #364 Closes #365 2013-04-03 14:46:12 +01:00
TheDarklingWolf 0afc96717a Added a suppresses smoke flag. 2013-04-03 11:18:42 +01:00
TheDarklingWolf f5f624027c Removed - from valid inventory characters. It's already used to wield nothing. 2013-04-03 09:27:07 +01:00
Kyratzes Talvadore 32f939e79b Merge pull request #363 from ethankaminski/chargen-tidy
Tidy up chargen finalization
2013-04-03 01:22:16 -07:00
ethankaminski 49f497ba40 Restoring a conditional that got dropped by the last commit 2013-04-03 21:19:45 +13:00
ethankaminski 257f787d7e Tidy up chargen finalization
Reduce messiness and - IMPORTANTLY - make it so characters can't go unnamed ("yes, waste points" -> "I want to give a name" started the game without naming the char).
2013-04-03 21:03:07 +13:00
Kevin Granade 6c357fa2c9 Merge pull request #360 from veryinky/master
Woodstoves related changes + metal tank crafting.
2013-04-02 20:19:17 -07:00
veryinky 859aa2e8c2 Woodstove construction 2013-04-02 22:35:45 -04:00
veryinky b02ab12ea2 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 18:30:09 -04:00
Kevin Granade f478dc5c45 Kill trailing whitespace\! 2013-04-02 17:19:57 -05:00
Kevin Granade b8bc5a7b25 Remove a ton of commented-out code. 2013-04-02 17:18:40 -05:00
Kevin Granade 3d291f7d70 Merge remote-tracking branch 'dda/pr/347' into dda-master 2013-04-02 17:10:32 -05:00
veryinky 19c93f3bc2 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 17:43:47 -04:00
TheDarklingWolf eacc97927a Actually changed all references of Silencer to Suppressor 2013-04-02 22:17:46 +01:00
TheDarklingWolf e475dc46ff Change code references for silencer to suppressor to match ingame name. 2013-04-02 22:04:56 +01:00
TheDarklingWolf ae9e074aff Renamed silencer to suppressor. 2013-04-02 21:48:12 +01:00
veryinky efad1cf3d6 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 14:23:17 -04:00
TheDarklingWolf 15a42427c4 My LAW goes FWOOSH! Added changes to changelog. 2013-04-02 18:58:40 +01:00
TheDarklingWolf c118da5524 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 18:48:53 +01:00
TheDarklingWolf 6ecb916e70 Added M72-LAW. Placed it in the Soldier & Helicopter Mapextras, and the launcher spawnlist. 2013-04-02 18:48:14 +01:00
Kevin Granade 2974c54cb1 Merge pull request #351 from Voker57/fixes
Remove >< from possible inventory letters since they make items inaccessible
2013-04-02 10:22:46 -07:00
Voker57 7737b34e49 Remove >< from possible inventory letters 2013-04-02 21:13:50 +04:00
TheDarklingWolf 9e7a74c0b2 Added new IF_NO_UNLOAD flag, used to prevent a weapon from being unloaded. (Charge rifles, LAWs, etc). 2013-04-02 16:52:15 +01:00
TheDarklingWolf 7f4a0cb3b1 Made the message when you attempt to close the curtains from outside more informative. 2013-04-02 16:46:52 +01:00
TheDarklingWolf dd1e9f9777 Fix traps overwriting each other. 2013-04-02 15:43:11 +01:00
TheDarklingWolf 575b2ce302 Mininukes require a grenade or 2 40mm concussive/frag. 2013-04-02 14:57:39 +01:00
TheDarklingWolf 7af47f6b90 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 14:36:36 +01:00
TheDarklingWolf c5f2101744 Added some stuff to the changelog 2013-04-02 14:36:05 +01:00
Kevin Granade daa842c88b Merge pull request #346 from veryinky/CraftingSeatPedal
Crafting seats require springs, pedals chunks.
2013-04-02 06:15:37 -07:00
origamiwolf beff3aa23d Bugfix for hot foods in containers not cooling down. Fixes #336 2013-04-02 20:03:22 +08:00
veryinky 6dc7e01410 Crafting seats require springs, pedals chunks. 2013-04-02 01:57:17 -03:00
Kevin Granade c5f06e6531 Fix style of random_map_extra(). 2013-04-01 22:52:28 -05:00
Kevin Granade 7fa9498417 Exclude non-classic map extras from selection when in classic zombie mode. 2013-04-01 22:46:23 -05:00
Kevin Granade 2cb272f3fa Add etags and ctags targets to phony list. 2013-04-01 21:46:23 -05:00
Kevin Granade a7603358d1 Add etags make target. 2013-04-01 21:46:23 -05:00
Kevin Granade 9244f91cc4 Merge pull request #345 from ethankaminski/invlet-fix
Stop the inventory being confused by non-alpha invlets
2013-04-01 19:40:40 -07:00
Kevin Granade facf3a3838 Some const and interface cleanup in map. 2013-04-01 21:38:40 -05:00
Kevin Granade ca9dd45ea8 Allow rain animation to be disabled with an option. 2013-04-01 21:15:33 -05:00
Kevin Granade ef902addc5 Use normal outside cache for determining where to draw rain animation. 2013-04-01 20:59:36 -05:00
Kevin Granade f75288aa5b Take zlevel into account when determining outsidedness. 2013-04-01 20:58:51 -05:00
Kevin Granade ea767e2f0d Seperate out linker to allow substituting distcc for CXX. 2013-04-01 20:09:08 -05:00
Kevin Granade e8e733620a Merge pull request #342 from wito/weather-fixes
Weather fixes
2013-04-01 18:01:13 -07:00
ethankaminski b182d91f90 Stop the inventory being confused by non-alpha invlets 2013-04-02 14:00:56 +13:00
Kevin Granade 5ebf79b895 Merge pull request #340 from veryinky/patch-1
crafting recipes for seat, muffler, crank.
2013-04-01 17:58:50 -07:00
Kevin Granade 379bc45587 Merge pull request #339 from veryinky/fix
fix kill count display
2013-04-01 17:53:05 -07:00
Kevin Granade 1bbba41719 Merge pull request #334 from ethankaminski/trait-farsighted
Add Far-Sighted trait
2013-04-01 17:13:50 -07:00
TheDarklingWolf 9b4a00ad2e Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 00:58:49 +01:00
Kevin Granade eebcbf3c61 Merge pull request #332 from Soyweiser/NPC_fixes
Npc spawning on top of each other fixed
2013-04-01 16:58:29 -07:00
TheDarklingWolf 86ffd5c2fa Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 00:58:22 +01:00
TheDarklingWolf b58b819012 Actually fixed the rollmat crash this time. Ctrl-Z is a fickle friend. 2013-04-02 00:57:59 +01:00
Kevin Granade 73ff14cd8c Merge pull request #329 from Soyweiser/master
Stopped npc's from spawning. Using a new npc.txt file.
2013-04-01 16:49:41 -07:00
TheDarklingWolf e93d2c1090 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-04-02 00:47:09 +01:00
TheDarklingWolf 73864981c7 Fix rollmat crash, blade trap blade drops, added Brazier to benign list. Closes #331 2013-04-02 00:46:18 +01:00
Kevin Granade 82e7b9716f Merge pull request #328 from jbfink/spelling-fix
Spelling correction (supplimental to supplemental) in overmapp.cc
2013-04-01 16:38:40 -07:00
Kevin Granade 39bfcc8867 Merge remote-tracking branch 'remotes/dda/pr/307' into dda-master
Conflicts:
	itype.h
	itypedef.cpp
	mapitemsdef.cpp
2013-04-01 18:33:06 -05:00
Williham Totland 29cf1f608c Removes glare from sunlight while indoors 2013-04-01 23:17:50 +02:00
Williham Totland d338869491 Makes rain make you wet 2013-04-01 23:11:58 +02:00
veryinky 18a2649452 crafting recipes for seat, muffler, crank. 2013-04-01 18:07:34 -03:00
veryinky 4518131c58 fix kill count display 2013-04-01 17:48:18 -03:00
Williham Totland b4f9e8139d lightning now makes a player wet, adds thunder (still no strikes) 2013-04-01 22:32:38 +02:00
Williham Totland 14c8c5e357 string identifiers 2013-04-01 21:36:12 +02:00
Williham Totland fdc1a6c6d8 ups power armor weight, makes hauling frame unique-equipped 2013-04-01 21:31:18 +02:00
ethankaminski c266bb9fba Make Far-Sighted also apply a penalty to electronics/tailoring crafting
Added electronics/tailoring crafting penalties to far-sighted, after GlyphGryph suggested it.
Only crafting is penalized (not disassembly), because making things is more fiddly than taking them apart.
Only electronics/tailoring are affected (tailoring less so) because they seem the most reliant on fine detail vision.
2013-04-01 19:29:29 +13:00
ethankaminski 521aa1f30f Add far-sighted as a trait, take penalties with no reading glasses
Added the Far-Sighted trait. If you're far-sighted and have no reading glasses on, you're unable to read and take a melee accuracy penalty.
2013-04-01 18:17:07 +13:00
Kevin Granade 79c36ebc3f And a few more symbols for labelling inventoy items. 2013-03-31 23:55:21 -05:00
Kevin Granade d70ad0a2ce Replace hard-coded ascii calculations with an explicit string of characters for use in labelling inventory items. 2013-03-31 23:52:24 -05:00
Soy 5e93e734fe Added missing a few npctalk switch cases. 2013-04-01 06:30:12 +02:00
Soy d6426f85cb Added fix for npc spawning on top of other npc. It now searches in a spiral pattern for a free spot (a game->is_empty spot). 2013-04-01 06:08:35 +02:00
Soy b0507b7c91 small comment problem fixed 2013-04-01 04:08:56 +02:00
Soy 59f5d337ff Removed old data/nonpc.txt and no_npc.txt files. Added npc.txt you can set in the npc.txt file which npcs you want to spawn. The starting one or random spawn ones. All defaults are set to not spawn them. 2013-04-01 03:58:48 +02:00
Kevin Granade 6fa9547df3 Cleanup DOS-style newlines. 2013-03-31 18:49:14 -05:00
Ids dce2ebdf21 create_starting_npcs will not generate starting npcs if the no_npc.txt file exists. 2013-04-01 01:27:32 +02:00
Kevin Granade 2ef337b379 Mass-remove trailing whitespace. 2013-03-31 18:26:39 -05:00
jbfink af017d5b96 Spelling correction (supplimental to supplemental) in overmapp.cc 2013-03-31 19:10:15 -04:00
TheDarklingWolf 3db8f03679 Made kegs spawn in the junk mapitem 2013-03-31 21:28:50 +01:00
TheDarklingWolf aaba2d6d3b Updated app title to 0.4 2013-03-31 21:18:24 +01:00
TheDarklingWolf d342bdc6d1 Change purse description. Closes #281 2013-03-31 21:09:19 +01:00
TheDarklingWolf 545ad70c15 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-31 20:24:24 +01:00
TheDarklingWolf 8897d27526 Various small fixes. Closes #324 Closes #317 2013-03-31 20:23:34 +01:00
Kevin Granade fd05d90e5a Merge pull request #320 from ethankaminski/autodrop_crashfix
Fix a crash bug that would occur if the player had autodrop on
2013-03-31 12:17:14 -07:00
Kevin Granade 6ee607f8ed Merge pull request #319 from ethankaminski/drawing-fix
Better fix for rain drawing
2013-03-31 12:04:23 -07:00
Kyratzes Talvadore 50fe2c7104 Merge pull request #321 from ethankaminski/nailfix
Re-fix nail drop rate
2013-03-31 05:09:42 -07:00
Kyratzes Talvadore 57bef43546 Merge pull request #323 from ethankaminski/item-fixes
Fix segfault-causing typo in shocker zombie butchering
2013-03-31 05:09:13 -07:00
ethankaminski ff5f35069a Fix segfault-causing typo in shocker zombie butchering 2013-04-01 00:45:08 +13:00
ethankaminski 986488955e One last case of nail over-generation 2013-03-31 23:16:22 +13:00
ethankaminski 4fe312bc1f Re-fix nail drop rate from deconstruction
Looks like the item refactor blew away my fix to nail drop rate, after changing how spawn_item works with charged items. Re-fixing.
2013-03-31 23:12:26 +13:00
ethankaminski 0b2285d621 Fix a crash bug that would occur if the player had autodrop on 2013-03-31 20:32:42 +13:00
ethankaminski 58d2b42818 Actually, really fix rain this time
Bug introduced by the last commit, and fixed by this commit: rain would fall where mobs were standing, replacing them with nothing.

The real issue: there was a variable in map::draw that was being set according to the player character's coordinates, when other code wanted it to be set according to the viewport center. ACTUALLY fix it this time. I hope. Unless there's more magic.
2013-03-31 18:27:57 +13:00
ethankaminski 5b5ef7ce6a Better rain drawing fix for shifted viewports
My previous fix for rain in shifted viewports made it so that rain would just not fall after you got too far away from the player. Fixed it the RIGHT way this time.
2013-03-31 18:01:57 +13:00
ethankaminski 9e5bb85684 Rename some arcane "cx"/"cy" variables 2013-03-31 18:01:14 +13:00
Kevin Granade 3522136133 Merge pull request #318 from ethankaminski/master
Fix new crash when generating fitted underarmor
2013-03-30 21:14:40 -07:00
ethankaminski 5b88d6032c Add one more missing fitted item def 2013-03-31 17:08:51 +13:00
origamiwolf 91934d490c Added heatpack to map item spawns.
Merged manually across item indexing refactor by Kevin Granade.
2013-03-30 21:55:20 -05:00
Kevin Granade ead4a85c30 Merge remote-tracking branch 'ethankaminski/knife-cauterize' into dda-master
Conflicts:
	data/changelog.txt
2013-03-30 21:33:31 -05:00
Kevin Granade 3ab096c7bd Fix construction recipe macros so they don't scribble all over the crafting recipes. 2013-03-30 21:24:46 -05:00
Kevin Granade 5746f4ca9c Merge remote-tracking branch 'dda/pr/316' into dda-master 2013-03-30 20:45:31 -05:00
Kevin Granade 2bb7dd9bac Fix indexing errors in construction definition macros. 2013-03-30 20:45:22 -05:00
ethankaminski cec149a6d0 Re-added leather trenchcoat recipe 2013-03-31 14:31:05 +13:00
ethankaminski 908c365d3e Re-add fitted items to the definitions 2013-03-31 14:21:45 +13:00
ethankaminski ff3769a6b4 Remove duplicate cases of toolsets. 2013-03-31 13:50:49 +13:00
Kevin Granade 73333b0af6 Fix indices used by crafting recipe definition macros, thanks Soron and veryinky for reporting. 2013-03-30 19:25:42 -05:00
Kevin Granade 208cc86ca9 Merge pull request #313 from ethankaminski/batsys-fix
Make the battery system bionic only consume as many batteries as needed
2013-03-30 16:50:41 -07:00
ethankaminski 4c36416aaa Use the new item framework 2013-03-31 12:45:49 +13:00
ethankaminski 3817112743 Merge branch 'master' into knife-cauterize 2013-03-31 12:45:26 +13:00
Kevin Granade 945beeac94 Merge pull request #306 from wito/more-pushables
Just makes a few more things pushable.
2013-03-30 16:38:34 -07:00
Kevin Granade 1ef319b69f Correct handling of flamable liquids. 2013-03-30 18:33:31 -05:00
Kevin Granade 9688f48263 Remove trailing whitespace. 2013-03-30 18:33:05 -05:00
Kevin Granade fc7ecb81d3 Remove some commented out code. 2013-03-30 18:32:37 -05:00
ethankaminski 3d9632c061 Make knives capable of cauterization with a lighter. 2013-03-31 12:22:05 +13:00
ethankaminski eae9b5d7fd Move the meat of cauterization into player.cpp 2013-03-31 12:04:41 +13:00
ethankaminski 1de6840abe Make the battery system bionic only consume as many batteries as needed 2013-03-31 11:10:06 +13:00
GlyphGryph 5b3999963f Changed itypes to use a map instead of a hash, as well as some required changes elsewhere, like in bionics, to make that work.
This is a significant refactor. It is the first step on moving items out to an external data file, and allowing more control over how items work later on.
2013-03-30 13:26:14 -04:00
Kevin Granade 04ff8c6f3f Merge pull request #305 from wito/crafting-madness
Modified crafting to not yield ALL THE THREAD!
2013-03-30 08:40:40 -07:00
Williham Totland e62b8a4476 Modified crafting to not yield ALL THE THREAD! when disassembling string, and related madness 2013-03-30 16:32:19 +01:00
Williham Totland 6335f1016d bathtub, oven, cupboards pushable 2013-03-30 16:31:14 +01:00
TheDarklingWolf 794f5f685d Increased volume&Weight of Stone Pot and Waterskin 2013-03-30 12:34:41 +00:00
TheDarklingWolf 523c253d77 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-30 12:11:14 +00:00
TheDarklingWolf 5e81d8ad64 Update brazier description 2013-03-30 12:11:01 +00:00
Kevin Granade 5b451558f4 Merge pull request #300 from ethankaminski/cauterize
Add cauterization as a way to remove bites/bleeding
2013-03-29 23:18:49 -07:00
Kevin Granade 636566920b resurrect overmap::find_all() for use by roadmap. 2013-03-30 01:16:51 -05:00
ethankaminski 012d5d0e0a Make the cauterization message's tone more intense 2013-03-30 18:06:54 +13:00
Kevin Granade aff09c13db Merge branch 'roadmap' into dda-master 2013-03-29 23:55:42 -05:00
Kevin Granade e7a5f8e799 Pull together vehicle-derived map caching into a single loop. 2013-03-29 23:22:38 -05:00
Kevin Granade 18b4b10da0 Pull iteration over map into build_outside_cache(), move it to be with other caching functions, and reformat it. 2013-03-29 23:22:00 -05:00
Kevin Granade 96f706a92e Make any tile that has a vision line drawn through it visible. 2013-03-29 23:18:35 -05:00
ethankaminski ff8809a8c4 Add cauterization (soldering iron/hotplate only for now)
You can now cauterize yourself with certain items, causing a fair amount of pain in exchange for healing (uninfected) bite and bleeding effects.
Now maybe I won't have situations where I'm out of first aid kits, have plenty of antibiotics, and intentionally wait the ~4 hours until the bite gets infected so I can heal the damn thing :P.
2013-03-30 16:59:16 +13:00
ethankaminski a16121b7ea Should probably add my major changes to the changelog 2013-03-30 16:57:05 +13:00
Kevin Granade 7fd4b7526d Merge branch 'pr/287' into dda-master 2013-03-29 21:42:46 -05:00
Kevin Granade 3cfce434ba Add a sound effect when breaking a window when trying to pry it open. 2013-03-29 21:34:24 -05:00
Kevin Granade 01a76511ca Merge pull request #294 from origamiwolf/CDDA-itemflag
Expansion of item_flags
2013-03-29 18:54:05 -07:00
Kevin Granade a278488d0a Merge pull request #299 from ethankaminski/wolf-fix
Fix one (primary/only?) source of wolf self-attacks.
2013-03-29 17:49:57 -07:00
Kevin Granade c851c02845 Merge branch 'pr/296' into dda-master
Conflicts:
	data/changelog.txt
2013-03-29 19:24:30 -05:00
Kevin Granade 13ae920d71 Merge pull request #295 from wito/gunmod-fix
Adresses an issue where M203s and underslung shotguns would start at -1 charges
2013-03-29 17:17:33 -07:00
Kevin Granade c944ec0f19 Merge pull request #291 from ethankaminski/examine_hinting
Improve item examination sidebar
2013-03-29 17:16:28 -07:00
ethankaminski cd0aa8fad5 Fix one (primary/only?) source of wolf self-attacks. 2013-03-30 12:56:33 +13:00
Williham Totland 953e4ba2ed changelog 2013-03-29 23:38:37 +01:00
Kyratzes Talvadore 23c05e83eb Merge pull request #298 from wito/wito-changelog
Wito changelog
2013-03-29 15:16:22 -07:00
Williham Totland ddd7080774 Changes added 2013-03-29 22:51:23 +01:00
Williham Totland a791f86881 Merge branch 'wito-changelog' of github.com:wito/Cataclysm-DDA into wito-changelog 2013-03-29 22:48:39 +01:00
Williham Totland c78261e78c Changes added 2013-03-29 22:47:54 +01:00
Williham Totland b2f3a7e425 Changes added 2013-03-29 22:47:02 +01:00
Kyratzes Talvadore 02929f47d2 Merge pull request #297 from ethankaminski/hitdraw_bugfix
Maybe fix the Windows segfault when firing at out-of-view monsters
2013-03-29 14:31:37 -07:00
ethankaminski 013812de4d Maybe fix the Windows segfault when firing at out-of-view monsters 2013-03-30 10:26:27 +13:00
Williham Totland e45237acaa Removed skill check for guns vis-a-vis one-handed-ness 2013-03-29 22:23:21 +01:00
Williham Totland ebf2e3c562 Adresses an issue where M203s and underslung shotguns would start at -1 charges. 2013-03-29 20:38:05 +01:00
Williham Totland 6e0d1b59d2 Hauling frame added to spawn lists 2013-03-29 18:01:10 +01:00
Williham Totland bb8b64cf09 Power armor hauling frame 2013-03-29 17:59:43 +01:00
origamiwolf 50bb31cc46 Extended item flags to individual items, which allows for hot food. 2013-03-30 00:06:54 +08:00
Kevin Granade ceed70560f Merge pull request #293 from wito/power-armor
Adjusted damage reduction values
2013-03-29 08:23:39 -07:00
TheDarklingWolf 0952d85022 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-29 13:10:53 +00:00
TheDarklingWolf 903d02b598 Commented out hit animation. Seems to fix crash errors with NPCs and players attacking offscreen 2013-03-29 13:10:27 +00:00
Kyratzes Talvadore 7523b28ed3 Merge pull request #290 from ZwodahS/basemaster
Update crafting recipe search
2013-03-29 06:05:07 -07:00
Kyratzes Talvadore ef13701022 Merge pull request #292 from ethankaminski/rainfix
Fix weather effects with offset viewports
2013-03-29 06:04:09 -07:00
Williham Totland 9d3221c734 Adjusted damage reduction values 2013-03-29 13:24:22 +01:00
ethankaminski a79d056a1a Fix weather effects with offset viewports.
Made rain actually be drawn in the right place when the viewport is offset. Now I understand what went wrong! (but only through trial and error :P.)
2013-03-30 00:18:12 +13:00
ethankaminski 98949a4a96 Rename the use_rating enum to hint_rating 2013-03-29 22:50:08 +13:00
ethankaminski a4eefd9856 Remove an unused function declaration, and fix comment alignment 2013-03-29 22:34:53 +13:00
ethankaminski 9fdbd37085 Make room for the word "Disassemble"
Looks like that sidebar I was playing with cut off the last letter of "disassemble".
Three options: move everything one character to the left; widen the window; or choose a shorter word.
I went with the first of those options, since it's unlikely to break anything, still uses the right word, and there was room.
2013-03-29 22:22:50 +13:00
ethankaminski 86f52e663b Add a "D"isassemble option to the item examination screen 2013-03-29 22:21:07 +13:00
ethankaminski 73ca6fa7cf Add hinting to "U"nload as well 2013-03-29 21:41:22 +13:00
ethankaminski e2e32c0648 Should probably add myself to the credits at this point 2013-03-29 21:23:06 +13:00
ethankaminski 4930d6329a Add colored hinting to the item exam sidebar
When examining an item, the sidebar listing possible actions now has colored hinting.

Green: can do that action
Red: the item permits that action, but circumstances don't
Gray: the item does not permit that action

A few things (notably, Unload) don't hint yet. Also, there may be some rare cases that were missed.
2013-03-29 21:19:51 +13:00
Eric Ng(ZwodahS) 09c6496ef2 Displayed crafting searched results in 1 tab instead of their own crafting tabs 2013-03-29 15:12:22 +08:00
ethankaminski 196e5e2bc8 Further enhance compare_split_screen_popup()
Since compare_split_screen_popup() looks like it's been patched repeatedly, and since a display I want to work on uses that function, I don't feel to bad about adding (and documenting!) another kludgey feature to the function to allow for the change I want to make later on.
2013-03-29 19:13:22 +13:00
Matthew Ammann 5e9b6b6819 Added chance to break glass when prying open a window 2013-03-29 00:29:53 -04:00
Matthew Ammann b11079b996 Merge remote-tracking branch 'upstream/master' into pryWindows 2013-03-29 00:12:17 -04:00
Kevin Granade c9f0cd83a8 Merge pull request #289 from ethankaminski/longcrafting
Craft recipe continuously
2013-03-28 20:29:06 -07:00
Kevin Granade a1f2c4880a Merge pull request #288 from veryinky/master
Item description bugfix and update.
2013-03-28 20:01:04 -07:00
Kevin Granade 99f99b4e31 Merge pull request #286 from wito/power-armor
Power armor!
Merging, but it needs an adjustment to not wear out so quick.  Even powered it was taking heavy damage from handfuls of Zs.
2013-03-28 19:49:39 -07:00
Kevin Granade 739461b493 Merge pull request #276 from wito/vehcile-parts-two
Vehicle Parts. Car isles, water tanks & more…
2013-03-28 19:03:03 -07:00
veryinky 8e83e3da02 Update item.cpp 2013-03-28 22:40:20 -03:00
origamiwolf bddf99b610 Added specific item flag variable 2013-03-29 09:34:25 +08:00
ethankaminski e527b053ba Tweak longcraft behavior. 2013-03-29 14:13:47 +13:00
ethankaminski b3fd4457c8 Added ability to craft as long as possible 2013-03-29 11:23:46 +13:00
ethankaminski 282b7ede67 Refactor crafting interface code a bit
Made some changes that make it easier to add new actions that initiate crafting. Moved some code into separate functions, so there's less duplication.
2013-03-29 10:32:56 +13:00
TheDarklingWolf 1d996fe1d1 Added Eben to possible names, removed drops from zombie dogs 2013-03-28 21:18:39 +00:00
Matthew Ammann 6d5ce19836 Crowbars now pry open windows 2013-03-28 16:20:17 -04:00
Williham Totland e29fc1425c Power armor added to spawn lists. 2013-03-28 20:44:33 +01:00
Williham Totland 55fbd65bfe Power drain, wear limitations, enc adjustment 2013-03-28 20:44:12 +01:00
Williham Totland 5ee7471d67 Power armor! 2013-03-28 20:43:44 +01:00
TheDarklingWolf 352d1b298e Change character to spawn with matches instead of lighter 2013-03-28 19:09:03 +00:00
Kevin Granade ea493762e6 Merge pull request #284 from ethankaminski/nail-droprate
Nail/drug drop rate fix
2013-03-28 06:40:52 -07:00
ethankaminski 398d6bc480 Whose idea was it to have quantity=1 drop two items? 2013-03-28 22:06:52 +13:00
ethankaminski c7fb15ba92 Merge remote-tracking branch 'upstream/master' into nail-droprate 2013-03-28 21:39:39 +13:00
ethankaminski 82820641a9 Fix the nail/drug droprate bug introduced by my last fix 2013-03-28 21:36:34 +13:00
Whales 5b7fa524b9 Added license. 2013-03-27 22:29:24 -05:00
Kevin Granade e6139173d3 Merge pull request #280 from origamiwolf/CDDA
Dynamic spawn fix
2013-03-27 20:13:14 -07:00
origamiwolf 73f752be35 Charges description for food items changed to Portions, which
will no longer show -1 for single portion food items.
fixes #266
2013-03-28 10:00:00 +08:00
Kevin Granade 49f9704622 Merge pull request #279 from ethankaminski/sinew-bugfix
Sinew drop rate bugfix, and ability to spawn copies of charged items
2013-03-27 18:54:43 -07:00
Kevin Granade a79dadb2a3 Merge pull request #278 from teh-sam/master
Add matches (20 in a book) to the game
2013-03-27 18:22:57 -07:00
Kevin Granade 6dffb1ddba Merge pull request #265 from wito/inventory-fix
Improved pickup behaviour when near item limit
2013-03-27 18:06:39 -07:00
origamiwolf 6020c78a2f Dynamic spawn fix 2013-03-28 09:05:03 +08:00
Williham Totland 47b607819e fix for unlimited items in inventory. 2013-03-28 01:49:28 +01:00
Kevin Granade 1cb9d2cc81 Merge pull request #264 from wito/item-limit
Item limit per square is now 64
2013-03-27 17:21:39 -07:00
Kevin Granade f98ebb6fd6 Merge pull request #257 from ZwodahS/basemaster
added a search function to crafting menu
2013-03-27 16:29:28 -07:00
ethankaminski 679e33fabf Fix a potential bug with non-default quantity/charges
Whoops, forgot to update map::spawn_item() (formerly map::add_item()) to support non-default quantity AND charges. Now it should be possible to spawn N copies of an item with M charges.
2013-03-28 12:12:16 +13:00
ethankaminski 1a78c75394 Rename itype-taking map::add_item() to map::spawn_item()
Per Kevin's suggestion. Hopefully this'll make it easier to find instances of that name later on.
2013-03-28 12:10:53 +13:00
teh-sam be9a7cb28f Adding to various appropriate spawns 2013-03-27 16:50:32 -06:00
teh-sam b09643a69a Update itypedef.cpp 2013-03-27 16:41:20 -06:00
ethankaminski 565863d77d Made it possible to spawn several instances of charged items
This fixes a bug involving sinew spawning sinew*n, instead of n copies of sinew*10.
2013-03-28 11:39:10 +13:00
teh-sam 6ddef70815 Add book of matches 2013-03-27 16:27:21 -06:00
Williham Totland 9de1305b75 Fixed an issue where fuel for gas/plasma engines would not drain. 2013-03-27 23:16:52 +01:00
Williham Totland a7e977b4b7 fixed a bug where reversing the vehicle would drain the storage battery. 2013-03-27 19:01:17 +01:00
Williham Totland 41045c5a6a trickle charging storage batteries 2013-03-27 18:28:04 +01:00
Williham Totland e384a013db Battery upscale.
Battery usage in vehicles are upscaled by a factor of 100.
Output of the mini-reactor is scaled to match.
2013-03-27 18:12:50 +01:00
Williham Totland 6493039b0b drinking from vehicle sink 2013-03-27 15:55:28 +01:00
Williham Totland 01c482e909 allow for integrated kitchen to be used in crafting 2013-03-27 15:23:45 +01:00
Williham Totland 35aaba05f7 Water tanks for vehicles, tank drain utility function 2013-03-27 15:23:07 +01:00
Williham Totland 6d16b303ae kitchen unit installable 2013-03-27 13:29:24 +01:00
Williham Totland 678c64c1d5 RV Kitchen unit 2013-03-27 12:59:10 +01:00
Eric Ng(ZwodahS) 3c03730fc3 Merge remote-tracking branch 'base/master' into basemaster 2013-03-27 11:51:18 +08:00
Kevin Granade 6878be3e07 Reskin fresh/fast zombie as a zombie dog. 2013-03-26 21:26:14 -05:00
Kevin Granade 1a0b11bdd4 Add a cooldown to zombie bite attack. 2013-03-26 21:25:36 -05:00
Kevin Granade 204e8bd33d Adjust agression flags of several animals. 2013-03-26 21:24:58 -05:00
Kevin Granade d4b446599a Cleanup merge flubs in wolf flags. 2013-03-26 21:23:05 -05:00
Kevin Granade 24ec07af5b Drain input buffer of repeated keypresses to prevent overshoot. 2013-03-26 20:16:32 -05:00
TheDarklingWolf c1e3aff6f0 Molotovs use full bottle again 2013-03-26 21:47:05 +00:00
TheDarklingWolf ac8bfd011b Berries and wild veggies should no longer spawn rotten. They now have their birthday set to
the turn they are created. Closes #241
2013-03-26 21:20:29 +00:00
TheDarklingWolf 52a2fb9214 Being overencumbered with hoarder no longer gives a morale bonus. Closes #271 2013-03-26 19:45:46 +00:00
Williham Totland 06630c6cc6 Car isle and floor trunks 2013-03-26 20:10:46 +01:00
Williham Totland e7df8092a7 Improved pickup behaviour when near item limit 2013-03-26 16:03:06 +01:00
Williham Totland 2f15639834 Item limit increased for vehicles, as well. 2013-03-26 13:43:20 +01:00
Williham Totland ac5b21e753 Item limit per tile is now 64 2013-03-26 13:30:05 +01:00
Williham Totland c1258b7b9e Merge branch 'weak-beer' 2013-03-26 12:43:31 +01:00
Williham Totland 1f08fd9d08 tailoring provides fitted gear 2013-03-26 12:39:58 +01:00
Williham Totland 88d2a18bbe Fitted items appearing in world. 2013-03-26 12:37:10 +01:00
Williham Totland 7f7a16d38a Also, dress shirts. 2013-03-26 12:36:58 +01:00
Williham Totland 0923703509 A few new items made available as fitted. 2013-03-26 12:20:42 +01:00
Williham Totland ca468be5b0 Leather trenchcoat made craftable 2013-03-26 12:18:33 +01:00
Williham Totland 1352c67fee Watered down the beer 2013-03-26 11:59:08 +01:00
Williham Totland b5983bcfce Merge github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-26 11:15:26 +01:00
Eric Ng(ZwodahS) ba8dda9e4d fix recraft bug not checking morale 2013-03-26 12:48:34 +08:00
Eric Ng(ZwodahS) 09018363b3 Merge remote-tracking branch 'base/master' into basemaster 2013-03-26 12:33:22 +08:00
Kevin Granade c58992c251 Optimize seen calculation by precalculating it. 2013-03-25 22:41:45 -05:00
Kevin Granade 16d7b2c88d Fix dumb merge error that breaks the build. 2013-03-25 20:36:52 -05:00
Kevin Granade 525119dd30 Pull last of lightmap class into map class. 2013-03-25 19:51:53 -05:00
Kevin Granade 0918650cb2 Const some calendar accessors. 2013-03-25 19:51:53 -05:00
Kevin Granade eb7e450a3b Expand lightmap to cover entire map and make it's coodrinates match the map. 2013-03-25 19:51:53 -05:00
Kevin Granade 20e0f06e3a Remove cache built flag. 2013-03-25 19:51:53 -05:00
Kevin Granade d0d8925608 Pull transparency cache into map class. 2013-03-25 19:51:53 -05:00
Kevin Granade 476712991c Remove monster caching in lightmap and just retrieve light data from monsters directly. 2013-03-25 19:51:53 -05:00
Kevin Granade 4af7a4f7be Remove lightmap-specific caching of vehicle data and access vehicles directly for transparency and lighting info. 2013-03-25 19:51:52 -05:00
Kevin Granade 5ee73b40ed Move outside cache data and construction to map class. 2013-03-25 19:51:52 -05:00
Kevin Granade 0977d4bae1 Pull more static data out of inner loop and const more things in map::draw(). 2013-03-25 19:51:52 -05:00
Williham Totland d53b95223e Merge github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-25 17:41:13 +01:00
Eric Ng(ZwodahS) 42ede8ae08 fix a bug that was accidentally introduced 2013-03-26 00:25:45 +08:00
Eric Ng(ZwodahS) 79b41bac9e added a search function to crafting 2013-03-25 13:39:34 +08:00
Eric Ng(ZwodahS) d9d8047b71 indentation without changes 2013-03-25 12:53:58 +08:00
TheDarklingWolf c213bb0dde Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-24 19:43:16 +00:00
TheDarklingWolf ecbd8acd0e Added iexamine files to .cbp 2013-03-24 19:42:51 +00:00
Kyratzes Talvadore 63582c6aa1 Merge pull request #256 from Shoes01/master
Buffed fire, fixed frostbite occurring in above freezing temps
2013-03-24 12:23:23 -07:00
Shoes01 e2ea835a8f Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-24 15:47:14 -07:00
Shoes01 2121cc1abb Standing on fire heats players, if fire is big enough 2013-03-24 15:44:44 -07:00
Williham Totland 7ba5e980a5 Merge github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-24 20:22:03 +01:00
TheDarklingWolf 824c4403ef Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA
Conflicts:
	map.cpp
2013-03-24 19:20:23 +00:00
TheDarklingWolf 6b7dd80aff Made warm clothing protect against proper rain. Reduced check for drizzle. 2013-03-24 19:19:04 +00:00
Shoes01 835ae6b10a Standing on a fire or magma tile also heats up player 2013-03-24 09:31:44 -07:00
Shoes01 11a6a46b4f Buffed fire's heating capabilities 2013-03-24 09:20:15 -07:00
Shoes01 c41bbcc715 Frostbite now only occurs in freezing temperatures 2013-03-24 09:17:13 -07:00
Shoes01 564fb6fddf Being on fire now increases bodytemp 2013-03-24 09:12:13 -07:00
Kyratzes Talvadore dcbf8bea88 Merge pull request #255 from iank/throwing_bug
Fix throwing bug
2013-03-24 06:53:42 -07:00
Your Name 3e99666c5b Fix throwing bug
Previously, if a user pressed '0' when selecting target and then fired,
thrown object would always hit with a headshot, no matter the range or
skill.
2013-03-24 01:21:26 -04:00
Kevin Granade 63ab391d87 Merge pull request #252 from Catacstone/explode-examine
Examine() to iuse::style functions
2013-03-23 13:53:01 -07:00
Matias Oksa 2562cab0d0 Examine() to iuse::style functions 2013-03-23 22:19:16 +02:00
Kevin Granade 758193655d Merge pull request #249 from benjamg/hotfix/highway_spawn
fix max and min count checking
2013-03-23 13:08:24 -07:00
Kevin Granade 318f9831f2 Make smashing picket fences drop some 2x4s and nails instead of... spears? 2013-03-23 14:57:53 -05:00
Kevin Granade 75b99b303b Merge pull request #250 from iank/smashable_picket_fence
Make picket fence smashable
2013-03-23 12:41:41 -07:00
Williham Totland 63c1f4e90a Merge branch 'hotfix/highway_spawn' of github.com:benjamg/Cataclysm-DDA 2013-03-23 20:38:00 +01:00
Williham Totland a320089556 Merge github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-23 20:24:59 +01:00
benjamg 799b0fc98b use omspec before valid can be used 2013-03-23 19:04:44 +00:00
Kevin Granade 1e6572d07b Merge pull request #248 from benjamg/hotfix/overmap_copy_constructor
fix to make the copy constructor public again. some compilers required it
2013-03-23 11:44:35 -07:00
Your Name 177f547bba Make picket fence smashable 2013-03-23 13:46:18 -04:00
benjamg 2eff3aa0ef fix max and min count checking 2013-03-23 12:49:31 +00:00
Williham Totland 4ea7602be4 Merge github.com:TheDarklingWolf/Cataclysm-DDA 2013-03-23 13:16:37 +01:00
benjamg 95865b3cab seem the std::swap default isn't good for overmap so for now duplicate code 2013-03-23 11:33:03 +00:00
benjamg bfe1bfb2c9 fix to make the copy constructor public again. some compilers required it 2013-03-23 09:37:48 +00:00
Kevin Granade bf4a014b44 Merge pull request #203 from tasetase/opti
Trivial minor optimizations
2013-03-22 21:23:22 -07:00
tasetase d8c07512b6 Reverted bad optimization 2013-03-23 00:18:43 -04:00
tasetase ed68f5c5c8 Merge branch 'opti' of https://github.com/tasetase/DDAtase into opti 2013-03-23 00:14:03 -04:00
tasetase 16cf629aa3 Saved current ter_id in map::drawsq for less ter(x,y) calls 2013-03-22 23:56:00 -04:00
Kevin Granade 2b1e86e87e Trailing whitespace fixups in monstergroups.json. 2013-03-22 21:28:47 -05:00
Kevin Granade 643214d089 Prevent fungal spires from spawning. 2013-03-22 21:28:47 -05:00
Williham Totland c9ca0e653e Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-23 02:31:38 +01:00
Kevin Granade 18d4c6095b Merge pull request #246 from tasetase/glyphs
Fix for glyphs on linux!
2013-03-22 18:23:39 -07:00
Williham Totland 1c6a35d3d0 Merge branch 'glyphs' of git://github.com/tasetase/DDAtase 2013-03-23 02:00:40 +01:00
tasetase 8e9c0bb87a Fixed linux compatibility 2013-03-22 20:54:41 -04:00
Kevin Granade db92fda0a0 Simplify fur and leather production in butcher(). 2013-03-22 19:30:18 -05:00
Kyratzes Talvadore 74cacdba88 Merge pull request #245 from tasetase/glyphs
Use of Extended ASCII, new wall glyphs and corners
2013-03-22 15:39:33 -07:00
tasetase 7fb40f8aa8 Moved the logic to a method 2013-03-22 17:54:59 -04:00
tasetase f11f1c059d Merge remote-tracking branch 'upstream/master' into glyphs 2013-03-22 17:48:38 -04:00
Kyratzes Talvadore 83b5f1f4a2 Merge pull request #244 from wito/new-containers
Beer in kegs in liquor stores and bars
2013-03-22 14:10:51 -07:00
Williham Totland 3921184c94 Beer in kegs in liquor stores and bars 2013-03-22 21:15:18 +01:00
Kyratzes Talvadore 949698f25b Merge pull request #243 from wito/new-containers
Big jerrycans in hardware stores and garages
2013-03-22 12:56:03 -07:00
Williham Totland ddd8c2bdec Big jerrycans in hardware stores and garages 2013-03-22 20:33:11 +01:00
OzoneH3 0203f7ddfa Merge pull request #242 from benjamg/hotfix/roads
highways now on ground level and not high in the sky
2013-03-22 11:37:20 -07:00
benjamg 6b65d8522f highways now on ground level and not high in the sky 2013-03-22 18:33:20 +00:00
tasetase 5061472733 Changed the pipe/dash glyph to E-ASCII equivalent, and implemented a on-draw corner-making 2013-03-21 20:40:04 -04:00
Shoes01 1f2ee09b71 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA
Conflicts:
	crafting.cpp
2013-03-20 21:49:44 -07:00
Matias Oksa 902ccce77f Evac shelters as a cherry on top 2013-03-14 22:16:43 +02:00
Matias Oksa e35def251f More roadmap targets, now including: roads 2013-03-14 22:11:20 +02:00
tasetase d735fe501c Additional optimization to update_scent 2013-03-13 19:43:48 -04:00
tasetase 07fdec11c9 Optimized update_scent for less map::move_cost calls 2013-03-13 17:57:40 -04:00
102 changed files with 13071 additions and 10459 deletions
+6 -3
View File
@@ -7,15 +7,14 @@
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release/Cataclysm" prefix_auto="1" extension_auto="1" />
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add option="-Os" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-Wl,-stack,12000000,-subsystem,windows" />
<Add option="-static -lgdi32" />
</Linker>
@@ -66,6 +65,8 @@
<Unit filename="graffiti.cpp" />
<Unit filename="graffiti.h" />
<Unit filename="help.cpp" />
<Unit filename="iexamine.cpp" />
<Unit filename="iexamine.h" />
<Unit filename="input.cpp" />
<Unit filename="input.h" />
<Unit filename="inventory.cpp" />
@@ -139,6 +140,8 @@
<Unit filename="pldata.h" />
<Unit filename="posix_time.cpp" />
<Unit filename="posix_time.h" />
<Unit filename="profession.cpp" />
<Unit filename="profession.h" />
<Unit filename="ranged.cpp" />
<Unit filename="resource.rc">
<Option compilerVar="WINDRES" />
+1
View File
@@ -0,0 +1 @@
Cataclysm is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
+8 -4
View File
@@ -21,9 +21,9 @@
# 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-char-subscripts
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-char-subscripts
# Uncomment below to disable warnings
WARNINGS = -w
#WARNINGS = -w
DEBUG = -g
#PROFILE = -pg
#OTHERS = -O3
@@ -56,6 +56,7 @@ DDIR = .deps
OS = $(shell uname -o)
CXX = $(CROSS)g++
LD = $(CROSS)g++
# enable optimizations. slow to build
ifdef RELEASE
@@ -115,7 +116,7 @@ all: $(TARGET)
@
$(TARGET): $(ODIR) $(DDIR) $(OBJS)
$(CXX) $(W32FLAGS) -o $(TARGET) $(DEFINES) $(CXXFLAGS) \
$(LD) $(W32FLAGS) -o $(TARGET) $(DEFINES) $(CXXFLAGS) \
$(OBJS) $(LDFLAGS)
$(ODIR):
@@ -145,13 +146,16 @@ export ODIR _OBJS LDFLAGS CXX W32FLAGS DEFINES CXXFLAGS
ctags: $(SOURCES) $(HEADERS)
ctags $(SOURCES) $(HEADERS)
etags: $(SOURCES) $(HEADERS)
etags $(SOURCES) $(HEADERS)
tests: $(ODIR) $(DDIR) $(OBJS)
$(MAKE) -C tests
check: tests
$(MAKE) -C tests check
.PHONY: tests check
.PHONY: tests check ctags etags
-include $(SOURCES:%.cpp=$(DEPDIR)/%.P)
-include ${OBJS:.o=.d}
+1 -1
View File
@@ -39,7 +39,7 @@ game also has extensive documentation via the ? command. Pressing ?1 will list
all the key commands, which is a good place to start.
To submit a bug, complaint, feature request, or praise, please send them via
email to fivedozenwhales@gmail.com. You can also submit problem reports and
email to TheDarklingWolf@gmail.com. You can also submit problem reports and
patches at the github repository at http://github.com/Whales/Cataclysm .
I strive to include as many feature requests as possible, and if you submit one
+8 -4
View File
@@ -193,6 +193,10 @@ std::string action_ident(action_id act)
return "wait";
case ACTION_CRAFT:
return "craft";
case ACTION_RECRAFT:
return "recraft";
case ACTION_LONGCRAFT:
return "long_craft";
case ACTION_CONSTRUCT:
return "construct";
case ACTION_DISASSEMBLE:
@@ -233,8 +237,6 @@ std::string action_ident(action_id act)
return "debug_mode";
case ACTION_NULL:
return "null";
case ACTION_RECRAFT:
return "recraft";
}
return "unknown";
}
@@ -355,6 +357,10 @@ std::string action_name(action_id act)
return "Wait for Several Minutes";
case ACTION_CRAFT:
return "Craft Items";
case ACTION_RECRAFT:
return "Recraft last recipe";
case ACTION_LONGCRAFT:
return "Craft as long as possible";
case ACTION_CONSTRUCT:
return "Construct Terrain";
case ACTION_DISASSEMBLE:
@@ -395,8 +401,6 @@ std::string action_name(action_id act)
return "Toggle Debug Messages";
case ACTION_NULL:
return "No Action";
case ACTION_RECRAFT:
return "Recraft last recipe";
}
return "Someone forgot to name an action.";
}
+1
View File
@@ -61,6 +61,7 @@ ACTION_BIONICS,
ACTION_WAIT,
ACTION_CRAFT,
ACTION_RECRAFT,
ACTION_LONGCRAFT,
ACTION_CONSTRUCT,
ACTION_DISASSEMBLE,
ACTION_SLEEP,
+3 -3
View File
@@ -141,7 +141,7 @@ It may have unknown powers; use 'a' to activate them.";
art->charge_type = ARTC_NULL; // 1 in 8 chance that it can't recharge!
art->id = itypes.size();
itypes.push_back(art);
itypes[art->name]=art;
return art;
} else { // Generate an armor artifact
@@ -245,7 +245,7 @@ It may have unknown powers; use 'a' to activate them.";
}
art->id = itypes.size();
itypes.push_back(art);
itypes[art->name]=art;
return art;
}
}
@@ -359,7 +359,7 @@ itype* game::new_natural_artifact(artifact_natural_property prop)
}
art->id = itypes.size();
itypes.push_back(art);
itypes[art->name]=art;
return art;
}
+389 -114
View File
@@ -9,8 +9,24 @@
#define BATTERY_AMOUNT 4 // How much batteries increase your power
std::map<bionic_id, bionic_data*> bionics;
std::vector<bionic_id> faulty_bionics;
std::vector<bionic_id> power_source_bionics;
std::vector<bionic_id> unpowered_bionics;
void bionics_install_failure(game *g, player *u, int success);
bionic_data::bionic_data(std::string new_name, bool new_power_source, bool new_activated,
int new_power_cost, int new_charge_time, std::string new_description){
name = new_name;
power_source = new_power_source;
activated = new_activated;
power_cost = new_power_cost;
charge_time = new_charge_time;
description = new_description;
}
void player::power_bionics(game *g)
{
WINDOW* wBio = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
@@ -37,8 +53,8 @@ void player::power_bionics(game *g)
mvwputch(wBio, 20, 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]->power_source ||
!bionics[my_bionics[i].id]->activated )
passive.push_back(my_bionics[i]);
else
active.push_back(my_bionics[i]);
@@ -47,12 +63,12 @@ void player::power_bionics(game *g)
if (passive.size() > 0) {
mvwprintz(wBio, 3, 1, c_ltblue, "Passive:");
for (int i = 0; i < passive.size(); i++) {
if (bionics[passive[i].id].power_source)
if (bionics[passive[i].id]->power_source)
type = c_ltcyan;
else
type = c_cyan;
mvwputch(wBio, 4 + i, 1, type, passive[i].invlet);
mvwprintz(wBio, 4 + i, 3, type, bionics[passive[i].id].name.c_str());
mvwprintz(wBio, 4 + i, 3, type, bionics[passive[i].id]->name.c_str());
}
}
if (active.size() > 0) {
@@ -65,9 +81,9 @@ void player::power_bionics(game *g)
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"),
bionics[active[i].id].name.c_str(),
bionics[active[i].id].power_cost,
bionics[active[i].id].charge_time);
bionics[active[i].id]->name.c_str(),
bionics[active[i].id]->power_cost,
bionics[active[i].id]->charge_time);
}
}
wrefresh(wBio);
@@ -95,23 +111,24 @@ void player::power_bionics(game *g)
}
if (ch == KEY_ESCAPE) {
if (activating) {
if (bionics[tmp->id].activated) {
if (bionics[tmp->id]->activated) {
itype_id weapon_id = weapon.type->id;
if (tmp->powered) {
tmp->powered = false;
g->add_msg("%s powered off.", bionics[tmp->id].name.c_str());
} else if (power_level >= bionics[tmp->id].power_cost ||
(weapon.type->id == itm_bio_claws && tmp->id == bio_claws))
g->add_msg("%s powered off.", bionics[tmp->id]->name.c_str());
} else if (power_level >= bionics[tmp->id]->power_cost ||
(weapon_id == "bio_claws_weapon" && tmp->id == "bio_claws_weapon"))
activate_bionic(b, g);
} else
mvwprintz(wBio, 21, 1, c_ltred, "\
You can not activate %s! To read a description of \
%s, press '!', then '%c'.", bionics[tmp->id].name.c_str(),
bionics[tmp->id].name.c_str(), tmp->invlet);
%s, press '!', then '%c'.", bionics[tmp->id]->name.c_str(),
bionics[tmp->id]->name.c_str(), tmp->invlet);
} else { // Describing bionics, not activating them!
// Clear the lines first
ch = 0;
werase(w_description);
mvwprintz(w_description, 0, 0, c_ltblue, bionics[tmp->id].description.c_str());
mvwprintz(w_description, 0, 0, c_ltblue, bionics[tmp->id]->description.c_str());
}
}
}
@@ -132,15 +149,15 @@ You can not activate %s! To read a description of \
void player::activate_bionic(int b, game *g)
{
bionic bio = my_bionics[b];
int power_cost = bionics[bio.id].power_cost;
if (weapon.type->id == itm_bio_claws && bio.id == bio_claws)
int power_cost = bionics[bio.id]->power_cost;
if (weapon.type->id == "bio_claws_weapon" && bio.id == "bio_claws_weapon")
power_cost = 0;
if (power_level < power_cost) {
if (my_bionics[b].powered) {
g->add_msg("Your %s powers down.", bionics[bio.id].name.c_str());
g->add_msg("Your %s powers down.", bionics[bio.id]->name.c_str());
my_bionics[b].powered = false;
} else
g->add_msg("You cannot power your %s", bionics[bio.id].name.c_str());
g->add_msg("You cannot power your %s", bionics[bio.id]->name.c_str());
return;
}
@@ -149,9 +166,9 @@ void player::activate_bionic(int b, game *g)
my_bionics[b].charge--;
} else {
// Not-on units, or those with zero charge, have to pay the power cost
if (bionics[bio.id].charge_time > 0) {
if (bionics[bio.id]->charge_time > 0) {
my_bionics[b].powered = true;
my_bionics[b].charge = bionics[bio.id].charge_time;
my_bionics[b].charge = bionics[bio.id]->charge_time;
}
power_level -= power_cost;
}
@@ -165,20 +182,14 @@ void player::activate_bionic(int b, game *g)
InputEvent input;
item tmp_item;
switch (bio.id) {
case bio_painkiller:
if(bio.id == "bio_painkiller"){
pkill += 6;
pain -= 2;
if (pkill > pain)
pkill = pain;
break;
case bio_nanobots:
} else if (bio.id == "bio_nanobots"){
healall(4);
break;
case bio_resonator:
} else if (bio.id == "bio_resonator"){
g->sound(posx, posy, 30, "VRRRRMP!");
for (int i = posx - 1; i <= posx + 1; i++) {
for (int j = posy - 1; j <= posy + 1; j++) {
@@ -186,12 +197,10 @@ void player::activate_bionic(int b, game *g)
g->m.bash(i, j, 40, junk); // Multibash effect, so that doors &c will fall
g->m.bash(i, j, 40, junk);
if (g->m.is_destructable(i, j) && rng(1, 10) >= 4)
g->m.ter(i, j) = t_rubble;
g->m.ter_set(i, j, t_rubble);
}
}
break;
case bio_time_freeze:
} else if (bio.id == "bio_time_freeze"){
moves += 100 * power_level;
power_level = 0;
g->add_msg("Your speed suddenly increases!");
@@ -205,17 +214,13 @@ void player::activate_bionic(int b, game *g)
}
if (one_in(5))
add_disease(DI_TELEGLOW, rng(50, 400), g);
break;
case bio_teleport:
} else if (bio.id == "bio_teleport"){
g->teleport();
add_disease(DI_TELEGLOW, 300, g);
break;
}
// TODO: More stuff here (and bio_blood_filter)
case bio_blood_anal:
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))
@@ -260,9 +265,7 @@ void player::activate_bionic(int b, game *g)
refresh();
getch();
delwin(w);
break;
case bio_blood_filter:
} else if(bio.id == "bio_blood_filter"){
rem_disease(DI_FUNGUS);
rem_disease(DI_POISON);
rem_disease(DI_PKILL1);
@@ -275,11 +278,9 @@ void player::activate_bionic(int b, game *g)
rem_disease(DI_TOOK_PROZAC);
rem_disease(DI_TOOK_FLUMED);
rem_disease(DI_ADRENALINE);
break;
case bio_evap:
} else if(bio.id == "bio_evap"){
if (query_yn("Drink directly? Otherwise you will need a container.")) {
tmp_item = item(g->itypes[itm_water], 0);
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!");
@@ -292,128 +293,112 @@ void player::activate_bionic(int b, game *g)
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_evap].power_cost;
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;
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;
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;
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[itm_water], 0));
i_at(t).put_in(item(g->itypes["water_clean"], 0));
}
}
}
break;
case bio_lighter:
} 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;
power_level += bionics["bio_lighter"]->power_cost;
return;
}
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.");
break;
case bio_claws:
if (weapon.type->id == itm_bio_claws) {
} else if(bio.id == "bio_claws"){
if (weapon.type->id == "bio_claws_weapon") {
g->add_msg("You withdraw your claws.");
weapon = ret_null;
} else if (weapon.type->id != 0) {
} else if(weapon.type->id != "null"){
g->add_msg("Your claws extend, forcing you to drop your %s.",
weapon.tname().c_str());
g->m.add_item(posx, posy, weapon);
weapon = item(g->itypes[itm_bio_claws], 0);
weapon = item(g->itypes["bio_claws_weapon"], 0);
weapon.invlet = '#';
} else {
g->add_msg("Your claws extend!");
weapon = item(g->itypes[itm_bio_claws], 0);
weapon = item(g->itypes["bio_claws_weapon"], 0);
weapon.invlet = '#';
}
break;
case bio_blaster:
} else if(bio.id == "bio_blaster"){
tmp_item = weapon;
weapon = item(g->itypes[itm_bio_blaster], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_bio_fusion]);
weapon = item(g->itypes["bio_blaster_gun"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["bio_fusion_ammo"]);
weapon.charges = 1;
g->refresh_all();
g->plfire(false);
weapon = tmp_item;
break;
case bio_laser:
} else if (bio.id == "bio_laser"){
tmp_item = weapon;
weapon = item(g->itypes[itm_v29], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_laser_pack]);
weapon = item(g->itypes["v29"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["laser_pack"]);
weapon.charges = 1;
g->refresh_all();
g->plfire(false);
weapon = tmp_item;
break;
case bio_emp:
} 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.");
power_level += bionics[bio_emp].power_cost;
power_level += bionics["bio_emp"]->power_cost;
return;
}
dirx += posx;
diry += posy;
g->emp_blast(dirx, diry);
break;
case bio_hydraulics:
} else if (bio.id == "bio_hydraulics"){
g->add_msg("Your muscles hiss as hydraulic strength fills them!");
break;
case bio_water_extractor:
} else if (bio.id == "bio_water_extractor"){
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 == itm_corpse && query_yn("Extract water from the %s",
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;
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;
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;
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[itm_water], 0));
i_at(t).put_in(item(g->itypes["water"], 0));
}
}
}
if (i == g->m.i_at(posx, posy).size() - 1) // We never chose a corpse
power_level += bionics[bio_water_extractor].power_cost;
power_level += bionics["bio_water_extractor"]->power_cost;
}
break;
case bio_magnet:
} else if(bio.id == "bio_magnet"){
for (int i = posx - 10; i <= posx + 10; i++) {
for (int j = posy - 10; j <= posy + 10; j++) {
if (g->m.i_at(i, j).size() > 0) {
@@ -449,16 +434,14 @@ void player::activate_bionic(int b, game *g)
}
}
}
break;
case bio_lockpick:
} 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.");
power_level += bionics[bio_lockpick].power_cost;
power_level += bionics["bio_lockpick"]->power_cost;
return;
}
dirx += posx;
@@ -466,11 +449,9 @@ void player::activate_bionic(int b, game *g)
if (g->m.ter(dirx, diry) == t_door_locked) {
moves -= 40;
g->add_msg("You unlock the door.");
g->m.ter(dirx, diry) = t_door_c;
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());
break;
}
}
@@ -517,7 +498,7 @@ bool player::install_bionics(game *g, it_bionic* type)
for (int i = 1; i < type->options.size(); i++) {
bionic_id id = type->options[i];
mvwprintz(w, i + 3, 1, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
bionics[id]->name.c_str());
}
// Helper text
mvwprintz(w, 3, 39, c_white, "Difficulty of this module: %d",
@@ -552,11 +533,11 @@ bool player::install_bionics(game *g, it_bionic* type)
mvwprintz(w, 13, 39, c_white, "or faulty installation.");
wrefresh(w);
if (type->id == itm_bionics_battery) { // No selection list; just confirm
mvwprintz(w, 3, 1, h_ltblue, "Battery Level +%d", BATTERY_AMOUNT);
if (type->id == "bio_power_storage") { // No selection list; just confirm
mvwprintz(w, 3, 1, h_ltblue, "Power Storage +%d", BATTERY_AMOUNT);
mvwprintz(w_description, 0, 0, c_ltblue, "\
Installing this bionic will increase your total battery capacity by %d.\n\
Batteries are necessary for most bionics to function. They also require a\n\
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.", BATTERY_AMOUNT);
InputEvent input;
@@ -593,12 +574,12 @@ charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
bionic_id id = type->options[selection];
mvwprintz(w, 3 + selection, 1, (has_bionic(id) ? h_ltred : h_ltblue),
bionics[id].name.c_str());
bionics[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[id].description.c_str());
mvwprintz(w_description, 0, 0, c_ltblue, bionics[id]->description.c_str());
wrefresh(w_description);
wrefresh(w);
@@ -607,7 +588,7 @@ charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
case DirectionS:
mvwprintz(w, 2 + selection, 0, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
bionics[id]->name.c_str());
if (selection == type->options.size() - 1)
selection = 0;
else
@@ -616,7 +597,7 @@ charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
case DirectionN:
mvwprintz(w, 2 + selection, 0, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
bionics[id]->name.c_str());
if (selection == 0)
selection = type->options.size() - 1;
else
@@ -625,7 +606,7 @@ charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
}
if (input == Confirm && has_bionic(id)) {
popup("You already have a %s!", bionics[id].name.c_str());
popup("You already have a %s!", bionics[id]->name.c_str());
input = Nothing;
}
} while (input != Cancel && input != Confirm);
@@ -637,7 +618,7 @@ charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
bionic_id id = type->options[selection];
int success = chance_of_success - rng(1, 100);
if (success > 0) {
g->add_msg("Successfully installed %s.", bionics[id].name.c_str());
g->add_msg("Successfully installed %s.", bionics[id]->name.c_str());
add_bionic(id);
} else
bionics_install_failure(g, this, success);
@@ -716,10 +697,10 @@ void bionics_install_failure(game *g, player *u, int success)
{
fail_text += ", causing a faulty installation.";
std::vector<bionic_id> valid;
for (int i = max_bio_good + 1; i < max_bio; i++) {
bionic_id id = bionic_id(i);
if (!u->has_bionic(id))
valid.push_back(id);
for (std::vector<std::string>::iterator it = faulty_bionics.begin() ; it != faulty_bionics.end(); ++it){
if (!u->has_bionic(*it)){
valid.push_back(*it);
}
}
if (valid.size() == 0) { // We've got all the bad bionics!
if (u->max_power_level > 0) {
@@ -738,3 +719,297 @@ void bionics_install_failure(game *g, player *u, int success)
g->add_msg(fail_text.c_str());
}
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.");
// 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_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");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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_ears");
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, but also reduces your\n\
dexterity by 2.");
unpowered_bionics.push_back("bio_ears");
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, but increasing encumberance by 2 and decreasing\n\
perception by 1.");
unpowered_bionics.push_back("bio_ears");
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, but increasing your encumberance by 2.");
unpowered_bionics.push_back("bio_ears");
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, but decreasing your dexterity by 1.");
unpowered_bionics.push_back("bio_ears");
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, but decreasing your speed by 15.");
unpowered_bionics.push_back("bio_ears");
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.");
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 Dissapation", 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.");
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["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, "\
Nanotubs 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.");
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_banish"] = new bionic_data("Banishment", false, true, 40, 0, "\
You can briefly open a one-way gate to the nether realm, banishing a single\n\
target there permanently. This is not without its dangers, however, as the\n\
inhabitants of the nether world may take notice.");
bionics["bio_gate_out"] = new bionic_data("Gate Out", false, true, 55, 0, "\
You can temporarily open a two-way gate to the nether realm, accessible only\n\
by you. This will remove you from immediate danger, but may attract the\n\
attention of the nether world's inhabitants...");
bionics["bio_gate_in"] = new bionic_data("Gate In", false, true, 35, 0, "\
You can temporarily open a one-way gate from the nether realm. This will\n\
attract the attention of its horrifying inhabitants, who may begin to pour\n\
into reality.");
bionics["bio_nightfall"] = new bionic_data("Artificial Night", false, true, 5, 1, "\
Photon absorbtion panels will attract and obliterate photons within a 100'\n\
radius, casting an area around you into pitch darkness.");
bionics["bio_drilldown"] = new bionic_data("Borehole Drill", false, true, 30, 0, "\
Your legs can transform into a powerful drill which will bury you 50 feet\n\
into the earth. Be careful to only drill down when you know you will be able\n\
to get out, or you'll simply dig your own tomb.");
bionics["bio_heatwave"] = new bionic_data("Heatwave", false, true, 45, 0, "\
At the cost of immense power, you can cause dramatic spikes in the ambient\n\
temperature around you. These spikes are very short-lived, but last long\n\
enough to ignite wood, paper, gunpowder, and other substances.");
bionics["bio_lightning"] = new bionic_data("Chain Lightning", false, true, 48, 0, "\
Powerful capacitors unleash an electrical storm at your command, sending a\n\
chain of highly-damaging lightning through the air. It has the power to\n\
injure several opponents before grounding itself.");
bionics["bio_tremor"] = new bionic_data("Tremor Pads", false, true, 40, 0, "\
Using tremor pads in your feet, you can cause a miniature earthquake. The\n\
shockwave will damage enemies (particularly those digging underground), tear\n\
down walls, and churn the earth.");
bionics["bio_flashflood"] = new bionic_data("Flashflood", false, true, 35, 0, "\
By drawing the moisture from the air, and synthesizing water from in-air\n\
elements, you can create a massive puddle around you. The effects are more\n\
powerful when used near a body of water.");
//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.");
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.");
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.");
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.");
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.");
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.");
faulty_bionics.push_back("bio_stiff");
}
+20 -300
View File
@@ -1,51 +1,26 @@
#ifndef _BIONICS_H_
#define _BIONICS_H_
#include <string>
#include <map>
/* Thought: Perhaps a HUD bionic that changes the display of the game?
* Showing more information or something. */
enum bionic_id {
bio_null,
// Power sources
bio_batteries, bio_metabolics, bio_solar, bio_furnace, bio_ethanol,
// Automatic / Always-On
bio_memory, bio_ears,
bio_eye_enhancer, bio_membrane, bio_targeting,
bio_gills, bio_purifier,
bio_climate, bio_storage, bio_recycler, bio_digestion, // TODO: Ynnn
bio_tools, bio_shock, bio_heat_absorb,
bio_carbon, bio_armor_head, bio_armor_torso, bio_armor_arms, bio_armor_legs,
// Player Activated
bio_flashlight, bio_night_vision, bio_infrared,
bio_face_mask, // TODO
bio_ads, bio_ods, bio_scent_mask,bio_scent_vision, bio_cloak, bio_painkiller,
bio_nanobots, bio_heatsink, bio_resonator, bio_time_freeze, bio_teleport,
bio_blood_anal, bio_blood_filter, bio_alarm,
bio_evap, bio_lighter, bio_claws, bio_blaster, bio_laser, bio_emp,
bio_hydraulics, bio_water_extractor, bio_magnet, bio_fingerhack, bio_lockpick,
bio_ground_sonar,
max_bio_start,
// EVERYTHING below this point is not available to brand-new players
// TODO: all these suckers
bio_banish, bio_gate_out, bio_gate_in, bio_nightfall, bio_drilldown,
bio_heatwave, bio_lightning, bio_tremor, bio_flashflood,
max_bio_good,
// Everything below THIS point is bad bionics, meant to be punishments
bio_dis_shock, bio_dis_acid, bio_drain, bio_noise, bio_power_weakness,
bio_stiff,
max_bio
};
typedef std::string bionic_id;
struct bionic_data {
std::string name;
bool power_source;
bool activated; // If true, then the below function only happens when
// activated; otherwise, it happens every turn
int power_cost;
int charge_time; // How long, when activated, between drawing power_cost
// If 0, it draws power once
std::string description;
class bionic_data {
public:
bionic_data(std::string new_name, bool new_power_source, bool new_activated,
int new_power_cost, int new_charge_time, std::string new_description);
std::string name;
bool power_source;
bool activated; // If true, then the below function only happens when
// activated; otherwise, it happens every turn
int power_cost;
int charge_time; // How long, when activated, between drawing power_cost
// If 0, it draws power once
std::string description;
};
struct bionic {
@@ -54,7 +29,7 @@ struct bionic {
bool powered;
int charge;
bionic() {
id = bio_batteries;
id = "bio_batteries";
invlet = 'a';
powered = false;
charge = 0;
@@ -67,264 +42,9 @@ struct bionic {
};
};
const bionic_data bionics[] = {
{"NULL bionics", false, false, 0, 0, "\
If you're seeing this, it's a bug."},
// NAME ,PW_SRC, ACT ,COST, TIME,
{"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."},
{"Metabolic Interchange", true, false, 0, 0, "\
Your digestive system and power supply are interconnected. Any drain on\n\
energy instead increases your hunger."},
{"Solar Panels", true, false, 0, 0, "\
You have a few solar panels installed. While in direct sunlight, your power\n\
level will slowly recharge."},
{"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."},
{"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."},
{"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 power."},
{"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."},
{"Diamond Cornea", false, false, 0, 0, "\
Your vision is greatly enhanced, giving you a +2 bonus to perception."},
{"Nictating Membrane", false, false, 0, 0, "\
Your eyes have a thin membrane that closes over your eyes while underwater,\n\
negating any vision penalties."},
{"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."},
{"Membrane Oxygenator", false, false, 1, 0, "\
An oxygen interchange system automatically switches on while underwater,\n\
slowly draining your energy reserves but providing oxygen."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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, but also reduces your\n\
dexterity by 2."},
{"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, but increasing encumberance by 2 and decreasing\n\
perception by 1."},
{"Alloy Plating - Torso", false, false, 0, 0, "\
The flesh on your torso has been replaced by a strong armor, protecting you\n\
greatly, but increasing your encumberance by 2."},
{"Alloy Plating - Arms", false, false, 0, 0, "\
The flesh on your arms has been replaced by a strong armor, protecting you\n\
greatly, but decreasing your dexterity by 1."},
{"Alloy Plating - Legs", false, false, 0, 0, "\
The flesh on your legs has been replaced by a strong armor, protecting you\n\
greatly, but decreasing your speed by 15."},
{"Cranial Flashlight", false, true, 1, 30, "\
Mounted between your eyes is a small but powerful LED flashlight."},
{"Implanted Night Vision", false, true, 1, 20, "\
Your eyes have been modified to amplify existing light, allowing you to see\n\
in the dark."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"Thermal Dissapation", 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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"Mini-Flamethrower", false, true, 3, 0, "\
The index fingers of both hands have powerful fire starters which extend from\n\
the tip."},
{"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."},
{"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."},
{"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."},
{"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."},
{"Hydraulic Muscles", false, true, 1, 3, "\
While activated, the muscles in your arms will be greatly enchanced,\n\
increasing your strength by 20."},
{"Water Extraction Unit", false, true, 2, 0, "\
Nanotubs 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."},
{"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."},
{"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."},
{"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."},
{"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."},
{"max_bio_start - BUG", false, false, 0, 0, "\
This is a placeholder bionic meant to demarkate those which a new character\n\
can start with. If you are reading this, you have found a bug!"},
{"Banishment", false, true, 40, 0, "\
You can briefly open a one-way gate to the nether realm, banishing a single\n\
target there permanently. This is not without its dangers, however, as the\n\
inhabitants of the nether world may take notice."},
{"Gate Out", false, true, 55, 0, "\
You can temporarily open a two-way gate to the nether realm, accessible only\n\
by you. This will remove you from immediate danger, but may attract the\n\
attention of the nether world's inhabitants..."},
{"Gate In", false, true, 35, 0, "\
You can temporarily open a one-way gate from the nether realm. This will\n\
attract the attention of its horrifying inhabitants, who may begin to pour\n\
into reality."},
{"Artificial Night", false, true, 5, 1, "\
Photon absorbtion panels will attract and obliterate photons within a 100'\n\
radius, casting an area around you into pitch darkness."},
{"Borehole Drill", false, true, 30, 0, "\
Your legs can transform into a powerful drill which will bury you 50 feet\n\
into the earth. Be careful to only drill down when you know you will be able\n\
to get out, or you'll simply dig your own tomb."},
{"Heatwave", false, true, 45, 0, "\
At the cost of immense power, you can cause dramatic spikes in the ambient\n\
temperature around you. These spikes are very short-lived, but last long\n\
enough to ignite wood, paper, gunpowder, and other substances."},
{"Chain Lightning", false, true, 48, 0, "\
Powerful capacitors unleash an electrical storm at your command, sending a\n\
chain of highly-damaging lightning through the air. It has the power to\n\
injure several opponents before grounding itself."},
{"Tremor Pads", false, true, 40, 0, "\
Using tremor pads in your feet, you can cause a miniature earthquake. The\n\
shockwave will damage enemies (particularly those digging underground), tear\n\
down walls, and churn the earth."},
{"Flashflood", false, true, 35, 0, "\
By drawing the moisture from the air, and synthesizing water from in-air\n\
elements, you can create a massive puddle around you. The effects are more\n\
powerful when used near a body of water."},
{"max_bio_good - BUG", false, false, 0, 0, "\
This is a placeholder bionic. If you are reading this, you have found a bug!"},
{"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."},
{"Acidic Discharge", false, false, 0, 0, "\
A malfunctioning bionic which occasionally discharges acid into your muscles,\n\
causing sharp pain and minor damage."},
{"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."},
{"Noisemaker", false, false, 0, 0, "\
A malfunctioning bionic. It will occasionally emit a loud burst of noise."},
{"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."},
{"Wire-induced Stiffness", false, false, 0, 0, "\
Improperly installed wires cause a physical stiffness in most of your body,\n\
causing increased encumberance."}
};
extern std::map<bionic_id, bionic_data*> bionics;
extern std::vector<bionic_id> faulty_bionics;
extern std::vector<bionic_id> power_source_bionics;
extern std::vector<bionic_id> unpowered_bionics;
#endif
+6 -6
View File
@@ -224,14 +224,14 @@ void calendar::standardize()
season = season_type(tmpseason);
}
int calendar::minutes_past_midnight()
int calendar::minutes_past_midnight() const
{
//debugmsg("minute: %d hour: %d");
int ret = minute + hour * 60;
return ret;
}
moon_phase calendar::moon()
moon_phase calendar::moon() const
{
int phase = day / (DAYS_IN_SEASON / 4);
//phase %= 4; Redundant?
@@ -241,7 +241,7 @@ moon_phase calendar::moon()
return moon_phase(phase);
}
calendar calendar::sunrise()
calendar calendar::sunrise() const
{
calendar ret;
int start_hour = 0, end_hour = 0;
@@ -273,7 +273,7 @@ calendar calendar::sunrise()
return ret;
}
calendar calendar::sunset()
calendar calendar::sunset() const
{
calendar ret;
int start_hour = 0, end_hour = 0;
@@ -305,7 +305,7 @@ calendar calendar::sunset()
return ret;
}
bool calendar::is_night()
bool calendar::is_night() const
{
calendar sunrise_time = sunrise(), sunset_time = sunset();
@@ -316,7 +316,7 @@ bool calendar::is_night()
return (mins > sunset_mins + TWILIGHT_MINUTES || mins < sunrise_mins);
}
int calendar::sunlight()
int calendar::sunlight() const
{
calendar sunrise_time = sunrise(), sunset_time = sunset();
+6 -6
View File
@@ -70,12 +70,12 @@ class calendar
void standardize(); // Ensure minutes <= 59, hour <= 23, etc.
// Sunlight and day/night calcuations
int minutes_past_midnight(); // Useful for sunrise/set calculations
moon_phase moon(); // Find phase of moon
calendar sunrise(); // Current time of sunrise
calendar sunset(); // Current time of sunset
bool is_night(); // After sunset + TWILIGHT_MINUTES, before sunrise
int sunlight(); // Current amount of sun/moonlight; uses preceding funcs
int minutes_past_midnight() const; // Useful for sunrise/set calculations
moon_phase moon() const; // Find phase of moon
calendar sunrise() const; // Current time of sunrise
calendar sunset() const; // Current time of sunset
bool is_night() const; // After sunset + TWILIGHT_MINUTES, before sunrise
int sunlight() const; // Current amount of sun/moonlight; uses preceding funcs
// Print-friendly stuff
std::string print_time(bool twentyfour = false);
+6 -1
View File
@@ -46,7 +46,7 @@ bool WinCreate()
int WinBorderWidth;
int WinTitleSize;
unsigned int WindowStyle;
const WCHAR *szTitle= (L"Cataclysm: Dark Days Ahead - 0.3 Prerelease");
const WCHAR *szTitle= (L"Cataclysm: Dark Days Ahead - 0.4");
WinTitleSize = GetSystemMetrics(SM_CYCAPTION); //These lines ensure
WinBorderWidth = GetSystemMetrics(SM_CXDLGFRAME) * 2; //that our window will
WinBorderHeight = GetSystemMetrics(SM_CYDLGFRAME) * 2; // be a perfect size
@@ -157,6 +157,7 @@ inline void FillRectDIB(int x, int y, int width, int height, unsigned char color
{
int j;
for (j=y; j<y+height; j++)
//NOTE TO FUTURE: this breaks if j is negative. Apparently it doesn't break if j is too large, though?
memset(&dcbits[x+j*WindowWidth],color,width);
};
@@ -331,6 +332,10 @@ fin.open("data\\FONTDATA");
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)
}
int i,j;
WINDOW *newwindow = new WINDOW;
//newwindow=&_windows[WindowCount];
+14 -14
View File
@@ -260,12 +260,12 @@ void computer::activate_function(game *g, computer_action action)
for (int i = 0; i < g->m.i_at(x1, y1).size(); i++) {
item *it = &(g->m.i_at(x1, y1)[i]);
if (it->is_container() && it->contents.empty()) {
it->put_in( item(g->itypes[itm_sewage], g->turn) );
it->put_in( item(g->itypes["sewage"], g->turn) );
found_item = true;
}
}
if (!found_item) {
item sewage(g->itypes[itm_sewage], g->turn);
item sewage(g->itypes["sewage"], g->turn);
g->m.add_item(x1, y1, sewage);
}
}
@@ -467,14 +467,14 @@ void computer::activate_function(game *g, computer_action action)
for (int i = 0; i < names.size(); i++)
print_line(names[i].c_str());
if (more > 0)
print_line("%d OTHERS FOUND...");
print_line("%d OTHERS FOUND...", more);
} break;
case COMPACT_ELEVATOR_ON:
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_elevator_control_off)
g->m.ter(x, y) = t_elevator_control;
g->m.ter_set(x, y, t_elevator_control);
}
}
print_line("Elevator activated.");
@@ -579,7 +579,7 @@ of pureed bone & LSD.");
break;
case COMPACT_DOWNLOAD_SOFTWARE:
if (!g->u.has_amount(itm_usb_drive, 1))
if (!g->u.has_amount("usb_drive", 1))
print_error("USB drive required!");
else {
mission *miss = g->find_mission(mission_id);
@@ -604,11 +604,11 @@ of pureed bone & LSD.");
print_error("ERROR: Please place sample in centrifuge.");
else if (g->m.i_at(x, y).size() > 1)
print_error("ERROR: Please remove all but one sample from centrifuge.");
else if (g->m.i_at(x, y)[0].type->id != itm_vacutainer)
else if (g->m.i_at(x, y)[0].type->id != "vacutainer")
print_error("ERROR: Please use vacutainer-contained samples.");
else if (g->m.i_at(x, y)[0].contents.empty())
print_error("ERROR: Vacutainer empty.");
else if (g->m.i_at(x, y)[0].contents[0].type->id != itm_blood)
else if (g->m.i_at(x, y)[0].contents[0].type->id != "blood")
print_error("ERROR: Please only use blood samples.");
else { // Success!
item *blood = &(g->m.i_at(x, y)[0].contents[0]);
@@ -618,10 +618,10 @@ of pureed bone & LSD.");
print_line("Result: Human blood. Unknown pathogen found.");
print_line("Pathogen bonded to erythrocytes and leukocytes.");
if (query_bool("Download data?")) {
if (!g->u.has_amount(itm_usb_drive, 1))
if (!g->u.has_amount("usb_drive", 1))
print_error("USB drive required!");
else {
item software(g->itypes[itm_software_blood_data], 0);
item software(g->itypes["software_blood_data"], 0);
int index = g->u.pick_usb();
g->u.inv[index].contents.clear();
g->u.inv[index].put_in(software);
@@ -674,7 +674,7 @@ void computer::activate_failure(game *g, computer_failure fail)
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.has_flag(console, x, y))
g->m.ter(x, y) = t_console_broken;
g->m.ter_set(x, y, t_console_broken);
}
}
break;
@@ -731,7 +731,7 @@ void computer::activate_failure(game *g, computer_failure fail)
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_sewage_pump) {
g->m.ter(x, y) = t_rubble;
g->m.ter_set(x, y, t_rubble);
g->explosion(x, y, 10, 0, false);
}
}
@@ -760,7 +760,7 @@ void computer::activate_failure(game *g, computer_failure fail)
i = leak_size;
else {
p = next_move[rng(0, next_move.size() - 1)];
g->m.ter(p.x, p.y) = t_sewage;
g->m.ter_set(p.x, p.y, t_sewage);
}
}
}
@@ -785,11 +785,11 @@ void computer::activate_failure(game *g, computer_failure fail)
print_error("ERROR: Please place sample in centrifuge.");
else if (g->m.i_at(x, y).size() > 1)
print_error("ERROR: Please remove all but one sample from centrifuge.");
else if (g->m.i_at(x, y)[0].type->id != itm_vacutainer)
else if (g->m.i_at(x, y)[0].type->id != "vacutainer")
print_error("ERROR: Please use vacutainer-contained samples.");
else if (g->m.i_at(x, y)[0].contents.empty())
print_error("ERROR: Vacutainer empty.");
else if (g->m.i_at(x, y)[0].contents[0].type->id != itm_blood)
else if (g->m.i_at(x, y)[0].contents[0].type->id != "blood")
print_error("ERROR: Please only use blood samples.");
else {
print_error("ERROR: Blood sample destroyed.");
+253 -156
View File
@@ -22,12 +22,13 @@ void game::init_construction()
constructions.push_back( new constructable(id, name, difficulty, able, done))
#define STAGE(...)\
tl = 0; cl = 0; sl++; \
tl = -1; cl = -1; sl++; \
constructions[id]->stages.push_back(construction_stage(__VA_ARGS__));
#define TOOL(...) setvector(constructions[id]->stages[sl].tools[tl], \
__VA_ARGS__); tl++
#define COMP(...) setvector(constructions[id]->stages[sl].components[cl], \
__VA_ARGS__); cl++
#define TOOL(item) ++tl; constructions[id]->stages[sl].tools[tl].push_back(component(item, -1))
#define TOOLCONT(item) constructions[id]->stages[sl].tools[tl].push_back(component(item, -1))
#define COMP(item, amount) ++cl; constructions[id]->stages[sl].components[cl].push_back(component(item,amount))
#define COMPCONT(item, amount) constructions[id]->stages[sl].components[cl].push_back(component(item,amount))
/* CONSTRUCT( name, time, able, done )
* Name is the name as it appears in the menu; 30 characters or less, please.
@@ -42,27 +43,36 @@ void game::init_construction()
CONSTRUCT("Dig Pit", 0, &construct::able_dig, &construct::done_nothing);
STAGE(t_pit_shallow, 10);
TOOL(itm_shovel, itm_primitive_shovel, itm_digging_stick, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
TOOLCONT("digging_stick");
STAGE(t_pit, 10);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
CONSTRUCT("Spike Pit", 0, &construct::able_pit, &construct::done_nothing);
STAGE(t_pit_spiked, 5);
COMP(itm_spear_wood, 4, NULL);
COMP("spear_wood", 4);
CONSTRUCT("Fill Pit", 0, &construct::able_pit, &construct::done_nothing);
STAGE(t_pit_shallow, 5);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
STAGE(t_dirt, 5);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
CONSTRUCT("Chop Down Tree", 0, &construct::able_tree, &construct::done_tree);
STAGE(t_dirt, 10);
TOOL(itm_ax, itm_primitive_axe, itm_chainsaw_on, NULL);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
STAGE(t_dirt, 20);
TOOL(itm_ax, itm_primitive_axe, itm_chainsaw_on, NULL);
TOOL("ax");
TOOLCONT("primitive_axe");
TOOLCONT("chainsaw_on");
CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
STAGE(t_null, 1);
@@ -74,102 +84,143 @@ void game::init_construction()
/* CONSTRUCT("Remove Window Pane", 1, &construct::able_window_pane,
&construct::done_window_pane);
STAGE(t_window_empty, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_rock, itm_hatchet, NULL);
TOOL(itm_screwdriver, itm_knife_butter, itm_toolset, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("rock");
TOOLCONT("hatchet");
TOOL("screwdriver");
TOOLCONT("knife_butter");
TOOLCONT("toolset");
*/
CONSTRUCT("Repair Door", 1, &construct::able_door_broken,
&construct::done_nothing);
STAGE(t_door_c, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 3, NULL);
COMP(itm_nail, 12, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 3);
COMP("nail", 12);
CONSTRUCT("Board Up Door", 0, &construct::able_door, &construct::done_nothing);
STAGE(t_door_boarded, 8);
TOOL(itm_hammer, itm_hammer_sledge, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 8, NULL);
TOOL("hammer");
TOOLCONT("hammer_sledge");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 4);
COMP("nail", 8);
CONSTRUCT("Board Up Window", 0, &construct::able_window,
&construct::done_nothing);
STAGE(t_window_boarded, 5);
TOOL(itm_hammer, itm_hammer_sledge, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 8, NULL);
TOOL("hammer");
TOOLCONT("hammer_sledge");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 4);
COMP("nail", 8);
CONSTRUCT("Build Wall", 2, &construct::able_empty, &construct::done_nothing);
STAGE(t_wall_half, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_nail, 20, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 10);
COMP("nail", 20);
STAGE(t_wall_wood, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_nail, 20, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 10);
COMP("nail", 20);
CONSTRUCT("Build Log Wall", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_wall_log_half, 20);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_stick, 3, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
COMP("log", 2);
COMP("stick", 3);
STAGE(t_wall_log, 20);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_stick, 3, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
COMP("log", 2);
COMP("stick", 3);
CONSTRUCT("Build Palisade Wall", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_palisade, 20);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
COMP(itm_log, 3, NULL);
COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
COMP("log", 3);
COMP("rope_30", 1);
COMPCONT("rope_6", 5);
CONSTRUCT("Build Rope and Pulley System", 2, &construct::able_empty, &construct::done_nothing);
STAGE(t_palisade_pulley, 0);
COMP(itm_rope_30, 1, NULL);
COMP(itm_stick, 8, itm_2x4, 8, NULL);
COMP("rope_30", 1);
COMP("stick", 8);
COMPCONT("2x4", 8);
CONSTRUCT("Build Palisade Gate", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_palisade_gate, 20);
TOOL(itm_shovel, itm_primitive_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_2x4, 3, NULL);
COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);
TOOL("shovel");
TOOLCONT("primitive_shovel");
COMP("log", 2);
COMP("2x4", 3);
COMP("rope_30", 1);
COMPCONT("rope_6", 5);
CONSTRUCT("Build Window", 2, &construct::able_empty,
CONSTRUCT("Build Window", 2, &construct::able_make_window,
&construct::done_nothing);
STAGE(t_window_empty, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 15, itm_log, 2, NULL);
COMP(itm_nail, 30, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 15);
COMPCONT("log", 2);
COMP("nail", 30);
STAGE(t_window, 5);
COMP(itm_glass_sheet, 1, NULL);
COMP("glass_sheet", 1);
STAGE(t_window_domestic, 5);
TOOL(itm_saw, NULL);
COMP(itm_nail, 4, NULL);
COMP(itm_sheet, 2, NULL);
COMP(itm_stick, 1, NULL);
TOOL("saw");
COMP("nail", 4);
COMP("sheet", 2);
COMP("stick", 1);
CONSTRUCT("Build Door", 2, &construct::able_empty,
&construct::done_nothing);
STAGE(t_door_frame, 15);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 12, NULL);
COMP(itm_nail, 24, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 12);
COMP("nail", 24);
STAGE(t_door_c, 15);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 12, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 4);
COMP("nail", 12);
CONSTRUCT("Build Wire Fence",3, &construct::able_dig,
&construct::done_nothing);
STAGE(t_chainfence_posts, 20);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_rock, NULL);
COMP(itm_pipe, 6, NULL);
COMP(itm_scrap, 8, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("rock");
COMP("pipe", 6);
COMP("scrap", 8);
STAGE(t_chainfence_v, 20);
COMP(itm_wire, 15, NULL);
COMP("wire", 15);
CONSTRUCT("Realign Fence", 0, &construct::able_chainlink,
&construct::done_nothing);
@@ -179,86 +230,124 @@ void game::init_construction()
CONSTRUCT("Build Wire Gate", 3, &construct::able_between_walls,
&construct::done_nothing);
STAGE(t_chaingate_c, 15);
COMP(itm_wire, 20, NULL);
COMP(itm_steel_chunk, 3, itm_scrap, 12, NULL);
COMP(itm_pipe, 6, NULL);
COMP("wire", 20);
COMP("steel_chunk", 3);
COMPCONT("scrap", 12);
COMP("pipe", 6);
/* Removed until we have some way of auto-aligning fences!
CONSTRUCT("Build Fence", 1, 15, &construct::able_empty);
STAGE(t_fence_h, 10);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, NULL);
COMP(itm_2x4, 5, itm_nail, 8, NULL);
*/
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
COMP("2x4", 5);
COMPCONT("nail", 8);
*/
CONSTRUCT("Build Roof", 3, &construct::able_between_walls,
&construct::done_nothing);
STAGE(t_floor, 40);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 8, NULL);
COMP(itm_nail, 40, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 8);
COMP("nail", 40);
// Base stuff
CONSTRUCT("Build Bulletin Board", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_bulletin, 10)
TOOL(itm_saw, NULL);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 8, NULL);
TOOL("saw");
TOOL("hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("2x4", 4);
COMP("nail", 8);
// Household stuff
CONSTRUCT("Build Dresser", 1, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_dresser, 20);
TOOL(itm_saw, NULL);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 6, NULL);
TOOL("saw");
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("nail", 8);
COMP("2x4", 6);
CONSTRUCT("Build Bookcase", 1, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_bookcase, 20);
TOOL(itm_saw, NULL);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 16, NULL);
COMP(itm_2x4, 12, NULL);
TOOL("saw");
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("nail", 16);
COMP("2x4", 12);
CONSTRUCT("Build Counter", 0, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_counter, 20);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 6, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("nail", 8);
COMP("2x4", 6);
CONSTRUCT("Build Makeshift Bed", 0, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_makeshift_bed, 20);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_sheet, 1, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
COMP("nail", 8);
COMP("2x4", 10);
COMP("sheet", 1);
CONSTRUCT("Tape up window", 0, &construct::able_window,
&construct::done_tape);
STAGE(t_null, 2);
COMP(itm_duct_tape, 50, NULL);
COMP("duct_tape", 50);
CONSTRUCT("Deconstruct Furniture", 0, &construct::able_deconstruct,
&construct::done_deconstruct);
STAGE(t_null, 20);
TOOL(itm_hammer, itm_primitive_hammer, itm_hatchet, itm_nailgun, NULL);
TOOL(itm_screwdriver, itm_toolset, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("hatchet");
TOOLCONT("nailgun");
TOOL("screwdriver");
TOOLCONT("toolset");
CONSTRUCT("Start vehicle construction", 0, &construct::able_empty, &construct::done_vehicle);
STAGE(t_null, 10);
COMP(itm_frame, 1, NULL);
COMP("frame", 1);
CONSTRUCT("Fence Posts", 0, &construct::able_dig,
&construct::done_nothing);
STAGE(t_fence_post, 5);
TOOL(itm_hammer, itm_primitive_hammer, itm_shovel, itm_primitive_shovel, itm_rock, itm_hatchet, itm_ax, itm_primitive_axe, NULL);
COMP(itm_spear_wood, 2, NULL);
TOOL("hammer");
TOOLCONT("primitive_hammer");
TOOLCONT("shovel");
TOOLCONT("primitive_shovel");
TOOLCONT("rock");
TOOLCONT("hatchet");
TOOLCONT("ax");
TOOLCONT("primitive_axe");
COMP("spear_wood", 2);
CONSTRUCT("Build Wood Stove", 0, &construct::able_empty,
&construct::done_nothing);
STAGE(t_woodstove, 10);
TOOL("hacksaw");
COMP("metal_tank", 1);
COMP("pipe", 1);
}
void game::construction_menu()
@@ -347,7 +436,7 @@ void game::construction_menu()
posy++;
posx = 33;
for (int j = 0; j < stage.tools[i].size(); j++) {
itype_id tool = stage.tools[i][j];
itype_id tool = stage.tools[i][j].type;
nc_color col = c_red;
if (total_inv.has_amount(tool, 1)) {
has_tool[i] = true;
@@ -508,7 +597,7 @@ bool game::player_can_build(player &p, inventory inv, constructable* con,
tools_required = true;
has_tool = false;
for (int k = 0; k < stage.tools[j].size() && !has_tool; k++) {
if (inv.has_amount(stage.tools[j][k], 1))
if (inv.has_amount(stage.tools[j][k].type, 1))
has_tool = true;
}
if (!has_tool) // missing one of the tools for this stage
@@ -638,7 +727,7 @@ void game::complete_construction()
// Make the terrain change
int terx = u.activity.placement.x, tery = u.activity.placement.y;
if (stage.terrain != t_null)
m.ter(terx, tery) = stage.terrain;
m.ter_set(terx, tery, stage.terrain);
// Strip off the first stage in our list...
u.activity.values.erase(u.activity.values.begin());
@@ -677,10 +766,13 @@ bool construct::able_furniture(game *g, point p)
switch(g->m.ter(p.x, p.y)) {
case t_fridge:
case t_glass_fridge:
case t_oven:
case t_bathtub:
required_str = 10;
break;
case t_bookcase:
case t_locker:
case t_table:
required_str = 9;
break;
case t_dresser:
@@ -688,6 +780,7 @@ bool construct::able_furniture(game *g, point p)
case t_chair:
case t_armchair:
case t_bench:
case t_cupboard:
required_str = 8;
break;
default:
@@ -710,6 +803,10 @@ bool construct::able_window(game *g, point p)
g->m.ter(p.x, p.y) == t_window);
}
bool construct::able_make_window(game *g, point p)
{
return able_window(g, p) || able_empty(g, p);
}
bool construct::able_empty_window(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_window_empty);
@@ -771,12 +868,12 @@ bool construct::able_pit(game *g, point p)
bool construct::able_between_walls(game *g, point p)
{
return (g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x +1, p.y) ||
g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x, p.y +1) ||
g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x, p.y -1) ||
g->m.has_flag(supports_roof, p.x +1, p.y) && g->m.has_flag(supports_roof, p.x, p.y +1) ||
g->m.has_flag(supports_roof, p.x +1, p.y) && g->m.has_flag(supports_roof, p.x, p.y -1) ||
g->m.has_flag(supports_roof, p.x, p.y -1) && g->m.has_flag(supports_roof, p.x, p.y +1));
return ((g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x +1, p.y)) ||
(g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x, p.y +1)) ||
(g->m.has_flag(supports_roof, p.x -1, p.y) && g->m.has_flag(supports_roof, p.x, p.y -1)) ||
(g->m.has_flag(supports_roof, p.x +1, p.y) && g->m.has_flag(supports_roof, p.x, p.y +1)) ||
(g->m.has_flag(supports_roof, p.x +1, p.y) && g->m.has_flag(supports_roof, p.x, p.y -1)) ||
(g->m.has_flag(supports_roof, p.x, p.y -1) && g->m.has_flag(supports_roof, p.x, p.y +1)));
}
bool construct::able_deconstruct(game *g, point p)
@@ -786,7 +883,7 @@ bool construct::able_deconstruct(game *g, point p)
void construct::done_window_pane(game *g, point p)
{
g->m.add_item(g->u.posx, g->u.posy, g->itypes[itm_glass_sheet], 0);
g->m.spawn_item(g->u.posx, g->u.posy, g->itypes["glass_sheet"], 0);
}
void construct::done_furniture(game *g, point p)
@@ -809,8 +906,8 @@ void construct::done_furniture(game *g, point p)
break;
}
g->m.ter(x, y) = g->m.ter(p.x, p.y);
g->m.ter(p.x, p.y) = t_floor;
g->m.ter_set(x, y, g->m.ter(p.x, p.y));
g->m.ter_set(p.x, p.y, t_floor);
//Move all Items within a container
std::vector <item> vItemMove = g->m.i_at(p.x, p.y);
@@ -832,13 +929,13 @@ 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(tree[i].x, tree[i].y) = t_log;
g->m.ter_set(tree[i].x, tree[i].y, t_log);
}
}
void construct::done_log(game *g, point p)
{
g->m.add_item(p.x, p.y, g->itypes[itm_log], int(g->turn), rng(5, 15));
g->m.spawn_item(p.x, p.y, g->itypes["log"], int(g->turn), rng(5, 15));
}
@@ -861,13 +958,13 @@ void construct::done_tape(game *g, point p)
switch (g->m.ter(p.x, p.y))
{
case t_window_alarm:
g->m.ter(p.x, p.y) = t_window_alarm_taped;
g->m.ter_set(p.x, p.y, t_window_alarm_taped);
case t_window_domestic:
g->m.ter(p.x, p.y) = t_window_domestic_taped;
g->m.ter_set(p.x, p.y, t_window_domestic_taped);
case t_window:
g->m.ter(p.x, p.y) = t_window_taped;
g->m.ter_set(p.x, p.y, t_window_taped);
}
}
@@ -880,91 +977,91 @@ void construct::done_deconstruct(game *g, point p)
case t_makeshift_bed:
case t_bed:
case t_armchair:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 9);
g->m.add_item(p.x, p.y, g->itypes[itm_rag], 0, 9);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,8));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 9);
g->m.spawn_item(p.x, p.y, g->itypes["rag"], 0, 9);
g->m.spawn_item(p.x, p.y, g->itypes["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.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 3);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,12));
g->m.ter(p.x, p.y) = t_door_frame;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 3);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_door_frame);
break;
case t_window_domestic:
g->m.add_item(p.x, p.y, g->itypes[itm_stick], 0);
g->m.add_item(p.x, p.y, g->itypes[itm_sheet], 0, 1);
g->m.add_item(p.x, p.y, g->itypes[itm_glass_sheet], 0);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, 3);
g->m.ter(p.x, p.y) = t_window_empty;
g->m.spawn_item(p.x, p.y, g->itypes["stick"], 0);
g->m.spawn_item(p.x, p.y, g->itypes["sheet"], 0, 1);
g->m.spawn_item(p.x, p.y, g->itypes["glass_sheet"], 0);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, 3);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_window:
g->m.add_item(p.x, p.y, g->itypes[itm_glass_sheet], 0);
g->m.ter(p.x, p.y) = t_window_empty;
g->m.spawn_item(p.x, p.y, g->itypes["glass_sheet"], 0);
g->m.ter_set(p.x, p.y, t_window_empty);
break;
case t_backboard:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 4);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,10));
g->m.ter(p.x, p.y) = t_pavement;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 4);
g->m.spawn_item(p.x, p.y, g->itypes["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.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 4);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,10));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 4);
g->m.spawn_item(p.x, p.y, g->itypes["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:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 4);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,10));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 4);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_slide:
g->m.add_item(p.x, p.y, g->itypes[itm_sheet_metal], 3);
g->m.add_item(p.x, p.y, g->itypes[itm_pipe], 0, rng(4,8));
g->m.ter(p.x, p.y) = t_grass;
g->m.spawn_item(p.x, p.y, g->itypes["steel_plate"], 0);
g->m.spawn_item(p.x, p.y, g->itypes["pipe"], 0, rng(4,8));
g->m.ter_set(p.x, p.y, t_grass);
break;
case t_rack:
case t_monkey_bars:
g->m.add_item(p.x, p.y, g->itypes[itm_pipe], 0, rng(6,12));
g->m.ter(p.x, p.y) = t_grass;
g->m.spawn_item(p.x, p.y, g->itypes["pipe"], 0, rng(6,12));
g->m.ter_set(p.x, p.y, t_grass);
break;
case t_fridge:
g->m.add_item(p.x, p.y, g->itypes[itm_scrap], 0, rng(2,6));
g->m.add_item(p.x, p.y, g->itypes[itm_steel_chunk], 0, rng(2,3));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["scrap"], 0, rng(2,6));
g->m.spawn_item(p.x, p.y, g->itypes["steel_chunk"], 0, rng(2,3));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_counter:
case t_dresser:
case t_table:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 6);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,8));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 6);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, rng(6,8));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_pool_table:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 4);
g->m.add_item(p.x, p.y, g->itypes[itm_rag], 0, 4);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(6,10));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 4);
g->m.spawn_item(p.x, p.y, g->itypes["rag"], 0, 4);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, rng(6,10));
g->m.ter_set(p.x, p.y, t_floor);
break;
case t_bookcase:
g->m.add_item(p.x, p.y, g->itypes[itm_2x4], 0, 12);
g->m.add_item(p.x, p.y, g->itypes[itm_nail], 0, rng(12,16));
g->m.ter(p.x, p.y) = t_floor;
g->m.spawn_item(p.x, p.y, g->itypes["2x4"], 0, 12);
g->m.spawn_item(p.x, p.y, g->itypes["nail"], 0, 0, rng(12,16));
g->m.ter_set(p.x, p.y, t_floor);
break;
}
+2 -1
View File
@@ -8,7 +8,7 @@ struct construction_stage
{
ter_id terrain;
int time; // In minutes, i.e. 10 turns
std::vector<itype_id> tools[3];
std::vector<component> tools[3];
std::vector<component> components[3];
construction_stage(ter_id Terrain, int Time) :
@@ -39,6 +39,7 @@ struct construct // Construction functions.
bool able_empty (game *, point); // Able if tile is empty
bool able_window(game *, point); // Any window tile
bool able_make_window(game *, point); // Any window tile or empty
bool able_empty_window(game *, point); // Empty window tiles
bool able_window_pane(game *, point); // Only intact windows
bool able_broken_window(game *, point); // Able if tile is broken window
+2412 -1593
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -27,7 +27,7 @@ struct component
{
itype_id type;
int count;
component() { type = itm_null; count = 0; }
component() { type = "null"; count = 0; }
component(itype_id TYPE, int COUNT) : type (TYPE), count (COUNT) {}
};
@@ -46,7 +46,7 @@ struct recipe {
recipe() {
id = 0;
result = itm_null;
result = "null";
category = CC_NULL;
sk_primary = NULL;
sk_secondary = NULL;
+37
View File
@@ -1,4 +1,41 @@
Changelog will be a little light for the early entries due to me being really bad at documenting things.
0.4
Make the battery system bionic only consume as many batteries as necessary to fully power yourself
Knives can also cauterize wounds now. Requires a lighter.
Soldering irons (and hotplates, why not) can be used to cauterize wounds, causing pain and removing any bleeding or uninfected bite effects.
Fixed crash bug in Windows when attacks hit something off-screen?
Fixed precipitation animation with shifted viewport.
Can now disassemble items from the examination screen.
Added colored hinting to the item examination sidebar listing possible actions. e.g., "W" (for "wear") is grayed out if the item isn't wearable.
Added ability to craft a recipe continuously (until out of materials, etc.).
Reduce (maybe fully fix) wolf self-attacks.
Power armor.
More fitted gear, and a few more pieces made craftable.
Vehicle-mountable water tanks and kitchen units, implied storage-battery-charging generators.
Map tiles can now contain up to 64 items.
Beer has been made weaker, and now appears in kegs in liquor stores and bars.
Steel jerrycans.
Any gun can now be used one-handed if you are strong enough.
Hardcoded frostbite not to occur above freezing temperatures.
Improved fire's ability to warm the player. Also, standing on fire and being on fire warm up the player.
Fixed body temperature equalization.
Sunny and clear weather no longer warm the player underground.
Standing in water or sewage will increase the rate of heat loss (but not make the player colder)
The head and torso now lose heat faster than other body parts.
Body temperature drops as you lose HP.
Encumberance menu's listing of warmth has been made more colorful.
Mouth (face) now has appropriate cold and hot diseases.
The ability to cauterize wounds to heal bites and stop bleeding. (a)ctivate a knife, requires a lighter.
The ability to craft an item as many times as is possible. Defaults to the + key. (Linux and Mac users will need to assign a key)
Added M72-LAW. Makes a large explosion and penetrates armour well. One shot only.
Clothing can be made fitted by (a)pplying a sewing kit.
Some foods can be heated, hot food grants a larger morale bonus than cold food.
Ammunition explodes rather than burning.
Lightstrips, function as weak light providers. Craftable.
Bandages and First Aid kits no longer show uninjured bodyparts in the menu.
Some basic professions, more to be added later.
0.3
Many menus stretch with an enlarged viewport.
+1 -1
View File
@@ -13,4 +13,4 @@ BurnZeZ, Oddzball, Shades, Shoes01, Tase, GalenEvil
Contributors:
AkrionXxarr, Benjamg, Creidieki, Daftfad, Elricsfate, Gim,
GlyphGryph, Gremour, HerbertJones, hovatterz, Origamiwolf,
Uzername, Voker57, Wito
Soron, Uzername, Voker57, Wito
View File
View File
+18
View File
@@ -0,0 +1,18 @@
# This is the npc file for Cataclysm.
# You can start a line with # to make it a comment--it will be ignored.
# Blank lines are ignored too.
# Extra whitespace, including tab, is ignored, so format things how you like.
# If you wish to restore defaults, simply remove this file.
# This file currently has two options, disabling starting npcs and
# disabling randomly spawning npcs spawned by the dynamic spawn system
# Turning on the starting_npc setting only has effect on new character
# creation. None of these settings get rid of already spawned npcs. Use
# the debug menu for that.
# WARNING: NPC's are currently broken. When used expect bugs and crashes.
# You have been warned.
# None of these settings prevent you from spawning npcs using the debug menu.
starting_npc n
random_npc n
+7 -8
View File
@@ -26,7 +26,7 @@
{
"name" : "GROUP_BEE",
"default" : "mon_bee",
"monsters" : [
"monsters" : [
]
},
{
@@ -47,7 +47,7 @@
{ "monster" : "mon_skeleton", "freq" : 30 },
{ "monster" : "mon_zombie_smoker", "freq" : 30 },
{ "monster" : "mon_zombie_shrieker", "freq" : 30 },
{ "monster" : "mon_zombie_spitter", "freq" : 30 },
{ "monster" : "mon_zombie_spitter", "freq" : 30 },
{ "monster" : "mon_zombie_electric", "freq" : 30 },
{ "monster" : "mon_zombie_necro", "freq" : 1 },
{ "monster" : "mon_boomer", "freq" : 30 },
@@ -75,7 +75,6 @@
{ "monster" : "mon_zombie_fungus", "freq" : 300 },
{ "monster" : "mon_boomer_fungus", "freq" : 30 },
{ "monster" : "mon_spore", "freq" : 0 },
{ "monster" : "mon_fungaloid_queen", "freq" : 303 },
{ "monster" : "mon_fungal_wall", "freq" : 0 }
]
},
@@ -84,7 +83,7 @@
"name" : "GROUP_GOO",
"default" : "mon_blob",
"monsters" : [
{ "monster" : "mon_blob_small", "freq" : 200 }
{ "monster" : "mon_blob_small", "freq" : 200 }
]
},
{
@@ -92,7 +91,7 @@
"default" : "mon_chud",
"monsters" : [
{ "monster" : "mon_one_eye", "freq" : 90 },
{ "monster" : "mon_crawler", "freq" : 35 }
{ "monster" : "mon_crawler", "freq" : 35 }
]
},
{
@@ -198,14 +197,14 @@
"name" : "GROUP_HOUSE", "_comment" : "+15% child",
"default" : "mon_zombie",
"monsters" : [
{ "monster" : "mon_zombie_child", "freq" : 150 },
{ "monster" : "mon_zombie_child", "freq" : 150 },
{ "monster" : "mon_zombie_cop", "freq" : 20 },
{ "monster" : "mon_zombie_fast", "freq" : 70 },
{ "monster" : "mon_zombie_grabber", "freq" : 70 },
{ "monster" : "mon_skeleton", "freq" : 30 },
{ "monster" : "mon_zombie_smoker", "freq" : 30 },
{ "monster" : "mon_zombie_shrieker", "freq" : 30 },
{ "monster" : "mon_zombie_spitter", "freq" : 30 },
{ "monster" : "mon_zombie_spitter", "freq" : 30 },
{ "monster" : "mon_zombie_electric", "freq" : 30 },
{ "monster" : "mon_zombie_necro", "freq" : 1 },
{ "monster" : "mon_boomer", "freq" : 30 },
@@ -282,4 +281,4 @@
{ "monster" : "mon_zombie_soldier", "freq" : 50 }
]
}
]
]
+1
View File
@@ -91,6 +91,7 @@
{ "name" : "Diego", "gender" : "male", "usage" : "given" },
{ "name" : "Dominic", "gender" : "male", "usage" : "given" },
{ "name" : "Dylan", "gender" : "male", "usage" : "given" },
{ "name" : "Eben", "gender" : "male", "usage" : "given" },
{ "name" : "Edwards", "gender" : "unisex", "usage" : "family" },
{ "name" : "Eli", "gender" : "male", "usage" : "given" },
{ "name" : "Elijah", "gender" : "male", "usage" : "given" },
+37
View File
@@ -0,0 +1,37 @@
[
{
"ident": "unemployed",
"name": "Unemployed",
"description":
"They say you don't have any 'useful skills', but at least your clothes fit\nwell.",
"points": 0,
"items": ["jeans", "tshirt", "sneakers"]
},
{
"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.",
"points": 1,
"items": ["dress_shirt", "pants", "boots", "coat_lab", "gloves_rubber", "glasses_safety"]
},
{
"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.",
"points": 2,
"items": ["tank_top", "jeans", "beltrig", "wrench", "mag_cars", "manual_mechanics"]
},
{
"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.",
"points": -1,
"items": ["pants", "dress_shirt", "dress_shoes", "cig"]
}
]
+29 -29
View File
@@ -157,10 +157,10 @@ void defense_game::game_over(game *g)
void defense_game::init_itypes(game *g)
{
g->itypes[itm_2x4]->volume = 0;
g->itypes[itm_2x4]->weight = 0;
g->itypes[itm_landmine]->price = 300;
g->itypes[itm_bot_turret]->price = 6000;
g->itypes["2x4"]->volume = 0;
g->itypes["2x4"]->weight = 0;
g->itypes["landmine"]->price = 300;
g->itypes["bot_turret"]->price = 6000;
}
void defense_game::init_mtypes(game *g)
@@ -997,7 +997,7 @@ Press Enter to buy everything in your cart, Esc to buy nothing.");
for (int j = 0; j < item_count[0][i]; j++) {
if (g->u.volume_carried() + tmp.volume() <= g->u.volume_capacity() &&
g->u.weight_carried() + tmp.weight() <= g->u.weight_capacity() &&
g->u.inv.size() < 52)
g->u.inv.size() < inv_chars.size())
g->u.i_add(tmp);
else { // Could fit it in the inventory!
dropped_some = true;
@@ -1033,50 +1033,50 @@ std::vector<itype_id> caravan_items(caravan_category cat)
case CARAVAN_MELEE:
setvector(ret,
itm_hammer, itm_bat, itm_mace, itm_morningstar, itm_hammer_sledge, itm_hatchet,
itm_knife_combat, itm_rapier, itm_machete, itm_katana, itm_spear_knife,
itm_pike, itm_chainsaw_off, NULL);
"hammer", "bat", "mace", "morningstar", "hammer_sledge", "hatchet",
"knife_combat", "rapier", "machete", "katana", "spear_knife",
"pike", "chainsaw_off", NULL);
break;
case CARAVAN_GUNS:
setvector(ret,
itm_crossbow, itm_bolt_steel, itm_compbow, itm_arrow_cf, itm_marlin_9a,
itm_22_lr, itm_hk_mp5, itm_9mm, itm_taurus_38, itm_38_special, itm_deagle_44,
itm_44magnum, itm_m1911, itm_hk_ump45, itm_45_acp, itm_fn_p90, itm_57mm,
itm_remington_870, itm_shot_00, itm_shot_slug, itm_browning_blr, itm_3006,
itm_ak47, itm_762_m87, itm_m4a1, itm_556, itm_savage_111f, itm_hk_g3,
itm_762_51, itm_hk_g80, itm_12mm, itm_plasma_rifle, itm_plasma, NULL);
"crossbow", "bolt_steel", "compbow", "arrow_cf", "marlin_9a",
"22_lr", "hk_mp5", "9mm", "taurus_38", "38_special", "deagle_44",
"44magnum", "m1911", "hk_ump45", "45_acp", "fn_p90", "57mm",
"remington_870", "shot_00", "shot_slug", "browning_blr", "3006",
"ak47", "762_m87", "m4a1", "556", "savage_111f", "hk_g3",
"762_51", "hk_g80", "12mm", "plasma_rifle", "plasma", NULL);
break;
case CARAVAN_COMPONENTS:
setvector(ret,
itm_rag, itm_fur, itm_leather, itm_superglue, itm_string_36, itm_chain,
itm_processor, itm_RAM, itm_power_supply, itm_motor, itm_hose, itm_pot,
itm_2x4, itm_battery, itm_nail, itm_gasoline, NULL);
"rag", "fur", "leather", "superglue", "string_36", "chain",
"processor", "RAM", "power_supply", "motor", "hose", "pot",
"2x4", "battery", "nail", "gasoline", NULL);
break;
case CARAVAN_FOOD:
setvector(ret,
itm_1st_aid, itm_water, itm_energy_drink, itm_whiskey, itm_can_beans,
itm_mre_beef, itm_flour, itm_inhaler, itm_codeine, itm_oxycodone, itm_adderall,
itm_cig, itm_meth, itm_royal_jelly, itm_mutagen, itm_purifier, NULL);
"1st_aid", "water", "energy_drink", "whiskey", "can_beans",
"mre_beef", "flour", "inhaler", "codeine", "oxycodone", "adderall",
"cig", "meth", "royal_jelly", "mutagen", "purifier", NULL);
break;
case CARAVAN_CLOTHES:
setvector(ret,
itm_backpack, itm_vest, itm_trenchcoat, itm_jacket_leather, itm_kevlar,
itm_gloves_fingerless, itm_mask_filter, itm_mask_gas, itm_glasses_eye,
itm_glasses_safety, itm_goggles_ski, itm_goggles_nv, itm_helmet_ball,
itm_helmet_riot, NULL);
"backpack", "vest", "trenchcoat", "jacket_leather", "kevlar",
"gloves_fingerless", "mask_filter", "mask_gas", "glasses_eye",
"glasses_safety", "goggles_ski", "goggles_nv", "helmet_ball",
"helmet_riot", NULL);
break;
case CARAVAN_TOOLS:
setvector(ret,
itm_screwdriver, itm_wrench, itm_saw, itm_hacksaw, itm_lighter, itm_sewing_kit,
itm_scissors, itm_extinguisher, itm_flashlight, itm_hotplate,
itm_soldering_iron, itm_shovel, itm_jackhammer, itm_landmine, itm_teleporter,
itm_grenade, itm_flashbang, itm_EMPbomb, itm_smokebomb, itm_bot_manhack,
itm_bot_turret, itm_UPS_off, itm_mininuke, NULL);
"screwdriver", "wrench", "saw", "hacksaw", "lighter", "sewing_kit",
"scissors", "extinguisher", "flashlight", "hotplate",
"soldering_iron", "shovel", "jackhammer", "landmine", "teleporter",
"grenade", "flashbang", "EMPbomb", "smokebomb", "bot_manhack",
"bot_turret", "UPS_off", "mininuke", NULL);
break;
}
+58 -27
View File
@@ -117,6 +117,14 @@ void dis_effect(game *g, player &p, disease &dis)
}
break;
case DI_COLD_MOUTH:
switch (dis.intensity) {
case 3 : p.per_cur -= 3; if (!p.has_disease(DI_SLEEP) && one_in(200)) g->add_msg("Your face is stiff from the cold.");
case 2 : p.per_cur--;
case 1 : if (!p.has_disease(DI_SLEEP) && one_in(600)) g->add_msg("\"Brr.\"");
}
break;
case DI_COLD_TORSO:
switch (dis.intensity) {
case 3 : p.dex_cur -= 2; if (!p.has_disease(DI_SLEEP) && one_in(200)) g->add_msg("Your torso is burning up. You should remove some layers.");
@@ -131,15 +139,15 @@ void dis_effect(game *g, player &p, disease &dis)
case DI_COLD_ARMS:
switch (dis.intensity) {
case 3 : p.dex_cur -= 2;
case 2 : p.dex_cur--;
case 1 : if (!p.has_disease(DI_SLEEP) && one_in(600)) g->add_msg("Your arms are shivering.");
case 2 : p.dex_cur--; if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("Your arms are shivering.");
case 1 : if (!p.has_disease(DI_SLEEP) && one_in(600)) g->add_msg("Your arms have goosebumps.");
}
break;
case DI_COLD_HANDS:
switch (dis.intensity) {
case 3 : p.dex_cur -= 2;
case 2 : p.dex_cur -= 2;
case 2 : p.dex_cur -= 2; if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("Your hands are shivering.");
case 1 : if (!p.has_disease(DI_SLEEP) && one_in(600)) g->add_msg("\"Brr.\"");
}
break;
@@ -167,7 +175,7 @@ void dis_effect(game *g, player &p, disease &dis)
switch (dis.intensity) {
case 2 : p.dex_cur -= 3;
case 1 :
if (p.temp_cur[bp_mouth] > BODYTEMP_COLD && p.pain < 40) p.pain++;
if (p.temp_cur[bp_hands] > BODYTEMP_COLD && p.pain < 40) p.pain++;
if (!p.has_disease(DI_SLEEP) && one_in(200)) g->add_msg("Your hands feel numb.");
}
break;
@@ -176,7 +184,7 @@ void dis_effect(game *g, player &p, disease &dis)
switch (dis.intensity) {
case 2 : // -4 speed
case 1 :
if (p.temp_cur[bp_mouth] > BODYTEMP_COLD && p.pain < 40) p.pain++;
if (p.temp_cur[bp_feet] > BODYTEMP_COLD && p.pain < 40) p.pain++;
if (!p.has_disease(DI_SLEEP) && one_in(200)) g->add_msg("Your feet feel numb.");
}
break;
@@ -229,6 +237,15 @@ void dis_effect(game *g, player &p, disease &dis)
}
break;
case DI_HOT_MOUTH:
switch (dis.intensity) {
case 3 : p.thirst--;
if (p.pain < 50) p.pain++;
case 2 : p.thirst--;
case 1 : if (!p.has_disease(DI_SLEEP) && one_in(600)) g->add_msg("\"Phew, it's hot.\"");
}
break;
case DI_HOT_TORSO:
switch (dis.intensity) {
case 3 :
@@ -506,7 +523,7 @@ void dis_effect(game *g, player &p, disease &dis)
dis.duration = dice(3, 100);
}
}
if (int(g->turn) % 100 == 0 && !p.has_bionic(bio_recycler)) {
if (int(g->turn) % 100 == 0 && !p.has_bionic("bio_recycler")) {
// Hunger and thirst advance more slowly while we sleep.
p.hunger--;
p.thirst--;
@@ -901,7 +918,7 @@ void dis_effect(game *g, player &p, disease &dis)
tries < 10);
if (tries < 10) {
if (g->m.move_cost(x, y) == 0)
g->m.ter(x, y) = t_rubble;
g->m.ter_set(x, y, t_rubble);
beast.spawn(x, y);
g->z.push_back(beast);
if (g->u_see(x, y, junk)) {
@@ -963,7 +980,7 @@ void dis_effect(game *g, player &p, disease &dis)
tries < 10);
if (tries < 10) {
if (g->m.move_cost(x, y) == 0)
g->m.ter(x, y) = t_rubble;
g->m.ter_set(x, y, t_rubble);
beast.spawn(x, y);
g->z.push_back(beast);
if (g->u_see(x, y, junk)) {
@@ -1089,16 +1106,20 @@ void dis_effect(game *g, player &p, disease &dis)
} else if (dis.duration > 3600) { //Infection Symptoms 18 hours into infection
if (one_in(100)) {
if (!p.is_npc())
if (p.has_disease(DI_SLEEP)) {
p.rem_disease(DI_SLEEP);
g->add_msg("You wake up.");
g->add_msg("You feel terribly weak, standing up is nearly impossible.");
} else
g->add_msg("You can barely remain standing.");
p.vomit(g);
if(p.pain < 100)
p.pain++;
if (!p.is_npc()) {
if (p.has_disease(DI_SLEEP)) {
p.rem_disease(DI_SLEEP);
g->add_msg("You wake up.");
g->add_msg("You feel terribly weak, standing up is nearly impossible.");
} else {
g->add_msg("You can barely remain standing.");
}
}
p.vomit(g);
if(p.pain < 100)
{
p.pain++;
}
}
p.str_cur-= 2;
p.dex_cur-= 2;
@@ -1175,6 +1196,11 @@ std::string dis_name(disease dis)
case 1: return "Cold head";
case 2: return "Cold head!";
case 3: return "Freezing head!!";}
case DI_COLD_MOUTH:
switch (dis.intensity) {
case 1: return "Cold face";
case 2: return "Cold face!";
case 3: return "Freezing face!!";}
case DI_COLD_TORSO:
switch (dis.intensity) {
case 1: return "Cold torso";
@@ -1217,6 +1243,11 @@ std::string dis_name(disease dis)
case 1: return "Hot head";
case 2: return "Hot head!";
case 3: return "Scorching head!!";}
case DI_HOT_MOUTH:
switch (dis.intensity) {
case 1: return "Hot face";
case 2: return "Hot face!";
case 3: return "Scorching face!!";}
case DI_HOT_TORSO:
switch (dis.intensity) {
case 1: return "Hot torso";
@@ -1341,17 +1372,11 @@ std::string dis_description(disease dis)
case 2: return "Your head is very exposed to the cold. It is hard to concentrate.";
case 3: return "Your head is dangerously cold. Getting undressed sounds like a good idea.";}
case DI_COLD_EYES:
switch (dis.intensity) {
case 1: return "Your eyes are exposed to the cold.";
case 2: return "Your eyes are very exposed to the cold.";
case 3: return "Your eyes are dangerously cold.";}
case DI_COLD_MOUTH:
switch (dis.intensity) {
case 1: return "Your mouth is exposed to the cold.";
case 2: return "Your mouth is very exposed to the cold.";
case 3: return "Your mouth is dangerously cold.";}
case 1: return "Your face is exposed to the cold.";
case 2: return "Your face is very exposed to the cold.";
case 3: return "Your face is dangerously cold.";}
case DI_COLD_TORSO:
switch (dis.intensity) {
@@ -1415,6 +1440,12 @@ std::string dis_description(disease dis)
case 2: return "Your head is sweating from the heat. You feel nauseated. You have a headache.";
case 3: return "Your head is sweating profusely. You feel very nauseated. You have a headache.";}
case DI_HOT_MOUTH:
switch (dis.intensity) {
case 1: return "Your face feels warm.";
case 2: return "Your face is sweating from the heat, making it hard to see.";
case 3: return "Your face is sweating profusely, making it hard to see.";}
case DI_HOT_TORSO:
switch (dis.intensity) {
case 1: return "Your torso feels warm.";
+3 -3
View File
@@ -113,7 +113,7 @@ void event::actualize(game *g)
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_root_wall && one_in(3))
g->m.ter(x, y) = t_underbrush;
g->m.ter_set(x, y, t_underbrush);
}
}
break;
@@ -123,7 +123,7 @@ void event::actualize(game *g)
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_grate) {
g->m.ter(x, y) = t_stairs_down;
g->m.ter_set(x, y, t_stairs_down);
int j;
if (!saw_grate && g->u_see(x, y, j))
saw_grate = true;
@@ -185,7 +185,7 @@ void event::actualize(game *g)
// flood_buf is filled with correct tiles; now copy them back to g->m
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++)
g->m.ter(x, y) = flood_buf[x][y];
g->m.ter_set(x, y, flood_buf[x][y]);
}
g->add_event(EVENT_TEMPLE_FLOOD, int(g->turn) + rng(2, 3));
} break;
+58 -43
View File
@@ -91,11 +91,12 @@ bool map::process_fields_in_submap(game *g, int gridn)
if (it->is_ammo() && it->ammo_type() != AT_BATT &&
it->ammo_type() != AT_NAIL && it->ammo_type() != AT_BB &&
it->ammo_type() != AT_BOLT && it->ammo_type() != AT_ARROW && it->ammo_type() != AT_NULL) {
cur->age /= 2;
cur->age -= 600;
destroyed = true;
smoke += 6;
consumed++;
// cook off ammo instead of just burning it.
for(int i = 0; i < (it->charges / 10) + 1; i++)
{
g->explosion(x, y, (dynamic_cast<it_ammo*>(it->type))->damage / 2, true, false);
}
} else if (it->made_of(PAPER)) {
destroyed = it->burn(cur->density * 3);
@@ -139,21 +140,16 @@ bool map::process_fields_in_submap(game *g, int gridn)
}
} else if (it->made_of(LIQUID)) {
switch (it->type->id) { // TODO: Make this be not a hack.
case itm_whiskey:
case itm_vodka:
case itm_rum:
case itm_tequila:
cur->age -= 300;
smoke += 6;
break;
default:
cur->age += rng(80 * vol, 300 * vol);
smoke++;
if(it->type->id == "tequila" || it->type->id == "whiskey" ||
it->type->id == "vodka" || it->type->id == "rum") {
cur->age -= 300;
smoke += 6;
} else {
cur->age += rng(80 * vol, 300 * vol);
smoke++;
}
destroyed = true;
consumed++;
} else if (it->made_of(POWDER)) {
cur->age -= vol;
destroyed = true;
@@ -180,10 +176,10 @@ bool map::process_fields_in_submap(game *g, int gridn)
if (veh)
veh->damage (part, cur->density * 10, false);
// If the flames are in a brazier, they're fully contained, so skip consuming terrain
if(tr_brazier != tr_at(x, y)) {
if((tr_brazier != tr_at(x, y))&&(has_flag(fire_container, x, y) != TRUE )) {
// Consume the terrain we're on
if (has_flag(explodes, x, y)) {
ter(x, y) = ter_id(int(ter(x, y)) + 1);
ter_set(x, y, ter_id(int(ter(x, y)) + 1));
cur->age = 0;
cur->density = 3;
g->explosion(x, y, 40, 0, true);
@@ -198,7 +194,7 @@ bool map::process_fields_in_submap(game *g, int gridn)
cur->age -= cur->density * cur->density * 40;
smoke += 15;
if (cur->density == 3)
ter(x, y) = t_ash;
ter_set(x, y, t_ash);
} else if (has_flag(l_flammable, x, y) && one_in(62 - cur->density * 10)) {
cur->age -= cur->density * cur->density * 30;
@@ -219,7 +215,8 @@ bool map::process_fields_in_submap(game *g, int gridn)
// If the flames are in a pit, it can't spread to non-pit
bool in_pit = (ter(x, y) == t_pit);
// If the flames are REALLY big, they contribute to adjacent flames
if (cur->density == 3 && cur->age < 0 && tr_brazier != tr_at(x, y)) {
if (cur->density == 3 && cur->age < 0 && tr_brazier != tr_at(x, y)
&& (has_flag(fire_container, x, y) != TRUE ) ){
// Randomly offset our x/y shifts by 0-2, to randomly pick a square to spread to
int starti = rng(0, 2);
int startj = rng(0, 2);
@@ -247,11 +244,12 @@ bool map::process_fields_in_submap(game *g, int gridn)
if (field_at(fx, fy).type == fd_web)
spread_chance = 50 + spread_chance / 2;
if (has_flag(explodes, fx, fy) && one_in(8 - cur->density) &&
tr_brazier != tr_at(x, y)) {
ter(fx, fy) = ter_id(int(ter(fx, fy)) + 1);
tr_brazier != tr_at(x, y) && (has_flag(fire_container, x, y) != TRUE ) ) {
ter_set(fx, fy, ter_id(int(ter(fx, fy)) + 1));
g->explosion(fx, fy, 40, 0, true);
} else if ((i != 0 || j != 0) && rng(1, 100) < spread_chance &&
tr_brazier != tr_at(x, y) &&
(has_flag(fire_container, x, y) != TRUE )&&
(in_pit == (ter(fx, fy) == t_pit)) &&
((cur->density == 3 &&
(has_flag(flammable, fx, fy) || one_in(20))) ||
@@ -278,7 +276,8 @@ bool map::process_fields_in_submap(game *g, int gridn)
// If we're not spreading, maybe we'll stick out some smoke, huh?
if (move_cost(fx, fy) > 0 &&
(!one_in(smoke) || (nosmoke && one_in(40))) &&
rng(3, 35) < cur->density * 10 && cur->age < 1000) {
rng(3, 35) < cur->density * 10 && cur->age < 1000 &&
(has_flag(suppress_smoke, x, y) != TRUE )) {
smoke--;
add_field(g, fx, fy, fd_smoke, rng(1, cur->density));
}
@@ -539,7 +538,7 @@ bool map::process_fields_in_submap(game *g, int gridn)
case fd_push_items: {
std::vector<item> *it = &(i_at(x, y));
for (int i = 0; i < it->size(); i++) {
if ((*it)[i].type->id != itm_rock || (*it)[i].bday >= int(g->turn) - 1)
if ((*it)[i].type->id != "rock" || (*it)[i].bday >= int(g->turn) - 1)
i++;
else {
item tmp = (*it)[i];
@@ -712,11 +711,17 @@ void map::step_in_field(int x, int y, game *g)
case fd_fire:
adjusted_intensity = cur->density;
if( g->u.in_vehicle )
if( inside )
adjusted_intensity -= 2;
else
adjusted_intensity -= 1;
if (!g->u.has_active_bionic(bio_heatsink)) {
{
if( inside )
{
adjusted_intensity -= 2;
}
else
{
adjusted_intensity -= 1;
}
}
if (!g->u.has_active_bionic("bio_heatsink")) {
if (adjusted_intensity == 1) {
g->add_msg("You burn your legs and feet!");
g->u.hit(g, bp_feet, 0, 0, rng(2, 6));
@@ -743,23 +748,33 @@ void map::step_in_field(int x, int y, game *g)
break;
case fd_smoke:
if (cur->density == 3 && !inside)
g->u.infect(DI_SMOKE, bp_mouth, 4, 15, g);
break;
if (cur->density == 3 && !inside)
{
g->u.infect(DI_SMOKE, bp_mouth, 4, 15, g);
}
break;
case fd_tear_gas:
if ((cur->density > 1 || !one_in(3)) && !inside || inside && one_in(3))
g->u.infect(DI_TEARGAS, bp_mouth, 5, 20, g);
if (cur->density > 1 && !inside || inside && one_in(3))
g->u.infect(DI_BLIND, bp_eyes, cur->density * 2, 10, g);
break;
if ((cur->density > 1 || !one_in(3)) && (!inside || (inside && one_in(3))))
{
g->u.infect(DI_TEARGAS, bp_mouth, 5, 20, g);
}
if (cur->density > 1 && (!inside || (inside && one_in(3))))
{
g->u.infect(DI_BLIND, bp_eyes, cur->density * 2, 10, g);
}
break;
case fd_toxic_gas:
if (cur->density == 2 && !inside || cur->density == 3 && inside )
g->u.infect(DI_POISON, bp_mouth, 5, 30, g);
else if (cur->density == 3 && !inside)
g->u.infect(DI_BADPOISON, bp_mouth, 5, 30, g);
break;
if (cur->density == 2 && (!inside || (cur->density == 3 && inside)))
{
g->u.infect(DI_POISON, bp_mouth, 5, 30, g);
}
else if (cur->density == 3 && !inside)
{
g->u.infect(DI_BADPOISON, bp_mouth, 5, 30, g);
}
break;
case fd_nuke_gas:
g->u.radiation += rng(0, cur->density * (cur->density + 1));
@@ -771,7 +786,7 @@ void map::step_in_field(int x, int y, game *g)
case fd_flame_burst:
if (inside) break;
if (!g->u.has_active_bionic(bio_heatsink)) {
if (!g->u.has_active_bionic("bio_heatsink")) {
g->add_msg("You're torched by flames!");
g->u.hit(g, bp_legs, 0, 0, rng(2, 6));
g->u.hit(g, bp_legs, 1, 0, rng(2, 6));
+495 -817
View File
File diff suppressed because it is too large Load Diff
+27 -16
View File
@@ -180,7 +180,7 @@ class game
void nuke(int x, int y);
std::vector<faction *> factions_at(int x, int y);
int& scent(int x, int y);
float natural_light_level();
float natural_light_level() const;
unsigned char light_level();
void reset_light_level();
int assign_npc_id();
@@ -222,7 +222,7 @@ class game
bool has_gametype() const { return gamemode && gamemode->id() != SGAME_NULL; }
special_game_id gametype() const { return (gamemode) ? gamemode->id() : SGAME_NULL; }
std::vector <itype*> itypes;
std::map<std::string, itype*> itypes;
std::vector <mtype*> mtypes;
std::vector <vehicle*> vtypes;
std::vector <trap*> traps;
@@ -241,7 +241,6 @@ class game
char nextinv; // Determines which letter the next inv item will have
overmap cur_om;
map m;
light_map lm;
int levx, levy, levz; // Placement inside the overmap
player u;
std::vector<monster> z;
@@ -255,7 +254,8 @@ class game
std::vector<item> items_dragged;
int weight_dragged; // Computed once, when you start dragging
bool debugmon;
bool no_npc;
bool starting_npc;
bool random_npc;
std::map<int, std::map<int, bool> > mapRain;
@@ -269,6 +269,10 @@ class game
WINDOW *w_void; //space unter status if viewport Y > 12
overmap *om_hori, *om_vert, *om_diag; // Adjacent overmaps
bool handle_liquid(item &liquid, bool from_ground, bool infinite);
void open_gate( game *g, const int examx, const int examy, const enum ter_id handle_type );
private:
// Game-start procedures
bool opening_screen();// Warn about screen size, then present the main menu
@@ -281,6 +285,7 @@ class game
// Data Initialization
void init_itypes(); // Initializes item types
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
@@ -293,7 +298,10 @@ class game
void init_vehicles(); // Initializes vehicle types
void init_autosave(); // Initializes autosave parameters
std::string default_npc_txt(); //load the default settings for the npc.txt file
void load_keyboard_settings(); // Load keybindings from disk
void load_npc_settings(); //load npc settings from disk
void save_keymap(); // Save keybindings to disk
std::vector<char> keys_bound_to(action_id act); // All keys bound to act
void clear_bindings(action_id act); // Deletes all keys bound to act
@@ -312,18 +320,21 @@ class game
void open(); // Open a door 'o'
void close(); // Close a door 'c'
void smash(); // Smash terrain
void craft(); // See crafting.cpp
void recraft(); // See crafting.cpp
void try_and_make(recipe *r);
bool can_make(recipe *r);
void make_craft(recipe *making); // See crafting.cpp
void complete_craft(); // See crafting.cpp
void craft(); // See crafting.cpp
void recraft(); // See crafting.cpp
void long_craft(); // See crafting.cpp
bool crafting_allowed(); // See crafting.cpp
recipe* select_crafting_recipe(); // See crafting.cpp
bool making_would_work(recipe *r); // See crafting.cpp
bool can_make(recipe *r); // See crafting.cpp
void make_craft(recipe *making); // See crafting.cpp
void make_all_craft(recipe *making); // See crafting.cpp
void complete_craft(); // See crafting.cpp
void pick_recipes(std::vector<recipe*> &current,
std::vector<bool> &available, craft_cat tab);// crafting.cpp
void disassemble(); // See crafting.cpp
void disassemble_item(recipe *dis); // See crafting.cpp
void complete_disassemble(); // See crafting.cpp
void construction_menu(); // See construction.cpp
std::vector<bool> &available, craft_cat tab,std::string filter);// crafting.cpp
void disassemble(char ch = 0); // See crafting.cpp
void complete_disassemble(); // See crafting.cpp
void construction_menu(); // See construction.cpp
bool player_can_build(player &p, inventory inv, constructable* con,
const int level = -1, bool cont = false,
bool exact_level=false);
@@ -337,7 +348,7 @@ class game
void exam_vehicle(vehicle &veh, int examx, int examy, int cx=0, int cy=0);
void pickup(int posx, int posy, int min);// Pickup items; ',' or via examine()
// Pick where to put liquid; false if it's left where it was
bool handle_liquid(item &liquid, bool from_ground, bool infinite);
void compare(int iCompareX = -999, int iCompareY = -999); // Compare two Items 'I'
void drop(char chInput = '.'); // Drop an item 'd'
void drop_in_direction(); // Drop w/ direction 'D'
+3 -2
View File
@@ -401,8 +401,9 @@ but you will absorb the excess.\n\
Swarms of monsters may call for firearms. If you find one, wield it first,\n\
then reload by pressing 'r'. If you wish to change ammo, you must unload the\n\
weapon by pressing 'U', then reload again. To fire, press 'f', move the\n\
cursor to the relevant space, then hit '.' or 'f'. Some guns have automatic\n\
fire; to shoot a burst, press 'F'. This will severely reduce accuracy.\n\
cursor to the relevant space, then hit '.' or 'f'. Some guns have alternate\n\
firing modes, such as burst fire; to cycle modes, press 'F'. Firing\n\
continuously, especially in bursts, will severely reduce accuracy.\n\
\n\
Unlike most roguelikes, fleeing will often be your best option, especially\n\
when overwhelmed by a swarm of zombies. Try to avoid getting cornered inside\n\
+602
View File
@@ -0,0 +1,602 @@
//
// iexamine.cpp
// Cataclysm
//
// Livingstone
//
#include "iuse.h"
#include "game.h"
#include "mapdata.h"
#include "keypress.h"
#include "output.h"
#include "rng.h"
#include "line.h"
#include "player.h"
#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());
};
void iexamine::gaspump(game *g, player *p, map *m, int examx, int examy) {
if (!query_yn("Use the %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
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);
} else {
p->moves -= 300;
g->handle_liquid(gas, false, true);
}
if (one_in(50)) {
g->add_msg("With a clang and a shudder, the gas pump goes silent.");
m->ter_set(examx, examy, t_gas_pump_empty);
}
}
void iexamine::elevator(game *g, player *p, map *m, int examx, int examy){
if (!query_yn("Use the %s?",m->tername(examx, examy).c_str())) return;
int movez = (g->levz < 0 ? 2 : -2);
g->levz += movez;
m->load(g, g->levx, g->levy, g->levz);
g->update_map(p->posx, p->posy);
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (m->ter(x, y) == t_elevator) {
p->posx = x;
p->posy = y;
}
}
}
g->refresh_all();
}
void iexamine::controls_gate(game *g, player *p, map *m, int examx, int examy) {
if (!query_yn("Use the %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
g->open_gate(g,examx,examy, m->ter(examx,examy));
}
void iexamine::cardreader(game *g, player *p, map *m, int examx, int examy) {
itype_id card_type = (m->ter(examx, examy) == t_card_science ? "id_science" :
"id_military");
if (p->has_amount(card_type, 1) && query_yn("Swipe your ID card?")) {
p->moves -= 100;
for (int i = -3; i <= 3; i++) {
for (int j = -3; j <= 3; j++) {
if (m->ter(examx + i, examy + j) == t_door_metal_locked)
m->ter_set(examx + i, examy + j, t_floor);
}
}
for (int i = 0; i < g->z.size(); i++) {
if (g->z[i].type->id == mon_turret) {
g->z.erase(g->z.begin() + i);
i--;
}
}
g->add_msg("You insert your ID card.");
g->add_msg("The nearby doors slide into the floor.");
p->use_amount(card_type, 1);
} else {
bool using_electrohack = (p->has_amount("electrohack", 1) &&
query_yn("Use electrohack on the reader?"));
bool using_fingerhack = (!using_electrohack && p->has_bionic("bio_fingerhack") &&
p->power_level > 0 &&
query_yn("Use fingerhack on the reader?"));
if (using_electrohack || using_fingerhack) {
p->moves -= 500;
p->practice("computer", 20);
int success = rng(p->skillLevel("computer") / 4 - 2, p->skillLevel("computer") * 2);
success += rng(-3, 3);
if (using_fingerhack)
success++;
if (p->int_cur < 8)
success -= rng(0, int((8 - p->int_cur) / 2));
else if (p->int_cur > 8)
success += rng(0, int((p->int_cur - 8) / 2));
if (success < 0) {
g->add_msg("You cause a short circuit!");
if (success <= -5) {
if (using_electrohack) {
g->add_msg("Your electrohack is ruined!");
p->use_amount("electrohack", 1);
} else {
g->add_msg("Your power is drained!");
p->charge_power(0 - rng(0, p->power_level));
}
}
m->ter_set(examx, examy, t_card_reader_broken);
} else if (success < 6)
g->add_msg("Nothing happens.");
else {
g->add_msg("You activate the panel!");
g->add_msg("The nearby doors slide into the floor.");
m->ter_set(examx, examy, t_card_reader_broken);
for (int i = -3; i <= 3; i++) {
for (int j = -3; j <= 3; j++) {
if (m->ter(examx + i, examy + j) == t_door_metal_locked)
m->ter_set(examx + i, examy + j, t_floor);
}
}
}
} else {
g->add_msg("Looks like you need a %s.",g->itypes[card_type]->name.c_str());
}
}
}
void iexamine::rubble(game *g, player *p, map *m, int examx, int examy) {
if (!(p->has_amount("shovel", 1) || p->has_amount("primitive_shovel", 1))) {
g->add_msg("If only you had a shovel...");
return;
}
const char *xname = m->tername(examx, examy).c_str();
if (query_yn("Clear up that %s?",xname)) {
// "Remove"
p->moves -= 200;
// "Replace"
if(m->ter(examx,examy) == t_rubble) {
item rock(g->itypes["rock"], g->turn);
m->add_item(p->posx, p->posy, rock);
m->add_item(p->posx, p->posy, rock);
}
// "Refloor"
if (g->levz < 0) {
m->ter_set(examx, examy, t_rock_floor);
} else {
m->ter_set(examx, examy, t_dirt);
}
// "Remind"
g->add_msg("You clear up that %s.", xname);
}
}
void iexamine::chainfence(game *g, player *p, map *m, int examx, int examy) {
if (!query_yn("Climb %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
p->moves -= 400;
if (one_in(p->dex_cur)) {
g->add_msg("You slip whilst climbing and fall down again");
} else {
p->moves += p->dex_cur * 10;
p->posx = examx;
p->posy = examy;
}
}
void iexamine::tent(game *g, player *p, map *m, int examx, int examy) {
if (!query_yn("Take down your tent?")) {
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);
g->add_msg("You take down the tent");
item tent(g->itypes["tent_kit"], g->turn);
m->add_item(examx, examy, tent);
}
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())) {
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);
g->add_msg("You take down the shelter");
item tent(g->itypes["shelter_kit"], g->turn);
m->add_item(examx, examy, tent);
}
void iexamine::wreckage(game *g, player *p, map *m, int examx, int examy) {
if (!(p->has_amount("shovel", 1) || p->has_amount("primitive_shovel", 1))) {
g->add_msg("If only you had a shovel..");
return;
}
if (query_yn("Clear up that wreckage?")) {
p->moves -= 200;
m->ter_set(examx, examy, t_dirt);
item chunk(g->itypes["steel_chunk"], g->turn);
item scrap(g->itypes["scrap"], g->turn);
item pipe(g->itypes["pipe"], g->turn);
item wire(g->itypes["wire"], g->turn);
m->add_item(examx, examy, chunk);
m->add_item(examx, examy, scrap);
if (one_in(5)) {
m->add_item(examx, examy, pipe);
m->add_item(examx, examy, wire); }
g->add_msg("You clear the wreckage up");
}
}
void iexamine::pit(game *g, player *p, map *m, int examx, int examy) {
if(!p->has_amount("2x4", 1)) {
none(g, p, m, examx, examy);
return;
}
if (query_yn("Place a plank over the pit?")) {
p->use_amount("2x4", 1);
m->ter_set(examx, examy, t_pit_covered);
g->add_msg("You place a plank of wood over the pit");
} else {
g->add_msg("You need a plank of wood to do that");
}
}
void iexamine::pit_spiked(game *g, player *p, map *m, int examx, int examy) {
if(!p->has_amount("2x4", 1)) {
none(g, p, m, examx, examy);
return;
}
if (query_yn("Place a plank over the pit?")) {
p->use_amount("2x4", 1);
m->ter_set(examx, examy, t_pit_spiked_covered);
g->add_msg("You place a plank of wood over the pit");
} else {
g->add_msg("You need a plank of wood to do that");
}
}
void iexamine::pit_covered(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Remove cover?")) {
none(g, p, m, examx, examy);
return;
}
item plank(g->itypes["2x4"], g->turn);
g->add_msg("You remove the plank.");
m->add_item(p->posx, p->posy, plank);
m->ter_set(examx, examy, t_pit);
}
void iexamine::pit_spiked_covered(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Remove cover?")) {
none(g, p, m, examx, examy);
return;
}
item plank(g->itypes["2x4"], g->turn);
g->add_msg("You remove the plank.");
m->add_item(p->posx, p->posy, plank);
m->ter_set(examx, examy, t_pit_spiked);
}
void iexamine::fence_post(game *g, player *p, map *m, int examx, int examy) {
int ch = menu("Fence Construction:", "Rope Fence", "Wire Fence",
"Barbed Wire Fence", "Cancel", NULL);
switch (ch){
case 1:{
if (p->has_amount("rope_6", 2)) {
p->use_amount("rope_6", 2);
m->ter_set(examx, examy, t_fence_rope);
p->moves -= 200;
} else
g->add_msg("You need 2 six-foot lengths of rope to do that");
} break;
case 2:{
if (p->has_amount("wire", 2)) {
p->use_amount("wire", 2);
m->ter_set(examx, examy, t_fence_wire);
p->moves -= 200;
} else
g->add_msg("You need 2 lengths of wire to do that!");
} break;
case 3:{
if (p->has_amount("wire_barbed", 2)) {
p->use_amount("wire_barbed", 2);
m->ter_set(examx, examy, t_fence_barbed);
p->moves -= 200;
} else
g->add_msg("You need 2 lengths of barbed wire to do that!");
} break;
case 4:
default:
break;
}
}
void iexamine::remove_fence_rope(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Remove %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
item rope(g->itypes["rope_6"], g->turn);
m->add_item(p->posx, p->posy, rope);
m->add_item(p->posx, p->posy, rope);
m->ter_set(examx, examy, t_fence_post);
p->moves -= 200;
}
void iexamine::remove_fence_wire(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Remove %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
item rope(g->itypes["wire"], g->turn);
m->add_item(p->posx, p->posy, rope);
m->add_item(p->posx, p->posy, rope);
m->ter_set(examx, examy, t_fence_post);
p->moves -= 200;
}
void iexamine::remove_fence_barbed(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Remove %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
item rope(g->itypes["wire_barbed"], g->turn);
m->add_item(p->posx, p->posy, rope);
m->add_item(p->posx, p->posy, rope);
m->ter_set(examx, examy, t_fence_post);
p->moves -= 200;
}
void iexamine::slot_machine(game *g, player *p, map *m, int examx, int examy) {
if (p->cash < 10)
g->add_msg("You need $10 to play.");
else if (query_yn("Insert $10?")) {
do {
if (one_in(5))
popup("Three cherries... you get your money back!");
else if (one_in(20)) {
popup("Three bells... you win $50!");
p->cash += 40; // Minus the $10 we wagered
} else if (one_in(50)) {
popup("Three stars... you win $200!");
p->cash += 190;
} else if (one_in(1000)) {
popup("JACKPOT! You win $5000!");
p->cash += 4990;
} else {
popup("No win.");
p->cash -= 10;
}
} while (p->cash >= 10 && query_yn("Play again?"));
}
}
void iexamine::bulletin_board(game *g, player *p, map *m, int examx, int examy) {
basecamp *camp = m->camp_at(examx, examy);
if (camp && camp->board_x() == examx && camp->board_y() == examy) {
std::vector<std::string> options;
options.push_back("Cancel");
int choice = menu_vec(camp->board_name().c_str(), options) - 1;
}
else {
bool create_camp = m->allow_camp(examx, examy);
std::vector<std::string> options;
if (create_camp)
options.push_back("Create camp");
options.push_back("Cancel");
// TODO: Other Bulletin Boards
int choice = menu_vec("Bulletin Board", options) - 1;
if (choice >= 0 && choice < options.size()) {
if (options[choice] == "Create camp") {
// TODO: Allow text entry for name
m->add_camp("Home", examx, examy);
}
}
}
}
void iexamine::fault(game *g, player *p, map *m, int examx, int examy) {
popup("\
This wall is perfectly vertical. Odd, twisted holes are set in it, leading\n\
as far back into the solid rock as you can see. The holes are humanoid in\n\
shape, but with long, twisted, distended limbs.");
}
void iexamine::pedestal_wyrm(game *g, player *p, map *m, int examx, int examy) {
if (!m->i_at(examx, examy).empty()) {
none(g, p, m, examx, examy);
return;
}
g->add_msg("The pedestal sinks into the ground...");
m->ter_set(examx, examy, t_rock_floor);
g->add_event(EVENT_SPAWN_WYRMS, int(g->turn) + rng(5, 10));
}
void iexamine::pedestal_temple(game *g, player *p, map *m, int examx, int examy) {
if (m->i_at(examx, examy).size() == 1 &&
m->i_at(examx, examy)[0].type->id == "petrified_eye") {
g->add_msg("The pedestal sinks into the ground...");
m->ter_set(examx, examy, t_dirt);
m->i_at(examx, examy).clear();
g->add_event(EVENT_TEMPLE_OPEN, int(g->turn) + 4);
} else if (p->has_amount("petrified_eye", 1) &&
query_yn("Place your petrified eye on the pedestal?")) {
p->use_amount("petrified_eye", 1);
g->add_msg("The pedestal sinks into the ground...");
m->ter_set(examx, examy, t_dirt);
g->add_event(EVENT_TEMPLE_OPEN, int(g->turn) + 4);
} else
g->add_msg("This pedestal is engraved in eye-shaped diagrams, and has a large\
semi-spherical indentation at the top.");
}
void iexamine::fswitch(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Flip the %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
p->moves -= 100;
for (int y = examy; y <= examy + 5; y++) {
for (int x = 0; x < SEEX * MAPSIZE; x++) {
switch (m->ter(examx, examy)) {
case t_switch_rg:
if (m->ter(x, y) == t_rock_red)
m->ter_set(x, y, t_floor_red);
else if (m->ter(x, y) == t_floor_red)
m->ter_set(x, y, t_rock_red);
else if (m->ter(x, y) == t_rock_green)
m->ter_set(x, y, t_floor_green);
else if (m->ter(x, y) == t_floor_green)
m->ter_set(x, y, t_rock_green);
break;
case t_switch_gb:
if (m->ter(x, y) == t_rock_blue)
m->ter_set(x, y, t_floor_blue);
else if (m->ter(x, y) == t_floor_blue)
m->ter_set(x, y, t_rock_blue);
else if (m->ter(x, y) == t_rock_green)
m->ter_set(x, y, t_floor_green);
else if (m->ter(x, y) == t_floor_green)
m->ter_set(x, y, t_rock_green);
break;
case t_switch_rb:
if (m->ter(x, y) == t_rock_blue)
m->ter_set(x, y, t_floor_blue);
else if (m->ter(x, y) == t_floor_blue)
m->ter_set(x, y, t_rock_blue);
else if (m->ter(x, y) == t_rock_red)
m->ter_set(x, y, t_floor_red);
else if (m->ter(x, y) == t_floor_red)
m->ter_set(x, y, t_rock_red);
break;
case t_switch_even:
if ((y - examy) % 2 == 1) {
if (m->ter(x, y) == t_rock_red)
m->ter_set(x, y, t_floor_red);
else if (m->ter(x, y) == t_floor_red)
m->ter_set(x, y, t_rock_red);
else if (m->ter(x, y) == t_rock_green)
m->ter_set(x, y, t_floor_green);
else if (m->ter(x, y) == t_floor_green)
m->ter_set(x, y, t_rock_green);
else if (m->ter(x, y) == t_rock_blue)
m->ter_set(x, y, t_floor_blue);
else if (m->ter(x, y) == t_floor_blue)
m->ter_set(x, y, t_rock_blue);
}
break;
}
}
}
g->add_msg("You hear the rumble of rock shifting.");
g->add_event(EVENT_TEMPLE_SPAWN, g->turn + 3);
}
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())) {
none(g, p, m, examx, examy);
return;
}
g->add_msg("This flower has a heady aroma");
if (!(p->is_wearing("mask_filter")||p->is_wearing("mask_gas") ||
one_in(3))) {
g->add_msg("You fall asleep...");
p->add_disease(DI_SLEEP, 1200, g);
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->spawn_item(examx, examy, g->itypes["poppy_flower"],0);
m->spawn_item(examx, examy, g->itypes["poppy_bud"],0);
}
void iexamine::tree_apple(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Pick %s?",m->tername(examx, examy).c_str())) return;
int num_apples = rng(1, p->skillLevel("survival"));
if (num_apples >= 12)
num_apples = 12;
for (int i = 0; i < num_apples; i++)
m->spawn_item(examx, examy, g->itypes["apple"], g->turn, 0);
m->ter_set(examx, examy, t_tree);
}
void iexamine::shrub_blueberry(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Pick %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
int num_blueberries = rng(1, p->skillLevel("survival"));
if (num_blueberries >= 12)
num_blueberries = 12;
for (int i = 0; i < num_blueberries; i++)
m->spawn_item(examx, examy, g->itypes["blueberries"], g->turn, 0);
m->ter_set(examx, examy, t_shrub);
}
void iexamine::shrub_wildveggies(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Pick %s?",m->tername(examx, examy).c_str())) return;
p->assign_activity(g, ACT_FORAGE, 500 / (p->skillLevel("survival") + 1), 0);
p->activity.placement = point(examx, examy);
p->moves = 0;
}
void iexamine::recycler(game *g, player *p, map *m, int examx, int examy) {
if(!query_yn("Use the %s?",m->tername(examx, examy).c_str())) {
none(g, p, m, examx, examy);
return;
}
if (m->i_at(examx, examy).size() > 0)
{
g->sound(examx, examy, 80, "Ka-klunk!");
int num_metal = 0;
for (int i = 0; i < m->i_at(examx, examy).size(); i++)
{
item *it = &(m->i_at(examx, examy)[i]);
if (it->made_of(STEEL))
num_metal++;
m->i_at(examx, examy).erase(m->i_at(examx, examy).begin() + i);
i--;
}
if (num_metal > 0)
{
while (num_metal > 9)
{
m->spawn_item(p->posx, p->posy, g->itypes["steel_lump"], 0);
num_metal -= 10;
}
do
{
m->spawn_item(p->posx, p->posy, g->itypes["steel_chunk"], 0);
num_metal -= 3;
} while (num_metal > 2);
}
}
else g->add_msg("The recycler is empty.");
}
void iexamine::trap(game *g, player *p, map *m, int examx, int examy) {
if (g->traps[m->tr_at(examx, examy)]->difficulty < 99 &&
p->per_cur-p->encumb(bp_eyes) >= g->traps[m->tr_at(examx, examy)]->visibility &&
query_yn("There is a %s there. Disarm?",
g->traps[m->tr_at(examx, examy)]->name.c_str())) {
m->disarm_trap(g, examx, examy);
}
}
+54
View File
@@ -0,0 +1,54 @@
//
// iexamine.h
// Cataclysm
//
// Livingstone
//
#ifndef __Cataclysmic__iexamine__
#define __Cataclysmic__iexamine__
//#include <iostream>
class game;
class item;
class player;
class map;
class iexamine
{
public:
void none (game *g, player *p, map *m, int examx, int examy);
void gaspump (game *g, player *p, map *m, int examx, int examy);
void elevator (game *g, player *p, map *m, int examx, int examy);
void controls_gate(game *g, player *p, map *m, int examx, int examy);
void cardreader (game *g, player *p, map *m, int examx, int examy);
void rubble (game *g, player *p, map *m, int examx, int examy);
void chainfence (game *g, player *p, map *m, int examx, int examy);
void tent (game *g, player *p, map *m, int examx, int examy);
void shelter (game *g, player *p, map *m, int examx, int examy);
void wreckage (game *g, player *p, map *m, int examx, int examy);
void pit (game *g, player *p, map *m, int examx, int examy);
void pit_spiked (game *g, player *p, map *m, int examx, int examy);
void pit_covered (game *g, player *p, map *m, int examx, int examy);
void pit_spiked_covered (game *g, player *p, map *m, int examx, int examy);
void fence_post (game *g, player *p, map *m, int examx, int examy);
void remove_fence_rope (game *g, player *p, map *m, int examx, int examy);
void remove_fence_wire (game *g, player *p, map *m, int examx, int examy);
void remove_fence_barbed (game *g, player *p, map *m, int examx, int examy);
void slot_machine (game *g, player *p, map *m, int examx, int examy);
void bulletin_board (game *g, player *p, map *m, int examx, int examy);
void fault (game *g, player *p, map *m, int examx, int examy);
void pedestal_wyrm (game *g, player *p, map *m, int examx, int examy);
void pedestal_temple (game *g, player *p, map *m, int examx, int examy);
void fswitch (game *g, player *p, map *m, int examx, int examy);
void flower_poppy (game *g, player *p, map *m, int examx, int examy);
void tree_apple (game *g, player *p, map *m, int examx, int examy);
void shrub_blueberry (game *g, player *p, map *m, int examx, int examy);
void shrub_wildveggies (game *g, player *p, map *m, int examx, int examy);
void recycler (game *g, player *p, map *m, int examx, int examy);
void trap(game *g, player *p, map *m, int examx, int examy);
};
#endif /* defined(__Cataclysmic__iexamine__) */
+6 -1
View File
@@ -60,7 +60,12 @@ InputEvent get_input(int ch)
case ',':
case 'g':
return Pickup;
case 'f':
case 'F':
return Filter;
case 'r':
case 'R':
return Reset;
default:
return Undefined;
}
+2 -1
View File
@@ -19,7 +19,8 @@ enum InputEvent {
DirectionDown, /* Think stairs */
DirectionUp,
Filter,
Reset,
Pickup,
Nothing,
Undefined
+41 -19
View File
@@ -4,6 +4,8 @@
#include "keypress.h"
#include "mapdata.h"
const std::string inv_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#&()*+./:;=?@[\\]^_{|}";
item& inventory::operator[] (int i)
{
if (i < 0 || i > items.size()) {
@@ -141,6 +143,11 @@ void inventory::add_item(item newit, bool keep_invlet)
return; // Styles never belong in our inventory.
for (int i = 0; i < items.size(); i++) {
if (items[i][0].stacks_with(newit)) {
if (items[i][0].is_food() && items[i][0].has_flag(IF_HOT)) {
int tmpcounter = (items[i][0].item_counter + newit.item_counter) / 2;
items[i][0].item_counter = tmpcounter;
newit.item_counter = tmpcounter;
}
newit.invlet = items[i][0].invlet;
items[i].push_back(newit);
return;
@@ -197,16 +204,39 @@ void inventory::form_from_map(game *g, point origin, int range)
add_item(g->m.i_at(x, y)[i]);
// Kludges for now!
if (g->m.field_at(x, y).type == fd_fire) {
item fire(g->itypes[itm_fire], 0);
item fire(g->itypes["fire"], 0);
fire.charges = 1;
add_item(fire);
}
ter_id terrain_id = g->m.ter(x, y);
if (terrain_id == t_toilet || terrain_id == t_water_sh || terrain_id == t_water_dp){
item water(g->itypes[itm_water], 0);
item water(g->itypes["water"], 0);
water.charges = 50;
add_item(water);
}
int vpart = -1;
vehicle *veh = g->m.veh_at(x, y, vpart);
if (veh) {
const int kpart = veh->part_with_feature(vpart, vpf_kitchen);
if (kpart >= 0) {
item hotplate(g->itypes["hotplate"], 0);
hotplate.charges = veh->fuel_left(AT_BATT, true);
add_item(hotplate);
item water(g->itypes["water_clean"], 0);
water.charges = veh->fuel_left(AT_WATER);
add_item(water);
item pot(g->itypes["pot"], 0);
add_item(pot);
item pan(g->itypes["pan"], 0);
add_item(pan);
}
}
}
}
}
@@ -462,22 +492,14 @@ bool inventory::has_item(item *it)
void inventory::assign_empty_invlet(item &it, player *p)
{
for (int ch = 'a'; ch <= 'z'; ch++) {
//debugmsg("Trying %c", ch);
if (index_by_letter(ch) == -1 && (!p || !p->has_weapon_or_armor(ch))) {
it.invlet = ch;
//debugmsg("Using %c", ch);
return;
for (std::string::const_iterator newinvlet = inv_chars.begin();
newinvlet != inv_chars.end();
newinvlet++) {
if (index_by_letter(*newinvlet) == -1 && (!p || !p->has_weapon_or_armor(*newinvlet))) {
it.invlet = *newinvlet;
return;
}
}
}
for (int ch = 'A'; ch <= 'Z'; ch++) {
//debugmsg("Trying %c", ch);
if (index_by_letter(ch) == -1 && (!p || !p->has_weapon_or_armor(ch))) {
//debugmsg("Using %c", ch);
it.invlet = ch;
return;
}
}
it.invlet = '`';
//debugmsg("Couldn't find empty invlet");
it.invlet = '`';
//debugmsg("Couldn't find empty invlet");
}
+2
View File
@@ -8,6 +8,8 @@
class game;
class map;
const extern std::string inv_chars;
class inventory
{
public:
+11 -9
View File
@@ -5,6 +5,7 @@
#include <vector>
#include <map>
#include <sstream>
#include <algorithm>
const int iCategorieNum = 11;
std::string CATEGORIES[iCategorieNum] =
@@ -113,11 +114,11 @@ void print_inv_statics(game *g, WINDOW* w_inv, std::string title,
}
// Print items carried
for(int ch='a'; ch <= 'z'; ++ch)
n_items += ((g->u.inv.index_by_letter(ch) == -1) ? 0 : 1);
for(int ch='A'; ch <= 'Z'; ++ch)
n_items += ((g->u.inv.index_by_letter(ch) == -1) ? 0 : 1);
mvwprintw(w_inv, 1, 62, "Items: %d/52 ", n_items);
for (std::string::const_iterator invlet = inv_chars.begin();
invlet != inv_chars.end(); invlet++) {
n_items += ((g->u.inv.index_by_letter(*invlet) == -1) ? 0 : 1);
}
mvwprintw(w_inv, 1, 62, "Items: %d/%d ", n_items, inv_chars.size());
}
// Display current inventory.
@@ -396,8 +397,8 @@ std::vector<item> game::multidrop()
}
}
if (!found) {
if (ch == u.weapon.invlet && u.weapon.type->id > num_items &&
u.weapon.type->id < num_all_items) {
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());
warned_about_bionic = true;
@@ -617,8 +618,9 @@ void game::compare(int iCompareX, int iCompareY)
}
}
if (!found) {
if (ch == u.weapon.invlet && u.weapon.type->id > num_items &&
u.weapon.type->id < num_all_items) {
if ( ch == u.weapon.invlet &&
std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(), u.weapon.type->id) != unreal_itype_ids.end()){
//Do Bionic stuff here?!
} else {
if (!bFirst)
+141 -174
View File
@@ -4,8 +4,14 @@
#include "skill.h"
#include "game.h"
#include <sstream>
#include <algorithm>
#include "cursesdef.h"
// mfb(n) converts a flag to its appropriate position in covers's bitfield
#ifndef mfb
#define mfb(n) long(1 << (n))
#endif
bool is_flammable(material m);
std::string default_technique_name(technique_id tech);
@@ -20,6 +26,8 @@ item::item()
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
item_counter = 0;
type = nullitem();
curammo = NULL;
corpse = NULL;
@@ -42,6 +50,8 @@ item::item(itype* it, unsigned int turn)
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
item_counter = 0;
active = false;
curammo = NULL;
corpse = NULL;
@@ -67,7 +77,7 @@ item::item(itype* it, unsigned int turn)
charges = -1;
else
charges = tool->def_charges;
} else if (it->is_gunmod() && it->id == itm_spare_mag) {
} else if ((it->is_gunmod() && it->id == "spare_mag") || it->item_flags & mfb(IF_MODE_AUX)) {
charges = 0;
} else
charges = -1;
@@ -89,6 +99,8 @@ item::item(itype *it, unsigned int turn, char let)
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
item_counter = 0;
active = false;
if (it->is_gun()) {
charges = 0;
@@ -107,7 +119,7 @@ item::item(itype *it, unsigned int turn, char let)
charges = -1;
else
charges = tool->def_charges;
} else if (it->is_gunmod() && it->id == itm_spare_mag) {
} else if (it->is_gunmod() && it->id == "spare_mag") {
charges = 0;
} else {
charges = -1;
@@ -133,6 +145,8 @@ void item::make_corpse(itype* it, mtype* mt, unsigned int turn)
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
item_counter = 0;
curammo = NULL;
active = false;
if(!it)
@@ -169,26 +183,26 @@ void item::make(itype* it)
bool item::is_null()
{
return (type == NULL || type->id == 0);
return (type == NULL || type->id == "null");
}
item item::in_its_container(std::vector<itype*> *itypes)
item item::in_its_container(std::map<std::string, itype*> *itypes)
{
if (is_software()) {
item ret( (*itypes)[itm_usb_drive], 0);
item ret( (*itypes)["usb_drive"], 0);
ret.contents.push_back(*this);
ret.invlet = invlet;
return ret;
}
if (!is_food() || (dynamic_cast<it_comest*>(type))->container == itm_null)
if (!is_food() || (dynamic_cast<it_comest*>(type))->container == "null")
return *this;
it_comest *food = dynamic_cast<it_comest*>(type);
item ret((*itypes)[food->container], bday);
if (dynamic_cast<it_comest*>(type)->container == itm_can_food)
if (dynamic_cast<it_comest*>(type)->container == "can_food")
food->spoils = 0;
if (made_of(LIQUID))
@@ -204,7 +218,7 @@ item item::in_its_container(std::vector<itype*> *itypes)
bool item::invlet_is_okay()
{
return ((invlet >= 'a' && invlet <= 'z') || (invlet >= 'A' && invlet <= 'Z'));
return (inv_chars.find(invlet) != std::string::npos);
}
bool item::stacks_with(item rhs)
@@ -212,6 +226,7 @@ bool item::stacks_with(item rhs)
bool stacks = (type == rhs.type && damage == rhs.damage &&
active == rhs.active && charges == rhs.charges &&
item_flags == rhs.item_flags &&
contents.size() == rhs.contents.size() &&
(!goes_bad() || bday == rhs.bday));
@@ -243,21 +258,28 @@ void item::put_in(item payload)
std::string item::save_info()
{
if (type == NULL)
if (type == NULL){
debugmsg("Tried to save an item with NULL type!");
int ammotmp = 0;
}
itype_id ammotmp = "null";
/* TODO: This causes a segfault sometimes, even though we check to make sure
* curammo isn't NULL. The crashes seem to occur most frequently when saving an
* NPC, or when saving map data containing an item an NPC has dropped.
*/
if (curammo != NULL)
if (curammo != NULL){
ammotmp = curammo->id;
if (ammotmp < 0 || ammotmp > num_items)
ammotmp = 0; // Saves us from some bugs
std::stringstream dump;// (std::stringstream::in | std::stringstream::out);
dump << " " << int(invlet) << " " << int(typeId()) << " " << int(charges) <<
" " << int(damage) << " " << int(burnt) << " " << poison << " " <<
ammotmp << " " << owned << " " << int(bday);
}
if( std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(),
ammotmp) != unreal_itype_ids.end() &&
std::find(artifact_itype_ids.begin(), artifact_itype_ids.end(),
ammotmp) != artifact_itype_ids.end()
) {
ammotmp = "null"; //Saves us from some bugs, apparently?
}
std::stringstream dump;
dump << " " << int(invlet) << " " << typeId() << " " << int(charges) <<
" " << int(damage) << " " << int(item_flags) << " " << int(burnt) <<
" " << poison << " " << ammotmp << " " << owned << " " << int(bday);
if (active)
dump << " 1";
else
@@ -280,9 +302,11 @@ void item::load_info(std::string data, game *g)
{
std::stringstream dump;
dump << data;
int idtmp, ammotmp, lettmp, damtmp, burntmp, acttmp, corp;
dump >> lettmp >> idtmp >> charges >> damtmp >> burntmp >> poison >> ammotmp >>
owned >> bday >> acttmp >> corp >> mission_id >> player_id;
std::string idtmp, ammotmp;
int lettmp, damtmp, burntmp, acttmp, corp, item_flagstmp;
dump >> lettmp >> idtmp >> charges >> damtmp >> item_flagstmp >>
burntmp >> poison >> ammotmp >> owned >> bday >> acttmp >>
corp >> mission_id >> player_id;
if (corp != -1)
corpse = g->mtypes[corp];
else
@@ -302,11 +326,12 @@ void item::load_info(std::string data, game *g)
invlet = char(lettmp);
damage = damtmp;
burnt = burntmp;
item_flags = item_flagstmp;
active = false;
mode = IF_NULL;
if (acttmp == 1)
active = true;
if (ammotmp > 0)
if (ammotmp != "null")
curammo = dynamic_cast<it_ammo*>(g->itypes[ammotmp]);
else
curammo = NULL;
@@ -331,14 +356,10 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
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));
/*
dump << " Volume: " << volume() << " Weight: " << weight() << "\n" <<
" Bash: " << int(type->melee_dam) <<
(has_flag(IF_SPEAR) ? " Pierce: " : " Cut: ") <<
int(type->melee_cut) << " To-hit bonus: " <<
(type->m_to_hit > 0 ? "+" : "" ) << int(type->m_to_hit) << "\n" <<
" Moves per attack: " << attack_time() << "\n";
*/
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) )));
}
if (is_food()) {
@@ -348,11 +369,6 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("FOOD", " Quench: ", "", int(food->quench)));
dump->push_back(iteminfo("FOOD", " Enjoyability: ", "", int(food->fun)));
/*
dump << " Nutrition: " << int(food->nutr) << "\n Quench: " <<
int(food->quench) << "\n Enjoyability: " << int(food->fun);
*/
} else if (is_food_container()) {
// added charge display for debugging
it_comest* food = dynamic_cast<it_comest*>(contents[0].type);
@@ -360,13 +376,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
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", " Charges: ", "", int(contents[0].charges)));
/*
dump << " Nutrition: " << int(food->nutr) << "\n Quench: " <<
int(food->quench) << "\n Enjoyability: " << int(food->fun)
<< "\n Charges: " << int(contents[0].charges);
*/
dump->push_back(iteminfo("FOOD", " Portions: ", "", abs(int(contents[0].charges))));
} else if (is_ammo()) {
// added charge display for debugging
@@ -380,14 +390,6 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("AMMO", " Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", " Count: ", "", int(ammo->count)));
/*
dump << " Type: " << ammo_name(ammo->type) << "\n Damage: " <<
int(ammo->damage) << "\n Armor-pierce: " << int(ammo->pierce) <<
"\n Range: " << int(ammo->range) << "\n Accuracy: " <<
int(100 - ammo->accuracy) << "\n Recoil: " << int(ammo->recoil)
<< "\n Count: " << int(ammo->count);
*/
} else if (is_ammo_container()) {
it_ammo* ammo = dynamic_cast<it_ammo*>(contents[0].type);
@@ -399,14 +401,6 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("AMMO", " Recoil: ", "", int(ammo->recoil), "", true, true));
dump->push_back(iteminfo("AMMO", " Count: ", "", int(contents[0].charges)));
/*
dump << " Type: " << ammo_name(ammo->type) << "\n Damage: " <<
int(ammo->damage) << "\n Armor-pierce: " << int(ammo->pierce) <<
"\n Range: " << int(ammo->range) << "\n Accuracy: " <<
int(100 - ammo->accuracy) << "\n Recoil: " << int(ammo->recoil)
<< "\n Count: " << int(contents[0].charges);
*/
} else if (is_gun()) {
it_gun* gun = dynamic_cast<it_gun*>(type);
int ammo_dam = 0, ammo_recoil = 0;
@@ -419,81 +413,66 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
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 << " Skill used: " << gun->skill_used->name() << "\n Ammunition: " <<
clip_size() << " rounds of " << ammo_name(ammo_type());
dump << "\n Damage: ";
*/
temp1.str("");
if (has_ammo)
temp1 << ammo_dam; //dump << ammo_dam;
temp1 << ammo_dam;
temp1 << (gun_damage(false) >= 0 ? "+" : "" );
//dump << (gun_damage(false) >= 0 ? "+" : "" ) << gun_damage(false);
temp2.str("");
if (has_ammo)
temp2 << " = " << gun_damage(); //dump << " = " << gun_damage();
temp2 << " = " << gun_damage();
dump->push_back(iteminfo("GUN", " Damage: ", temp1.str(), int(gun_damage(false)), temp2.str()));
dump->push_back(iteminfo("GUN", " Accuracy: ", "", int(100 - accuracy())));
//dump << "\n Accuracy: " << int(100 - accuracy());
//dump << "\n Recoil: ";
temp1.str("");
if (has_ammo)
temp1 << ammo_recoil; //dump << ammo_recoil;
temp1 << ammo_recoil;
temp1 << (recoil(false) >= 0 ? "+" : "" );
//dump << (recoil(false) >= 0 ? "+" : "" ) << recoil(false);
temp2.str("");
if (has_ammo)
temp2 << " = " << recoil(); //dump << " = " << recoil();
temp2 << " = " << recoil();
dump->push_back(iteminfo("GUN"," Recoil: ", temp1.str(), int(recoil(false)), temp2.str(), true, true));
//dump << "\n Reload time: " << int(gun->reload_time);
//if (has_flag(IF_RELOAD_ONE))
//dump << " per round";
dump->push_back(iteminfo("GUN", " Reload time: ", "", int(gun->reload_time), ((has_flag(IF_RELOAD_ONE)) ? " per round" : ""), true, true));
if (burst_size() == 0) {
if (gun->skill_used == Skill::skill("pistol") && has_flag(IF_RELOAD_ONE))
dump->push_back(iteminfo("GUN", " Revolver.")); //dump << "\n Revolver.";
dump->push_back(iteminfo("GUN", " Revolver."));
else
dump->push_back(iteminfo("GUN", " Semi-automatic.")); //dump << "\n Semi-automatic.";
dump->push_back(iteminfo("GUN", " Semi-automatic."));
} else
dump->push_back(iteminfo("GUN", " Burst size: ", "", int(burst_size()))); //dump << "\n Burst size: " << burst_size();
dump->push_back(iteminfo("GUN", " Burst size: ", "", int(burst_size())));
if (contents.size() > 0)
dump->push_back(iteminfo("GUN", "\n")); //dump << "\n";
dump->push_back(iteminfo("GUN", "\n"));
temp1.str("");
for (int i = 0; i < contents.size(); i++)
temp1 << "\n+" << contents[i].tname();
dump->push_back(iteminfo("GUN", temp1.str())); //
dump->push_back(iteminfo("GUN", temp1.str()));
} 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))); //dump << " Accuracy: " << (mod->accuracy > 0 ? "+" : "") << int(mod->accuracy);
dump->push_back(iteminfo("GUNMOD", " Accuracy: ", ((mod->accuracy > 0) ? "+" : ""), int(mod->accuracy)));
if (mod->damage != 0)
dump->push_back(iteminfo("GUNMOD", " Damage: ", ((mod->damage > 0) ? "+" : ""), int(mod->damage))); //dump << "\n 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 << "\n Magazine: " << (mod->clip > 0 ? "+" : "") << int(mod->damage) << "%";
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 << "\n Recoil: " << int(mod->recoil);
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 << "\n Burst: " << (mod->clip > 0 ? "+" : "") << int(mod->clip);
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))); //dump << "\n " << ammo_name(mod->newtype);
dump->push_back(iteminfo("GUNMOD", " " + ammo_name(mod->newtype)));
temp1.str("");
temp1 << " Used on: ";
@@ -510,7 +489,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
} else if (is_armor()) {
it_armor* armor = dynamic_cast<it_armor*>(type);
temp1.str("");
temp1 << " Covers: ";
if (armor->covers & mfb(bp_head))
@@ -532,88 +511,69 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("ARMOR", temp1.str()));
dump->push_back(iteminfo("ARMOR", " Encumberment: ", "", int(armor->encumber), "", true, true));
if (has_flag(IF_FIT))
{
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", " Bashing protection: ", "", int(armor->dmg_resist)));
dump->push_back(iteminfo("ARMOR", " Cut protection: ", "", int(armor->cut_resist)));
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 << "\n Encumberment: " << int(armor->encumber) <<
"\n Bashing protection: " << int(armor->dmg_resist) <<
"\n Cut protection: " << int(armor->cut_resist) <<
"\n Environmental protection: " << int(armor->env_resist) <<
"\n Warmth: " << int(armor->warmth) <<
"\n 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 << " Just for fun.\n";
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 << " Can bring your " << book->type->name() << " skill to " << int(book->level) << std::endl;
if (book->req == 0)
dump->push_back(iteminfo("BOOK", " It can be understood by beginners.")); //dump << " It can be understood by beginners.\n";
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 << " Requires " << book->type->name() << " level " << int(book->req) << " to understand.\n";
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 << " Requires intelligence of " << int(book->intel) << " to easily read." << std::endl;
if (book->fun != 0)
dump->push_back(iteminfo("BOOK", " Reading this book affects your morale by ", (book->fun > 0 ? "+" : ""), int(book->fun))); //dump << " Reading this book affects your morale by " << (book->fun > 0 ? "+" : "") << int(book->fun) << std::endl;
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 << " This book takes " << int(book->time) << " minutes to read.";
} else if (is_tool()) {
it_tool* tool = dynamic_cast<it_tool*>(type);
/*
dump << " Maximum " << tool->max_charges << " charges";
if (tool->ammo == AT_NULL)
dump << ".";
else
dump << " of " << ammo_name(tool->ammo) << ".";
*/
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges), " charges" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
if ((tool->max_charges)!=0)
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges), " charges" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
} else if (is_style()) {
it_style* style = dynamic_cast<it_style*>(type);
//dump << "\n";
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)));
//dump << default_technique_name(style->moves[i].tech) << ". Requires Unarmed Skill of " << style->moves[i].level << "\n";
}
} else if (!is_null() && type->techniques != 0) {
//dump << "\n";
temp1.str("");
for (int i = 1; i < NUM_TECHNIQUES; i++) {
if (type->techniques & mfb(i))
temp1 << default_technique_name( technique_id(i) ) + "; "; //dump << default_technique_name( technique_id(i) ) << "; ";
}
if (temp1.str() != "")
dump->push_back(iteminfo("TECHNIQUE", temp1.str()));
}
if ( showtext && !is_null() ) {
//dump << "\n\n" << type->description << "\n";
dump->push_back(iteminfo("DESCRIPTION", type->description));
if (is_armor() && has_flag(IF_FIT))
{
dump->push_back(iteminfo("DESCRIPTION", "\n\n"));
dump->push_back(iteminfo("DESCRIPTION", "This piece of clothing fits you perfectly."));
}
if (contents.size() > 0) {
if (is_gun()) {
for (int i = 0; i < contents.size(); i++)
dump->push_back(iteminfo("DESCRIPTION", contents[i].type->description));
//dump << "\n " << contents[i].type->description;
} else
dump->push_back(iteminfo("DESCRIPTION", contents[0].type->description));
//dump << "\n " << contents[0].type->description;
//dump << "\n";
}
}
@@ -647,7 +607,7 @@ nc_color item::color(player *u)
{
nc_color ret = c_ltgray;
if (active) // Active items show up as yellow
if (active && !is_food() && !is_food_container()) // Active items show up as yellow
ret = c_yellow;
else if (is_gun()) { // Guns are green if you are carrying ammo for them
ammotype amtype = ammo_type();
@@ -680,7 +640,7 @@ nc_color item::color_in_inventory(player *u)
{
// Items in our inventory get colorized specially
nc_color ret = c_white;
if (active)
if (active && !is_food() && !is_food_container())
ret = c_yellow;
return ret;
@@ -743,7 +703,6 @@ std::string item::tname(game *g)
if (damage == 4) damtext = "thoroughly rusted ";
break;
default:
//damtext = "damaged ";
if (damage == 1) damtext = "lightly damaged ";
if (damage == 2) damtext = "damaged ";
if (damage == 3) damtext = "very damaged ";
@@ -753,7 +712,6 @@ std::string item::tname(game *g)
}
if (is_var_veh_part()){
//if(is_engine()){
if(type->bigness_aspect == BIGNESS_ENGINE_DISPLACEMENT){ //liters, e.g. "3.21-Liter V8 engine"
ret.precision(4);
ret << (float)bigness/100 << "-Liter ";
@@ -768,12 +726,12 @@ std::string item::tname(game *g)
else if (burnt > 0)
ret << "burnt ";
if (typeId() == itm_corpse) {
if (typeId() == "corpse") {
ret << corpse->name << " corpse";
if (name != "")
ret << " of " << name;
return ret.str();
} else if (typeId() == itm_blood) {
} else if (typeId() == "blood") {
if (corpse == NULL || corpse->id == mon_null)
ret << "human blood";
else
@@ -800,6 +758,12 @@ std::string item::tname(game *g)
if (food != NULL && g != NULL && food->spoils != 0 &&
int(g->turn) < (int)bday + 100)
ret << " (fresh)";
if (food != NULL && g != NULL && has_flag(IF_HOT))
ret << " (hot)";
if (food != NULL && g != NULL && is_food_container()) {
if (contents[0].has_flag(IF_HOT))
ret << " (hot)";
}
if (food != NULL && g != NULL && food->spoils != 0 &&
int(g->turn) - (int)bday > food->spoils * 600)
ret << " (rotten)";
@@ -811,7 +775,7 @@ std::string item::tname(game *g)
nc_color item::color()
{
if (typeId() == itm_corpse)
if (typeId() == "corpse")
return corpse->color;
if( is_null() )
return c_black;
@@ -831,7 +795,7 @@ int item::price()
int item::weight()
{
if (typeId() == itm_corpse) {
if (typeId() == "corpse") {
int ret;
switch (corpse->size) {
case MS_TINY: ret = 5; break;
@@ -881,7 +845,7 @@ int item::weight()
int item::volume()
{
if (typeId() == itm_corpse) {
if (typeId() == "corpse") {
switch (corpse->size) {
case MS_TINY: return 2;
case MS_SMALL: return 40;
@@ -933,7 +897,7 @@ int item::damage_cut()
{
if (is_gun()) {
for (int i = 0; i < contents.size(); i++) {
if (contents[i].typeId() == itm_bayonet)
if (contents[i].typeId() == "bayonet")
return contents[i].type->melee_cut;
}
}
@@ -944,22 +908,33 @@ int item::damage_cut()
bool item::has_flag(item_flag f)
{
bool ret = false;
// first check for flags specific to item type
// gun flags
if (is_gun()) {
if (mode == IF_MODE_AUX) {
item* gunmod = active_gunmod();
if( gunmod != NULL )
return gunmod->has_flag(f);
ret = gunmod->has_flag(f);
if (ret) return ret;
} else {
for (int i = 0; i < contents.size(); i++) {
// Don't report flags from active gunmods for the gun.
if (contents[i].has_flag(f) && contents[i].has_flag(IF_MODE_AUX))
return true;
if (contents[i].has_flag(f) && contents[i].has_flag(IF_MODE_AUX)) {
ret = true;
return ret;
}
}
}
}
if( is_null() )
return false;
return (type->item_flags & mfb(f));
// other item type flags
ret = type->item_flags & mfb(f);
if (ret) return ret;
// now check for item specific flags
ret = item_flags & mfb(f);
return ret;
}
bool item::has_technique(technique_id tech, player *p)
@@ -977,7 +952,7 @@ bool item::has_technique(technique_id tech, player *p)
return (type->techniques & mfb(tech));
}
int item::has_gunmod(int type)
int item::has_gunmod(itype_id type)
{
if (!is_gun())
return -1;
@@ -1070,14 +1045,11 @@ int item::weapon_value(int skills[num_skill_types])
my_value += int(type->melee_dam * (1 + .3 * skills[sk_bashing] +
.1 * skills[sk_melee] ));
//debugmsg("My value: (+bash) %d", my_value);
my_value += int(type->melee_cut * (1 + .4 * skills[sk_cutting] +
.1 * skills[sk_melee] ));
//debugmsg("My value: (+cut) %d", my_value);
my_value += int(type->m_to_hit * (1.2 + .3 * skills[sk_melee]));
//debugmsg("My value: (+hit) %d", my_value);
return my_value;
}
@@ -1090,14 +1062,11 @@ int item::melee_value(int skills[num_skill_types])
int my_value = 0;
my_value += int(type->melee_dam * (1 + .3 * skills[sk_bashing] +
.1 * skills[sk_melee] ));
//debugmsg("My value: (+bash) %d", my_value);
my_value += int(type->melee_cut * (1 + .4 * skills[sk_cutting] +
.1 * skills[sk_melee] ));
//debugmsg("My value: (+cut) %d", my_value);
my_value += int(type->m_to_hit * (1.2 + .3 * skills[sk_melee]));
//debugmsg("My value: (+hit) %d", my_value);
if (is_style())
my_value += 15 * skills[sk_unarmed] + 8 * skills[sk_melee];
@@ -1124,8 +1093,6 @@ style_move item::style_data(technique_id tech)
bool item::is_two_handed(player *u)
{
if (is_gun() && (dynamic_cast<it_gun*>(type))->skill_used != Skill::skill("pistol"))
return true;
return (weight() > u->str_cur * 4);
}
@@ -1134,7 +1101,7 @@ bool item::made_of(material mat)
if( is_null() )
return false;
if (typeId() == itm_corpse)
if (typeId() == "corpse")
return (corpse->mat == mat);
return (type->m1 == mat || type->m2 == mat);
@@ -1224,11 +1191,11 @@ bool item::is_food(player *u)
if (type->is_food())
return true;
if (u->has_bionic(bio_batteries) && is_ammo() &&
if (u->has_bionic("bio_batteries") && is_ammo() &&
(dynamic_cast<it_ammo*>(type))->type == AT_BATT)
return true;
if (u->has_bionic(bio_furnace) && is_flammable(type->m1) &&
is_flammable(type->m2) && typeId() != itm_corpse)
if (u->has_bionic("bio_furnace") && is_flammable(type->m1) &&
is_flammable(type->m2) && typeId() != "corpse")
return true;
return false;
}
@@ -1306,12 +1273,6 @@ bool item::is_book()
if( is_null() )
return false;
/*
if (type->is_macguffin()) {
it_macguffin* mac = dynamic_cast<it_macguffin*>(type);
return mac->readable;
}
*/
return type->is_book();
}
@@ -1381,7 +1342,7 @@ int item::reload_time(player &u)
it_gun* reloading = dynamic_cast<it_gun*>(type);
ret = reloading->reload_time;
if (charges == 0) {
int spare_mag = has_gunmod(itm_spare_mag);
int spare_mag = has_gunmod("spare_mag");
if (spare_mag != -1 && contents[spare_mag].charges > 0)
ret -= double(ret) * 0.9;
}
@@ -1644,7 +1605,7 @@ int item::pick_reload_ammo(player &u, bool interactive)
debugmsg("RELOADING NON-GUN NON-TOOL");
return false;
}
int has_spare_mag = has_gunmod (itm_spare_mag);
int has_spare_mag = has_gunmod ("spare_mag");
std::vector<int> am; // List of indicies of valid ammo
@@ -1734,7 +1695,7 @@ bool item::reload(player &u, int index)
if (is_gun()) {
// Reload using a spare magazine
int spare_mag = has_gunmod(itm_spare_mag);
int spare_mag = has_gunmod("spare_mag");
if (charges <= 0 && spare_mag != -1 &&
u.weapon.contents[spare_mag].charges > 0) {
charges = u.weapon.contents[spare_mag].charges;
@@ -1778,7 +1739,7 @@ bool item::reload(player &u, int index)
return false;
if (reload_target->is_gun() || reload_target->is_gunmod()) {
if (reload_target->is_gunmod() && reload_target->typeId() == itm_spare_mag) {
if (reload_target->is_gunmod() && reload_target->typeId() == "spare_mag") {
// Use gun numbers instead of the mod if it's a spare magazine
max_load = (dynamic_cast<it_gun*>(type))->clip;
single_load = has_flag(IF_RELOAD_ONE);
@@ -1822,10 +1783,16 @@ bool item::reload(player &u, int index)
}
}
if (ammo_to_use->charges == 0)
if (u.inv[index].is_container())
u.inv[index].contents.erase(u.inv[index].contents.begin());
else
u.i_remn(index);
{
if (u.inv[index].is_container())
{
u.inv[index].contents.erase(u.inv[index].contents.begin());
}
else
{
u.i_remn(index);
}
}
return true;
} else
return false;
@@ -1893,9 +1860,9 @@ std::ostream & operator<<(std::ostream & out, const item & it)
}
int item::typeId()
itype_id item::typeId()
{
if (!type)
return itm_null;
return "null";
return type->id;
}
+14 -6
View File
@@ -43,7 +43,7 @@ public:
void make(itype* it);
// returns the default container of this item, with this item in it
item in_its_container(std::vector<itype*> *itypes);
item in_its_container(std::map<std::string, itype*> *itypes);
nc_color color(player *u);
nc_color color_in_inventory(player *u);
@@ -86,7 +86,7 @@ public:
int damage_cut();
bool has_flag(item_flag f);
bool has_technique(technique_id t, player *p = NULL);
int has_gunmod(int type);
int has_gunmod(itype_id type);
item* active_gunmod();
std::vector<technique_id> techniques();
bool goes_bad();
@@ -132,9 +132,8 @@ public:
bool is_var_veh_part();
bool is_artifact();
int typeId();
itype* type;
itype_id typeId();
itype* type;
mtype* corpse;
it_ammo* curammo;
@@ -153,7 +152,8 @@ public:
int bigness; // engine power, wheel size
};
int mode; // Mode of operation, can be changed by the player.
unsigned item_flags : NUM_ITEM_FLAGS; // generic item specific flags
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!
@@ -166,4 +166,12 @@ private:
std::ostream & operator<<(std::ostream &, const item &);
std::ostream & operator<<(std::ostream &, const item *);
//the assigned numbers are a result of legacy stuff in compare_split_screen_popup(),
//it would be better long-term to rewrite stuff so that we don't need that hack
enum hint_rating {
HINT_CANT = 0, //meant to display as gray
HINT_IFFY = 1, //meant to display as red
HINT_GOOD = -999 // meant to display as green
};
#endif
+53 -283
View File
@@ -31,256 +31,12 @@ enum item_cat
IC_CONTAINER
};
enum itype_id {
itm_null = 0,
itm_corpse,
// Special pseudoitems
itm_fire, itm_toolset, itm_apparatus,
// Drinks
itm_water, itm_water_clean, itm_sewage, itm_salt_water, itm_oj, itm_apple_cider,
itm_energy_drink, itm_cola, itm_rootbeer, itm_milk, itm_V8, itm_broth,
itm_soup_veggy, itm_soup_meat, itm_whiskey, itm_vodka, itm_gin, itm_rum, itm_tequila, itm_triple_sec,
itm_long_island, itm_beer, itm_bleach,
itm_ammonia, itm_mutagen, itm_purifier, itm_tea, itm_coffee, itm_blood,
// Monster Meats
itm_bone, itm_plant_sac, itm_meat, itm_veggy, itm_human_flesh, itm_veggy_wild, itm_meat_tainted, itm_veggy_tainted,
itm_meat_cooked, itm_veggy_cooked, itm_veggy_wild_cooked,
// Food
itm_apple, itm_orange, itm_lemon, itm_chips, itm_chips2, itm_chips3,
itm_pretzels, itm_chocolate,
itm_jerky, itm_sandwich_t, itm_candy, itm_mushroom, itm_mushroom_poison,
itm_mushroom_magic, itm_blueberries, itm_strawberries, itm_tomato,
itm_broccoli, itm_zucchini, itm_corn, itm_frozen_dinner, itm_cooked_dinner,
itm_spaghetti_raw, itm_spaghetti_cooked, itm_macaroni_raw, itm_macaroni_cooked,
itm_ravioli, itm_sauce_red, itm_sauce_pesto, itm_can_beans, itm_can_corn,
itm_can_spam, itm_can_pineapple, itm_can_coconut, itm_can_sardine,
itm_can_tuna, itm_can_catfood, itm_honeycomb, itm_wax, itm_royal_jelly, itm_fetus,
itm_arm, itm_leg, itm_ant_egg, itm_marloss_berry, itm_flour, itm_sugar,
itm_salt, itm_potato_raw, itm_potato_baked, itm_bread, itm_pie, itm_pizza,
itm_mre_beef, itm_mre_veggy, itm_tea_raw, itm_coffee_raw, itm_jihelucake,
// Medication
itm_bandages, itm_1st_aid, itm_vitamins, itm_aspirin, itm_caffeine,
itm_pills_sleep, itm_iodine, itm_dayquil, itm_nyquil, itm_inhaler, itm_codeine,
itm_oxycodone, itm_tramadol, itm_xanax, itm_adderall, itm_thorazine,
itm_prozac, itm_cig, itm_weed, itm_coke, itm_meth, itm_heroin, itm_cigar,
itm_antibiotics, itm_poppy_sleep, itm_poppy_pain, itm_crack, /*itm_grack,*/
// Do-nothing / Melee weapons
itm_wrapper, itm_withered, itm_syringe, itm_fur, itm_leather, itm_superglue,
itm_id_science, itm_id_military, itm_electrohack, itm_string_6, itm_string_36,
itm_rope_6, itm_rope_30, itm_chain, itm_processor, itm_RAM, itm_power_supply,
itm_amplifier, itm_transponder, itm_receiver, itm_burnt_out_bionic,
itm_antenna, itm_steel_chunk,
itm_steel_lump, itm_scrap, itm_hose, itm_glass_sheet, itm_manhole_cover, itm_rock,
itm_stick, itm_broom,
itm_hammer_sledge, itm_hatchet, itm_nailboard, itm_nailbat,
itm_pot, itm_pan, itm_knife_butter, itm_2x4, itm_muffler,
itm_pipe, itm_bat, itm_bat_metal,
itm_spear_wood, itm_baton,
itm_bee_sting, itm_wasp_sting, itm_chitin_piece, itm_biollante_bud,
itm_canister_empty, itm_gold, itm_coal, itm_petrified_eye, itm_spiral_stone,
itm_cane, itm_binoculars, itm_usb_drive,
itm_mace, itm_morningstar, itm_pool_cue, itm_pool_ball, itm_candlestick,
itm_spike, itm_blade, itm_wire, itm_wire_barbed, itm_rebar, itm_log,
itm_splinter, itm_skewer, itm_crackpipe, itm_torch_done,
itm_spring, itm_lawnmower, itm_sheet, itm_broketent, itm_element,
itm_television, itm_pilot_light, itm_toaster, itm_microwave, itm_laptop,
itm_fan, itm_ceramic_plate, itm_ceramic_bowl, itm_ceramic_cup,
itm_glass_plate, itm_glass_bowl, itm_glass, itm_tin_plate, itm_fork, itm_spork,
itm_foon, itm_rag_bloody, itm_clock, itm_clockworks,
itm_javelin, itm_rock_pot,
// Vehicle parts
itm_frame,
itm_wheel, itm_wheel_wide, itm_wheel_bicycle, itm_wheel_motorbike, itm_wheel_small,
itm_seat, itm_vehicle_controls,
itm_1cyl_combustion, itm_v2_combustion, itm_i4_combustion,
itm_v6_combustion, itm_v8_combustion,
itm_motor, itm_motor_large, itm_plasma_engine, itm_foot_crank,
itm_metal_tank, itm_storage_battery, itm_minireactor, itm_solar_panel,
itm_sheet_metal, itm_steel_plate, itm_alloy_plate, itm_spiked_plate, itm_hard_plate,
// Footwear
itm_socks, itm_socks_wool,
itm_sneakers, itm_boots, itm_boots_steel, itm_boots_winter, itm_mocassins,
itm_flip_flops, itm_dress_shoes, itm_heels,
itm_sneakers_fit, itm_boots_fit, itm_boots_steel_fit, itm_boots_winter_fit,
itm_dress_shoes_fit, itm_heels_fit, itm_boots_chitin,
// Legwear
itm_shorts, itm_shorts_cargo,
itm_jeans, itm_pants, itm_pants_leather, itm_pants_cargo, itm_pants_army, itm_pants_ski,
itm_long_underpants, itm_skirt,
itm_jeans_fit, itm_pants_fit, itm_pants_cargo_fit, itm_pants_army_fit,
// Full-body clothing
itm_jumpsuit, itm_dress, itm_armor_chitin, itm_suit, itm_hazmat_suit,
itm_armor_plate,
// Torso clothing
itm_tshirt, itm_polo_shirt, itm_dress_shirt, itm_tank_top, itm_sweatshirt,
itm_sweater, itm_hoodie, itm_under_armor, itm_jacket_light, itm_jacket_jean, itm_blazer,
itm_jacket_leather, itm_kevlar, itm_coat_rain, itm_poncho, itm_trenchcoat, itm_trenchcoat_leather,
itm_coat_winter, itm_coat_fur, itm_peacoat, itm_vest, itm_beltrig, itm_coat_lab,
itm_tshirt_fit, itm_polo_shirt_fit, itm_hoodie_fit, itm_sweatshirt_fit, itm_sweater_fit,
itm_jacket_light_fit, itm_jacket_leather_fit, itm_trenchcoat_fit, itm_trenchcoat_leather_fit,
// Arm clothing
itm_armguard_soft, itm_armguard_hard, itm_armguard_chitin, itm_armguard_metal,
// Gloves
itm_gloves_liner, itm_gloves_light, itm_mittens, itm_gloves_wool, itm_gloves_winter,
itm_gloves_leather, itm_gloves_fingerless, itm_gloves_rubber,
itm_gloves_medical, itm_fire_gauntlets, itm_gauntlets_chitin,
// Masks
itm_mask_dust, itm_bandana, itm_scarf, itm_mask_filter, itm_mask_gas,
// Eyewear
itm_glasses_eye, itm_glasses_reading, itm_glasses_safety, itm_goggles_swim,
itm_goggles_ski, itm_goggles_welding, itm_goggles_nv, itm_glasses_monocle, itm_sunglasses,
// Headwear
itm_hat_ball, itm_hat_boonie, itm_hat_cotton, itm_hat_knit, itm_hat_hunting, itm_hat_fur, itm_balclava, itm_hat_hard,
itm_helmet_bike, itm_helmet_skid, itm_helmet_ball, itm_helmet_army, itm_helmet_riot,
itm_helmet_motor, itm_helmet_chitin, itm_helmet_plate, itm_tophat,
// High-storage
itm_backpack, itm_rucksack, itm_purse, itm_mbag, itm_fanny, itm_holster, itm_bootstrap,
itm_ragpouch, itm_leather_pouch,
// Decorative
itm_ring, itm_necklace,
// Ammunition
itm_battery, itm_thread, itm_sinew, itm_plant_fibre, itm_duct_tape, itm_cable, itm_plut_cell,
itm_nail, itm_bb, itm_arrow_wood, itm_arrow_cf,
itm_bolt_wood, itm_bolt_steel, itm_shot_bird, itm_shot_00, itm_shot_slug,
itm_shot_he, itm_22_lr, itm_22_cb, itm_22_ratshot, itm_9mm, itm_9mmP,
itm_9mmP2, itm_762_25, itm_38_special, itm_38_super, itm_10mm, itm_40sw, itm_44magnum,
itm_45_acp, itm_45_jhp, itm_45_super, itm_57mm, itm_46mm, itm_762_m43,
itm_762_m87, itm_223, itm_556, itm_556_incendiary, itm_270, itm_3006,
itm_3006_incendiary, itm_308, itm_762_51, itm_762_51_incendiary,
itm_laser_pack, itm_40mm_concussive, itm_40mm_frag, itm_40mm_incendiary,
itm_40mm_teargas, itm_40mm_smoke, itm_40mm_flashbang, itm_12mm, itm_plasma,
itm_charge_shot,
itm_shot_hull,
itm_9mm_casing, itm_38_casing, itm_40_casing, itm_44_casing, itm_45_casing,
itm_57mm_casing, itm_46mm_casing, itm_762_casing, itm_223_casing,
itm_3006_casing, itm_308_casing, itm_40mm_casing, itm_gunpowder,
itm_shotgun_primer, itm_smpistol_primer, itm_lgpistol_primer,
itm_smrifle_primer, itm_lgrifle_primer, itm_lead, itm_incendiary, itm_gasoline,
// Guns
itm_nailgun, itm_bbgun, itm_crossbow, itm_compbow, itm_longbow, itm_rifle_22,
itm_rifle_9mm, itm_smg_9mm, itm_smg_45, itm_sig_mosquito, itm_sw_22,
itm_glock_19, itm_usp_9mm, itm_sw_619, itm_taurus_38, itm_sig_40, itm_sw_610,
itm_ruger_redhawk, itm_deagle_44, itm_usp_45, itm_m1911, itm_fn57, itm_hk_ucp,
itm_tokarev,
itm_shotgun_sawn, itm_saiga_sawn, itm_shotgun_s, itm_shotgun_d, itm_remington_870,
itm_mossberg_500, itm_saiga_12, itm_american_180, itm_uzi, itm_tec9,
itm_calico, itm_hk_mp5, itm_mac_10, itm_hk_ump45, itm_TDI, itm_fn_p90,
itm_hk_mp7, itm_ppsh, itm_marlin_9a, itm_ruger_1022, itm_browning_blr,
itm_remington_700, itm_sks, itm_ruger_mini, itm_savage_111f, itm_hk_g3,
itm_hk_g36, itm_ak47, itm_fn_fal, itm_acr, itm_ar15, itm_m4a1, itm_scar_l,
itm_scar_h, itm_steyr_aug, itm_m249, itm_v29, itm_ftk93, itm_nx17,
itm_flamethrower_simple, itm_flamethrower, itm_launcher_simple, itm_m79,
itm_m320, itm_mgl, itm_coilgun, itm_hk_g80, itm_plasma_rifle,
itm_revolver_shotgun,
// Gun modifications
itm_silencer, itm_grip, itm_barrel_big, itm_barrel_small, itm_barrel_rifled,
itm_clip, itm_clip2, itm_spare_mag, itm_stablizer, itm_blowback, itm_autofire,
itm_retool_45, itm_retool_9mm, itm_retool_22, itm_retool_57, itm_retool_46,
itm_retool_308, itm_retool_223, itm_conversion_battle, itm_conversion_sniper,
itm_m203, itm_bayonet, itm_u_shotgun, itm_gun_crossbow,
// Books
itm_mag_porn, itm_mag_tv, itm_mag_news, itm_mag_cars, itm_mag_cooking,
itm_mag_carpentry,
itm_mag_guns, itm_mag_archery, itm_novel_romance, itm_novel_spy, itm_novel_scifi,
itm_novel_drama, itm_manual_brawl, itm_manual_knives, itm_manual_mechanics, itm_manual_survival,
itm_manual_speech, itm_manual_business, itm_manual_first_aid,
itm_manual_computers, itm_cookbook, itm_manual_electronics,
itm_manual_tailor, itm_manual_traps, itm_manual_carpentry,
itm_textbook_computers, itm_textbook_electronics, itm_textbook_business, itm_textbook_mechanics,
itm_textbook_chemistry, itm_textbook_carpentry, itm_SICP, itm_textbook_robots,
// Containers
itm_bag_plastic, itm_bottle_plastic, itm_bottle_glass,
itm_can_drink, itm_can_food, itm_box_small,
itm_canteen, itm_jerrycan, itm_jug_plastic, itm_flask_glass, itm_waterskin,
// Tools
itm_lighter, itm_sewing_kit, itm_scissors, itm_hammer, itm_extinguisher,
itm_flashlight, itm_flashlight_on, itm_hotplate, itm_soldering_iron,
itm_water_purifier, itm_two_way_radio, itm_radio, itm_radio_on, itm_roadmap, itm_crowbar,
itm_hoe, itm_shovel, itm_chainsaw_off, itm_chainsaw_on, itm_jackhammer, itm_jacqueshammer,
itm_bubblewrap, itm_beartrap, itm_board_trap, itm_tripwire, itm_crossbow_trap,
itm_shotgun_trap, itm_blade_trap, itm_light_snare_kit, itm_heavy_snare_kit, itm_landmine,
itm_geiger_off, itm_geiger_on, itm_teleporter, itm_canister_goo, itm_pipebomb, itm_pipebomb_act,
itm_grenade, itm_grenade_act, itm_flashbang, itm_flashbang_act, itm_EMPbomb,
itm_EMPbomb_act, itm_scrambler, itm_scrambler_act, itm_gasbomb, itm_gasbomb_act, itm_smokebomb,
itm_smokebomb_act, itm_molotov, itm_molotov_lit, itm_acidbomb,
itm_acidbomb_act, itm_dynamite, itm_dynamite_act, itm_firecracker_pack, itm_firecracker_pack_act,
itm_firecracker, itm_firecracker_act, itm_mininuke, itm_mininuke_act, itm_pheromone, itm_portal,
itm_bot_manhack, itm_bot_turret, itm_UPS_off, itm_UPS_on, itm_tazer, itm_mp3, itm_mp3_on,
itm_vortex_stone, itm_dogfood, itm_boobytrap, itm_c4, itm_c4armed, itm_dog_whistle,
itm_vacutainer, itm_welder, itm_cot, itm_rollmat, itm_xacto, itm_scalpel,
itm_machete, itm_katana, itm_spear_knife, itm_rapier, itm_pike, itm_broadsword,
itm_makeshift_machete, itm_makeshift_halberd, itm_knife_steak,
itm_knife_butcher, itm_knife_combat, itm_saw, itm_ax, itm_hacksaw,
itm_tent_kit, itm_torch, itm_torch_lit, itm_candle, itm_candle_lit,
itm_brazier, itm_puller, itm_press, itm_screwdriver, itm_wrench, itm_snare_trigger,
itm_boltcutters, itm_mop, itm_picklocks, itm_pickaxe, itm_spray_can, itm_rag,
itm_pda, itm_pda_flashlight, itm_pockknife, itm_needle_bone,
itm_primitive_hammer, itm_primitive_axe, itm_primitive_shovel, itm_digging_stick,
itm_shelter_kit, itm_damaged_shelter_kit,
// Bionics containers
itm_bionics_battery,
//power sources
itm_bionics_solar, itm_bionics_batteries,
itm_bionics_metabolics, itm_bionics_furnace, itm_bionics_ethanol,
// utility
itm_bionics_toolset, itm_bionics_storage, itm_bionics_flashlight,
itm_bionics_lighter, itm_bionics_magnet,
// neuro
itm_bionics_memory, itm_bionics_painkiller,itm_bionics_alarm,
// sensory
itm_bionics_ears, itm_bionics_eye_enhancer, itm_bionics_night_vision,
itm_bionics_infrared, itm_bionics_scent_vision,
// cbm: aquatic
itm_bionics_membrane, itm_bionics_gills,
// cbm: combat augs
itm_bionics_targeting, itm_bionics_ground_sonar,
// cbm: hazmat
itm_bionics_purifier, itm_bionics_climate, itm_bionics_heatsink, itm_bionics_blood_filter,
// nutritional
itm_bionics_recycler, itm_bionics_digestion, itm_bionics_evap, itm_bionics_water_extractor,
// desert survival (all dupes)
// melee:
itm_bionics_shock, itm_bionics_heat_absorb, itm_bionics_claws,
// armor:
itm_bionics_carbon, itm_bionics_armor_head, itm_bionics_armor_torso,
itm_bionics_armor_arms, itm_bionics_armor_legs,
// espionage
itm_bionics_face_mask, itm_bionics_scent_mask, itm_bionics_cloak, itm_bionics_fingerhack,
//defense
itm_bionics_ads, itm_bionics_ods,
// medical
itm_bionics_nanobots, itm_bionics_blood_anal,
// construction
itm_bionics_resonator, itm_bionics_hydraulics,
// super soldier
itm_bionics_time_freeze, itm_bionics_teleport,
// ranged combat
itm_bionics_blaster, itm_bionics_laser, itm_bionics_emp,
// Software
itm_software_useless, itm_software_hacking, itm_software_medical,
itm_software_math, itm_software_blood_data,
// MacGuffins!
itm_note,
//-----Jovan's. Flowers!-----
itm_poppy_flower, itm_poppy_bud,
//---------------------------
// Static (non-random) artifacts should go here.
num_items,
// These shouldn't be counted among "normal" items; thus, they are outside the
// bounds of num_items
itm_bio_claws, itm_bio_fusion, itm_bio_blaster,
// Unarmed Combat Styles
itm_style_karate, itm_style_aikido, itm_style_judo, itm_style_tai_chi,
itm_style_capoeira, itm_style_krav_maga, itm_style_muay_thai,
itm_style_ninjutsu, itm_style_taekwondo, itm_style_tiger, itm_style_crane,
itm_style_leopard, itm_style_snake, itm_style_dragon, itm_style_centipede,
itm_style_venom_snake, itm_style_scorpion, itm_style_lizard, itm_style_toad,
itm_style_zui_quan,
num_all_items
};
typedef std::string itype_id;
extern std::vector<std::string> unreal_itype_ids;
extern std::vector<std::string> martial_arts_itype_ids;
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
@@ -293,11 +49,13 @@ 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,
NUM_AMMO_TYPES
};
@@ -335,11 +93,22 @@ IF_SHOCK, // Stuns and damages enemies, powers up shockers.
IF_UNARMED_WEAPON, // Counts as an unarmed weapon
IF_NO_UNWIELD, // Impossible to unwield, e.g. bionic claws
IF_NO_UNLOAD, // Cannot be unloaded. For Fusion rifles and other ammo generating weapons.
IF_BACKBLAST, // Creates a backblast of smoke.
// Weapon mode flags
IF_MODE_AUX, // A gunmod with a firing mode
IF_MODE_BURST, // A burst of attacks
// Food status flags
IF_HOT, // hot food
IF_EATEN_HOT, // food meant to be eaten hot
IF_ROTTEN, // rotten food
// Clothing flags
IF_VARSIZE, // comes in variable sizes (item type flag)
IF_FIT, // clothing fits player (item specific flag)
NUM_ITEM_FLAGS
};
@@ -413,12 +182,12 @@ struct style_move
// Returns the name of a category of ammo (e.g. "shot")
std::string ammo_name(ammotype t);
// Returns the default ammo for a category of ammo (e.g. "itm_00_shot")
// Returns the default ammo for a category of ammo (e.g. ""00_shot"")
itype_id default_ammo(ammotype guntype);
struct itype
{
int id; // ID # that matches its place in master itype list
itype_id id; // ID # that matches its place in master itype list
// Used for save files; aligns to itype_id above.
unsigned char rarity; // How often it's found
unsigned int price; // Its value
@@ -450,6 +219,7 @@ struct itype
virtual bool is_gunmod() { return false; }
virtual bool is_bionic() { return false; }
virtual bool is_armor() { return false; }
virtual bool is_power_armor() { return false; }
virtual bool is_book() { return false; }
virtual bool is_tool() { return false; }
virtual bool is_container() { return false; }
@@ -464,7 +234,7 @@ struct itype
virtual std::string save_data() { return std::string(); }
itype() {
id = 0;
id = "null";
rarity = 0;
name = "none";
sym = '#';
@@ -479,7 +249,7 @@ struct itype
techniques = 0;
}
itype(int pid, unsigned char prarity, unsigned int pprice,
itype(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -536,7 +306,7 @@ struct it_comest : public itype
void (iuse::*use)(game *, player *, item *, bool);// Special effects of use
add_type add; // Effects of addiction
it_comest(int pid, unsigned char prarity, unsigned int pprice,
it_comest(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1,
unsigned short pvolume, unsigned short pweight,
@@ -563,6 +333,7 @@ struct it_comest : public itype
use = puse;
add = padd;
comesttype = pcomesttype;
item_flags = pitem_flags;
}
};
@@ -573,7 +344,7 @@ struct it_var_veh_part: public itype
unsigned int min_bigness; //CC's
unsigned int max_bigness;
it_var_veh_part(int pid, unsigned char prarity, unsigned int pprice,
it_var_veh_part(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -592,8 +363,8 @@ struct it_var_veh_part: public itype
virtual bool is_var_veh_part(){return true;}
virtual bool is_wheel() { return false; }
virtual bool is_engine() {
if (id < itm_1cyl_combustion) return false;
if (id > itm_v8_combustion) return false;
//FIX ME OH FUCKING GOD NOT EVERYTING SHOULD BE AN ENGINE
// TODO: glyphgryph
return true;
}
};
@@ -612,10 +383,10 @@ struct it_ammo : public itype
unsigned ammo_effects : NUM_AMMO_EFFECTS;
virtual bool is_ammo() { return true; }
// virtual bool count_by_charges() { return id != itm_gasoline; }
// virtual bool count_by_charges() { return id != "gasoline"; }
virtual bool count_by_charges() { return true; }
it_ammo(int pid, unsigned char prarity, unsigned int pprice,
it_ammo(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1,
unsigned short pvolume, unsigned short pweight,
@@ -652,7 +423,7 @@ struct it_gun : public itype
virtual bool is_gun() { return true; }
it_gun(int pid, unsigned char prarity, unsigned int pprice,
it_gun(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -688,7 +459,7 @@ struct it_gunmod : public itype
virtual bool is_gunmod() { return true; }
it_gunmod(int pid, unsigned char prarity, unsigned int pprice,
it_gunmod(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -727,7 +498,10 @@ struct it_armor : public itype
signed char warmth;
unsigned char storage;
bool power_armor;
virtual bool is_armor() { return true; }
virtual bool is_power_armor() { return power_armor; }
virtual bool is_artifact() { return false; }
virtual std::string save_data() { return std::string(); }
@@ -742,7 +516,7 @@ struct it_armor : public itype
storage = 0;
}
it_armor(int pid, unsigned char prarity, unsigned int pprice,
it_armor(itype_id pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -752,7 +526,7 @@ struct it_armor : public itype
unsigned char pcovers, signed char pencumber,
unsigned char pdmg_resist, unsigned char pcut_resist,
unsigned char penv_resist, signed char pwarmth,
unsigned char pstorage)
unsigned char pstorage, bool ppower_armor = false)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
covers = pcovers;
@@ -762,6 +536,7 @@ struct it_armor : public itype
env_resist = penv_resist;
warmth = pwarmth;
storage = pstorage;
power_armor = ppower_armor;
}
};
@@ -775,7 +550,7 @@ struct it_book : public itype
unsigned char time; // How long, in 10-turns (aka minutes), it takes to read
// "To read" means getting 1 skill point, not all of em
virtual bool is_book() { return true; }
it_book(int pid, unsigned char prarity, unsigned int pprice,
it_book(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -807,7 +582,7 @@ struct it_container : public itype
unsigned char contains; // Internal volume
unsigned flags : num_con_flags;
virtual bool is_container() { return true; }
it_container(int pid, unsigned char prarity, unsigned int pprice,
it_container(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -843,11 +618,11 @@ struct it_tool : public itype
def_charges = 0;
charges_per_use = 0;
turns_per_charge = 0;
revert_to = itm_null;
revert_to = "null";
use = &iuse::none;
}
it_tool(int pid, unsigned char prarity, unsigned int pprice,
it_tool(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -877,23 +652,18 @@ struct it_bionic : public itype
virtual bool is_bionic() { return true; }
it_bionic(int pid, unsigned char prarity, unsigned int pprice,
it_bionic(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
int pdifficulty, ...)
int pdifficulty)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
difficulty = pdifficulty;
va_list ap;
va_start(ap, pdifficulty);
bionic_id tmp;
while ((tmp = (bionic_id)va_arg(ap, int)))
options.push_back(tmp);
va_end(ap);
options.push_back(id);
}
};
@@ -904,7 +674,7 @@ struct it_macguffin : public itype
virtual bool is_macguffin() { return true; }
it_macguffin(int pid, unsigned char prarity, unsigned int pprice,
it_macguffin(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -927,7 +697,7 @@ struct it_software : public itype
virtual bool is_software() { return true; }
it_software(int pid, unsigned char prarity, unsigned int pprice,
it_software(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
@@ -948,7 +718,7 @@ struct it_style : public itype
std::vector<style_move> moves;
it_style(int pid, unsigned char prarity, unsigned int pprice,
it_style(std::string pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
@@ -1005,11 +775,11 @@ struct it_artifact_tool : public it_tool
def_charges = 0;
charges_per_use = 1;
turns_per_charge = 0;
revert_to = itm_null;
revert_to = "null";
use = &iuse::artifact;
};
it_artifact_tool(int pid, unsigned int pprice, std::string pname,
it_artifact_tool(std::string pid, unsigned int pprice, std::string pname,
std::string pdes, char psym, nc_color pcolor, material pm1,
material pm2, unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
@@ -1017,7 +787,7 @@ struct it_artifact_tool : public it_tool
:it_tool(pid, 0, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags,
0, 0, 1, 0, AT_NULL, itm_null, &iuse::artifact) { };
0, 0, 1, 0, AT_NULL, "null", &iuse::artifact) { };
};
struct it_artifact_armor : public it_armor
@@ -1058,7 +828,7 @@ struct it_artifact_armor : public it_armor
price = 0;
};
it_artifact_armor(int pid, unsigned int pprice, std::string pname,
it_artifact_armor(std::string pid, unsigned int pprice, std::string pname,
std::string pdes, char psym, nc_color pcolor, material pm1,
material pm2, unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
+2271 -2274
View File
File diff suppressed because it is too large Load Diff
+827 -559
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -18,6 +18,7 @@ class iuse
void firstaid (game *g, player *p, item *it, bool t);
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);
@@ -55,12 +56,17 @@ class iuse
void hammer (game *g, player *p, item *it, bool t);
void light_off (game *g, player *p, item *it, bool t);
void light_on (game *g, player *p, item *it, bool t);
void lightstrip (game *g, player *p, item *it, bool t);
void cauterize_elec (game *g, player *p, item *it, bool t);
void water_purifier (game *g, player *p, item *it, bool t);
void two_way_radio (game *g, player *p, item *it, bool t);
void radio_off (game *g, player *p, item *it, bool t);
void radio_on (game *g, player *p, item *it, bool t);
void noise_emitter_off(game *g, player *p, item *it, bool t);
void noise_emitter_on (game *g, player *p, item *it, bool t);
void roadmap (game *g, player *p, item *it, bool t);
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 crowbar (game *g, player *p, item *it, bool t);
void makemound (game *g, player *p, item *it, bool t);
@@ -132,6 +138,9 @@ class iuse
void rag (game *g, player *p, item *it, bool t);
void pda (game *g, player *p, item *it, bool t);
void pda_flashlight (game *g, player *p, item *it, bool t);
void LAW (game *g, player *p, item *it, bool t);
void heatpack (game *g, player *p, item *it, bool t);
// MACGUFFINS
void mcg_note (game *g, player *p, item *it, bool t);
+17
View File
@@ -8,6 +8,23 @@ long input(long ch)
ch = getch();
}
// Needs a totally seperate implementation for windows
#if !(defined _WIN32 || defined WINDOWS)
int newch;
// Clear the buffer of characters that match the one we're going to act on.
timeout(0);
do {
newch = getch();
} while( newch != ERR && newch == ch );
timeout(-1);
// If we read a different character than the one we're going to act on, re-queue it.
if (newch != ERR && newch != ch) {
ungetch(newch);
}
#endif
switch (ch) {
case KEY_UP: return 'k';
case KEY_LEFT: return 'h';
+202 -299
View File
@@ -3,314 +3,333 @@
#include "game.h"
#include "lightmap.h"
#define INBOUNDS(x, y) (x >= -SEEX && x <= SEEX && y >= -SEEY && y <= SEEY)
#define INBOUNDS_LARGE(x, y) (x >= -LIGHTMAP_RANGE_X && x <= LIGHTMAP_RANGE_X &&\
y >= -LIGHTMAP_RANGE_Y && y <= LIGHTMAP_RANGE_Y)
#define INBOUNDS(x, y) \
(x >= 0 && x < SEEX * MAPSIZE && y >= 0 && y < SEEY * MAPSIZE)
#define LIGHTMAP_CACHE_X SEEX * MAPSIZE
#define LIGHTMAP_CACHE_Y SEEY * MAPSIZE
light_map::light_map()
: lm()
, sm()
void map::generate_lightmap(game* g)
{
memset(lm, 0, sizeof(lm));
memset(sm, 0, sizeof(sm));
}
void light_map::generate(game* g, int x, int y, float natural_light, float luminance)
{
build_light_cache(g, x, y);
memset(lm, 0, sizeof(lm));
memset(sm, 0, sizeof(sm));
int dir_x[] = { 1, 0 , -1, 0 };
int dir_y[] = { 0, 1 , 0, -1 };
int dir_d[] = { 180, 270, 0, 90 };
const int dir_x[] = { 1, 0 , -1, 0 };
const int dir_y[] = { 0, 1 , 0, -1 };
const int dir_d[] = { 180, 270, 0, 90 };
const float luminance = g->u.active_light();
const float natural_light = g->natural_light_level();
// Daylight vision handling returned back to map due to issues it causes here
if (natural_light > LIGHT_SOURCE_BRIGHT) {
// Apply sunlight, first light source so just assign
for(int sx = x - SEEX; sx <= x + SEEX; ++sx) {
for(int sy = y - SEEY; sy <= y + SEEY; ++sy) {
for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx) {
for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy) {
// In bright light indoor light exists to some degree
if (!is_outside(sx - x, sy - y))
lm[sx - x + SEEX][sy - y + SEEY] = LIGHT_AMBIENT_LOW;
if (!g->m.is_outside(sx, sy))
lm[sx][sy] = LIGHT_AMBIENT_LOW;
}
}
}
// Apply player light sources
if (luminance > LIGHT_AMBIENT_LOW)
apply_light_source(g->u.posx, g->u.posy, x, y, luminance);
apply_light_source(g->u.posx, g->u.posy, luminance);
for(int sx = x - LIGHTMAP_RANGE_X; sx <= x + LIGHTMAP_RANGE_X; ++sx) {
for(int sy = y - LIGHTMAP_RANGE_Y; sy <= y + LIGHTMAP_RANGE_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);
// When underground natural_light is 0, if this changes we need to revisit
if (natural_light > LIGHT_AMBIENT_LOW) {
if (!is_outside(sx - x, sy - y)) {
// Apply light sources for external/internal divide
for(int i = 0; i < 4; ++i) {
if (INBOUNDS_LARGE(sx - x + dir_x[i], sy - y + dir_y[i]) &&
is_outside(sx - x + dir_x[i], sy - y + dir_y[i])) {
if (INBOUNDS(sx - x, sy - y) && is_outside(0, 0))
lm[sx - x + SEEX][sy - y + SEEY] = natural_light;
for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx) {
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);
// 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)) {
// Apply light sources for external/internal divide
for(int i = 0; i < 4; ++i) {
if (INBOUNDS(sx + dir_x[i], sy + dir_y[i]) &&
g->m.is_outside(sx + dir_x[i], sy + dir_y[i])) {
if (INBOUNDS(sx, sy) && g->m.is_outside(0, 0))
lm[sx][sy] = natural_light;
if (c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].transparency > LIGHT_TRANSPARENCY_SOLID)
apply_light_arc(sx, sy, dir_d[i], x, y, natural_light);
if (g->m.light_transparency(sx, sy) > LIGHT_TRANSPARENCY_SOLID)
apply_light_arc(sx, sy, dir_d[i], natural_light);
}
}
}
}
}
// TODO: make this bit use item flags
// may need to make item::has_flag const first
if (items.size() == 1 &&
items[0].type->id == "flashlight_on")
apply_light_source(sx, sy, 20);
if (items.size() == 1 &&
items[0].type->id == itm_flashlight_on)
apply_light_source(sx, sy, x, y, 20);
items[0].type->id == "lightstrip")
apply_light_source(sx, sy, 1);
if(terrain == t_lava)
apply_light_source(sx, sy, x, y, 50);
apply_light_source(sx, sy, 50);
if(terrain == t_console)
apply_light_source(sx, sy, x, y, 3);
apply_light_source(sx, sy, 3);
if (items.size() == 1 &&
items[0].type->id == itm_candle_lit)
apply_light_source(sx, sy, x, y, 4);
items[0].type->id == "candle_lit")
apply_light_source(sx, sy, 4);
if(terrain == t_emergency_light)
apply_light_source(sx, sy, x, y, 3);
apply_light_source(sx, sy, 3);
// TODO: [lightmap] Attach light brightness to fields
switch(current_field.type) {
switch(current_field.type) {
case fd_fire:
if (3 == current_field.density)
apply_light_source(sx, sy, x, y, 160);
apply_light_source(sx, sy, 160);
else if (2 == current_field.density)
apply_light_source(sx, sy, x, y, 60);
apply_light_source(sx, sy, 60);
else
apply_light_source(sx, sy, x, y, 16);
apply_light_source(sx, sy, 16);
break;
case fd_fire_vent:
case fd_flame_burst:
apply_light_source(sx, sy, x, y, 8);
apply_light_source(sx, sy, 8);
break;
case fd_electricity:
if (3 == current_field.density)
apply_light_source(sx, sy, x, y, 8);
apply_light_source(sx, sy, 8);
else if (2 == current_field.density)
apply_light_source(sx, sy, x, y, 1);
apply_light_source(sx, sy, 1);
else
apply_light_source(sx, sy, x, y, LIGHT_SOURCE_LOCAL); // kinda a hack as the square will still get marked
apply_light_source(sx, sy, LIGHT_SOURCE_LOCAL); // kinda a hack as the square will still get marked
break;
}
}
}
// Apply any vehicle light sources
if (c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].veh &&
c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].veh_light > LL_DARK) {
if (c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].veh_light > LL_LIT) {
int dir = c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].veh->face.dir();
float luminance = c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].veh_light;
apply_light_arc(sx, sy, dir, x, y, luminance);
}
for (int i = 0; i < g->z.size(); ++i) {
int mx = g->z[i].posx;
int my = g->z[i].posy;
if (INBOUNDS(mx, my)) {
if (g->z[i].has_effect(ME_ONFIRE)) {
apply_light_source(mx, my, 3);
}
// TODO: [lightmap] Attach natural light brightness to creatures
// TODO: [lightmap] Allow creatures to have light attacks (ie: eyebot)
// TODO: [lightmap] Allow creatures to have facing and arc lights
switch (g->z[i].type->id) {
case mon_zombie_electric:
apply_light_source(mx, my, 1);
break;
case mon_turret:
apply_light_source(mx, my, 2);
break;
case mon_flaming_eye:
apply_light_source(mx, my, LIGHT_SOURCE_BRIGHT);
break;
case mon_manhack:
apply_light_source(mx, my, LIGHT_SOURCE_LOCAL);
break;
}
}
}
if (c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].mon >= 0) {
if (g->z[c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].mon].has_effect(ME_ONFIRE))
apply_light_source(sx, sy, x, y, 3);
// TODO: [lightmap] Attach natural light brightness to creatures
// TODO: [lightmap] Allow creatures to have light attacks (ie: eyebot)
// TODO: [lightmap] Allow creatures to have facing and arc lights
switch(g->z[c[sx - x + LIGHTMAP_RANGE_X][sy - y + LIGHTMAP_RANGE_Y].mon].type->id) {
case mon_zombie_electric:
apply_light_source(sx, sy, x, y, 1);
break;
case mon_turret:
apply_light_source(sx, sy, x, y, 2);
break;
case mon_flaming_eye:
apply_light_source(sx, sy, x, y, LIGHT_SOURCE_BRIGHT);
break;
case mon_manhack:
apply_light_source(sx, sy, x, y, LIGHT_SOURCE_LOCAL);
break;
// Apply any vehicle light sources
VehicleList vehs = g->m.get_vehicles();
for(int v = 0; v < vehs.size(); ++v) {
if(vehs[v].v->lights_on) {
int dir = vehs[v].v->face.dir();
for (std::vector<int>::iterator part = vehs[v].v->external_parts.begin();
part != vehs[v].v->external_parts.end(); ++part) {
int px = vehs[v].x + vehs[v].v->parts[*part].precalc_dx[0];
int py = vehs[v].y + vehs[v].v->parts[*part].precalc_dy[0];
if(INBOUNDS(px, py)) {
int dpart = vehs[v].v->part_with_feature(*part , vpf_light);
if (dpart >= 0) {
float luminance = vehs[v].v->part_info(dpart).power;
if (luminance > LL_LIT) {
apply_light_arc(px, py, dir, luminance);
}
}
}
}
}
}
}
lit_level light_map::at(int dx, int dy)
lit_level map::light_at(int dx, int dy)
{
if (!INBOUNDS(dx, dy))
return LL_DARK; // Out of bounds
if (sm[dx + SEEX][dy + SEEY] >= LIGHT_SOURCE_BRIGHT)
if (sm[dx][dy] >= LIGHT_SOURCE_BRIGHT)
return LL_BRIGHT;
if (lm[dx + SEEX][dy + SEEY] >= LIGHT_AMBIENT_LIT)
if (lm[dx][dy] >= LIGHT_AMBIENT_LIT)
return LL_LIT;
if (lm[dx + SEEX][dy + SEEY] >= LIGHT_AMBIENT_LOW)
if (lm[dx][dy] >= LIGHT_AMBIENT_LOW)
return LL_LOW;
return LL_DARK;
}
float light_map::ambient_at(int dx, int dy)
float map::ambient_light_at(int dx, int dy)
{
if (!INBOUNDS(dx, dy))
return 0.0f;
return lm[dx + SEEX][dy + SEEY];
return lm[dx][dy];
}
bool light_map::is_outside(int dx, int dy)
bool map::pl_sees(int fx, int fy, int tx, int ty, int max_range)
{
// We don't know and true seems a better default than false
if (!INBOUNDS_LARGE(dx, dy))
return true;
return outside_cache[dx + LIGHTMAP_RANGE_X][dy + LIGHTMAP_RANGE_Y];
}
bool light_map::sees(int fx, int fy, int tx, int ty, int max_range)
{
if(!INBOUNDS_LARGE(fx, fy) || !INBOUNDS_LARGE(tx, ty))
return false;
if (!INBOUNDS(tx, ty)) return false;
if (max_range >= 0 && (abs(tx - fx) > max_range || abs(ty - fy) > max_range))
return false; // Out of range!
int ax = abs(tx - fx) << 1;
int ay = abs(ty - fy) << 1;
int dx = (fx < tx) ? 1 : -1;
int dy = (fy < ty) ? 1 : -1;
int x = fx;
int y = fy;
// TODO: [lightmap] Pull out the common code here rather than duplication
if (ax > ay) {
int t = ay - (ax >> 1);
do {
if(t >= 0 && ((y + dy != ty) || (x + dx == tx))) {
y += dy;
t -= ax;
}
x += dx;
t += ay;
if(c[x + LIGHTMAP_RANGE_X][y + LIGHTMAP_RANGE_Y].transparency == LIGHT_TRANSPARENCY_SOLID)
break;
} while(!(x == tx && y == ty));
} else {
int t = ax - (ay >> 1);
do {
if(t >= 0 && ((x + dx != tx) || (y + dy == ty))) {
x += dx;
t -= ay;
}
y += dy;
t += ax;
if(c[x + LIGHTMAP_RANGE_X][y + LIGHTMAP_RANGE_Y].transparency == LIGHT_TRANSPARENCY_SOLID)
break;
} while(!(x == tx && y == ty));
}
return (x == tx && y == ty);
return seen_cache[tx][ty];
}
void light_map::apply_light_source(int x, int y, int cx, int cy, float luminance)
void map::cache_seen(int fx, int fy, int tx, int ty, int max_range)
{
bool lit[LIGHTMAP_X][LIGHTMAP_Y];
if (!INBOUNDS(fx, fy) || !INBOUNDS(tx, ty)) return;
const int ax = abs(tx - fx) << 1;
const int ay = abs(ty - fy) << 1;
const int dx = (fx < tx) ? 1 : -1;
const int dy = (fy < ty) ? 1 : -1;
int x = fx;
int y = fy;
int seen = true;
// TODO: [lightmap] Pull out the common code here rather than duplication
if (ax > ay)
{
int t = ay - (ax >> 1);
do
{
if(t >= 0 && ((y + dy != ty) || (x + dx == tx)))
{
y += dy;
t -= ax;
}
x += dx;
t += ay;
seen_cache[x][y] |= seen;
if(light_transparency(x, y) == LIGHT_TRANSPARENCY_SOLID) seen = false;
} while(!(x == tx && y == ty));
}
else
{
int t = ax - (ay >> 1);
do
{
if(t >= 0 && ((x + dx != tx) || (y + dy == ty)))
{
x += dx;
t -= ay;
}
y += dy;
t += ax;
seen_cache[x][y] |= seen;
if(light_transparency(x, y) == LIGHT_TRANSPARENCY_SOLID) seen = false;
} while(!(x == tx && y == ty));
}
}
void map::apply_light_source(int x, int y, float luminance)
{
bool lit[LIGHTMAP_CACHE_X][LIGHTMAP_CACHE_Y];
memset(lit, 0, sizeof(lit));
if (INBOUNDS(x - cx, y - cy)) {
lit[x - cx + SEEX][y - cy + SEEY] = true;
lm[x - cx + SEEX][y - cy + SEEY] += std::max(luminance, static_cast<float>(LL_LOW));
sm[x - cx + SEEX][y - cy + SEEY] += luminance;
if (INBOUNDS(x, y)) {
lit[x][y] = true;
lm[x][y] += std::max(luminance, static_cast<float>(LL_LOW));
sm[x][y] += luminance;
}
if (luminance > LIGHT_SOURCE_LOCAL) {
int range = LIGHT_RANGE(luminance);
int sx = x - cx - range; int ex = x - cx + range;
int sy = y - cy - range; int ey = y - cy + range;
int sx = x - range; int ex = x + range;
int sy = y - range; int ey = y + range;
for(int off = sx; off <= ex; ++off) {
apply_light_ray(lit, x, y, cx + off, cy + sy, cx, cy, luminance);
apply_light_ray(lit, x, y, cx + off, cy + ey, cx, cy, luminance);
apply_light_ray(lit, x, y, off, sy, luminance);
apply_light_ray(lit, x, y, off, ey, luminance);
}
// Skip corners with + 1 and < as they were done
for(int off = sy + 1; off < ey; ++off) {
apply_light_ray(lit, x, y, cx + sx, cy + off, cx, cy, luminance);
apply_light_ray(lit, x, y, cx + ex, cy + off, cx, cy, luminance);
apply_light_ray(lit, x, y, sx, off, luminance);
apply_light_ray(lit, x, y, ex, off, luminance);
}
}
}
void light_map::apply_light_arc(int x, int y, int angle, int cx, int cy, float luminance)
void map::apply_light_arc(int x, int y, int angle, float luminance)
{
if (luminance <= LIGHT_SOURCE_LOCAL)
return;
bool lit[LIGHTMAP_X][LIGHTMAP_Y];
bool lit[LIGHTMAP_CACHE_X][LIGHTMAP_CACHE_Y];
memset(lit, 0, sizeof(lit));
int range = LIGHT_RANGE(luminance);
apply_light_source(x, y, cx, cy, LIGHT_SOURCE_LOCAL);
apply_light_source(x, y, LIGHT_SOURCE_LOCAL);
// Normalise (should work with negative values too)
angle = angle % 360;
// East side
if (angle < 90 || angle > 270) {
int sy = y - cy - ((angle < 90) ? range * (( 45 - angle) / 45.0f) : range);
int ey = y - cy + ((angle > 270) ? range * ((angle - 315) / 45.0f) : range);
int sy = y - ((angle < 90) ? range * (( 45 - angle) / 45.0f) : range);
int ey = y + ((angle > 270) ? range * ((angle - 315) / 45.0f) : range);
int ox = x - cx + range;
int ox = x + range;
for(int oy = sy; oy <= ey; ++oy)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, luminance);
apply_light_ray(lit, x, y, ox, oy, luminance);
}
// South side
if (angle < 180) {
int sx = x - cx - ((angle < 90) ? range * (( angle - 45) / 45.0f) : range);
int ex = x - cx + ((angle > 90) ? range * ((135 - angle) / 45.0f) : range);
int sx = x - ((angle < 90) ? range * (( angle - 45) / 45.0f) : range);
int ex = x + ((angle > 90) ? range * ((135 - angle) / 45.0f) : range);
int oy = y - cy + range;
int oy = y + range;
for(int ox = sx; ox <= ex; ++ox)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, luminance);
apply_light_ray(lit, x, y, ox, oy, luminance);
}
// West side
if (angle > 90 && angle < 270) {
int sy = y - cy - ((angle < 180) ? range * ((angle - 135) / 45.0f) : range);
int ey = y - cy + ((angle > 180) ? range * ((225 - angle) / 45.0f) : range);
int sy = y - ((angle < 180) ? range * ((angle - 135) / 45.0f) : range);
int ey = y + ((angle > 180) ? range * ((225 - angle) / 45.0f) : range);
int ox = x - cx - range;
int ox = x - range;
for(int oy = sy; oy <= ey; ++oy)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, luminance);
apply_light_ray(lit, x, y, ox, oy, luminance);
}
// North side
if (angle > 180) {
int sx = x - cx - ((angle > 270) ? range * ((315 - angle) / 45.0f) : range);
int ex = x - cx + ((angle < 270) ? range * ((angle - 225) / 45.0f) : range);
int sx = x - ((angle > 270) ? range * ((315 - angle) / 45.0f) : range);
int ex = x + ((angle < 270) ? range * ((angle - 225) / 45.0f) : range);
int oy = y - cy - range;
int oy = y - range;
for(int ox = sx; ox <= ex; ++ox)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, luminance);
apply_light_ray(lit, x, y, ox, oy, luminance);
}
}
void light_map::apply_light_ray(bool lit[LIGHTMAP_X][LIGHTMAP_Y], int sx, int sy,
int ex, int ey, int cx, int cy, float luminance)
void map::apply_light_ray(bool lit[LIGHTMAP_CACHE_X][LIGHTMAP_CACHE_Y],
int sx, int sy, int ex, int ey, float luminance)
{
int ax = abs(ex - sx) << 1;
int ay = abs(ey - sy) << 1;
@@ -333,17 +352,17 @@ void light_map::apply_light_ray(bool lit[LIGHTMAP_X][LIGHTMAP_Y], int sx, int sy
x += dx;
t += ay;
if (INBOUNDS(x - cx, y - cy) && !lit[x - cx + SEEX][y - cy + SEEY]) {
if (INBOUNDS(x, y) && !lit[x][y]) {
// Multiple rays will pass through the same squares so we need to record that
lit[x - cx + SEEX][y - cy + SEEY] = true;
lit[x][y] = true;
// We know x is the longest angle here and squares can ignore the abs calculation
float light = luminance / ((sx - x) * (sx - x));
lm[x - cx + SEEX][y - cy + SEEY] += light * transparency;
lm[x][y] += light * transparency;
}
if (INBOUNDS_LARGE(x - cx, y - cy))
transparency *= c[x - cx + LIGHTMAP_RANGE_X][y - cy + LIGHTMAP_RANGE_Y].transparency;
if (INBOUNDS(x, y))
transparency *= light_transparency(x, y);
if (transparency <= LIGHT_TRANSPARENCY_SOLID)
break;
@@ -360,17 +379,17 @@ void light_map::apply_light_ray(bool lit[LIGHTMAP_X][LIGHTMAP_Y], int sx, int sy
y += dy;
t += ax;
if (INBOUNDS(x - cx, y - cy) && !lit[x - cx + SEEX][y - cy + SEEY]) {
if (INBOUNDS(x, y) && !lit[x][y]) {
// Multiple rays will pass through the same squares so we need to record that
lit[x - cx + SEEX][y - cy + SEEY] = true;
lit[x][y] = true;
// We know y is the longest angle here and squares can ignore the abs calculation
float light = luminance / ((sy - y) * (sy - y));
lm[x - cx + SEEX][y - cy + SEEY] += light;
lm[x][y] += light;
}
if (INBOUNDS_LARGE(x - cx, y - cy))
transparency *= c[x - cx + LIGHTMAP_RANGE_X][y - cy + LIGHTMAP_RANGE_Y].transparency;
if (INBOUNDS(x, y))
transparency *= light_transparency(x, y);
if (transparency <= LIGHT_TRANSPARENCY_SOLID)
break;
@@ -378,119 +397,3 @@ void light_map::apply_light_ray(bool lit[LIGHTMAP_X][LIGHTMAP_Y], int sx, int sy
} while(!(x == ex && y == ey));
}
}
void light_map::build_outside_cache(map *m, const int x, const int y, const int sx, const int sy)
{
const ter_id terrain = m->ter(sx, sy);
if( terrain == t_floor || terrain == t_rock_floor || terrain == t_floor_wax ||
terrain == t_fema_groundsheet || terrain == t_dirtfloor) {
for( int dx = -1; dx <= 1; dx++ ) {
for( int dy = -1; dy <= 1; dy++ ) {
outside_cache[x + dx][y + dy] = false;
}
}
} else if(terrain == t_bed || terrain == t_groundsheet || terrain == t_makeshift_bed) {
outside_cache[x][y] = false;
}
}
// We only do this once now so we don't make 100k calls to is_outside for each
// generation. As well as close to that for the veh_at function.
void light_map::build_light_cache(game* g, int cx, int cy)
{
// Clear cache
memset(outside_cache, true, sizeof(outside_cache));
for(int x = 0; x < LIGHTMAP_CACHE_X; x++) {
for(int y = 0; y < LIGHTMAP_CACHE_Y; y++) {
int sx = x + g->u.posx - LIGHTMAP_RANGE_X;
int sy = y + g->u.posy - LIGHTMAP_RANGE_Y;
build_outside_cache(&g->m, x, y, sx, sy);
c[x][y].transparency = LIGHT_TRANSPARENCY_CLEAR;
c[x][y].veh = NULL;
c[x][y].veh_part = 0;
c[x][y].veh_light = 0;
c[x][y].mon = -1;
}
}
// Check for critters and cache
for (int i = 0; i < g->z.size(); ++i)
if (INBOUNDS(g->z[i].posx - cx, g->z[i].posy - cy))
c[g->z[i].posx - cx + LIGHTMAP_RANGE_X][g->z[i].posy - cy + LIGHTMAP_RANGE_Y].mon = i;
// Check for vehicles and cache
VehicleList vehs = g->m.get_vehicles(cx - LIGHTMAP_RANGE_X, cy - LIGHTMAP_RANGE_Y, cx + LIGHTMAP_RANGE_X, cy + LIGHTMAP_RANGE_Y);
for(int v = 0; v < vehs.size(); ++v) {
for(int p = 0; p < vehs[v].v->parts.size(); ++p) {
int px = vehs[v].x + vehs[v].v->parts[p].precalc_dx[0] - cx;
int py = vehs[v].y + vehs[v].v->parts[p].precalc_dy[0] - cy;
if (INBOUNDS(px, py)) {
px += LIGHTMAP_RANGE_X;
py += LIGHTMAP_RANGE_Y;
if (vehs[v].v->is_inside(p))
outside_cache[px][py] = true;
// External part appears to always be the first?
if (!c[px][py].veh) {
c[px][py].veh = vehs[v].v;
c[px][py].veh_part = p;
}
if (vehs[v].v->lights_on &&
vehs[v].v->part_flag(p, vpf_light) &&
vehs[v].v->parts[p].hp > 0)
c[px][py].veh_light = vehs[v].v->part_info(p).power;
}
}
}
for(int x = 0; x < LIGHTMAP_CACHE_X; x++) {
for(int y = 0; y < LIGHTMAP_CACHE_Y; y++) {
int sx = x + cx - LIGHTMAP_RANGE_X;
int sy = y + cy - LIGHTMAP_RANGE_Y;
if (c[x][y].veh) {
if (c[x][y].veh->part_flag(c[x][y].veh_part, vpf_opaque) &&
c[x][y].veh->parts[c[x][y].veh_part].hp > 0) {
int dpart = c[x][y].veh->part_with_feature(c[x][y].veh_part, vpf_openable);
if (dpart < 0 || !c[x][y].veh->parts[dpart].open) {
c[x][y].transparency = LIGHT_TRANSPARENCY_SOLID;
continue;
}
}
} else if (!(terlist[g->m.ter(sx, sy)].flags & mfb(transparent))) {
c[x][y].transparency = LIGHT_TRANSPARENCY_SOLID;
continue;
}
field& f = g->m.field_at(sx, sy);
if(f.type > 0) {
if(!fieldlist[f.type].transparent[f.density - 1]) {
// Fields are either transparent or not, however we want some to be translucent
switch(f.type) {
case fd_smoke:
case fd_toxic_gas:
case fd_tear_gas:
if(f.density == 3)
c[x][y].transparency = LIGHT_TRANSPARENCY_SOLID;
if(f.density == 2)
c[x][y].transparency *= 0.5;
break;
case fd_nuke_gas:
c[x][y].transparency *= 0.5;
break;
default:
c[x][y].transparency = LIGHT_TRANSPARENCY_SOLID;
break;
}
}
// TODO: [lightmap] Have glass reduce light as well
}
}
}
}
-51
View File
@@ -1,9 +1,6 @@
#ifndef _LIGHTMAP_H_
#define _LIGHTMAP_H_
#include "mapdata.h"
#include "map.h"
#define LIGHT_SOURCE_LOCAL 0.1
#define LIGHT_SOURCE_BRIGHT 10
@@ -13,17 +10,7 @@
#define LIGHT_TRANSPARENCY_SOLID 0
#define LIGHT_TRANSPARENCY_CLEAR 1
#define LIGHTMAP_X (2 * SEEX + 1)
#define LIGHTMAP_Y (2 * SEEY + 1)
#define LIGHT_RANGE(b) static_cast<int>(sqrt(b / LIGHT_AMBIENT_LOW) + 1)
#define LIGHT_MAX_RANGE_X (SEEX*(MAPSIZE/2))
#define LIGHT_MAX_RANGE_Y (SEEX*(MAPSIZE/2))
#define LIGHTMAP_RANGE_X (SEEX + LIGHT_MAX_RANGE_X)
#define LIGHTMAP_RANGE_Y (SEEY + LIGHT_MAX_RANGE_Y)
#define LIGHTMAP_CACHE_X (2 * LIGHTMAP_RANGE_X + 1)
#define LIGHTMAP_CACHE_Y (2 * LIGHTMAP_RANGE_Y + 1)
enum lit_level {
LL_DARK = 0,
@@ -32,42 +19,4 @@ enum lit_level {
LL_BRIGHT // Probably only for light sources
};
struct light_map_cache {
float transparency;
vehicle* veh;
int veh_part;
int veh_light;
int mon;
};
class light_map
{
public:
light_map();
void generate(game* g, int x, int y, float natural_light, float luminance);
lit_level at(int dx, int dy); // Assumes 0,0 is light map center
float ambient_at(int dx, int dy); // Raw values for tilesets
bool is_outside(int dx, int dy);
bool sees(int fx, int fy, int tx, int ty, int max_range);
private:
typedef light_map_cache light_cache[LIGHTMAP_CACHE_X][LIGHTMAP_CACHE_Y];
float lm[LIGHTMAP_X][LIGHTMAP_Y];
float sm[LIGHTMAP_X][LIGHTMAP_Y];
bool outside_cache[LIGHTMAP_CACHE_X][LIGHTMAP_CACHE_Y];
light_cache c;
void apply_light_source(int x, int y, int cx, int cy, float luminance);
void apply_light_arc(int x, int y, int angle, int cx, int cy, float luminance);
void apply_light_ray(bool lit[LIGHTMAP_X][LIGHTMAP_Y], int sx, int sy,
int ex, int ey, int cx, int cy, float luminance);
void build_outside_cache(map *m, const int x, const int y, const int sx, const int sy);
void build_light_cache(game* g, int x, int y);
};
#endif
+496 -235
View File
File diff suppressed because it is too large Load Diff
+31 -8
View File
@@ -17,6 +17,7 @@
#include "npc.h"
#include "vehicle.h"
#include "graffiti.h"
#include "lightmap.h"
#define MAPSIZE 11
#define CAMPSIZE 1
@@ -43,7 +44,7 @@ class map
// Constructors & Initialization
map();
map(std::vector<itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
map(std::map<std::string, itype*>* itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
~map();
@@ -51,7 +52,7 @@ class map
void draw(game *g, WINDOW* w, const point center);
void debug();
void drawsq(WINDOW* w, player &u, const int x, const int y, const bool invert, const bool show_items,
const int cx = -1, const int cy = -1,
const int view_center_x = -1, const int view_center_y = -1,
const bool low_light = false, const bool bright_level = false);
// File I/O
@@ -65,12 +66,12 @@ class map
// Movement and LOS
int move_cost(const int x, const int y); // Cost to move through; 0 = impassible
int move_cost_ter_only(const int x, const int y); // same as above, but don't take vehicles into account
bool trans(const int x, const int y, char * trans_buf = NULL); // Transparent?
bool trans(const int x, const int y); // Transparent?
// (Fx, Fy) sees (Tx, Ty), within a range of (range)?
// tc indicates the Bresenham line used to connect the two points, and may
// subsequently be used to form a path between them
bool sees(const int Fx, const int Fy, const int Tx, const int Ty,
const int range, int &tc, char * trans_buf = NULL);
const int range, int &tc);
// clear_path is the same idea, but uses cost_min <= move_cost <= cost_max
bool clear_path(const int Fx, const int Fy, const int Tx, const int Ty,
const int range, const int cost_min, const int cost_max, int &tc);
@@ -105,7 +106,8 @@ class map
bool displace_water (const int x, const int y);
// Terrain
ter_id& ter(const int x, const int y); // Terrain at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
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);
bool is_indoor(const int x, const int y); // Check if current ter is indoors
std::string tername(const int x, const int y); // Name of terrain at (x, y)
std::string features(const int x, const int y); // Words relevant to terrain (sharp, etc)
@@ -139,7 +141,7 @@ class map
void i_clear(const int x, const int y);
void i_rem(const int x, const int y, const int index);
point find_item(const item *it);
void add_item(const int x, const int y, itype* type, int birthday, int quantity = 0);
void spawn_item(const int x, const int y, itype* type, int birthday, int quantity = 0, int charges = 0);
void add_item(const int x, const int y, item new_item);
void process_active_items(game *g);
void process_active_items_in_submap(game *g, const int nonant);
@@ -191,8 +193,13 @@ class map
void create_anomaly(const int cx, const int cy, artifact_natural_property prop);
vehicle *add_vehicle(game *g, vhtype_id type, const int x, const int y, const int dir);
computer* add_computer(const int x, const int y, std::string name, const int security);
float light_transparency(const int x, const int y) const;
void build_map_cache(game *g);
lit_level light_at(int dx, int dy); // Assumes 0,0 is light map center
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::vector <itype*> *itypes;
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];
@@ -209,6 +216,10 @@ protected:
void add_extra(map_extra type, game *g);
void rotate(const int turns);// Rotates the current map 90*turns degress clockwise
// Useful for houses, shops, etc
void build_transparency_cache();
void build_outside_cache(const game *g);
void generate_lightmap(game *g);
void build_seen_cache(game *g);
bool inbounds(const int x, const int y);
int my_MAPSIZE;
@@ -227,6 +238,18 @@ protected:
bool veh_in_active_range;
private:
long determine_wall_corner(const int x, const int y, const long orig_sym);
void cache_seen(const int fx, const int fy, const int tx, const int ty, const int max_range);
void apply_light_source(int x, int y, float luminance);
void apply_light_arc(int x, int y, int angle, float luminance);
void apply_light_ray(bool lit[MAPSIZE*SEEX][MAPSIZE*SEEY],
int sx, int sy, int ex, int ey, float luminance);
float lm[MAPSIZE*SEEX][MAPSIZE*SEEY];
float sm[MAPSIZE*SEEX][MAPSIZE*SEEY];
bool outside_cache[MAPSIZE*SEEX][MAPSIZE*SEEY];
float transparency_cache[MAPSIZE*SEEX][MAPSIZE*SEEY];
bool seen_cache[MAPSIZE*SEEX][MAPSIZE*SEEY];
submap* grid[MAPSIZE * MAPSIZE];
};
@@ -234,7 +257,7 @@ class tinymap : public map
{
public:
tinymap();
tinymap(std::vector<itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
tinymap(std::map<std::string, itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
~tinymap();
+1 -3
View File
@@ -198,8 +198,7 @@ void mapbuffer::load()
if (!fin.is_open())
return;
int itx, ity, t, d, a, num_submaps, num_loaded=0;
bool fields_here = false;
int itx, ity, t, d, a, num_submaps, num_loaded = 0;
item it_tmp;
std::string databuff;
fin >> num_submaps;
@@ -263,7 +262,6 @@ void mapbuffer::load()
fin >> itx >> ity >> t;
sm->trp[itx][ity] = trap_id(t);
} else if (string_identifier == "F") {
fields_here = true;
fin >> itx >> ity >> t >> d >> a;
sm->fld[itx][ity] = field(field_id(t), d, a);
sm->field_count++;
+221 -219
View File
@@ -12,6 +12,7 @@
#include "vehicle.h"
#include "graffiti.h"
#include "basecamp.h"
#include "iexamine.h"
#include <iosfwd>
class game;
@@ -60,16 +61,19 @@ enum t_flag {
flammable2, // Burn to ash rather than rubble.
deconstruct, // Can be deconstructed
reduce_scent, // Reduces the scent even more, only works if object is bashable as well
fire_container,// Contains fire like brazier or wood stove.
suppress_smoke, // Prevents smoke from being generated by fires. Used for ventilated tiles such as wood stoves.
num_t_flags // MUST be last
};
struct ter_t {
std::string name;
char sym;
long sym;
nc_color color;
unsigned char movecost;
trap_id trap;
unsigned long flags;// : num_t_flags;
void (iexamine::*examine)(game *, player *, map *m, int examx, int examy);
};
enum ter_id {
@@ -162,428 +166,422 @@ num_terrain_types
const ter_t terlist[num_terrain_types] = { // MUST match enum ter_id above!
{"nothing", ' ', c_white, 2, tr_null,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::none},
{"empty space", ' ', c_black, 2, tr_ledge,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"dirt", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
mfb(transparent)|mfb(diggable)|mfb(tentable), &iexamine::none},
{"sand", '.', c_yellow, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
mfb(transparent)|mfb(diggable)|mfb(tentable), &iexamine::none},
{"mound of dirt", '#', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::none},
{"shallow pit", '0', c_yellow, 8, tr_null,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::none},
{"pit", '0', c_brown, 10, tr_pit,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::pit},
{"corpse filled pit",'#', c_green, 5, tr_null,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::none},
{"covered pit", '#', c_ltred, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::pit_covered},
{"spiked pit", '0', c_ltred, 10, tr_spike_pit,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::pit_spiked},
{"covered spiked pit",'#',c_ltred, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::pit_spiked_covered},
{"rock floor", '.', c_ltgray, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"pile of rubble", '^', c_ltgray, 4, tr_null,
mfb(transparent)|mfb(rough)|mfb(diggable)},
mfb(transparent)|mfb(rough)|mfb(diggable), &iexamine::rubble},
{"pile of ash", '#', c_ltgray, 2, tr_null,
mfb(transparent)|mfb(diggable)},
mfb(transparent)|mfb(diggable), &iexamine::rubble},
{"twisted metal", '#', c_cyan, 5, tr_null,
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item)},
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item), &iexamine::wreckage},
{"metal wreckage", '#', c_cyan, 5, tr_null,
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item)},
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item), &iexamine::wreckage},
{"grass", '.', c_green, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
mfb(transparent)|mfb(diggable)|mfb(tentable), &iexamine::none},
{"metal floor", '.', c_ltcyan, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"pavement", '.', c_dkgray, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"yellow pavement", '.', c_yellow, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"sidewalk", '.', c_ltgray, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"floor", '.', c_cyan, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)},
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses), &iexamine::none},
{"dirt floor", '.', c_brown, 2, tr_null, //Dirt Floor, must have roofs!
mfb(transparent)|mfb(diggable)|mfb(supports_roof)|mfb(collapses)},
mfb(transparent)|mfb(diggable)|mfb(supports_roof)|mfb(collapses), &iexamine::none},
{"hay", '#', i_brown, 5, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(collapses)},
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(collapses), &iexamine::none},
{"metal grate", '#', c_dkgray, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"slime", '~', c_green, 6, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(place_item)},
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(place_item), &iexamine::none},
{"walkway", '#', c_yellow, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"canvas wall", '#', c_blue, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable), &iexamine::none},
{"canvas flap", '+', c_blue, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable), &iexamine::none},
{"open canvas flap", '.', c_blue, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"groundsheet", ';', c_green, 2, tr_null,
mfb(transparent)|mfb(tentable)},
mfb(transparent)|mfb(tentable), &iexamine::tent},
{"groundsheet", ';', c_green, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"animalskin wall", '#', c_brown, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable), &iexamine::none},
{"animalskin flap", '+', c_white, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable), &iexamine::none},
{"open animalskin flap", '.', c_white, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"animalskin floor", ';', c_brown, 2, tr_null,
mfb(transparent)|mfb(tentable)},
mfb(transparent)|mfb(tentable), &iexamine::shelter},
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Skylight
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses), &iexamine::none}, // Skylight
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Emergency Light
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses), &iexamine::none}, // Emergency Light
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Regular Light
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses), &iexamine::none}, // Regular Light
{"half-built wall", '#', c_brown, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem), &iexamine::none},
{"log wall", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"chipped log wall",'#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"broken log wall", '&', c_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)|
mfb(supports_roof)},
mfb(supports_roof), &iexamine::none},
{"palisade wall", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(transparent)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(transparent), &iexamine::none},
{"palisade gate", '+', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(door)|mfb(transparent)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(door)|mfb(transparent), &iexamine::none},
{"half-built wall", '#', c_ltred, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem), &iexamine::none},
{"wooden wall", '#', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"chipped wood wall",'#', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"broken wood wall", '&', c_ltred, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)|
mfb(supports_roof)},
{"wall", '|', c_ltgray, 0, tr_null,
mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"wall", '-', c_ltgray, 0, tr_null,
mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"concrete wall", '|', c_dkgray, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"concrete wall", '-', c_dkgray, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"metal wall", '|', c_cyan, 0, tr_null,
mfb(noitem)|mfb(noitem)|mfb(supports_roof)},
{"metal wall", '-', c_cyan, 0, tr_null,
mfb(noitem)|mfb(noitem)|mfb(supports_roof)},
{"glass wall", '|', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof)},
{"glass wall", '-', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof)},
{"glass wall", '|', c_ltcyan, 0, tr_null, // Alarmed
mfb(supports_roof), &iexamine::none},
{"wall", LINE_XOXO, c_ltgray, 0, tr_null,
mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"wall", LINE_OXOX, c_ltgray, 0, tr_null,
mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"concrete wall", LINE_XOXO, c_dkgray, 0, tr_null,
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"concrete wall", LINE_OXOX, c_dkgray, 0, tr_null,
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"metal wall", LINE_XOXO, c_cyan, 0, tr_null,
mfb(noitem)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"metal wall", LINE_OXOX, c_cyan, 0, tr_null,
mfb(noitem)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"glass wall", LINE_XOXO, c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"glass wall", LINE_OXOX, c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"glass wall", LINE_XOXO, c_ltcyan, 0, tr_null, // Alarmed
mfb(transparent)|mfb(bashable)|mfb(alarmed)|mfb(noitem)|
mfb(supports_roof)},
{"glass wall", '-', c_ltcyan, 0, tr_null, // Alarmed
mfb(supports_roof), &iexamine::none},
{"glass wall", LINE_OXOX, c_ltcyan, 0, tr_null, // Alarmed
mfb(transparent)|mfb(bashable)|mfb(alarmed)|mfb(noitem)|
mfb(supports_roof)},
{"reinforced glass", '|', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof)},
{"reinforced glass", '-', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof)},
mfb(supports_roof), &iexamine::none},
{"reinforced glass", LINE_XOXO, c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"reinforced glass", LINE_OXOX, c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"metal bars", '"', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(noitem)},
mfb(transparent)|mfb(noitem), &iexamine::none},
{"closed wood door", '+', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(door)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable2)|mfb(door)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"damaged wood door",'&', c_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)|
mfb(supports_roof)},
mfb(supports_roof), &iexamine::none},
{"open wood door", '\'', c_brown, 2, tr_null,
mfb(flammable2)|mfb(transparent)|mfb(supports_roof)},
mfb(flammable2)|mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"closed wood door", '+', c_brown, 0, tr_null, // Actually locked
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"closed wood door", '+', c_brown, 0, tr_null, // Locked and alarmed
mfb(bashable)|mfb(flammable2)|mfb(alarmed)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable2)|mfb(alarmed)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"empty door frame", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"locked wire gate", '+', c_cyan, 0, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"closed wooden gate", '+', c_brown, 3, tr_null,
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2)},
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2), &iexamine::none},
{"open wooden gate", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2)},
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2), &iexamine::none},
{"closed wire gate", '+', c_cyan, 0, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"open wire gate", '.', c_cyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"boarded up door", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"closed metal door",'+', c_cyan, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"open metal door", '\'', c_cyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"closed metal door",'+', c_cyan, 0, tr_null, // Actually locked
mfb(noitem)|mfb(supports_roof)},
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"closed glass door",'+', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(door)|mfb(noitem)|mfb(supports_roof)},
mfb(transparent)|mfb(bashable)|mfb(door)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"open glass door", '\'', c_ltcyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
mfb(transparent)|mfb(supports_roof), &iexamine::none},
{"bulletin board", '6', c_blue, 0, tr_null,
mfb(flammable)|mfb(noitem)},
mfb(flammable)|mfb(noitem), &iexamine::none},
{"makeshift portcullis", '&', c_cyan, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"steel compactor", '&', c_green, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::recycler},
{"window", '"', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)|mfb(deconstruct)}, // Plain Ol' window
mfb(supports_roof)|mfb(deconstruct), &iexamine::none}, // Plain Ol' window
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)| mfb(reduce_scent)}, // Regular window
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)| mfb(reduce_scent), &iexamine::none}, // Regular window
{"window", '"', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)|mfb(deconstruct)}, //has curtains
mfb(supports_roof)|mfb(deconstruct), &iexamine::none}, //has curtains
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)| mfb(reduce_scent)}, // Curtain window
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)| mfb(reduce_scent), &iexamine::none}, // Curtain window
{"open window", '\'', c_ltcyan, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)},
mfb(transparent)|mfb(flammable)|mfb(noitem)| mfb(supports_roof), &iexamine::none},
{"closed curtains", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof), &iexamine::none},
{"window", '"', c_ltcyan, 0, tr_null, // Actually alarmed
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(alarmed)|mfb(noitem)|
mfb(supports_roof)},
mfb(supports_roof), &iexamine::none},
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)|mfb(alarmed)| mfb(reduce_scent)}, //Alarmed, duh.
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)|mfb(alarmed)| mfb(reduce_scent), &iexamine::none}, //Alarmed, duh.
{"empty window", '0', c_yellow, 8, tr_null,
mfb(transparent)|mfb(flammable)|mfb(supports_roof)},
mfb(transparent)|mfb(flammable)|mfb(supports_roof), &iexamine::none},
{"window frame", '0', c_ltcyan, 8, tr_null,
mfb(transparent)|mfb(sharp)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)},
mfb(supports_roof), &iexamine::none},
{"boarded up window",'#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"solid rock", '#', c_white, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"odd fault", '#', c_magenta, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
mfb(noitem)|mfb(supports_roof), &iexamine::fault},
{"paper wall", '#', c_white, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(noitem)},
mfb(bashable)|mfb(flammable2)|mfb(noitem), &iexamine::none},
{"tree", '7', c_green, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
mfb(flammable2)|mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"young tree", '1', c_green, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem), &iexamine::none},
{"apple tree", '7', c_ltgreen, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
mfb(flammable2)|mfb(noitem)|mfb(supports_roof), &iexamine::tree_apple},
{"underbrush", '#', c_ltgreen, 6, tr_null,
mfb(transparent)|mfb(bashable)|mfb(diggable)|mfb(container)|
mfb(flammable2)|mfb(thin_obstacle)|mfb(place_item)},
mfb(flammable2)|mfb(thin_obstacle)|mfb(place_item), &iexamine::shrub_wildveggies},
{"shrub", '#', c_green, 8, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable2)|
mfb(thin_obstacle)|mfb(place_item)},
mfb(thin_obstacle)|mfb(place_item), &iexamine::none},
{"blueberry bush", '#', c_ltgreen, 8, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable2)|mfb(thin_obstacle)},
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable2)|mfb(thin_obstacle), &iexamine::shrub_blueberry},
{"tree trunk", '1', c_brown, 4, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(diggable)},
mfb(transparent)|mfb(flammable2)|mfb(diggable), &iexamine::none},
{"root wall", '#', c_brown, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
mfb(noitem)|mfb(supports_roof), &iexamine::none},
{"wax wall", '#', c_yellow, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)|mfb(place_item)},
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)|mfb(place_item), &iexamine::none},
{"wax floor", '.', c_yellow, 2, tr_null,
mfb(transparent)|mfb(l_flammable)},
mfb(transparent)|mfb(l_flammable), &iexamine::none},
{"picket fence", '|', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle)},
mfb(bashable)|mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle), &iexamine::none},
{"picket fence", '-', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle)},
mfb(bashable)|mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle), &iexamine::none},
{"chain link fence", '|', c_cyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle)},
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle), &iexamine::chainfence},
{"chain link fence", '-', c_cyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle)},
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle), &iexamine::chainfence},
{"metal post", '#', c_cyan, 2, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
mfb(transparent)|mfb(thin_obstacle), &iexamine::fence_post},
{"fence post", '#', c_brown, 2, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
mfb(transparent)|mfb(thin_obstacle), &iexamine::fence_post},
{"wire fence", '$', c_blue, 4, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
mfb(transparent)|mfb(thin_obstacle), &iexamine::remove_fence_wire},
{"barbed wire fence",'$', c_blue, 4, tr_null,
mfb(transparent)|mfb(sharp)|mfb(thin_obstacle)},
mfb(transparent)|mfb(sharp)|mfb(thin_obstacle), &iexamine::remove_fence_barbed},
{"rope fence", '$', c_brown, 3, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
mfb(transparent)|mfb(thin_obstacle), &iexamine::remove_fence_rope},
{"railing", '|', c_yellow, 3, tr_null,
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle)},
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle), &iexamine::none},
{"railing", '-', c_yellow, 3, tr_null,
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle)},
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle), &iexamine::none},
{"marloss bush", '1', c_dkgray, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)},
mfb(transparent)|mfb(bashable)|mfb(flammable2), &iexamine::none},
{"fungal bed", '#', c_dkgray, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(diggable)},
mfb(transparent)|mfb(flammable2)|mfb(diggable), &iexamine::none},
{"fungal tree", '7', c_dkgray, 0, tr_null,
mfb(flammable2)|mfb(noitem)},
mfb(flammable2)|mfb(noitem), &iexamine::none},
{"shallow water", '~', c_ltblue, 5, tr_null,
mfb(transparent)|mfb(liquid)|mfb(swimmable)},
mfb(transparent)|mfb(liquid)|mfb(swimmable), &iexamine::none},
{"deep water", '~', c_blue, 0, tr_null,
mfb(transparent)|mfb(liquid)|mfb(swimmable)},
mfb(transparent)|mfb(liquid)|mfb(swimmable), &iexamine::none},
{"sewage", '~', c_ltgreen, 6, tr_null,
mfb(transparent)|mfb(swimmable)},
mfb(transparent)|mfb(swimmable), &iexamine::none},
{"lava", '~', c_red, 4, tr_lava,
mfb(transparent)|mfb(liquid)},
mfb(transparent)|mfb(liquid), &iexamine::none},
{"bed", '#', c_magenta, 5, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(collapses)|
mfb(deconstruct)|mfb(place_item)},
mfb(deconstruct)|mfb(place_item), &iexamine::none},
{"toilet", '&', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)},
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses), &iexamine::none},
{"makeshift bed", '#', c_magenta, 5, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"sink", '&', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item), &iexamine::none},
{"oven", '#', c_dkgray, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item), &iexamine::none},
{"wood stove", '#', i_red, 4, tr_null,
mfb(transparent)|mfb(container)|mfb(place_item)},
mfb(transparent)|mfb(container)|mfb(fire_container)|mfb(suppress_smoke)|mfb(place_item), &iexamine::none},
{"bathtub", '~', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item), &iexamine::none},
{"chair", '#', c_brown, 2, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"arm chair", 'H', c_green, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"sofa", 'H', i_red, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"cupboard", '#', c_blue, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)|
mfb(container)|mfb(place_item)},
mfb(container)|mfb(place_item), &iexamine::none},
{"trash can", '&', c_ltcyan, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(container)|mfb(place_item)},
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(container)|mfb(place_item), &iexamine::none},
{"desk", '#', c_ltred, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)|
mfb(container)|mfb(place_item)},
mfb(container)|mfb(place_item), &iexamine::none},
{"sandbox", '#', c_yellow, 3, tr_null,
mfb(transparent)|mfb(deconstruct)},
mfb(transparent)|mfb(deconstruct), &iexamine::none},
{"slide", '#', c_ltcyan, 4, tr_null,
mfb(transparent)|mfb(deconstruct)},
mfb(transparent)|mfb(deconstruct), &iexamine::none},
{"monkey bars", '#', c_cyan, 4, tr_null,
mfb(transparent)|mfb(deconstruct)},
mfb(transparent)|mfb(deconstruct), &iexamine::none},
{"backboard", '7', c_red, 0, tr_null,
mfb(transparent)|mfb(deconstruct)},
mfb(transparent)|mfb(deconstruct), &iexamine::none},
{"bench", '#', c_brown, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"table", '#', c_red, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"pool table", '#', c_green, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"gasoline pump", '&', c_red, 0, tr_null,
mfb(transparent)|mfb(explodes)|mfb(noitem)},
mfb(transparent)|mfb(explodes)|mfb(noitem), &iexamine::gaspump},
{"smashed gas pump", '&', c_ltred, 0, tr_null,
mfb(transparent)|mfb(noitem)},
mfb(transparent)|mfb(noitem), &iexamine::none},
{"out-of-order gasoline pump", '&', c_red, 0, tr_null,
mfb(transparent)|mfb(noitem)},
mfb(transparent)|mfb(noitem), &iexamine::none},
{"missile", '#', c_ltblue, 0, tr_null,
mfb(explodes)|mfb(noitem)},
mfb(explodes)|mfb(noitem), &iexamine::none},
{"blown-out missile",'#', c_ltgray, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"counter", '#', c_blue, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct), &iexamine::none},
{"radio tower", '&', c_ltgray, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"radio controls", '6', c_green, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)},
mfb(transparent)|mfb(bashable)|mfb(noitem), &iexamine::none},
{"broken console", '6', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
mfb(transparent)|mfb(noitem)|mfb(collapses), &iexamine::none},
{"computer console", '6', c_blue, 0, tr_null,
mfb(transparent)|mfb(console)|mfb(noitem)|mfb(collapses)},
mfb(transparent)|mfb(console)|mfb(noitem)|mfb(collapses), &iexamine::none},
{"mechanical winch", '6', c_cyan_red, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
mfb(transparent)|mfb(noitem)|mfb(collapses), &iexamine::controls_gate},
{"rope and pulley", '|', c_brown, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
mfb(transparent)|mfb(noitem)|mfb(collapses), &iexamine::controls_gate},
{"rope and pulley", '|', c_brown, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
mfb(transparent)|mfb(noitem)|mfb(collapses), &iexamine::controls_gate},
{"sewage pipe", '1', c_ltgray, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"sewage pump", '&', c_ltgray, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"centrifuge", '{', c_magenta, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"column", '1', c_ltgray, 0, tr_null,
mfb(flammable)},
mfb(flammable), &iexamine::none},
{"refrigerator", '{', c_ltcyan, 0, tr_null,
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item)},
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item), &iexamine::none},
{"glass door fridge",'{', c_ltcyan, 0, tr_null,
mfb(collapses)|mfb(bashable)|mfb(place_item)},
mfb(collapses)|mfb(bashable)|mfb(place_item), &iexamine::none},
{"dresser", '{', c_brown, 0, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable)|mfb(collapses)|
mfb(bashable)|mfb(deconstruct)|mfb(place_item)},
mfb(bashable)|mfb(deconstruct)|mfb(place_item), &iexamine::none},
{"locker", '{', c_ltgray, 0, tr_null,
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item)},
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item), &iexamine::none},
{"display rack", '{', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(collapses)|mfb(bashable)|
mfb(deconstruct)|mfb(place_item)},
mfb(deconstruct)|mfb(place_item), &iexamine::none},
{"book case", '{', c_brown, 0, tr_null,
mfb(flammable)|mfb(collapses)|mfb(bashable)|mfb(deconstruct)|mfb(place_item)},
mfb(flammable)|mfb(collapses)|mfb(bashable)|mfb(deconstruct)|mfb(place_item), &iexamine::none},
{"dumpster", '{', c_green, 0, tr_null,
mfb(container)|mfb(bashable)|mfb(place_item)},
mfb(container)|mfb(bashable)|mfb(place_item), &iexamine::none},
{"cloning vat", '0', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(sealed)|mfb(place_item)},
mfb(transparent)|mfb(bashable)|mfb(sealed)|mfb(place_item), &iexamine::none},
{"crate", 'X', i_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(sealed)|
mfb(flammable)|mfb(deconstruct)|mfb(place_item)},
mfb(flammable)|mfb(deconstruct)|mfb(place_item), &iexamine::none},
{"open crate", 'O', i_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable)|mfb(place_item)},
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable)|mfb(place_item), &iexamine::none},
{"stairs down", '>', c_yellow, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
mfb(transparent)|mfb(goes_down)|mfb(place_item), &iexamine::none},
{"stairs up", '<', c_yellow, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
mfb(transparent)|mfb(goes_up)|mfb(place_item), &iexamine::none},
{"manhole", '>', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
mfb(transparent)|mfb(goes_down)|mfb(place_item), &iexamine::none},
{"ladder", '<', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
mfb(transparent)|mfb(goes_up)|mfb(place_item), &iexamine::none},
{"ladder", '>', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
mfb(transparent)|mfb(goes_down)|mfb(place_item), &iexamine::none},
{"downward slope", '>', c_brown, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
mfb(transparent)|mfb(goes_down)|mfb(place_item), &iexamine::none},
{"upward slope", '<', c_brown, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
mfb(transparent)|mfb(goes_up)|mfb(place_item), &iexamine::none},
{"rope leading up", '<', c_white, 2, tr_null,
mfb(transparent)|mfb(goes_up)},
mfb(transparent)|mfb(goes_up), &iexamine::none},
{"manhole cover", '0', c_dkgray, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"card reader", '6', c_pink, 0, tr_null, // Science
mfb(noitem)},
mfb(noitem), &iexamine::cardreader},
{"card reader", '6', c_pink, 0, tr_null, // Military
mfb(noitem)},
mfb(noitem), &iexamine::cardreader},
{"broken card reader",'6',c_ltgray, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"slot machine", '6', c_green, 0, tr_null,
mfb(bashable)|mfb(noitem)},
mfb(bashable)|mfb(noitem), &iexamine::slot_machine},
{"elevator controls",'6', c_ltblue, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::elevator},
{"powerless controls",'6',c_ltgray, 0, tr_null,
mfb(noitem)},
mfb(noitem), &iexamine::none},
{"elevator", '.', c_magenta, 2, tr_null,
0},
0, &iexamine::none},
{"dark pedestal", '&', c_dkgray, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::pedestal_wyrm},
{"light pedestal", '&', c_white, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::pedestal_temple},
{"red stone", '#', c_red, 0, tr_null,
0},
0, &iexamine::none},
{"green stone", '#', c_green, 0, tr_null,
0},
0, &iexamine::none},
{"blue stone", '#', c_blue, 0, tr_null,
0},
0, &iexamine::none},
{"red floor", '.', c_red, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"green floor", '.', c_green, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"blue floor", '.', c_blue, 2, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::none},
{"yellow switch", '6', c_yellow, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::fswitch},
{"cyan switch", '6', c_cyan, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::fswitch},
{"purple switch", '6', c_magenta, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::fswitch},
{"checkered switch", '6', c_white, 0, tr_null,
mfb(transparent)},
mfb(transparent), &iexamine::fswitch},
{"mutated poppy flower", 'f', c_red, 3, tr_null,
mfb(transparent)}
mfb(transparent), &iexamine::flower_poppy}
};
enum map_extra {
@@ -606,6 +604,10 @@ enum map_extra {
num_map_extras
};
const int classic_extras = mfb(mx_helicopter) | mfb(mx_military) |
mfb(mx_stash) | mfb(mx_drugdeal) | mfb(mx_supplydrop) | mfb(mx_minefield) |
mfb(mx_wolfpack) | mfb(mx_cougar) | mfb(mx_puddle) | mfb(mx_crater);
// Chances are relative to eachother; e.g. a 200 chance is twice as likely
// as a 100 chance to appear.
const int map_extra_chance[num_map_extras + 1] = {
+1476 -1456
View File
File diff suppressed because it is too large Load Diff
+512 -526
View File
File diff suppressed because it is too large Load Diff
+39 -64
View File
@@ -22,7 +22,7 @@ std::string melee_verb(technique_id tech, std::string your, player &p,
* STATE QUERIES
* bool is_armed() - True if we are armed with any weapon.
* bool unarmed_attack() - True if we are NOT armed with any weapon, but still
* true if we're wielding a bionic weapon (at this point, just itm_bio_claws).
* true if we're wielding a bionic weapon (at this point, just "bio_claws").
*
* HIT DETERMINATION
* int base_to_hit() - The base number of sides we get in hit_roll().
@@ -34,12 +34,12 @@ std::string melee_verb(technique_id tech, std::string your, player &p,
bool player::is_armed()
{
return (weapon.typeId() != 0 && !weapon.is_style());
return (weapon.typeId() != "null" && !weapon.is_style());
}
bool player::unarmed_attack()
{
return (weapon.typeId() == 0 || weapon.is_style() ||
return (weapon.typeId() == "null" || weapon.is_style() ||
weapon.has_flag(IF_UNARMED_WEAPON));
}
@@ -54,16 +54,12 @@ int player::hit_roll()
{
int stat = dex_cur;
// Some martial arts use something else to determine hits!
switch (weapon.typeId()) {
case itm_style_tiger:
if(weapon.typeId() == "style_tiger"){
stat = (str_cur * 2 + dex_cur) / 3;
break;
case itm_style_leopard:
} else if(weapon.typeId() == "style_leopard"){
stat = (per_cur + int_cur + dex_cur * 2) / 4;
break;
case itm_style_snake:
} else if(weapon.typeId() == "style_snake"){
stat = (per_cur + dex_cur) / 2;
break;
}
int numdice = base_to_hit(stat) + weapon.type->m_to_hit +
disease_intensity(DI_ATTACK_BOOST);
@@ -110,6 +106,11 @@ int player::hit_roll()
numdice += int(disease_level(DI_DRUNK) / 400);
}
// Farsightedness makes us hit worse
if (has_trait(PF_HYPEROPIC) && !is_wearing("glasses_reading")) {
numdice -= 2;
}
if (numdice < 1) {
numdice = 1;
sides = 8 - encumb(bp_torso);
@@ -173,6 +174,7 @@ int player::hit_mon(game *g, monster *z, bool allow_grab) // defaults to true
int stuck_penalty = roll_stuck_penalty(z, (stab_dam >= cut_dam));
if (weapon.is_style())
stuck_penalty = 0;
moves -= stuck_penalty;
// Pick one or more special attacks
technique_id technique = pick_technique(g, z, NULL, critical_hit, allow_grab);
@@ -188,7 +190,7 @@ int player::hit_mon(game *g, monster *z, bool allow_grab) // defaults to true
melee_special_effects(g, z, NULL, critical_hit, bash_dam, cut_dam, stab_dam);
// Make a rather quiet sound, to alert any nearby monsters
if (weapon.typeId() != itm_style_ninjutsu) // Ninjutsu is silent!
if (weapon.typeId() != "style_ninjutsu") // Ninjutsu is silent!
g->sound(posx, posy, 8, "");
verb = melee_verb(technique, your, *this, bash_dam, cut_dam, stab_dam);
@@ -300,7 +302,8 @@ void player::hit_player(game *g, player &p, bool allow_grab)
int stuck_penalty = roll_stuck_penalty(NULL, (stab_dam >= cut_dam));
if (weapon.is_style())
stuck_penalty = 0;
moves -= stuck_penalty;
// Pick one or more special attacks
technique_id technique = pick_technique(g, NULL, &p, critical_hit, allow_grab);
@@ -315,7 +318,7 @@ void player::hit_player(game *g, player &p, bool allow_grab)
melee_special_effects(g, NULL, &p, critical_hit, bash_dam, cut_dam, stab_dam);
// Make a rather quiet sound, to alert any nearby monsters
if (weapon.typeId() != itm_style_ninjutsu) // Ninjutsu is silent!
if (weapon.typeId() != "style_ninjutsu") // Ninjutsu is silent!
g->sound(posx, posy, 8, "");
p.hit(g, bp_hit, side, bash_dam, (cut_dam > stab_dam ? cut_dam : stab_dam));
@@ -392,16 +395,12 @@ bool player::scored_crit(int target_dodge)
// ... except sometimes we don't use dexteiry!
int stat = dex_cur;
// Some martial arts use something else to determine hits!
switch (weapon.typeId()) {
case itm_style_tiger:
if(weapon.typeId() == "style_tiger"){
stat = (str_cur * 2 + dex_cur) / 3;
break;
case itm_style_leopard:
} else if(weapon.typeId() == "style_leopard"){
stat = (per_cur + int_cur + dex_cur * 2) / 4;
break;
case itm_style_snake:
} else if(weapon.typeId() == "style_snake"){
stat = (per_cur + dex_cur) / 2;
break;
}
chance = 25;
if (stat > 8) {
@@ -516,16 +515,12 @@ int player::roll_bash_damage(monster *z, bool crit)
if (unarmed_attack())
skill = skillLevel("unarmed");
switch (weapon.typeId()) { // Some martial arts change which stat
case itm_style_crane:
if(weapon.typeId() =="style_crane"){
stat = (dex_cur * 2 + str_cur) / 3;
break;
case itm_style_snake:
} else if(weapon.typeId() == "style_snake"){
stat = int(str_cur + per_cur) / 2;
break;
case itm_style_dragon:
} else if(weapon.typeId() == "style_dragon"){
stat = int(str_cur + int_cur) / 2;
break;
}
ret = base_damage(true, stat);
@@ -722,7 +717,7 @@ technique_id player::pick_technique(game *g, monster *z, player *p,
if (possible.empty()) { // Use non-crits only if any crit-onlies aren't used
if (weapon.has_technique(TEC_DISARM, this) && !z &&
p->weapon.typeId() != 0 && !p->weapon.has_flag(IF_UNARMED_WEAPON) &&
p->weapon.typeId() != "null" && !p->weapon.has_flag(IF_UNARMED_WEAPON) &&
dice( dex_cur + skillLevel("unarmed"), 8) >
dice(p->dex_cur + p->skillLevel("melee"), 10))
possible.push_back(TEC_DISARM);
@@ -800,7 +795,7 @@ void player::perform_technique(technique_id technique, game *g, monster *z,
if (z != NULL && !z->has_flag(MF_FLIES)) {
z->add_effect(ME_DOWNED, rng(1, 2));
bash_dam += z->fall_damage();
} else if (p != NULL && !p->weapon.typeId() == itm_style_judo) {
} else if (p != NULL && p->weapon.typeId() != "style_judo") {
p->add_disease(DI_DOWNED, rng(1, 2), g);
bash_dam += 3;
}
@@ -832,7 +827,7 @@ void player::perform_technique(technique_id technique, game *g, monster *z,
z->knock_back_from(g, posx + rng(-1, 1), posy + rng(-1, 1));
} else if (p != NULL) {
p->knock_back_from(g, posx + rng(-1, 1), posy + rng(-1, 1));
if (!p->weapon.typeId() == itm_style_judo)
if (p->weapon.typeId() != "style_judo")
p->add_disease(DI_DOWNED, rng(1, 2), g);
}
break;
@@ -921,7 +916,7 @@ technique_id player::pick_defensive_technique(game *g, monster *z, player *p)
return TEC_WBLOCK_1;
if (weapon.has_technique(TEC_DEF_DISARM, this) &&
z == NULL && p->weapon.typeId() != 0 &&
z == NULL && p->weapon.typeId() != "null" &&
!p->weapon.has_flag(IF_UNARMED_WEAPON) &&
dice( dex_cur + skillLevel("unarmed"), 8) >
dice(p->dex_cur + p->skillLevel("melee"), 10))
@@ -986,9 +981,9 @@ void player::perform_defensive_technique(
bash_dam *= .5;
double reduction = 1.0;
// Special reductions for certain styles
if (weapon.typeId() == itm_style_tai_chi)
if (weapon.typeId() == "style_tai_chi")
reduction -= double(0.08 * double(per_cur - 6));
if (weapon.typeId() == itm_style_taekwondo)
if (weapon.typeId() == "style_taekwondo")
reduction -= double(0.08 * double(str_cur - 6));
if (reduction > 1.0)
reduction = 1.0;
@@ -1145,11 +1140,11 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
p->moves -= stab_moves;
// Bonus attacks!
bool shock_them = (has_bionic(bio_shock) && power_level >= 2 &&
bool shock_them = (has_bionic("bio_shock") && power_level >= 2 &&
unarmed_attack() && (!mon || !z->has_flag(MF_ELECTRIC)) &&
one_in(3));
bool drain_them = (has_bionic(bio_heat_absorb) && power_level >= 1 &&
bool drain_them = (has_bionic("bio_heat_absorb") && power_level >= 1 &&
!is_armed() && (!mon || z->has_flag(MF_WARM)));
if (drain_them)
@@ -1251,36 +1246,22 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
}
// Finally, some special effects for martial arts
switch (weapon.typeId()) {
case itm_style_karate:
if(weapon.typeId() == "style_karate"){
dodges_left++;
blocks_left += 2;
break;
case itm_style_aikido:
} else if(weapon.typeId() == "style_aikido"){
bash_dam /= 2;
break;
case itm_style_capoeira:
} else if(weapon.typeId() == "style_capoeira"){
add_disease(DI_DODGE_BOOST, 2, g, 2);
break;
case itm_style_muay_thai:
} else if(weapon.typeId() == "style_muay_thai"){
if ((mon && z->type->size >= MS_LARGE) || (!mon && p->str_max >= 12))
bash_dam += rng((mon ? z->type->size : (p->str_max - 8) / 4),
3 * (mon ? z->type->size : (p->str_max - 8) / 4));
break;
case itm_style_tiger:
} else if(weapon.typeId() == "style_tiger"){
add_disease(DI_DAMAGE_BOOST, 2, g, 2, 10);
break;
case itm_style_centipede:
} else if(weapon.typeId() == "style_centipede"){
add_disease(DI_SPEED_BOOST, 2, g, 4, 40);
break;
case itm_style_venom_snake:
} else if(weapon.typeId() == "style_venom_snake"){
if (has_disease(DI_VIPER_COMBO)) {
if (disease_intensity(DI_VIPER_COMBO) == 1) {
if (is_u)
@@ -1305,9 +1286,7 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
bash_dam += 5;
add_disease(DI_VIPER_COMBO, 2, g, 1, 2);
}
break;
case itm_style_scorpion:
} else if(weapon.typeId() == "style_scorpion"){
if (crit) {
if (!is_npc())
g->add_msg("Stinger Strike!");
@@ -1325,12 +1304,8 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
p->knock_back_from(g, posx, posy); // Knock a 2nd time if the first worked
}
}
break;
case itm_style_zui_quan:
} else if(weapon.typeId() == "style_zui_quan"){
dodges_left = 50; // Basically, unlimited.
break;
}
}
+2 -1
View File
@@ -45,7 +45,8 @@ std::string mission::save_info()
void mission::load_info(game *g, std::ifstream &data)
{
int type_id, rewtype, reward_id, rew_item, rew_skill, itemid, tmpfollow;
int type_id, rewtype, reward_id, rew_skill, tmpfollow;
std::string rew_item, itemid;
data >> type_id;
type = &(g->mission_types[type_id]);
std::string tmpdesc;
+2 -2
View File
@@ -109,7 +109,7 @@ struct mission_type {
{
deadline_low = 0;
deadline_high = 0;
item_id = itm_null;
item_id = "null";
follow_up = MISSION_NULL;
};
@@ -145,7 +145,7 @@ struct mission {
value = 0;
uid = -1;
target = point(-1, -1);
item_id = itm_null;
item_id = "null";
count = 0;
deadline = 0;
npc_id = -1;
+9 -9
View File
@@ -21,7 +21,7 @@ void mission_start::infect_npc(game *g, mission *miss)
}
p->add_disease(DI_INFECTION, -1, g);
for (int i = 0; i < p->inv.size(); i++) {
if (p->inv[i].type->id == itm_antibiotics) {
if (p->inv[i].type->id == "antibiotics") {
p->inv.remove_stack(i);
i--;
}
@@ -37,7 +37,7 @@ void mission_start::place_dog(game *g, mission *miss)
debugmsg("Couldn't find NPC! %d", miss->npc_id);
return;
}
g->u.i_add( item(g->itypes[itm_dog_whistle], 0) );
g->u.i_add( item(g->itypes["dog_whistle"], 0) );
g->add_msg("%s gave you a dog whistle.", dev->name.c_str());
miss->target = house;
@@ -78,25 +78,25 @@ void mission_start::place_npc_software(game *g, mission *miss)
debugmsg("Couldn't find NPC! %d", miss->npc_id);
return;
}
g->u.i_add( item(g->itypes[itm_usb_drive], 0) );
g->u.i_add( item(g->itypes["usb_drive"], 0) );
g->add_msg("%s gave you a USB drive.", dev->name.c_str());
oter_id ter = ot_house_north;
switch (dev->myclass) {
case NC_HACKER:
miss->item_id = itm_software_hacking;
miss->item_id = "software_hacking";
break;
case NC_DOCTOR:
miss->item_id = itm_software_medical;
miss->item_id = "software_medical";
ter = ot_s_pharm_north;
miss->follow_up = MISSION_GET_ZOMBIE_BLOOD_ANAL;
break;
case NC_SCIENTIST:
miss->item_id = itm_software_math;
miss->item_id = "software_math";
break;
default:
miss->item_id = itm_software_useless;
miss->item_id = "software_useless";
}
int dist = 0;
@@ -190,7 +190,7 @@ void mission_start::place_npc_software(game *g, mission *miss)
std::stringstream compname;
compname << dev->name << "'s Terminal";
compmap.ter(comppoint.x, comppoint.y) = t_console;
compmap.ter_set(comppoint.x, comppoint.y, t_console);
computer *tmpcomp = compmap.add_computer(comppoint.x, comppoint.y,
compname.str(), 0);
tmpcomp->mission_id = miss->uid;
@@ -203,7 +203,7 @@ void mission_start::reveal_hospital(game *g, mission *miss)
{
npc* dev = g->find_npc(miss->npc_id);
if (dev != NULL) {
g->u.i_add( item(g->itypes[itm_vacutainer], 0) );
g->u.i_add( item(g->itypes["vacutainer"], 0) );
g->add_msg("%s gave you a vacutainer.", dev->name.c_str());
}
int dist = 0;
+2 -2
View File
@@ -29,7 +29,7 @@ mission_type(id, name, goal, diff, val, urgent, place, start, end, fail) )
&mission_place::always, &mission_start::infect_npc,
&mission_end::heal_infection, &mission_fail::kill_npc);
ORIGINS(ORIGIN_OPENER_NPC);
ITEM(itm_antibiotics);
ITEM("antibiotics");
DEADLINE(24, 48); // 1 - 2 days
MISSION("Retrieve Software", MGOAL_FIND_ANY_ITEM, 2, 800, false,
@@ -41,7 +41,7 @@ mission_type(id, name, goal, diff, val, urgent, place, start, end, fail) )
&mission_place::always, &mission_start::reveal_hospital,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_SECONDARY);
ITEM(itm_software_blood_data);
ITEM("software_blood_data");
MISSION("Find Lost Dog", MGOAL_FIND_MONSTER, 3, 1000, false,
&mission_place::near_town, &mission_start::place_dog,
+18 -18
View File
@@ -15,7 +15,7 @@ void mattack::antqueen(game *g, monster *z)
for (int y = z->posy - 2; y <= z->posy + 2; y++) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
// is_empty() because we can't hatch an ant under the player, a monster, etc.
if (g->m.i_at(x, y)[i].type->id == itm_ant_egg && g->is_empty(x, y)) {
if (g->m.i_at(x, y)[i].type->id == "ant_egg" && g->is_empty(x, y)) {
egg_points.push_back(point(x, y));
i = g->m.i_at(x, y).size(); // Done looking at this tile
}
@@ -43,7 +43,7 @@ void mattack::antqueen(game *g, monster *z)
int junk;
if (g->u_see(z->posx, z->posy, junk))
g->add_msg("The %s lays an egg!", z->name().c_str());
g->m.add_item(z->posx, z->posy, g->itypes[itm_ant_egg], g->turn);
g->m.spawn_item(z->posx, z->posy, g->itypes["ant_egg"], g->turn);
} else { // There are eggs nearby. Let's hatch some.
z->moves -= 20 * egg_points.size(); // It takes a while
int junk;
@@ -52,7 +52,7 @@ void mattack::antqueen(game *g, monster *z)
for (int i = 0; i < egg_points.size(); i++) {
int x = egg_points[i].x, y = egg_points[i].y;
for (int j = 0; j < g->m.i_at(x, y).size(); j++) {
if (g->m.i_at(x, y)[j].type->id == itm_ant_egg) {
if (g->m.i_at(x, y)[j].type->id == "ant_egg") {
g->m.i_rem(x, y, j);
j = g->m.i_at(x, y).size(); // Max one hatch per tile.
monster tmp(g->mtypes[mon_ant_larva], x, y);
@@ -200,7 +200,7 @@ void mattack::resurrect(game *g, monster *z)
for (int y = z->posy - 4; y <= z->posy + 4; y++) {
if (g->is_empty(x, y) && g->m.sees(z->posx, z->posy, x, y, -1, junk)) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y)[i].type->id == itm_corpse &&
if (g->m.i_at(x, y)[i].type->id == "corpse" &&
g->m.i_at(x, y)[i].corpse->species == species_zombie) {
corpses.push_back(point(x, y));
i = g->m.i_at(x, y).size();
@@ -221,7 +221,7 @@ void mattack::resurrect(game *g, monster *z)
for (int i = 0; i < corpses.size(); i++) {
int x = corpses[i].x, y = corpses[i].y;
for (int n = 0; n < g->m.i_at(x, y).size(); n++) {
if (g->m.i_at(x, y)[n].type->id == itm_corpse && one_in(2)) {
if (g->m.i_at(x, y)[n].type->id == "corpse" && one_in(2)) {
if (g->u_see(x, y, junk))
raised++;
int burnt_penalty = g->m.i_at(x, y)[n].burnt;
@@ -336,9 +336,9 @@ void mattack::growplants(game *g, monster *z)
if (i == 0 && j == 0)
j++;
if (!g->m.has_flag(diggable, z->posx + i, z->posy + j) && one_in(4))
g->m.ter(z->posx + i, z->posy + j) = t_dirt;
g->m.ter_set(z->posx + i, z->posy + j, t_dirt);
else if (one_in(3) && g->m.is_destructable(z->posx + i, z->posy + j))
g->m.ter(z->posx + i, z->posy + j) = t_dirtmound; // Destroy walls, &c
g->m.ter_set(z->posx + i, z->posy + j, t_dirtmound); // Destroy walls, &c
else {
if (one_in(4)) { // 1 in 4 chance to grow a tree
int mondex = g->mon_at(z->posx + i, z->posy + j);
@@ -379,9 +379,9 @@ void mattack::growplants(game *g, monster *z)
g->active_npc[npcdex].hit(g, hit, side, 0, rng(10, 30));
}
}
g->m.ter(z->posx + i, z->posy + j) = t_tree_young;
g->m.ter_set(z->posx + i, z->posy + j, t_tree_young);
} else if (one_in(3)) // If no tree, perhaps underbrush
g->m.ter(z->posx + i, z->posy + j) = t_underbrush;
g->m.ter_set(z->posx + i, z->posy + j, t_underbrush);
}
}
}
@@ -391,7 +391,7 @@ void mattack::growplants(game *g, monster *z)
for (int j = -5; j <= 5; j++) {
if (i != 0 || j != 0) {
if (g->m.ter(z->posx + i, z->posy + j) == t_tree_young)
g->m.ter(z->posx + i, z->posy + j) = t_tree; // Young tree => tree
g->m.ter_set(z->posx + i, z->posy + j, t_tree); // Young tree => tree
else if (g->m.ter(z->posx + i, z->posy + j) == t_underbrush) {
// Underbrush => young tree
int mondex = g->mon_at(z->posx + i, z->posy + j);
@@ -569,9 +569,9 @@ void mattack::triffid_heartbeat(game *g, monster *z)
for (int x = g->u.posx; x <= z->posx - 3; x++) {
for (int y = g->u.posy; y <= z->posy - 3; y++) {
if (g->is_empty(x, y) && one_in(4))
g->m.ter(x, y) = t_root_wall;
g->m.ter_set(x, y, t_root_wall);
else if (g->m.ter(x, y) == t_root_wall && one_in(10))
g->m.ter(x, y) = t_dirt;
g->m.ter_set(x, y, t_dirt);
}
}
// Open blank tiles as long as there's no possible route
@@ -580,7 +580,7 @@ void mattack::triffid_heartbeat(game *g, monster *z)
tries < 20) {
int x = rng(g->u.posx, z->posx - 3), y = rng(g->u.posy, z->posy - 3);
tries++;
g->m.ter(x, y) = t_dirt;
g->m.ter_set(x, y, t_dirt);
if (rl_dist(x, y, g->u.posx, g->u.posy > 3 && g->z.size() < 30 &&
g->mon_at(x, y) == -1 && one_in(20))) { // Spawn an extra monster
mon_id montype = mon_triffid;
@@ -1088,7 +1088,7 @@ void mattack::stare(game *g, monster *z)
g->m.ter(sight[i].x, sight[i].y) == t_reinforced_glass_v)
i = sight.size();
else if (g->m.is_destructable(sight[i].x, sight[i].y))
g->m.ter(sight[i].x, sight[i].y) = t_rubble;
g->m.ter_set(sight[i].x, sight[i].y, t_rubble);
}
}
}
@@ -1172,8 +1172,8 @@ void mattack::smg(game *g, monster *z)
tmp.str_cur = 16;
tmp.dex_cur = 6;
tmp.per_cur = 8;
tmp.weapon = item(g->itypes[itm_smg_9mm], 0);
tmp.weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_9mm]);
tmp.weapon = item(g->itypes["smg_9mm"], 0);
tmp.weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["9mm"]);
tmp.weapon.charges = 10;
std::vector<point> traj = line_to(z->posx, z->posy,
target->posx, target->posy, fire_t);
@@ -1211,8 +1211,8 @@ void mattack::smg(game *g, monster *z)
tmp.str_cur = 16;
tmp.dex_cur = 6;
tmp.per_cur = 8;
tmp.weapon = item(g->itypes[itm_smg_9mm], 0);
tmp.weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_9mm]);
tmp.weapon = item(g->itypes["smg_9mm"], 0);
tmp.weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["9mm"]);
tmp.weapon.charges = 10;
std::vector<point> traj = line_to(z->posx, z->posy, g->u.posx, g->u.posy, t);
g->fire(tmp, g->u.posx, g->u.posy, traj, true);
+1 -1
View File
@@ -22,7 +22,7 @@ void mdeath::normal(game *g, monster *z)
if ((z->hp >= -50 || z->hp >= 0 - 2 * z->type->hp) &&
(z->made_of(FLESH) || z->made_of(VEGGY))) {
item tmp;
tmp.make_corpse(g->itypes[itm_corpse], z->type, g->turn);
tmp.make_corpse(g->itypes["corpse"], z->type, g->turn);
g->m.add_item(z->posx, z->posy, tmp);
}
}
+6 -2
View File
@@ -28,7 +28,7 @@ mon_id MonsterGroupManager::GetMonsterFromGroup(std::string group, std::vector <
MonsterGroup g = monsterGroupMap[group];
for (FreqDef_iter it = g.monsters.begin(); it != g.monsters.end(); ++it)
{
if((turn == -1 || (turn + 900 >= MINUTES(STARTING_MINUTES) + (*mtypes)[it->first]->difficulty)) &&
if((turn == -1 || (turn + 900 >= MINUTES(STARTING_MINUTES) + HOURS((*mtypes)[it->first]->difficulty))) &&
(!OPTIONS[OPT_CLASSIC_ZOMBIES] ||
(*mtypes)[it->first]->in_category(MC_CLASSIC) ||
(*mtypes)[it->first]->in_category(MC_WILDLIFE)))
@@ -37,7 +37,11 @@ mon_id MonsterGroupManager::GetMonsterFromGroup(std::string group, std::vector <
else roll -= it->second;
}
}
return g.defaultMonster;
if ((turn + 900 < MINUTES(STARTING_MINUTES) + HOURS((*mtypes)[g.defaultMonster]->difficulty))
&& (!OPTIONS[OPT_STATIC_SPAWN]))
return mon_null;
else
return g.defaultMonster;
}
bool MonsterGroupManager::IsMonsterInGroup(std::string group, mon_id monster)
-1
View File
@@ -19,7 +19,6 @@ void game::init_monitems()
monitems[mon_zombie_shrieker] = monitems[mon_zombie];
monitems[mon_zombie_spitter] = monitems[mon_zombie];
monitems[mon_zombie_electric] = monitems[mon_zombie];
monitems[mon_zombie_fast] = monitems[mon_zombie];
monitems[mon_zombie_brute] = monitems[mon_zombie];
monitems[mon_zombie_hulk] = monitems[mon_zombie];
monitems[mon_zombie_fungus] = monitems[mon_zombie];
+15 -13
View File
@@ -261,7 +261,7 @@ void monster::move(game *g)
hit_player(g, g->u);
else if (mondex != -1 && g->z[mondex].type->species == species_hallu)
g->kill_mon(mondex);
else if (mondex != -1 && type->melee_dice > 0 &&
else if (mondex != -1 && type->melee_dice > 0 && this != &(g->z[mondex]) &&
(g->z[mondex].friendly != 0 || has_flag(MF_ATTACKMON)))
hit_monster(g, mondex);
else if (npcdex != -1 && type->melee_dice > 0)
@@ -361,8 +361,10 @@ point monster::scent_move(game *g)
std::vector<point> smoves;
int maxsmell = 2; // Squares with smell 0 are not eligable targets
if (has_flag(MF_KEENNOSE)) {
int maxsmell = 1; }
if (has_flag(MF_KEENNOSE))
{
maxsmell = 1;
}
int minsmell = 9999;
point pbuff, next(-1, -1);
unsigned int smell;
@@ -494,11 +496,11 @@ void monster::hit_player(game *g, player &p, bool can_grab)
g->add_msg("You stop reloading.");
else if (g->u.activity.type == ACT_READ)
g->add_msg("You stop reading.");
else if (g->u.activity.type == ACT_CRAFT)
else if (g->u.activity.type == ACT_CRAFT || g->u.activity.type == ACT_LONGCRAFT)
g->add_msg("You stop crafting.");
g->u.activity.type = ACT_NULL;
}
if (p.has_active_bionic(bio_ods)) {
if (p.has_active_bionic("bio_ods")) {
if (u_see)
g->add_msg("%s offensive defense system shocks it!", Your.c_str());
hurt(rng(10, 40));
@@ -610,7 +612,7 @@ void monster::move_to(game *g, int x, int y)
}
// Diggers turn the dirt into dirtmound
if (has_flag(MF_DIGS))
g->m.ter(posx, posy) = t_dirtmound;
g->m.ter_set(posx, posy, t_dirtmound);
// Acid trail monsters leave... a trail of acid
if (has_flag(MF_ACIDTRAIL))
g->m.add_field(g, posx, posy, fd_acid, 1);
@@ -628,12 +630,10 @@ void monster::move_to(game *g, int x, int y)
void monster::stumble(game *g, bool moved)
{
// don't stumble every turn. every 3rd turn, or 8th when walking.
if(moved)
if(!one_in(8))
return;
else
if(!one_in(3))
return;
if((moved && !one_in(8)) || !one_in(3))
{
return;
}
std::vector <point> valid_stumbles;
for (int i = -1; i <= 1; i++) {
@@ -647,7 +647,9 @@ void monster::stumble(game *g, bool moved)
}
}
if (valid_stumbles.size() == 0) //nowhere to stumble?
return;
{
return;
}
int choice = rng(0, valid_stumbles.size() - 1);
posx = valid_stumbles[choice].x;
+11 -6
View File
@@ -446,10 +446,10 @@ int monster::trigger_sum(game *g, std::vector<monster_trigger> *triggers)
if (check_meat) {
std::vector<item> *items = &(g->m.i_at(x, y));
for (int n = 0; n < items->size(); n++) {
if ((*items)[n].type->id == itm_corpse ||
(*items)[n].type->id == itm_meat ||
(*items)[n].type->id == itm_meat_cooked ||
(*items)[n].type->id == itm_human_flesh) {
if ((*items)[n].type->id == "corpse" ||
(*items)[n].type->id == "meat" ||
(*items)[n].type->id == "meat_cooked" ||
(*items)[n].type->id == "human_flesh") {
ret += 3;
check_meat = false;
}
@@ -462,7 +462,7 @@ int monster::trigger_sum(game *g, std::vector<monster_trigger> *triggers)
}
}
if (check_fire) {
if (g->u.has_amount(itm_torch_lit, 1))
if (g->u.has_amount("torch_lit", 1))
ret += 49;
}
}
@@ -529,6 +529,11 @@ void monster::hit_monster(game *g, int i)
int junk;
monster* target = &(g->z[i]);
if (this == target) {
debugmsg("stopped monster from hitting itself");
return;
}
int numdice = type->melee_skill;
int dodgedice = target->dodge() * 2;
switch (target->type->size) {
@@ -648,7 +653,7 @@ void monster::die(game *g)
selected_item++;
cur_chance -= g->itypes[mapit[selected_item]]->rarity;
}
g->m.add_item(posx, posy, g->itypes[mapit[selected_item]], 0);
g->m.spawn_item(posx, posy, g->itypes[mapit[selected_item]], 0);
if (type->item_chance < 0)
animal_done = true; // Only drop ONE item.
}
+1
View File
@@ -10,6 +10,7 @@ enum morale_type
{
MORALE_NULL = 0,
MORALE_FOOD_GOOD,
MORALE_FOOD_HOT,
MORALE_MUSIC,
MORALE_MARLOSS,
MORALE_FEELING_GOOD,
+1
View File
@@ -7,6 +7,7 @@
std::string morale_data[NUM_MORALE_TYPES] = {
"This is a bug",
"Enjoyed %i",
"Enjoyed a hot meal",
"Music",
"Marloss Bliss",
"Good Feeling",
+1 -1
View File
@@ -181,7 +181,7 @@ struct mtype {
std::string name;
std::string description;
monster_species species;
char sym; // Symbol on the map
long sym; // Symbol on the map
nc_color color;// Color of symbol (see color.h)
m_size size;
+14 -14
View File
@@ -72,8 +72,8 @@ mon("wolf", species_mammal, 'w', c_dkgray, MS_MEDIUM, FLESH,
&mdeath::normal, &mattack::none, "\
A vicious and fast pack hunter."
);
FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_ANIMAL, MF_WARM, MF_FUR, MF_HIT_AND_RUN, MF_KEENNOSE, MF_BLEED, MF_ATTACKMON), MF_BONES;
ANGER(MTRIG_TIME, MTRIG_PLAYER_WEAK, MTRIG_HURT, MF_VIS50);
FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_ANIMAL, MF_WARM, MF_FUR, MF_HIT_AND_RUN, MF_KEENNOSE, MF_BLEED, MF_ATTACKMON, MF_BONES, MF_VIS50);
ANGER(MTRIG_PLAYER_CLOSE, MTRIG_FRIEND_ATTACKED, MTRIG_PLAYER_WEAK, MTRIG_HURT);
PLACATE(MTRIG_MEAT);
FEARS(MTRIG_FIRE, MTRIG_FRIEND_DIED);
CATEGORIES(MC_WILDLIFE);
@@ -85,7 +85,7 @@ mon("bear", species_mammal, 'B', c_dkgray, MS_LARGE, FLESH,
Remember, only YOU can prevent forest fires."
);
FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_ANIMAL, MF_WARM, MF_FUR, MF_BLEED, MF_VIS40, MF_BONES);
ANGER(MTRIG_PLAYER_CLOSE);
ANGER(MTRIG_PLAYER_CLOSE, MTRIG_HURT);
PLACATE(MTRIG_MEAT);
FEARS(MTRIG_FIRE);
CATEGORIES(MC_WILDLIFE);
@@ -205,7 +205,7 @@ buzzes angrily through the air, dagger-\n\
sized sting pointed forward."
);
FLAGS(MF_SMELLS, MF_VENOM, MF_FLIES, MF_STUMBLES, MF_HIT_AND_RUN);
ANGER(MTRIG_FRIEND_DIED, MTRIG_PLAYER_CLOSE);
ANGER(MTRIG_HURT, MTRIG_FRIEND_DIED, MTRIG_PLAYER_CLOSE);
mon("giant wasp",species_insect, 'a', c_red, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
@@ -215,7 +215,7 @@ An evil-looking, slender-bodied wasp with\n\
a vicious sting on its abdomen."
);
FLAGS(MF_SMELLS, MF_POISON, MF_VENOM, MF_FLIES);
ANGER(MTRIG_FRIEND_DIED, MTRIG_PLAYER_CLOSE, MTRIG_SOUND);
ANGER(MTRIG_HURT, MTRIG_FRIEND_DIED, MTRIG_PLAYER_CLOSE, MTRIG_SOUND);
// GIANT WORMS
@@ -252,7 +252,7 @@ FLAGS(MF_DIGS, MF_HEARS, MF_GOODHEARING, MF_WARM, MF_LEATHER);
// ZOMBIES
mon("zombie", species_zombie, 'Z', c_ltgreen, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
3,100,100, 70, 8, 1, 5, 2, 1, 0, 0, 40, 50, 0,
3,100,100, 70, 8, 1, 5, 2, 1, 0, 0, 40, 50, 5,
&mdeath::normal, &mattack::bite, "\
A human body, stumbling slowly forward on\n\
uncertain legs, possessed with an unstoppable\n\
@@ -263,7 +263,7 @@ CATEGORIES(MC_CLASSIC);
mon("zombie cop", species_zombie, 'Z', c_blue, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
3,100,100, 70, 8, 1, 5, 0, 1, 0, 0, 40, 50, 0,
3,100,100, 70, 8, 1, 5, 0, 1, 0, 0, 40, 50, 5,
&mdeath::normal, &mattack::bite, "\
A human body, encapsulated in tough riot\n\
armour, this zombie was clearly a cop gearing\n\
@@ -313,11 +313,11 @@ thick, obfuscating smoke."
FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_WARM, MF_BASHES, MF_POISON,
MF_HARDTOSHOOT, MF_FRIENDLY_SPECIAL, MF_NO_BREATHE, MF_VIS40);
mon("fresh zombie",species_zombie, 'Z', c_ltred, MS_MEDIUM, FLESH,
mon("zombie dog",species_zombie, 'd', c_ltgreen, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
12,100,100,150, 10, 1, 4, 3, 4, 0, 0, 45, 40, 0,
12,100,100,150, 10, 1, 4, 3, 4, 0, 0, 0, 40, 5,
&mdeath::normal, &mattack::bite, "\
This deformed, sinewy zombie stays close to\n\
This deformed, sinewy canine stays close to\n\
the ground, loping forward faster than most\n\
humans ever could."
);
@@ -327,7 +327,7 @@ CATEGORIES(MC_CLASSIC);
mon("zombie brute",species_zombie, 'Z', c_red, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
25,100,100,115, 9, 4, 4, 2, 0, 6, 3, 60, 80, 0,
25,100,100,115, 9, 4, 4, 2, 0, 6, 3, 60, 80, 5,
&mdeath::normal, &mattack::bite, "\
A hideous beast of a zombie, bulging with\n\
distended muscles on both arms and legs."
@@ -376,7 +376,7 @@ FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_WARM, MF_BASHES, MF_POISON,
mon("skeleton", species_zombie, 'Z', c_white, MS_MEDIUM, STONE,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
8,100,100, 90, 10, 1, 5, 3, 2, 0, 15, 0, 40, 0,
8,100,100, 90, 10, 1, 5, 3, 2, 0, 15, 0, 40, 5,
&mdeath::normal, &mattack::bite, "\
A skeleton picked clean of all but a few\n\
rotten scraps of flesh, somehow still in\n\
@@ -408,7 +408,7 @@ FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_WARM, MF_BASHES, MF_POISON,
mon("zombie soldier", species_zombie, 'Z',c_ltblue, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
20,100,100, 80, 12, 2, 4, 0, 0, 8, 16, 60,100, 0,
20,100,100, 80, 12, 2, 4, 0, 0, 8, 16, 60,100, 5,
&mdeath::normal, &mattack::bite, "\
This zombie was clearly a soldier before.\n\
Its tattered armor gives it strong defense,\n\
@@ -1106,7 +1106,7 @@ heavily armored."
);
FLAGS(MF_SEES, MF_HEARS, MF_BASHES, MF_ATTACKMON, MF_ELECTRONIC, MF_NO_BREATHE, MF_VIS50);
mon("copbot", species_robot, 'R', c_dkgray, MS_MEDIUM, STEEL,
mon("copbot", species_robot, 'R', c_ltblue, MS_MEDIUM, STEEL,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
12,100, 40,100, 4, 3, 2, 0, 8, 12, 8, 80, 80, 3,
&mdeath::normal, &mattack::copbot, "\
+1 -2
View File
@@ -221,7 +221,7 @@ void player::remove_child_flag(game *g, pl_flag flag)
void mutation_effect(game *g, player &p, pl_flag mut)
{
bool is_u = (&p == &(g->u));
bool destroy = false, skip_cloth = false;
bool destroy = false;
std::vector<body_part> bps;
switch (mut) {
@@ -262,7 +262,6 @@ void mutation_effect(game *g, player &p, pl_flag mut)
case PF_HORNS_POINTED:
case PF_ANTENNAE:
case PF_ANTLERS:
skip_cloth = true;
bps.push_back(bp_head);
break;
+191 -51
View File
@@ -1,4 +1,5 @@
#include "player.h"
#include "profession.h"
#include "output.h"
#include "rng.h"
#include "keypress.h"
@@ -34,10 +35,13 @@
#define HIGH_STAT 14 // The point after which stats cost double
#define MAX_TRAIT_POINTS 12 // How many points from traits
#define NEWCHAR_TAB_MAX 4 // The ID of the rightmost tab
void draw_tabs(WINDOW* w, std::string sTab);
int set_stats(WINDOW* w, game* g, player *u, int &points);
int set_traits(WINDOW* w, game* g, player *u, int &points);
int set_profession(WINDOW* w, game* g, player *u, int &points);
int set_skills(WINDOW* w, game* g, player *u, int &points);
int set_description(WINDOW* w, game* g, player *u, int &points);
@@ -49,7 +53,9 @@ void save_template(player *u);
bool player::create(game *g, character_type type, std::string tempname)
{
weapon = item(g->itypes[0], 0);
weapon = item(g->itypes["null"], 0);
g->u.prof = profession::generic();
WINDOW* w = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
@@ -148,7 +154,7 @@ bool player::create(game *g, character_type type, std::string tempname)
points = 0;
} break;
}
tab = 3;
tab = NEWCHAR_TAB_MAX;
} else
points = OPTIONS[OPT_INITIAL_POINTS];
@@ -158,10 +164,11 @@ bool player::create(game *g, character_type type, std::string tempname)
switch (tab) {
case 0: tab += set_stats (w, g, this, points); break;
case 1: tab += set_traits (w, g, this, points); break;
case 2: tab += set_skills (w, g, this, points); break;
case 3: tab += set_description(w, g, this, points); break;
case 2: tab += set_profession (w, g, this, points); break;
case 3: tab += set_skills (w, g, this, points); break;
case 4: tab += set_description(w, g, this, points); break;
}
} while (tab >= 0 && tab < 4);
} while (tab >= 0 && tab <= NEWCHAR_TAB_MAX);
delwin(w);
if (tab < 0)
@@ -179,16 +186,18 @@ bool player::create(game *g, character_type type, std::string tempname)
if (has_trait(PF_SMELLY))
scent = 800;
if (has_trait(PF_ANDROID)) {
add_bionic(bionic_id(rng(bio_memory, max_bio_start - 1)));// Other
if (bionics[my_bionics[0].id].power_cost > 0) {
add_bionic(bionic_id(rng(1, bio_ethanol))); // Power Source
std::map<std::string,bionic_data*>::iterator random_bionic = bionics.begin();
std::advance(random_bionic,rng(0,bionics.size()-1));
add_bionic(random_bionic->first);// Other
if (bionics[my_bionics[0].id]->power_cost > 0) {
add_bionic(bionic_id(power_source_bionics[rng(0,power_source_bionics.size())])); // Power Source
max_power_level = 10;
power_level = 10;
} else {
bionic_id tmpbio;
do
tmpbio = bionic_id(rng(bio_ethanol + 1, bio_armor_legs));
while (bionics[tmpbio].power_cost > 0);
tmpbio = bionic_id(unpowered_bionics[rng(0, unpowered_bionics.size())]);
while (bionics[tmpbio]->power_cost > 0);
add_bionic(tmpbio);
max_power_level = 0;
power_level = 0;
@@ -196,9 +205,9 @@ bool player::create(game *g, character_type type, std::string tempname)
/* CHEATER'S STUFF
add_bionic(bionic_id(rng(0, bio_ethanol))); // Power Source
add_bionic(bionic_id(rng(0, "bio_ethanol"))); // Power Source
for (int i = 0; i < 5; i++)
add_bionic(bionic_id(rng(bio_memory, max_bio_start - 1)));// Other
add_bionic(bionic_id(rng("bio_memory", max_"bio_start" - 1)));// Other
max_power_level = 80;
power_level = 80;
@@ -211,46 +220,68 @@ End of cheatery */
int choice = menu("Pick your style:",
"Karate", "Judo", "Aikido", "Tai Chi", "Taekwondo", NULL);
if (choice == 1)
ma_type = itm_style_karate;
ma_type = "style_karate";
if (choice == 2)
ma_type = itm_style_judo;
ma_type = "style_judo";
if (choice == 3)
ma_type = itm_style_aikido;
ma_type = "style_aikido";
if (choice == 4)
ma_type = itm_style_tai_chi;
ma_type = "style_tai_chi";
if (choice == 5)
ma_type = itm_style_taekwondo;
ma_type = "style_taekwondo";
item tmpitem = item(g->itypes[ma_type], 0);
full_screen_popup(tmpitem.info(true).c_str());
} while (!query_yn("Use this style?"));
styles.push_back(ma_type);
}
ret_null = item(g->itypes[0], 0);
ret_null = item(g->itypes["null"], 0);
if (!styles.empty())
weapon = item(g->itypes[ styles[0] ], 0, ':');
else
weapon = item(g->itypes[0], 0);
// Nice to start out less than naked.
item tmp(g->itypes[itm_jeans_fit], 0, 'a');
worn.push_back(tmp);
tmp = item(g->itypes[itm_tshirt_fit], 0, 'b');
worn.push_back(tmp);
tmp = item(g->itypes[itm_sneakers_fit], 0, 'c');
worn.push_back(tmp);
weapon = item(g->itypes["null"], 0);
item tmp; //gets used several times
std::vector<std::string> prof_items = g->u.prof->items();
for (std::vector<std::string>::const_iterator iter = prof_items.begin(); iter != prof_items.end(); ++iter) {
item tmp = item(g->itypes.at(*iter), 0, 'a' + worn.size());
if (tmp.is_armor()) {
if (tmp.has_flag(IF_VARSIZE))
tmp.item_flags |= mfb(IF_FIT);
worn.push_back(tmp);
} else {
inv.push_back(tmp);
}
// if we start with drugs, need to start strongly addicted, too
if (tmp.is_food()) {
it_comest *comest = dynamic_cast<it_comest*>(tmp.type);
if (comest->add != ADD_NULL) {
addiction add(comest->add, 10);
g->u.addictions.push_back(add);
}
}
}
// The near-sighted get to start with glasses.
if (has_trait(PF_MYOPIC)) {
tmp = item(g->itypes[itm_glasses_eye], 0, 'd');
tmp = item(g->itypes["glasses_eye"], 0, 'a' + worn.size());
worn.push_back(tmp);
}
// And the far-sighted get to start with reading glasses.
if (has_trait(PF_HYPEROPIC)) {
tmp = item(g->itypes["glasses_reading"], 0, 'a' + worn.size());
worn.push_back(tmp);
}
// Likewise, the asthmatic start with their medication.
if (has_trait(PF_ASTHMA)) {
tmp = item(g->itypes[itm_inhaler], 0, 'a' + worn.size());
tmp = item(g->itypes["inhaler"], 0, 'a' + worn.size());
inv.push_back(tmp);
}
// Basic starter gear, added independently of profession.
tmp = item(g->itypes[itm_pockknife], 0,'a' + worn.size());
// Basic starter gear, added independently of profession.
tmp = item(g->itypes["pockknife"], 0,'a' + worn.size());
inv.push_back(tmp);
tmp = item(g->itypes[itm_lighter], 0,'a' + worn.size());
tmp = item(g->itypes["matches"], 0,'a' + worn.size());
inv.push_back(tmp);
// make sure we have no mutations
for (int i = 0; i < PF_MAX2; i++)
@@ -271,9 +302,10 @@ void draw_tabs(WINDOW* w, std::string sTab)
}
}
draw_tab(w, 8, "STATS", (sTab == "STATS") ? true : false);
draw_tab(w, 24, "TRAITS", (sTab == "TRAITS") ? true : false);
draw_tab(w, 41, "SKILLS", (sTab == "SKILLS") ? true : false);
draw_tab(w, 7, "STATS", (sTab == "STATS") ? true : false);
draw_tab(w, 18, "TRAITS", (sTab == "TRAITS") ? true : false);
draw_tab(w, 30, "PROFESSION", (sTab == "PROFESSION") ? true : false);
draw_tab(w, 46, "SKILLS", (sTab == "SKILLS") ? true : false);
draw_tab(w, 58, "DESCRIPTION", (sTab == "DESCRIPTION") ? true : false);
mvwputch(w, 2, 0, c_ltgray, LINE_OXXO); // |^
@@ -655,6 +687,120 @@ int set_traits(WINDOW* w, game* g, player *u, int &points)
} while (true);
}
int set_profession(WINDOW* w, game* g, player *u, int &points)
{
draw_tabs(w, "PROFESSION");
WINDOW* w_description = newwin(3, 78, 21 + getbegy(w), 1 + getbegx(w));
int cur_id = 1;
int retval = 0;
//may as well stick that +1 on for convenience
profession const** sorted_profs = new profession const*[profession::count()+1];
for (profmap::const_iterator iter = profession::begin(); iter != profession::end(); ++iter)
{
profession const* prof = &(iter->second);
sorted_profs[prof->id()] = prof;
}
do
{
int netPointCost = sorted_profs[cur_id]->point_cost() - u->prof->point_cost();
mvwprintz(w, 3, 2, c_ltgray, "Points left: %d ", points);
// Clear the bottom of the screen.
mvwprintz(w_description, 0, 0, c_ltgray, "\
");
mvwprintz(w_description, 1, 0, c_ltgray, "\
");
mvwprintz(w_description, 2, 0, c_ltgray, "\
");
mvwprintz(w, 3, 40, c_ltgray, " ");
if (points >= netPointCost)
{
mvwprintz(w, 3, 20, c_green, "Profession %s costs %d points (net: %d)",
sorted_profs[cur_id]->name().c_str(), sorted_profs[cur_id]->point_cost(),
netPointCost);
}
else
{
mvwprintz(w, 3, 20, c_ltred, "Profession %s costs %d points (net: %d)",
sorted_profs[cur_id]->name().c_str(), sorted_profs[cur_id]->point_cost(),
netPointCost);
}
mvwprintz(w_description, 0, 0, c_green, sorted_profs[cur_id]->description().c_str());
for (int i = 1; i < 17; ++i)
{
mvwprintz(w, 4 + i, 2, c_ltgray, "\
"); // Clear the line
int id = i;
if (cur_id < 7)
{
//do nothing
}
else if (cur_id >= profession::count() - 9)
{
id = profession::count() - 16 + i;
}
else
{
id += cur_id - 7;
}
if (id > profession::count())
{
break;
}
if (u->prof != sorted_profs[id])
{
mvwprintz(w, 4 + i, 2, (sorted_profs[id] == sorted_profs[cur_id] ? h_ltgray : c_ltgray),
sorted_profs[id]->name().c_str());
}
else
{
mvwprintz(w, 4 + i, 2,
(sorted_profs[id] == sorted_profs[cur_id] ? hilite(COL_SKILL_USED) : COL_SKILL_USED),
sorted_profs[id]->name().c_str());
}
}
wrefresh(w);
wrefresh(w_description);
switch (input())
{
case 'j':
if (cur_id < profession::count())
cur_id++;
break;
case 'k':
if (cur_id > 1)
cur_id--;
break;
case '\n':
if (netPointCost <= points) {
u->prof = profession::prof(sorted_profs[cur_id]->ident()); // we've got a const*
points -= netPointCost;
}
break;
case '<':
retval = -1;
break;
case '>':
retval = 1;
break;
}
} while (retval == 0);
delete[] sorted_profs;
return retval;
}
int set_skills(WINDOW* w, game* g, player *u, int &points)
{
draw_tabs(w, "SKILLS");
@@ -814,31 +960,25 @@ To save this character as a template, press !.");
mvwprintz(w, 6, 8, c_ltgray, "______________________________");
noname = false;
}
if (ch == '>') {
if (points > 0 && query_yn("Remaining points will be discarded, are you sure you want to proceed?")) {
if (u->name.size() == 0) {
if (points > 0 && !query_yn("Remaining points will be discarded, are you sure you want to proceed?")) {
continue;
} else if (u->name.size() == 0) {
mvwprintz(w, 6, 8, h_ltgray, "______NO NAME ENTERED!!!!_____");
noname = true;
wrefresh(w);
if (query_yn("Are you SURE you're finished? Your name will be randomly generated."))
u->pick_name();
return 1;
} else
return 1;
} else if (u->name.size() == 0) {
mvwprintz(w, 6, 8, h_ltgray, "______NO NAME ENTERED!!!!_____");
noname = true;
wrefresh(w);
if (query_yn("Are you SURE you're finished? Your name will be randomly generated.")){
if (!query_yn("Are you SURE you're finished? Your name will be randomly generated.")) {
continue;
} else {
u->pick_name();
return 1;
}
} else if (query_yn("Are you SURE you're finished?"))
} else if (query_yn("Are you SURE you're finished?")) {
return 1;
else
refresh();
} else {
continue;
}
} else if (ch == '<') {
return -1;
} else if (ch == '!') {
+144 -119
View File
@@ -53,7 +53,7 @@ npc::npc()
sklevel[i] = 0;
}
npc::npc(const npc &rhs) { *this = rhs; }
npc::npc(const npc &rhs):player() { *this = rhs; }
npc::~npc() { }
@@ -158,7 +158,7 @@ std::string npc::save_info()
dump << styles.size() << " ";
for (int i = 0; i < styles.size(); i++)
dump << int(styles[i]) << " ";
dump << itype_id(styles[i]) << " ";
dump << illness.size() << " ";
for (int i = 0; i < illness.size(); i++)
@@ -171,7 +171,7 @@ std::string npc::save_info()
dump << my_bionics.size() << " ";
for (int i = 0; i < my_bionics.size(); i++)
dump << int(my_bionics[i].id) << " " << my_bionics[i].invlet << " " <<
dump << bionic_id(my_bionics[i].id) << " " << my_bionics[i].invlet << " " <<
int(my_bionics[i].powered) << " " << my_bionics[i].charge << " ";
// NPC-specific stuff
@@ -248,16 +248,18 @@ void npc::load_info(game *g, std::string data)
for (int i = 0; i < num_skill_types; i++)
dump >> sklevel[i] >> skexercise[i];
int numill, numstyle;
int typetmp;
disease illtmp;
itype_id tmpstyle;
int numstyle;
dump >> numstyle;
for (int i = 0; i < numstyle; i++) {
dump >> typetmp;
styles.push_back(itype_id(typetmp));
dump >> tmpstyle;
styles.push_back(tmpstyle);
}
int typetmp;
int numill;
dump >> numill;
disease illtmp;
for (int i = 0; i < numill; i++) {
dump >> typetmp >> illtmp.duration;
illtmp.type = dis_type(typetmp);
@@ -271,12 +273,13 @@ void npc::load_info(game *g, std::string data)
addtmp.type = add_type(typetmp);
addictions.push_back(addtmp);
}
bionic_id tmpbionic;
int numbio;
bionic biotmp;
dump >> numbio;
for (int i = 0; i < numbio; i++) {
dump >> typetmp >> biotmp.invlet >> biotmp.powered >> biotmp.charge;
biotmp.id = bionic_id(typetmp);
dump >> tmpbionic >> biotmp.invlet >> biotmp.powered >> biotmp.charge;
biotmp.id = bionic_id(tmpbionic);
my_bionics.push_back(biotmp);
}
// Special NPC stuff
@@ -304,8 +307,8 @@ void npc::randomize(game *g, npc_class type)
dex_max = dice(4, 3);
int_max = dice(4, 3);
per_max = dice(4, 3);
ret_null = item(g->itypes[0], 0);
weapon = item(g->itypes[0], 0);
ret_null = item(g->itypes["null"], 0);
weapon = item(g->itypes["null"], 0);
inv.clear();
personality.aggression = rng(-10, 10);
personality.bravery = rng( -3, 10);
@@ -400,7 +403,7 @@ void npc::randomize(game *g, npc_class type)
personality.bravery += rng(0, 3);
personality.collector -= rng(1, 6);
do
styles.push_back( itype_id( rng(itm_style_karate, itm_style_zui_quan) ) );
styles.push_back( martial_arts_itype_ids[rng(0, martial_arts_itype_ids.size()-1)] );
while (one_in(2));
break;
@@ -697,58 +700,58 @@ void npc::randomize_from_faction(game *g, faction *fac)
std::vector<item> starting_clothes(npc_class type, bool male, game *g)
{
std::vector<item> ret;
itype_id pants = itm_null, shoes = itm_null, shirt = itm_null,
gloves = itm_null, coat = itm_null, mask = itm_null,
glasses = itm_null, hat = itm_null;
itype_id pants = "null", shoes = "null", shirt = "null",
gloves = "null", coat = "null", mask = "null",
glasses = "null", hat = "null";
switch(rng(0, (male ? 3 : 4))) {
case 0: pants = itm_jeans; break;
case 1: pants = itm_pants; break;
case 2: pants = itm_pants_leather; break;
case 3: pants = itm_pants_cargo; break;
case 4: pants = itm_skirt; break;
case 0: pants = "jeans"; break;
case 1: pants = "pants"; break;
case 2: pants = "pants_leather"; break;
case 3: pants = "pants_cargo"; break;
case 4: pants = "skirt"; break;
}
switch (rng(0, 3)) {
case 0: shirt = itm_tshirt; break;
case 1: shirt = itm_polo_shirt; break;
case 2: shirt = itm_dress_shirt; break;
case 3: shirt = itm_tank_top; break;
case 0: shirt = "tshirt"; break;
case 1: shirt = "polo_shirt"; break;
case 2: shirt = "dress_shirt"; break;
case 3: shirt = "tank_top"; break;
}
switch(rng(0, 10)) {
case 8: gloves = itm_gloves_leather; break;
case 9: gloves = itm_gloves_fingerless; break;
case 10: gloves = itm_fire_gauntlets; break;
case 8: gloves = "gloves_leather"; break;
case 9: gloves = "gloves_fingerless"; break;
case 10: gloves = "fire_gauntlets"; break;
}
switch (rng(0, 6)) {
case 2: coat = itm_hoodie; break;
case 3: coat = itm_jacket_light; break;
case 4: coat = itm_jacket_jean; break;
case 5: coat = itm_jacket_leather; break;
case 6: coat = itm_trenchcoat; break;
case 2: coat = "hoodie"; break;
case 3: coat = "jacket_light"; break;
case 4: coat = "jacket_jean"; break;
case 5: coat = "jacket_leather"; break;
case 6: coat = "trenchcoat"; break;
}
if (one_in(30))
coat = itm_kevlar;
shoes = itm_sneakers;
mask = itm_null;
coat = "kevlar";
shoes = "sneakers";
mask = "null";
if (one_in(8)) {
switch(rng(0, 2)) {
case 0: mask = itm_mask_dust; break;
case 1: mask = itm_bandana; break;
case 2: mask = itm_mask_filter; break;
case 0: mask = "mask_dust"; break;
case 1: mask = "bandana"; break;
case 2: mask = "mask_filter"; break;
}
}
glasses = itm_null;
glasses = "null";
if (one_in(8))
glasses = itm_glasses_safety;
hat = itm_null;
glasses = "glasses_safety";
hat = "null";
if (one_in(6)) {
switch(rng(0, 5)) {
case 0: hat = itm_hat_ball; break;
case 1: hat = itm_hat_hunting; break;
case 2: hat = itm_hat_hard; break;
case 3: hat = itm_helmet_bike; break;
case 4: hat = itm_helmet_riot; break;
case 5: hat = itm_helmet_motor; break;
case 0: hat = "hat_ball"; break;
case 1: hat = "hat_hunting"; break;
case 2: hat = "hat_hard"; break;
case 3: hat = "helmet_bike"; break;
case 4: hat = "helmet_riot"; break;
case 5: hat = "helmet_motor"; break;
}
}
@@ -756,101 +759,101 @@ std::vector<item> starting_clothes(npc_class type, bool male, game *g)
switch (type) {
case NC_DOCTOR:
if (one_in(2))
pants = itm_pants;
pants = "pants";
if (one_in(3))
shirt = (one_in(2) ? itm_polo_shirt : itm_dress_shirt);
shirt = (one_in(2) ? "polo_shirt" : "dress_shirt");
if (!one_in(8))
coat = itm_coat_lab;
coat = "coat_lab";
if (one_in(3))
mask = itm_mask_dust;
mask = "mask_dust";
if (one_in(4))
glasses = itm_glasses_safety;
if (gloves != itm_null || one_in(3))
gloves = itm_gloves_medical;
glasses = "glasses_safety";
if (gloves != "null" || one_in(3))
gloves = "gloves_medical";
break;
case NC_TRADER:
if (one_in(2))
pants = itm_pants_cargo;
pants = "pants_cargo";
switch (rng(0, 8)) {
case 1: coat = itm_hoodie; break;
case 2: coat = itm_jacket_jean; break;
case 3: case 4: coat = itm_vest; break;
case 5: case 6: case 7: case 8: coat = itm_trenchcoat; break;
case 1: coat = "hoodie"; break;
case 2: coat = "jacket_jean"; break;
case 3: case 4: coat = "vest"; break;
case 5: case 6: case 7: case 8: coat = "trenchcoat"; break;
}
break;
case NC_NINJA:
if (one_in(4))
shirt = itm_null;
shirt = "null";
else if (one_in(3))
shirt = itm_tank_top;
shirt = "tank_top";
if (one_in(5))
gloves = itm_gloves_leather;
gloves = "gloves_leather";
if (one_in(2))
mask = itm_bandana;
mask = "bandana";
if (one_in(3))
hat = itm_null;
hat = "null";
break;
case NC_COWBOY:
if (one_in(2))
shoes = itm_boots;
shoes = "boots";
if (one_in(2))
pants = itm_jeans;
pants = "jeans";
if (one_in(3))
shirt = itm_tshirt;
shirt = "tshirt";
if (one_in(4))
gloves = itm_gloves_leather;
gloves = "gloves_leather";
if (one_in(4))
coat = itm_jacket_jean;
coat = "jacket_jean";
if (one_in(3))
hat = itm_hat_boonie;
hat = "hat_boonie";
break;
case NC_SCIENTIST:
if (one_in(4))
glasses = itm_glasses_eye;
glasses = "glasses_eye";
else if (one_in(2))
glasses = itm_glasses_safety;
glasses = "glasses_safety";
if (one_in(5))
coat = itm_coat_lab;
coat = "coat_lab";
break;
case NC_BOUNTY_HUNTER:
if (one_in(3))
pants = itm_pants_cargo;
pants = "pants_cargo";
if (one_in(2))
shoes = itm_boots_steel;
shoes = "boots_steel";
if (one_in(4))
coat = itm_jacket_leather;
coat = "jacket_leather";
if (one_in(4))
mask = itm_mask_filter;
mask = "mask_filter";
if (one_in(5))
glasses = itm_goggles_ski;
glasses = "goggles_ski";
if (one_in(3)) {
mask = itm_null;
hat = itm_helmet_motor;
mask = "null";
hat = "helmet_motor";
}
break;
}
// Fill in the standard things we wear
if (shoes != itm_null)
if (shoes != "null")
ret.push_back(item(g->itypes[shoes], 0));
if (pants != itm_null)
if (pants != "null")
ret.push_back(item(g->itypes[pants], 0));
if (shirt != itm_null)
if (shirt != "null")
ret.push_back(item(g->itypes[shirt], 0));
if (coat != itm_null)
if (coat != "null")
ret.push_back(item(g->itypes[coat], 0));
if (gloves != itm_null)
if (gloves != "null")
ret.push_back(item(g->itypes[gloves], 0));
// Bad to wear a mask under a motorcycle helmet
if (mask != itm_null && hat != itm_helmet_motor)
if (mask != "null" && hat != "helmet_motor")
ret.push_back(item(g->itypes[mask], 0));
if (glasses != itm_null)
if (glasses != "null")
ret.push_back(item(g->itypes[glasses], 0));
if (hat != itm_null)
if (hat != "null")
ret.push_back(item(g->itypes[hat], 0));
// Second pass--for extra stuff like backpacks, etc
@@ -859,16 +862,16 @@ std::vector<item> starting_clothes(npc_class type, bool male, game *g)
case NC_DOCTOR:
case NC_SCIENTIST:
if (one_in(10))
ret.push_back(item(g->itypes[itm_backpack], 0));
ret.push_back(item(g->itypes["backpack"], 0));
break;
case NC_COWBOY:
case NC_BOUNTY_HUNTER:
if (one_in(2))
ret.push_back(item(g->itypes[itm_backpack], 0));
ret.push_back(item(g->itypes["backpack"], 0));
break;
case NC_TRADER:
if (!one_in(15))
ret.push_back(item(g->itypes[itm_backpack], 0));
ret.push_back(item(g->itypes["backpack"], 0));
break;
}
@@ -879,7 +882,7 @@ std::vector<item> starting_inv(npc *me, npc_class type, game *g)
{
int total_space = me->volume_capacity() - 2;
std::vector<item> ret;
ret.push_back( item(g->itypes[itm_lighter], 0) );
ret.push_back( item(g->itypes["lighter"], 0) );
itype_id tmp;
// First, if we're wielding a gun, get some ammo for it
@@ -898,7 +901,7 @@ std::vector<item> starting_inv(npc *me, npc_class type, game *g)
}
if (type == NC_TRADER) { // Traders just have tons of random junk
while (total_space > 0 && !one_in(50)) {
tmp = itype_id(rng(2, num_items - 1));
tmp = standard_itype_ids[rng(0,standard_itype_ids.size()-1)];
if (total_space >= g->itypes[tmp]->volume) {
ret.push_back(item(g->itypes[tmp], 0));
ret[ret.size() - 1] = ret[ret.size() - 1].in_its_container(&g->itypes);
@@ -940,7 +943,7 @@ std::vector<item> starting_inv(npc *me, npc_class type, game *g)
// TODO: More specifics.
while (total_space > 0 && !one_in(8)) {
tmp = itype_id(rng(4, num_items - 1));
tmp = standard_itype_ids[rng(0, standard_itype_ids.size())];
if (total_space >= g->itypes[tmp]->volume) {
ret.push_back(item(g->itypes[tmp], 0));
ret[ret.size() - 1] = ret[ret.size() - 1].in_its_container(&g->itypes);
@@ -980,6 +983,28 @@ void npc::spawn_at(overmap *o, int x, int y)
}
}
void npc::place_near(game *g, int potentialX, int potentialY)
{
//places the npc at the nearest empty spot near (potentialX, potentialY). Searches in a spiral pattern for a suitable location.
int x = 0;
int y = 0;
int dx = 0;
int dy = -1;
int temp;
while(!g->is_empty(potentialX + x, potentialY + y)) {
if ((x == y) || ((x < 0) && (x == -y)) || ((x > 0) && (x == 1-y))) {//change direction
temp = dx;
dx = -dy;
dy = temp;
}
x += dx;
y += dy;
}//end search, potentialX + x , potentialY + y contains a free spot.
//place the npc at the free spot.
posx = potentialX + x;
posy = potentialY + y;
}
skill npc::best_skill()
{
std::vector<int> best_skills;
@@ -1007,22 +1032,22 @@ void npc::starting_weapon(game *g)
switch (best) {
case sk_bashing:
switch (rng(0, 5)) {
case 0: weapon.make(g->itypes[itm_hammer]); break;
case 1: weapon.make(g->itypes[itm_wrench]); break;
case 2: weapon.make(g->itypes[itm_hammer_sledge]); break;
case 3: weapon.make(g->itypes[itm_pipe]); break;
case 4: weapon.make(g->itypes[itm_bat]); break;
case 5: weapon.make(g->itypes[itm_crowbar]); break;
case 0: weapon.make(g->itypes["hammer"]); break;
case 1: weapon.make(g->itypes["wrench"]); break;
case 2: weapon.make(g->itypes["hammer_sledge"]); break;
case 3: weapon.make(g->itypes["pipe"]); break;
case 4: weapon.make(g->itypes["bat"]); break;
case 5: weapon.make(g->itypes["crowbar"]); break;
}
break;
case sk_cutting:
switch (rng(0, 5)) {
case 0: weapon.make(g->itypes[itm_knife_butcher]); break;
case 1: weapon.make(g->itypes[itm_hatchet]); break;
case 2: weapon.make(g->itypes[itm_ax]); break;
case 3: weapon.make(g->itypes[itm_machete]); break;
case 4: weapon.make(g->itypes[itm_knife_combat]); break;
case 5: weapon.make(g->itypes[itm_katana]); break;
case 0: weapon.make(g->itypes["knife_butcher"]); break;
case 1: weapon.make(g->itypes["hatchet"]); break;
case 2: weapon.make(g->itypes["ax"]); break;
case 3: weapon.make(g->itypes["machete"]); break;
case 4: weapon.make(g->itypes["knife_combat"]); break;
case 5: weapon.make(g->itypes["katana"]); break;
}
break;
case sk_throw:
@@ -1272,7 +1297,7 @@ int npc::player_danger(player *u)
ret += 8;
} else if (u->weapon.type->melee_dam >= 12 || u->weapon.type->melee_cut >= 12)
ret++;
else if (u->weapon.type->id == 0) // Unarmed
else if (u->weapon.type->id == "null") // Unarmed
ret -= 3;
if (u->str_cur > 20) // Superhuman strength!
@@ -1435,7 +1460,7 @@ void npc::decide_needs()
it_gun* gun = dynamic_cast<it_gun*>(weapon.type);
needrank[need_ammo] = 5 * has_ammo(gun->ammo).size();
}
if (weapon.type->id == 0 && sklevel[sk_unarmed] < 4)
if (weapon.type->id == "null" && sklevel[sk_unarmed] < 4)
needrank[need_weapon] = 1;
else
needrank[need_weapon] = weapon.type->melee_dam + weapon.type->melee_cut +
@@ -1506,7 +1531,7 @@ void npc::init_selling(std::vector<int> &indices, std::vector<int> &prices)
int val, price;
bool found_lighter = false;
for (int i = 0; i < inv.size(); i++) {
if (inv[i].type->id == itm_lighter && !found_lighter)
if (inv[i].type->id == "lighter" && !found_lighter)
found_lighter = true;
else {
val = value(inv[i]) - (inv[i].price() / 50);
@@ -1609,8 +1634,8 @@ int npc::value(item &it)
if (fac_has_job(FACJOB_DRUGS) && it.is_food() &&
(dynamic_cast<it_comest*>(it.type))->addict >= 5)
ret += 10;
if (fac_has_job(FACJOB_DOCTORS) && it.type->id >= itm_bandages &&
it.type->id <= itm_prozac)
if (fac_has_job(FACJOB_DOCTORS) && it.type->id >= "bandages" &&
it.type->id <= "prozac")
ret += 10;
if (fac_has_value(FACVAL_BOOKS) && it.is_book())
ret += 14;
@@ -1624,7 +1649,7 @@ int npc::value(item &it)
bool npc::has_healing_item()
{
for (int i = 0; i < inv.size(); i++) {
if (inv[i].type->id == itm_bandages || inv[i].type->id == itm_1st_aid)
if (inv[i].type->id == "bandages" || inv[i].type->id == "1st_aid")
return true;
}
return false;
@@ -1633,9 +1658,9 @@ bool npc::has_healing_item()
bool npc::has_painkiller()
{
for (int i = 0; i < inv.size(); i++) {
if ((pain <= 35 && inv[i].type->id == itm_aspirin) ||
(pain >= 50 && inv[i].type->id == itm_oxycodone) ||
inv[i].type->id == itm_tramadol || inv[i].type->id == itm_codeine)
if ((pain <= 35 && inv[i].type->id == "aspirin") ||
(pain >= 50 && inv[i].type->id == "oxycodone") ||
inv[i].type->id == "tramadol" || inv[i].type->id == "codeine")
return true;
}
return false;
@@ -1850,7 +1875,7 @@ void npc::print_info(WINDOW* w)
// because it's a border as well; so we have lines 6 through 11.
// w is also 48 characters wide - 2 characters for border = 46 characters for us
mvwprintz(w, 6, 1, c_white, "NPC: %s", name.c_str());
mvwprintz(w, 7, 1, c_red, "Wielding %s%s", (weapon.type->id == 0 ? "" : "a "),
mvwprintz(w, 7, 1, c_red, "Wielding %s%s", (weapon.type->id == "null" ? "" : "a "),
weapon.tname().c_str());
std::string wearing;
std::stringstream wstr;
@@ -1991,14 +2016,14 @@ void npc::die(game *g, bool your_fault)
}
item my_body;
my_body.make_corpse(g->itypes[itm_corpse], g->mtypes[mon_null], g->turn);
my_body.make_corpse(g->itypes["corpse"], g->mtypes[mon_null], g->turn);
my_body.name = name;
g->m.add_item(posx, posy, my_body);
for (int i = 0; i < inv.size(); i++)
g->m.add_item(posx, posy, inv[i]);
for (int i = 0; i < worn.size(); i++)
g->m.add_item(posx, posy, worn[i]);
if (weapon.type->id != itm_null)
if (weapon.type->id != "null")
g->m.add_item(posx, posy, weapon);
for (int i = 0; i < g->active_missions.size(); i++) {
+5 -3
View File
@@ -136,7 +136,7 @@ struct npc_favor
npc_favor() {
type = FAVOR_NULL;
value = 0;
item_id = itm_null;
item_id = "null";
skill = NULL;
};
@@ -235,11 +235,12 @@ struct npc_opinion
int tmpsize;
info >> trust >> fear >> value >> anger >> owed >> tmpsize;
for (int i = 0; i < tmpsize; i++) {
int tmptype, tmpitem, tmpskill;
int tmptype, tmpskill;
std::string tmpitem;
npc_favor tmpfavor;
info >> tmptype >> tmpfavor.value >> tmpitem >> tmpskill;
tmpfavor.type = npc_favor_type(tmptype);
tmpfavor.item_id = itype_id(tmpitem);
tmpfavor.item_id = tmpitem;
tmpfavor.skill = Skill::skill(tmpskill);
favors.push_back(tmpfavor);
}
@@ -411,6 +412,7 @@ public:
void randomize(game *g, npc_class type = NC_NONE);
void randomize_from_faction(game *g, faction *fac);
void spawn_at(overmap *o, int posx, int posy);
void place_near(game *g, int potentialX, int potentialY);
skill best_skill();
void starting_weapon(game *g);
+23 -23
View File
@@ -12,9 +12,9 @@
#ifndef NUM_ESCAPE_ITEMS
#define NUM_ESCAPE_ITEMS 11
itype_id ESCAPE_ITEMS[NUM_ESCAPE_ITEMS] = {
itm_cola, itm_caffeine, itm_energy_drink, itm_canister_goo, itm_smokebomb,
itm_smokebomb_act, itm_adderall, itm_coke, itm_meth, itm_teleporter,
itm_pheromone
"cola", "caffeine", "energy_drink", "canister_goo", "smokebomb",
"smokebomb_act", "adderall", "coke", "meth", "teleporter",
"pheromone"
};
#endif
@@ -22,10 +22,10 @@ itype_id ESCAPE_ITEMS[NUM_ESCAPE_ITEMS] = {
#ifndef NUM_ALT_ATTACK_ITEMS
#define NUM_ALT_ATTACK_ITEMS 16
itype_id ALT_ATTACK_ITEMS[NUM_ALT_ATTACK_ITEMS] = {
itm_knife_combat, itm_spear_wood, itm_molotov, itm_pipebomb, itm_grenade,
itm_gasbomb, itm_bot_manhack, itm_tazer, itm_dynamite, itm_mininuke,
itm_molotov_lit, itm_pipebomb_act, itm_grenade_act, itm_gasbomb_act,
itm_dynamite_act, itm_mininuke_act
"knife_combat", "spear_wood", "molotov", "pipebomb", "grenade",
"gasbomb", "bot_manhack", "tazer", "dynamite", "mininuke",
"molotov_lit", "pipebomb_act", "grenade_act", "gasbomb_act",
"dynamite_act", "mininuke_act"
};
#endif
@@ -1471,7 +1471,7 @@ void npc::wield_best_melee(game *g)
void npc::alt_attack(game *g, int target)
{
itype_id which = itm_null;
itype_id which = "null";
int tarx, tary;
if (target == TARGET_PLAYER) {
tarx = g->u.posx;
@@ -1496,7 +1496,7 @@ void npc::alt_attack(game *g, int target)
which = ALT_ATTACK_ITEMS[i];
}
if (which == itm_null) { // We ain't got shit!
if (which == "null") { // We ain't got shit!
// Not sure if this should ever occur. For now, let's warn with a debug msg
debugmsg("npc::alt_attack() couldn't find an alt attack item!");
if (dist == 1) {
@@ -1622,7 +1622,7 @@ bool thrown_item(item *used)
return false;
}
itype_id type = itype_id(used->type->id);
return (used->active || type == itm_knife_combat || type == itm_spear_wood);
return (used->active || type == "knife_combat" || type == "spear_wood");
}
void npc::heal_player(game *g, player &patient)
@@ -1666,20 +1666,20 @@ void npc::heal_player(game *g, player &patient)
g->add_msg("Someone heals you.");
int amount_healed;
if (has_amount(itm_1st_aid, 1)) {
if (has_amount("1st_aid", 1)) {
switch (worst) {
case hp_head: amount_healed = 10 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 20 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 15 + 2 * sklevel[sk_firstaid];
}
use_charges(itm_1st_aid, 1);
} else if (has_amount(itm_bandages, 1)) {
use_charges("1st_aid", 1);
} else if (has_amount("bandages", 1)) {
switch (worst) {
case hp_head: amount_healed = 1 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 4 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 3 + 2 * sklevel[sk_firstaid];
}
use_charges(itm_bandages, 1);
use_charges("bandages", 1);
}
patient.heal(worst, amount_healed);
moves -= 250;
@@ -1716,20 +1716,20 @@ void npc::heal_self(game *g)
}
int amount_healed;
if (has_amount(itm_1st_aid, 1)) {
if (has_amount("1st_aid", 1)) {
switch (worst) {
case hp_head: amount_healed = 10 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 20 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 15 + 2 * sklevel[sk_firstaid];
}
use_charges(itm_1st_aid, 1);
} else if (has_amount(itm_bandages, 1)) {
use_charges("1st_aid", 1);
} else if (has_amount("bandages", 1)) {
switch (worst) {
case hp_head: amount_healed = 1 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 4 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 3 + 2 * sklevel[sk_firstaid];
}
use_charges(itm_bandages, 1);
use_charges("bandages", 1);
} else {
debugmsg("NPC tried to heal self, but has no bandages / first aid");
move_pause();
@@ -1747,15 +1747,15 @@ void npc::use_painkiller(game *g)
int difference = 9999, index = -1;
for (int i = 0; i < inv.size(); i++) {
int diff = 9999;
if (inv[i].type->id == itm_aspirin)
if (inv[i].type->id == "aspirin")
diff = abs(pain - 15);
else if (inv[i].type->id == itm_codeine)
else if (inv[i].type->id == "codeine")
diff = abs(pain - 30);
else if (inv[i].type->id == itm_oxycodone)
else if (inv[i].type->id == "oxycodone")
diff = abs(pain - 60);
else if (inv[i].type->id == itm_heroin)
else if (inv[i].type->id == "heroin")
diff = abs(pain - 100);
else if (inv[i].type->id == itm_tramadol)
else if (inv[i].type->id == "tramadol")
diff = abs(pain - 40) / 2; // Bonus since it's long-acting
if (diff < difference) {
+12 -6
View File
@@ -351,8 +351,12 @@ std::string dynamic_line(talk_topic topic, game *g, npc *p)
return "Well, I was lost, but you found me...";
case NPC_MISSION_KIDNAPPED:
return "Well, I was kidnapped, but you saved me...";
case NPC_MISSION_BASE:
return "I'm guarding this location.";
case NPC_MISSION_NULL:
switch (p->myclass) {
case NC_SHOPKEEP:
return "I'm a local shopkeeper.";
case NC_HACKER:
return "I'm looking for some choice systems to hack.";
case NC_DOCTOR:
@@ -665,7 +669,7 @@ std::vector<talk_response> gen_responses(talk_topic topic, game *g, npc *p)
int score = p->op_of_u.trust + p->op_of_u.value * 3 +
p->personality.altruism * 2;
int missions_value = p->assigned_missions_value(g);
if (g->u.has_amount(itm_mininuke, 1)) {
if (g->u.has_amount("mininuke", 1)) {
RESPONSE("Because I'm holding a thermal detonator!");
SUCCESS(TALK_GIVE_EQUIPMENT);
SUCCESS_ACTION(&talk_function::give_equipment);
@@ -735,7 +739,7 @@ std::vector<talk_response> gen_responses(talk_topic topic, game *g, npc *p)
resume << "Yes, let's resume training " <<
(g->u.backlog.index > 0 ?
skill_name(g->u.backlog.index) :
g->itypes[ 0 - g->u.backlog.index ]->name);
g->itypes[ martial_arts_itype_ids[0-g->u.backlog.index] ]->name);
SELECT_TEMP( resume.str(), g->u.backlog.index);
SUCCESS(TALK_TRAIN_START);
}
@@ -766,7 +770,7 @@ std::vector<talk_response> gen_responses(talk_topic topic, game *g, npc *p)
for (int i = 0; i < styles.size() && printed < 9; i++) {
printed++;
SELECT_TEMP( g->itypes[styles[i]]->name + " (cost 800)",
0 - styles[i] );
0 - i );
SUCCESS(TALK_TRAIN_START);
}
if (more) {
@@ -1481,10 +1485,12 @@ void talk_function::start_training(game *g, npc *p)
{
int cost = 0, time = 0;
skill sk_used = sk_null;
itype_id style = itm_null;
//There were some style references here that... didn't do anything. Created but never used.
//TODO: Remove these comments once I'm sure this is correct.
//itype_id style = "null";
if (p->chatbin.tempvalue < 0) {
cost = -800;
style = itype_id(0 - p->chatbin.tempvalue);
// style = itype_id(0 - p->chatbin.tempvalue);
time = 30000;
} else {
sk_used = skill(p->chatbin.tempvalue);
@@ -1528,7 +1534,7 @@ void parse_tags(std::string &phrase, player *u, npc *me)
if (tag == "<yrwp>")
phrase.replace(fa, l, u->weapon.tname());
else if (tag == "<mywp>") {
if (me->weapon.type->id == 0)
if (me->weapon.type->id == "null")
phrase.replace(fa, l, "fists");
else
phrase.replace(fa, l, me->weapon.tname());
+7
View File
@@ -206,6 +206,8 @@ option_key lookup_option_key(std::string id)
return OPT_AUTOSAVE;
if (id == "gradual_night_light")
return OPT_GRADUAL_NIGHT_LIGHT;
if (id == "rain_animation")
return OPT_RAIN_ANIMATION;
if (id == "query_disassemble")
return OPT_QUERY_DISASSEMBLE;
if (id == "drop_empty")
@@ -244,6 +246,7 @@ std::string option_string(option_key key)
case OPT_AUTOSAFEMODETURNS: return "autosafemodeturns";
case OPT_AUTOSAVE: return "autosave";
case OPT_GRADUAL_NIGHT_LIGHT: return "gradual_night_light";
case OPT_RAIN_ANIMATION: return "rain_animation";
case OPT_QUERY_DISASSEMBLE: return "query_disassemble";
case OPT_DROP_EMPTY: return "drop_empty";
case OPT_SKILL_RUST: return "skill_rust";
@@ -274,6 +277,7 @@ std::string option_desc(option_key key)
case OPT_AUTOSAFEMODETURNS: return "Number of turns after safemode\nis reenabled if no hostiles are\nin safemodeproximity distance";
case OPT_AUTOSAVE: return "If true, game will periodically\nsave the map";
case OPT_GRADUAL_NIGHT_LIGHT: return "If true will add nice gradual-lighting\n(should only make a difference @night)";
case OPT_RAIN_ANIMATION: return "If true, will display weather animations";
case OPT_QUERY_DISASSEMBLE: return "If true, will query before disassembling\nitems";
case OPT_DROP_EMPTY: return "Set to drop empty containers after use\n0 - don't drop any\n1 - all except watertight containers\n2 - all containers";
case OPT_SKILL_RUST: return "Set the level of skill rust\n0 - vanilla Cataclysm\n1 - capped at skill levels\n2 - none at all";
@@ -304,6 +308,7 @@ std::string option_name(option_key key)
case OPT_AUTOSAFEMODETURNS: return "Turns to reenable safemode";
case OPT_AUTOSAVE: return "Periodically Autosave";
case OPT_GRADUAL_NIGHT_LIGHT: return "Gradual night light";
case OPT_RAIN_ANIMATION: return "Rain animation";
case OPT_QUERY_DISASSEMBLE: return "Query on disassembly";
case OPT_DROP_EMPTY: return "Drop empty containers";
case OPT_SKILL_RUST: return "Skill Rust";
@@ -411,6 +416,8 @@ autosafemodeturns 50\n\
autosave F\n\
# If true will add nice gradual-lighting (should only make a difference @night)\n\
gradual_night_light F\n\
# If true, will display weather animations\n\
rain_animation T\n\
# If true, will query beefore disassembling items\n\
query_disassemble T\n\
# Player will automatically drop empty containers after use\n\
+1
View File
@@ -17,6 +17,7 @@ OPT_AUTOSAFEMODE, // Autosafemode on by default?
OPT_AUTOSAFEMODETURNS, //Number of turns untill safemode kicks back in
OPT_AUTOSAVE, // Automatically save the game on intervals.
OPT_GRADUAL_NIGHT_LIGHT, // be so cool at night :)
OPT_RAIN_ANIMATION, // Enable the rain and other weather animation
OPT_QUERY_DISASSEMBLE, // Query before disassembling items
OPT_DROP_EMPTY, // auto drop empty containers after use
OPT_SKILL_RUST, // level of skill rust
+15 -3
View File
@@ -721,6 +721,10 @@ void full_screen_popup(const char* mes, ...)
refresh();
}
//note that passing in iteminfo instances with sType == "MENU" or "DESCRIPTION" does special things
//if sType == "MENU", sPre == "iOffsetY" or "iOffsetX" also do special things
//otherwise if sType == "MENU", iValue can be used to control color
//all this should probably be cleaned up at some point, rather than using a function for things it wasn't meant for
char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string sItemName, std::vector<iteminfo> vItemDisplay, std::vector<iteminfo> vItemCompare)
{
WINDOW* w = newwin(iHeight, iWidth, VIEW_OFFSET_Y, iLeft + VIEW_OFFSET_X);
@@ -737,14 +741,18 @@ char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string
} else if (vItemDisplay[i].sPre == "iOffsetX") {
iStartX = vItemDisplay[i].iValue;
} else {
mvwprintz(w, line_num, iStartX, c_ltgreen, "%s", (vItemDisplay[i].sName).c_str());
nc_color nameColor = c_ltgreen; //pre-existing behavior, so make it the default
//patched to allow variable "name" coloring, e.g. for item examining
if (vItemDisplay[i].iValue >= 0) {
nameColor = vItemDisplay[i].iValue == 0 ? c_ltgray : c_ltred;
}
mvwprintz(w, line_num, iStartX, nameColor, "%s", (vItemDisplay[i].sName).c_str());
wprintz(w, c_white, "%s", (vItemDisplay[i].sPre).c_str());
line_num++;
}
} else if (vItemDisplay[i].sType == "DESCRIPTION") {
std::string sText = vItemDisplay[i].sName;
std::replace(sText.begin(), sText.end(), '\n', ' ');
int iPos;
while (1) {
line_num++;
if (sText.size() > iWidth-4) {
@@ -848,7 +856,7 @@ char rand_char()
// this translates symbol y, u, n, b to NW, NE, SE, SW lines correspondingly
// h, j, c to horizontal, vertical, cross correspondingly
long special_symbol (char sym)
long special_symbol (long sym)
{
switch (sym)
{
@@ -932,6 +940,10 @@ void draw_tab(WINDOW *w, int iOffsetX, std::string sText, bool bSelected)
void hit_animation(int iX, int iY, nc_color cColor, char cTile, int iTimeout)
{
WINDOW *w_hit = newwin(1, 1, iY+VIEW_OFFSET_Y, iX+VIEW_OFFSET_X);
if (w_hit == NULL) {
return; //we passed in negative values (semi-expected), so let's not segfault
}
mvwputch(w_hit, 0, 0, cColor, cTile);
wrefresh(w_hit);
+1 -1
View File
@@ -68,7 +68,7 @@ nc_color invert_color(nc_color c);
nc_color red_background(nc_color c);
nc_color rand_color();
char rand_char();
long special_symbol (char sym);
long special_symbol (long sym);
// utility: moves \n's around to fit string breaks within a certain width.
std::string word_rewrap (const std::string &in, int width);
+94 -40
View File
@@ -157,6 +157,30 @@ overmap::overmap(game *g, int x, int y)
open(g);
}
overmap::overmap(overmap const& o)
: zg(o.zg)
, radios(o.radios)
, npcs(o.npcs)
, cities(o.cities)
, roads_out(o.roads_out)
, towns(o.towns)
, loc(o.loc)
, prefix(o.prefix)
, name(o.name)
, layer(NULL)
{
layer = new map_layer[OVERMAP_LAYERS];
for(int z = 0; z < OVERMAP_LAYERS; ++z) {
for(int i = 0; i < OMAPX; ++i) {
for(int j = 0; j < OMAPY; ++j) {
layer[z].terrain[i][j] = o.layer[z].terrain[i][j];
layer[z].visible[i][j] = o.layer[z].visible[i][j];
}
}
layer[z].notes = o.layer[z].notes;
}
}
overmap::~overmap()
{
if (layer) {
@@ -167,28 +191,33 @@ overmap::~overmap()
overmap& overmap::operator=(overmap const& o)
{
loc = o.loc;
prefix = o.prefix;
name = o.name;
cities = o.cities;
roads_out = o.roads_out;
towns = o.towns;
zg = o.zg;
radios = o.radios;
npcs = o.npcs;
zg = o.zg;
radios = o.radios;
npcs = o.npcs;
cities = o.cities;
roads_out = o.roads_out;
towns = o.towns;
loc = o.loc;
prefix = o.prefix;
name = o.name;
layer = new map_layer[OVERMAP_LAYERS];
for(int z = 0; z < OVERMAP_LAYERS; ++z) {
for(int i = 0; i < OMAPX; ++i) {
for(int j = 0; j < OMAPY; ++j) {
layer[z].terrain[i][j] = o.layer[z].terrain[i][j];
layer[z].visible[i][j] = o.layer[z].visible[i][j];
}
}
layer[z].notes = o.layer[z].notes;
}
if (layer) {
delete [] layer;
layer = NULL;
}
return *this;
layer = new map_layer[OVERMAP_LAYERS];
for(int z = 0; z < OVERMAP_LAYERS; ++z) {
for(int i = 0; i < OMAPX; ++i) {
for(int j = 0; j < OMAPY; ++j) {
layer[z].terrain[i][j] = o.layer[z].terrain[i][j];
layer[z].visible[i][j] = o.layer[z].visible[i][j];
}
}
layer[z].notes = o.layer[z].notes;
}
return *this;
}
void overmap::init_layers()
@@ -848,6 +877,23 @@ point overmap::find_closest(point origin, oter_id type, int type_range,
return point(-1, -1);
}
std::vector<point> overmap::find_all(tripoint origin, oter_id type, int type_range,
int &dist, bool must_be_seen)
{
std::vector<point> res;
int max = (dist == 0 ? OMAPX / 2 : dist);
for (dist = 0; dist <= max; dist++) {
for (int x = origin.x - dist; x <= origin.x + dist; x++) {
for (int y = origin.y - dist; y <= origin.y + dist; y++) {
if (ter(x, y, origin.z) >= type && ter(x, y, origin.z) < type + type_range &&
(!must_be_seen || seen(x, y, origin.z)))
res.push_back(point(x, y));
}
}
}
return res;
}
std::vector<point> overmap::find_terrain(std::string term, int cursx, int cursy, int zlevel)
{
std::vector<point> found;
@@ -1698,20 +1744,28 @@ void overmap::build_tunnel(int x, int y, int z, int s, int dir)
bool overmap::build_slimepit(int x, int y, int z, int s)
{
bool requires_sub = false;
for (int n = 1; n <= s; n++) {
for (int i = x - n; i <= x + n; i++) {
for (int j = y - n; j <= y + n; j++) {
if (rng(1, s * 2) >= n)
if (one_in(8)) {
ter(i, j, z) = ot_slimepit_down;
requires_sub = true;
} else
ter(i, j, z) = ot_slimepit;
bool requires_sub = false;
for (int n = 1; n <= s; n++)
{
for (int i = x - n; i <= x + n; i++)
{
for (int j = y - n; j <= y + n; j++)
{
if (rng(1, s * 2) >= n)
{
if (one_in(8))
{
ter(i, j, z) = ot_slimepit_down;
requires_sub = true;
} else {
ter(i, j, z) = ot_slimepit;
}
}
}
}
}
}
}
return requires_sub;
return requires_sub;
}
void overmap::build_mine(int x, int y, int z, int s)
@@ -2215,7 +2269,7 @@ void overmap::place_specials()
point pt(p.x, p.y);
// Skip non-classic specials if we're in classic mode
if (OPTIONS[OPT_CLASSIC_ZOMBIES] && !(special.flags & mfb(OMS_FLAG_CLASSIC))) continue;
if ((placed[i] < special.max_appearances || special.max_appearances <= 0) &&
if ((placed[ omspec_id(i) ] < special.max_appearances || special.max_appearances <= 0) &&
(min == -1 || dist_from_city(pt) >= min) &&
(max == -1 || dist_from_city(pt) <= max) &&
(place.*special.able)(this, p))
@@ -2228,7 +2282,7 @@ void overmap::place_specials()
// Place the MUST HAVE ones first, to try and guarantee that they appear
std::vector<omspec_id> must_place;
for (int i = 0; i < valid.size(); i++) {
if (placed[i] < overmap_specials[ valid[i] ].min_appearances)
if (placed[ valid[i] ] < overmap_specials[ valid[i] ].min_appearances)
must_place.push_back(valid[i]);
}
if (must_place.empty()) {
@@ -2342,7 +2396,7 @@ void overmap::place_special(overmap_special special, tripoint p)
distance = dist;
}
}
make_hiway(p.x, p.y, 0, cities[closest].x, cities[closest].y, ot_road_null);
make_hiway(p.x, p.y, cities[closest].x, cities[closest].y, p.z, ot_road_null);
}
if (special.flags & mfb(OMS_FLAG_PARKING_LOT)) {
@@ -2355,7 +2409,7 @@ void overmap::place_special(overmap_special special, tripoint p)
}
}
ter(p.x, p.y - 1, p.z) = ot_s_lot;
make_hiway(p.x, p.y - 1, 0, cities[closest].x, cities[closest].y, ot_road_null);
make_hiway(p.x, p.y - 1, cities[closest].x, cities[closest].y, p.z, ot_road_null);
}
if (special.flags & mfb(OMS_FLAG_DIRT_LOT)) {
int closest = -1, distance = 999;
@@ -2367,7 +2421,7 @@ void overmap::place_special(overmap_special special, tripoint p)
}
}
ter(p.x, p.y - 1, p.z) = ot_dirtlot;
make_hiway(p.x, p.y - 1, 0, cities[closest].x, cities[closest].y, ot_road_null);
make_hiway(p.x, p.y - 1, cities[closest].x, cities[closest].y, p.z, ot_road_null);
}
// Finally, place monsters if applicable
@@ -2469,7 +2523,7 @@ void overmap::place_radios()
break;
case ot_fema_entrance:
snprintf( message, sizeof(message), "This is FEMA camp %d%d.\
Supplies are limited, please bring supplimental food, water, and bedding.\
Supplies are limited, please bring supplemental food, water, and bedding.\
This is FEMA camp %d%d. A desginated long-term emergency shelter.", i, j, i, j);
radios.push_back(radio_tower(i*2, j*2, rng(80, 200), message));
break;
@@ -2540,7 +2594,7 @@ void overmap::open(game *g)
std::string const terfilename = terrain_filename(loc.x, loc.y);
std::ifstream fin;
char datatype;
int ct, cx, cy, cz, cs, cp, cd;
int cx, cy, cz, cs, cp, cd;
std::string cstr;
city tmp;
std::vector<item> npc_inventory;
+3 -3
View File
@@ -54,6 +54,7 @@ class overmap
{
public:
overmap();
overmap(overmap const&);
overmap(game *g, int x, int y);
~overmap();
@@ -78,6 +79,8 @@ class overmap
// TODO: make this 3d
point find_closest(point origin, oter_id type, int type_range,
int &dist, bool must_be_seen);
std::vector<point> find_all(tripoint origin, oter_id type, int type_range,
int &dist, bool must_be_seen);
std::vector<point> find_terrain(std::string term, int cursx, int cursy, int zlevel);
int closest_city(point p);
point random_house_in_city(int city_id);
@@ -119,9 +122,6 @@ class overmap
bool nullbool;
std::string nullstr;
// no copy constructor
overmap(overmap const&);
// Initialise
void init_layers();
void open(game *g);
+835 -386
View File
File diff suppressed because it is too large Load Diff
+16 -2
View File
@@ -20,6 +20,7 @@ class monster;
class game;
class trap;
class mission;
class profession;
struct special_attack
{
@@ -182,6 +183,7 @@ public:
bool has_addiction(add_type type);
int addiction_level(add_type type);
void cauterize(game *g);
void suffer(game *g);
void vomit(game *g);
@@ -199,6 +201,16 @@ public:
void try_to_sleep(game *g); // '$' command; adds DIS_LYING_DOWN
bool can_sleep(game *g); // Checked each turn during DIS_LYING_DOWN
// helper functions meant to tell inventory display code what kind of visual feedback to give to the user
hint_rating rate_action_use(item *it); //rates usability lower for non-tools (books, etc.)
hint_rating rate_action_wear(item *it);
hint_rating rate_action_eat(item *it);
hint_rating rate_action_read(item *it, game *g);
hint_rating rate_action_takeoff(item *it);
hint_rating rate_action_reload(item *it);
hint_rating rate_action_unload(item *it);
hint_rating rate_action_disassemble(item *it, game *g);
int warmth(body_part bp); // Warmth provided by armor &c
int encumb(body_part bp); // Encumberance from armor &c
int encumb(body_part bp, int &layers, int &armorenc, int &warmth);
@@ -244,6 +256,7 @@ public:
// has_amount works ONLY for quantity.
// has_charges works ONLY for charges.
void use_amount(itype_id it, int quantity, bool use_container = false);
bool use_charges_if_avail(itype_id it, int quantity);// Uses up charges
void use_charges(itype_id it, int quantity);// Uses up charges
bool has_amount(itype_id it, int quantity);
bool has_charges(itype_id it, int quantity);
@@ -251,7 +264,7 @@ public:
int charges_of(itype_id it);
bool has_watertight_container();
bool has_matching_liquid(int it);
bool has_matching_liquid(itype_id it);
bool has_weapon_or_armor(char let); // Has an item with invlet let
bool has_item(char let); // Has an item with invlet let
bool has_item(item *it); // Has a specific item
@@ -273,6 +286,7 @@ public:
std::string name;
bool male;
profession* prof;
bool my_traits[PF_MAX2];
bool my_mutations[PF_MAX2];
int mutation_category_level[NUM_MUTATION_CATEGORIES];
@@ -293,7 +307,7 @@ public:
int cash;
int moves;
int hp_cur[num_hp_parts], hp_max[num_hp_parts];
signed int temp_cur[num_bp], frostbite_timer[num_bp];
signed int temp_cur[num_bp], frostbite_timer[num_bp], temp_conv[num_bp];
void temp_equalizer(body_part bp1, body_part bp2); // Equalizes heat between body parts
std::vector<morale_point> morale;
+10 -5
View File
@@ -28,16 +28,16 @@ enum dis_type {
DI_GLARE, DI_WET,
// Temperature, the order is important (dependant on bodypart.h)
DI_COLD,
DI_COLD_TORSO, DI_COLD_HEAD, DI_COLD_EYES, DI_COLD_MOUTH,
DI_COLD_TORSO, DI_COLD_HEAD, DI_COLD_EYES, DI_COLD_MOUTH,
DI_COLD_ARMS, DI_COLD_HANDS, DI_COLD_LEGS, DI_COLD_FEET,
DI_FROSTBITE,
DI_FROSTBITE_TORSO, DI_FROSTBITE_HEAD, DI_FROSTBITE_EYES, DI_FROSTBITE_MOUTH,
DI_FROSTBITE_ARMS, DI_FROSTBITE_HANDS, DI_FROSTBITE_LEGS, DI_FROSTBITE_FEET,
DI_HOT,
DI_HOT_TORSO, DI_HOT_HEAD, DI_HOT_EYES, DI_HOT_MOUTH,
DI_HOT_TORSO, DI_HOT_HEAD, DI_HOT_EYES, DI_HOT_MOUTH,
DI_HOT_ARMS, DI_HOT_HANDS, DI_HOT_LEGS, DI_HOT_FEET,
DI_BLISTERS,
DI_BLISTERS_TORSO, DI_BLISTERS_HEAD, DI_BLISTERS_EYES, DI_BLISTERS_MOUTH,
DI_BLISTERS_TORSO, DI_BLISTERS_HEAD, DI_BLISTERS_EYES, DI_BLISTERS_MOUTH,
DI_BLISTERS_ARMS, DI_BLISTERS_HANDS, DI_BLISTERS_LEGS, DI_BLISTERS_FEET,
// Diseases
DI_INFECTION,
@@ -96,8 +96,8 @@ struct addiction
enum activity_type {
ACT_NULL = 0,
ACT_RELOAD, ACT_READ, ACT_WAIT, ACT_CRAFT, ACT_DISASSEMBLE, ACT_BUTCHER, ACT_FORAGE, ACT_BUILD,
ACT_VEHICLE, ACT_REFILL_VEHICLE,
ACT_RELOAD, ACT_READ, ACT_WAIT, ACT_CRAFT, ACT_LONGCRAFT,
ACT_DISASSEMBLE, ACT_BUTCHER, ACT_FORAGE, ACT_BUILD, ACT_VEHICLE, ACT_REFILL_VEHICLE,
ACT_TRAIN,
NUM_ACTIVITIES
};
@@ -191,6 +191,7 @@ enum pl_flag {
PF_SPLIT, // Null trait, splits between bad & good
PF_MYOPIC, // Smaller sight radius UNLESS wearing glasses
PF_HYPEROPIC, // With no reading glasses, can't read and takes melee penalty
PF_HEAVYSLEEPER, // Sleeps in, won't wake up to sounds as easily
PF_ASTHMA, // Occasionally needs medicine or suffers effects
PF_BADBACK, // Carries less
@@ -454,6 +455,10 @@ with your choice of karate, judo, aikido, tai chi, or taekwondo."},
Without your glasses, your seeing radius is severely reduced! However, while\n\
wearing glasses this trait has no effect, and you are guaranteed to start\n\
with a pair."},
{"Far-Sighted", -2, 0, 0, "\
Without reading glasses, you are unable to read anything, and take penalities\n\
on melee accuracy and electronics/tailoring crafting. However, you are\n\
guaranteed to start with a pair of reading glasses."},
{"Heavy Sleeper", -1, 0, 0, "\
You're quite the heavy sleeper. Noises are unlikely to wake you up."},
{"Asthmatic", -4, 0, 0, "\
+152
View File
@@ -0,0 +1,152 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include "profession.h"
#include "output.h"
#include "picojson.h"
profession::profession()
{
_id = 0;
_ident = "";
_name = "null";
_description = "null";
_point_cost = 0;
}
profession::profession(unsigned int id, std::string ident, std::string name, std::string description, signed int points)
{
_id = id;
_ident = ident;
_name = name;
_description = description;
_point_cost = points;
}
profmap profession::_all_profs(profession::load_professions());
profmap profession::load_professions()
{
profmap allProfs;
picojson::value profsRaw;
std::ifstream profsFile;
profsFile.open("data/raw/professions.json");
profsFile >> profsRaw;
if (profsRaw.is<picojson::array>())
{
const picojson::array& profs = profsRaw.get<picojson::array>();
unsigned int id = 0;
for (picojson::array::const_iterator aProf = profs.begin(); aProf != profs.end(); ++aProf)
{
++id;
const picojson::object& object = aProf->get<picojson::object>();
std::string ident, name, description;
signed int points;
ident = object.at("ident").get<std::string>();
name = object.at("name").get<std::string>();
description = object.at("description").get<std::string>();
points = static_cast<int>(object.at("points").get<double>());
profession newProfession(id, ident, name, description, points);
const picojson::array& items = object.at("items").get<picojson::array>();
for (picojson::array::const_iterator anItem = items.begin(); anItem != items.end(); ++anItem)
{
newProfession.add_item(anItem->get<std::string>());
}
allProfs[ident] = newProfession;
}
}
else
{
std::cout << "Bad profession file:\n" << profsRaw << std::endl;
exit(1);
}
return allProfs;
}
profession* profession::prof(std::string ident)
{
profmap::iterator prof = _all_profs.find(ident);
if (prof != _all_profs.end())
{
return &(prof->second);
}
else
{
debugmsg("Tried to get invalid profession: %s", ident.c_str());
}
}
profession* profession::generic()
{
return profession::prof("unemployed");
}
bool profession::exists(std::string ident)
{
return _all_profs.find(ident) != _all_profs.end();
}
profmap::const_iterator profession::begin()
{
return _all_profs.begin();
}
profmap::const_iterator profession::end()
{
return _all_profs.end();
}
int profession::count()
{
return _all_profs.size();
}
bool profession::has_initialized()
{
return exists("unemployed");
}
void profession::add_item(std::string item)
{
_starting_items.push_back(item);
}
unsigned int profession::id() const
{
return _id;
}
std::string profession::ident() const
{
return _ident;
}
std::string profession::name() const
{
return _name;
}
std::string profession::description() const
{
return _description;
}
signed int profession::point_cost() const
{
return _point_cost;
}
std::vector<std::string> profession::items() const
{
return _starting_items;
}
+49
View File
@@ -0,0 +1,49 @@
#ifndef _PROFESSION_H_
#define _PROFESSION_H_
#include <string>
#include <vector>
#include <map>
class profession;
typedef std::map<std::string, profession> profmap;
class profession
{
private:
unsigned int _id; // used when we care about precise order, starts at 1
std::string _ident;
std::string _name;
std::string _description;
signed int _point_cost;
std::vector<std::string> _starting_items;
void add_item(std::string item);
public:
//these three aren't meant for external use, but had to be made public regardless
profession();
profession(unsigned int id, std::string ident, std::string name, std::string description, signed int points);
static profmap _all_profs;
static profmap load_professions();
// these should be the only ways used to get at professions
static profession* prof(std::string ident);
static profession* generic(); // points to the generic, default profession
static bool exists(std::string ident);
static profmap::const_iterator begin();
static profmap::const_iterator end();
static int count();
static bool has_initialized();
unsigned int id() const;
std::string ident() const;
std::string name() const;
std::string description() const;
signed int point_cost() const;
std::vector<std::string> items() const;
};
#endif
+21 -20
View File
@@ -33,7 +33,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
if (p.weapon.has_flag(IF_CHARGE)) { // It's a charger gun, so make up a type
// Charges maxes out at 8.
int charges = p.weapon.num_charges();
it_ammo *tmpammo = dynamic_cast<it_ammo*>(itypes[itm_charge_shot]);
it_ammo *tmpammo = dynamic_cast<it_ammo*>(itypes["charge_shot"]);
tmpammo->damage = charges * charges;
tmpammo->pierce = (charges >= 4 ? (charges - 3) * 2.5 : 0);
@@ -116,7 +116,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
int trange = trig_dist(p.posx, p.posy, tarx, tary);
if (trange < int(firing->volume / 3) && firing->ammo != AT_SHOT)
trange = int(firing->volume / 3);
else if (p.has_bionic(bio_targeting)) {
else if (p.has_bionic("bio_targeting")) {
if (trange > LONG_RANGE)
trange = int(trange * .65);
else
@@ -170,24 +170,24 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
}
// Drop a shell casing if appropriate.
itype_id casing_type = itm_null;
itype_id casing_type = "null";
switch(curammo->type) {
case AT_SHOT: casing_type = itm_shot_hull; break;
case AT_9MM: casing_type = itm_9mm_casing; break;
case AT_38: casing_type = itm_38_casing; break;
case AT_40: casing_type = itm_40_casing; break;
case AT_44: casing_type = itm_44_casing; break;
case AT_45: casing_type = itm_45_casing; break;
case AT_57: casing_type = itm_57mm_casing; break;
case AT_46: casing_type = itm_46mm_casing; break;
case AT_762: casing_type = itm_762_casing; break;
case AT_223: casing_type = itm_223_casing; break;
case AT_3006: casing_type = itm_3006_casing; break;
case AT_308: casing_type = itm_308_casing; break;
case AT_40MM: casing_type = itm_40mm_casing; break;
case AT_SHOT: casing_type = "shot_hull"; break;
case AT_9MM: casing_type = "9mm_casing"; break;
case AT_38: casing_type = "38_casing"; break;
case AT_40: casing_type = "40_casing"; break;
case AT_44: casing_type = "44_casing"; break;
case AT_45: casing_type = "45_casing"; break;
case AT_57: casing_type = "57mm_casing"; break;
case AT_46: casing_type = "46mm_casing"; break;
case AT_762: casing_type = "762_casing"; break;
case AT_223: casing_type = "223_casing"; break;
case AT_3006: casing_type = "3006_casing"; break;
case AT_308: casing_type = "308_casing"; break;
case AT_40MM: casing_type = "40mm_casing"; break;
default: /*No casing for other ammo types.*/ break;
}
if (casing_type != itm_null) {
if (casing_type != "null") {
int x = p.posx - 1 + rng(0, 2);
int y = p.posy - 1 + rng(0, 2);
std::vector<item>& items = m.i_at(x, y);
@@ -577,7 +577,7 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
for (int j = 1; j < 46; j++)
mvwputch(w_target, i, j, c_white, ' ');
}
lm.generate(this, center.x, center.y, natural_light_level(), u.active_light());
m.build_map_cache(this);
m.draw(this, w_terrain, center);
// Draw the Monsters
for (int i = 0; i < z.size(); i++) {
@@ -681,6 +681,7 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
} else if (ch == '0') {
x = u.posx;
y = u.posy;
ret.clear();
} else if (ch == '*')
snap_to_target = !snap_to_target;
else if (ch == KEY_ESCAPE || ch == 'q') { // return empty vector (cancel)
@@ -782,7 +783,7 @@ void make_gun_sound_effect(game *g, player &p, bool burst, item* weapon)
g->sound(p.posx, p.posy, 8, "Fzzt!");
else if (weapon->curammo->type == AT_40MM)
g->sound(p.posx, p.posy, 8, "Thunk!");
else if (weapon->curammo->type == AT_GAS)
else if (weapon->curammo->type == AT_GAS || weapon->curammo->type == AT_66MM)
g->sound(p.posx, p.posy, 4, "Fwoosh!");
else if (weapon->curammo->type != AT_BOLT &&
weapon->curammo->type != AT_ARROW)
@@ -795,7 +796,7 @@ int calculate_range(player &p, int tarx, int tary)
it_gun* firing = dynamic_cast<it_gun*>(p.weapon.type);
if (trange < int(firing->volume / 3) && firing->ammo != AT_SHOT)
trange = int(firing->volume / 3);
else if (p.has_bionic(bio_targeting)) {
else if (p.has_bionic("bio_targeting")) {
if (trange > LONG_RANGE)
trange = int(trange * .65);
else
+3 -17
View File
@@ -1,29 +1,15 @@
#include "setvector.h"
void setvector(std::vector<itype_id> &vec, ... )
void setvector(std::vector<int> &vec, ... )
{
va_list ap;
va_start(ap, vec);
itype_id tmp;
while ((tmp = (itype_id)va_arg(ap, int)))
int tmp;
while ((tmp = (int)va_arg(ap, int)))
vec.push_back(tmp);
va_end(ap);
}
void setvector(std::vector<component> &vec, ... )
{
va_list ap;
va_start(ap, vec);
itype_id it_tmp;
int n_tmp;
while ((it_tmp = (itype_id)va_arg(ap, int))) {
n_tmp = (int)va_arg(ap, int);
component tmp(it_tmp, n_tmp);
vec.push_back(tmp);
}
va_end(ap);
}
void setvector(std::vector<mon_id> &vec, ... )
{
va_list ap;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "crafting.h"
#include "mission.h"
void setvector(std::vector <itype_id> &vec, ... );
void setvector(std::vector <component> &vec, ... );
// void setvector(std::vector <component> &vec, ... );
void setvector(std::vector <mon_id> &vec, ... );
void setvector(std::vector <items_location_and_chance> &vec, ... );
void setvector(std::vector <mission_origin> &vec, ... );
+10 -8
View File
@@ -5,8 +5,8 @@
static const int sx[4] = { 1, -1, -1, 1 };
static const int sy[4] = { 1, 1, -1, -1 };
tileray::tileray (): deltax(0), deltay(0), direction(0), leftover (0),
last_dx(0), last_dy(0), infinite (false), steps(0)
tileray::tileray (): deltax(0), deltay(0), leftover(0), direction(0),
last_dx(0), last_dy(0), steps(0), infinite (false)
{
}
@@ -22,11 +22,9 @@ tileray::tileray (int adir): direction (adir)
void tileray::init (int adx, int ady)
{
leftover = 0;
last_dx = 0;
last_dy = 0;
deltax = adx;
deltay = ady;
leftover = 0;
if (!adx && !ady)
direction = 0;
else{
@@ -34,12 +32,16 @@ void tileray::init (int adx, int ady)
if (direction <0)
direction += 360;
}
infinite = false;
last_dx = 0;
last_dy = 0;
steps = 0;
infinite = false;
}
void tileray::init (int adir)
{
deltax = 0;
deltay = 0;
leftover = 0;
direction = adir;
if (direction <0)
@@ -50,8 +52,8 @@ void tileray::init (int adir)
last_dy = 0;
deltax = abs((int) (cos ((float) direction * M_PI / 180.0) * 100));
deltay = abs((int) (sin ((float) direction * M_PI / 180.0) * 100));
infinite = true;
steps = 0;
infinite = true;
}
int tileray::dx ()
@@ -83,7 +85,7 @@ int tileray::dir4 ()
return 0;
}
char tileray::dir_symbol (char sym)
long tileray::dir_symbol (long sym)
{
switch (sym)
{
+1 -1
View File
@@ -37,7 +37,7 @@ public:
int dy (); // return dy of last advance (-1 to 1)
int dir (); // return direction of ray (degrees)
int dir4 (); // return 4-sided direction (0 = east, 1 = south, 2 = west, 3 = north)
char dir_symbol (char sym); // convert certain symbols from north-facing variant into current dir facing
long dir_symbol (long sym); // convert certain symbols from north-facing variant into current dir facing
int ortho_dx (int od); // return dx for point at "od" distance in orthogonal direction
int ortho_dy (int od); // return dy for point at "od" distance in orthogonal direction
bool mostly_vertical (); // return if ray is mostly vertical
+7 -9
View File
@@ -112,7 +112,7 @@ struct trapfuncm {
struct trap {
int id;
char sym;
long sym;
nc_color color;
std::string name;
@@ -128,10 +128,12 @@ struct trap {
// Type of trap
bool is_benign();
trap(int pid, char psym, nc_color pcolor, std::string pname,
trap(int pid, std::string string_id, std::string pname, nc_color pcolor, char psym,
int pvisibility, int pavoidance, int pdifficulty,
void (trapfunc::*pact)(game *, int x, int y),
void (trapfuncm::*pactm)(game *, monster *, int x, int y), ...) {
void (trapfuncm::*pactm)(game *, monster *, int x, int y),
std::vector<std::string> keys) {
//string_id is ignored at the moment, will later replace the id
id = pid;
sym = psym;
color = pcolor;
@@ -141,12 +143,8 @@ struct trap {
difficulty = pdifficulty;
act = pact;
actm = pactm;
va_list ap;
va_start(ap, pactm);
itype_id tmp;
while ((tmp = (itype_id)va_arg(ap, int)))
components.push_back(tmp);
va_end(ap);
components.insert(components.end(), keys.begin(), keys.end());
};
};
+195 -126
View File
@@ -1,172 +1,241 @@
#include <vector>
#include "game.h"
void game::init_traps()
{
int id = -1;
#define TRAP(name, sym, color, visibility, avoidance, difficulty, action, ...) \
id++;\
traps.push_back(new trap(id, sym, color, name, visibility, avoidance,\
difficulty, action, __VA_ARGS__));
TRAP("none", '?', c_white, 20, 0, 0, &trapfunc::none, &trapfuncm::none,
NULL);
int id = -1;
// Arguments for new trap (in order):
// id, Trap_Key, Name, Symbol, Color, Visibility, Avoidance,
// Difficulty, Action on Player, Action on Monster, Keys for Items to be dropped
id++;
std::vector<std::string> keys;
traps.push_back(new trap(id, "NONE", "none", c_white, '?', 20, 0,
0, &trapfunc::none, &trapfuncm::none, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("bubblewrap", '_', c_ltcyan, 0, 8, 0,
&trapfunc::bubble, &trapfuncm::bubble,
itm_bubblewrap, NULL);
// Name Symbol Colour Vis Avd Diff
TRAP("cot", '#', c_green, 0, 0, 0,
&trapfunc::none, &trapfuncm::cot,
itm_cot, NULL);
keys.clear();
id++;
keys.push_back("bubblewrap");
traps.push_back(new trap(id, "BUBBLEWRAP", "bubblewrap", c_ltcyan, '_', 0, 8,
0, &trapfunc::bubble, &trapfuncm::bubble, keys));;
// Name Symbol Colour Vis Avd Diff
TRAP("brazier", '#', c_red, 0, 0, 0,
&trapfunc::none, &trapfuncm::none,
itm_brazier, NULL);
keys.clear();
id++;
keys.push_back("cot");
traps.push_back(new trap(id, "COT", "cot", c_green, '#', 0, 0,
0, &trapfunc::none, &trapfuncm::cot, keys));;
// Name Symbol Colour Vis Avd Diff
TRAP("roll mat", '#', c_blue, 0, 0, 0,
&trapfunc::none, &trapfuncm::none,
itm_rollmat, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("bear trap", '^', c_blue, 2, 7, 3,
&trapfunc::beartrap, &trapfuncm::beartrap,
itm_beartrap, NULL);
keys.clear();
id++;
keys.push_back("brazier");
traps.push_back(new trap(id, "BRAZIER", "brazier", c_red, '#', 0, 0,
0, &trapfunc::none, &trapfuncm::none, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("buried bear trap", '^', c_blue, 9, 8, 4,
&trapfunc::beartrap, &trapfuncm::beartrap,
itm_beartrap, NULL);
keys.clear();
id++;
keys.push_back("rollmat");
traps.push_back(new trap(id, "ROLLMAT", "roll mat", c_blue, '#', 0, 0,
0, &trapfunc::none, &trapfuncm::none, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("rabbit snare", '\\', c_brown, 5, 10, 2,
&trapfunc::snare, &trapfuncm::snare,
itm_stick, itm_string_36, NULL);
keys.clear();
id++;
keys.push_back("beartrap");
traps.push_back(new trap(id, "BEARTRAP", "bear trap", c_blue, '^', 2, 7,
3, &trapfunc::beartrap, &trapfuncm::beartrap, keys));;
TRAP("spiked board", '_', c_ltgray, 1, 6, 0,
&trapfunc::board, &trapfuncm::board,
itm_board_trap, NULL);
keys.clear();
id++;
keys.push_back("beartrap");
traps.push_back(new trap(id, "BEARTRAP_BURIED", "buried bear trap", c_blue, '^', 9, 8,
4, &trapfunc::beartrap, &trapfuncm::beartrap, keys));;
TRAP("tripwire", '^', c_ltred, 6, 4, 3,
&trapfunc::tripwire, &trapfuncm::tripwire,
itm_string_36, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("crossbow trap", '^', c_green, 5, 4, 5,
&trapfunc::crossbow, &trapfuncm::crossbow,
itm_string_36, itm_crossbow, NULL);
keys.clear();
id++;
keys.push_back("stick");
keys.push_back("string_36");
traps.push_back(new trap(id, "SNARE", "rabbit snare", c_brown, '\\', 5, 10,
2, &trapfunc::snare, &trapfuncm::snare, keys));;
TRAP("shotgun trap", '^', c_red, 4, 5, 6,// 2 shots
&trapfunc::shotgun, &trapfuncm::shotgun,
itm_string_36, itm_shotgun_sawn, NULL);
keys.clear();
id++;
keys.push_back("board_trap");
traps.push_back(new trap(id, "NAILBOARD", "spiked board", c_ltgray, '_', 1, 6,
0, &trapfunc::board, &trapfuncm::board, keys));;
TRAP("shotgun trap", '^', c_red, 4, 5, 6,// 1 shot
&trapfunc::shotgun, &trapfuncm::shotgun,
itm_string_36, itm_shotgun_sawn, NULL);
keys.clear();
id++;
keys.push_back("string_36");
traps.push_back(new trap(id, "TRIPWIRE", "tripwire", c_ltred, '^', 6, 4,
3, &trapfunc::tripwire, &trapfuncm::tripwire, keys));;
TRAP("spinning blade engine", '_', c_ltred, 0, 0, 2,
&trapfunc::none, &trapfuncm::none,
itm_motor, itm_machete, itm_machete, NULL);
keys.clear();
id++;
keys.push_back("string_36");
keys.push_back("crossbow");
traps.push_back(new trap(id, "CROSSBOW_TRAP", "crossbow trap", c_green, '^', 5, 4,
5, &trapfunc::crossbow, &trapfuncm::crossbow, keys));;
TRAP("spinning blade", '\\', c_cyan, 0, 4, 99,
&trapfunc::blade, &trapfuncm::blade,
NULL);
keys.clear();
id++;
keys.push_back("string_36");
keys.push_back("shotgun_sawn");
traps.push_back(new trap(id, "SHOTGUN_2", "shotgun trap", c_red, '^', 4, 5,
6, &trapfunc::shotgun, &trapfuncm::shotgun, keys));;
TRAP("light snare trap", '^', c_brown, 5, 10, 2,
&trapfunc::snare_light, &trapfuncm::snare_light,
itm_light_snare_kit, NULL);
keys.clear();
id++;
keys.push_back("string_36");
keys.push_back("shotgun_sawn");
traps.push_back(new trap(id, "SHOTGUN_1", "shotgun trap", c_red, '^', 4, 5,
6, &trapfunc::shotgun, &trapfuncm::shotgun, keys));;
TRAP("heavy snare trap", '^', c_brown, 3, 10, 4,
&trapfunc::snare_heavy, &trapfuncm::snare_heavy,
itm_heavy_snare_kit, NULL);
keys.clear();
id++;
keys.push_back("motor");
keys.push_back("blade");
keys.push_back("blade");
traps.push_back(new trap(id, "ENGINE", "spinning blade engine", c_ltred, '_', 0, 0,
2, &trapfunc::none, &trapfuncm::none, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("land mine", '^', c_red, 1, 14, 10,
&trapfunc::landmine, &trapfuncm::landmine,
itm_landmine, NULL);
keys.clear();
id++;
keys.push_back("null");
traps.push_back(new trap(id, "BLADE", "spinning blade", c_cyan, '\\', 0, 4,
99, &trapfunc::blade, &trapfuncm::blade, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("buried land mine", '_', c_red, 10, 14, 10,
&trapfunc::landmine, &trapfuncm::landmine,
itm_landmine, NULL);
keys.clear();
id++;
keys.push_back("light_snare_kit");
traps.push_back(new trap(id, "LIGHT_SNARE", "light snare trap", c_brown, '^', 5, 10,
2, &trapfunc::snare_light, &trapfuncm::snare_light, keys));
// Name Symbol Color Vis Avd Diff
TRAP("teleport pad", '_', c_magenta, 0, 15, 20,
&trapfunc::telepad, &trapfuncm::telepad,
itm_null, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("goo pit", '_', c_dkgray, 0, 15, 15,
&trapfunc::goo, &trapfuncm::goo,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("heavy_snare_kit");
traps.push_back(new trap(id, "HEAVY_SNARE", "heavy snare trap", c_brown, '^', 3, 10,
4, &trapfunc::snare_heavy, &trapfuncm::snare_heavy, keys));
// Name Symbol Color Vis Avd Diff
TRAP("dissector", '7', c_cyan, 2, 20, 99,
&trapfunc::dissector, &trapfuncm::dissector,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("landmine");
traps.push_back(new trap(id, "LANDMINE", "land mine", c_red, '^', 1, 14,
10, &trapfunc::landmine, &trapfuncm::landmine, keys));;
// Name Symbol Color Vis Avd Diff
TRAP("sinkhole", '_', c_brown, 10, 14, 99,
&trapfunc::sinkhole, &trapfuncm::sinkhole,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("landmine");
traps.push_back(new trap(id, "LANDMINE_BURIED", "buried land mine", c_red, '_', 10, 14,
10, &trapfunc::landmine, &trapfuncm::landmine, keys));;
TRAP("pit", '0', c_brown, 0, 8, 99,
&trapfunc::pit, &trapfuncm::pit,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null"); //WHY????? Why does this drop a null? T_T
traps.push_back(new trap(id, "TELEPAD", "teleport pad", c_magenta, '_', 0, 15,
20, &trapfunc::telepad, &trapfuncm::telepad, keys));;
TRAP("spiked pit", '0', c_blue, 0, 8, 99,
&trapfunc::pit_spikes, &trapfuncm::pit_spikes,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null"); //Still why????
traps.push_back(new trap(id, "GOO", "goo pit", c_dkgray, '_', 0, 15,
15, &trapfunc::goo, &trapfuncm::goo, keys));;
TRAP("lava", '~', c_red, 0, 99, 99,
&trapfunc::lava, &trapfuncm::lava,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null"); //Whatever, I don't even care.
traps.push_back(new trap(id, "DISSECTOR", "dissector", c_cyan, '7', 2, 20,
99, &trapfunc::dissector, &trapfuncm::dissector, keys));;
keys.clear();
id++;
keys.push_back("null"); //...
traps.push_back(new trap(id, "SINKHOLE", "sinkhole", c_brown, '_', 10, 14,
99, &trapfunc::sinkhole, &trapfuncm::sinkhole, keys));;
keys.clear();
id++;
keys.push_back("null"); //T_T
traps.push_back(new trap(id, "PIT", "pit", c_brown, '0', 0, 8,
99, &trapfunc::pit, &trapfuncm::pit, keys));;
keys.clear();
id++;
keys.push_back("null"); //o_o
traps.push_back(new trap(id, "SPIKE_PIT", "spiked pit", c_blue, '0', 0, 8,
99, &trapfunc::pit_spikes, &trapfuncm::pit_spikes, keys));;
keys.clear();
id++;
keys.push_back("null");
traps.push_back(new trap(id, "", "lava", c_red, '~', 0, 99,
99, &trapfunc::lava, &trapfuncm::lava, keys));;
keys.clear();
id++;
keys.push_back("null");
// The '%' symbol makes the portal cycle through ~*0&
// Name Symbol Color Vis Avd Diff
TRAP("shimmering portal", '%', c_magenta, 0, 30, 99,
&trapfunc::portal, &trapfuncm::portal,
itm_null, NULL);
traps.push_back(new trap(id, "", "shimmering portal", c_magenta, '%', 0, 30,
99, &trapfunc::portal, &trapfuncm::portal, keys));;
TRAP("ledge", ' ', c_black, 0, 99, 99,
&trapfunc::ledge, &trapfuncm::ledge,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null");
traps.push_back(new trap(id, "", "ledge", c_black, ' ', 0, 99,
99, &trapfunc::ledge, &trapfuncm::ledge, keys));;
TRAP("boobytrap", '^', c_ltcyan, 5, 4, 7,
&trapfunc::boobytrap, &trapfuncm::boobytrap,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null");
traps.push_back(new trap(id, "", "boobytrap", c_ltcyan, '^', 5, 4,
7, &trapfunc::boobytrap, &trapfuncm::boobytrap, keys));;
TRAP("raised tile", '^', c_ltgray, 9, 20, 99,
&trapfunc::temple_flood,&trapfuncm::none,
itm_null, NULL);
keys.clear();
id++;
keys.push_back("null");
traps.push_back(new trap(id, "", "raised tile", c_ltgray, '^', 9, 20,
99, &trapfunc::temple_flood,&trapfuncm::none, keys));;
keys.clear();
id++;
keys.push_back("null");
// Toggles through states of RGB walls
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::temple_toggle, &trapfuncm::none,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::temple_toggle, &trapfuncm::none, keys));;
keys.clear();
id++;
keys.push_back("null");
// Glow attack
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::glow, &trapfuncm::glow,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::glow, &trapfuncm::glow, keys));;
keys.clear();
id++;
keys.push_back("null");
// Hum attack
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::hum, &trapfuncm::hum,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::hum, &trapfuncm::hum, keys));;
keys.clear();
id++;
keys.push_back("null");
// Shadow spawn
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::shadow, &trapfuncm::none,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::shadow, &trapfuncm::none, keys));;
keys.clear();
id++;
keys.push_back("null");
// Drain attack
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::drain, &trapfuncm::drain,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::drain, &trapfuncm::drain, keys));;
keys.clear();
id++;
keys.push_back("null");
// Snake spawn / hisssss
TRAP("", '^', c_white, 99, 99, 99,
&trapfunc::snake, &trapfuncm::snake,
itm_null, NULL);
traps.push_back(new trap(id, "", "", c_white, '^', 99, 99,
99, &trapfunc::snake, &trapfuncm::snake, keys));;
}
+46 -44
View File
@@ -28,7 +28,7 @@ void trapfunc::beartrap(game *g, int x, int y)
g->u.hit(g, bp_legs, rng(0, 1), 10, 16);
g->u.add_disease(DI_BEARTRAP, -1, g);
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_beartrap], g->turn);
g->m.spawn_item(x, y, g->itypes["beartrap"], g->turn);
}
void trapfuncm::beartrap(game *g, monster *z, int x, int y)
@@ -36,14 +36,13 @@ void trapfuncm::beartrap(game *g, monster *z, int x, int y)
g->sound(x, y, 8, "SNAP!");
if (z->hurt(35)) {
g->kill_mon(g->mon_at(x, y));
g->m.add_item(x, y, g->itypes[itm_beartrap], 0);
g->m.spawn_item(x, y, g->itypes["beartrap"], 0);
} else {
z->moves = 0;
z->add_effect(ME_BEARTRAP, rng(8, 15));
}
g->m.tr_at(x, y) = tr_null;
item beartrap(g->itypes[itm_beartrap], 0);
item beartrap(g->itypes["beartrap"], 0);
z->add_item(beartrap);
}
@@ -120,10 +119,10 @@ void trapfunc::crossbow(game *g, int x, int y)
} else
g->add_msg("You dodge the shot!");
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_crossbow], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["crossbow"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
if (add_bolt)
g->m.add_item(x, y, g->itypes[itm_bolt_steel], 0);
g->m.spawn_item(x, y, g->itypes["bolt_steel"], 0);
}
void trapfuncm::crossbow(game *g, monster *z, int x, int y)
@@ -140,10 +139,10 @@ void trapfuncm::crossbow(game *g, monster *z, int x, int y)
} else if (seen)
g->add_msg("A bolt shoots out, but misses the %s.", z->name().c_str());
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_crossbow], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["crossbow"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
if (add_bolt)
g->m.add_item(x, y, g->itypes[itm_bolt_steel], 0);
g->m.spawn_item(x, y, g->itypes["bolt_steel"], 0);
}
void trapfunc::shotgun(game *g, int x, int y)
@@ -172,8 +171,8 @@ void trapfunc::shotgun(game *g, int x, int y)
} else
g->add_msg("You dodge the shot!");
if (shots == 2 || g->m.tr_at(x, y) == tr_shotgun_1) {
g->m.add_item(x, y, g->itypes[itm_shotgun_sawn], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["shotgun_sawn"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
g->m.tr_at(x, y) = tr_null;
} else
g->m.tr_at(x, y) = tr_shotgun_1;
@@ -200,8 +199,10 @@ void trapfuncm::shotgun(game *g, monster *z, int x, int y)
g->kill_mon(g->mon_at(x, y));
if (shots == 2 || g->m.tr_at(x, y) == tr_shotgun_1) {
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_shotgun_sawn], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["shotgun_sawn"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
g->m.spawn_item(x, y, g->itypes["shotgun_sawn"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
} else
g->m.tr_at(x, y) = tr_shotgun_1;
}
@@ -234,8 +235,8 @@ void trapfunc::snare_light(game *g, int x, int y)
g->add_msg("A snare closes on your leg.");
g->u.add_disease(DI_LIGHTSNARE, rng(10, 20), g);
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_string_36], 0);
g->m.add_item(x, y, g->itypes[itm_snare_trigger], 0);
g->m.spawn_item(x, y, g->itypes["string_36"], 0);
g->m.spawn_item(x, y, g->itypes["snare_trigger"], 0);
}
void trapfuncm::snare_light(game *g, monster *z, int x, int y)
@@ -280,8 +281,8 @@ void trapfuncm::snare_light(game *g, monster *z, int x, int y)
break;
}
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_string_36], 0);
g->m.add_item(x, y, g->itypes[itm_snare_trigger], 0);
g->m.spawn_item(x, y, g->itypes["string_36"], 0);
g->m.spawn_item(x, y, g->itypes["snare_trigger"], 0);
}
void trapfunc::snare_heavy(game *g, int x, int y)
@@ -293,8 +294,8 @@ void trapfunc::snare_heavy(game *g, int x, int y)
g->u.hit(g, bp_legs, side, 15, 20);
g->u.add_disease(DI_HEAVYSNARE, rng(20, 30), g);
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_rope_6], 0);
g->m.add_item(x, y, g->itypes[itm_snare_trigger], 0);
g->m.spawn_item(x, y, g->itypes["rope_6"], 0);
g->m.spawn_item(x, y, g->itypes["snare_trigger"], 0);
}
void trapfuncm::snare_heavy(game *g, monster *z, int x, int y)
@@ -350,8 +351,8 @@ void trapfuncm::snare_heavy(game *g, monster *z, int x, int y)
break;
}
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_snare_trigger], 0);
g->m.add_item(x, y, g->itypes[itm_rope_6], 0);
g->m.spawn_item(x, y, g->itypes["snare_trigger"], 0);
g->m.spawn_item(x, y, g->itypes["rope_6"], 0);
}
void trapfunc::landmine(game *g, int x, int y)
@@ -530,11 +531,12 @@ void trapfunc::pit_spikes(game *g, int x, int y)
g->u.hit(g, hit, side, 0, damage);
if (one_in(4)) {
g->add_msg("The spears break!");
g->m.ter(x, y) = t_pit;
g->m.ter_set(x, y, t_pit);
g->m.tr_at(x, y) = tr_pit;
for (int i = 0; i < 4; i++) { // 4 spears to a pit
if (one_in(3))
g->m.add_item(x, y, g->itypes[itm_spear_wood], g->turn);
g->m.spawn_item(x, y, g->itypes["spear_wood"], g->turn);
g->m.spawn_item(x, y, g->itypes["spear_wood"], g->turn);
}
}
}
@@ -555,11 +557,11 @@ void trapfuncm::pit_spikes(game *g, monster *z, int x, int y)
if (one_in(4)) {
if (sees)
g->add_msg("The spears break!");
g->m.ter(x, y) = t_pit;
g->m.ter_set(x, y, t_pit);
g->m.tr_at(x, y) = tr_pit;
for (int i = 0; i < 4; i++) { // 4 spears to a pit
if (one_in(3))
g->m.add_item(x, y, g->itypes[itm_spear_wood], g->turn);
g->m.spawn_item(x, y, g->itypes["spear_wood"], g->turn);
}
}
}
@@ -601,8 +603,8 @@ void trapfuncm::lava(game *g, monster *z, int x, int y)
void trapfunc::sinkhole(game *g, int x, int y)
{
g->add_msg("You step into a sinkhole, and start to sink down!");
if (g->u.has_amount(itm_rope_30, 1) &&
query_yn("Throw your rope to try to catch soemthing?")) {
if (g->u.has_amount("rope_30", 1) &&
query_yn("Throw your rope to try to catch something?")) {
int throwroll = rng(g->u.skillLevel("throw"),
g->u.skillLevel("throw") + g->u.str_cur + g->u.dex_cur);
if (throwroll >= 12) {
@@ -619,9 +621,9 @@ void trapfunc::sinkhole(game *g, int x, int y)
}
if (safe.size() == 0) {
g->add_msg("There's nowhere to pull yourself to, and you sink!");
g->u.use_amount(itm_rope_30, 1);
g->m.add_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes[itm_rope_30], g->turn);
g->u.use_amount("rope_30", 1);
g->m.spawn_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes["rope_30"], g->turn);
g->m.tr_at(g->u.posx, g->u.posy) = tr_pit;
g->vertical_move(-1, true);
} else {
@@ -635,17 +637,17 @@ void trapfunc::sinkhole(game *g, int x, int y)
} else {
g->add_msg("You're not strong enough to pull yourself out...");
g->u.moves -= 100;
g->u.use_amount(itm_rope_30, 1);
g->m.add_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes[itm_rope_30], g->turn);
g->u.use_amount("rope_30", 1);
g->m.spawn_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes["rope_30"], g->turn);
g->vertical_move(-1, true);
}
} else {
g->add_msg("Your throw misses completely, and you sink!");
if (one_in((g->u.str_cur + g->u.dex_cur) / 3)) {
g->u.use_amount(itm_rope_30, 1);
g->m.add_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes[itm_rope_30], g->turn);
g->u.use_amount("rope_30", 1);
g->m.spawn_item(g->u.posx + rng(-1, 1), g->u.posy + rng(-1, 1),
g->itypes["rope_30"], g->turn);
}
g->m.tr_at(g->u.posx, g->u.posy) = tr_pit;
g->vertical_move(-1, true);
@@ -689,23 +691,23 @@ void trapfunc::temple_toggle(game *g, int x, int y)
switch (type) {
case t_floor_red:
if (g->m.ter(i, j) == t_rock_green)
g->m.ter(i, j) = t_floor_green;
g->m.ter_set(i, j, t_floor_green);
else if (g->m.ter(i, j) == t_floor_green)
g->m.ter(i, j) = t_rock_green;
g->m.ter_set(i, j, t_rock_green);
break;
case t_floor_green:
if (g->m.ter(i, j) == t_rock_blue)
g->m.ter(i, j) = t_floor_blue;
g->m.ter_set(i, j, t_floor_blue);
else if (g->m.ter(i, j) == t_floor_blue)
g->m.ter(i, j) = t_rock_blue;
g->m.ter_set(i, j, t_rock_blue);
break;
case t_floor_blue:
if (g->m.ter(i, j) == t_rock_red)
g->m.ter(i, j) = t_floor_red;
g->m.ter_set(i, j, t_floor_red);
else if (g->m.ter(i, j) == t_floor_red)
g->m.ter(i, j) = t_rock_red;
g->m.ter_set(i, j, t_rock_red);
break;
}
@@ -841,7 +843,7 @@ void trapfuncm::snake(game *g, monster *z, int x, int y)
bool trap::is_benign()
{
if (id == tr_rollmat || id == tr_cot)
if (id == tr_rollmat || id == tr_cot || id == tr_brazier)
return true;
else
return false;
+7 -7
View File
@@ -30,7 +30,7 @@ bool tutorial_game::init(game *g)
g->cur_om.make_tutorial();
g->cur_om.save();
g->u.toggle_trait(PF_QUICK);
g->u.inv.push_back(item(g->itypes[itm_lighter], 0, 'e'));
g->u.inv.push_back(item(g->itypes["lighter"], 0, 'e'));
g->u.skillLevel("gun").level(5);
g->u.skillLevel("melee").level(5);
// Init the starting map at g location.
@@ -62,7 +62,7 @@ void tutorial_game::per_turn(game *g)
add_message(g, LESSON_INTRO);
if (g->light_level() == 1) {
if (g->u.has_amount(itm_flashlight, 1))
if (g->u.has_amount("flashlight", 1))
add_message(g, LESSON_DARK);
else
add_message(g, LESSON_DARK_NO_FLASH);
@@ -76,7 +76,7 @@ void tutorial_game::per_turn(game *g)
if (!tutorials_seen[LESSON_BUTCHER]) {
for (int i = 0; i < g->m.i_at(g->u.posx, g->u.posy).size(); i++) {
if (g->m.i_at(g->u.posx, g->u.posy)[i].type->id == itm_corpse) {
if (g->m.i_at(g->u.posx, g->u.posy)[i].type->id == "corpse") {
add_message(g, LESSON_BUTCHER);
i = g->m.i_at(g->u.posx, g->u.posy).size();
}
@@ -140,7 +140,7 @@ void tutorial_game::post_action(game *g, action_id act)
break;
case ACTION_USE:
if (g->u.has_amount(itm_grenade_act, 1))
if (g->u.has_amount("grenade_act", 1))
add_message(g, LESSON_ACT_GRENADE);
for (int x = g->u.posx - 1; x <= g->u.posx + 1; x++) {
for (int y = g->u.posy - 1; y <= g->u.posy + 1; y++) {
@@ -151,11 +151,11 @@ void tutorial_game::post_action(game *g, action_id act)
break;
case ACTION_EAT:
if (g->u.last_item == itm_codeine)
if (g->u.last_item == "codeine")
add_message(g, LESSON_TOOK_PAINKILLER);
else if (g->u.last_item == itm_cig)
else if (g->u.last_item == "cig")
add_message(g, LESSON_TOOK_CIG);
else if (g->u.last_item == itm_water)
else if (g->u.last_item == "water")
add_message(g, LESSON_DRANK_WATER);
break;
+17 -17
View File
@@ -69,15 +69,15 @@ void veh_interact::exec (game *gm, vehicle *v, int x, int y)
crafting_inv = gm->crafting_inventory();
int charges = ((it_tool *) g->itypes[itm_welder])->charges_per_use;
has_wrench = crafting_inv.has_amount(itm_wrench, 1) ||
crafting_inv.has_amount(itm_toolset, 1);
has_hacksaw = crafting_inv.has_amount(itm_hacksaw, 1) ||
crafting_inv.has_amount(itm_toolset, 1);
has_welder = (crafting_inv.has_amount(itm_welder, 1) &&
crafting_inv.has_charges(itm_welder, charges)) ||
(crafting_inv.has_amount(itm_toolset, 1) &&
crafting_inv.has_charges(itm_toolset, charges/5));
int charges = ((it_tool *) g->itypes["welder"])->charges_per_use;
has_wrench = crafting_inv.has_amount("wrench", 1) ||
crafting_inv.has_amount("toolset", 1);
has_hacksaw = crafting_inv.has_amount("hacksaw", 1) ||
crafting_inv.has_amount("toolset", 1);
has_welder = (crafting_inv.has_amount("welder", 1) &&
crafting_inv.has_charges("welder", charges)) ||
(crafting_inv.has_amount("toolset", 1) &&
crafting_inv.has_charges("toolset", charges/5));
display_stats ();
display_veh ();
@@ -511,7 +511,7 @@ void veh_interact::display_veh ()
for (int ep = 0; ep < veh->external_parts.size(); ep++)
{
int p = veh->external_parts[ep];
char sym = veh->part_sym (p);
long sym = veh->part_sym (p);
nc_color col = veh->part_color (p);
int y = -(veh->parts[p].mount_dx + ddx);
int x = veh->parts[p].mount_dy + ddy;
@@ -674,7 +674,7 @@ item consume_vpart_item (game *g, vpart_id vpid){
if(candidates[i].in_inventory){
if (candidates[i].index == -1)
options.push_back(candidates[i].vpart_item.tname() + " (wielded)");
else
else
options.push_back(candidates[i].vpart_item.tname());
}
else { //nearby.
@@ -719,7 +719,7 @@ void complete_vehicle (game *g)
int dy = g->u.activity.values[5];
int part = g->u.activity.values[6];
std::vector<component> tools;
int welder_charges = ((it_tool *) g->itypes[itm_welder])->charges_per_use;
int welder_charges = ((it_tool *) g->itypes["welder"])->charges_per_use;
itype_id itm;
int partnum;
item used_item;
@@ -735,8 +735,8 @@ void complete_vehicle (game *g)
debugmsg ("complete_vehicle install part fails dx=%d dy=%d id=%d", dx, dy, part);
used_item = consume_vpart_item (g, (vpart_id) part);
veh->get_part_properties_from_item(g, partnum, used_item); //transfer damage, etc.
tools.push_back(component(itm_welder, welder_charges));
tools.push_back(component(itm_toolset, welder_charges/5));
tools.push_back(component("welder", welder_charges));
tools.push_back(component("toolset", welder_charges/5));
g->consume_tools(tools);
g->add_msg ("You install a %s into the %s.",
vpart_list[part].name, veh->name.c_str());
@@ -746,14 +746,14 @@ void complete_vehicle (game *g)
if (veh->parts[part].hp <= 0)
{
used_item = consume_vpart_item (g, veh->parts[part].id);
tools.push_back(component(itm_wrench, 1));
tools.push_back(component("wrench", 1));
g->consume_tools(tools);
tools.clear();
dd = 0;
veh->insides_dirty = true;
}
tools.push_back(component(itm_welder, welder_charges));
tools.push_back(component(itm_toolset, welder_charges/5));
tools.push_back(component("welder", welder_charges));
tools.push_back(component("toolset", welder_charges/5));
g->consume_tools(tools);
veh->parts[part].hp = veh->part_info(part).durability;
g->add_msg ("You repair the %s's %s.",
+78 -62
View File
@@ -32,6 +32,9 @@ enum vpart_id
vp_board_u,
vp_board_n,
vp_board_b,
vp_isle_h2,
vp_isle_v2,
vp_floor_trunk,
vp_roof,
vp_door,
vp_door_o,
@@ -61,6 +64,7 @@ enum vpart_id
vp_fuel_tank_batt,
vp_fuel_tank_plut,
vp_fuel_tank_hydrogen,
vp_fuel_tank_water,
vp_cargo_trunk, // over
vp_cargo_box, // over
@@ -69,6 +73,7 @@ enum vpart_id
vp_muffler,
vp_seatbelt,
vp_solar_panel,
vp_kitchen_unit,
vp_m249,
vp_flamethrower,
vp_plasmagun,
@@ -105,7 +110,9 @@ enum vpart_flags
vpf_wheel, // this part touches ground (trigger traps)
vpf_seat, // is seat
vpf_bed, // is bed (like seat, but can't be boarded)
vpf_isle, // is isle (no extra movement cost)
vpf_engine, // is engine
vpf_kitchen, // is kitchen
vpf_fuel_tank, // is fuel tank
vpf_cargo, // is cargo
vpf_controls, // is controls
@@ -125,7 +132,7 @@ enum vpart_flags
struct vpart_info
{
const char *name; // part name
char sym; // symbol of part as if it's looking north
long sym; // symbol of part as if it's looking north
nc_color color; // color
char sym_broken; // symbol of broken part as if it's looking north
nc_color color_broken; // color of broken part
@@ -154,133 +161,142 @@ struct vpart_info
// h, j, c to horizontal, vertical, cross correspondingly
const vpart_info vpart_list[num_vparts] =
{ // name sym color sym_b color_b dmg dur par1 par2 item
{ "null part", '?', c_red, '?', c_red, 100, 100, 0, 0, itm_null, 0,
{ "null part", '?', c_red, '?', c_red, 100, 100, 0, 0, "null", 0,
0 },
{ "seat", '#', c_red, '*', c_red, 60, 300, 0, 0, itm_seat, 1,
{ "seat", '#', c_red, '*', c_red, 60, 300, 0, 0, "seat", 1,
mfb(vpf_over) | mfb(vpf_seat) | mfb(vpf_cargo) | mfb(vpf_no_reinforce) },
{ "bed", '#', c_magenta, '*', c_magenta, 60, 300, 0, 0, itm_seat, 1,
{ "bed", '#', c_magenta, '*', c_magenta, 60, 300, 0, 0, "seat", 1,
mfb(vpf_over) | mfb(vpf_bed) | mfb(vpf_cargo) | mfb(vpf_no_reinforce) },
{ "frame", 'h', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'h', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'j', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'j', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'c', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'c', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'y', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'y', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'u', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'u', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'n', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'n', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'b', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'b', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", '=', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", '=', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", 'H', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", 'H', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "frame", '^', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, itm_frame, 1,
{ "frame", '^', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "handle", '^', c_ltcyan, '#', c_ltcyan, 100, 300, 0, 0, itm_frame, 1,
{ "handle", '^', c_ltcyan, '#', c_ltcyan, 100, 300, 0, 0, "frame", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) },
{ "board", 'h', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'h', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "board", 'j', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'j', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "board", 'y', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'y', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "board", 'u', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'u', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "board", 'n', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'n', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "board", 'b', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "board", 'b', c_ltgray, '#', c_ltgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_external) | mfb(vpf_mount_point) | mfb (vpf_mount_inner) | mfb(vpf_opaque) | mfb(vpf_obstacle) },
{ "roof", '#', c_ltgray, '#', c_dkgray, 100, 1000, 0, 0, itm_steel_plate, 1,
{ "isle", '=', c_white, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_internal) | mfb(vpf_over) | mfb(vpf_no_reinforce) | mfb(vpf_isle) },
{ "isle", 'H', c_white, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_internal) | mfb(vpf_over) | mfb (vpf_no_reinforce) | mfb(vpf_isle) },
{ "floor trunk", '=', c_white, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
mfb(vpf_internal) | mfb(vpf_over) | mfb (vpf_no_reinforce) | mfb(vpf_isle) | mfb(vpf_cargo) },
{ "roof", '#', c_ltgray, '#', c_dkgray, 100, 1000, 0, 0, "steel_plate", 1,
mfb(vpf_internal) | mfb(vpf_roof) },
{ "door", '+', c_cyan, '&', c_cyan, 80, 200, 0, 0, itm_frame, 2,
{ "door", '+', c_cyan, '&', c_cyan, 80, 200, 0, 0, "frame", 2,
mfb(vpf_external) | mfb(vpf_obstacle) | mfb(vpf_openable) },
{ "opaque door",'+', c_cyan, '&', c_cyan, 80, 200, 0, 0, itm_frame, 2,
{ "opaque door",'+', c_cyan, '&', c_cyan, 80, 200, 0, 0, "frame", 2,
mfb(vpf_external) | mfb(vpf_obstacle) | mfb(vpf_opaque) | mfb(vpf_openable) },
{ "internal door", '+', c_cyan, '&', c_cyan, 75, 75, 0, 0, itm_frame, 2,
{ "internal door", '+', c_cyan, '&', c_cyan, 75, 75, 0, 0, "frame", 2,
mfb(vpf_external) | mfb(vpf_obstacle) | mfb(vpf_opaque) | mfb(vpf_openable) | mfb(vpf_roof) | mfb(vpf_no_reinforce) },
{ "windshield", '"', c_ltcyan, '0', c_ltgray, 70, 50, 0, 0, itm_glass_sheet, 1,
{ "windshield", '"', c_ltcyan, '0', c_ltgray, 70, 50, 0, 0, "glass_sheet", 1,
mfb(vpf_over) | mfb(vpf_obstacle) | mfb(vpf_no_reinforce) },
{ "blade", '-', c_white, 'x', c_white, 250, 100, 0, 0, itm_blade, 2,
{ "blade", '-', c_white, 'x', c_white, 250, 100, 0, 0, "blade", 2,
mfb(vpf_external) | mfb(vpf_unmount_on_damage) | mfb(vpf_sharp) | mfb(vpf_no_reinforce) },
{ "blade", '|', c_white, 'x', c_white, 350, 100, 0, 0, itm_blade, 2,
{ "blade", '|', c_white, 'x', c_white, 350, 100, 0, 0, "blade", 2,
mfb(vpf_external) | mfb(vpf_unmount_on_damage) | mfb(vpf_sharp) | mfb(vpf_no_reinforce) },
{ "spike", '.', c_white, 'x', c_white, 300, 100, 0, 0, itm_spike, 2,
{ "spike", '.', c_white, 'x', c_white, 300, 100, 0, 0, "spike", 2,
mfb(vpf_external) | mfb(vpf_unmount_on_damage) | mfb(vpf_sharp) | mfb(vpf_no_reinforce) },
// wheel_width(inches)
{ "wheel", '0', c_dkgray, 'x', c_ltgray, 50, 200, 9, 0, itm_wheel, 4,
{ "wheel", '0', c_dkgray, 'x', c_ltgray, 50, 200, 9, 0, "wheel", 4,
mfb(vpf_external) | mfb (vpf_mount_over) | mfb(vpf_wheel) | mfb(vpf_mount_point) | mfb(vpf_variable_size) },
{ "wide wheel", 'O', c_dkgray, 'x', c_ltgray, 50, 400, 14, 0, itm_wheel_wide, 5,
{ "wide wheel", 'O', c_dkgray, 'x', c_ltgray, 50, 400, 14, 0, "wheel_wide", 5,
mfb(vpf_external) | mfb (vpf_mount_over) | mfb(vpf_wheel) | mfb(vpf_mount_point) | mfb(vpf_variable_size) },
{ "bicycle wheel",'|', c_dkgray, 'x', c_ltgray, 50, 40, 2, 0, itm_wheel_bicycle, 1,
{ "bicycle wheel",'|', c_dkgray, 'x', c_ltgray, 50, 40, 2, 0, "wheel_bicycle", 1,
mfb(vpf_external) | mfb (vpf_mount_over) | mfb(vpf_wheel) | mfb(vpf_mount_point) | mfb(vpf_variable_size) },
{ "motorbike wheel",'o',c_dkgray, 'x', c_ltgray, 50, 90, 4, 0, itm_wheel_motorbike, 2,
{ "motorbike wheel",'o',c_dkgray, 'x', c_ltgray, 50, 90, 4, 0, "wheel_motorbike", 2,
mfb(vpf_external) | mfb (vpf_mount_over) | mfb(vpf_wheel) | mfb(vpf_mount_point) | mfb(vpf_variable_size) },
{ "small wheel", 'o',c_dkgray, 'x', c_ltgray, 50, 70, 6, 0, itm_wheel_small, 2,
{ "small wheel", 'o',c_dkgray, 'x', c_ltgray, 50, 70, 6, 0, "wheel_small", 2,
mfb(vpf_external) | mfb (vpf_mount_over) | mfb(vpf_wheel) | mfb(vpf_mount_point) | mfb(vpf_variable_size) },
//
{ "1-cylinder engine", '*', c_ltred, '#', c_red, 80, 150, 40, AT_GAS, itm_1cyl_combustion, 2,
{ "1-cylinder engine", '*', c_ltred, '#', c_red, 80, 150, 40, AT_GAS, "1cyl_combustion", 2,
mfb(vpf_internal) | mfb(vpf_engine) | mfb(vpf_variable_size) },
{ "V-twin engine", '*', c_ltred, '#', c_red, 80, 200, 120, AT_GAS, itm_v2_combustion, 2,
{ "V-twin engine", '*', c_ltred, '#', c_red, 80, 200, 120, AT_GAS, "v2_combustion", 2,
mfb(vpf_internal) | mfb(vpf_engine) | mfb(vpf_variable_size) },
{ "Inline-4 engine", '*', c_ltred, '#', c_red, 80, 300, 300, AT_GAS, itm_i4_combustion, 3,
{ "Inline-4 engine", '*', c_ltred, '#', c_red, 80, 300, 300, AT_GAS, "i4_combustion", 3,
mfb(vpf_internal) | mfb(vpf_engine) | mfb(vpf_variable_size) },
{ "V6 engine", '*', c_ltred, '#', c_red, 80, 400, 800, AT_GAS, itm_v6_combustion, 4,
{ "V6 engine", '*', c_ltred, '#', c_red, 80, 400, 800, AT_GAS, "v6_combustion", 4,
mfb(vpf_internal) | mfb(vpf_engine) | mfb(vpf_variable_size) },
{ "V8 engine", '*', c_ltred, '#', c_red, 80, 400, 800, AT_GAS, itm_v8_combustion, 4,
{ "V8 engine", '*', c_ltred, '#', c_red, 80, 400, 800, AT_GAS, "v8_combustion", 4,
mfb(vpf_internal) | mfb(vpf_engine) | mfb(vpf_variable_size) },
{ "electric motor", '*', c_yellow, '#', c_red, 80, 200, 70, AT_BATT, itm_motor, 3,
{ "electric motor", '*', c_yellow, '#', c_red, 80, 200, 70, AT_BATT, "motor", 3,
mfb(vpf_internal) | mfb(vpf_engine) },
{ "large electric motor", '*', c_yellow, '#', c_red, 80, 400, 350, AT_BATT, itm_motor_large, 4,
{ "large electric motor", '*', c_yellow, '#', c_red, 80, 400, 350, AT_BATT, "motor_large", 4,
mfb(vpf_internal) | mfb(vpf_engine) },
{ "plasma engine", '*', c_ltblue, '#', c_red, 80, 250, 400, AT_PLASMA, itm_plasma_engine, 6,
{ "plasma engine", '*', c_ltblue, '#', c_red, 80, 250, 400, AT_PLASMA, "plasma_engine", 6,
mfb(vpf_internal) | mfb(vpf_engine) },
{ "Foot pedals", '*', c_ltgray, '#', c_red, 50, 50, 70, AT_MUSCLE, itm_foot_crank, 1,
{ "Foot pedals", '*', c_ltgray, '#', c_red, 50, 50, 70, AT_MUSCLE, "foot_crank", 1,
mfb(vpf_internal) | mfb(vpf_engine) },
// capacity type
{ "gasoline tank", 'O', c_ltred, '#', c_red, 80, 150, 3000, AT_GAS, itm_metal_tank, 1,
{ "gasoline tank", 'O', c_ltred, '#', c_red, 80, 150, 3000, AT_GAS, "metal_tank", 1,
mfb(vpf_internal) | mfb(vpf_fuel_tank) },
{ "storage battery", 'O', c_yellow, '#', c_red, 80, 300, 1000, AT_BATT, itm_storage_battery, 2,
{ "storage battery", 'O', c_yellow, '#', c_red, 80, 300, 100000, AT_BATT, "storage_battery", 2,
mfb(vpf_internal) | mfb(vpf_fuel_tank) },
{ "minireactor", 'O', c_ltgreen, '#', c_red, 80, 700, 10000, AT_PLUT, itm_minireactor, 7,
{ "minireactor", 'O', c_ltgreen, '#', c_red, 80, 700, 10000, AT_PLUT, "minireactor", 7,
mfb(vpf_internal) | mfb(vpf_fuel_tank) },
{ "hydrogene tank", 'O', c_ltblue, '#', c_red, 80, 150, 3000, AT_PLASMA, itm_metal_tank, 1,
{ "hydrogene tank", 'O', c_ltblue, '#', c_red, 80, 150, 3000, AT_PLASMA, "metal_tank", 1,
mfb(vpf_internal) | mfb(vpf_fuel_tank) },
{ "trunk", 'H', c_brown, '#', c_brown, 80, 300, 400, 0, itm_frame, 1,
{ "water tank", 'O', c_ltcyan, '#', c_red, 80, 150, 400, AT_WATER, "metal_tank", 1,
mfb(vpf_internal) | mfb(vpf_fuel_tank) },
{ "trunk", 'H', c_brown, '#', c_brown, 80, 300, 400, 0, "frame", 1,
mfb(vpf_over) | mfb(vpf_cargo) },
{ "box", 'o', c_brown, '#', c_brown, 60, 100, 400, 0, itm_frame, 1,
{ "box", 'o', c_brown, '#', c_brown, 60, 100, 400, 0, "frame", 1,
mfb(vpf_over) | mfb(vpf_cargo) },
{ "controls", '$', c_ltgray, '$', c_red, 10, 250, 0, 0, itm_vehicle_controls, 3,
{ "controls", '$', c_ltgray, '$', c_red, 10, 250, 0, 0, "vehicle_controls", 3,
mfb(vpf_internal) | mfb(vpf_controls) },
// bonus
{ "muffler", '/', c_ltgray, '/', c_ltgray, 10, 150, 40, 0, itm_muffler, 2,
{ "muffler", '/', c_ltgray, '/', c_ltgray, 10, 150, 40, 0, "muffler", 2,
mfb(vpf_internal) | mfb(vpf_muffler) },
{ "seatbelt", ',', c_ltgray, ',', c_red, 10, 200, 25, 0, itm_rope_6, 1,
{ "seatbelt", ',', c_ltgray, ',', c_red, 10, 200, 25, 0, "rope_6", 1,
mfb(vpf_internal) | mfb(vpf_seatbelt) },
{ "solar panel", '#', c_yellow, 'x', c_yellow, 10, 20, 30, 0, itm_solar_panel, 6,
{ "solar panel", '#', c_yellow, 'x', c_yellow, 10, 20, 30, 0, "solar_panel", 6,
mfb(vpf_over) | mfb(vpf_solar_panel) },
{ "mounted M249", 't', c_cyan, '#', c_cyan, 80, 400, 0, AT_223, itm_m249, 6,
{ "kitchen unit", '&', c_ltcyan, 'x', c_ltcyan, 10, 20, 0, 0, "kitchen_unit", 4,
mfb(vpf_over) | mfb(vpf_cargo) | mfb(vpf_roof) | mfb(vpf_no_reinforce) | mfb(vpf_obstacle) | mfb(vpf_kitchen) },
{ "mounted M249", 't', c_cyan, '#', c_cyan, 80, 400, 0, AT_223, "m249", 6,
mfb(vpf_over) | mfb(vpf_turret) | mfb(vpf_cargo) },
{ "mounted flamethrower", 't', c_dkgray, '#', c_dkgray, 80, 400, 0, AT_GAS, itm_flamethrower, 7,
{ "mounted flamethrower", 't', c_dkgray, '#', c_dkgray, 80, 400, 0, AT_GAS, "flamethrower", 7,
mfb(vpf_over) | mfb(vpf_turret) },
{ "mounted plasma gun", 't', c_ltblue, '#', c_ltblue, 80, 400, 0, AT_PLASMA, itm_plasma_rifle, 7,
{ "mounted plasma gun", 't', c_ltblue, '#', c_ltblue, 80, 400, 0, AT_PLASMA, "plasma_rifle", 7,
mfb(vpf_over) | mfb(vpf_turret) },
{ "steel plating", ')', c_ltcyan, ')', c_ltcyan, 100, 1000, 0, 0, itm_steel_plate, 3,
{ "steel plating", ')', c_ltcyan, ')', c_ltcyan, 100, 1000, 0, 0, "steel_plate", 3,
mfb(vpf_internal) | mfb(vpf_armor) },
{ "superalloy plating",')', c_dkgray, ')', c_dkgray, 100, 900, 0, 0, itm_alloy_plate, 4,
{ "superalloy plating",')', c_dkgray, ')', c_dkgray, 100, 900, 0, 0, "alloy_plate", 4,
mfb(vpf_internal) | mfb(vpf_armor) },
{ "spiked plating", ')', c_red, ')', c_red, 150, 900, 0, 0, itm_spiked_plate, 3,
{ "spiked plating", ')', c_red, ')', c_red, 150, 900, 0, 0, "spiked_plate", 3,
mfb(vpf_internal) | mfb(vpf_armor) | mfb(vpf_sharp) },
{ "hard plating", ')', c_cyan, ')', c_cyan, 100, 2300, 0, 0, itm_hard_plate, 4,
{ "hard plating", ')', c_cyan, ')', c_cyan, 100, 2300, 0, 0, "hard_plate", 4,
mfb(vpf_internal) | mfb(vpf_armor) },
{ "head light", '*', c_white, '*', c_white, 10, 20, 120, 0, itm_flashlight, 1,
{ "head light", '*', c_white, '*', c_white, 10, 20, 120, 0, "flashlight", 1,
mfb(vpf_internal) | mfb(vpf_light) }
};
+9
View File
@@ -778,8 +778,10 @@ void game::init_vehicles()
// dx, dy, part_id
PART ( 0, 0, vp_frame_v2);
PART ( 0, 0, vp_isle_v2);
PART ( 0, 0, vp_roof);
PART ( 0, 1, vp_frame_v2);
PART ( 0, 1, vp_isle_h2);
PART ( 0, 1, vp_roof);
PART ( 0, 2, vp_door);
PART ( 0, -1, vp_frame_v2);
@@ -815,6 +817,7 @@ void game::init_vehicles()
PART ( -1, -1, vp_seat);
PART ( -1, -1, vp_roof);
PART ( -1, 0, vp_frame_v2);
PART ( -1, 0, vp_isle_v2);
PART ( -1, 0, vp_roof);
PART ( -1, 1, vp_frame_h2);
PART ( -1, 1, vp_seat);
@@ -829,6 +832,7 @@ void game::init_vehicles()
PART ( -2, -1, vp_seat);
PART ( -2, -1, vp_roof);
PART ( -2, 0, vp_frame_v2);
PART ( -2, 0, vp_floor_trunk);
PART ( -2, 0, vp_roof);
PART ( -2, 1, vp_frame_h2);
PART ( -2, 1, vp_seat);
@@ -843,6 +847,7 @@ void game::init_vehicles()
PART ( -3, -1, vp_seat);
PART ( -3, -1, vp_roof);
PART ( -3, 0, vp_frame_v2);
PART ( -3, 0, vp_isle_v2);
PART ( -3, 0, vp_roof);
PART ( -3, 1, vp_frame_h2);
PART ( -3, 1, vp_seat);
@@ -856,6 +861,7 @@ void game::init_vehicles()
PART ( -4, -1, vp_seat);
PART ( -4, -1, vp_roof);
PART ( -4, 0, vp_frame_v2);
PART ( -4, 0, vp_isle_v2);
PART ( -4, 0, vp_roof);
PART ( -4, 1, vp_frame_h2);
PART ( -4, 1, vp_seat);
@@ -869,6 +875,7 @@ void game::init_vehicles()
PART ( -5, -1, vp_seat);
PART ( -5, -1, vp_roof);
PART ( -5, 0, vp_frame_v2);
PART ( -5, 0, vp_floor_trunk);
PART ( -5, 0, vp_roof);
PART ( -5, 1, vp_frame_h2);
PART ( -5, 1, vp_seat);
@@ -882,6 +889,7 @@ void game::init_vehicles()
PART ( -6, -1, vp_seat);
PART ( -6, -1, vp_roof);
PART ( -6, 0, vp_frame_v2);
PART ( -6, 0, vp_isle_v2);
PART ( -6, 0, vp_roof);
PART ( -6, 1, vp_frame_h2);
PART ( -6, 1, vp_seat);
@@ -895,6 +903,7 @@ void game::init_vehicles()
PART ( -7, -1, vp_seat);
PART ( -7, -1, vp_roof);
PART ( -7, 0, vp_frame_v2);
PART ( -7, 0, vp_isle_v2);
PART ( -7, 0, vp_roof);
PART ( -7, 1, vp_frame_h2);
PART ( -7, 1, vp_seat);
+45 -27
View File
@@ -606,7 +606,7 @@ void vehicle::print_part_desc (void *w, int y1, int width, int p, int hl)
void vehicle::print_fuel_indicator (void *w, int y, int x)
{
WINDOW *win = (WINDOW *) w;
const nc_color fcs[num_fuel_types] = { c_ltred, c_yellow, c_ltgreen, c_ltblue };
const nc_color fcs[num_fuel_types] = { c_ltred, c_yellow, c_ltgreen, c_ltblue, c_ltcyan };
const char fsyms[5] = { 'E', '\\', '|', '/', 'F' };
nc_color col_indf1 = c_ltgray;
mvwprintz(win, y, x, col_indf1, "E...F");
@@ -753,6 +753,25 @@ int vehicle::refill (int ftype, int amount)
return amount;
}
int vehicle::drain (int ftype, int amount) {
int drained = 0;
for (int p = 0; p < parts.size(); p++) {
if (part_flag(p, vpf_fuel_tank) && part_info(p).fuel_type == ftype && parts[p].amount > 0) {
if (parts[p].amount > (amount - drained)) {
parts[p].amount -= (amount - drained);
drained = amount;
break;
} else {
drained += parts[p].amount;
parts[p].amount = 0;
}
}
}
return drained;
}
std::string vehicle::fuel_name(int ftype)
{
switch (ftype)
@@ -765,6 +784,8 @@ std::string vehicle::fuel_name(int ftype)
return std::string("plutonium cells");
case AT_PLASMA:
return std::string("hydrogen");
case AT_WATER:
return std::string("clean water");
default:
return std::string("INVALID FUEL (BUG)");
}
@@ -773,7 +794,7 @@ std::string vehicle::fuel_name(int ftype)
int vehicle::basic_consumption (int ftype)
{
if (ftype == AT_PLUT)
ftype = AT_BATT;
ftype = AT_BATT;
int cnt = 0;
int fcon = 0;
for (int p = 0; p < parts.size(); p++)
@@ -1020,7 +1041,7 @@ void vehicle::consume_fuel ()
for (int ft = 0; ft < 3; ft++)
{
float st = strain() * 10;
int amnt = (int) (basic_consumption (ftypes[ft]) * (1.0 + st * st) / 100);
int amnt = (int) (basic_consumption (ftypes[ft]) * (1.0 + st * st) / (ftypes[ft] == AT_BATT?1:100));
if (!amnt)
continue; // no engines of that type
// g->add_msg("consume: %d of fuel%d (st:%.2f)", amnt, ft, st);
@@ -1037,7 +1058,7 @@ void vehicle::consume_fuel ()
if (part_flag(p, vpf_fuel_tank) &&
(part_info(p).fuel_type == (elec? (j? AT_BATT : AT_PLUT) : ftypes[ft])))
{
parts[p].amount -= amnt;
parts[p].amount -= amnt / ((elec && !j)?100:1);
if (parts[p].amount < 0)
parts[p].amount = 0;
found = true;
@@ -1305,7 +1326,7 @@ veh_collision vehicle::part_collision (int vx, int vy, int part, int x, int y)
switch (collision_type) // destroy obstacle
{
case veh_coll_thin_obstacle:
g->m.ter (x, y) = t_dirt;
g->m.ter_set(x, y, t_dirt);
break;
case veh_coll_destructable:
g->m.destroy(g, x, y, false);
@@ -1472,7 +1493,7 @@ void vehicle::handle_trap (int x, int y, int part)
snd = "SNAP!";
wreckit = true;
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_beartrap], 0);
g->m.spawn_item(x, y, g->itypes["beartrap"], 0);
break;
case tr_nailboard:
wreckit = true;
@@ -1488,10 +1509,10 @@ void vehicle::handle_trap (int x, int y, int part)
snd = "Clank!";
wreckit = true;
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_crossbow], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["crossbow"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
if (!one_in(10))
g->m.add_item(x, y, g->itypes[itm_bolt_steel], 0);
g->m.spawn_item(x, y, g->itypes["bolt_steel"], 0);
break;
case tr_shotgun_2:
case tr_shotgun_1:
@@ -1504,8 +1525,8 @@ void vehicle::handle_trap (int x, int y, int part)
else
{
g->m.tr_at(x, y) = tr_null;
g->m.add_item(x, y, g->itypes[itm_shotgun_sawn], 0);
g->m.add_item(x, y, g->itypes[itm_string_6], 0);
g->m.spawn_item(x, y, g->itypes["shotgun_sawn"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
}
break;
case tr_landmine:
@@ -1548,7 +1569,7 @@ void vehicle::handle_trap (int x, int y, int part)
bool vehicle::add_item (int part, item itm)
{
if (!part_flag(part, vpf_cargo) || parts[part].items.size() >= 26)
if (!part_flag(part, vpf_cargo) || parts[part].items.size() >= 64)
return false;
it_ammo *ammo = dynamic_cast<it_ammo*> (itm.type);
if (part_flag(part, vpf_turret))
@@ -1583,19 +1604,15 @@ void vehicle::gain_moves (int mp)
thrust (cruise_velocity > velocity? 1 : -1);
}
if (g->is_in_sunlight(global_x(), global_y()))
{
int spw = solar_power ();
if (spw)
{
int fl = spw / 100;
int prob = spw % 100;
if (rng (0, 100) <= prob)
fl++;
if (fl)
refill (AT_BATT, fl);
}
if (g->is_in_sunlight(global_x(), global_y())) {
refill (AT_BATT, solar_power());
}
// If the vehicle is moving, trickle-charge storage batteries.
if (velocity && one_in(10)) {
refill (AT_BATT, abs(velocity) / 100);
}
// check for smoking parts
for (int ep = 0; ep < external_parts.size(); ep++)
{
@@ -1818,7 +1835,7 @@ int vehicle::damage_direct (int p, int dmg, int type)
else
if (parts[p].hp <= 0 && part_flag(p, vpf_unmount_on_damage))
{
g->m.add_item (global_x() + parts[p].precalc_dx[0],
g->m.spawn_item (global_x() + parts[p].precalc_dx[0],
global_y() + parts[p].precalc_dy[0],
g->itypes[part_info(p).item], g->turn);
remove_part (p);
@@ -1847,7 +1864,8 @@ void vehicle::leak_fuel (int p)
parts[p].amount = 0;
return;
}
g->m.add_item(i, j, g->itypes[itm_gasoline], 0);
g->m.spawn_item(i, j, g->itypes["gasoline"], 0);
g->m.spawn_item(i, j, g->itypes["gasoline"], 0);
parts[p].amount -= 100;
}
}
@@ -1872,7 +1890,7 @@ void vehicle::fire_turret (int p, bool burst)
int fleft = fuel_left (amt);
if (fleft < 1)
return;
it_ammo *ammo = dynamic_cast<it_ammo*>(g->itypes[amt == AT_GAS? itm_gasoline : itm_plasma]);
it_ammo *ammo = dynamic_cast<it_ammo*>(g->itypes[amt == AT_GAS? "gasoline" : "plasma"]);
if (!ammo)
return;
if (fire_turret_internal (p, *gun, *ammo, charges))
+7 -3
View File
@@ -14,8 +14,8 @@ class map;
class player;
class game;
const int num_fuel_types = 4;
const int fuel_types[num_fuel_types] = { AT_GAS, AT_BATT, AT_PLUT, AT_PLASMA };
const int num_fuel_types = 5;
const int fuel_types[num_fuel_types] = { AT_GAS, AT_BATT, AT_PLUT, AT_PLASMA, AT_WATER };
const int k_mvel = 200;
// 0 - nothing, 1 - monster/player/npc, 2 - vehicle,
@@ -49,7 +49,7 @@ struct veh_collision {
struct vehicle_part
{
vehicle_part() : id(vp_null), mount_dx(0), mount_dy(0), hp(0),
blood(0), inside(false), flags(0), passenger_id(0), bigness(0)
blood(0), bigness(0), inside(false), flags(0), passenger_id(0)
{
precalc_dx[0] = precalc_dx[1] = -1;
precalc_dy[0] = precalc_dy[1] = -1;
@@ -247,6 +247,10 @@ public:
// returns amount of leftover fuel
int refill (int ftype, int amount);
// drains a fuel type (e.g. for the kitchen unit)
// returns amount actually drained, does not engage reactor
int drain (int ftype, int amount);
// vehicle's fuel type name
std::string fuel_name(int ftype);

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