Compare commits

...

1612 Commits

Author SHA1 Message Date
TheDarklingWolf 8666490d6a Fix crowbars 2013-03-05 16:55:13 +00:00
TheDarklingWolf faa50819eb Messed with pocketknife stats, fixed email bug 2013-03-05 16:05:00 +00:00
Kyratzes Talvadore eb63d39865 Merge pull request #145 from OzoneH3/master
Added magacine for archery, added guns and ammo to magazine group
2013-03-05 03:05:31 -08:00
Kevin Granade dc8b9831c0 Make static or dynamic zombie spawning an option. 2013-03-04 21:32:11 -06:00
Kevin Granade 24e27d36ec Add some comments to new option flags. 2013-03-04 21:32:11 -06:00
Kevin Granade dda2e5dd1e Give zombie groups a major bump. 2013-03-04 21:32:11 -06:00
Kevin Granade d45ea8f7a3 Make zombie population density fall off exponentially with distance from city centers. 2013-03-04 21:32:11 -06:00
Kevin Granade 6f110e4ea3 Make staticly spawned monsters generate a new spawn at their current location when despawning instead of warping back to their origin. 2013-03-04 21:32:11 -06:00
Kevin Granade d974fa4882 Centralize the monster despawn logic in a single method. 2013-03-04 21:32:11 -06:00
Kevin Granade 9801da51cf Make spawns dencer at the center of towns. 2013-03-04 21:30:58 -06:00
Kevin Granade 3bab8dfe98 Replace the city mongroup with static spawns of zombies scattered about. 2013-03-04 21:30:58 -06:00
Kevin Granade 3ff88c4736 Give lockpicking and prying open alarmed doors have a chance of setting off alarms. 2013-03-04 19:40:03 -06:00
Kevin Granade 7bdbc9e0ae Make picking a lock unlock the door instead of also opening it. 2013-03-04 19:11:20 -06:00
Kevin Granade 0cb3aeaa52 Factor mechancs skill in to lockpicking and door forcing. 2013-03-04 18:52:32 -06:00
Kevin Granade 5fdfb2b17f Refactor crowbar code to repeat itself less. 2013-03-04 18:52:32 -06:00
Kevin Granade 39700a7fff Make the rest of the esged weapons ueable as cutting tools. 2013-03-04 18:52:32 -06:00
Kevin Granade 39b8738184 Add varable strength requirements for moving different furniture types. 2013-03-04 18:52:32 -06:00
Kevin Granade 8b1ca73225 Refactor lockpicking code to not repeat itself so much. 2013-03-04 18:52:31 -06:00
Kevin Granade 0d41c95353 Add message indicating failure to pick a lock. 2013-03-04 18:52:31 -06:00
Kevin Granade 92fefb6adf Make lockpicking and forcing doors take time whether it works or not. 2013-03-04 18:52:31 -06:00
TheDarklingWolf 64ba80026f Cots no longer prompt a warning 2013-03-04 17:41:56 +00:00
TheDarklingWolf 1aa6ded393 Added a 3in string to 50 thread recipe. All rope disassembly is handled via the disassembly key. 2013-03-04 17:34:35 +00:00
TheDarklingWolf eaf3536c6e Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-04 17:09:17 +00:00
TheDarklingWolf 81338012a5 Updated rollmat description to make it more descriptive. 2013-03-04 17:08:43 +00:00
OzoneH3 03f6184a71 Updated list_items to not redraw terrain if it isnt absolutley needed 2013-03-04 15:11:55 +01:00
OzoneH3 7676b07cb6 Added possibility to Takeoff the weapon
It is possible, to (w)ield and press '-' to take off the weaopn, but how should anyone know that?!
2013-03-04 12:59:10 +01:00
OzoneH3 bd33a5738d Added magacine for archery, added guns and ammo to magazine group 2013-03-04 11:40:21 +01:00
Zach Morgan 86894453ce make vehicle control regaining make more sense
by eating the sideways velocity.
also fixing rl_vec dot products, broken from from last commit's fix
2013-03-04 05:35:13 -05:00
Zach Morgan d34c73c2f6 moving skid recovery
from inside map::vehproceed
to vehicle::possibly_recover_from_skid
2013-03-04 05:07:08 -05:00
Zach Morgan b2bc3ca2f6 give a chance to recover in a skid, depenging on
chance, and move & face vectors being somewhat aligned.
2013-03-04 04:40:01 -05:00
OzoneH3 26921a91b4 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-04 09:41:09 +01:00
Zach Morgan 20844c7cab implemented vehicle::face_vec 2013-03-04 00:30:39 -05:00
Zach Morgan 9ec4cc602b mingw & fake curses compilation fix 2013-03-04 00:25:44 -05:00
Zach Morgan 77e37b0113 giving 'tough' trait a cost of 3 pts instead of 5 2013-03-03 23:40:38 -05:00
Zach Morgan dc56e2eca1 s/percussion/concussion in bike helmet description.
Thanks to elricsfate for pointing it out.
2013-03-03 23:23:47 -05:00
OzoneH3 070df33b9e Update list items only redraw previous trail to item instead of whole terrain 2013-03-04 00:35:05 +01:00
Kyratzes Talvadore 459cb2d1f9 Merge pull request #144 from OzoneH3/master
Updated inventory menu to always display item info and a menu beside
2013-03-03 14:43:14 -08:00
OzoneH3 0349cd9668 Updated inventory menu to always display item info and a menu beside 2013-03-03 23:24:02 +01:00
TheDarklingWolf 7784b07af2 Fema groundsheets are now indoor tiles. The labs no longer use pavement. 2013-03-03 21:39:59 +00:00
TheDarklingWolf 10298aad75 Makefile update 2013-03-03 18:34:46 +00:00
Kyratzes Talvadore 6d8bc20eb4 Merge pull request #130 from OzoneH3/master
Added Option (safemodeproximity) for safemode, at what distance to hostiles safemode should kick in
2013-03-03 09:54:58 -08:00
Kevin Granade 578436cc73 Make wolves and other meat-eaters unhappy about zombie meat, but ok with cooked and human meat. 2013-03-03 11:36:36 -06:00
Kevin Granade c7da5cce22 Remove DOS style newlines. 2013-03-03 11:22:23 -06:00
TheDarklingWolf 23f75a3248 Fixed unburied landmines being placed in mx_minefield 2013-03-03 17:10:32 +00:00
OzoneH3 d604f5b761 Added missing key for numpad support 2013-03-03 13:58:02 +00:00
OzoneH3 a51226bebb Added numpad keys to input.cpp
Conflicts:

	overmap.cpp
2013-03-03 13:57:59 +00:00
Kyratzes Talvadore bb14238b43 Fixed a screwup in cooked marrow description. 2013-03-03 13:33:46 +00:00
OzoneH3 ed91287ad4 Added missing key for numpad support 2013-03-03 14:26:32 +01:00
TheDarklingWolf 5b9926db78 Increased chance of gas pumps running out of gas 2013-03-03 13:20:25 +00:00
TheDarklingWolf e295648c61 Added wild veggies to various recipes 2013-03-03 13:18:13 +00:00
TheDarklingWolf 7508445bc7 Changed messenger bag description and storage 2013-03-03 13:16:16 +00:00
TheDarklingWolf 8633b2a1cb Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-03 13:15:00 +00:00
TheDarklingWolf 2b0b5bec98 Some name changes to veggy chunks 2013-03-03 13:14:50 +00:00
OzoneH3 1e34693f74 Added numpad keys to input.cpp 2013-03-03 12:42:38 +01:00
OzoneH3 8499f59080 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA
Conflicts:
	game.cpp
	overmap.cpp
2013-03-03 10:40:38 +01:00
Kevin Granade d1252c2b59 Update distance to target message offset. 2013-03-03 02:23:22 -06:00
Zach Morgan 89aee80229 Merge pull request #142 from BurnZeZ/master
Lowered encumbrance of messenger bag to 0
2013-03-02 23:12:37 -08:00
Zach Morgan dfa73854d3 Revert "Merge branch 'WarningResolutions' of git://github.com/AkrionXxarr/Cataclysm-DDA"
This reverts commit b8b08ba99a, reversing
changes made to d5152fdc3d.

Justification: Apparently, Whales used represented certain states using negative values in the inventory
system, and perhaps in other instances. This branch replaced a bunch of
ints with unsigned ints, for no real reason.

I think that this also causes the initial NPC's needs vector to become
corrupted.

Conflicts:
	bionics.cpp
	game.cpp
	graffiti.cpp
	map.cpp
	overmap.cpp
	rng.cpp
2013-03-03 01:46:08 -05:00
BurnZeZ f0d63e2ab6 Lowered encumbrance of messenger bag to 0
RIP Bruce
2013-03-02 23:05:38 -05:00
Kevin Granade a5b4dfbd27 Stop blueberries from spawning, you have to forage for them now. 2013-03-02 21:58:30 -06:00
BurnZeZ 10e736b5f0 That was levels of wrong beyond the ability of ethics to account for. 2013-03-02 22:49:21 -05:00
Zach Morgan e9d31bec58 Merge pull request #141 from BurnZeZ/master
Input revamp base
2013-03-02 19:41:00 -08:00
BurnZeZ 625ba7aba0 Removed the escape key delay. 2013-03-02 22:28:50 -05:00
Zach Morgan 9b96c7089f Merge pull request #140 from tasetase/master
Make t_window_domestic break when shot
2013-03-02 19:08:11 -08:00
Zach Morgan e9cb72d3c5 stem cell treatment to repair bones
"Mr. Stem Cell" treatment terminal in hospital,
and disease.
no new items.
2013-03-02 20:37:18 -05:00
BurnZeZ 5fa706ac9d Merge pull request #2 from BurnZeZ/input-revamp
Input revamp beginnings
2013-03-02 16:47:42 -08:00
BurnZeZ d12045a1f2 get_input() can now handle arrow keys 2013-03-02 19:42:05 -05:00
BurnZeZ 13602188c6 Temp fix so arrow keys work. 2013-03-02 19:26:04 -05:00
phil 17ea14eb48 Made t_window_domestic breakable when shot 2013-03-02 18:58:58 -05:00
phil 7b79660e4d Minor tweaks related to shooting 2013-03-02 18:58:01 -05:00
BurnZeZ 8aec1699eb Merge branch 'master' into input-revamp
Conflicts:
	bionics.cpp
	game.cpp
2013-03-02 18:46:54 -05:00
OzoneH3 4c9ced093f Fixed freeze when options get changed from bool to int 2013-03-03 00:19:08 +01:00
OzoneH3 6a0bf4c865 Added inventory menu option to reload item 2013-03-02 23:16:34 +01:00
OzoneH3 e978f250eb Fix inventory menu unload, dont unload held weapon if selected item is worn item 2013-03-02 21:41:04 +01:00
OzoneH3 a3e1be9e8d Added unload items from inventory menu 2013-03-02 21:16:26 +01:00
Kevin Granade ec0616d2e4 Increase scent update radius, only seems to make a difference if you're running. 2013-03-01 21:57:48 -06:00
Kevin Granade e6588068bc Only return scent values when queried from inside scent update radius to avoid confusing monsters. 2013-03-01 20:50:54 -06:00
Kevin Granade 5dee478a35 Update draw_scent() debug function for configurable view size. 2013-03-01 20:21:33 -06:00
OzoneH3 2984403382 Inventory, add menu to choose what to do with the selected item.
Reload/Unload may follow, but its complicated ...
2013-03-01 22:38:43 +01:00
TheDarklingWolf 230fe26545 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-03-01 20:54:26 +00:00
TheDarklingWolf aa9c6072c3 Landmines can now be set on non-diggable terrain. 2013-03-01 20:53:36 +00:00
Zach Morgan b341d92b10 Merge pull request #128 from AkrionXxarr/WarningResolutions
More fixes similar to the djb2_hash fix.
2013-03-01 11:40:46 -08:00
TheDarklingWolf e7cc2e8cb1 Remove sewing kit exception from disassembly 2013-03-01 18:17:51 +00:00
TheDarklingWolf 4fc1a1a8df Rip up tshirts by hand 2013-03-01 18:17:23 +00:00
OzoneH3 6f8a1ed478 Fixed broken overmap Notes not being displayed and added custom note symbol with X:TEXT 2013-03-01 16:06:48 +01:00
OzoneH3 9549305c8d 12/24 hour time text update 2013-03-01 14:38:40 +01:00
OzoneH3 6d4b6b2ad5 Made the Help menu a bit more 80x25 friendly 2013-03-01 13:41:49 +01:00
OzoneH3 4864d3064b Added normal 24h time display to time options 2013-03-01 13:24:05 +01:00
OzoneH3 41b6f12f89 If Ausosafemode is on, color SAFE green if no hostiles are in proximity range, otherwise color it red
Added progressbar like coloring of SAFE while autosafemode is powering up.
2013-03-01 12:47:01 +01:00
OzoneH3 1f0c27ff6f Fix: Show new skill percentage when reading a book 2013-03-01 12:04:50 +01:00
OzoneH3 01d113b202 Added Option (safemodeproximity) for safemode, at what distance to hostiles safemode should kick in
Also added an option after how many turns autosafemode reenables safemode if there are no hostiles in safemodeproximity range
2013-03-01 11:57:37 +01:00
AkrionXxarr e8b4a21540 Fix to confusing and potentially unpredictable conditionals.
This is a fix similar to the djb2_hash fix.
2013-02-28 21:10:25 -08:00
Zach Morgan 48be67014c Merge pull request #127 from AkrionXxarr/WarningResolutions
Fixed djb2_hash with proper code.
2013-02-28 20:33:59 -08:00
AkrionXxarr a8ad03d677 Fixed djb2_hash with proper code. 2013-02-28 19:28:33 -08:00
Kevin Granade 7d2e2a16a9 Added minimal test running make target. 2013-02-28 18:41:36 -06:00
Kevin Granade 5eb21df4b3 Minor cleanup to line_test.cpp. 2013-02-28 18:21:30 -06:00
Kevin Granade 643c3b440a Workaround to probable symbol collision between some cataclysm object and libtap. 2013-02-28 18:21:30 -06:00
Zach Morgan b2ba305653 trivial bracketing 2013-02-28 19:18:22 -05:00
Zach Morgan 5986601e02 making vehicles move 2013-02-28 19:04:43 -05:00
Zach Morgan b8b08ba99a Merge branch 'WarningResolutions' of git://github.com/AkrionXxarr/Cataclysm-DDA
Conflicts:
	inventory_ui.cpp
2013-02-28 18:48:02 -05:00
BurnZeZ d4fe0acd05 Merge branch 'master' into input-revamp 2013-02-28 18:06:23 -05:00
BurnZeZ cfd5518cfd Made get_input() backwards compatible with the existing codebase
Fixed a bug trapping you at the item list prompt
2013-02-28 17:57:27 -05:00
Zach Morgan d5152fdc3d Merge pull request #125 from OzoneH3/master
Add worn items and weapon to total item count in inventory.
2013-02-28 14:55:57 -08:00
Zach Morgan e195d28c8e Merge pull request #118 from benjamg/hotfix/makefile_dependencies
add dependency information for g++ linux builds
2013-02-28 14:40:05 -08:00
AkrionXxarr 9ba34d3ebf Further warning resolutions. Specifically focused on signed/unsigned mismatches.
Change to warning flags in Makefile.

Small error fix.
2013-02-28 14:05:21 -08:00
AkrionXxarr e19854dc3e Further warning resolutions. Specifically focused on unused parameter warnings.
Small error fixes.

Further warning resolutions. A fix in items.h.

Further warning resolutions.
A few bug fixes and fixes to past changes.

Small error fixes.
2013-02-28 14:05:20 -08:00
AkrionXxarr 0f657dee94 Further warning resolutions. Specifically defaulting switch statements.
Further warning resolutions.
2013-02-28 14:05:19 -08:00
AkrionXxarr d3c6015ea6 Further warning resolutions.
Further warning resolutions.
Tweeked previous -Wunused-parameter warning fixes

Further warning resolutions.

Further warning resolutions. Crazy source file is crazy.

Potential bug fix?
2013-02-28 14:04:57 -08:00
OzoneH3 494a641e6b Add worn items and weapon to total item count in inventory. 2013-02-28 23:03:14 +01:00
AkrionXxarr 22e1de332a Fixed a couple errors in previous commit.
More warning resolutions.
Reordered switch in artifact.cpp to match enum order.
(Probably missed doing this to a couple previous switches,
 will have to go back)
2013-02-28 13:30:37 -08:00
AkrionXxarr 55b8e3a83e Warning Resolutions 2013-02-28 13:30:36 -08:00
BurnZeZ 544aaaf3fc Merge branch 'master' into input-revamp 2013-02-28 15:15:08 -05:00
BurnZeZ e7446e0264 More input.h integration 2013-02-28 15:13:06 -05:00
benjamg 8bd8c06947 fix for clean method 2013-02-28 19:50:49 +00:00
benjamg 9ad98f7e70 Merge branch 'hotfix/makefile_dependencies' of github.com:benjamg/Cataclysm-DDA into hotfix/makefile_dependencies 2013-02-28 19:47:06 +00:00
BurnZeZ c0d7ddd1d3 Fixed factions ignoring input that should close the window
Removed an accidental double call to get_input() in game::close()
Updated a DebugLog string to display get_input() rather than input()
2013-02-28 14:40:42 -05:00
BurnZeZ 33919dcf4b A bit of input refactoring inside game.cpp
More code uses input.h functions rather than directly calling getch()

Fixed the menu loop I broke last commit
2013-02-28 14:31:31 -05:00
Zach Morgan a5fa8f9668 Using larger chunks of memory instead of VLAs.
This lets clang++ compile cataclysm.
2013-02-28 13:18:02 -05:00
Zach Morgan 87af41d2c8 Merge pull request #123 from benjamg/hotfix/makefile_anytests
Support multiple tests with libtab
2013-02-28 07:53:36 -08:00
Ben Gray 9de7ad5c58 make clean remove dependency files too 2013-02-28 10:08:08 +00:00
Ben Gray 0ef60d89d2 add dependency information for g++ linux builds 2013-02-28 10:06:46 +00:00
Ben Gray 0e92eca46d updated makefile to build each test from it's own source file as libtab uses the main entry point as it's test runner 2013-02-28 10:06:14 +00:00
Kevin Granade e3b8e0fd73 Fix off-by-one error in construction menu that was making construction menu crash on entry of a `. 2013-02-27 22:30:38 -06:00
Zach Morgan 9057403a6c distinct message for cigars 2013-02-27 22:21:46 -05:00
Zach Morgan 694f1cbe97 unarmed vs. inventory screen offset fix 2013-02-27 22:01:55 -05:00
Kevin Granade ec16dc4822 Initial support for unit tests using libtap. 2013-02-27 18:21:24 -06:00
Kevin Granade 91ee4faaa2 Revert "Replace the city mongroup with static spawns of zombies scattered about."
This reverts commit bc44340bd9.
2013-02-27 18:07:24 -06:00
Kevin Granade b628deaf18 Prune map.h as an include for line.cpp. 2013-02-27 18:04:12 -06:00
Kevin Granade 4e62e0299b Initialize temp_cur with the appropriate define. 2013-02-27 17:53:25 -06:00
Kevin Granade cba16f9d7c Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into dda-master 2013-02-27 17:52:35 -06:00
BurnZeZ a042be590d Added a new method for input.
Made the main menu use the new input system.
2013-02-27 18:40:59 -05:00
Ben Gray 96548da1e8 add dependency information for g++ linux builds 2013-02-27 21:12:42 +00:00
TheDarklingWolf 3452ad54aa Disabled body temperature updates 2013-02-27 19:33:14 +00:00
Zach Morgan 2562f2d3dd misc game.cpp chanves, from kevin 2013-02-27 11:11:38 -05:00
Zach Morgan b38ec05c2d making zombie kids more friendly 2013-02-27 02:50:31 -05:00
Zach Morgan 34b1c93283 - annoying temperature message 2013-02-27 02:39:17 -05:00
Kevin Granade bc44340bd9 Replace the city mongroup with static spawns of zombies scattered about. 2013-02-27 00:12:48 -06:00
Kevin Granade b8959a1219 Add new place_spawns() function to generate random-ish static spawns of monsters. 2013-02-27 00:11:44 -06:00
Zach Morgan ddb1d408be taking a step to prevent multiple veh-veh
collision events in the same instance.

Note: this could add time to the system, and with collisions being the
way they are, they could add energy to the system.
So hopefully the resonances don't cascade with too many vehicles.
2013-02-27 00:35:58 -05:00
Zach Morgan 5472cef101 fixing vehicle solar panels 2013-02-26 22:54:46 -05:00
Kevin Granade 6106145e3d Merge remote-tracking branch 'shoes/master' into dda-master
Conflicts:
	weather.h
2013-02-26 21:10:47 -06:00
Shoes01 16036327c8 Bodytemp is now updated every tick instead of every 10 ticks 2013-02-26 21:40:22 -08:00
Shoes01 5977e198e1 Documentation and cleanup of bodytemp stuff 2013-02-26 20:30:08 -08:00
Kevin Granade 2032dda642 Give gas pumps a chance of running out of gas. 2013-02-26 20:43:47 -06:00
Kevin Granade adac220862 Fix bionic description typo. 2013-02-26 20:43:47 -06:00
TheDarklingWolf c79fcdca2f Fix for windows, probably 2013-02-26 22:12:32 +00:00
TheDarklingWolf c618b1a353 Some fixes for foraging 2013-02-26 19:07:21 +00:00
Zach Morgan 44dc6ff371 fixing repair/replace part consumption 2013-02-26 12:02:53 -05:00
TheDarklingWolf e586852e35 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-26 12:43:47 +00:00
TheDarklingWolf 34249c3d25 Revolver shotguns, also some clockworks 2013-02-26 12:43:37 +00:00
Kyratzes Talvadore 23b559893b Merge pull request #115 from Voker57/tweaks
Add metal tank to garage stuff
2013-02-26 04:25:51 -08:00
Voker57 d615426fe0 Add metal tank to garage stuff 2013-02-26 16:23:35 +04:00
Kyratzes Talvadore f7b95d1e89 Merge pull request #113 from Voker57/tweaks
Lowered encumbrance of chitin helmet to 1
2013-02-26 03:29:43 -08:00
Kyratzes Talvadore 509ed7da6d Merge pull request #114 from Voker57/tweaks2
Bring reloading time costs in accordance to number of rounds crafted
2013-02-26 03:29:31 -08:00
Voker57 bef38b47f1 Bring reloading time costs in accordance to number of rounds crafted 2013-02-26 15:11:36 +04:00
Voker57 ae43c16989 Lowered encumbrance of chitin helmet to 1 2013-02-26 14:24:37 +04:00
Owen Diamond d20008c6ac OOps fixed bug 2013-02-25 22:47:38 -06:00
Kevin Granade 4327342cf0 Add some randomness to cutting yourself on window glass. 2013-02-25 22:46:58 -06:00
Kevin Granade 47bfc29dbe Replace random chance of bleeding with damage thresholds.
Conflicts:

	monmove.cpp
2013-02-25 22:32:53 -06:00
Owen Diamond 856847b08f Make you care, even if it isnt right in your face. 2013-02-25 21:49:03 -06:00
Owen Diamond 97dba19f55 Guilt and bug fix for loot drop 2013-02-25 21:49:03 -06:00
Owen Diamond 337dd5e662 Child Zombies 2013-02-25 21:49:03 -06:00
Owen Diamond cc8b0cd7f5 Made pocket knife a tool. 2013-02-25 21:49:03 -06:00
Zach Morgan d8b8c9cfa8 fusion blaster arms less insanely common, with no apologies :) 2013-02-25 22:14:57 -05:00
Zach Morgan fcfbbffea2 fixing construction with the toolset bionic. 2013-02-25 22:06:31 -05:00
Zach Morgan a2e0134127 During part installation, account for the fact
that the inventory system is slightly stupid wrt wielded items.
2013-02-25 17:06:20 -05:00
TheDarklingWolf 6a33c12182 Tapeable windows, even when it would be redundant to do so 2013-02-25 17:45:56 +00:00
TheDarklingWolf 4ea120c8bb Domestic windows now require and output the correct materials. 2013-02-25 17:06:22 +00:00
TheDarklingWolf b8b7bf9929 Disassembled with AT_NULL no longer generate charges of none. 2013-02-25 16:53:25 +00:00
Kyratzes Talvadore 19b683d5a7 Merge pull request #111 from OzoneH3/master
Resize Inventory/Drop/Compare screen with VIEWX/VIEWY changes
2013-02-25 08:31:42 -08:00
OzoneH3 0726226ca0 Boost list_items range if VIEWX/VIEWY > 12/12 2013-02-25 15:02:33 +01:00
OzoneH3 7e56bb3242 More fixing, clear all lines on page chage 2013-02-25 14:07:50 +01:00
OzoneH3 bd5a1c0419 New window width fix 2013-02-25 13:48:10 +01:00
OzoneH3 ee68fcbbeb Resize Inventory/Drop/Compare screen with VIEWX/VIEWY changes 2013-02-25 13:43:37 +01:00
OzoneH3 35970d6329 Fix: Move furniture to strange places 2013-02-25 11:06:22 +01:00
Owen Diamond 281a7c0a5d Temp adjustments 2013-02-24 21:19:54 -06:00
Owen Diamond 65ab22db41 Temp Status 2013-02-24 21:12:45 -06:00
Kevin Granade b3e95e73a4 Clean up draw artifacts when displaying overmap. 2013-02-24 20:56:16 -06:00
Kevin Granade 2ed36683b5 Swap human flesh and wild veggie order so you don't get human flesh from bushes and veggies from corpses. 2013-02-24 20:09:57 -06:00
Kevin Granade 03c18caee5 Indentation cleanup. 2013-02-24 19:32:31 -06:00
Kevin Granade 5effecdd88 Cleanup trailing whitespace, again. 2013-02-24 19:32:31 -06:00
origamiwolf 9276ebf88b Added foraging for wild vegetables, results depends on survival skill
Conflicts:

	README.md
	itype.h
	pldata.h
2013-02-24 19:32:31 -06:00
origamiwolf 1dd43f8d66 Added apple trees and blueberry bushes
Removed electrohack check if ID card is used

Conflicts:

	README.md
	game.cpp
	mapdata.h
2013-02-24 19:32:31 -06:00
Zach Morgan 89c0e31cfb Fixing some tutorial mode instability, where it
spewed scent crap before crashing when player 'Q'uit.
2013-02-24 19:21:51 -05:00
TheDarklingWolf 5934e05df7 Palisade walls and gates 2013-02-24 23:14:36 +00:00
TheDarklingWolf d08dad61ed Make rucksacks spawn in milsurp stores 2013-02-24 22:10:25 +00:00
TheDarklingWolf 04548af0c2 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-24 22:07:57 +00:00
TheDarklingWolf c931f95b33 Log walls, and some fixes for FEMA camps 2013-02-24 22:07:29 +00:00
Zach Morgan 1c3eac3854 reset mapbuffer for real this time 2013-02-24 15:43:32 -05:00
Zach Morgan bc9255890f Reset the mapbuffer on new world. 2013-02-24 15:31:36 -05:00
Kevin Granade 454265f935 Update mon_info() to incorporate view shifting into determination. 2013-02-24 13:29:18 -06:00
Kevin Granade 403bcdc2a1 Update mon_info() to handle VIEWX and VIEWY being different values. 2013-02-24 13:25:27 -06:00
Kevin Granade e1ef05fb71 Word-wrapped option menu entries to fit on the screen at a minimal screen size. 2013-02-24 11:20:47 -06:00
Shoes01 18e44e28c4 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-02-24 08:13:58 -08:00
Kyratzes Talvadore 6e46b9425c Merge pull request #103 from Voker57/tweaks
Make metabolic exchange a little faster
2013-02-24 02:46:00 -08:00
Kyratzes Talvadore 826a3b8516 Merge pull request #102 from Voker57/fixes
Allow deconstructing curtainless windows
2013-02-24 02:44:15 -08:00
Voker57 2ae2883366 Make metabolic exchange a little faster 2013-02-24 14:44:01 +04:00
Kyratzes Talvadore 986ab209b8 Merge pull request #101 from OzoneH3/master
List Items: Filter multiple items, seperate with ','
2013-02-24 02:41:59 -08:00
Voker57 4edd189405 Allow deconstructing curtainless windows 2013-02-24 14:41:35 +04:00
OzoneH3 0d024a56b8 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-24 11:38:05 +01:00
Kyratzes Talvadore 60b16b5ff3 Merge pull request #100 from BurnZeZ/master
Quick fix for a missed var last pull request.
2013-02-24 02:20:09 -08:00
BurnZeZ 75d30ac349 Missed a window size value during last changes. 2013-02-24 05:11:22 -05:00
Zach Morgan 3cad6857f5 typo fix: Youe -> Your 2013-02-24 04:46:09 -05:00
OzoneH3 b026f450d9 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-24 10:25:49 +01:00
Shoes01 9ca4e46593 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-02-24 01:23:51 -08:00
OzoneH3 b983c7c587 List Items: Filter multiple items, seperate with ',' 2013-02-24 10:22:25 +01:00
Kevin Granade df8740481e Merge pull request #99 from BurnZeZ/bugfixes
Re-implementing proper window defaults due to ...
2013-02-23 22:02:24 -08:00
Kevin Granade 9eab1abf40 Merge pull request #96 from Oddzball/LMOECabinMerge
Windows Scaleable view fix
2013-02-23 21:26:38 -08:00
Kevin Granade 5add54c437 Make overmap display dynamicly sized based on configured terrain view size. 2013-02-23 23:16:15 -06:00
Owen Diamond 0f0da70f13 Windows scalable viewport attempt 4 2013-02-23 19:52:25 -07:00
Owen Diamond 643345a914 Windows scalable size attempt 3 2013-02-23 19:47:01 -07:00
Owen Diamond 08ab4bc598 Oops, fixed typo/space out. 2013-02-23 19:29:49 -07:00
Owen Diamond 5837fc0eea Window Fix test default 2013-02-23 19:23:31 -07:00
Owen Diamond 83f1ced9d7 Windows Fix attempt 2 2013-02-23 19:07:45 -07:00
Owen Diamond 46dbec0ae6 Revert "Fix for windows adjustable view size"
This reverts commit cfe3bf0701.
2013-02-23 18:58:13 -07:00
BurnZeZ 522f8f2f3b Re-implementing proper window defaults due to ba34a04979 allowing it. 2013-02-23 20:44:21 -05:00
Owen Diamond ba45e06bae included options.h in catacurse for windows 2013-02-23 18:43:03 -07:00
Owen Diamond cfe3bf0701 Fix for windows adjustable view size 2013-02-23 18:38:01 -07:00
Kevin Granade 49c513e2f8 Make position of view items window dynamic based on terrain window size. 2013-02-23 19:22:42 -06:00
Kevin Granade 54a979833c Revert SEEX->VIEWX change in resonance cascade, which has nothing to do with view distance. 2013-02-23 19:12:06 -06:00
Oddzball 9cbffdf09a Merge pull request #6 from TheDarklingWolf/master
Rebase for compile test
2013-02-23 17:09:43 -08:00
Kevin Granade a2d7228244 Merge pull request #94 from BurnZeZ/master
Add options to allow terrain window resizing
2013-02-23 17:03:33 -08:00
BurnZeZ 6e1a45d897 Merge pull request #1 from BurnZeZ/catacurses_fixup
Catacurses fixup
2013-02-23 16:57:45 -08:00
Oddzball 35915b8f3e Merge pull request #5 from TheDarklingWolf/master
Baseline with DDA
2013-02-23 16:54:22 -08:00
Kevin Granade db7c4c9bbd Suppliment a help entry with information on the new item comparison menu. 2013-02-23 18:46:24 -06:00
BurnZeZ ba34a04979 Fixed the window size options to more accurately represent the actual numbers.
Fixed a typo in the tutorial text.
2013-02-23 19:23:30 -05:00
Kevin Granade 3ac362b99f Add an entry for new view-related commands. 2013-02-23 18:12:59 -06:00
BurnZeZ 5801dfee6f Removed _maxx/_maxy from catacurse.h WINDOW, as generic curses functions to access them are already defined.
Fixed areas that relied on this.
2013-02-23 18:14:02 -05:00
Zach Morgan 06c158e2ee small help changes, related to bionics & NPCs. 2013-02-23 18:00:53 -05:00
BurnZeZ 97c273ab81 Hackish fix for undefined viewport size when it's not in options.txt 2013-02-23 17:41:19 -05:00
Kevin Granade a44cf5c204 Make lava increase body temperature when nearby as if it were fire. 2013-02-23 16:41:15 -06:00
Kevin Granade 6daf131baa Generate lightmap in target() to avoid using stale one. 2013-02-23 15:49:38 -06:00
BurnZeZ ba795cd153 Cleaned up redundant #defines. 2013-02-23 15:39:35 -05:00
Zach Morgan e729e818d8 reset gamemode after the game ends,
so that defense mode doesn't continue into normal game
2013-02-23 15:22:01 -05:00
Shoes01 1f9907e39e Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-02-23 12:09:52 -08:00
BurnZeZ dca4aeae2f Fix retarded assignment to non-existent variables from last commit. 2013-02-23 12:58:20 -05:00
BurnZeZ dac4a0eb11 Hotfix: Compiling on windows failing due to mismatched variable names in the windows curses header. 2013-02-23 12:31:11 -05:00
Shoes01 76f7493899 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-02-23 07:25:50 -08:00
TheDarklingWolf a871bde0d6 Autosave now adds a message when saving. 2013-02-23 15:19:33 +00:00
BurnZeZ ca1187f4a7 Fixed a typo and some formatting. 2013-02-23 03:26:35 -05:00
BurnZeZ 9055a9bff2 Added options to control terrain window size, replacing the makefile method.
Replaced VIEWX/Y defines with int Game::VIEWX/Y.
Began taking steps to replace VIEWX/Y with variables from the interacted window. This will allow proper dynamic sizing in the future.
2013-02-23 03:26:35 -05:00
Kevin Granade 1aed5e12a7 Add FEMA camp radio broadcast. 2013-02-23 00:39:25 -06:00
Kevin Granade acdbdae3ad Change place_radios to a switch statement to accomodate more entries neatly. 2013-02-22 23:51:37 -06:00
Owen Diamond aecb06bdb9 FemaCampDDAMerge 2013-02-22 23:17:39 -06:00
Owen Diamond ea78391e80 FemaCampDDAMerge 2013-02-22 22:13:58 -07:00
Kevin Granade 5cf6e985c2 Purge Oddzball notes to self. 2013-02-22 23:01:22 -06:00
Owen Diamond 04cf39ef6f Added random cougar attack in wilderness area.
Conflicts:

	mapdata.h
	mapgen.cpp
	omdata.h
2013-02-22 22:58:16 -06:00
Kevin Granade 00ab00c6c5 Add coordinates to some radio stations. 2013-02-22 22:33:22 -06:00
Kevin Granade 5b2ed65ca6 Add radio beacon to LMOE shelters. 2013-02-22 21:54:11 -06:00
BurnZeZ c8d6cf99e7 Added vikeys to the "List nearby items" window. 2013-02-22 22:29:57 -05:00
Kevin Granade 7a0af03703 Don't use blinking colors, ever. 2013-02-22 21:17:59 -06:00
BurnZeZ 8a401b0f92 Made changes to allow resizing the ingame viewport.
Added a couple lines to the Makefile where the desired size can be set.
2013-02-22 22:02:32 -05:00
Shoes01 85b3b8e871 Added player complaints due to heat 2013-02-22 18:54:32 -08:00
Zach Morgan 2dd6e15f44 implemented a word rewrapper,
so that it looks less terrible using the same descriptions
for bionics & CBMs
2013-02-22 21:25:25 -05:00
Kevin Granade 256e301238 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into merge_LMOA 2013-02-22 20:02:08 -06:00
Owen Diamond 016b972009 LMOE and Cabins 2013-02-22 18:00:52 -07:00
Zach Morgan 44e9a6ad7a Done splitting bionics.
Batteries are still the only special case.
2013-02-22 18:30:07 -05:00
Zach Morgan 411c28dbfa more splittage. 4 combined modules remaining. 2013-02-22 18:30:07 -05:00
Zach Morgan 246d00aca3 splitting a few more bionics 2013-02-22 18:30:06 -05:00
Zach Morgan bc323490c8 more bionic splits: neuro & sensory 2013-02-22 18:30:06 -05:00
Zach Morgan 06523f22f0 split tools bionics. 2013-02-22 18:30:06 -05:00
Zach Morgan fe840cb33e new little macro for single bionics category. 2013-02-22 18:30:06 -05:00
Zach Morgan 3d90ba774b split up CBM: power sources into 5 CBM's 2013-02-22 18:30:06 -05:00
TheDarklingWolf addb67b951 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-22 19:50:22 +00:00
TheDarklingWolf 6acd3aa389 Balaclavas are no longer sweet filo pastry dishes 2013-02-22 19:49:43 +00:00
Kyratzes Talvadore f3ae1ad0e7 Merge pull request #89 from OzoneH3/master
Item List added filter option
2013-02-22 11:31:24 -08:00
OzoneH3 11322a02ac Item List, exclude items with (minus) -item 2013-02-22 19:17:58 +01:00
OzoneH3 e61a9f11b3 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-22 18:59:11 +01:00
OzoneH3 ba7321fcf5 Item List added filter option 2013-02-22 18:58:12 +01:00
TheDarklingWolf 32400248f1 Added some more furniture to move prompt. Changed some colours up. 2013-02-22 17:27:47 +00:00
Kevin Granade efd1f174fd Destroy trailing whitespace. 2013-02-21 23:58:02 -06:00
Kevin Granade ed36ffd43b Merge branch 'Shoes01-master' into dda-master
Conflicts:
	player.cpp
2013-02-21 23:43:23 -06:00
Shoes01 3b2d7568d5 Cleared up some confusion regarding bodywetness 2013-02-21 22:13:03 -08:00
Shoes01 ec6c3b8c51 Layering no longer takes into account 5 items considered under-garements 2013-02-21 21:59:03 -08:00
Shoes01 810a2bce9f Added a layer check for specific under-garment items not to count towards encumbrance 2013-02-21 21:02:56 -08:00
Shoes01 3ccc822df6 Merge branch 'master' of github.com:Shoes01/Cataclysm-DDA 2013-02-21 20:13:46 -08:00
Kevin Granade 25e6e8cba7 Merge pull request #88 from OzoneH3/master
Some updates, see description
2013-02-21 18:04:25 -08:00
Shoes01 000be1da4b Modify footwear check to allow wearing socks while still forbidding doubling up on footwear. Thanks kevingranade 2013-02-21 19:15:12 -04:00
OzoneH3 bcfdb078bd Better check to find out if pos(x,y) is indoors.
Fixes opening windows while not standing on a floor tile.
2013-02-21 23:35:29 +01:00
OzoneH3 5a346f3d59 Show percentage of current skill when learning from a book.
You learn a little about first aid! (76%)
2013-02-21 20:09:05 +01:00
OzoneH3 f1bfdbf5c4 Move furniture: Removed container check -> items will move with bookshelvs/tables/chairs/... 2013-02-21 18:17:08 +01:00
OzoneH3 c1c7b751c9 Move furniture: Move all items within a container. 2013-02-21 16:56:29 +01:00
OzoneH3 933229d750 Made some of the new house interior smashable
t_sink
t_bathtub
t_bookcase
t_pool_table
t_counter
t_table
2013-02-21 16:24:00 +01:00
OzoneH3 9df6f0b7e2 Add: Catch CTRL+C and ask the player if he really wants to quit without saving. (Linux only) 2013-02-21 15:34:33 +01:00
OzoneH3 15b8d907c1 Improved Encumberance section on player info screen
Torso: (3)  2+1= 3  (75)
Arms:  (2)  2+2= 4  (60)

Bodypart: (Layers of cloth)  Cloth encumb + Layer/Overweight penalty = Total encumb  (Warmth)
2013-02-21 15:03:58 +01:00
Zach Morgan e87b72d3be bigness transfer fix
when installing part from inventory
2013-02-21 08:57:43 -05:00
Shoes01 5758539e48 Merge remote-tracking branch 'origin/master' 2013-02-20 20:19:27 -08:00
Shoes01 87e6645582 Added more items and tweaked warmth values to reflect new calculations 2013-02-20 20:10:30 -08:00
Shoes01 35d3a9624f Added more items and tweaked warmth values to reflect new calculations 2013-02-20 20:02:42 -08:00
Shoes01 30b57b7b51 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-02-20 21:26:32 -04:00
Shoes01 ba6a0c83c6 Finally fixed bodytemp morale code 2013-02-20 21:23:58 -04:00
Shoes01 6bdd334a12 Fixed some copy pasting errors 2013-02-20 20:29:31 -04:00
Kevin Granade 6b51d1bb33 Wrap code to delete save files in game::delete_save(). 2013-02-20 17:54:50 -06:00
Kevin Granade a106ebcc24 mend 2013-02-20 17:54:50 -06:00
Kevin Granade b462d3f968 Experimental code to replace system() call to delete save directory with system calls on windows. 2013-02-20 17:54:50 -06:00
Kevin Granade a204b7834d Replace system() call for deleting save files on linux with opendir/readdir/unlink/closedir loop. 2013-02-20 17:54:50 -06:00
Shoes01 6f24e400b6 Added elaboration of expectations of bodytemp system, and tweaked the calculation to match 2013-02-20 19:08:27 -04:00
TheDarklingWolf fb077c5077 Changed curtains to more general purpose sheets, modified some crafting 2013-02-20 22:39:07 +00:00
TheDarklingWolf ca374fcde8 A few more deconstructable terrain pieces 2013-02-20 22:21:57 +00:00
Shoes01 e9820e4347 Tweaked warmth in boots, fixed a comment 2013-02-20 18:21:37 -04:00
Owen Diamond a80e738c6a not so retarded colors. Brown is BROWN :P 2013-02-20 22:11:52 +00:00
Kyratzes Talvadore bd262995d5 Merge pull request #79 from Voker57/reading
Allow reading fun books even when morale is low
2013-02-20 07:02:55 -08:00
Voker57 09e64565b2 Allow reading fun books even when morale is low 2013-02-20 08:26:44 +04:00
Kevin Granade d7ee55c8ad Update some draw code to work with view shifting. 2013-02-19 20:31:42 -06:00
TheDarklingWolf 37c1d95c58 Fixed fix for combat knives. Now actually fixes the problem instead of preventing compiling. 2013-02-19 21:21:24 +00:00
TheDarklingWolf eb3e2c7b4c Fixed other instance of rnd, also fixed combat knives being eaten by wood carving 2013-02-19 21:17:16 +00:00
TheDarklingWolf ba3513d4b3 Made Sharp & Rough terrain less dangerous to mobs 2013-02-19 20:30:46 +00:00
Kyratzes Talvadore 4655a4807d Fixed small error 2013-02-19 19:30:07 +00:00
Kyratzes Talvadore 45388eccea Merge pull request #78 from uzername/master
More furniture to regular houses: kitchen and living room
2013-02-19 11:29:05 -08:00
uzername cef3ec452c kitchen and living room furniture 2013-02-19 21:19:35 +02:00
Zach Morgan dc049d7384 fixing odds of bounce in veh-body collision 2013-02-19 11:13:43 -05:00
Zach Morgan 3f6dbbf3c6 better veh-veh. again. 2013-02-19 09:56:13 -05:00
Kyratzes Talvadore a4913dd1e3 Merge pull request #75 from uzername/master
Some embellishments to the regular houses.
2013-02-19 04:13:40 -08:00
Zach Morgan f7f916df19 more of a collision resolution system.
Still not perfect. wrote a class, rl_vec2d, for roguelike vectors where
rl dist is used instead of pythagorean.
2013-02-18 19:15:02 -05:00
uzername cf717f7c06 Some embellishments to the house 2013-02-18 23:33:18 +02:00
Zach Morgan 9ca7b646de partial fix for overly fun veh-veh happenings
After collision, normalize remaining time to move. This mostly prevents
another collision happening immediately afterwards, which had inverted the
resulting velocity due to an inverted normalized blah blah blah.
2013-02-18 14:09:27 -05:00
Zach Morgan d7aff3108c bounds checking before displace_vehicle,
stops vehicle & warns if somehow out of bounds.
2013-02-18 14:09:27 -05:00
Zach Morgan 31209a09c7 rl_dist() correct usage 2013-02-18 14:09:27 -05:00
Zach Morgan 24c688a00a Added a game message for veh-veh collisions. 2013-02-18 14:09:27 -05:00
Shoes01 094a3d95f6 Added warmth items 2013-02-18 15:00:58 -04:00
Shoes01 f2f4febc2d Moved bodytemp equalizer code 2013-02-18 14:37:11 -04:00
Kevin Granade d23ef6b761 Merge pull request #74 from uzername/master
Some new information to developer's FAQ. That's my pull request.
2013-02-18 09:50:29 -08:00
uzername 0c670e8f36 New information into a developer FAQ 2013-02-18 19:34:00 +02:00
Kevin Granade 3adf2e4dba Give rags a minimal volume and weight. Thanks Shoes. 2013-02-17 14:12:06 -06:00
Kevin Granade d6c08b678f Make game::player_can_build() return true if any stage can be built by default. 2013-02-17 14:06:29 -06:00
Kevin Granade 9d4a1f210b Reset has_tool and has_component at start of loop so all tools/components are checked. 2013-02-17 14:03:20 -06:00
Shoes01 52e818d744 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA
Conflicts:
	disease.cpp
	game.cpp
	itypedef.cpp
	player.cpp
2013-02-17 15:30:50 -04:00
Kevin Granade 00a162350d Prevent molotovs from shattering themselves and causing a segfault if they explode in bashable terrain. Reported by hkwh01. 2013-02-17 12:15:06 -06:00
Shoes01 293656a980 Added new items, messages, and made some fixes 2013-02-17 11:10:20 -04:00
Kevin Granade 9dd45220d9 Update hallucinate to stay centered on the current view. 2013-02-16 23:47:01 -06:00
Kevin Granade 39fac67b86 Massively reduce the chance of eye, mouth, and head shots. Thanks to AnderHammer for pointing it out. 2013-02-16 20:44:17 -06:00
Kevin Granade 37b139253f Merge code to open/close barn doors and garage gates and clean it up soon. 2013-02-16 14:32:49 -06:00
Owen Diamond 0084768b34 Add explanation of zombie spawns from IRC. 2013-02-15 23:10:32 -06:00
Owen Diamond 9b1c1ccfc2 Increase contrast of colors for selecting traits. 2013-02-15 23:10:19 -06:00
Owen Diamond 2ffcc5c0d0 Add spawns of corn and corn husks. 2013-02-15 23:10:06 -06:00
Owen Diamond 15872638bc Add farm submap group. 2013-02-15 23:09:47 -06:00
Owen Diamond 58f5f94a46 Add dirt lot submap. 2013-02-15 22:33:28 -06:00
Owen Diamond f1585f5657 Added indoor dirt floor and hay terrain tiles. 2013-02-15 22:29:38 -06:00
Owen Diamond 9403f7a771 Add wooden gate and barn door. 2013-02-15 22:09:23 -06:00
Kevin Granade e848b49224 Indentation fixup. 2013-02-15 21:56:12 -06:00
Owen Diamond 51511d6d0d Added corn and withered plant for farm. 2013-02-15 20:23:37 -06:00
Kevin Granade 5d1a577bca Block radiant effect of fires if line of sight to them is blocked. 2013-02-15 19:24:41 -06:00
Zach Morgan 155d247c94 making charge rifle unwielding thing be less
of a special case and more boring.
2013-02-15 17:51:02 -05:00
TheDarklingWolf 1172657cce Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-15 19:21:11 +00:00
TheDarklingWolf db6a446ddf Fixed some typos, added a message for engine damage 2013-02-15 19:20:30 +00:00
Kyratzes Talvadore abc9dadfef Some typo fixes, pointed out by James Benson 2013-02-15 18:10:46 +00:00
Shoes01 3b0c733fe5 Modtemp morale, frostbite, temp calculation updates 2013-02-15 07:13:43 -04:00
Zach Morgan b921769d38 deactivate charge rifle when you unwield it.
thanks Griffinhart.
2013-02-15 05:17:37 -05:00
Zach Morgan cf5fedf6d7 Charge weapon fake ammo fix. Thanks, Griffinhart. 2013-02-15 03:37:49 -05:00
Zach Morgan c09d2a8206 better veh submerge criteria. 2013-02-14 22:47:30 -05:00
Zach Morgan d3070f82b8 fixing a couple nasty bugs in tileray and
displace_vehicle. using fabs instead of abs to normalize floats.
So vehicles no longer go insane when you run into them :)

That's not to say that weird things don't currently happen.
2013-02-14 22:47:30 -05:00
Zach Morgan 27081a318d reverting veh inbounds 'fix' 2013-02-14 22:47:30 -05:00
Zach Morgan c30365023d weeeeird vehmove vector normalization taking place 2013-02-14 22:47:30 -05:00
Zach Morgan 73e5fa090b removing a comment & an unreachable block 2013-02-14 22:47:30 -05:00
Zach Morgan da88ee5fc0 modeling apocalyptic vehicle collisions with a
horrifying mixture of roguelike dynamics, bad physics, roguelike
geometry, and trigonometry.

still no vehicle damage.
2013-02-14 22:47:30 -05:00
Zach Morgan ae61625d63 fixing previous nerf to reverse thrusting. 2013-02-14 22:47:29 -05:00
Zach Morgan ef649a6bbe making vehicle collisions slightly less ridiculous
hitting a bicycle with a cargo truck will make both vehs move
simultaneously. currently it just will move forward instead
of conserving momentum.

no damage involved yet.
2013-02-14 22:47:29 -05:00
Zach Morgan 9207082540 nerfing initial reverse thrust.
braking was confused with thrust because thrust dir
wasn't as negative as 0.

This goes as far as to make reverse less powerful than forward accel.

Also tweaking stoppage threshold so that bicycles can go in reverse.
2013-02-14 22:47:29 -05:00
Zach Morgan 7b404822fd mechanism for vehicles to carry leftover
vehproceed time to the next turn.
2013-02-14 22:47:29 -05:00
Zach Morgan f26cf8768c removing vehicle 'moves',
vehicles' of_turn  property replaces it,
 which tracks time instead of distance
2013-02-14 22:47:29 -05:00
Zach Morgan 62457c6934 nothing really, a target & subtarget entry for
collision structs, but nothing's done with it yet.
2013-02-14 22:47:29 -05:00
Zach Morgan cd8914571a more refactoring
an enum for collision types, and a collision struct.
2013-02-14 22:47:29 -05:00
Zach Morgan 497b2fd006 more vehmove refactoring.
it's now the case that veh movement is
 sort of handled in parallel.
Too bad you hardly ever see multiple
 vehicles moving at once. (so far...)
2013-02-14 22:47:29 -05:00
Zach Morgan b35f85ac30 made wrapped_vehicles aware of submap.
used get_vehicles to de-indent a couple levels of vehmove.
2013-02-14 22:47:29 -05:00
Zach Morgan 0c2288fe9a overhaul checkpoint:
map::get_vehicles() with no args now gets all vehs.
vehmove() using get_vehicles() instead of iterating over each submap.
commented code for me to refer to and you to be anoyed by.
2013-02-14 22:47:29 -05:00
Zach Morgan bd68d058d1 reworking wrapped_vehicle
to not use a more generic superclass, because i don't
intend to refer to a vehicle as an 'item'
2013-02-14 22:47:29 -05:00
Zach Morgan 0de4433ee2 another functionally identical change,
adding of_turn to vehicles, to indicate how much
of their per-turn travel remains.
2013-02-14 22:47:29 -05:00
Zach Morgan 42c031e651 formatting map::vehmove() so that i can read it
before taking a stab at rewriting it.
2013-02-14 22:47:29 -05:00
Kevin Granade 9ae79f711c Remove some tabs. 2013-02-14 21:32:32 -06:00
Kevin Granade 892ec0139b Normalize body temperature if you have a controlled climate bionic. 2013-02-14 21:29:12 -06:00
Kevin Granade 15dd7f97c9 Merge pull request #66 from OzoneH3/master
Update: Item list, press I to compare with inventory
2013-02-14 18:03:49 -08:00
OzoneH3 0307f7cda4 Update: Item list, press I to compare with inventory 2013-02-15 00:50:53 +01:00
TheDarklingWolf ab250ec5a3 Added a bunch of dumb jokes 2013-02-14 20:59:34 +00:00
TheDarklingWolf 1dd6349c80 Added missing files to cbp 2013-02-14 19:40:05 +00:00
Kyratzes Talvadore 83916fc982 Merge pull request #62 from OzoneH3/master
Update: List items, remove dups and display enhancement
2013-02-14 11:05:20 -08:00
OzoneH3 7d613b17b9 Bugfix 2013-02-14 19:04:26 +01:00
OzoneH3 1f797d2b83 Update: List items, remove duplicate items on same stack
Show current item number / Total items
Display direction and distance to item
2013-02-14 18:56:39 +01:00
Zach Morgan 776d8976da Map grid segfault fix in map::displace_vehicle 2013-02-14 06:54:46 -05:00
Kevin Granade 71a02a0730 Adjust misfire chance based on weapon durability. 2013-02-13 22:00:12 -06:00
Zach Morgan cbb62cf4f1 disambiguate 2 pairs of overmap symbols
Pawn shop and Military surplus stores looked identical.
Banks and garages also look identical.

I don't know the best solution. What i do know is that orientation for
banks doesn't matter, and Oddzball probably had the right idea when he
used '$' for banks.

Because they have multiple entrances, orientation for garages probably
matters less than surplus stores, and you're likely looting garages if
you want a vehicle, so I am replacing <>V^ for garages
with 'O', which is what lots use.

pawn shops: <>^V grey
surplus: <>^V bold white
banks: $ grey
garages: O bold white
2013-02-13 19:44:22 -05:00
Kevin Granade a6bd9225d7 Update mapdata.h
Allow item spawns in refrigerators.
2013-02-13 16:30:54 -06:00
Zach Morgan 78cf1da87f Merge pull request #60 from hovatterz/spelling
Fix spelling issue when eating Royal Jelly
2013-02-13 14:18:26 -08:00
Kevin Granade 9749eb941b Update mapdata.h
Fix definition of stairs broken in bc8a7077ff.
2013-02-13 16:01:15 -06:00
Zack Hovatter a8b7f2e6e5 Fix spelling issue when eating Royal Jelly 2013-02-13 15:40:16 -05:00
Kevin Granade 05cfb3d2ad Update game.cpp
Prevent player from boarding a seat that has items in it.
2013-02-13 13:41:06 -06:00
Kevin Granade 3e7f30ce59 Update veh_type.h
Allow stashing items on a vehicle seat or bed.
2013-02-13 13:05:10 -06:00
TheDarklingWolf 0e7af62dbc Made items visible in cloning vats 2013-02-13 15:36:41 +00:00
Zach Morgan fee83cadec Removing seatbelt from quadbike.
These things were way too safe :)
2013-02-13 04:09:58 -05:00
Kevin Granade 3644e06f78 Don't highlight terrain with items in it if the terrain is a container. 2013-02-13 00:33:21 -06:00
Kevin Granade d0663918a1 Make a new glass-doored fridge so you can see its contents in convinience stores. 2013-02-13 00:33:21 -06:00
Kevin Granade db306da05f Block visibility of items in container type terrain. 2013-02-13 00:33:21 -06:00
Kevin Granade 557d40b9e6 Hide items in containers from list items menu. 2013-02-13 00:33:21 -06:00
Kevin Granade bc8a7077ff Fork off place_item terrain flag from container flag so container can just be item visibility. 2013-02-13 00:33:21 -06:00
Zach Morgan e6d1cf9b14 vehicle partname for non-gas motors.
reported by kevin
2013-02-13 00:35:25 -05:00
Zach Morgan 0ac6411c28 fixing order of vehicle types
so that motorcycle chassis stop spawning in parking lots.
2013-02-12 22:37:58 -05:00
Shoes01 235ce4c0b6 Bodytemp morale penalty and calculation adjusted
cherry-picked from shoes/foo

Conflicts:

	game.cpp
2013-02-12 20:40:08 -05:00
Shoes01 79f839d270 Bodytemp morale penalty and calculation adjusted 2013-02-12 21:10:56 -04:00
Zach Morgan b6214956e4 double the road-river-overmap bounds checking
because apparently bridges to nowhere can go west or north as well.
2013-02-12 18:32:46 -05:00
Kyratzes Talvadore 3d9c70e20b Merge pull request #57 from OzoneH3/master
Added: List items on the ground around player
2013-02-12 15:23:37 -08:00
OzoneH3 dec7b592ff Added: List items on the ground around player
Scroll through the list to see a line indicating
where the item is. Keybinding: V
2013-02-13 01:20:55 +01:00
TheDarklingWolf a907cc609b Fixed errors in deconstruction 2013-02-12 15:47:53 +00:00
TheDarklingWolf 2bfe0a3f52 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-12 14:04:57 +00:00
TheDarklingWolf c0cd01c769 Fixed some weirdness with item outputs from disassembled/destroyed items
Removing window panes is now handled via deconstruct furniture option
2013-02-12 14:04:10 +00:00
Kyratzes Talvadore cd2fec3d42 Merge pull request #55 from OzoneH3/master
Update: Compare items with color highlighting
2013-02-12 05:28:05 -08:00
Zach Morgan 827da1aad0 welp, another fix for the same
little bridge-river-overmap thing.
2013-02-12 03:05:24 -05:00
Zach Morgan d068516cca fix vehicles spawning in garages 2013-02-11 18:29:27 -05:00
OzoneH3 0b1291995e Updated compare items with colore highlighting
Better item stats are colored green, worse
stats are colored red.
2013-02-11 22:01:37 +01:00
TheDarklingWolf ded5eb0909 Added a small comment documenting the previous change 2013-02-11 16:32:24 +00:00
TheDarklingWolf cb99fb5ec1 Removed sewage from checks for water.
Reduced check for overeating from 15 to 5
2013-02-11 16:27:48 +00:00
TheDarklingWolf 2628ac1cac Made leather trenchcoat warmth the same as leather jackets.
Fixed slight oversight with warmth checking in weather.cpp and modified tent colour to stand out more against
forest
2013-02-11 16:21:10 +00:00
Zach Morgan 1c8c23132d Making vehicles a bit more common.
justification: If players really want a vehicle in their initial small
town, it shouldn't be too hard to find one. They've been downgraded, and
probably half of them work now anyways.
(By design. Program-wise, they seem very stable now.)
2013-02-11 04:49:55 -05:00
Zach Morgan 23ccbcf889 Fixing place_cities()'s notworkingness, for the most part.
Includes tweaks to make somewhat smaller cities, however now they're
not all clumped into one in a restricted section of the overmap.

This includes some of Oddzball's overmapgen tweaks, but it doesn't go as
far.
https://github.com/Oddzball/Cataclysm-CZS/compare/5da2505...c0ec9b18a93acef633f070ee9111e7d5ba1fada3
2013-02-11 02:06:24 -05:00
Kevin Granade cfa135e7d7 Make blood-soaked rags red. 2013-02-10 20:23:59 -06:00
Kevin Granade 9e62f5a8da Make rags used to staunch bleeding bloody whether it works or not. 2013-02-10 20:20:45 -06:00
Kevin Granade d067e220c0 Fix a typo in new temperature code. 2013-02-10 18:02:20 -06:00
Shoes01 2495d16e1c Temperature mod clean up with a bit of polish. 2013-02-10 18:02:20 -06:00
Shoes01 9739983c6e Temperature mod in working state. Needs balance 2013-02-10 18:02:20 -06:00
Shoes01 08a9d5b258 Commiting changes from a merge 2013-02-10 19:37:10 -04:00
Kyratzes Talvadore 7775a650da Merge pull request #54 from OzoneH3/master
Fix Item compare. Don't display empty inv Headers
2013-02-10 15:28:23 -08:00
Shoes01 6fe46c31f5 Temperature mod clean up with a bit of polish. 2013-02-10 18:26:59 -04:00
Zach Morgan 9c887bfe8b random vehicle part sizes are more consistent.
also parts are given a bit of damage sometimes :)
2013-02-10 16:44:42 -05:00
Shoes01 0d2de85b74 Temperature mod in working state. Needs balance 2013-02-10 17:33:06 -04:00
Shoes01 cbdc176394 Temperature mod clean up with a bit of polish. 2013-02-10 17:06:06 -04:00
TheDarklingWolf 8e369176e7 Hopefully fixed windows compiling 2013-02-10 17:57:10 +00:00
TheDarklingWolf 325eec1586 Added resource.rc file 2013-02-10 17:33:42 +00:00
TheDarklingWolf 29703c79fc Made hardware stores with back lots more common 2013-02-10 17:21:19 +00:00
TheDarklingWolf 5afc5f34a0 Rags now get bloody when used to stop bleeding. Can be cleaned 2013-02-10 17:06:10 +00:00
Shoes01 2cbe9421ea Temperature mod in working state. Needs balance 2013-02-10 10:55:24 -04:00
TheDarklingWolf fc10e83386 Added PDA, currently doesn't spawn and acts only as a weak flashlight.
Plan a lot more for it in the future, probably start with ebook software.
2013-02-10 13:36:45 +00:00
OzoneH3 d60968d1b9 Fix Item compare don't display empty inv Headers 2013-02-10 14:31:42 +01:00
TheDarklingWolf 48428e0222 Replaced Whales' email in help.cpp with my own 2013-02-10 11:26:58 +00:00
TheDarklingWolf d969ad813a Modified main menu header 2013-02-10 11:25:35 +00:00
Kyratzes Talvadore 366dfa192f Merge pull request #53 from OzoneH3/master
Add compare items on the ground
2013-02-10 03:22:04 -08:00
OzoneH3 c2ceb8df06 Add compare items on the ground
Works like examine, choose a direction from where the
items on the ground should be read. Only one item per
name will be displayed. Max 10 Items. Select with 0-9.
2013-02-10 12:33:17 +01:00
Zach Morgan a1c7621ba2 better part/item property transfer. Also works now 2013-02-10 03:48:13 -05:00
Zach Morgan 006f7fd769 misc tweaking for items w/ bigness.
Un-inverting damage persistence for removed parts.
enum for bigness aspect.
2013-02-10 01:59:55 -05:00
Kevin Granade cc817a906e Spawn blood on the ground when player bleeds. 2013-02-09 23:07:50 -06:00
Owen Diamond 6b3a02bcfc Introduce occasional gun missfires. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Owen Diamond 44bb0485de Make dogs get angry if you hurt them. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Owen Diamond 848b1196c4 Add cat definition, but no spawn yet. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Owen Diamond 3bfcb8d92f Add MF_BLEED flag to some monsters I missed while merging. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Owen Diamond a9f2ea76ed Add definition of cougar. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Owen Diamond 1bb82a3558 Add KEENNOSE monster ability and apply it to some monsters. Pulled from Oddzball's repo. 2013-02-09 22:46:54 -06:00
Kevin Granade 410b621ff1 Line break fixup. 2013-02-09 22:46:54 -06:00
Owen Diamond 3f8e3230fc Add some item spawns. Pulled from Oddzball's repo. 2013-02-09 22:45:22 -06:00
Owen Diamond 1b7afcd805 Add rucksack to appropriate item spawn lists. Pulled from Oddzball's repo. 2013-02-09 22:45:21 -06:00
Owen Diamond 67686a47bc Add rucksack item as the new biggest storage item, and push backpack and purse down a bit. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Owen Diamond 4737671203 Let bandages be used to stop bleeding. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Owen Diamond ae0727d23d Add function allowing rag to be used as an improvised bandage. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Owen Diamond 70d018ae12 Make rag a tool in preperation for allowing use as an improvised bandage. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Owen Diamond 9b13e7ddd9 Add monster ability to cause bleeding wounds. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Owen Diamond 9f6b949dd2 Add bleeding as a disease. Pulled from Oddzball's repo. 2013-02-09 22:41:15 -06:00
Zach Morgan 923d62f351 tweaking veh parts & symbols.
having bicycles use bicycle wheels
2013-02-09 19:37:29 -05:00
Zach Morgan ee4c311533 Merge remote-tracking branch 'dda/master' into bigness 2013-02-09 16:52:28 -05:00
Zach Morgan 4c85a1ecd7 A bit of a monster stumbling rewrite.
Stubling critters acquire a new post-stumble path
 rather than trying to acquire their pre-stumble path.
Also, hopefully the code is clearer.
Hopefully faster, too. I noticed that std::vectors in
 monster::stumble were becoming a bottleneck.
2013-02-09 16:19:58 -05:00
Kyratzes Talvadore ca210f6216 Update README.md 2013-02-09 17:32:34 +00:00
Zach Morgan ca58f05e96 Merge remote-tracking branch 'dda/master' into bigness 2013-02-09 12:13:38 -05:00
Kyratzes Talvadore 10118d7271 Merge pull request #52 from OzoneH3/master
Add side by side item comparison
2013-02-09 07:21:50 -08:00
Kyratzes Talvadore b762ce33a7 Merge pull request #51 from RWJMurphy/master
Re-add craftable 2x4s
2013-02-09 03:15:57 -08:00
Kyratzes Talvadore 4326c641f8 Merge pull request #50 from Voker57/toolsettweaks
Toolset tweaks
2013-02-09 03:15:20 -08:00
Reed Murphy 43356a1c2e Re-add craftable 2x4s
They appear to have been removed by commit
e1cd33ad51, possibly unintentionally?
2013-02-09 17:40:30 +11:00
Zach Morgan 15eee9cd6c wheel variety. 5 types, variable diameters,
and implemented traction stuff.
2013-02-09 01:20:26 -05:00
Kevin Granade 9b2701c579 Return bandages and first aid to inventory when they are applied to a limb to no effect. 2013-02-08 20:47:21 -06:00
OzoneH3 6724b2fc85 Add side by side item comparison
Select two items from an inventory like window.
Shows name, stats and text from both items on a
split screen.
2013-02-09 02:32:30 +01:00
Voker57 f7b9712ea9 Reduce toolset power drain when heating 2013-02-09 04:31:41 +04:00
Voker57 020892617d Weld steel plating with toolset 2013-02-09 04:31:41 +04:00
Voker57 299cea9f30 Reload ammo with heat from toolset 2013-02-09 04:31:41 +04:00
Voker57 2cdb56d170 Butcher with integrated toolset 2013-02-09 04:31:41 +04:00
Zach Morgan eb2e32bfa4 Merge pull request #47 from Voker57/water_crafting
Add water to crafting materials if near water source
2013-02-08 16:12:27 -08:00
Zach Morgan 071d4ea048 part_info().power going through part_power
this makes engines with bigness actually have variable power.

also, bumping bicycles. because it's not fair that they have the
same wheels that cars have.
2013-02-08 18:14:48 -05:00
Zach Morgan 77c63b2f47 Merge remote-tracking branch 'dda/master' into bigness
Conflicts:
	mapitemsdef.cpp
2013-02-08 17:11:14 -05:00
Zach Morgan a2b900f011 Initial rng '--seed' mechanism. From any string.
This only guarantees one sort of consistency: with the same input,
on the same system, and of course with the same character build,
on a new world, the state, including the overmap & starting location
should be identical.

good enough for benchmarking.
2013-02-08 15:12:16 -05:00
Zach Morgan d95b544c4c tweaking silo roomgen
to avoid single room being walled off from the rest.
2013-02-08 11:56:53 -05:00
Zach Morgan 3f48b4ccb9 sort of preserving veh part health
through remove & install processes.
2013-02-08 02:32:56 -05:00
Zach Morgan 1ee3538cc3 Merge pull request #48 from Voker57/mapitemsdef
Make reloading tools and vehicle essentials a bit more accessible
2013-02-07 23:32:13 -08:00
Zach Morgan 22b5ec129b fixing a misconception that i had about
% operator vs. negative numbers
2013-02-08 00:06:14 -05:00
Zach Morgan e9b0bad46f a copy/rewrite of consume_item for veh parts
this is to preserve some item properties while ignoring
the weird cases of consume_item.
2013-02-07 23:38:07 -05:00
Kevin Granade 9656fcf3fb Add default keybindings for cardinal view shifting commands. 2013-02-07 22:22:14 -06:00
Kevin Granade 325c3b2744 Add implementation for view shift commands. 2013-02-07 22:21:44 -06:00
Kevin Granade 1017958f6e Add new view shifting actions. 2013-02-07 22:21:11 -06:00
Kevin Granade 9552b51b5d Remove L as a default keybinding to free it up for view shifting. 2013-02-07 22:20:34 -06:00
Kevin Granade de863b7a9b Use new offset coordinates to adjust origin of normal draw() and look_around() operations. 2013-02-07 22:19:51 -06:00
Kevin Granade 784c608154 Add offset coordinate members to player class to support persistent view shifting. 2013-02-07 22:18:47 -06:00
Zach Morgan 6b514e246f Merge pull request #49 from hovatterz/reading-increase
Add message for skill increases while reading
2013-02-07 13:13:13 -08:00
Zack Hovatter 07ba88a989 Add message for skill increases while reading 2013-02-07 15:07:00 -06:00
Voker57 c79008f638 Make reloading tools and vehicle essentials a bit more accessible 2013-02-07 23:09:45 +04:00
Voker57 0484cd7f16 Add water to crafting materials if near water source 2013-02-07 22:46:38 +04:00
Zach Morgan 28babc916e making compile. 2013-02-07 13:28:54 -05:00
TheDarklingWolf 72da311a5f Untest 2013-02-07 18:06:01 +00:00
TheDarklingWolf a7f51a5c55 Testing stuff 2013-02-07 17:57:12 +00:00
Zach Morgan ca3b5a4ad7 Merge remote-tracking branch 'dda/master' into bigness 2013-02-07 12:54:38 -05:00
Zach Morgan 6bd0b00587 same deal for item types as the prev. commit.
mostly cosmetic. Also updating the struct name
it_veh_part -> it_var_veh_part
2013-02-07 12:35:47 -05:00
TheDarklingWolf 4cc077fbb6 Updated .cbp 2013-02-07 17:24:06 +00:00
Voker57 1b2e59894d Graffiti. 2013-02-07 21:14:13 +04:00
Zach Morgan 74638cf789 L instead of CC in veh part display
Also taking out long word 'combustion' from part name.
2013-02-07 11:05:46 -05:00
Zach Morgan 7868ba8b91 a bit of an engine mod
to increase variety in car parts. The new 'bigness' property is the
only one that's currently transferrable between car parts & items.
Yeah, there certainly needed to be another 'size' attribute. this one's
variable though, and can mean different things depending on context.
(plating thickness, cc of engine displacement, wheel radius, kilowatts,
etc.)

not ready yet. i just wanted to put what i had out there.
2013-02-07 10:12:34 -05:00
Kevin Granade 26459db720 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-06 22:58:37 -06:00
Kevin Granade 708523a5ff Remove redundant check for flamable clothing. 2013-02-06 22:33:40 -06:00
Kyratzes Talvadore e9aafd365b Merge pull request #43 from hovatterz/teaching
Fix NPC teaching
2013-02-06 12:50:57 -08:00
Zack Hovatter 4b5844037e Fix NPC teaching 2013-02-06 14:44:57 -06:00
Kyratzes Talvadore f4308f8dcb Merge pull request #42 from hovatterz/launcher
Add launcher for Linux/OS X users to double click
2013-02-06 11:28:47 -08:00
Kyratzes Talvadore 89f856d546 Merge pull request #41 from hovatterz/gitignore
Add bindist files to the .gitignore
2013-02-06 11:28:28 -08:00
Zack Hovatter a07858943a Add launcher for Linux/OS X users to double click 2013-02-06 13:01:05 -06:00
Zack Hovatter 3af7a751ee Add bindist files to the .gitignore 2013-02-06 13:00:10 -06:00
TheDarklingWolf 9eb9a6995c Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-06 11:55:11 +00:00
TheDarklingWolf 6bfc743bc2 Moved drugs that were in misc to chem section 2013-02-06 11:52:54 +00:00
Kevin Granade c4f7f2bdd6 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-05 22:23:40 -06:00
Kevin Granade 8bb22521d7 Initialize webs properly in mapgen. Avoids weird bug where fields stop updating if you burn the webs. 2013-02-05 22:23:30 -06:00
Zach Morgan 3630b6d79d Durr, even more overmap vs. river vs. bridge boundary checking
Dunno if bridges between overmaps should even be legal.
2013-02-05 19:49:35 -05:00
Zach Morgan a7143cd69e Boundary checking for bridges crossing overmap borders 2013-02-05 00:49:10 -05:00
Kevin Granade 28190a437d Replace bandages or first-aid in inventory if application is cancelled. 2013-02-04 21:16:07 -06:00
Kevin Granade 492d6e3e7e Switch uint32_t and int32_t to int to match rest of code and un-break code that allows signed skill levels. 2013-02-04 19:52:04 -06:00
TheDarklingWolf d26b1a8f2f And again, removed -x flags 2013-02-04 23:38:54 +00:00
TheDarklingWolf 9cceee1d79 Saved modified cbp 2013-02-04 23:37:55 +00:00
TheDarklingWolf c1afb564b8 Changed mode I think. 2013-02-04 23:32:39 +00:00
TheDarklingWolf 78eccaf7ed Added NPC nullification files, and icon files 2013-02-04 23:30:15 +00:00
Zach Morgan e8b4d2d9f8 rewrite of overmap::find_closest.
this thing was an npc stumbling block because
it didn't scan everything and was so slow.
2013-02-04 17:10:59 -05:00
Zach Morgan 16c79ac3e3 vehicles moving faster are now animated faster.
whee!
2013-02-04 10:11:52 -05:00
Kevin Granade b294657ca9 Prevent illegal dereference of index when doing a tactical reload. Reported by Rivet. 2013-02-03 20:51:30 -06:00
Kevin Granade 8208d7965b Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-03 13:52:51 -06:00
Kevin Granade d713e741e3 Create human flesh when butchering humans and human-like monsters. 2013-02-03 13:51:04 -06:00
Kevin Granade 10d6219cec Add MF_HUMAN flag for monster types that are actually human. 2013-02-03 13:50:29 -06:00
TheDarklingWolf 349d176b2b Modified deconstruction to return better floor tiles 2013-02-03 19:32:40 +00:00
TheDarklingWolf 15a8bb45a6 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-03 18:14:32 +00:00
TheDarklingWolf 5fbdd83ac0 Added a bunch more clutter items, pending a mapgen rework of houses 2013-02-03 18:13:54 +00:00
Kevin Granade 1af454bf62 Add human flesh item as distingt from regular meat. 2013-02-03 11:39:14 -06:00
Zach Morgan dd407d112f crafting vs skills fix. 2013-02-03 12:38:20 -05:00
TheDarklingWolf 8b44d40189 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-03 15:44:15 +00:00
TheDarklingWolf db7dd3770e Added some vehicle chassis types, and made them spawn in garages. 2013-02-03 15:43:54 +00:00
Kevin Granade 0d038010b4 Clear and re-cache vehicles on map shift, should fix phantom vehicles following you around. 2013-02-02 23:39:46 -06:00
Kevin Granade ab8b0772d0 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-02 20:52:32 -06:00
Kevin Granade 76268f1ae0 Simplify a bunch of skill accesses by retrieving them on the fly instead of grabbing a skill object. 2013-02-02 20:49:49 -06:00
Zach Morgan f1d406d696 rewriting set_adjacent_overmaps
to something that doesn't go into special cases.
2013-02-02 21:32:52 -05:00
Kevin Granade 850d92e666 Fix some indentation. 2013-02-02 20:16:54 -06:00
Kevin Granade 9f93dc3539 Push skill lookup down into individual item struct constructors. 2013-02-02 20:12:55 -06:00
Kevin Granade 6bda5a0dd7 Streamline recipe declaration by pushing skill lookup down into recipe constructor. 2013-02-02 19:14:42 -06:00
Kevin Granade d04caa986f Streamline skills API by making player::practice() and player::SkillLevel() accept a string identifying the skill. 2013-02-02 19:13:20 -06:00
Zach Morgan fb09de7a0a using reset_light_level in a less stupid way 2013-02-02 18:24:43 -05:00
TheDarklingWolf 383b13f42d Removed nonexistent grack from trader blacklist 2013-02-02 22:51:48 +00:00
TheDarklingWolf 1095d9e8a3 Added some stupid jokes, made picklocks apply to locked gates now. 2013-02-02 22:47:52 +00:00
TheDarklingWolf a931a2fae8 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-02-02 22:09:41 +00:00
TheDarklingWolf 55685f6c28 Pickaxes and wagons, yay easter eggs 2013-02-02 22:09:25 +00:00
Kyratzes Talvadore 81bf947b55 Merge pull request #35 from zpmorgan/foo
reset_light_level() for immediate lighting changes
2013-02-02 13:51:30 -08:00
Zach Morgan c5743b67fe blah, candles should do the same as flashlights
in the prev. commit.
2013-02-02 16:48:19 -05:00
Zach Morgan f9f3c4a1d1 reset_light_level() for immediate lighting changes
this clears the cache so it'll be recalculated.
2013-02-02 16:38:26 -05:00
TheDarklingWolf ec0dc233c4 Renamed lighters for easier wishing 2013-02-02 21:17:18 +00:00
TheDarklingWolf 974d443d80 Merged stuff into dev FAQ, fixed boot crafting and issue with logception 2013-02-02 21:12:50 +00:00
Kevin Granade 032e558cc9 Dereference this pointer in calendar comparison. 2013-02-02 13:58:15 -06:00
Kyratzes Talvadore a51790df92 Merge pull request #34 from zpmorgan/lightlevel-per-turn
caching game::light_level().
2013-02-02 09:20:30 -08:00
Zach Morgan 32334d3ad2 caching game::light_level().
it's called way more than once per turn.
2013-02-02 11:54:03 -05:00
Kyratzes Talvadore 03008318c4 Merge pull request #33 from zpmorgan/wait-once
Only wait once. Waiting seems to work in vehicles.
2013-02-02 07:40:00 -08:00
Kyratzes Talvadore 45878a6ac6 Merge pull request #32 from zpmorgan/dirty-mapbuffer
Tracking whether MAPBUFFER actually needs saving
2013-02-02 07:02:23 -08:00
Zach Morgan 1936ff0524 Only wait once. Waiting seems to work in vehicles.
I'm not sure the point of that turret_mode thing; leaving it there.
2013-02-02 09:52:44 -05:00
Kevin Granade 11c9524dcb Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-02 01:34:48 -06:00
Kevin Granade 496a757dd2 Merge pull request #31 from zpmorgan/master
map rendering optimization
2013-02-01 23:32:11 -08:00
Zach Morgan 46e390cbb7 Tracking whether MAPBUFFER actually needs saving
with a 'dirty bit'. I imagine that overmaps and nonants
could use the same principle to be loaded on demand
andn saved as needed.
2013-02-02 02:28:38 -05:00
Kevin Granade 4d8af82e1e Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-02-02 01:28:24 -06:00
Kevin Granade 44a1a4c2dd Greatly reduce the transmission of scent across closed doors, windows, etc. 2013-02-02 01:28:07 -06:00
Zach Morgan 5c127b2c8c another render optimization.
g->light_level() would iterate over the player's
inventory for each rendered tile. cached.
2013-02-01 23:50:06 -05:00
Zach Morgan 9f2e12d896 caching player rendering conditions
rather than crawling inventory for unlikely items for each rendered tile.
2013-02-01 21:39:05 -05:00
Kyratzes Talvadore a209c72876 Merge pull request #30 from zpmorgan/master
bounds checking for veh_exists_at.
2013-02-01 14:41:01 -08:00
Zach Morgan b735c8a926 bounds checking for veh_exists_at. 2013-02-01 17:35:28 -05:00
Kyratzes Talvadore cbca4f0665 Merge pull request #29 from zpmorgan/skill-rust
fixing skills, which were rusting almost every turn.
2013-02-01 06:45:31 -08:00
Kyratzes Talvadore da1f3f2464 Merge pull request #28 from zpmorgan/overmap-boundary-mapgen
fixing that problem where vehicles evaporate
2013-02-01 06:45:19 -08:00
Zach Morgan 3b53de1810 fixing skills rusting almost every turn. 2013-02-01 09:16:41 -05:00
Zach Morgan 1fece90606 fixing that problem where vehicles evaporate
Why does this fix it? I'm not sure exactly :/
2013-02-01 08:05:23 -05:00
Kevin Granade 73d7139f72 Un-macro iterating across the skills vector. 2013-01-31 19:02:21 -06:00
Kevin Granade 69194d324c Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-31 18:40:28 -06:00
Kyratzes Talvadore 5bf5dee2a7 Merge pull request #27 from zpmorgan/master
having NPCs hog less cpu underground.
2013-01-31 13:06:15 -08:00
Zach Morgan ca77de0657 making undergound NPCs hog less CPU
NPCs no longer flail about looking for various shops.
Functionally, they still do the same thing. Just much faster.
2013-01-31 12:24:05 -05:00
Kevin Granade 43f604fcc1 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-30 20:49:24 -06:00
Kyratzes Talvadore b107b0edc4 Merge pull request #26 from zpmorgan/master
misc fixes
2013-01-30 12:52:51 -08:00
Zach Morgan 7d344784d2 #include stdint.h in skill.h so that it compiles 2013-01-30 10:39:05 -05:00
Zach Morgan 9b7deb698a Vehicle part cache optimization.
Hopefully fixing the situation where the game is bogged down
with vehicle cache map traversals when there are a
bunch of mobs & vehicles around.
2013-01-30 10:38:52 -05:00
Zach Morgan a1fc81f2a4 Let webs be woven over slime.
Both web weaver and slimy are mutations that can coexist.
2013-01-30 10:38:52 -05:00
Zach Morgan 0bb607e295 fixed segfault on flooding strange temple room 2013-01-30 10:38:52 -05:00
Zach Morgan 494a0dbd74 check whether the map's submap grid
is somehow corrupted,
before adding a spawn point to it.
2013-01-30 10:38:52 -05:00
Kyratzes Talvadore 4113bc4d86 Merge pull request #25 from wito/loadable-skills
Loadable skills
2013-01-29 23:55:04 -08:00
Kevin Granade 93ac47bb63 Merge remote-tracking branch 'zpmorgan/master' into for-darklingwolf 2013-01-29 20:29:36 -06:00
Kyratzes Talvadore 77d2a3a828 Merge pull request #24 from wito/master
Some new vehicle parts
2013-01-29 12:53:48 -08:00
Zach Morgan 83f86de61c Let webs be woven over slime.
Both web weaver and slimy are mutations that can coexist.
2013-01-29 13:10:11 -05:00
Zach Morgan 5858c1e74f fixed segfault on flooding strange temple room 2013-01-29 09:54:34 -05:00
Zach Morgan 49506cf689 check whether the map's submap grid
is somehow corrupted,
before adding a spawn point to it.
2013-01-29 09:54:34 -05:00
Williham Totland f9756382a9 Merge branch 'master' into loadable-skills
Conflicts:
	construction.cpp
	map.cpp
2013-01-29 15:08:00 +01:00
Williham Totland 21c9237f4b Merge branch 'vehicle-parts' 2013-01-29 14:58:57 +01:00
Williham Totland 10edcaf67f Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-01-29 14:48:47 +01:00
Kyratzes Talvadore 5898a2a8d8 Merge pull request #23 from daftfad/bugfixes
fixed toolless constructions
2013-01-29 05:34:14 -08:00
daftfad e6478eff42 fixed toolless constructions 2013-01-28 22:42:32 -05:00
daftfad b44c28f456 Merge branch 'master' of github_daftfad:TheDarklingWolf/Cataclysm-DDA into bugfixes 2013-01-28 22:26:31 -05:00
TheDarklingWolf ee33c1e565 Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-01-28 15:13:10 +00:00
TheDarklingWolf 19da866c6b Lockpicks now required to silently open doors 2013-01-28 15:12:42 +00:00
Kevin Granade b1554e46ee Continue to constitutionialize map.cpp and map.h. 2013-01-27 23:13:47 -06:00
Kevin Granade 9d978ba029 Reduce calls to map::field_at() slightly by holding onto a reference to the field. 2013-01-27 20:10:23 -06:00
Kevin Granade 28cf77c47f Const all the things in map.cpp and map.h. 2013-01-27 20:09:19 -06:00
Kevin Granade 0a0326af51 Slightly reduce calls to map::i_at() by holding a local reference to it. 2013-01-27 18:42:14 -06:00
Kevin Granade 67278adc2f Merge remote-tracking branch 'zpmorgan/master' into for-darklingwolf 2013-01-27 11:39:03 -06:00
Zach Morgan 3d09c9906c removed bottleneck in saving&loading of mapbuffers
list.size is O(n) with some stl implementations, and it was
sizing the submap list every time a submap was loaded or saved.
2013-01-27 08:41:16 -05:00
Zach Morgan b03485645d little optimization.
I noticed a bunch of wolves checking for lit torches too often.
2013-01-27 04:57:33 -05:00
Kevin Granade ef17051934 Make scent normalization much slower. 2013-01-26 22:16:08 -06:00
Kevin Granade 893c97d67c Prevent divide by zero in scent display code. 2013-01-26 19:55:15 -06:00
Kevin Granade deda10f174 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-26 12:54:09 -06:00
TheDarklingWolf 2d808053fe Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-01-26 18:38:11 +00:00
TheDarklingWolf e1ac6ac701 Merge pull request #22 from zpmorgan/master
fix for #21: segfault on going downstairs
2013-01-26 10:37:58 -08:00
Kevin Granade 2d8b851413 Add a FAQ for devs and an initial post explaining relationships between map classes. 2013-01-26 12:19:20 -06:00
Zach Morgan be7a0d3c32 descending stairs, using an elevator, and
debug-teleporting no longer crash when
right next to overmap borders. stuff was only
being dynamically generated for one of the overmaps.
2013-01-26 10:05:10 -05:00
daftfad b97bc7abc7 added check to npc_move_to_next to use debugmon toggle 2013-01-25 19:05:22 -05:00
TheDarklingWolf e01e193105 Merge git://github.com/kevingranade/Cataclysm 2013-01-25 16:20:46 +00:00
TheDarklingWolf 31fed07310 Merge pull request #20 from daftfad/bugfixes
Some bugfixes
2013-01-25 08:19:37 -08:00
daftfad 3b52e12938 fixed inability to construct component/tool-less constructions like clean window 2013-01-25 05:48:04 -05:00
daftfad 5835ce3018 fixed infinite loop with breather spawn 2013-01-25 05:41:19 -05:00
daftfad 4ca0bc186a Merge branch 'master' of github_daftfad:TheDarklingWolf/Cataclysm-DDA into bugfixes 2013-01-25 05:19:30 -05:00
Kevin Granade 14f543d172 Replace open-coded is_outside() with simple loop. 2013-01-24 21:39:00 -06:00
Kevin Granade e318f9e1f0 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-24 18:50:57 -06:00
TheDarklingWolf b8ec2aec2a Merge pull request #19 from hovatterz/bindist-fixes
Fix issue with bindist target on OS X
2013-01-24 01:31:01 -08:00
Zack Hovatter da539e11e3 Fix issue with bindist target on OS X 2013-01-23 16:33:24 -06:00
TheDarklingWolf 068fb0d90a Moved openable window construction into normal window construction 2013-01-23 21:41:11 +00:00
Kevin Granade d2b8d9fe9b Recuce calls to map::ter() a little more by stashing the value locally. 2013-01-22 21:32:41 -06:00
Kevin Granade 669d96174a Further reduce number of calls to map::ter() by caching the value and referencing it multiple times in build_outside_cache(). 2013-01-22 19:08:41 -06:00
TheDarklingWolf ed4fb9e583 Merge git://github.com/kevingranade/Cataclysm 2013-01-22 19:19:33 +00:00
TheDarklingWolf 02557c0495 Reduced scar zombie spawns 2013-01-22 19:18:27 +00:00
TheDarklingWolf 8fce0efb59 Merge pull request #17 from daftfad/master
construction bugfixes and more build changes
2013-01-22 08:03:03 -08:00
daftfad 13b74e98d3 [bug] fixed construction menu 2013-01-22 04:40:28 -05:00
daftfad bc88ba9c51 Fixed incorrect math for construction hotkey 'i'.
Construction staging ACTUALLY  fixed this time.
2013-01-22 04:11:18 -05:00
daftfad 80a5aafed5 [bug] Allow building of later stages of constructions even if first
condition not satisifed.

Fixed makefile yet again.
2013-01-22 03:21:35 -05:00
daftfad 1cc9e18d52 Merge branch 'master' of github_daftfad:TheDarklingWolf/Cataclysm-DDA 2013-01-22 01:47:15 -05:00
daftfad 89a86c4bf3 more Makefile stuff 2013-01-22 01:33:11 -05:00
Kevin Granade 65dbe56dd4 Add a mysterious radio message that is broadcast by some radio stations. 2013-01-21 22:41:24 -06:00
Kevin Granade 9f55dcff89 Typo in array indexing. 2013-01-21 20:46:13 -06:00
Kevin Granade 4138486053 Switch references to outside_cache array to call through accessor function instead. 2013-01-21 20:27:14 -06:00
Kevin Granade 1a0b44bdbb Replace fill method with faster memset() calls. 2013-01-21 19:36:17 -06:00
Kevin Granade 35297d0bc9 Add an optimised caching function for build_light_cache to call instead of map::is_outside(). 2013-01-21 19:17:13 -06:00
Kevin Granade 21413a6da5 Wove cache of whether tiles are outdoors into a contiguous array. 2013-01-20 17:53:00 -06:00
Kevin Granade d898a8e417 Kill tabs\! 2013-01-20 12:05:26 -06:00
Kevin Granade a329840751 Make flashlight wielded by player always originate from player's position. 2013-01-20 11:37:17 -06:00
The Darkling Wolf 7f5ad2c9d3 Merge git://github.com/kevingranade/Cataclysm 2013-01-20 10:27:49 +00:00
TheDarklingWolf 7569f8b252 Merge pull request #15 from daftfad/master
Working towards a unified Makefile
2013-01-20 00:12:44 -08:00
daftfad 1f80fb3e1b Moved some build info into COMPILING 2013-01-20 02:01:19 -05:00
Kevin Granade e168f97280 Only force a square to be un-shadowy when it's outside and in range to be illuminated naturally. 2013-01-19 20:49:20 -06:00
Kevin Granade 46fc5d0118 Indentation fix. 2013-01-19 14:51:41 -06:00
Kevin Granade addeb75d37 Don't halve lowlight_sight_range so outdoors aren't shadowy. 2013-01-19 14:50:36 -06:00
Williham Totland 2e4e06bd20 Removed +x flag on source files.
@TheDarklingWolf Take care not to set these, will ya? ;)
2013-01-19 19:29:44 +01:00
daftfad d23e3f362c Added support for 32-bit linux. still need to figure out all the 32-bit deps
Added RELEASE mode to toggle optimizations
2013-01-19 00:06:38 -05:00
daftfad 5b4e8a79f4 working towards a unified makefile 2013-01-18 12:54:41 -05:00
daftfad 84751969be Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA 2013-01-18 02:08:40 -05:00
Williham Totland 0983210445 Added internal doors for vehicles.
Same materials as a standard door, but:

Is roofed,
cannot be reinforced,
weaker,
opaque.

Mostly exists for the benefit of the sleeper cab in the Semi-truck.
2013-01-17 20:55:11 +01:00
Williham Totland 5f515e596f Fixed a minor visual glitch with the semi-truck. 2013-01-17 20:54:57 +01:00
Williham Totland 4e1fe11505 Merge branch 'master' into vehicle-parts 2013-01-17 18:34:48 +01:00
Williham Totland dda68881ec Made opaque vehicle doors actually opaque. 2013-01-17 18:19:16 +01:00
TheDarklingWolf 57c51510ad Merge pull request #13 from wito/master
Autosave: The bane of my existence!
2013-01-17 08:19:48 -08:00
Williham Totland c1e0814874 Further reworked Skill to use pointers.
This should remove the need for a null skill alltogether.
2013-01-17 15:09:22 +01:00
Williham Totland 70051b9734 merge branch master into loadable-skills 2013-01-17 14:02:16 +01:00
Williham Totland 814731e663 Fixed a bug causing time to pass at ~double rate. 2013-01-17 13:53:14 +01:00
TheDarklingWolf d39f4cef2a Merge pull request #12 from ShadowZero/master
Make NPCs defend themselves when shot by player.
2013-01-17 00:02:00 -08:00
daftfad 0cca4cca1d Added Items: display to inventory screen 2013-01-16 22:21:48 -05:00
TheDarklingWolf 717d335ebb Merge pull request #9 from wito/master
Improved autosave semantics
2013-01-16 12:16:10 -08:00
TheDarklingWolf f85b9d78b6 Merge pull request #11 from daftfad/master
Fix for wildnerness overspawning
2013-01-16 12:14:50 -08:00
Williham Totland f9e9e6bebf Vehicle beds.
Using a seat, vehicle beds can now be constructed.

As comfortable to sleep on as regular vehicle seats,
but does not prompt the player to board the vehicle when walked upon.
2013-01-16 20:00:47 +01:00
daftfad 72c344be5a Fixed accidental removal of wield-action code in wilderness patch 2013-01-16 12:58:32 -05:00
Williham Totland df5fc6946c And finally, ACTUALLY improved autosave semantics.
Sleeping and waiting should now only give one autosave,
at the very beginning of the action.
2013-01-16 18:24:56 +01:00
daftfad 50ac0921d9 Fixed wildlife over-spawning 2013-01-16 11:24:04 -05:00
Williham Totland 5452d36fd8 ACTUALLY suppressed saves in vehicles. 2013-01-16 15:52:07 +01:00
Williham Totland 0588d00b05 Suppress autosave in vehicles. 2013-01-16 15:04:01 +01:00
Williham Totland a2337b2a13 Merge branch 'master' of github.com:TheDarklingWolf/Cataclysm-DDA 2013-01-16 15:01:21 +01:00
Williham Totland 8f4f9da4d1 Improved autosave semantics.
Autosaves no longer occur if you are standing still, sleeping, etc.
2013-01-16 14:57:53 +01:00
TheDarklingWolf d10c36c445 Merge git://github.com/wito/Cataclysm-DDA 2013-01-16 13:47:06 +00:00
TheDarklingWolf 204206200a Split crafting up a bit more 2013-01-16 13:46:20 +00:00
Williham Totland ac7ad24743 30-minute saving now properly respects autosave option, spelling fixes for initial points. 2013-01-16 13:59:21 +01:00
TheDarklingWolf a6a7a36675 Merge pull request #8 from zpmorgan/master
compile name.h w/ gcc
2013-01-15 23:52:51 -08:00
TheDarklingWolf 08b9085a67 Weakened beekeeper zombies a bit, supressed autosave while in a vehicle 2013-01-16 07:20:38 +00:00
Zach Morgan aa1ffcff70 Got errors:"‘uint32_t’ has not been declared", etc
(gcc 4.6)
fix: #including stdint.h in name.h
2013-01-16 00:01:11 -05:00
TheDarklingWolf 1381681192 Fixed molotov crafting costs and compiling errors 2013-01-15 18:40:01 +00:00
TheDarklingWolf 92cc02db29 Modified some zombie names, and crafting recipes 2013-01-15 18:15:04 +00:00
TheDarklingWolf b02078fcb9 Merge pull request #7 from wito/master
Configurable difficulty level, groundwork for a severe rewrite of how names are handled.
2013-01-15 09:54:54 -08:00
Williham Totland 3d86c5144a Use or Apply Wielded, default key capital A. 2013-01-15 15:31:14 +01:00
Williham Totland 14edde3a64 Improved RNG seeding.
Also, whitespace fixes.
2013-01-15 11:14:21 +01:00
TheDarklingWolf cd4f2b707a Merge pull request #6 from daftfad/master
Mops can cleanup liquids
2013-01-14 21:56:44 -08:00
Williham Totland 4ca7b1488d Made character generation points user-configurable.
Also, whitespace fixes.
2013-01-14 18:55:51 +01:00
daftfad fc5d784483 Mops can now clean up spilled liquids 2013-01-14 12:17:38 -05:00
Williham Totland 067e550579 Merge branch 'master' into loadable-skills
Conflicts:
	player.cpp
2013-01-14 15:13:14 +01:00
Williham Totland 9cffcfb6d4 name generation redone, final touches 2013-01-14 14:27:02 +01:00
Williham Totland dcfb92df00 refactor 2013-01-14 13:57:53 +01:00
Williham Totland df4b232d3f name generation reworked 2013-01-14 13:26:00 +01:00
Williham Totland c5162d25d2 picojson json library 2013-01-14 11:27:59 +01:00
Williham Totland 4f784862ae Fixed an off-by-one display error in the character screen. 2013-01-14 00:19:34 +01:00
Williham Totland 505d4a3087 moved to references 2013-01-14 00:10:24 +01:00
Williham Totland 7a51e26285 Converted file format to JSON.
Adds picojson by Kazuho Oku.

github.com/kazuho/picojson

This necessitates mention in readme-files bundled with compiled releases; no change required for code releases.
2013-01-13 22:33:29 +01:00
Williham Totland 34831c98e1 moved skills file into place. 2013-01-13 21:54:56 +01:00
Williham Totland d9d9105b2f cleanup 2013-01-13 21:51:22 +01:00
Williham Totland 14e7d28f51 crafting 2013-01-13 20:58:52 +01:00
Williham Totland d7b2a59973 savant handling 2013-01-13 20:43:00 +01:00
Williham Totland 7796b11204 driving, disarming traps 2013-01-13 20:36:03 +01:00
Williham Totland 93ffc17f39 items, melee 2013-01-13 20:31:58 +01:00
Williham Totland a7fcaf61f9 odds and ends 2013-01-13 19:51:48 +01:00
Williham Totland 14a1919f2e traps updated 2013-01-13 19:05:31 +01:00
Williham Totland f965d7c83f Merge branch 'master' into loadable-skills 2013-01-13 18:56:42 +01:00
Williham Totland 85443e661b conversion: bionics, books, guns, melee 2013-01-13 18:50:36 +01:00
Williham Totland 1a26777911 final display fixes 2013-01-13 16:35:19 +01:00
Williham Totland 34651948bc display using new method, save and load 2013-01-13 16:18:16 +01:00
Williham Totland 06ae5e8afc exposed excercise through an accessor 2013-01-13 15:48:26 +01:00
Williham Totland 8f6f3a6177 Fixed an appearance of a ghost skill. 2013-01-13 15:46:42 +01:00
Williham Totland 3f9b5f23d6 Significantly upped skill comprehension to better match old values. 2013-01-13 15:46:20 +01:00
Williham Totland 230fc8e7db Expanded comparators for SkillLevel 2013-01-13 13:17:13 +01:00
Williham Totland 400e63611d SkillLevel::comprehension() 2013-01-13 13:07:48 +01:00
Williham Totland 211064deb5 New Skill array. 2013-01-13 13:06:11 +01:00
Williham Totland f6e605a8ed Defines, operators, accessors. 2013-01-13 12:27:51 +01:00
ShadowZero 099524867e Made NPCs defend themselves when shot at. 2013-01-13 22:11:56 +11:00
TheDarklingWolf 8d5be56b82 Merge git://github.com/kevingranade/Cataclysm
Conflicts:
	player.cpp
2013-01-13 10:27:29 +00:00
TheDarklingWolf dafe823eec Merge branch 'master' of https://github.com/TheDarklingWolf/Cataclysm-DDA 2013-01-13 10:22:59 +00:00
TheDarklingWolf 628fd893ed Added boltcutters, made lockable chainlink gates, added the gates to spawns 2013-01-13 10:22:21 +00:00
TheDarklingWolf b7c29d42d0 Reworked military outposts a little. Chainlink fences and gates, and concrete walls. 2013-01-13 09:34:44 +00:00
TheDarklingWolf c3c323cc1c Changed rebar doors to wire ones 2013-01-13 08:41:12 +00:00
TheDarklingWolf dc7c8825ea Fixed up some crafting and added in a few new items 2013-01-13 00:48:42 +00:00
Kevin Granade 0f39a18454 Add long island iced tea and prerequisites. 2013-01-12 17:35:32 -06:00
Kevin Granade f3e3ddcc95 Fix sign of comparison testing ammo compatability. 2013-01-12 15:02:41 -06:00
TheDarklingWolf abe6aa602d Merge pull request #5 from hovatterz/displace-npc
Friendly NPCs will now move out of the way
2013-01-12 12:53:05 -08:00
Zack Hovatter 6ddbc82c0e Friendly NPCs will now move out of the way 2013-01-12 14:49:25 -06:00
origamiwolf 3b415dfeb3 Items using gasoline can now be reloaded using the reload command.
Extensively refactored flamethrower reload code to make it more generic.

Conflicts:

	item.cpp
2013-01-12 14:39:20 -06:00
TheDarklingWolf 431c624d48 Pilot lights and televisions 2013-01-12 20:39:10 +00:00
TheDarklingWolf f9964da509 Modified vegetarian description to make slightly more sense 2013-01-12 18:54:43 +00:00
origamiwolf 1a0948c6d4 Added option to delete world after player death
Conflicts:

	main.cpp
2013-01-12 18:19:08 +00:00
Williham Totland a6f7e307ea Loadable skills: Part three: skill_count() 2013-01-12 18:40:02 +01:00
Williham Totland 929df3cf80 Loadable skills: Part Two: The kills. 2013-01-12 18:14:37 +01:00
Williham Totland c3b1916e03 Loadable skills: Step one: Basic framework: The subtitle 2013-01-12 18:04:24 +01:00
Williham Totland edd13a5fce Various whitespace fixes, look here for minor zapped stubs. 2013-01-12 15:20:17 +01:00
Williham Totland b3c93c246e Removed om_npcs_move, check_warmth.
If reinstating, look here.
2013-01-12 15:10:59 +01:00
Williham Totland 13e36b8e91 Fixed chain link fence rotation. 2013-01-12 14:27:18 +01:00
Williham Totland 58a5d644ff Improved garage rotation code. 2013-01-12 14:26:33 +01:00
Williham Totland e43d0248b1 Removed make_all_items_owned stub.
Look here if reinstating it.
2013-01-12 14:17:50 +01:00
Williham Totland 418ca32936 Removed stub code for making shopkeepers.
Look here if reinstating it.
2013-01-12 14:00:51 +01:00
Williham Totland 341575d47a Autosave fix: Seen map tiles are no longer scrambled when reloading an autosave. 2013-01-12 13:22:16 +01:00
Williham Totland 105674989f Cleared +x on source files. 2013-01-12 12:50:27 +01:00
Williham Totland ccb707f744 Updated the MOTD to no longer referencing DDA as a mod. 2013-01-12 12:44:59 +01:00
Williham Totland 747437920d Moderately large cleanup, killing a lot of warnings.
No actual changes.
2013-01-12 12:42:16 +01:00
TheDarklingWolf db11c99ca1 Added a bunch of new tiles, and some deconstruct data for 'em 2013-01-12 07:16:51 +00:00
TheDarklingWolf 0b65753283 Merge branch 'for-darklingwolf' of https://github.com/kevingranade/Cataclysm 2013-01-12 06:26:11 +00:00
TheDarklingWolf 443a0e60f6 Fixed obscene amounts of sound being generated 2013-01-12 06:18:52 +00:00
TheDarklingWolf 8c270c5575 Merge branch 'for-darklingwolf' of https://github.com/kevingranade/Cataclysm 2013-01-12 06:11:31 +00:00
Kevin Granade a33c36d498 Add a sound effect when a tent is destroyed. 2013-01-12 00:07:35 -06:00
Kevin Granade ba2958a61a Prevent placing tent on top of player. 2013-01-11 23:55:25 -06:00
Kevin Granade e1fd552487 Prevent partially deploying tent by checking entire deploy area before doing anything. 2013-01-11 23:52:28 -06:00
TheDarklingWolf 8f94ab592f Fixed up flashlights and transponder crafting 2013-01-12 05:18:48 +00:00
TheDarklingWolf 79e873f4fa Merge branch 'delete-save' of https://github.com/hovatterz/Cataclysm-DDA 2013-01-12 05:07:46 +00:00
Kevin Granade 8913413f06 Massive series of spelling and grammer fixes submitted by Zen Arcade on the forums. 2013-01-11 22:56:37 -06:00
Kevin Granade 6d195a5216 Clean up reload logic a bit more and make sure ammo being loaded into gunmods matches already loaded ammo. 2013-01-11 22:34:45 -06:00
Kevin Granade 5d07944500 Merge remote-tracking branch 'zpmorgan/reload-multi-fix' into for-darklingwolf 2013-01-11 20:25:57 -06:00
Zach Morgan b0e87517d6 formatting weapon reload code
There's still no real consistency, but now at least it's
not a mixture of tabs and spaces.

I think this fixes reloading your weapon when you

have multiple ammo types for it.

meh, 1-space formatting,

comment language purified :)
2013-01-11 19:44:59 -05:00
Zack Hovatter 5665a46f11 Add menu item to delete world and saves 2013-01-11 14:17:19 -06:00
Zack Hovatter e3173299ec Fix compile issues with g++4.2 2013-01-11 09:27:14 -06:00
TheDarklingWolf 391ad46ab7 Merge pull request #3 from hovatterz/gitignore
Add non-source files to the .gitignore
2013-01-11 04:19:48 -08:00
Zack Hovatter 756bc8e752 Add non-source files to the .gitignore 2013-01-10 21:06:00 -06:00
TheDarklingWolf 9960a3aa1a Fixed gasoline charges, fixed select fire keybinding, added light to turrets 2013-01-10 23:17:18 +00:00
Kevin Granade 006bf2c743 Make use of new map::add_item() functionality to simplify code. Thanks to zpmorgan for pointing out the item stacking problem. 2013-01-08 21:09:09 -06:00
Kevin Granade b5ed92d21a Make add_item() with a quantity recursively create multiple items when the items don't have charges. 2013-01-08 19:46:51 -06:00
Kevin Granade 4c71f9ba68 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-08 19:10:29 -06:00
Kevin Granade ac0a8e7c96 Fixup some damage in reload logic that was preventing gunmods from being reloaded. 2013-01-08 19:09:57 -06:00
Kevin Granade feb7eb025e Move ammo effects to a bitfield in the ammo item instead of filling up the items flag bitfield. 2013-01-08 19:08:39 -06:00
TheDarklingWolf e1f75ee7c9 Weakened fungal walls a little, fixed bear-traps not dropping when they killed the enemy 2013-01-08 16:55:14 +00:00
TheDarklingWolf f206351c0f Added in some framework for canning and hot foods 2013-01-07 23:19:04 +00:00
Kevin Granade fad310e5d0 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA into for-darklingwolf 2013-01-06 22:21:33 -06:00
TheDarklingWolf 15ed3d5df0 Did.. something 2013-01-07 02:16:37 +00:00
TheDarklingWolf a57118f0e1 Fixed acidbomb crafting 2013-01-07 00:44:18 +00:00
TheDarklingWolf ab9ae4f387 Fixed a derp 2013-01-06 22:58:50 +00:00
Kevin Granade 02fe813021 Add code to collapse a tent when bashed. 2013-01-06 16:52:01 -06:00
origamiwolf 6201e425d4 Implemented less stupid way of showing a limited inventory.
Added survival mag and mechanics textbook.

Conflicts:

	data/motd
	game.cpp
	itype.h
	itypedef.cpp
	mapitemsdef.cpp
2013-01-06 22:43:29 +00:00
Kevin Granade f9e4ef5ef7 Fix indentation in tent iuse function. 2013-01-06 15:36:27 -06:00
Kevin Granade 787428c2c3 Merge branch 'master' of git://github.com/TheDarklingWolf/Cataclysm-DDA into for-darklingwolf
Conflicts:
	mapitemsdef.cpp
2013-01-06 15:19:57 -06:00
TheDarklingWolf 69126557b2 Acidbomb crafting from batteries. Makes no sense, but eh. 2013-01-06 16:49:02 +00:00
TheDarklingWolf 08e4ac01ee Fixed up vehicle headlights 2013-01-06 16:31:16 +00:00
TheDarklingWolf 292bac1157 Added headlights to more vehicles 2013-01-06 15:31:37 +00:00
origamiwolf a7789c5cea Fixed crafting recipes consuming all gasoline, readjusted gasoline requirements in recipes.
Recipes that require containers now check that containers are empty

Conflicts:

	crafting.cpp
2013-01-06 15:06:22 +00:00
origamiwolf 04ecdebe64 Inventory screen shows only suitable items for certain commands (eat, read, wear, take off) 2013-01-06 15:01:53 +00:00
origamiwolf a2515af81d Added inv_food function to display only food items.
Plus some groundwork for easier reloading of gasoline guns and tools.

Conflicts:

	README.md
	item.cpp
2013-01-06 15:01:48 +00:00
TheDarklingWolf 6cd22bf3cd Fixed deconstruction conflicts 2013-01-06 14:48:53 +00:00
origamiwolf c199b9ba9d Furniture deconstruction added, done through construction menu.
Conflicts:

	construction.h
	mapdata.h
2013-01-06 14:41:33 +00:00
TheDarklingWolf 9c1b205041 Implemented Antecheese's reading tweak 2013-01-06 13:58:56 +00:00
TheDarklingWolf 20a012d50d Moved lawnmower deconstruction into crafting.cpp, increased component vector size 2013-01-06 11:39:35 +00:00
Kevin Granade 4e3061d938 Add bicycle to vehicle spawn list. 2013-01-05 23:44:13 -06:00
Kevin Granade 1ecd4f0109 Merge branch 'bicycle' into for-darklingwolf
Conflicts:
	itype.h
	mapitemsdef.cpp
	veh_typedef.cpp
2013-01-05 23:42:06 -06:00
Kevin Granade 54290bbfa2 Add schoolbus to rare vehicle spawn list. 2013-01-05 23:15:11 -06:00
Kevin Granade 65e1df5ee9 Change schoolbus engine to medium, large was too high-performance. 2013-01-05 23:14:46 -06:00
Kevin Granade 32c5fef652 Added schoolbus predefined vehicle. 2013-01-05 21:46:16 -06:00
TheDarklingWolf 382b5fd4ec Cut crafting recipes down a bit 2013-01-06 00:02:35 +00:00
TheDarklingWolf e0948f84e1 Fixed spawning of new items 2013-01-05 22:49:21 +00:00
TheDarklingWolf 5245afe7e3 Added survival magazine and advanced mechanics textbook 2013-01-05 22:45:43 +00:00
TheDarklingWolf c7199e5c77 Added bash data for chain fences 2013-01-05 21:33:27 +00:00
TheDarklingWolf 3535dee1f5 Added domestic windows to the pane removal, no curtains yet. 2013-01-05 21:29:29 +00:00
TheDarklingWolf 5ed55137a6 Merge branch 'for-darklingwolf' 2013-01-05 21:22:40 +00:00
TheDarklingWolf e3f9fd1e05 Cleaned up the list of items for deconstruction 2013-01-05 21:21:14 +00:00
Kevin Granade 5ba961e4f8 Re-enable shell casing scattering. 2013-01-05 14:55:48 -06:00
Kevin Granade 4e93669d26 Indentation fix. 2013-01-05 14:54:02 -06:00
Kevin Granade 2868d49234 Initialize shell casings with charges = 1 so they stack with other shell casings properly. 2013-01-05 14:51:55 -06:00
TheDarklingWolf 2c57d4c62e Made duct tape an ammo, removed the redundant bandage recipe and re-merged Kevingranade's stacking code 2013-01-05 20:09:08 +00:00
TheDarklingWolf 000883bd4b Fixed blunder in crafting.cpp 2013-01-05 04:20:13 +00:00
origamiwolf 55d3e37c07 Cleaned up item disassembly, which is now also a player activity.
Conflicts:

	crafting.cpp
	pldata.h
2013-01-04 16:18:43 +00:00
origamiwolf c63282658a Item disassembly implemented. 2013-01-04 16:18:07 +00:00
origamiwolf 62075ef850 Laying groundwork for item disassembly
Conflicts:

	iuse.cpp
	iuse.h
2013-01-04 16:17:42 +00:00
origamiwolf d72ad3dd48 Rewrote options screen in help menu to allow for non-boolean option setting.
Conflicts:

	help.cpp
	options.h
2013-01-04 16:15:51 +00:00
TheDarklingWolf 977db7dc3d Fixed sawnoff shotgun crafting crash, also started on chain-link fences. 2013-01-04 15:00:42 +00:00
TheDarklingWolf 3ca4cb3b91 Damaged tent item, still WIP 2013-01-04 02:30:28 +00:00
TheDarklingWolf 360d44663a Added tents, still moderately buggy, but fine if used correctly 2013-01-04 01:54:33 +00:00
TheDarklingWolf e9cecd6e91 Removed pain flag stuff 2013-01-03 19:16:44 +00:00
TheDarklingWolf 2235a75258 Shrubs and bushes no longer murderous 2013-01-03 19:13:45 +00:00
TheDarklingWolf a30511ac26 Fixed blood spawns that were causing segfaults 2013-01-03 03:32:33 +00:00
TheDarklingWolf 6cf4779072 Fixed clean water spawns 2013-01-03 00:07:08 +00:00
TheDarklingWolf dd2395fa1c Reduced scrap drops and costs a bit, added wire and scrap to wreckage 2013-01-02 23:06:38 +00:00
TheDarklingWolf 9a52779156 Fixed an error in a recipe 2013-01-02 22:59:28 +00:00
TheDarklingWolf 602ad29c97 Added scrap to more recipes, made scrap drop from smashed metal stuff 2013-01-02 22:58:49 +00:00
TheDarklingWolf a40d63b5ee Cleaned up window construction a little to make openable windows work better 2013-01-02 20:44:13 +00:00
TheDarklingWolf 5f5ef0448f Made container volumes a little more consistent 2013-01-02 18:23:44 +00:00
TheDarklingWolf 23302e5293 Openable windows, and added scrap and springs to some crafting recipes 2013-01-02 03:35:31 +00:00
TheDarklingWolf dc90d90d79 Added scrap metal to a few recipes, fixed up some leather stuff costs 2013-01-02 01:04:33 +00:00
TheDarklingWolf 6aaafee780 Wolves and bears afraid of fire now 2013-01-02 00:40:16 +00:00
TheDarklingWolf 31446157b8 Fixed rock floors letting rain in, and digging of rubble and ash 2013-01-01 23:02:28 +00:00
TheDarklingWolf e84df02299 You can now cut up leather items with knives and scissors 2013-01-01 21:24:13 +00:00
TheDarklingWolf 17e7327705 Cleaned up jackhammering of floors a little, added a leather trenchcoat. 2013-01-01 21:08:35 +00:00
TheDarklingWolf 74ceb97548 Added a sawnoff version of the Saiga-12 2013-01-01 18:29:55 +00:00
TheDarklingWolf a8ae4996f1 Fixed colour of curtains item and tile 2012-12-31 20:18:26 +00:00
TheDarklingWolf c9292e548a Fixed up the way curtains work. Slightly broke the construction menu 2012-12-31 20:07:26 +00:00
TheDarklingWolf 8e0c1c261b Fixed crafting of armguards 2012-12-31 18:08:01 +00:00
TheDarklingWolf c75804422d Fixed bugfix conflict 2012-12-31 17:58:48 +00:00
origamiwolf 1973bd697f Bugfix for cooked food coming out rotten before actual spoilage time
Conflicts:

	crafting.cpp
2012-12-31 17:58:19 +00:00
origamiwolf 8ac115784b Addition of arm armour.
Conflicts:

	README.md
	itype.h
	itypedef.cpp
	mapitemsdef.cpp
2012-12-31 17:57:32 +00:00
TheDarklingWolf 9add5b5aea Added lawnmowers to spawn lists 2012-12-31 03:12:56 +00:00
TheDarklingWolf ad7c7b79dd Unfucked skill learning. 2012-12-31 03:06:29 +00:00
TheDarklingWolf 10b13424fb Screwdrivers and Wrenches used to disassemble items
Added in lawnmowers, and all they entail
2012-12-30 23:53:54 +00:00
origamiwolf 662c78bb9d Bugfix for containers not being filled when wielded. 2012-12-30 19:57:29 +00:00
Kevin Granade 6eae2dac32 Merge branch 'master' of git://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-30 01:45:58 -06:00
Kevin Granade 781fc05f79 Move check for NULL in item::reload() to prevent segfault when trying to reload a partially-loaded gun with no matching ammo. 2012-12-30 01:45:47 -06:00
Kevin Granade cfdb7105e9 Improve gunmod-ammo compatability checking. 2012-12-30 01:45:33 -06:00
Kevin Granade 17e576b86a Display an error message when reloading a gun fails. 2012-12-30 01:40:17 -06:00
Kevin Granade 040d0e1313 Merge branch 'master' of git://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-29 18:09:58 -06:00
Kevin Granade 3fa03db2ed Revert "Stack shell casngs where appropriate as they are generated."
This reverts commit 9a4c553e1a.

The method chosen of incrementing the charges member of the shell casing items doesn't work as expected.
2012-12-29 18:07:47 -06:00
TheDarklingWolf debf059f80 Merge branch 'for-darklingwolf' 2012-12-30 00:06:02 +00:00
TheDarklingWolf 06a52038eb 40mm Casings, currently unused 2012-12-30 00:03:24 +00:00
origamiwolf cbd564fd78 Option to autodrop empty containers 2012-12-29 21:48:11 +00:00
origamiwolf f7ccb51ef8 Option to autodrop empty containers
Conflicts:

	README.md
2012-12-29 21:47:47 +00:00
TheDarklingWolf ce2456564f Options for skill rust 2012-12-29 21:47:31 +00:00
origamiwolf 1254271e1b Add option to change skill rust behaviour
Conflicts:

	README.md
	player.cpp
2012-12-29 21:35:58 +00:00
TheDarklingWolf 43211542fc Casings are no longer obscenely flammable 2012-12-29 19:57:01 +00:00
TheDarklingWolf 1523f63750 Fixed sewing kit reloading 2012-12-29 14:19:36 +00:00
Kevin Granade 1986220a91 Merge branch 'master' of git://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-28 11:30:55 -06:00
TheDarklingWolf c511309fe5 Readded fuzzy stacking for cooked meat 2012-12-28 15:15:44 +00:00
origamiwolf d6f1f513ad Bugfix in food crafting involving non-liquid charges. 2012-12-28 15:06:03 +00:00
Kevin Granade 4e43bc9b51 Initialize wished for guns and gunmods properly. 2012-12-27 21:47:08 -06:00
TheDarklingWolf 21c7f79600 Fixed rotten cooked food issue.. maybe 2012-12-28 01:12:44 +00:00
TheDarklingWolf 792cce6935 Sewing kits reloadable with thread, thread can be crafted or
found in all the same places as sewing kits.
2012-12-27 22:29:26 +00:00
TheDarklingWolf e1cd33ad51 Made 36in string and 6-30ft roop craftable. 2012-12-27 22:13:31 +00:00
TheDarklingWolf dffea40943 Fixed the bashing of metal stuff 2012-12-27 21:37:54 +00:00
TheDarklingWolf 26d9d1da06 Labs should have correctly spawning concrete walls and floors 2012-12-27 20:10:13 +00:00
TheDarklingWolf 8e9dd609fb Cleared out underfloor from game.cpp, corrected the order of wreckage and twisted metal
and changed the rubble clearing query to use your zlevel rather than terrain.
2012-12-27 19:44:09 +00:00
TheDarklingWolf dab052a260 Added concrete walls, made them spawn in underground labs. Changed underground floors to rock. 2012-12-27 19:39:25 +00:00
origamiwolf 7fe07aff99 Container volumes and liquid charges tweaked for self-consistency.
Plus a bugfix for pouring liquids back into the same container.

Conflicts:

	README.md
	itypedef.cpp
2012-12-27 17:44:42 +00:00
origamiwolf 1d3d0cf040 Bugfix for liquid weights. 2012-12-27 17:42:37 +00:00
Kevin Granade d5dd3a868c Add weapon indirection where possible in ranged.cpp 2012-12-27 00:53:38 -06:00
Kevin Granade 76bc6f4cd1 Check ammo levels with accessor to support auxillary gun mods. 2012-12-27 00:52:31 -06:00
Kevin Granade 9a4c553e1a Stack shell casngs where appropriate as they are generated. 2012-12-27 00:02:52 -06:00
Kevin Granade c53b44bb6e Randomly scatter firearm casings around player when they are generated. 2012-12-26 22:16:28 -06:00
Kevin Granade 10ad974e76 Make gun_damage() return damage for gunmods. 2012-12-26 13:03:56 -06:00
Kevin Granade b0025c19f3 Merge branch 'master' of git://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-26 12:12:51 -06:00
Kevin Granade f625620fd4 Segregate gun and tool reloading code. 2012-12-26 12:11:59 -06:00
TheDarklingWolf a8639cca6f Reworked water stuff 2012-12-26 18:02:10 +00:00
Kevin Granade 3334003c9f Support actve gunmods in make_gun_sound_effects(). 2012-12-26 11:57:35 -06:00
TheDarklingWolf 427989f2c6 Accreditation 2012-12-26 16:44:00 +00:00
origamiwolf 09e6797e7d Water purifiers now consume appropriate amount of charge when purifying larger quantities. 2012-12-26 16:42:15 +00:00
TheDarklingWolf 9767fd0865 Merged revision f8b645d341 of DinoCataclysm 2012-12-26 16:41:09 +00:00
origamiwolf 327f5ad50d bugfix for benign trap checks
Conflicts:

	trapfunc.cpp
2012-12-26 16:40:36 +00:00
TheDarklingWolf 7220ad4f95 Merged revision fdf3feeada, fixed readme and mapitemsdef 2012-12-26 16:39:56 +00:00
origamiwolf 43b7128a5d handle_liquid modified to allow for larger capacity containers
added canteens and jerrycans

Conflicts:

	README.md
	mapitemsdef.cpp
2012-12-26 16:37:36 +00:00
Kevin Granade 8a112dc45a Streamline generation of empty gun shells. 2012-12-25 14:43:41 -06:00
Kevin Granade 8adc2311fe Make spent firearm casing generation use curammo pointer so it makes correct casings when gunmod firing modes are used. 2012-12-25 12:58:03 -06:00
TheDarklingWolf 6d2c4d7119 Fixed firearms using 2 charges, thanks to lastverb for the fix 2012-12-24 21:45:30 +00:00
TheDarklingWolf 2b213fb619 Merge branch 'for-darklingwolf' 2012-12-23 23:34:53 +00:00
TheDarklingWolf 68c9f81eb8 Reverted changes 2012-12-23 23:32:20 +00:00
origamiwolf ef1434ae7a Stacking for food items cooked around the same time.
Conflicts:

	README.md
2012-12-23 23:14:04 +00:00
TheDarklingWolf fd3d93fbfb Jackhammers can now be used to dig through roads and floors. 2012-12-23 23:10:55 +00:00
origamiwolf 422d928fbc Removed queries for stepping on 'benign' traps like rollmats and cots. 2012-12-23 22:34:16 +00:00
TheDarklingWolf 8e108f0d47 Added gunpowder to grenade crafting 2012-12-23 22:17:52 +00:00
Kevin Granade a6c6ea81d9 Merge branch 'master' of git://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-22 23:55:20 -06:00
Kevin Granade 55680f1b75 Add a gun-mounted crossbow gunmod. 2012-12-22 23:53:52 -06:00
Kevin Granade 4232100f4e Make code to display active gunmod ammunition gneric. 2012-12-22 23:53:19 -06:00
Kevin Granade cbf52a1b8d Make code to enumerate ammunition accepted by a gun generic. 2012-12-22 23:52:39 -06:00
Kevin Granade 24aba76d84 Update descriptions of M203 and underslung shotgun. 2012-12-22 22:28:28 -06:00
Kevin Granade ca08273f7a Merge branch 'select-fire' into for-darklingwolf 2012-12-22 21:58:34 -06:00
Kevin Granade 31b2dc30e2 Make item::active_gunmod() return a pointer to the gunmod instead of its index. 2012-12-22 21:43:14 -06:00
Kevin Granade 4ad0cf99b3 Alter game::plfire() and game::fire() to use weapon mode. 2012-12-22 20:48:47 -06:00
Kevin Granade ed94540827 Have gunmods return a burst fire of 1. 2012-12-22 20:45:07 -06:00
Kevin Granade cd4b03c552 Guard against segfaults by verifying that curammo isn't null before accessing it. 2012-12-22 20:44:12 -06:00
Kevin Granade 4ae1f9c61a Make item::has_flag() weapon mode aware. 2012-12-22 20:42:20 -06:00
Kevin Granade 67a5c51a16 Add an accessor to determine number of charges in a weapon-mode friendly way. 2012-12-22 19:17:57 -06:00
Kevin Granade 84d2b32a10 Make the burst fire mode trigger burst fire. 2012-12-22 19:16:13 -06:00
Kevin Granade 0d7bb035b2 Indentation fix. 2012-12-22 01:14:00 -06:00
Kevin Granade 2a4c5898bb Use magazine size and reload one flags from gun when reloading spare magazine. 2012-12-22 01:13:43 -06:00
Kevin Granade e8e0988cf6 Fix checks for reloading spare magazine. 2012-12-22 01:12:46 -06:00
Kevin Granade b952f9a5a8 Make tools work with new reload code. 2012-12-22 01:11:26 -06:00
Kevin Granade a940a87f00 Bail out if we can't find a target to reload. 2012-12-22 01:10:25 -06:00
Kevin Granade f125e3af00 Don't prevent selection of ammo when the gun is full but the sparemag isn't. 2012-12-22 01:06:47 -06:00
Kevin Granade 50670f7687 Differentiate between active gunmods and retool gunmods. 2012-12-22 00:00:06 -06:00
Kevin Granade 2135dff556 Display current gun mode. 2012-12-21 23:58:52 -06:00
Kevin Granade ba220b848e Fix next_mode function. 2012-12-21 23:57:32 -06:00
Kevin Granade 0306f226fe NULL mode member properly when creating items. 2012-12-21 23:56:14 -06:00
Kevin Granade 27d9a3e7e5 Suport unloading ammunition from activ gunmods. 2012-12-21 21:22:28 -06:00
Kevin Granade 68d89aa1e8 Check that ammo matches the gun or gunmod it's being loaded into. 2012-12-21 21:16:52 -06:00
Kevin Granade 7b9d796fb8 Only offer ammo for selection if the gun or gunmod it goes in has room for it. 2012-12-21 21:15:34 -06:00
Kevin Granade c1a358f466 Indentation fixes. 2012-12-21 21:07:42 -06:00
Kevin Granade 8b134d84c6 Make active_gunmod() public. 2012-12-21 19:08:39 -06:00
Kevin Granade b3a4b611fb Display ammo loaded in gunmods. 2012-12-21 19:08:15 -06:00
Kevin Granade 6d5e2f9f75 Check for ammo being present before checking its type. 2012-12-21 10:22:02 -06:00
Kevin Granade 752175b8ac Add support for gunmods with firing modes to reload code. 2012-12-17 20:32:01 -06:00
Kevin Granade fa48f6437b Add handling for gunmods with firing modes to item class accessors. 2012-12-17 20:30:05 -06:00
Kevin Granade 507c8f3d50 Add action to change the mode of the wielded weapon. 2012-12-17 20:28:52 -06:00
Kevin Granade 10aa1fb079 Add magazine size and ammo type to gunmods with firing modes, and update item handling code to handle the new properties. 2012-12-17 20:19:01 -06:00
Kevin Granade 6be3ee0604 Simplify tatical reload code. 2012-12-17 20:08:08 -06:00
Kevin Granade 06d571a70c Add some helper functions for dealing with weapon modes. 2012-12-17 19:47:05 -06:00
Kevin Granade a6b2fe3504 Add mode member to item class and initialize as appropriate. 2012-12-17 19:46:02 -06:00
Kevin Granade 6157de366f Add some weapon mode flags and apply them to weapons as appropriate. 2012-12-17 19:45:16 -06:00
TheDarklingWolf 087f2b7e36 Merge branch 'for-darklingwolf' 2012-12-17 23:40:13 +00:00
TheDarklingWolf a5847ac4bf Fixed some more recipe errors, added a few more fitted clothing types 2012-12-17 23:32:39 +00:00
TheDarklingWolf 8a39d215a3 Fixed ammo crafting issues 2012-12-17 14:41:34 +00:00
Kevin Granade b457d0f122 Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-12-16 17:45:23 -06:00
Kevin Granade f6528871b4 Make braziers prevent spread of fire and destruction of terrain. 2012-12-16 17:44:26 -06:00
Kevin Granade 7e4af6b1c3 Prevent fires from spreading into pits from regular terrain. 2012-12-16 16:19:48 -06:00
TheDarklingWolf cea5d5a76a Fixed some errors with monster item spawns 2012-12-16 20:41:06 +00:00
TheDarklingWolf c318168fc3 Fixed some ammo crafting stuff 2012-12-16 20:26:36 +00:00
TheDarklingWolf fcf40d70bf Fixed ammo crafting 2012-12-16 14:59:22 +00:00
TheDarklingWolf e86872308c Merged hand loader mod from the old forums. Thanks to Shadowscales for rescuing the files 2012-12-16 14:37:45 +00:00
TheDarklingWolf 779614fd91 Merged vehicle extension mod, improved the way logs are cut up. 2012-12-14 23:45:23 +00:00
TheDarklingWolf aead3adc89 Origamiwolf's trash compactor. (git://github.com/origamiwolf/DinoCataclysm.git) 2012-12-12 17:23:38 +00:00
TheDarklingWolf e3d03ab906 Added boiling water, and fixed the subtractions for stat boosting muts. 2012-12-12 17:15:15 +00:00
TheDarklingWolf e3590ab70e Reduced window and ceiling cost. 2012-12-12 12:22:50 +00:00
Kevin Granade e2d8972cc9 Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into select-fire
Conflicts:
	player.cpp
2012-12-10 19:16:25 -06:00
Kevin Granade d1bf705fac Unload IF_RELOAD_AND_SHOOT weapons if firing is cancelled. 2012-12-09 19:30:31 -06:00
Kevin Granade ac58269489 Typo fix. 2012-12-09 19:29:47 -06:00
TheDarklingWolf 704c73a030 Merge branch 'for-darklingwolf' 2012-12-09 19:45:06 +00:00
Kevin Granade 08cdba7c97 Make gasoline, and therefore flamethrower, deal a little direct damage too. 2012-12-09 13:38:03 -06:00
Kevin Granade 969fd891ef Make flamethrower cause a small flame explosion instead of a tiny fire field. 2012-12-09 12:48:14 -06:00
Kevin Granade bbe4d41051 Make flame explosions much quieter than concussive explosions. 2012-12-09 12:47:18 -06:00
TheDarklingWolf 23fcc1a626 Mostly curtains 2012-12-08 18:53:23 +00:00
TheDarklingWolf 884372f875 Merge branch 'for-darklingwolf'
Conflicts:
	mapitemsdef.cpp
2012-12-08 15:38:48 +00:00
origamiwolf 0c8cedd45e Swapped order of checks for rubble and wreckage clearing 2012-12-08 00:21:15 -06:00
Kevin Granade 00b6a52cb8 Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf
Tiny fixup.

Conflicts:
	mapitemsdef.cpp
2012-12-06 18:43:50 -06:00
Kevin Granade ba6a4a51f6 Display the contents of a spare magazine gunmod if there is one attached to the current weapon. 2012-12-02 17:00:36 -06:00
Kevin Granade c2107e2fcf The code for handling the behavior of spare magazines. 2012-12-02 16:59:56 -06:00
Kevin Granade 85327b5ad4 Add a pointer to the weapon being operated on in game::unload() to support spare magazine unloading. 2012-12-02 16:59:04 -06:00
Kevin Granade 346c9e6c03 Add tests to avoid attaching spare magazine to incompatable guns. 2012-12-02 16:55:13 -06:00
Kevin Granade 726137d6b9 Make sure new spare magazines are spawned with appropriate charges. 2012-12-02 16:44:17 -06:00
Kevin Granade bcbec0059a Simplify some code with new has_gunmod() helper. 2012-12-02 16:42:06 -06:00
Kevin Granade 8017be8902 Add item::has_gunmod() helper method. 2012-12-02 16:39:24 -06:00
Kevin Granade aacb8482c3 Add spare magazine to item spawn lists. 2012-12-02 15:30:27 -06:00
Kevin Granade 1507cd2c25 Fix indention in spawn lists. 2012-12-02 15:29:05 -06:00
Kevin Granade 1b55630753 Add spare magazine item. 2012-12-02 15:26:17 -06:00
Kevin Granade 58faaa348c Shift recoil indicator over to make roo for gun name. 2012-12-02 15:03:12 -06:00
Kevin Granade 558f29f79d Indentation fix. 2012-12-01 18:25:16 -06:00
TheDarklingWolf 3ca65b54f0 More work with fitted clothing.
Warm clothes prevent rain morale loss
2012-11-30 00:08:05 +00:00
TheDarklingWolf 8302fe4b44 Added new, fitting clothes, fitting clothes are rarer and have less penalties 2012-11-28 20:56:27 +00:00
TheDarklingWolf e3331ac5f8 Also fixed the splash text 2012-11-28 14:21:04 +00:00
TheDarklingWolf bc574bd27b Craftable vehicle controls 2012-11-28 14:20:16 +00:00
TheDarklingWolf 12c93c8196 Added some stuff 2012-11-28 02:27:07 +00:00
TheDarklingWolf ed5eb84f89 Some changes to bandage crafting 2012-11-27 18:35:21 +00:00
TheDarklingWolf 0bd32f3e6d Added candles, not very bright, but provide light for a long time 2012-11-27 18:14:26 +00:00
TheDarklingWolf 06cef3e014 Some work with crack and meth.
Need a drink can or crackpipe to smoke them from.
2012-11-27 15:43:02 +00:00
TheDarklingWolf ab845a6b05 Merge branch 'for-darklingwolf' 2012-11-26 17:43:57 +00:00
TheDarklingWolf 6e3dfee54a Tiny wording & grammar change 2012-11-26 10:12:17 +00:00
TheDarklingWolf 4aec44de3f Updated 2012-11-26 10:09:39 +00:00
Kevin Granade cbfaec8f6a Add drops of small numbers of nails when various walls and furniture are destroyed. 2012-11-25 22:13:21 -06:00
Kevin Granade 7d2a3b470c Simplify hammer use with new add_item(). 2012-11-25 20:07:58 -06:00
Kevin Granade e9d3b3e05e Add quantity argument to map::add_item() to allow spawning items with custom number of charges. 2012-11-25 20:07:47 -06:00
Kevin Granade 5d0b257920 Steal a line from message display and shift player info lines up in preperation for displaying weapon mode information. 2012-11-25 16:20:36 -06:00
TheDarklingWolf 1a955208da Merge branch 'for-darklingwolf' 2012-11-25 21:52:03 +00:00
TheDarklingWolf 5e45d53d37 Some fire stuff, breaks save compat 2012-11-25 21:50:39 +00:00
Kevin Granade 4a903b2ba9 Prevent furniture moving from practicing carpentry. Reported by uzername. 2012-11-25 15:30:55 -06:00
Kevin Granade 9ac16c53cf Add .gitignore file covering options.txt and keymap.txt 2012-11-25 14:35:41 -06:00
Kevin Granade f5be8bf696 Revert "Added peeking to the keymap"
This reverts commit cf59098d16.

Sorry about deleting everyone's keymap.txt file, but AFAIK there's no other way to prevent git from overwriting it now that it's tracking it.
2012-11-25 14:10:39 -06:00
Kevin Granade f362f66fc2 Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-11-25 13:51:53 -06:00
Kevin Granade 57f92de48f Added default keymapping for peek command. 2012-11-25 11:57:45 -06:00
TheDarklingWolf cf59098d16 Added peeking to the keymap 2012-11-25 17:48:54 +00:00
TheDarklingWolf 0a01240cb8 Cleaned up hacksaws a li'l 2012-11-25 17:22:35 +00:00
TheDarklingWolf 822a0e9be2 Moved car stuff into garages 2012-11-24 18:40:50 +00:00
Kevin Granade a756729a43 Fix check for valid key range for construction menu hotkey handling. 2012-11-24 10:47:22 -06:00
TheDarklingWolf e3cf746c8a Fixed an error in construction hotkeys 2012-11-24 16:46:50 +00:00
TheDarklingWolf 0071e262fd Merge branch 'for-darklingwolf' 2012-11-23 20:44:48 +00:00
TheDarklingWolf 0b713658ad Underslung shotguns, work much like the grenade launchers 2012-11-23 20:43:35 +00:00
Kevin Granade 4d607159ec Add hotkeys to construction menu. 2012-11-22 18:35:13 -06:00
TheDarklingWolf 124b898476 Merge branch 'for-darklingwolf' 2012-11-22 18:04:45 +00:00
TheDarklingWolf 375c1260f7 Fixed recipes using water 2012-11-21 23:25:49 +00:00
TheDarklingWolf 03ae914e4f Water purifiers less annoying to use now. 2012-11-21 17:42:12 +00:00
TheDarklingWolf a70b88a66a Hopefully got interruptions to work correctly with vehicle fuelling. 2012-11-21 14:49:27 +00:00
Kevin Granade 939a3ca74f Add peek command to allow the player to carefully look around corners. 2012-11-20 22:29:32 -06:00
TheDarklingWolf ac8ccd753b Added welders to garage spawns 2012-11-20 16:39:01 +00:00
TheDarklingWolf 3183ad6665 Fixed tile breaking, again. 2012-11-20 16:19:24 +00:00
TheDarklingWolf 681b0b7743 Added bashable tags where appropriate 2012-11-20 15:55:42 +00:00
TheDarklingWolf cfa9783799 A bit harder to smash things 2012-11-20 15:46:18 +00:00
TheDarklingWolf 02fff83f82 Smashable racks and fridges. Should no longer be obscenely hard to break things. 2012-11-20 15:40:11 +00:00
TheDarklingWolf 83b949904b Added lockers to shelter 2012-11-20 12:43:11 +00:00
Kevin Granade 5e01704e6f Prevent or reduce effects of fields on player when in a vehicle, especially an enclosed one. 2012-11-19 19:40:37 -06:00
Kevin Granade 43bb9522bc Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-11-19 17:57:33 -06:00
TheDarklingWolf 456fd2daf0 Disabled saving in vehicles, also stopped your feet hurting when you run over rubble. 2012-11-19 17:21:55 +00:00
Kevin Granade 6eb0be2d8a Teensy coding style fix. 2012-11-17 23:07:16 -06:00
Kevin Granade 4a983e7ea8 Make doors with vertically or horizontally adjacent furniture harder to bash. 2012-11-17 22:53:29 -06:00
Kevin Granade 542c59b166 Rework TheDarklingWolf's roof collapse code to be based on how much support a tile has instead of a hardcoded chance. 2012-11-17 21:23:03 -06:00
Kevin Granade 2c2eed7ac4 Optimize lightmap generation by exiting early when a tile is fully lighted. 2012-11-17 19:30:42 -06:00
Kevin Granade e3ff24c240 Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod into for-darklingwolf 2012-11-17 19:28:28 -06:00
Kevin Granade 86fabaad34 Add move furniture command to construction menu. 2012-11-17 19:20:11 -06:00
TheDarklingWolf 3fcfd0e8f3 Added crack, with all associated stuff 2012-11-17 22:31:42 +00:00
TheDarklingWolf d22cae48a5 Fixed fences smashing to dirt. Thanks to GTAGuy for the report. 2012-11-17 21:02:24 +00:00
TheDarklingWolf 54b0129b9a Fixed duct tape 2012-11-16 14:07:58 +00:00
TheDarklingWolf 676f3f1bcc Duct tape 2012-11-16 13:57:22 +00:00
TheDarklingWolf 5099ac4794 Added a few varieties of potato chip 2012-11-16 13:41:47 +00:00
TheDarklingWolf 24380b9a38 Mapgen fixes 2012-11-15 20:49:45 +00:00
TheDarklingWolf 9f678d2eaa Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod
Conflicts:
	mapdata.h
2012-11-15 20:48:57 +00:00
Kevin Granade 9550b43a1c Update mapitemsdef.cpp
Added foot crank item to appropriate spawn lists.
2012-11-15 14:17:10 -06:00
Kevin Granade 0625b05f3b Update itypedef.cpp
Make foot crank rarer in preparation for adding it to spawn lists.
2012-11-15 14:08:38 -06:00
TheDarklingWolf 08ede862fd Work on emergency lighting for labs 2012-11-15 14:36:56 +00:00
TheDarklingWolf 957a12bc39 Forgot flickering lights 2012-11-15 14:31:04 +00:00
TheDarklingWolf 74ed455ece Added a few tiles to support lights 2012-11-15 14:28:54 +00:00
TheDarklingWolf 99fa80bc4f Started basic work on tents 2012-11-14 21:04:47 +00:00
TheDarklingWolf eda6175448 Cleaned up jackhammers a bit 2012-11-13 19:26:30 +00:00
TheDarklingWolf 771fdcaab6 Skills show when below level 1 2012-11-13 12:13:19 +00:00
TheDarklingWolf 23f031efda Use hacksaws to cut bar tiles up. Examine rubble to clear it with a shovel 2012-11-13 00:01:05 +00:00
TheDarklingWolf bdda564486 Erm. Slightly less destruction. 2012-11-11 21:29:39 +00:00
TheDarklingWolf c1136f72d4 Total destruction is much more possible now 2012-11-11 21:23:53 +00:00
TheDarklingWolf a6a2892b59 roofs no longer drop rebar or stone 2012-11-11 20:49:23 +00:00
TheDarklingWolf 70b5da4860 Merged Kevin's fixes 2012-11-11 20:37:55 +00:00
TheDarklingWolf cf42902900 Merge git://github.com/kevingranade/Cataclysm 2012-11-11 20:37:52 +00:00
Kevin Granade 5553604045 Merge branch 'just-optimization' 2012-11-11 14:32:15 -06:00
Kevin Granade 44e60dd31f Clear vehicle list when changing Z-levels to prevent ghost vehicles. 2012-11-11 14:32:02 -06:00
TheDarklingWolf ddcba86217 Merge git://github.com/kevingranade/Cataclysm 2012-11-11 19:54:22 +00:00
TheDarklingWolf b6402254fa Basic roof collapsing code 2012-11-11 19:53:55 +00:00
Kevin Granade 7a6781993c Merge branch 'bugfix-rollup' 2012-11-11 11:55:07 -06:00
Kevin Granade eb9dc4c242 Handle teleporting off a vehicle properly. 2012-11-11 11:51:16 -06:00
Kevin Granade dce1aefeca Revert "Sanity-check results output of vehicle cache, this prevents vehicles from appearing on multiple z levels."
This reverts commit 8ac42285a2.

Took a different path with fixing this, and forgot to clean this one up before pushing the other fix.
2012-11-11 10:51:38 -06:00
Kevin Granade 3c8bb0bbe6 Merge branch 'just-optimization' of github.com:kevingranade/Cataclysm into just-optimization 2012-11-11 10:50:15 -06:00
Kevin Granade c0ca85feb4 Merge branch 'just-optimization' 2012-11-11 10:49:16 -06:00
Kevin Granade dba825c360 fix vehicle sinking code to work properly with vehicle caching. 2012-11-11 10:49:03 -06:00
TheDarklingWolf 6f3a59e228 Reverted to old catacurse for now. 2012-11-11 11:06:30 +00:00
TheDarklingWolf b6ee019dc5 Merge git://github.com/kevingranade/Cataclysm 2012-11-11 10:43:16 +00:00
TheDarklingWolf 9f8f01e5ec Attribution 2012-11-11 00:17:14 +00:00
TheDarklingWolf 064fa6b85b Merged gim's update of Shades' lighting mod 2012-11-11 00:14:05 +00:00
Kevin Granade fb38cfa71f Merge branch 'just-optimization' 2012-11-10 17:57:04 -06:00
Kevin Granade a27ca45972 Adjust vehicle caching reset to catch more cases. 2012-11-10 17:56:43 -06:00
GiM 59ad241116 I think this was causing flickering
(cherry picked from commit 95679282428ddabe9b3cdfa9fd7723a41127f622)
2012-11-11 00:05:52 +01:00
GiM 501b17eda5 Merge remote-tracking branch 'tdw/master' into git-main-lightmap-hj-int 2012-11-10 23:31:01 +01:00
GiM 9b72fb490b somehow 'continue' got lost during merge ;/ 2012-11-10 23:25:23 +01:00
TheDarklingWolf 174dde63f9 Changed smashing a bit 2012-11-10 20:22:34 +00:00
TheDarklingWolf da47ec5b29 Readded my knife and log changes 2012-11-10 20:14:58 +00:00
GiM eb769bbf9f Merge remote-tracking branch 'tdw/master' into gim-main-lightmap-hj-int
Conflicts:
	game.cpp
	item.cpp
	map.cpp
	mapgen.cpp
2012-11-10 19:25:50 +01:00
GiM 224847f7f1 after merge fixes 2012-11-10 19:13:07 +01:00
GiM b9c95bb3ed Merge remote-tracking branch 'kevin/master' into gim-main-lightmap-hj-int
Conflicts:
	game.cpp
	item.cpp
	iuse.cpp
	map.cpp
	mapgen.cpp
	player.cpp
2012-11-10 18:35:32 +01:00
GiM da1ad9b03e Merge remote-tracking branch 'herbertjones/master' into gim-main-lightmap-hj-int
Conflicts:
	debug.h
	keypress.cpp
	keypress.h
	options.cpp
	options.h
2012-11-10 17:41:11 +01:00
TheDarklingWolf b00cd29c5d Fixed poppy stuff 2012-11-06 13:17:06 +00:00
TheDarklingWolf ad820a5bc2 Poppy based drugs 2012-11-06 13:08:35 +00:00
TheDarklingWolf 117bebca25 Fixed rebar not being given by walls 2012-11-06 12:43:17 +00:00
TheDarklingWolf 0367385f69 Added cots and rollmats 2012-11-05 19:21:01 +00:00
TheDarklingWolf 7c6f8459f6 Added cots and rollmats 2012-11-05 19:09:59 +00:00
TheDarklingWolf 222ffa0b19 Fixed a screwup with rebar door move costs 2012-11-05 07:21:49 +00:00
TheDarklingWolf 25d42c27e1 Removed mouth from speed calculations, reduced encumberance of storage 2012-11-04 14:18:11 +00:00
TheDarklingWolf a238321d3a Renamed Carpentry -> Construction. Added in a skill magazine.
Reduced door construction cost.
2012-11-04 11:57:44 +00:00
TheDarklingWolf 7ee5ba840a Tweaked metabolic interchange 2012-11-04 11:28:47 +00:00
TheDarklingWolf 14b18a2a7a Fixed the silly huge bonuses from mutating extra stats 2012-11-03 12:16:24 +00:00
TheDarklingWolf 1686194f1a Added some attribution to main menu. 2012-11-02 20:12:33 +00:00
TheDarklingWolf 1416ad6679 Added rebar, similar stats to pipe, used for rebar doors. 2012-11-01 11:41:07 +00:00
TheDarklingWolf 1328426bfe Added codeblocks project file, for my own convenience. 2012-10-31 12:41:48 +00:00
TheDarklingWolf ea27156f99 Merge git://github.com/kevingranade/Cataclysm
Conflicts:
	game.cpp
	item.cpp
	iuse.cpp
	map.cpp
	mapgen.cpp
	player.cpp
2012-10-31 12:37:52 +00:00
TheDarklingWolf 1cf4941e5a A few minor changes 2012-10-31 11:53:16 +00:00
TheDarklingWolf 34b0331419 Upped vehicle spawns in garages a little 2012-10-28 20:39:19 +00:00
TheDarklingWolf 93fce651b9 Fixed garage spawns 2012-10-28 20:19:53 +00:00
TheDarklingWolf c5604b4cb1 Added vehicle renaming 2012-10-28 19:01:35 +00:00
TheDarklingWolf db12add5cd Added a door to garages, removed Car Repairing message 2012-10-27 14:11:21 +01:00
TheDarklingWolf cb345a4c90 Test 2012-10-22 19:09:56 +01:00
Kevin Granade ebbf82dc85 Merge branch 'just-optimization'
Conflicts:
	map.cpp
2012-10-21 18:16:17 -05:00
Kevin Granade f2fc0c6581 Prevent adjustment to vehicle coordinates when loading map data for game maintenance purposes.
Conflicts:

	map.cpp
2012-10-21 18:14:03 -05:00
Kevin Granade 0e1515a170 Reset vehicle cache when moving between Z-levels. 2012-10-21 18:07:58 -05:00
Matthew 5721e91aab Updated to compile under Cygwin 2012-10-21 19:48:45 +01:00
Kevin Granade 8ac42285a2 Sanity-check results output of vehicle cache, this prevents vehicles from appearing on multiple z levels. 2012-10-21 09:50:52 -05:00
Kevin Granade 05c5999321 Merge branch 'selective-skills'
Conflicts:
	player.cpp
2012-10-20 19:14:22 -05:00
Kevin Granade 8b53f92960 Merge branch 'bugfix-rollup' 2012-10-20 18:54:39 -05:00
Kevin Granade fb4fcaf8dd Merge remote-tracking branch 'origin/master' 2012-10-20 18:53:31 -05:00
Kevin Granade 9cd27755e2 Apply the functional fix from b159ecaae4, fixing map generation bug near overmap borders. 2012-10-20 18:48:15 -05:00
Kevin Granade 697b734423 Merge pull request #1 from creidieki/combined
Grab some long-outstanding bugfixes.
2012-10-20 11:43:24 -07:00
Michael Creidieki Crouch 2b9a257bae Correct missing comma in facdata.h which caused incorrect faction names 2012-10-20 12:53:48 -04:00
Kevin Granade ecfa9b18c1 Merge branch 'fix-monster-radius' 2012-10-19 19:29:58 -05:00
Kevin Granade 202c239688 Reduce monster group radius to maintain a minimal monster population density and shrink monster groups as they are wiped out. 2012-10-19 19:29:44 -05:00
Michael Creidieki Crouch 0de09e7e5f Change va_arg usage in setvector.cpp to be 64-bit safe. 2012-10-19 17:05:08 -04:00
Creidieki M. Crouch 4d1cb18d65 Fixed various issues with Preset Character menu, including crash
* The game no longer crashes if you go to the Preset Character menu with no preset characters made, then hit "Enter"
* Scrolling a long list of preset characters no longer leaves the last two elements unchanged
* The game correctly erases the "No templates found!" message
2012-10-19 16:44:15 -04:00
Creidieki M. Crouch 5cffff392c Fixed price_adjustment (was truncating integer division, barter skills above 6 always returned 0 price). 2012-10-19 16:43:18 -04:00
Kevin Granade 52029cea25 Merge branch 'ypots'
Conflicts:
	iuse.cpp
2012-10-18 21:25:45 -05:00
Kevin Granade d383930750 Merge branch 'just-optimization'
Conflicts:
	map.cpp
2012-10-18 21:24:17 -05:00
Kevin Granade 39a7e8ac1e Change transparency memoization buffer to a char array to reduce memory usage slightly.
(cherry picked from commit d41e1b6297e67b0b0ca2773a2df69f5102c2ab56)
2012-10-18 20:52:33 -05:00
Kevin Granade e262b74d6c Memoize transparent tiles when rendering map.
(cherry picked from commit 4368eab7a1719098503d63d766da855d2f09c993)
2012-10-18 20:52:24 -05:00
Kevin Granade 75539752b3 Replace special case shift code with a cache invalidation.
(cherry picked from commit 3fa26df1632fe2c220554a19632b19099f80bdb3)
2012-10-18 20:52:13 -05:00
Herbert Jones ccffd82195 Remove vehicle recache in wrong place which prevented more than one
vehicle displaying at a time.
Assume that a vehicle is currently in map on initial load, as assuming
otherwise might not show the vehicle until a recache.
Uncache deleted vehicles.
Improve variable names.
(cherry picked from commit c515c41c7a9ed5e29077d9d65ce2848daa2156c9)

Conflicts:

	map.cpp
	mapgen.cpp
2012-10-18 20:51:36 -05:00
Herbert Jones 6f0c8990f1 Make sure map::trans doesn't duplicate work.
(cherry picked from commit ab8e6b865d352efc1e879996537d57ce26ebb34c)
2012-10-18 20:32:43 -05:00
Herbert Jones f0c4a18558 Removed unneeded function calls. Minor cleanup.
(cherry picked from commit 27c8005a8005b6a79f0984e645d6bf9509044ecf)

Conflicts:

	map.cpp
2012-10-18 20:32:10 -05:00
Herbert Jones 4728e6dba2 Optimize veh_at to do nothing when no vehicles present. When vehicles
present use cached information. When vehicles move update cached
information.
(cherry picked from commit 9148befcf6bf9ac3dc71beb065a9f947f4fb8007)

Conflicts:

	map.cpp
2012-10-18 20:29:34 -05:00
Herbert Jones 7d86e37668 Added optimizations for veh_at, which previously was profiling at ~50%,
however with these optimizations run around ~10%.
(cherry picked from commit d85ad565420b8ecb93bacfd11e5414dca5c029f7)

Conflicts:

	Makefile
	debug.cpp
	debug.h
	map.cpp
	mapbuffer.cpp
	mapgen.cpp
2012-10-18 20:13:59 -05:00
TheDarklingWolf 335ff5c52a Fixed fences 2012-10-17 21:52:21 +02:00
TheDarklingWolf b0670a39d2 Added picket fences to crowbar iuse. 2012-10-17 10:42:23 +02:00
TheDarklingWolf c0583fa611 Update construction.h 2012-10-16 23:07:31 +02:00
TheDarklingWolf a6237d1c57 Update mapdata.h 2012-10-16 22:45:31 +02:00
TheDarklingWolf 5540b9f53e More bed stuff 2012-10-16 18:20:29 +02:00
TheDarklingWolf a24a743911 Makeshift beds 2012-10-16 17:51:32 +02:00
TheDarklingWolf 1211a40c9b Bed construction 2012-10-16 17:50:47 +02:00
TheDarklingWolf a4a32cee08 Makeshift beds 2012-10-16 17:49:27 +02:00
TheDarklingWolf f3a00bbb41 Makeshift beds 2012-10-16 17:47:05 +02:00
TheDarklingWolf 50c35a1875 Added some household constructions. 2012-10-16 17:44:13 +02:00
Kevin Granade d249925d07 Merge remote-tracking branch 'origin/patch-7' into ypots 2012-10-15 21:48:04 -05:00
Kevin Granade 58564c883b Merge remote-tracking branch 'origin/patch-6' into ypots 2012-10-15 21:47:58 -05:00
Kevin Granade b26c0583b4 Merge remote-tracking branch 'origin/patch-5' into ypots 2012-10-15 21:47:56 -05:00
Kevin Granade fec7af3349 Merge remote-tracking branch 'origin/patch-4' into ypots 2012-10-15 21:47:53 -05:00
Kevin Granade 01cec3aa30 Merge remote-tracking branch 'origin/patch-3' into ypots 2012-10-15 21:47:51 -05:00
Kevin Granade 99421f0c02 Merge remote-tracking branch 'origin/patch-2' into ypots 2012-10-15 21:47:49 -05:00
Kevin Granade e228af3a45 Merge branch 'fix-vehicle-warp' into bugfix-rollup 2012-10-15 21:31:16 -05:00
Kevin Granade 7ae18207d5 Fix uninitialized data in game class.
(cherry picked from commit 7425a57984)
2012-10-15 21:31:10 -05:00
Kevin Granade bf241ec9ca Fix crash due to NULL curammo.
(cherry picked from commit bef3b0960d)
2012-10-15 21:18:41 -05:00
Kevin Granade fce8162973 Fix sigsegv in player::i_add.
(cherry picked from commit ce8423b215)
2012-10-15 21:17:57 -05:00
Herbert Jones 5d3d67eec4 Fixed npc copy constructor.
Added some missing npc dialog.
(cherry picked from commit f48e918b04)

Conflicts:

	game.cpp
2012-10-15 20:59:15 -05:00
Herbert Jones 0808fb03a8 item_id may be negative if game crashes after a player dies in
player::load_info, which will prevent you from ever loading the player
again.
(cherry picked from commit d464969c00)
2012-10-15 20:56:29 -05:00
Herbert Jones fd4c214396 Coding conventions.
(cherry picked from commit 2912429e01)
2012-10-15 20:55:49 -05:00
Herbert Jones 6d65c1d470 Added game::add_msg_if_player(p, msg) at suggestion of kevingranade.
(cherry picked from commit 7728dd176e)
2012-10-15 20:44:55 -05:00
Herbert Jones 60729e7112 More NULL ptr dereferencing issues.
(cherry picked from commit 159d8a4360)
2012-10-15 20:43:54 -05:00
Herbert Jones d4ee5fcf40 Do not try to derefernce NULL pointers.
(cherry picked from commit 011fc2dcc2)

Conflicts:

	item.cpp
2012-10-15 20:33:12 -05:00
Kevin Granade c7e0e87d1a Fixed "You ..." messages in iuse.cpp when player is not you.
(cherry picked from commit b03929feb7)

Conflicts:

	Makefile
2012-10-15 20:28:23 -05:00
Herbert Jones 4a2a5d764d Copy constructor was missing many members.
(cherry picked from commit 2166af42b1)
2012-10-15 20:10:33 -05:00
Herbert Jones 63fc410767 Fix for trying to save unintialized data.
(cherry picked from commit 999f0f8d41)
2012-10-15 20:09:44 -05:00
Kevin Granade f09b2f4d50 Blood should not cover up items.
(cherry picked from commit 06f7a33403)
2012-10-15 20:07:11 -05:00
Herbert Jones 3eb6fe568f All instances of mon_at must check for -1 return.
(cherry picked from commit b6719918d4)
2012-10-15 19:59:38 -05:00
Kevin Granade 37eadceb68 Save and restore player skill focus settings. 2012-10-09 19:53:55 -05:00
Kevin Granade b983304c12 Prevent advancing skills that are un-selected for advancement. 2012-10-09 19:13:16 -05:00
Kevin Granade 160f1cb759 Adjust player info menu to allow setting and clearing sklearn values for skills. 2012-10-09 18:52:29 -05:00
Kevin Granade 2d6ea9916d Add an array of booleans indicating that the player wants to emphasize learning the corresponding skills, defaults to on. 2012-10-09 17:44:06 -05:00
Herbert Jones 9ac02b9bf6 Fix uninitialized data in game class. 2012-10-09 03:38:29 -05:00
Herbert Jones 7425a57984 Fix uninitialized data in game class. 2012-10-09 03:36:06 -05:00
Herbert Jones bef3b0960d Fix crash due to NULL curammo. 2012-10-09 00:51:11 -05:00
Herbert Jones bb15139353 Don't allow unhandled signals to cause timeout/getch to leave early and
cause the game to autosave.
2012-10-07 22:06:58 -05:00
Herbert Jones ce8423b215 Fix sigsegv in player::i_add. 2012-10-07 21:47:17 -05:00
Herbert Jones f48e918b04 Fixed npc copy constructor.
Added some missing npc dialog.
2012-10-07 19:05:33 -05:00
Herbert Jones d464969c00 item_id may be negative if game crashes after a player dies in
player::load_info, which will prevent you from ever loading the player
again.
2012-10-07 05:00:02 -05:00
Kevin Granade 77cc84f041 Update itypedef.cpp
Fix a minor typo, reported by Birdie. http://cataclysmbugs.com/mantis/view.php?id=15
2012-10-05 19:44:05 -05:00
Kevin Granade 30b628755a Prevent adjustment to vehicle coordinates when loading map data for game maintenance purposes. 2012-10-05 18:37:30 -05:00
Kevin Granade 7bb598c4ea Adjust all vehicles in copy_grid, not just the last one. 2012-10-05 18:33:40 -05:00
Kevin Granade 5686e6f4fa Update map.cpp
Typo in comment.
2012-10-05 18:28:50 -05:00
Herbert Jones 2912429e01 Coding conventions. 2012-10-04 19:34:41 -05:00
Herbert Jones 7728dd176e Added game::add_msg_if_player(p, msg) at suggestion of kevingranade. 2012-10-04 19:29:22 -05:00
Kevin Granade 11c9a705f4 Update player.cpp
Substitute magazine for clip.
2012-10-04 17:58:51 -05:00
Kevin Granade a1537d7eb9 Update itypedef.cpp
Substitute magazine for clip.
2012-10-04 17:56:45 -05:00
Kevin Granade cae7ee9de3 Update item.cpp
Substitute Magazine for Clip.
2012-10-04 17:54:36 -05:00
Kevin Granade ef83a931b1 Update bionics.cpp
Make confirmation message for installing an internal battery match the actual amount by which capacity is increased. Reported by anonymoucoward.
2012-10-04 17:44:17 -05:00
Kevin Granade 09d41598cc Update iuse.cpp
Fix typo in water purifier message.
2012-10-04 16:08:07 -05:00
Herbert Jones 159d8a4360 More NULL ptr dereferencing issues. 2012-10-04 15:45:26 -05:00
Herbert Jones 011fc2dcc2 Do not try to derefernce NULL pointers. 2012-10-04 15:23:41 -05:00
Herbert Jones b03929feb7 Fixed "You ..." messages in iuse.cpp when player is not you. 2012-10-04 00:01:28 -05:00
Herbert Jones 2b7cd5b373 Added more logging.
Added Makefile defines for logging.
2012-10-03 23:43:52 -05:00
Herbert Jones fe988b88b5 Debugger disable in Windows Makefile. 2012-10-03 01:13:15 -05:00
Herbert Jones 08a4de6ab0 Squashed commit of the following:
commit b8001fec40f1fffaeb9163637439839e7b1048a2
Author: Herbert Jones <jones.herbert@gmail.com>
Date:   Tue Oct 2 03:02:11 2012 -0500

    Some experimental fixes for the vehicle system that don't rely on
    coords and instead use player ids.

This works well with the map fixes in the previous commit to master.
2012-10-03 01:08:47 -05:00
Herbert Jones b159ecaae4 New debug logger with ability to set log level and filter sources.
Mapgen section 1 did not call draw functions.
2012-10-03 00:52:50 -05:00
Herbert Jones 2166af42b1 Copy constructor was missing many members. 2012-10-01 22:18:04 -05:00
Herbert Jones 999f0f8d41 Fix for trying to save unintialized data. 2012-10-01 21:41:38 -05:00
Herbert Jones b7b696d5ea Blood should not cover up items.
(cherry picked from commit 06f7a33403)
2012-10-01 23:31:49 +02:00
Herbert Jones b8bf484c86 All instances of mon_at must check for -1 return.
(cherry picked from commit b6719918d4)
2012-10-01 23:30:05 +02:00
Herbert Jones af7fcc22fa Restore curses timeout after using it. 2012-09-30 21:41:00 -05:00
Herbert Jones c60bd80b74 Don't use ESC as the no action flag in input_wait. 2012-09-30 16:18:26 -05:00
Herbert Jones 06f7a33403 Blood should not cover up items. 2012-09-30 16:11:00 -05:00
Herbert Jones 23c87bef1f Added autosave feature. 2012-09-30 13:56:54 -05:00
Herbert Jones b6719918d4 All instances of mon_at must check for -1 return. 2012-09-30 03:29:43 -05:00
GiM cb5105f9f3 fix lighting vehicles stuff 2012-09-29 08:39:27 +02:00
GiM 12050a2070 Merge branch 'master' into gim-main-lightmap
Conflicts:
	game.cpp
	map.cpp
2012-09-28 22:33:14 +02:00
Whales 16331bba19 Fixed problem with blood etc covering up items 2012-09-25 01:01:19 -04:00
Whales b5924a2f25 Rewrote map saving; entire map is stored in memory 2012-09-24 19:43:48 -04:00
GiM 98ebd8d238 argrgh move this block back where it was, before
I thought it will be *optimization* ;p
2012-09-19 00:21:34 +02:00
GiM 7bd8de49b9 fix option description to fit it on the screen 2012-09-18 23:37:56 +02:00
GiM 1fb2d2afa6 gradual light 2012-09-18 23:37:18 +02:00
GiM ca306c2917 add option for improved lighting 2012-09-18 21:04:09 +02:00
GiM caa7b16bc2 a bit hackish solution, but I guess this mimic original behaviour
correctly
2012-09-18 20:47:55 +02:00
GiM 8c10c7125d finally fix lighting 2012-09-17 21:49:35 +02:00
GiM 59d8da90bd eh, forgot about colon during merging 2012-09-13 00:42:52 +02:00
GiM 6d81793659 Merge remote-tracking branch 'remotes/benjamg/feature/lightmap' into gim-main-lightmap
Conflicts:
	game.cpp
	map.cpp
	map.h
	veh_type.h
2012-09-13 00:29:55 +02:00
GiM e271cdc342 Merge branch 'feature/winconsole' into gim-main 2012-09-12 19:47:24 +02:00
GiM 11961240ae move redrawing to the beginning of 'getch'
now everything should run smoothly, additionaly add 'hack'
so that we have will draw 'animations'
2012-09-11 03:33:08 +02:00
GiM 327f92f3e1 it was mouse thingy, that caused problems with input 2012-09-10 19:42:14 +02:00
GiM 824a51416c additional screenbuffer test 2012-09-10 19:41:35 +02:00
GiM c50edd6f1e add mapfile in makefile 2012-09-10 19:39:26 +02:00
GiM d598710a7a some morelogging inside main game class 2012-09-09 00:55:54 +02:00
GiM 71e0a3db61 different loging 2012-09-09 00:55:14 +02:00
GiM 2ca23ae66c save debug messages to debug file 2012-09-09 00:54:17 +02:00
Kevin Granade 57f3aeb885 Add a bicycle as a new vehicle type based on muscle power. 2012-09-08 12:32:51 -05:00
Kevin Granade e830130da5 Add a foot crank as a type of muscle powered power source. 2012-09-08 12:32:01 -05:00
Kevin Granade f7a32568a9 Add muscle powered as a fuel type. 2012-09-08 12:30:49 -05:00
GiM 2ccbc84b2a should be done otherwise, but... cls instead of clear on win 2012-09-08 13:06:07 +02:00
GiM e3b8506de5 hopefully last fix to keys processing 2012-09-08 12:58:31 +02:00
GiM f5caa29f09 replace some debug prints with kinda dummy DebugLog() 2012-09-08 12:50:46 +02:00
GiM e9bd4ba8a3 fix key processing, now it seems to be playable! 2012-09-08 12:32:31 +02:00
GiM 6da272de15 some additional fixes duing console initialization 2012-09-08 12:09:13 +02:00
GiM 840a74eaca fix colors 2012-09-08 03:50:03 +02:00
GiM 59fb64d32e mostly debug stuff, and some rearrangements, also commented out refresh
inside getch...
2012-09-08 03:26:55 +02:00
GiM 45250c102b console on win, seems to be working, but far from perfect 2012-09-08 01:48:40 +02:00
GiM d5aa6c4efb reindent (any decent editor can change "width" of displayed tabs ;p) 2012-09-08 01:43:48 +02:00
DarklingWolf 89fec415b3 Crafting menu scrolling 2012-09-05 06:26:20 +01:00
DarklingWolf eb9cc05864 Reworked construction stuff again 2012-09-05 06:22:47 +01:00
DarklingWolf 56907c92a0 Nail bat, better than a nail board 2012-09-05 05:52:25 +01:00
DarklingWolf 068f503140 Merge git://github.com/herbertjones/Cataclysm 2012-09-05 04:08:26 +01:00
DarklingWolf 0e0610fce8 Added various fences. 2012-09-05 03:33:42 +01:00
TheDarklingWolf a1dad0a504 Update mapgen.cpp 2012-10-07 01:47:39 +02:00
TheDarklingWolf 8e287613a3 Merge pull request #2 from uzername/master
Mutated flowers concept
2012-10-05 13:58:46 -07:00
uzername 8602c53565 Flowers 2012-10-05 21:59:34 +03:00
uzername e3f2a7a1df Can I change README.md 2012-10-03 19:21:14 +03:00
TheDarklingWolf bce80395b5 Update README.md 2012-10-03 11:05:09 +02:00
TheDarklingWolf 41615685fb Update README.md 2012-10-03 11:04:55 +02:00
DarklingWolf 23fa0623dc Merge branch 'master' of https://github.com/TheDarklingWolf/CataclysmMod 2012-09-04 23:54:05 +01:00
TheDarklingWolf f8d7ef4e82 Update README.md 2012-10-04 15:26:10 +02:00
TheDarklingWolf 5cae902543 Updated readme.
I assume anyone who gets here will already know about Cataclysm itself, so I don't need Whales' verbatim readme post :P
2012-10-04 12:50:25 +02:00
TheDarklingWolf b115c3e99a Merge pull request #1 from uzername/master
My first small pull request to README.md
2012-10-03 14:49:25 -07:00
DarklingWolf 5050d52f77 Merged HerbertJones' fixes. 2012-09-04 23:53:31 +01:00
DarklingWolf c5c45ca030 Merge git://github.com/herbertjones/Cataclysm 2012-09-04 23:37:59 +01:00
DarklingWolf b0d0e98898 Added Uzername's mapgen changes and new buildings. 2012-09-04 23:37:31 +01:00
DarklingWolf b1948db575 Merge git://github.com/Whales/Cataclysm 2012-09-04 20:00:12 +01:00
TheDarklingWolf f023010996 Initial commit 2012-09-26 15:57:43 -07:00
Whales cf18cea2fd Fixed bow issue 2012-08-26 13:40:46 -04:00
Whales 0767a2a02a Fixed the lack of vehicles. 2012-08-26 01:29:32 -04:00
Whales df7bc53182 Removed some debug messages. 2012-08-25 22:19:11 -04:00
Whales 829918b3b0 Fixed Makefile, MOTD 2012-08-25 20:43:36 -04:00
Whales 2cccc877d9 Some UI improvements, configurable options 2012-08-25 20:40:44 -04:00
Ben Gray 579fb9a059 Merge branch 'feature/lightmap' of github.com:benjamg/Cataclysm into feature/lightmap 2012-08-08 11:17:28 +01:00
Ben Gray 06a0541451 Merge branch 'master' into feature/lightmap 2012-08-08 11:17:22 +01:00
Whales 8b99eef480 Some bugfixes, edit keybindings via help menu 2012-08-06 20:25:29 -04:00
Ben Gray d20ef8ef47 Merge branch 'master' into feature/lightmap 2012-08-06 09:45:09 +01:00
Whales 3ff22bf4c4 Some UI improvements. 2012-08-05 22:26:46 -04:00
benjamg d195f89cbe shifting drawing to use precalculated mapcache (which we already generate for the lightmap) 2012-07-22 14:08:57 +01:00
benjamg ce8e91b9dd fix the reading issue 2012-07-19 22:24:02 +01:00
benjamg 2ec4adc6c0 fixed issue with near sightedness, readded Whales' daylight/cycle (modified to add a low light part), fixed vehicle lights 2012-07-18 19:30:29 +01:00
Ben Gray 0eba532016 improve veh caching, as a side effect this should open indoor veh lights 2012-07-18 15:42:35 +01:00
Ben Gray 5e6de296cb Removed daylight from lightmap, modified u_sees and draw to treat it as before 2012-07-18 12:15:23 +01:00
Ben Gray d9728a69e6 Bright lit squares now obvious to people with nightvision goggles or bio enhancement 2012-07-17 12:09:23 +01:00
benjamg 64d15bc4a3 added turret control to vehicle menu 2012-07-16 20:11:36 +01:00
benjamg e034b3aa34 added a menu to vehicles 2012-07-16 18:19:26 +01:00
benjamg fff78e0bee on fire creatures lit up the place 2012-07-16 16:59:35 +01:00
benjamg 8344007feb Basic monster lighting, effects manhacks, zombie shockers and flaming eyes 2012-07-16 16:38:16 +01:00
benjamg c57bec133e Fixed lookup around using new u_sees code, no longer can you see things in lit areas when you shouldn't. Bright lights now discribed as such when you can't tell what else it is 2012-07-16 15:24:33 +01:00
benjamg 672ba36345 360 degree light arcs 2012-07-16 11:48:22 +01:00
benjamg bd3fd79c32 added basic vehicle lights 2012-07-15 09:31:15 +01:00
benjamg d2d5f665b6 Fixed the u_see problem under low light. Modified the todos so all lightmap related ones are tagged [lightmap] 2012-07-15 00:50:33 +01:00
benjamg c5e91bf3f9 adding Darkling Wolf's flashlights on the ground changes, tweaked all lighting values to give a higher light vs shadow ratio 2012-07-14 19:02:02 +01:00
benjamg 839b8ad54f fixed slow flashlight issue, also improved general performance with a caching layer 2012-07-14 16:46:42 +01:00
benjamg 9dc6c321d0 Merge branch 'master' into feature/lightmap 2012-07-14 08:27:50 +01:00
benjamg 938a4b1ca2 indoor lighting during lighter daylight improved 2012-07-14 08:20:16 +01:00
Whales 76ef3446ae Fixed inventory letter chaos. 2012-07-14 00:32:40 -04:00
Whales 6ecb46fd55 Fixed a couple bugs in the last update. 2012-07-14 00:01:41 -04:00
benjamg 73c752b846 speed up the player light sources somewhat 2012-07-13 23:33:16 +01:00
benjamg 348c0e3c19 fix torches and other personal light sources 2012-07-13 22:49:10 +01:00
benjamg afc212dc0b don't show walls light from the outside while inside 2012-07-13 22:17:15 +01:00
benjamg 2ae7a6f4a7 merge from lightmapnew 2012-07-13 21:54:18 +01:00
benjamg c1188bfb51 added indoor lighting, fixed vision bugs for blind/impaired vision 2012-07-13 21:48:30 +01:00
Ben Gray 342b6e8904 modified brightness weightings 2012-07-13 15:18:16 +01:00
Ben Gray 3b06d52487 reverting some light value tweaks, fix lighting model from weather 2012-07-13 14:57:58 +01:00
Ben Gray 0c55a58c81 updated the endless todo's of things I need to tweak 2012-07-13 12:59:56 +01:00
Ben Gray 46972840c0 fix mistake made in merge 2012-07-13 12:41:07 +01:00
Ben Gray e292a05d92 more sensible light ray generation, added natural light overlay 2012-07-13 12:39:42 +01:00
Ben Gray 518b4a8161 more debugging, fix defines 2012-07-13 12:39:42 +01:00
benjamg d515c879d5 new light ray model, still broken 2012-07-13 12:39:42 +01:00
benjamg 7281ff7b4b modified sparks to give light based on density 2012-07-13 12:39:42 +01:00
benjamg cae0c2bbe9 fix seeing fire light while blind or in a pit, added hightlight for bright lights while short sighted 2012-07-13 12:39:42 +01:00
benjamg 76c2ee0535 support look around via u_sees function, remove debugging from draw system 2012-07-13 12:39:42 +01:00
Ben Gray a30020b9f9 can read next to fires now 2012-07-13 12:38:55 +01:00
benjamg b0238a1194 fixed the light of sight issues, smoke blockes light rays 2012-07-13 12:38:55 +01:00
benjamg 23a52e75c4 let monsters see player if they are lit up by something 2012-07-13 12:38:21 +01:00
benjamg cffbe2d141 moved lightmap for player to game object rather than map, maybe should be part of player 2012-07-13 12:38:21 +01:00
benjamg 8b098fdb4f new style lightmaps now working 2012-07-13 12:38:21 +01:00
Ben Gray 1aca1847ad moved to seperate lightmap generation to allow use by critters too, also faster 2012-07-13 12:38:21 +01:00
Ben Gray ad3820e28c renamed functions to match standard 2012-07-13 12:38:21 +01:00
benjamg f2d7e35e34 fix the dynamic lighting 2012-07-13 12:38:21 +01:00
Ben Gray 24201ba6bd switched all uses of old get_direction to new keymap method 2012-07-13 12:37:31 +01:00
Ben Gray 3c999b92b7 added untested light sources 2012-07-13 12:37:31 +01:00
benjamg c743dda481 modified sparks to give light based on density 2012-07-13 10:26:30 +01:00
benjamg f900e52b45 fix seeing fire light while blind or in a pit, added hightlight for bright lights while short sighted 2012-07-13 10:26:30 +01:00
benjamg fb3ee1703b support look around via u_sees function, remove debugging from draw system 2012-07-13 10:26:30 +01:00
Ben Gray 213bd1d64e can read next to fires now 2012-07-13 10:24:59 +01:00
benjamg d2b95b996d fixed the light of sight issues, smoke blockes light rays 2012-07-13 10:24:59 +01:00
benjamg a958eb7360 let monsters see player if they are lit up by something 2012-07-13 10:23:29 +01:00
benjamg 83b40aff43 moved lightmap for player to game object rather than map, maybe should be part of player 2012-07-13 10:23:29 +01:00
benjamg ef44bc1218 new style lightmaps now working 2012-07-13 10:23:29 +01:00
Ben Gray 768bf2efd4 moved to seperate lightmap generation to allow use by critters too, also faster 2012-07-13 10:23:29 +01:00
Ben Gray 02844d9563 renamed functions to match standard 2012-07-13 10:23:29 +01:00
benjamg 1aac60223b fix the dynamic lighting 2012-07-13 10:23:29 +01:00
Ben Gray f66a101735 added untested light sources 2012-07-13 10:22:40 +01:00
Whales ef76a5e3a1 Many bugfixes. Some UI improvements. 2012-07-13 01:59:53 -04:00
Whales 6cc2390495 A few more small fixes. 2012-07-09 18:22:34 -04:00
Whales 7af5bcea66 More fixes, you can toggle NPCs off 2012-07-03 01:26:56 -04:00
Whales 5f39a42f32 Several game-breaking bug fixes. Good night. 2012-07-02 01:47:46 -04:00
Whales 95974473e6 Fixed a crash when asking NPC to lead you to safety. 2012-06-30 22:37:52 -04:00
Whales 20fb52e49c Fixed some NPC aggression issues. 2012-06-30 22:29:30 -04:00
Whales c4df7ad9be Adding missing files, lol 2012-06-30 19:34:14 -04:00
Whales 4b7038a7a8 Melee update. Saved NPCs, wild NPCs, interruptable actions, much more. 2012-06-30 19:31:30 -04:00
Whales 2818169ec2 A few more things. 2012-04-26 22:38:16 -04:00
Whales f926dc2cd8 Forgot to remove keymap.txt 2012-04-26 20:43:22 -04:00
Whales 84e7b70bfb Bug fixes left and right 2012-04-26 20:39:57 -04:00
Whales 0f9d6ff139 Some bug fixes, minor missing features, new motd 2012-04-22 23:23:35 -04:00
Whales e0ea44a397 Defense mode. Keybindings. 2012-04-22 22:00:05 -04:00
Whales 2f78a6cea1 Fixed a frequent segfault. 2012-03-08 15:26:13 -05:00
Whales 899698d630 Removed a couple debug outputs I left in. 2012-03-08 00:50:38 -05:00
Whales 5a5ef867fd New monster AI, many tweaks 2012-03-08 00:12:40 -05:00
Whales 93b374a1f3 NPCs travel with you, many tweaks and bug fixes 2012-01-29 02:16:46 -05:00
Whales 47dbd003bf In-depth monster armor; more mutations; XP tweak; bug fixes 2012-01-21 18:15:47 -05:00
Whales 07a1cb62f6 Mutation update! 2012-01-17 19:23:32 -05:00
Whales d2d1653a5c Software. New missions. Hospitals. Bugfixes. 2011-12-15 15:51:58 -05:00
Whales 00584a1550 Added some missing files! Oops. 2011-12-12 04:02:23 -05:00
Whales c7f5eb32f0 Fixed a segfault. 2011-12-12 03:48:14 -05:00
Whales 357b6b0fb3 NPCs die if they dont get needed antibiotics. 2011-12-12 02:23:33 -05:00
Whales 3328c6bae4 More missions, fleshed out mission system 2011-12-12 02:13:06 -05:00
Whales 9dfb3cb318 Attempting speech checks practices speech skill. 2011-12-10 17:24:52 -05:00
Whales ea84a277df More dialogue and stuff. 2011-12-10 17:04:09 -05:00
Whales f49f81b432 Fixed a segfault. 2011-12-08 00:21:54 -05:00
Whales 710b3a0297 Mapping issues fixed. 2011-12-07 21:27:53 -05:00
Whales ef904d0620 Shelters. NPC dialog and missions. 2011-12-07 21:09:08 -05:00
Whales 43e93a580a Melee tweak I forgot 2011-12-03 16:13:50 -05:00
Whales 1f60992516 Stairs fixed. More loot in pawn shops. 2011-12-03 16:08:51 -05:00
Whales f820fd223d Minor game-loading problem fixed. 2011-12-02 02:28:11 -05:00
Whales fadac131e3 Bigger active maps. Lots of efficiency changes. 2011-12-02 02:15:09 -05:00
Whales 0f9e9bf4f5 Fixed broken saves. 2011-11-18 20:50:50 -05:00
Whales 494276b3e2 More add_spawn bugfixes 2011-11-18 20:00:45 -05:00
Whales 03bfb855fe Less snakes in temple flood rooms. 2011-11-18 18:44:47 -05:00
Whales 39f7a324b3 Megastores. Long-range mapping. Bugfixes and tweaks. 2011-11-18 18:33:16 -05:00
Whales bceef0cf51 Fixed monster footstep volumes 2011-11-16 21:44:21 -05:00
Whales 75fa516546 Tunneling animals won't follow you over stairs 2011-11-16 21:36:44 -05:00
Whales f7afaaea56 Fleeing monsters no longer follow over stairs 2011-11-16 21:33:10 -05:00
Whales 804b474529 Fixed an error in vertical move. Improved monster pathing to stairs. 2011-11-16 21:31:09 -05:00
Whales 08eaf94d4f Fixed a couple artifact generation bugs. 2011-11-15 19:53:49 -05:00
Whales ce7898aba3 Fixed some misaligned artifact armor data. Requires a clean build. Sorry. 2011-11-15 19:33:40 -05:00
Whales 4cb43d45ee Made flipping switches in temples take up a move. 2011-11-15 19:23:00 -05:00
Whales b44185be71 Made getting into temples a little more intuitive. 2011-11-15 19:19:00 -05:00
Whales 769d1dc54f Removed a couple of debug messages. 2011-11-15 19:01:20 -05:00
Whales 1c7faeef5c Increased artifact appearance a little. 2011-11-15 18:45:29 -05:00
Whales f43b5d17ab Removed artifact spawning from debug 2011-11-15 18:41:41 -05:00
Whales 7db51d1119 Temples. Random artifacts. 2011-11-15 18:40:25 -05:00
Whales 6cc69c1b8a Spiked pits are now actually constructable. 2011-11-07 14:29:35 -05:00
Whales fd7f371a94 Further tweaks to the triffid finale. 2011-11-07 01:47:26 -05:00
Whales 0cee4ad347 Tweaked down triffid group radius and triffid heart generation. 2011-11-07 01:34:57 -05:00
Whales e720ba9270 Tweaked down triffid group radius. 2011-11-07 01:28:25 -05:00
Whales 90b3b338ed A couple tweaks to triffid content. 2011-11-07 01:24:47 -05:00
Whales 0944c37a26 FunctionZero's keypad enter fix. 2011-11-07 01:04:42 -05:00
Whales e6fd9aab4c Triffid lairs. Many bugfixes. 2011-11-07 00:54:32 -05:00
Whales 93536c0abc Crafting recipe for bayonet. 2011-11-02 17:48:30 -04:00
Whales f26ab4cb78 Crafting + construction rewrite; some bugfixes; bayonets 2011-11-02 17:40:17 -04:00
Whales a623e25548 Fixed a typo that prevented compiling. Oops. 2011-10-27 18:36:45 -04:00
Whales 50737a437b Fixed melee crit chances. 2011-10-27 18:10:22 -04:00
Whales 37d4ed3eed Player-made character templates + more. 2011-10-27 17:41:43 -04:00
Whales 7e78c238a2 Further crit tweaks, fire ammo consumption fix 2011-10-25 22:29:55 -04:00
Whales a9c5f3864e More bugfixes and tweaks. 2011-10-25 20:06:50 -04:00
Whales e2da2eba12 Fixed broken saves. haha 2011-10-25 19:26:00 -04:00
Whales fd6958b400 Fixed a couple errors with the latest update. 2011-10-25 19:24:25 -04:00
Whales f271b5e0b4 Forgot to give stabbing skill a say in determining critical hits. 2011-10-25 17:08:19 -04:00
Whales e625ed348e Vastly improved fire. Many tweaks and bugfixes. 2011-10-25 16:21:40 -04:00
Whales f18f111c9f Grenade launchers, bunkers, bugfixes. 2011-10-21 18:47:23 -04:00
Whales 12192b032b Changed default ignore monster command to ' 2011-10-20 21:50:39 -04:00
Whales 6f7bb993b5 No more turrets traversing stairs. 2011-10-20 21:47:00 -04:00
Whales 401a2c823a Multiple fixes. New debug functions. Fungal spires work. 2011-10-20 21:44:43 -04:00
Whales ef8e986c59 Merge pull request #28 from Madrawn/master
Madrawns Modded Stuff
2011-10-20 11:14:16 -07:00
Nailed 9aa028517c Merge branch 'master' of github.com:Madrawn/Cataclysm 2011-10-20 18:45:43 +02:00
Nailed a0639bcf47 Merge branch 'master' of git://github.com/Whales/Cataclysm 2011-10-20 18:42:16 +02:00
Whales 5f78e47d1f weed basement fix 2011-10-20 02:57:51 -04:00
Daniel 1b084ea2ca Merge branch 'master' of https://github.com/Whales/Cataclysm into scent 2011-10-20 08:45:56 +02:00
Whales 6c76a3f7e0 Various bugfixes, minor features 2011-10-20 02:25:49 -04:00
Nailed da9f23241a misplaced a ! 2011-10-19 22:26:32 +02:00
Nailed e97ad5fa68 removed the old unused diff 2011-10-19 22:15:55 +02:00
Nailed 4d8a772860 scent vision and bionic, should work.. looking at you git 2011-10-19 22:03:28 +02:00
Nailed 8503c961d5 Merge branch 'scent' of github.com:Madrawn/Cataclysm into scent 2011-10-19 18:09:44 +02:00
Daniel 88f67243dd scent bionic 2011-10-19 13:31:34 +02:00
Nailed b0cf4369ff Merge branch 'master' of git://github.com/Whales/Cataclysm 2011-10-15 21:57:35 +02:00
Nailed 3493d04e4e merging whales 2011-10-15 21:57:27 +02:00
Whales 96c9593476 Fixed crash when cancelling a drop 2011-10-15 02:41:27 -04:00
Whales a6af9cbd2d Forgot to actually use up rope if you tie it off and climb down 2011-10-15 00:44:05 -04:00
Whales d51ae662ff Some small fixes I forgot 2011-10-15 00:34:34 -04:00
Whales b8cb160513 Stairs update. 2011-10-15 00:15:57 -04:00
Daniel ac9fcd7f32 forgot to fix merge conflict 2011-10-10 08:35:24 +02:00
Daniel df5465a798 fixing merging conflicts 2011-10-09 19:31:28 +02:00
Daniel 67dd809314 Enabled NPCs for testing 2011-10-09 19:28:25 +02:00
Whales 6815400644 Several bugfixes for the latest release. 2011-10-09 02:34:26 -04:00
Whales fa6cd30a83 Minor weather warning fix 2011-10-08 22:25:10 -04:00
Whales 7010072f00 Big update centered on mines. 2011-10-08 22:09:09 -04:00
Daniel fc69a99605 Merge remote-tracking branch 'upstream/master' 2011-10-06 10:20:14 +02:00
Daniel b6e66d3c1c merging whales 2011-10-06 10:19:51 +02:00
Whales 6faf55edfa Fixed fire bug. Reverted erroneous comment. 2011-10-05 14:49:21 -04:00
Daniel 000627ee75 Merge remote-tracking branch 'upstream/master'
Conflicts:
	game.cpp
	mongroupdef.cpp
2011-10-05 14:23:16 +02:00
Daniel 18cfaef4f4 commit before update 2011-10-05 14:19:24 +02:00
Whales b728bd5e6f Fixed ungennable radio tower. 2011-10-05 02:45:00 -04:00
Whales 0c808641ef Big ol update, many changes. 2011-10-05 02:19:08 -04:00
Daniel 7086fb8855 host the diff for me, my minions! 2011-10-03 02:01:13 +02:00
Daniel c6d34a378f C4, Boobytrap, new query_int (0 to 9) 2011-10-03 01:45:42 +02:00
Daniel 215e761464 C4, Boobytrap, new query_int (0 to 9) 2011-10-03 01:36:17 +02:00
Daniel 2f649dd139 Dogfood, Dogspawning and Dogtaming - Should be working! 2011-10-02 19:29:21 +02:00
Daniel 49562fe156 dog testing 2011-10-02 10:52:32 +02:00
Daniel 0e2dca271a Auto Run Mode and space for ignoring current monsters 2011-10-02 03:44:26 +02:00
Daniel 533442dfdd Auto Run Mode and dogfood for dog taming (like starting dog) 2011-10-02 02:38:43 +02:00
Whales 760b8a242e Added forgotten calendar files. 2011-09-27 16:11:21 -04:00
Whales 5d470f1536 Non flesh monsters no longer splatter blood. 2011-09-27 13:55:26 -04:00
Whales 2d633e1a29 Fixed incorrect sunrise/sunset transition. 2011-09-27 13:47:55 -04:00
Whales a3976c83dc Blood splatters. 2011-09-27 13:39:46 -04:00
Whales 2830d55377 Fixed sewing kit segfault 2011-09-24 13:28:31 -04:00
Whales 07a8cfb93a Fixed bug that precluded the use of gun mods 2011-09-23 11:23:34 -04:00
Whales 6f350bc68c Tool use bug fixed. May have introduced new bugs; be vigilant. 2011-09-22 13:16:10 -04:00
Whales bc86e7acea Redid map saving structure. 2011-09-20 16:42:28 -04:00
Whales 047e28a5db More bug fixes. 2011-09-20 12:02:39 -04:00
Whales c8b2cd92a7 Several bug fixes, small features 2011-09-20 11:52:40 -04:00
Whales 8d49ea49d8 Inventory letter collision fix? 2011-09-19 01:52:55 -04:00
Whales 450002cf9e Fixed hammer-use bug. 2011-09-19 01:23:03 -04:00
Whales 097575fe55 Added capentry manual to sporting goods stores. 2011-09-19 01:20:35 -04:00
Whales 06dc370d5b Removed debugmsg from construction.cpp 2011-09-19 01:19:15 -04:00
Whales ee7bd30f81 Made the new book types spawn. 2011-09-19 00:24:52 -04:00
Whales 82d3778e95 Added the new files, whoops! 2011-09-18 23:03:49 -04:00
Whales 8ff8197851 Huge construction and inventory update. Clean build and save removal required. 2011-09-18 22:46:44 -04:00
Whales 995d6986af Moved debug functions to their own menu. 2011-08-08 21:41:44 -04:00
Whales 2ec930b3bf Smashable bookcases 2011-08-01 22:53:53 -04:00
Whales a0de4d05b6 Merged Drevlin's mapscreen patch. 2011-08-01 19:11:04 -04:00
Whales 6d0dad1c2e Added inventory letter reassignment. 2011-07-31 16:31:03 -04:00
Whales 1667644ed9 Fixed typo in flour description. 2011-07-31 02:49:37 -04:00
Whales 41766138d4 Wax floors count as indoors. 2011-07-31 01:48:47 -04:00
Whales 0cb4a7e92f Nerfed morale gain. Updated help to include information on morale. 2011-07-31 01:35:09 -04:00
Whales 50a6e9141b Merged Deon's Little Mod. 2011-07-31 01:00:35 -04:00
Whales fc650167db Fixed two directional-drop bugs. 2011-07-28 19:00:44 -04:00
Whales 4b33234305 Directional drop added. 2011-07-28 02:24:58 -04:00
Whales 521018239e Minor tweak of robocop spawning. 2011-07-25 09:43:55 -04:00
Whales 41725ec9b7 Added break-in alarms for banks and police stations and a detailed police hunt system. 2011-07-25 09:37:47 -04:00
Whales c7fae52d6d Fire now spreads significantly more slowly. 2011-07-24 02:19:33 -04:00
Whales 7d0c768085 Lightning toned down. 2011-07-23 19:12:16 -04:00
Whales 7c098650b1 Game autosaves on map_update() function 2011-07-23 18:20:19 -04:00
Whales f3c745db67 Merged Drevlin's circular menu and Quit When You Want mods 2011-07-23 17:30:19 -04:00
Whales 89df44437f Moved save game deletion to the moment of death to prevent exploit 2011-07-23 16:52:51 -04:00
Whales 36a5520435 Fixed slow movement message bug. 2011-07-22 13:35:45 -04:00
Whales 48f00d929e Couple of fixes. 2011-07-22 03:56:53 -04:00
Whales a704eb9338 Updated vault contents. 2011-07-22 02:41:54 -04:00
Whales ac8a977e89 Complete computer rewrite. Several other changes. 2011-07-22 02:37:22 -04:00
Whales 7ea5fe7c75 Complete computer rewrite. Several other changes. 2011-07-22 02:36:39 -04:00
Whales e319094ddc Nerfed Pain Resistant and reduced cost to 2. Fixed bank generation bugs. 2011-07-09 11:58:56 -04:00
Whales cdd0f23f9c Applied cib1's patch--no gameplay changes. 2011-07-08 20:46:49 -04:00
Whales 55cbf7a7ce Minor tweaks to portal generation. 2011-07-08 01:39:20 -04:00
Whales 4fb5f3e46a Removed temperature effects altogether. Nerfed marijuana painkiller effect. 2011-07-07 23:10:56 -04:00
Whales 725c3d2b6e Morale penalties from rain nerfed. 2011-07-07 21:58:28 -04:00
Whales 9c43e01bb8 Craftable flamethrower. 2011-07-07 20:48:56 -04:00
Whales 77d47a1dd4 Added incendiary ammo to military drops. 2011-07-07 19:41:39 -04:00
Whales 30318f9ab3 Special ammo effects added. Incendiary ammo for 7.62 M87, 5.56 NATO and 7.62 NATO added. 2011-07-07 19:37:13 -04:00
Whales a2c319b7ab Crafting times tweaks. Changed lighter usage message. 2011-07-05 18:04:47 -04:00
Whales 9b03771800 Disabled NPC spawn. Spear tweaks. Saiga-12 no longer loads by individual cartridges. 2011-07-05 17:51:42 -04:00
Whales 284d7f3fe5 Updated item placement - CLEAN BUILD REQUIRED 2011-07-05 02:55:20 -04:00
Whales f1fc78ab64 Cutting tweaking 2011-07-05 02:37:47 -04:00
Whales fd0dd79d94 Melee nerfing, especially at high levels. 2011-07-05 02:30:36 -04:00
Whales 3cf049f945 Moved melee combat functions to melee.cpp 2011-07-05 01:55:59 -04:00
Whales a37725318b Fixed sign bug when display effects of leg encumbrance 2011-07-03 01:32:32 -04:00
Whales 269f5a7643 Revert "Merge pull request #9 from Alien-AV/master"
This reverts commit 2ab533308f015d139bc2ff8a365ca7a157a802b6, reversing
changes made to d49d8c0f9c2547835304be0b3f7651f0ac71d285.
2011-07-02 19:53:18 -04:00
Whales ace358a7dc Merge pull request #9 from Alien-AV/master
Adds windows support
2011-07-02 15:13:34 -07:00
Whales 38b5fbd276 2 extra points on character creation. 2011-07-02 18:06:18 -04:00
Whales 208eb75efd Several bugfixes and optimizations 2011-07-02 17:58:10 -04:00
Alien_AV 469bfcfb43 merged with upstream 2011-07-02 08:13:35 +03:00
Whales 5418c20642 Fixed bug that made used-up ammo fail to disappear. Other small bugfixes. 2011-07-01 21:40:33 -04:00
Alien_AV a23d47c919 fix backspace, make screen clear attempt after exit not happen on windows 2011-07-01 06:51:24 +03:00
Alien_AV 17fc76a174 merged to upstream, HP now still shows after screen switches 2011-07-01 06:30:33 +03:00
Alien_AV d5e3a91a47 Merge remote-tracking branch 'upstream/master' 2011-07-01 06:05:44 +03:00
Whales 8f0ea42fdf Fixed eating your pants crash. 2011-06-30 23:00:00 -04:00
Whales 585f86f91a Capped randomly generated characters at 3 traits 2011-06-30 20:35:21 -04:00
Whales f2358ccc61 Gimped morale from food. 2011-06-30 18:15:06 -04:00
Whales 22e2673b35 Autosave on half-hour. Gender saves properly. 2011-06-30 17:52:05 -04:00
Whales 13b5f9655e Added banks. 2011-06-30 13:59:52 -04:00
Alien_AV 7b809b5e26 adjusting for windows compatibility, minor bug fixes 2011-06-29 17:03:55 +03:00
Whales 18a226a3c6 Police station added. Clean build required! 2011-06-28 17:43:06 -04:00
Whales e51299b292 Fixed is_game_over() bug with no return value 2011-06-28 16:09:23 -04:00
Whales 17dbb9c19e Fixed death screen kill counter. 2011-06-28 16:06:57 -04:00
Whales f22614a2ca Fixed stunned-monster bug that caused freezes. 2011-06-28 15:34:09 -04:00
Whales 21eb858ef9 NPCs that cause a game freeze will now die, rather than create an infinite loop. 2011-06-28 13:34:30 -04:00
Whales daaeb79341 Death screen updated. 2011-06-28 02:45:21 -04:00
Whales cbbae51103 Added a game over screen, which tallies your kills. 2011-06-28 02:32:53 -04:00
Whales 64f27e8637 New characters are now limited to 3 advantages and 3 disadvantages. 2011-06-28 01:51:59 -04:00
Whales 67b0ab2bd7 Death is now real! 2011-06-28 01:14:51 -04:00
Whales 445c4cb0a9 Loading a save game now deletes the save file. 2011-06-28 01:13:27 -04:00
Whales 3ddfe99811 Support for unlimited save files. 2011-06-28 00:38:21 -04:00
Whales 518503d579 Partially-finished turret crafting 2011-06-26 21:51:00 -04:00
Whales 22ee09d8a8 Added moraledata.h to repo. lol 2011-06-26 21:13:48 -04:00
Whales 948ab0cb21 Added code_doc directory, where all documentation on code will be in the future 2011-06-26 20:33:48 -04:00
Whales 518d122efd Morale overhauled again. Several bugfixes and tweaks. 2011-06-26 20:33:10 -04:00
Whales 6d4af60756 Made acid rain less deadly. 2011-06-20 22:29:33 -04:00
Whales 59dc9e0cc5 Save bug fixed. Clean build and removal of save data required. 2011-06-20 21:51:38 -04:00
Whales ac5b7890d8 Updated help, TODO and a few minor bugfixes 2011-06-17 18:53:33 -04:00
Whales 1de7e02091 Typo fixes. Eyeglasses no longer contribute to encumberment at all. Thanks to RM for bug reports. 2011-06-17 14:48:38 -04:00
Whales 84f49e8000 Several important bugfixes. Overhauled morale system. CLEAN BUILD REQUIRED. 2011-06-17 03:37:08 -04:00
Whales a1882258fb Fixed some color issues. 2011-06-15 23:09:36 -04:00
Whales 1afb72db4a Fixed a few compile-time bugs 2011-06-15 18:44:05 -04:00
Whales 73705055b4 Added missing files; weather and texthash 2011-06-15 18:04:59 -04:00
Whales b60ab36c2e New monster: dermatik, and a new disease that dermatik causes (parasitic larvae). CLEAN BUILD REQUIRED 2011-06-15 15:58:11 -04:00
Whales 932960856f Fixed bug where XP was used twice as fast as it should've been. lol 2011-06-14 02:52:53 -04:00
Whales f794197638 Updated motd 2011-06-14 01:37:40 -04:00
Whales 851d6d7838 Weather now works. XP Pool that fills from morale. 2011-06-14 01:17:15 -04:00
Whales 1dc2e4c789 Updated TODO 2011-05-31 17:31:34 -04:00
Whales e3e4150e67 Added two new firearms, American-180 and Steyr AUG. Should require a clean build and removal of saves. 2011-05-31 17:28:45 -04:00
Whales 8f954ea342 Fixed stupid item::is_book() bug :| 2011-05-26 00:02:46 -04:00
Whales 4c1e721e4d Lots of melee tweaks, a couple small features; CLEAN BUILD AND rm save/* REQUIRED! 2011-05-25 23:58:05 -04:00
Whales c0d8ecf9dd Fixed liquid handling--no more storing liquid in non-watertight or unsealable containers 2011-05-13 19:05:54 -04:00
Whales 0f1df830f7 Added chainsaw effects - reduced chance to get stuck in enemies, and splatters blood all over. 2011-05-13 11:29:52 -04:00
Whales d6cd3a3d5a Reversed some changes that introduced lots of terrible map bugs. 2011-05-08 09:18:55 -04:00
Whales 0b38e7dd3b Minor bugfixes. 2011-05-07 08:31:46 -04:00
Whales 81a8e2efbf Fixed some NPC bugs. 2011-05-04 15:41:51 -04:00
Whales 09e0b740f2 Added swamp monsters and stabbing weapons; also the weapon_flag enum to give weapons special effects. 2011-05-04 14:50:21 -04:00
Whales 325947da52 NPC AI work and items update. Clean build required. 2011-04-29 00:34:30 -04:00
Whales 75e7f02015 Geiger counters can now be switched to continuous scan. Player movement penalties from radiation capped. 2011-04-28 05:34:51 -04:00
Whales 8b2fb01b8c Character data screen ('@' key) now provides detailed encumberance information 2011-04-27 16:24:33 -04:00
Whales 9a45b178c8 Fixed 'weapon gets stuck' message bugs. 2011-04-27 13:15:04 -04:00
Whales 45941bdaf1 Updated NPC battle AI. Requires clean build. 2011-04-27 00:21:41 -04:00
Whales 1cbc0aaf85 Fixed save/load bug 2011-04-25 20:59:28 -04:00
Whales 1129b2df71 Should compile now, lol 2011-04-24 00:18:04 -04:00
Whales f32b8c697c Fixed bug caused by eating via a key. More progress on missions. 2011-04-19 21:16:14 -04:00
Whales a1eed05d71 Renamed mission_start to mission_update 2011-04-18 12:09:52 -04:00
Whales 323faf52af Progress on mission code. 2011-04-18 12:09:23 -04:00
Whales 348a5e825d Some bug fixes, improved pickup interface 2011-04-15 04:19:52 -04:00
Whales fec53eb0f7 Added enum talk_topic 2011-04-15 02:59:55 -04:00
Whales 979bb1d78d Added mission_place.cpp and mission_start.cpp 2011-04-15 02:57:43 -04:00
Whales b2800d2eb4 Added mission.cpp 2011-04-15 02:55:11 -04:00
Whales e2db12d622 NPCs are back! Lots of other code refactoring. 2011-04-15 02:50:38 -04:00
Whales 806fd7d519 Further stat updates. 2011-02-22 12:48:00 -05:00
Whales 35637d956f Unified some code for how stats alter gameplay (e.g. how Dexterity alters chance to hit) and exposed these values during character creation 2011-02-17 12:51:54 -05:00
Whales 84b6a3e149 Reading books is more user-friendly. Gun info is more explicit about what values come from ammo / the gun itself. 2011-02-04 02:48:23 -05:00
whales f71dc83330 Fixed typo. 2011-02-01 02:56:18 -05:00
m847 80a9c1f30d Massive commit from work I've done / patches I've applied while without a computer/ 2011-02-01 02:31:01 -05:00
whales 7156efa18b Fixed bug where butchering was canceled without a query upon spotting a monster, etc 2011-01-06 00:11:01 -05:00
whales f191ecb1bd Bionics may now be installed. 2011-01-05 23:55:37 -05:00
whales dd855d70f8 Added map embellishments; rare add-ons that make it more varied and interesting. Several bugfixes. 2010-12-31 02:26:44 -05:00
whales ac9d094c02 Reversed a bug which prevented items from being placed properly. 2010-12-13 17:04:06 -05:00
whales 4320af963a Some mutation tweaking. 2010-12-13 16:55:05 -05:00
whales 08f06b1837 Dressers can be smashed. Doors and dressers produce 2x4s when smashed, and young trees may produce sticks. 2010-12-13 13:41:32 -05:00
whales 904d1044bb Viewing inventory now allows you to examine items until you explicitly exit. Minor trait tweaking. 2010-12-11 15:31:40 -05:00
whales 7519f29f70 Reversed a change that prevented all character movement. 2010-12-10 16:06:58 -05:00
whales c66b7425f8 Fixed a rare crash when the player tabs to the skill section of the @ screen. 2010-12-10 01:04:39 -05:00
whales ffc5a9a9fd Acid now damages items and may eventually consume them, including metal items 2010-12-09 18:46:54 -05:00
whales af560645d0 Fixed line bugs (hopefully). Shovels now place pit traps, as well as pit terrain. 2010-12-08 02:29:32 -05:00
whales ec7b45ac96 Fixed a butchering bug. Butchering is now a multi-turn action which may be cancelled by approaching monsters. 2010-12-07 04:04:46 -05:00
whales 733eeb9d27 Lots of refactoring and bugfixes. 2010-12-07 03:21:34 -05:00
whales 5f5da74ac9 Fixed a minor eating bug. 2010-12-02 01:34:09 -05:00
whales 7cd09ebc32 Several bugfixes. 2010-12-01 03:33:48 -05:00
whales 8512789c69 Fixed a liquid handling bug. 2010-11-28 00:08:01 -05:00
whales 3ed5520443 Added Message of the Day to inform users about new features. Updated the help file. 2010-11-27 23:18:54 -05:00
whales 69cd3991b8 Player info screen now displays skill progress towards the next level. 2010-11-27 16:30:47 -05:00
whales 57cf46c03a Player is now guaranteed to start in a house with a basement. Tweaked tazer. 2010-11-22 21:55:54 -05:00
whales 39184176c8 Clothing is now color-coded by what body parts it covers, rather than real-life colors. Added new craftable electronics: EMP grenade, tazer, mp3 player. 2010-11-22 21:42:35 -05:00
whales 891846fb7a Clothing is now color-coded by what body parts it covers, rather than real-life colors. Added new craftable electronics: EMP grenade, tazer, mp3 player. 2010-11-22 21:31:01 -05:00
whales 1e5961ce80 Added craftable EMP grenades and tazers. Shocker zombies are now immune to any electric attacks. 2010-11-22 19:02:58 -05:00
whales 6264716e22 Fixed line problems and other bugs. 2010-11-22 16:53:03 -05:00
whales 972ac20d81 The death explosion of boomers now makes adow makes adjacent monsters stumble and lose movement. The difficult rating (and earliest possible spawn) of many monsters has been rebalanced. 2010-11-22 14:23:51 -05:00
whales 4af619a092 Made monsters spawn less frequently, partparticularly when there are many already in play. 2010-11-22 14:19:40 -05:00
whales 8d71264300 Made pharmacies more useful. Removed the binary from the repository. 2010-11-22 14:18:03 -05:00
whales 9d0e34b992 Fixed more liquid handling bugs. 2010-11-19 02:00:07 -05:00
whales c4c706dbcb Fixed some liquid handling bugs; made it easier to hit dodging monsters under some circumstances. 2010-11-19 01:40:29 -05:00
whales f24c4d2f71 Upped chances of painkiller appearance. 2010-11-18 22:52:48 -05:00
whales 42df443d42 Fixed a map scrolling bug and a few others. 2010-11-18 22:32:39 -05:00
whales 3472933cdb Added minimum morale requirements for reading and crafting. 2010-11-18 16:00:11 -05:00
whales f9796a9e8e Fixed some crafting bugs and others. 2010-11-17 23:04:29 -05:00
whales 1f8db1d8aa Added UPS to power clothing. Moved morale to morale.h and moraledata.h 2010-11-17 00:00:05 -05:00
whales fd555837ce Over-quenching of thirst no longer causes you to vomit 2010-11-16 00:09:38 -05:00
whales 879f73d783 Moved data files to a data directory 2010-11-15 18:44:37 -05:00
whales 015b094ecb Moved data files to a data directory 2010-11-15 18:40:04 -05:00
whales 2f27fd8edc Moved data files to a data directory 2010-11-15 18:39:46 -05:00
whales 51f71dbd54 Fixed the black screen startup issue 2010-11-15 18:24:53 -05:00
whales af07f81d1e Moved morale modifiers to temporary conditions. 2010-11-13 01:49:25 -05:00
whales 2cf3f8394e Moved ranged combat to ranged.cpp 2010-11-09 13:36:02 -05:00
whales da9fe835e7 Fixed liquid handling bugs. 2010-10-28 20:06:01 -04:00
whales 92e6bb3741 Added Help section on firearms. Vomiting now reduces drunkeness and removes some painkillers. 2010-10-28 11:47:03 -04:00
whales b93ff2e13d Containers like <plastic bottle of water> can now be unloaded like tools and guns. 2010-10-28 10:13:20 -04:00
whales f912ba2b84 Fixed bug where the player's power level wasn't saved. 2010-10-28 09:46:05 -04:00
whales 3b3cd6a274 Bugfixes and tweaks. Hunger/thirst are more forgiving. 2010-10-27 07:56:48 -04:00
whales 4e4b31b5b9 Various bugfixes 2010-10-22 23:58:17 -04:00
whales e954402238 Fix? 2010-10-22 01:22:23 -04:00
whales aa478a1504 Overmap searches now return results held in player-written notes. 2010-10-22 01:18:51 -04:00
whales 70bea8ed6e Fixed scissors bug that caused a game freeze. 2010-10-21 02:26:05 -04:00
whales 9cb78e8a83 Greater variety in gas stations & pharmacy 2010-10-21 02:09:12 -04:00
whales f05cebf705 Removed NPC spawning due to bugs; G will spawn an NPC sttill. 2010-10-20 22:34:37 -04:00
whales 57d06e8c42 Updated pharmacy generation to be more random. 2010-10-20 22:34:05 -04:00
whales 1d47351a10 Merge branch 'jaydg-master' 2010-10-20 02:53:08 -04:00
whales 219bcb4fcd Merge branch 'master' of http://github.com/jaydg/Cataclysm into jaydg-master 2010-10-20 02:46:00 -04:00
whales 67c28572bd ? 2010-10-20 02:39:39 -04:00
whales 72ca1eeb78 Minor bugfixes. Updated overheating / cold system. 2010-10-20 02:37:34 -04:00
whales 892e342a80 A few small bug fixes. Overheating greatly updated. 2010-10-20 02:33:39 -04:00
Joachim de Groot 4c052c054a Started porting to Windows.
Changed all references to ncurses.h to curses.h.
Added
Modified Makefile: changed generating dependencies as gccmakedep is not available on Msys. Use pdcurses and link statically on Msys.
Added an implementetion of nanosleep() to game.cpp as MinGW lacks it.
2010-10-19 22:00:59 +02:00
whales ef072ae11c Major refactoring. Missile silos updated. Turrets weakened. 2010-10-18 03:27:28 -04:00
whales 92cda56011 Fixed exploit--using BB/nail gun to train skills indefinitely 2010-10-17 04:37:56 -04:00
whales a4b39fa6b8 New map type: missile silos. Slightly buggy. Other tweaks. 2010-10-17 04:01:19 -04:00
whales 02556d6b52 Added new 'firearm,' nail gun. Monster spawn tweaks. Player waits are canceled upon gaining a new effect. 2010-10-14 10:50:47 -04:00
whales 9b787771dc Tutorial now starts players with a lighter. Minor refactoring. 2010-10-12 12:34:45 -04:00
whales 1ac561405c Fixed crafting using up entire ammo stacks. 2010-10-12 03:22:26 -04:00
whales acc01a4535 Many minor changes. 2010-10-12 02:56:39 -04:00
whales 59dd726bcc Fixed explosion shrapnel bug, and made grenades more powerful. More work on NPCs' movement. 2010-10-11 18:04:54 -04:00
whales e90d8b75dc Updated README to include links to github, Squidnet source, and Squidnet public server. 2010-10-11 13:17:50 -04:00
whales b681e29d7a Some work done on A*, NPC movement issues. 2010-10-10 21:53:57 -04:00
whales 346bc2947d Some refactoring. Removed bugs from static monster spawn (e.g. turrets), may have introduced others. 2010-10-10 05:38:07 -04:00
whales c0a596dd98 Fixed nightvision goggles. They actually work now. 2010-10-10 00:09:07 -04:00
whales c0550d8f36 Added lots of clothing recipes. Some refactoring of game.cpp. Commented game.h better. 2010-10-09 21:09:15 -04:00
whales 11ffb57dde Fixed thrown item bugs. 2010-10-08 22:53:16 -04:00
whales 6ba9d80500 Fixed (?) NPC spam 2010-10-08 22:45:43 -04:00
whales 736fb73fdf Streamlined monster attacks and added better comments. 2010-10-08 15:22:42 -04:00
whales c959076667 House items bug fixed. Item description bugs fixed. 2010-10-08 14:38:10 -04:00
whales 8d78d27742 Fixed unlimited character point exploit. 2010-10-08 04:31:26 -04:00
Whales dc839a87df Worked on A* pathfinding; still very buggy. Avoid NPC interaction. 2010-10-08 03:41:15 -04:00
whales 48e919b61b Lots of save file updates. OLD SAVES ARE INCOMPATIBLE. 2010-10-08 02:26:30 -04:00
whales ff83f5b77c World map exposure and notes data is now saved to character-specific files. 2010-10-07 15:51:59 -04:00
Whales 085c2e2189 Added the EDITING file. 2010-10-07 13:28:27 -04:00
Whales 106bca9df9 Added a proper README file 2010-10-07 13:26:30 -04:00
Whales 9d80fa8086 Lab spawning playtested and adjusted. Lab terminals now work fine. 2010-10-07 03:41:42 -04:00
Whales b657f8df8a Labs updated to contain monsters. New monster: zombie scientist. 2010-10-07 02:36:51 -04:00
Whales bf1237c87d Wed Oct 6 14:11:51 EDT 2010 2010-10-06 14:11:51 -04:00
Whales 51f29b5bc9 npcmove.cpp updated. Still a bit buggy. 2010-10-06 13:26:40 -04:00
Whales 84ab99ecbc makefile patch 2010-10-05 02:38:12 -04:00
Whales ee0c0dc872 nightly commit 2010-10-05 02:26:51 -04:00
Whales 61258b4052 map::route is having troubles 2010-10-05 00:50:26 -04:00
Whales b3aec5c281 npctalk fixed, finally. 2010-10-04 21:22:45 -04:00
whales be2d22c19a npctalk.cpp compiles, but segfaults on advice. map::route() is an A* pathfinder. 2010-10-04 16:37:57 -04:00
whales ef94b33d7f Minor test update 2010-10-04 14:54:49 -04:00
Whales da4c76c452 Updated npctalk to include hints. 2010-10-04 13:10:07 -04:00
Whales 2d44b7e6fe attack 2010-10-04 01:54:04 -04:00
Whales 5f4f8f6ca6 Merge branch 'master' of git@github.com:cataclysm/Cataclysm 2010-10-04 01:52:25 -04:00
Whales dce9b247e6 okay 2010-10-04 01:48:03 -04:00
cataclysm ef2649f609 2010-10-03 22:43:40 -07:00
175 changed files with 70150 additions and 15608 deletions
+8
View File
@@ -0,0 +1,8 @@
cataclysm
data/*.template
save/
obj/
debug.log
logg.txt
bindist/
cataclysmdda-*
+20
View File
@@ -0,0 +1,20 @@
Instructions for compiling on a Debian-based system. The package names here are for Ubuntu 12.10
Dependencies: libncurses
# Native build on current platform
sudo apt-get install libncurses5-dev
make
# Cross-compile to linux 32-bit from linux 64-bit
sudo apt-get install libc6-dev-i386 lib32ncurses5-dev lib32stdc++-dev g++-multilib
make NATIVE=linux32
# Cross-compile for Windows
sudo apt-get install autoconf bison flex cmake git automake intltool libtool scons yasm
mkdir -p ~/src
git clone -b stable https://github.com/mxe/mxe.git ~/src
cd ~/src/mxe
make gcc
PATH=${PATH}:~/src/mxe/usr/bin
make CROSS=win32
+176
View File
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Cataclysm" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release/Cataclysm" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-Wl,-stack,12000000,-subsystem,windows" />
<Add option="-static -lgdi32" />
</Linker>
</Target>
</Build>
<Unit filename="action.cpp" />
<Unit filename="action.h" />
<Unit filename="addiction.h" />
<Unit filename="artifact.cpp" />
<Unit filename="artifact.h" />
<Unit filename="artifactdata.h" />
<Unit filename="bionics.cpp" />
<Unit filename="bionics.h" />
<Unit filename="bodypart.cpp" />
<Unit filename="bodypart.h" />
<Unit filename="calendar.cpp" />
<Unit filename="calendar.h" />
<Unit filename="catacurse.cpp" />
<Unit filename="catacurse.h" />
<Unit filename="color.cpp" />
<Unit filename="color.h" />
<Unit filename="computer.cpp" />
<Unit filename="computer.h" />
<Unit filename="construction.cpp" />
<Unit filename="construction.h" />
<Unit filename="crafting.cpp" />
<Unit filename="crafting.h" />
<Unit filename="cursesdef.h" />
<Unit filename="debug.cpp" />
<Unit filename="debug.h" />
<Unit filename="defense.cpp" />
<Unit filename="dialogue.h" />
<Unit filename="disease.cpp" />
<Unit filename="disease.h" />
<Unit filename="enums.h" />
<Unit filename="event.cpp" />
<Unit filename="event.h" />
<Unit filename="facdata.h" />
<Unit filename="faction.cpp" />
<Unit filename="faction.h" />
<Unit filename="field.cpp" />
<Unit filename="game.cpp" />
<Unit filename="game.h" />
<Unit filename="gamemode.cpp" />
<Unit filename="gamemode.h" />
<Unit filename="graffiti.cpp" />
<Unit filename="graffiti.h" />
<Unit filename="help.cpp" />
<Unit filename="input.cpp" />
<Unit filename="input.h" />
<Unit filename="inventory.cpp" />
<Unit filename="inventory.h" />
<Unit filename="inventory_ui.cpp" />
<Unit filename="item.cpp" />
<Unit filename="item.h" />
<Unit filename="itype.h" />
<Unit filename="itypedef.cpp" />
<Unit filename="iuse.cpp" />
<Unit filename="iuse.h" />
<Unit filename="keypress.cpp" />
<Unit filename="keypress.h" />
<Unit filename="lightmap.cpp" />
<Unit filename="lightmap.h" />
<Unit filename="line.cpp" />
<Unit filename="line.h" />
<Unit filename="main.cpp" />
<Unit filename="map.cpp" />
<Unit filename="map.h" />
<Unit filename="mapbuffer.cpp" />
<Unit filename="mapbuffer.h" />
<Unit filename="mapdata.cpp" />
<Unit filename="mapdata.h" />
<Unit filename="mapgen.cpp" />
<Unit filename="mapitems.h" />
<Unit filename="mapitemsdef.cpp" />
<Unit filename="melee.cpp" />
<Unit filename="mission.cpp" />
<Unit filename="mission.h" />
<Unit filename="mission_end.cpp" />
<Unit filename="mission_fail.cpp" />
<Unit filename="mission_place.cpp" />
<Unit filename="mission_start.cpp" />
<Unit filename="missiondef.cpp" />
<Unit filename="monattack.cpp" />
<Unit filename="monattack.h" />
<Unit filename="mondeath.cpp" />
<Unit filename="mondeath.h" />
<Unit filename="mongroup.h" />
<Unit filename="mongroupdef.cpp" />
<Unit filename="monitemsdef.cpp" />
<Unit filename="monmove.cpp" />
<Unit filename="monster.cpp" />
<Unit filename="monster.h" />
<Unit filename="morale.h" />
<Unit filename="moraledata.h" />
<Unit filename="mtype.h" />
<Unit filename="mtypedef.cpp" />
<Unit filename="mutation.cpp" />
<Unit filename="mutation.h" />
<Unit filename="mutation_data.cpp" />
<Unit filename="name.cpp" />
<Unit filename="name.h" />
<Unit filename="newcharacter.cpp" />
<Unit filename="npc.cpp" />
<Unit filename="npc.h" />
<Unit filename="npcmove.cpp" />
<Unit filename="npctalk.cpp" />
<Unit filename="omdata.h" />
<Unit filename="options.cpp" />
<Unit filename="options.h" />
<Unit filename="output.cpp" />
<Unit filename="output.h" />
<Unit filename="overmap.cpp" />
<Unit filename="overmap.h" />
<Unit filename="picojson.h" />
<Unit filename="player.cpp" />
<Unit filename="player.h" />
<Unit filename="pldata.h" />
<Unit filename="posix_time.cpp" />
<Unit filename="posix_time.h" />
<Unit filename="ranged.cpp" />
<Unit filename="resource.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Unit filename="rng.cpp" />
<Unit filename="rng.h" />
<Unit filename="settlement.cpp" />
<Unit filename="settlement.h" />
<Unit filename="setvector.cpp" />
<Unit filename="setvector.h" />
<Unit filename="skill.cpp" />
<Unit filename="skill.h" />
<Unit filename="texthash.cpp" />
<Unit filename="texthash.h" />
<Unit filename="tileray.cpp" />
<Unit filename="tileray.h" />
<Unit filename="trap.h" />
<Unit filename="trapdef.cpp" />
<Unit filename="trapfunc.cpp" />
<Unit filename="tutorial.cpp" />
<Unit filename="tutorial.h" />
<Unit filename="veh_interact.cpp" />
<Unit filename="veh_interact.h" />
<Unit filename="veh_type.h" />
<Unit filename="veh_typedef.cpp" />
<Unit filename="vehicle.cpp" />
<Unit filename="vehicle.h" />
<Unit filename="weather.cpp" />
<Unit filename="weather.h" />
<Unit filename="weather_data.h" />
<Unit filename="wish.cpp" />
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
+82
View File
@@ -0,0 +1,82 @@
1.1 Adding an item
1) Edit itype.h. Change the enum item_id and insert a unique identifier for
your new item type. Be sure to put it among similar items.
2) Edit itypedef.cpp. Macros are used for all item types, and they are pretty
self-explanatory. Be ABSOLUTELY sure that you insert the macro at the same
point in the list as you inserted the identifier in item_id!
3) Your item type is now valid, but won't be spawned. If you want it to be
spawned among similar items, edit mapitemsdef.cpp. Find the appropriate
array(s), and insert the identifier for your item (e.g. itm_aspirin). Make
sure it comes in before the NULL at the end of the list.
5) Some items, like tools or food, also take an iuse::function reference.
Edit iuse.h and include the function in the class declaration; then edit
iuse.cpp and define your function. Functions may be shared among different
item types.
1.2 Adding a monster
1) Edit mtype.h. Change the enum mon_id and insert a unique identifier for
your new monster type. Be sure to put it among similar monsters.
2) Edit montypedef.cpp. A macro is used for monsters and it is pretty
straightforward (Any of this ring a bell?). Be ABSOLUTELY sure that you
insert the macro at the same point in the list as your inserted the
identifier in mon_id!
3) Your monster type is now valid, but won't be spawned. If you want it to be
spawned among similar monsters, edit mongroupdef.cpp. Find the appropriate
array, and insert the identifier for your monster (e.g, mon_zombie). Make
sure it comes in before the NULL at the end of the list.
4) If you want your monster to drop items, edit monitemsdef.cpp. Make a new
array for your monster type with all the map item groups it may carry, and a
chance value for each.
5) Your monster may have a special attack, a monattack::function reference.
Edit monattack.h and include the function in the class definition; then
edit monattack.cpp and define your function. Functions may be shared among
different monster types. Be aware that the function should contain a
statement that the monster uses to decide whether or not to use the attack,
and if they do, should reset the monster's attack timer.
7) Just like attacks, some monsters may have a special function called when
they die. This works the same as attacks, but the relevent files are
mondeath.h and mondeath.cpp.
1.3 Adding structures to the map
Most "regular" buildings are spawned in cities (large clusters of buildings which are located rather close to each other).
In file omdata.h in the enum oter_id structure define names (code identifiers) for your building.
If you want your building to be displayed at overmap in different orientations, you should add 4 identifiers for each orientation (south, east, west and north correspondingly).
In the same file in structure const oter_t oterlist[num_ter_types]
we should define how these buildings will be displayed, how much they obscure vision and which extras set they have. For example:
{"mil. surplus", '^', c_white, 5, build_extras, false, false},
{"mil. surplus", '>', c_white, 5, build_extras, false, false},
{"mil. surplus", 'v', c_white, 5, build_extras, false, false},
{"mil. surplus", '<', c_white, 5, build_extras, false, false}
Comments at the beginning of this structure are rather useful.
In the file mapgen.cpp find the subroutine called draw_map(...);
there you should find a huge variant operator ("switch")
where you should put your code defining the new building by adding new case-statement.
This should be mentioned that most buildings are built on the square SEEX*2 x SEEY*2 tiles.
If you want your building to be spawned not only in city limits
you should refer to structures in file omdata.h
(starting from the line #define OMSPEC_FREQ 7).
These structures are commented in source code. Add new identifier in enum omspec_id structure before
NUM_OMSPECS and then add a record in const overmap_special overmap_specials[NUM_OMSPECS] array. For example:
{ot_toxic_dump, 0, 5, 15, -1, mcat_null, 0, 0, 0, 0, &omspec_place::wilderness,0}
The comments given in source code to structure struct overmap_special explains the meaning of these constants in the example above.
FAQ
Q: What the heck is up with the map objects?
A: The pertinent map objects are submap, mapbuffer, map, and overmap.
The submap contains the actual map data, in SEEXxSEEY chunks.
Vehicles and Spawns are stored in vectors because they're relatively sparse.
Submaps live in the single global mapbuffer, MAPBUFFER.
Map encapsulates the area around the player that is currently active.
It contains an array of MAPSIZE * MAPSIZE submap pointers called grid.
This is a 2D array, but is mapped to a 1D array for (questionable) indexing purposes.
When the player moves from one submap to another, map::shift() is called.
It moves the pointers in grid to keep the player centered.
The leading edge of grid is populated by map::load()
If the submap has been visited before, it's loaded from MAPBUFFER
Otherwise a 2x2 chunk of submaps is generated based on the corresponding overmap square type.
An overmap encapsulates the large-scale structure of a map
Such as location and layout of cities, forests, rivers, roads, etc...
There are an arbitrary number of overmaps
Additional overmaps are generated as the player enters new areas.
+150 -9
View File
@@ -1,11 +1,152 @@
CC = g++
# Platforms:
# Linux native
# (don't need to do anything)
# Linux 64-bit
# make NATIVE=linux64
# Linux 32-bit
# make NATIVE=linux32
# Linux cross-compile to Win32
# make CROSS=i686-pc-mingw32-
# Win32
# Run: make NATIVE=win32
# Build types:
# Debug (no optimizations)
# Default
# Release (turn on optimizations)
# make RELEASE=1
# comment these to toggle them as one sees fit.
# 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
DEBUG = -g
CFLAGS = -Wall -c -lncurses $(DEBUG)
LFLAGS = -Wall -lncurses $(DEBUG)
CXX = g++
CXXFLAGS = -lncurses
OBJS = main.o bionics.o bodypart.o crafting.o event.o faction.o field.o game.o help.o item.o itypedef.o iuse.o keypress.o line.o map.o mapgen.o mapitemsdef.o monattack.o mondeath.o mongroupdef.o monitemsdef.o monmove.o monster.o mtypedef.o newcharacter.o npc.o npcmove.o npctalk.o output.o overmap.o player.o rng.o settlement.o setvector.o skill.o trapdef.o trapfunc.o wish.o
cataclysm: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o cataclysm
#PROFILE = -pg
#OTHERS = -O3
#DEFINES = -DNDEBUG
# Disable debug. Comment this out to get logging.
#DEFINES = -DENABLE_LOGGING
# Limit debug to level. Comment out all for all levels.
#DEFINES += -DDEBUG_INFO
#DEFINES += -DDEBUG_WARNING
#DEFINES += -DDEBUG_ERROR
#DEFINES += -DDEBUG_PEDANTIC_INFO
# Limit debug to section. Comment out all for all levels.
#DEFINES += -DDEBUG_ENABLE_MAIN
#DEFINES += -DDEBUG_ENABLE_MAP
#DEFINES += -DDEBUG_ENABLE_MAP_GEN
#DEFINES += -DDEBUG_ENABLE_GAME
VERSION = 0.1
TARGET = cataclysm
W32TARGET = cataclysm.exe
BINDIST_DIR = bindist
ODIR = obj
W32ODIR = objwin
DDIR = .deps
OS = $(shell uname -o)
CXX = $(CROSS)g++
# enable optimizations. slow to build
ifdef RELEASE
OTHERS += -O3
DEBUG =
endif
CXXFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE) $(OTHERS) -MMD
BINDIST_EXTRAS = README data cataclysm-launcher
BINDIST = cataclysmdda-$(VERSION).tar.gz
W32BINDIST = cataclysmdda-$(VERSION).zip
BINDIST_CMD = tar -czvf $(BINDIST) $(BINDIST_DIR)
W32BINDIST_CMD = zip -r $(W32BINDIST) $(BINDIST_DIR)
# is this section even being used anymore?
# SOMEBODY PLEASE CHECK
#ifeq ($(OS), Msys)
# LDFLAGS = -static -lpdcurses
#else
LDFLAGS = -lncurses
#endif
# Linux 64-bit
ifeq ($(NATIVE), linux64)
CXXFLAGS += -m64
else
# Linux 32-bit
ifeq ($(NATIVE), linux32)
CXXFLAGS += -m32
endif
endif
# Win32 (mingw32?)
ifeq ($(NATIVE), win32)
TARGET = $(W32TARGET)
BINDIST = $(W32BINDIST)
BINDIST_CMD = $(W32BINDIST_CMD)
ODIR = $(W32ODIR)
W32LDFLAGS = -Wl,-stack,12000000,-subsystem,windows
LDFLAGS += -static -lgdi32
endif
# MXE cross-compile to win32
ifeq ($(CROSS), i686-pc-mingw32-)
TARGET = $(W32TARGET)
BINDIST = $(W32BINDIST)
BINDIST_CMD = $(W32BINDIST_CMD)
ODIR = $(W32ODIR)
LDFLAGS += -lgdi32
endif
SOURCES = $(wildcard *.cpp)
_OBJS = $(SOURCES:.cpp=.o)
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
all: $(TARGET)
@
$(TARGET): $(ODIR) $(DDIR) $(OBJS)
$(CXX) $(W32FLAGS) -o $(TARGET) $(DEFINES) $(CXXFLAGS) \
$(OBJS) $(LDFLAGS)
$(ODIR):
mkdir $(ODIR)
$(DDIR):
@mkdir $(DDIR)
$(ODIR)/%.o: %.cpp
$(CXX) $(DEFINES) $(CXXFLAGS) -c $< -o $@
clean:
rm -f cataclysm main.o bionics.o bodypart.o crafting.o event.o faction.o field.o game.o help.o item.o itypedef.o iuse.o keypress.o line.o map.o mapgen.o mapitemsdef.o monattack.o mondeath.o mongroupdef.o monitemsdef.o monmove.o monster.o mtypedef.o newcharacter.o npc.o npcmove.o npctalk.o output.o overmap.o player.o rng.o settlement.o setvector.o skill.o trapdef.o trapfunc.o wish.o
rm -f $(TARGET) $(W32TARGET) $(ODIR)/*.o $(ODIR)/*.d $(W32ODIR)/*.o $(W32BINDIST) \
$(BINDIST)
rm -rf $(BINDIST_DIR)
bindist: $(BINDIST)
$(BINDIST): $(TARGET) $(BINDIST_EXTRAS)
rm -rf $(BINDIST_DIR)
mkdir -p $(BINDIST_DIR)
cp -R $(TARGET) $(BINDIST_EXTRAS) $(BINDIST_DIR)
$(BINDIST_CMD)
export ODIR _OBJS LDFLAGS CXX W32FLAGS DEFINES CXXFLAGS
tests: $(ODIR) $(DDIR) $(OBJS)
$(MAKE) -C tests
check: tests
$(MAKE) -C tests check
.PHONY: tests check
-include $(SOURCES:%.cpp=$(DEPDIR)/%.P)
-include ${OBJS:.o=.d}
+52
View File
@@ -0,0 +1,52 @@
# comment these to toggle them as one sees fit.
# 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
DEBUG = -g
#PROFILE = -pg
OTHERS = -O3
ODIR = objwin
DDIR = .deps
TARGET = cataclysm.exe
CXX = g++
LINKER = i486-mingw32-ld
LINKERFLAGS = -Wl,-stack,12000000,-subsystem,windows
CFLAGS = $(WARNINGS) $(DEBUG) $(PROFILE) $(OTHERS)
LDFLAGS = -static -lgdi32
#ifeq ($(OS), Msys)
#LDFLAGS = -static -lpdcurses
#else
#LDFLAGS = -lncurses
#endif
SOURCES = $(wildcard *.cpp)
_OBJS = $(SOURCES:.cpp=.o)
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
all: $(TARGET)
@
$(TARGET): $(ODIR) $(DDIR) $(OBJS)
$(CXX) $(LINKERFLAGS) -o $(TARGET) $(CFLAGS) $(OBJS) $(LDFLAGS)
$(ODIR):
mkdir $(ODIR)
$(DDIR):
@mkdir $(DDIR)
$(ODIR)/%.o: %.cpp
$(CXX) $(CFLAGS) -c $< -o $@
clean:
rm -f $(TARGET) $(ODIR)/*.o
-include $(SOURCES:%.cpp=$(DEPDIR)/%.P)
-100
View File
@@ -1,100 +0,0 @@
Emma
Isabella
Emily
Madison
Ava
Olivia
Sophie
Abigail
Elizabeth
Chloe
Samantha
Addison
Natalie
Mia
Alexis
Alyssa
Hannah
Ashley
Ella
Sarah
Grace
Brianna
Lily
Hailey
Anna
Victoria
Kayla
Lillian
Lauren
Kaylee
Allison
Savannah
Nevaeh
Gabriella
Sofia
Makayla
Avery
Riley
Julia
Leah
Aubrey
Jasmine
Audrey
Katie
Morgan
Brooklyn
Destiny
Sydney
Alexa
Kylie
Brooke
Kaitlin
Evelyn
Layla
Madeline
Kimberly
Kim
Zoe
Jessica
Jessie
Alexandra
Claire
Madelyn
Maria
Arianna
Jocelyn
Amelia
Angelina
Trinity
Andrea
Maya
Valeria
Sophie
Rachel
Vanessa
Aaliyah
Mariah
Gabrielle
Katelyn
Ariana
Bailey
Camilla
Jennifer
Jen
Melanie
Gianna
Charlotte
Paige
Autumn
Payton
Faith
Sara
Isabelle
Caroline
Genesis
Isabel
Mary
Zoey
Gracie
Megan
-100
View File
@@ -1,100 +0,0 @@
Smith
Johnson
Williams
Jones
Brown
Davis
Miller
Wilson
Moore
Taylor
Anderson
Thomas
Jackson
White
Harris
Martin
Thompson
Garcia
Martinez
Robinson
Clark
Rodriguez
Lewis
Lee
Walker
Hall
Allen
Young
Hernandez
King
Wright
Lopez
Hill
Scott
Green
Adams
Baker
Gonzalez
Nelson
Carter
Mitchell
Perez
Roberts
Turner
Phillips
Campbell
Parker
Evans
Edwards
Collins
Stewart
Sanchez
Morris
Rogers
Reed
Cook
Morgan
Bell
Murphy
Bailey
Rivera
Cooper
Richardson
Cox
Howard
Ward
Torres
Peterson
Gray
Ramirez
James
Watson
Brooks
Kelly
Sanders
Price
Bennett
Wood
Barnes
Ross
Henderson
Coleman
Jenkins
Perry
Powell
Long
Patterson
Hughes
Flores
Washington
Butler
Simmons
Foster
Gonzales
Bryant
Alexander
Russell
Griffin
Diaz
Hayes
-100
View File
@@ -1,100 +0,0 @@
Jacob
Michael
Ethan
Joshua
Daniel
Alexander
Anthony
William
Christopher
Matthew
Jayden
Andrew
Joseph
David
Noah
Aiden
James
Ryan
Logan
John
Nathan
Elijah
Christian
Gabriel
Benjamin
Jonathan
Tyler
Samuel
Nicholas
Gavin
Dylan
Jackson
Brandon
Caleb
Mason
Angel
Isaac
Evan
Jack
Kevin
Jose
Isaiah
Luke
Landon
Justin
Lucas
Zachary
Jordan
Robert
Aaron
Brayden
Thomas
Cameron
Hunter
Austin
Adrian
Connor
Owen
Aidan
Jason
Julian
Wyatt
Charles
Luis
Carter
Juan
Chase
Diego
Jeremiah
Brody
Xavier
Adam
Carlos
Sabastian
Liam
Hayden
Nathaniel
Henry
Jesus
Ian
Tristan
Bryan
Sean
Cole
Alex
Eric
Brian
Jaden
Carson
Blake
Ayden
Cooper
Dominic
Brady
Caden
Josiah
Kyle
Colton
Kaden
Eli
+56
View File
@@ -0,0 +1,56 @@
Cataclysm is a post-apocalyptic roguelike, set in the countryside of New England
after a devastating plague of monsters and zombies.
At present time, Cataclysm is still in early alpha, and is being developed very
rapidly. As such, there are no formal version numbers, as a new version is
released every day, often several a day.
Source is available at the github repository, http://github.com/Whales/Cataclysm
There is also a tarball available at http://squidnet.ath.cx/cataclysm.tar.gz
Squidnet maintains a public SSH server. If you cannot play Cataclysm locally,
or if you prefer to play it in a world shared with others, connect to
cataclysm@squidnet.ath.cx (there is no password).
Compiling Cataclysm under linux is straightforward, and only requires the
ncurses development libraries. Under Ubuntu, these libraries can be found in
the libncurses5-dev package ("sudo apt-get install libncurses5-dev" will install
this package).
Cataclysm is very different from most roguelikes in many ways. Rather than
being set in a vertical, linear dungeon, it is set in an unbounded, 3D world.
This means that exploration plays a much bigger role than in most roguelikes,
and the game is much less linear.
Because the map is so huge, it is actually completely persistant between games.
If you die, and start a new character, your new game will be set in the same
game world as your last. Like in many roguelikes, you will be able to loot the
dead bodies of previous characters; unlike most roguelikes, you will also be
able to retrace their steps completely, and any dramatic changes made to the
world will persist into your next game.
While this makes for interesting depth of play, and the ability to "save" game
progress even after death, some prefer to start each game with a freshly
generated world. This can be achieved by erasing the contents of the save
directory, found in the same folder as the executable. "rm save/*" will erase
these files for you.
Cataclysm's gameplay also includes many unique quirks, and the learning curve is
somewhat steep, even for those experienced with roguelikes. Included with the
game is a tutorial which runs the player through most of the key features. The
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
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
there is a good chance that it will appear in the game within a few days. Of
course, it is inevitable that I will reject some feature requests, either
because they do not fit my conception of the game, or because they require more
code than I think they're worth. Feature requests supplied in the form of a
patch stand a better chance of inclusion, of course ;) For instructions on
making changes to item types, monster types, etc., please see the EDITING file.
Most changes of this variety require no training in C++, or programming in
general.
If you want to take Cataclysm in a new direction, please feel free to create a
branch project--just let me know about it!
+13
View File
@@ -0,0 +1,13 @@
Cataclysm: Dark Days Ahead
==========================
You emerge from the shelter into the dim light of an overcast day, and look around for the first time since the disaster.
The world as you knew it is gone. A ruined world stands in its place, full of nightmares come to life. Nothing can ever go back to the way it was, before the Cataclysm, but you have to be strong. You have to survive. You have to persevere. If you don't, death will be one of the better outcomes.
Above your head, storm clouds gather, and the rain stings and hisses against your skin. You shoulder your backpack, and start walking. The world has gone to hell, but you get the sinking feeling that there are darker days ahead.
Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world. While some have described it as a "zombie game", there's far more to Cataclysm than that. Struggle to survive in a harsh, persistant, procedurally generated world. Scavenge the remnants of a dead civilization for for food, equipment, or, if you're lucky, a vehicle with a full tank of gas to get you the hell out of Dodge. Fight to defeat or escape from a wide variety of powerful monstrosities, from zombies to giant insects to killer robots and things far stranger and deadlier, and against the others like yourself, that want what you have...
Build the tools and defenses you will need to overcome the challenges you face, from a strongly fortified lair full of customized firearms and surrounded by pits and landmines, to a mobile, gasoline powered blade spinning fortress of death, tearing apart anything stupid enough to get in the way. And finally, improve! Learn skills to help you survive, acquire mind-bending mutations, and convert your own body into a cybernetic masterpiece.
Make no mistake - there is no other game quite like Cataclysm. How long can you survive?
+394
View File
@@ -0,0 +1,394 @@
#include "game.h"
#include "keypress.h"
#include <fstream>
void game::load_keyboard_settings()
{
std::ifstream fin;
fin.open("data/keymap.txt");
if (!fin) { // It doesn't exist
std::ofstream fout;
fout.open("data/keymap.txt");
fout << default_keymap_txt();
fout.close();
fin.open("data/keymap.txt");
}
if (!fin) { // Still can't open it--probably bad permissions
debugmsg("Can't open data/keymap.txt. This may be a permissions issue.");
return;
}
while (!fin.eof()) {
std::string id;
fin >> id;
if (id == "")
getline(fin, id); // Empty line, chomp it
else if (id[0] != '#') {
action_id act = look_up_action(id);
if (act == ACTION_NULL)
debugmsg("\
Warning! data/keymap.txt contains an unknown action, \"%s\"\n\
Fix data/keymap.txt at your next chance!", id.c_str());
else {
while (fin.peek() != '\n' && !fin.eof()) {
char ch;
fin >> ch;
if (keymap.find(ch) != keymap.end())
debugmsg("\
Warning! '%c' assigned twice in the keymap!\n\
%s is being ignored.\n\
Fix data/keymap.txt at your next chance!", ch, id.c_str());
else
keymap[ ch ] = act;
}
}
} else {
getline(fin, id); // Clear the whole line
}
}
}
void game::save_keymap()
{
std::ofstream fout;
fout.open("data/keymap.txt");
if (!fout) { // It doesn't exist
debugmsg("Can't open data/keymap.txt.");
fout.close();
return;
}
std::map<char, action_id>::iterator it;
for (it = keymap.begin(); it != keymap.end(); it++)
fout << action_ident( (*it).second ) << " " << (*it).first << std::endl;
fout.close();
}
std::vector<char> game::keys_bound_to(action_id act)
{
std::vector<char> ret;
std::map<char, action_id>::iterator it;
for (it = keymap.begin(); it != keymap.end(); it++) {
if ( (*it).second == act )
ret.push_back( (*it).first );
}
return ret;
}
void game::clear_bindings(action_id act)
{
std::map<char, action_id>::iterator it;
for (it = keymap.begin(); it != keymap.end(); it++) {
if ( (*it).second == act ) {
keymap.erase(it);
it = keymap.begin();
}
}
}
std::string action_ident(action_id act)
{
switch (act) {
case ACTION_PAUSE:
return "pause";
case ACTION_MOVE_N:
return "move_n";
case ACTION_MOVE_NE:
return "move_ne";
case ACTION_MOVE_E:
return "move_e";
case ACTION_MOVE_SE:
return "move_se";
case ACTION_MOVE_S:
return "move_s";
case ACTION_MOVE_SW:
return "move_sw";
case ACTION_MOVE_W:
return "move_w";
case ACTION_MOVE_NW:
return "move_nw";
case ACTION_MOVE_DOWN:
return "move_down";
case ACTION_MOVE_UP:
return "move_up";
case ACTION_CENTER:
return "center";
case ACTION_SHIFT_N:
return "shift_n";
case ACTION_SHIFT_NE:
return "shift_ne";
case ACTION_SHIFT_E:
return "shift_e";
case ACTION_SHIFT_SE:
return "shift_se";
case ACTION_SHIFT_S:
return "shift_s";
case ACTION_SHIFT_SW:
return "shift_sw";
case ACTION_SHIFT_W:
return "shift_w";
case ACTION_SHIFT_NW:
return "shift_nw";
case ACTION_OPEN:
return "open";
case ACTION_CLOSE:
return "close";
case ACTION_SMASH:
return "smash";
case ACTION_EXAMINE:
return "examine";
case ACTION_PICKUP:
return "pickup";
case ACTION_BUTCHER:
return "butcher";
case ACTION_CHAT:
return "chat";
case ACTION_LOOK:
return "look";
case ACTION_PEEK:
return "peek";
case ACTION_LIST_ITEMS:
return "listitems";
case ACTION_INVENTORY:
return "inventory";
case ACTION_COMPARE:
return "compare";
case ACTION_ORGANIZE:
return "organize";
case ACTION_USE:
return "apply";
case ACTION_USE_WIELDED:
return "apply_wielded";
case ACTION_WEAR:
return "wear";
case ACTION_TAKE_OFF:
return "take_off";
case ACTION_EAT:
return "eat";
case ACTION_READ:
return "read";
case ACTION_WIELD:
return "wield";
case ACTION_PICK_STYLE:
return "pick_style";
case ACTION_RELOAD:
return "reload";
case ACTION_UNLOAD:
return "unload";
case ACTION_THROW:
return "throw";
case ACTION_FIRE:
return "fire";
case ACTION_FIRE_BURST:
return "fire_burst";
case ACTION_SELECT_FIRE_MODE:
return "select_fire_mode";
case ACTION_DROP:
return "drop";
case ACTION_DIR_DROP:
return "drop_adj";
case ACTION_BIONICS:
return "bionics";
case ACTION_WAIT:
return "wait";
case ACTION_CRAFT:
return "craft";
case ACTION_CONSTRUCT:
return "construct";
case ACTION_DISASSEMBLE:
return "disassemble";
case ACTION_SLEEP:
return "sleep";
case ACTION_TOGGLE_SAFEMODE:
return "safemode";
case ACTION_TOGGLE_AUTOSAFE:
return "autosafe";
case ACTION_IGNORE_ENEMY:
return "ignore_enemy";
case ACTION_SAVE:
return "save";
case ACTION_QUIT:
return "quit";
case ACTION_PL_INFO:
return "player_data";
case ACTION_MAP:
return "map";
case ACTION_MISSIONS:
return "missions";
case ACTION_FACTIONS:
return "factions";
case ACTION_MORALE:
return "morale";
case ACTION_MESSAGES:
return "messages";
case ACTION_HELP:
return "help";
case ACTION_DEBUG:
return "debug";
case ACTION_DISPLAY_SCENT:
return "debug_scent";
case ACTION_TOGGLE_DEBUGMON:
return "debug_mode";
case ACTION_NULL:
return "null";
}
return "unknown";
}
action_id look_up_action(std::string ident)
{
for (int i = 0; i < NUM_ACTIONS; i++) {
if (action_ident( action_id(i) ) == ident)
return action_id(i);
}
return ACTION_NULL;
}
std::string action_name(action_id act)
{
switch (act) {
case ACTION_PAUSE:
return "Pause";
case ACTION_MOVE_N:
return "Move North";
case ACTION_MOVE_NE:
return "Move Northeast";
case ACTION_MOVE_E:
return "Move East";
case ACTION_MOVE_SE:
return "Move Southeast";
case ACTION_MOVE_S:
return "Move South";
case ACTION_MOVE_SW:
return "Move Southwest";
case ACTION_MOVE_W:
return "Move West";
case ACTION_MOVE_NW:
return "Move Northwest";
case ACTION_MOVE_DOWN:
return "Descend Stairs";
case ACTION_MOVE_UP:
return "Ascend Stairs";
case ACTION_CENTER:
return "Center View";
case ACTION_SHIFT_N:
return "Move View North";
case ACTION_SHIFT_NE:
return "Move View Northeast";
case ACTION_SHIFT_E:
return "Move View East";
case ACTION_SHIFT_SE:
return "Move View Southeast";
case ACTION_SHIFT_S:
return "Move View South";
case ACTION_SHIFT_SW:
return "Move View Southwest";
case ACTION_SHIFT_W:
return "Move View West";
case ACTION_SHIFT_NW:
return "Move View Northwest";
case ACTION_OPEN:
return "Open Door";
case ACTION_CLOSE:
return "Close Door";
case ACTION_SMASH:
return "Smash Nearby Terrain";
case ACTION_EXAMINE:
return "Examine Nearby Terrain";
case ACTION_PICKUP:
return "Pick Item(s) Up";
case ACTION_BUTCHER:
return "Butcher";
case ACTION_CHAT:
return "Chat with NPC";
case ACTION_LOOK:
return "Look Around";
case ACTION_PEEK:
return "Peek Around Corners";
case ACTION_LIST_ITEMS:
return "List all items around the player";
case ACTION_INVENTORY:
return "Open Inventory";
case ACTION_COMPARE:
return "Compare two Items";
case ACTION_ORGANIZE:
return "Swap Inventory Letters";
case ACTION_USE:
return "Apply or Use Item";
case ACTION_USE_WIELDED:
return "Apply or Use Wielded Item";
case ACTION_WEAR:
return "Wear Item";
case ACTION_TAKE_OFF:
return "Take Off Worn Item";
case ACTION_EAT:
return "Eat";
case ACTION_READ:
return "Read";
case ACTION_WIELD:
return "Wield";
case ACTION_PICK_STYLE:
return "Select Unarmed Style";
case ACTION_RELOAD:
return "Reload Wielded Item";
case ACTION_UNLOAD:
return "Unload or Empty Wielded Item";
case ACTION_THROW:
return "Throw Item";
case ACTION_FIRE:
return "Fire Wielded Item";
case ACTION_FIRE_BURST:
return "Burst-Fire Wielded Item";
case ACTION_SELECT_FIRE_MODE:
return "Toggle attack mode of Wielded Item";
case ACTION_DROP:
return "Drop Item";
case ACTION_DIR_DROP:
return "Drop Item to Adjacent Tile";
case ACTION_BIONICS:
return "View/Activate Bionics";
case ACTION_WAIT:
return "Wait for Several Minutes";
case ACTION_CRAFT:
return "Craft Items";
case ACTION_CONSTRUCT:
return "Construct Terrain";
case ACTION_DISASSEMBLE:
return "Disassemble items";
case ACTION_SLEEP:
return "Sleep";
case ACTION_TOGGLE_SAFEMODE:
return "Toggle Safemode";
case ACTION_TOGGLE_AUTOSAFE:
return "Toggle Auto-Safemode";
case ACTION_IGNORE_ENEMY:
return "Ignore Nearby Enemy";
case ACTION_SAVE:
return "Save and Quit";
case ACTION_QUIT:
return "Commit Suicide";
case ACTION_PL_INFO:
return "View Player Info";
case ACTION_MAP:
return "View Map";
case ACTION_MISSIONS:
return "View Missions";
case ACTION_FACTIONS:
return "View Factions";
case ACTION_MORALE:
return "View Morale";
case ACTION_MESSAGES:
return "View Message Log";
case ACTION_HELP:
return "View Help";
case ACTION_DEBUG:
return "Debug Menu";
case ACTION_DISPLAY_SCENT:
return "View Scentmap";
case ACTION_TOGGLE_DEBUGMON:
return "Toggle Debug Messages";
case ACTION_NULL:
return "No Action";
}
return "Someone forgot to name an action.";
}
+90
View File
@@ -0,0 +1,90 @@
#ifndef _ACTION_H_
#define _ACTION_H_
enum action_id {
ACTION_NULL = 0,
// Movement
ACTION_PAUSE,
ACTION_MOVE_N,
ACTION_MOVE_NE,
ACTION_MOVE_E,
ACTION_MOVE_SE,
ACTION_MOVE_S,
ACTION_MOVE_SW,
ACTION_MOVE_W,
ACTION_MOVE_NW,
ACTION_MOVE_DOWN,
ACTION_MOVE_UP,
// Shift view
ACTION_CENTER,
ACTION_SHIFT_N,
ACTION_SHIFT_NE,
ACTION_SHIFT_E,
ACTION_SHIFT_SE,
ACTION_SHIFT_S,
ACTION_SHIFT_SW,
ACTION_SHIFT_W,
ACTION_SHIFT_NW,
// Environment Interaction
ACTION_OPEN,
ACTION_CLOSE,
ACTION_SMASH,
ACTION_EXAMINE,
ACTION_PICKUP,
ACTION_BUTCHER,
ACTION_CHAT,
ACTION_LOOK,
ACTION_PEEK,
ACTION_LIST_ITEMS,
// Inventory Interaction (including quasi-inventories like bionics)
ACTION_INVENTORY,
ACTION_COMPARE,
ACTION_ORGANIZE,
ACTION_USE,
ACTION_USE_WIELDED,
ACTION_WEAR,
ACTION_TAKE_OFF,
ACTION_EAT,
ACTION_READ,
ACTION_WIELD,
ACTION_PICK_STYLE,
ACTION_RELOAD,
ACTION_UNLOAD,
ACTION_THROW,
ACTION_FIRE,
ACTION_FIRE_BURST,
ACTION_SELECT_FIRE_MODE,
ACTION_DROP,
ACTION_DIR_DROP,
ACTION_BIONICS,
// Long-term / special actions
ACTION_WAIT,
ACTION_CRAFT,
ACTION_CONSTRUCT,
ACTION_DISASSEMBLE,
ACTION_SLEEP,
ACTION_TOGGLE_SAFEMODE,
ACTION_TOGGLE_AUTOSAFE,
ACTION_IGNORE_ENEMY,
ACTION_SAVE,
ACTION_QUIT,
// Info Screens
ACTION_PL_INFO,
ACTION_MAP,
ACTION_MISSIONS,
ACTION_FACTIONS,
ACTION_MORALE,
ACTION_MESSAGES,
ACTION_HELP,
// Debug Functions
ACTION_DEBUG,
ACTION_DISPLAY_SCENT,
ACTION_TOGGLE_DEBUGMON,
NUM_ACTIONS
};
action_id look_up_action(std::string ident);
std::string action_ident(action_id);
std::string action_name(action_id);
#endif
+76 -50
View File
@@ -3,38 +3,37 @@
#include "rng.h"
#include "game.h"
#include "morale.h"
#include <sstream>
#define MIN_ADDICTION_LEVEL 3 // Minimum intensity before effects are seen
void addict_effect(game *g, addiction &add)
{
int in = add.intensity;
switch (add.type) {
case ADD_CIG:
g->u.int_cur--;
if (in > 20 || one_in((500 - 20 * in))) {
g->add_msg("You %s a cigarette.",
rng(0, 6) < in ? "need" : "could use");
g->cancel_activity_query("You have a craving.");
g->cancel_activity_query("You have a nicotine craving.");
g->u.add_morale(MORALE_CRAVING_NICOTINE, -15, -50);
if (one_in(800 - 50 * in))
g->u.fatigue++;
if (one_in(400 - 20 * in))
g->u.stim--;
if (one_in((800 - 10 * in)))
g->u.morale--;
}
break;
case ADD_CAFFEINE:
g->u.str_cur--;
g->u.moves -= 2;
if (in > 20 || one_in((500 - 20 * in))) {
g->add_msg("You want some caffeine.");
g->cancel_activity_query("You have a craving.");
g->cancel_activity_query("You have a caffeine craving.");
g->u.add_morale(MORALE_CRAVING_CAFFEINE, -5, -30);
if (rng(0, 10) < in)
g->u.stim--;
if (in > 19 || one_in((1000 - 50 * in)))
g->u.morale--;
if (rng(8, 400) < in) {
g->add_msg("Your hands start shaking... you need it bad!");
g->u.add_disease(DI_SHAKES, 20, g);
@@ -49,11 +48,12 @@ void addict_effect(game *g, addiction &add)
g->u.health--;
if (one_in(20) && rng(0, 20) < in) {
g->add_msg("You could use a drink.");
g->cancel_activity_query("You have a craving.");
g->u.morale -= rng(1, 4);
g->cancel_activity_query("You have an alcohol craving.");
g->u.add_morale(MORALE_CRAVING_ALCOHOL, -35, -120);
} else if (rng(8, 300) < in) {
g->add_msg("Your hands start shaking... you need a drink bad!");
g->cancel_activity_query("You have a craving.");
g->cancel_activity_query("You have an alcohol craving.");
g->u.add_morale(MORALE_CRAVING_ALCOHOL, -35, -120);
g->u.add_disease(DI_SHAKES, 50, g);
} else if (!g->u.has_disease(DI_HALLU) && rng(10, 1600) < in)
g->u.add_disease(DI_HALLU, 3600, g);
@@ -67,72 +67,92 @@ void addict_effect(game *g, addiction &add)
break;
case ADD_PKILLER:
g->u.str_cur -= 1 + int(in / 7);
g->u.per_cur--;
g->u.dex_cur--;
if (g->u.pain < in * 3)
g->u.pain++;
if (g->u.morale > 0 - in)
g->u.morale--;
if ((in >= 25 || g->turn % (100 - in * 4) == 0) && g->u.pkill > 0)
if ((in >= 25 || int(g->turn) % (100 - in * 4) == 0) && g->u.pkill > 0)
g->u.pkill--; // Tolerance increases!
if (in >= 40 || one_in((1200 - 30 * in)))
g->u.health--;
if (one_in(20) && dice(2, 20) < in) {
g->add_msg("Your hands start shaking... you need some painkillers.");
g->cancel_activity_query("You have a craving.");
g->u.add_disease(DI_SHAKES, 20 + in * 5, g);
} else if (one_in(20) && dice(2, 30) < in) {
g->add_msg("You feel anxious. You need your painkillers!");
g->cancel_activity_query("You have a craving.");
g->u.morale -= 5;
} else if (one_in(50) && dice(3, 50) < in) {
g->add_msg("You throw up heavily!");
g->cancel_activity_query("Throwing up.");
g->u.vomit(g);
if (g->u.pkill >= 35) // No further effects if we're doped up.
add.sated = 0;
else {
g->u.str_cur -= 1 + int(in / 7);
g->u.per_cur--;
g->u.dex_cur--;
if (g->u.pain < in * 3)
g->u.pain++;
if (in >= 40 || one_in((1200 - 30 * in)))
g->u.health--;
if (one_in(20) && dice(2, 20) < in) {
g->add_msg("Your hands start shaking... you need some painkillers.");
g->cancel_activity_query("You have an opiate craving.");
g->u.add_morale(MORALE_CRAVING_OPIATE, -40, -200);
g->u.add_disease(DI_SHAKES, 20 + in * 5, g);
} else if (one_in(20) && dice(2, 30) < in) {
g->add_msg("You feel anxious. You need your painkillers!");
g->u.add_morale(MORALE_CRAVING_OPIATE, -30, -200);
g->cancel_activity_query("You have a craving.");
} else if (one_in(50) && dice(3, 50) < in) {
g->add_msg("You throw up heavily!");
g->cancel_activity_query("Throwing up.");
g->u.vomit(g);
}
}
break;
case ADD_SPEED:
g->u.moves -= in;
if (g->u.morale > 0 - in)
g->u.morale--;
case ADD_SPEED: {
int move_pen = in * 5;
if (move_pen > 30)
move_pen = 30;
g->u.moves -= move_pen;
g->u.int_cur--;
g->u.str_cur--;
if (in >= 20 || g->turn % (100 - in * 5) == 0)
if (g->u.stim > -100 && (in >= 20 || int(g->turn) % (100 - in * 5) == 0))
g->u.stim--;
if (rng(0, 150) <= in)
g->u.health--;
if (dice(2, 100) < in) {
g->add_msg("You feel depressed. Speed would help.");
g->cancel_activity_query("You have a craving.");
g->u.morale -= rng(1, 1 + int(in / 3));
g->cancel_activity_query("You have a speed craving.");
g->u.add_morale(MORALE_CRAVING_SPEED, -25, -200);
} else if (one_in(10) && dice(2, 80) < in) {
g->add_msg("Your hands start shaking... you need a pick-me-up.");
g->cancel_activity_query("You have a craving.");
g->cancel_activity_query("You have a speed craving.");
g->u.add_morale(MORALE_CRAVING_SPEED, -25, -200);
g->u.add_disease(DI_SHAKES, in * 20, g);
} else if (one_in(50) && dice(2, 100) < in) {
g->add_msg("You stop suddenly, feeling bewildered.");
g->cancel_activity();
g->u.moves -= 300;
} else if (!g->u.has_disease(DI_HALLU) && one_in(20) &&
8 + dice(2, 80) < in) {
8 + dice(2, 80) < in)
g->u.add_disease(DI_HALLU, 3600, g);
}
break;
} break;
case ADD_COKE:
g->u.int_cur--;
g->u.per_cur--;
if (g->u.morale > -20 && (in >= 30 || one_in((900 - 30 * in)))) {
if (in >= 30 || one_in((900 - 30 * in))) {
g->add_msg("You feel like you need a bump.");
g->cancel_activity_query("You have a craving.");
g->u.morale -= 2;
g->cancel_activity_query("You have a craving for cocaine.");
g->u.add_morale(MORALE_CRAVING_COCAINE, -20, -250);
}
if (dice(2, 80) <= in) {
g->add_msg("You feel like you need a bump.");
g->cancel_activity_query("You have a craving.");
g->u.stim--;
g->cancel_activity_query("You have a craving for cocaine.");
g->u.add_morale(MORALE_CRAVING_COCAINE, -20, -250);
g->u.stim -= 3;
}
break;
case ADD_CRACK:
g->u.int_cur--;
g->u.per_cur--;
if (in >= 30 || one_in((900 - 30 * in))) {
g->add_msg("You're shivering, you need some crack.");
g->cancel_activity_query("You have a craving for crack.");
g->u.add_morale(MORALE_CRAVING_CRACK, -80, -250);
}
if (dice(2, 80) <= in) {
g->add_msg("You're shivering, you need some crack.");
g->cancel_activity_query("You have a craving for crack.");
g->u.add_morale(MORALE_CRAVING_CRACK, -80, -250);
g->u.stim -= 3;
}
break;
}
@@ -148,6 +168,7 @@ std::string addiction_name(addiction cur)
case ADD_PKILLER: return "Opiate Withdrawal";
case ADD_SPEED: return "Amphetamine Withdrawal";
case ADD_COKE: return "Cocaine Withdrawal";
case ADD_CRACK: return "Crack Cocaine Withdrawal";
default: return "Erroneous addiction";
}
}
@@ -183,6 +204,11 @@ Movement rate reduction. Depression. Weak immune system. Frequent cravings.";
case ADD_COKE:
return "Perception - 1; Intelligence - 1; Frequent cravings.";
case ADD_CRACK:
return "Perception - 2; Intelligence - 2; Frequent cravings.";
default:
return "";
}
}
+680
View File
@@ -0,0 +1,680 @@
#include <sstream>
#include <vector>
#include "game.h"
#include "artifact.h"
#include "artifactdata.h"
std::vector<art_effect_passive> fill_good_passive();
std::vector<art_effect_passive> fill_bad_passive();
std::vector<art_effect_active> fill_good_active();
std::vector<art_effect_active> fill_bad_active();
std::string artifact_name(std::string type);
itype* game::new_artifact()
{
if (one_in(2)) { // Generate a "tool" artifact
it_artifact_tool *art = new it_artifact_tool();
int form = rng(ARTTOOLFORM_NULL + 1, NUM_ARTTOOLFORMS - 1);
artifact_tool_form_datum *info = &(artifact_tool_form_data[form]);
art->name = artifact_name(info->name);
art->color = info->color;
art->sym = info->sym;
art->m1 = info->m1;
art->m2 = info->m2;
art->volume = rng(info->volume_min, info->volume_max);
art->weight = rng(info->weight_min, info->weight_max);
// Set up the basic weapon type
artifact_weapon_datum *weapon = &(artifact_weapon_data[info->base_weapon]);
art->melee_dam = rng(weapon->bash_min, weapon->bash_max);
art->melee_cut = rng(weapon->cut_min, weapon->cut_max);
art->m_to_hit = rng(weapon->to_hit_min, weapon->to_hit_max);
art->item_flags = weapon->flags;
// Add an extra weapon perhaps?
if (one_in(2)) {
int select = rng(0, 2);
if (info->extra_weapons[select] != ARTWEAP_NULL) {
weapon = &(artifact_weapon_data[ info->extra_weapons[select] ]);
art->volume += weapon->volume;
art->weight += weapon->weight;
art->melee_dam += rng(weapon->bash_min, weapon->bash_max);
art->melee_cut += rng(weapon->bash_min, weapon->bash_max);
art->m_to_hit += rng(weapon->to_hit_min, weapon->to_hit_max);
art->item_flags |= weapon->flags;
std::stringstream newname;
newname << weapon->adjective << " " << info->name;
art->name = artifact_name(newname.str());
}
}
std::stringstream description;
description << "This is the " << art->name << ".\n\
It is the only one of its kind.\n\
It may have unknown powers; use 'a' to activate them.";
art->description = description.str();
// Finally, pick some powers
art_effect_passive passive_tmp = AEP_NULL;
art_effect_active active_tmp = AEA_NULL;
int num_good = 0, num_bad = 0, value = 0;
std::vector<art_effect_passive> good_effects = fill_good_passive();
std::vector<art_effect_passive> bad_effects = fill_bad_passive();
// Wielded effects first
while (!good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(num_good < 1 || num_bad < 1 || one_in(num_good + 1) ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(2)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
num_good++;
} else if (!bad_effects.empty()) { // Bad effect
int index = rng(0, bad_effects.size() - 1);
passive_tmp = bad_effects[index];
bad_effects.erase(bad_effects.begin() + index);
num_bad++;
}
value += passive_effect_cost[passive_tmp];
art->effects_wielded.push_back(passive_tmp);
}
// Next, carried effects; more likely to be just bad
num_good = 0;
num_bad = 0;
value = 0;
good_effects = fill_good_passive();
bad_effects = fill_bad_passive();
while (one_in(2) && !good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
((num_good > 2 && one_in(num_good + 1)) || num_bad < 1 ||
one_in(num_bad + 1) || value > 1)) {
if (value < 1 && one_in(3)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
num_good++;
} else { // Bad effect
int index = rng(0, bad_effects.size() - 1);
passive_tmp = bad_effects[index];
bad_effects.erase(bad_effects.begin() + index);
num_bad++;
}
value += passive_effect_cost[passive_tmp];
art->effects_carried.push_back(passive_tmp);
}
// Finally, activated effects; not necessarily good or bad
num_good = 0;
num_bad = 0;
value = 0;
art->def_charges = 0;
art->max_charges = 0;
std::vector<art_effect_active> good_a_effects = fill_good_active();
std::vector<art_effect_active> bad_a_effects = fill_bad_active();
while (!good_a_effects.empty() && !bad_a_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(value > 3 || (num_bad > 0 && num_good == 0) ||
!one_in(3 - num_good) || !one_in(3 - num_bad))) {
if (!one_in(3) && value <= 1) { // Good effect
int index = rng(0, good_a_effects.size() - 1);
active_tmp = good_a_effects[index];
good_a_effects.erase(good_a_effects.begin() + index);
num_good++;
value += active_effect_cost[active_tmp];
} else { // Bad effect
int index = rng(0, bad_a_effects.size() - 1);
active_tmp = bad_a_effects[index];
bad_a_effects.erase(bad_a_effects.begin() + index);
num_bad++;
value += active_effect_cost[active_tmp];
}
art->effects_activated.push_back(active_tmp);
art->max_charges += rng(1, 3);
}
art->def_charges = art->max_charges;
// If we have charges, pick a recharge mechanism
if (art->max_charges > 0)
art->charge_type = art_charge( rng(ARTC_NULL + 1, NUM_ARTCS - 1) );
if (one_in(8) && num_bad + num_good >= 4)
art->charge_type = ARTC_NULL; // 1 in 8 chance that it can't recharge!
art->id = itypes.size();
itypes.push_back(art);
return art;
} else { // Generate an armor artifact
it_artifact_armor *art = new it_artifact_armor();
int form = rng(ARTARMFORM_NULL + 1, NUM_ARTARMFORMS - 1);
artifact_armor_form_datum *info = &(artifact_armor_form_data[form]);
art->name = artifact_name(info->name);
art->sym = '['; // Armor is always [
art->color = info->color;
art->m1 = info->m1;
art->m2 = info->m2;
art->volume = info->volume;
art->weight = info->weight;
art->melee_dam = info->melee_bash;
art->melee_cut = info->melee_cut;
art->m_to_hit = info->melee_hit;
art->item_flags = 0;
art->covers = info->covers;
art->encumber = info->encumb;
art->dmg_resist = info->dmg_resist;
art->cut_resist = info->cut_resist;
art->env_resist = info->env_resist;
art->warmth = info->warmth;
art->storage = info->storage;
std::stringstream description;
description << "This is the " << art->name << ".\n" <<
(info->plural ? "They are the only ones of their kind." :
"It is the only one of its kind.");
// Modify the armor further
if (!one_in(4)) {
int index = rng(0, 4);
if (info->available_mods[index] != ARMORMOD_NULL) {
artifact_armor_mod mod = info->available_mods[index];
artifact_armor_form_datum *modinfo = &(artifact_armor_mod_data[mod]);
if (modinfo->volume >= 0 || art->volume > abs(modinfo->volume))
art->volume += modinfo->volume;
else
art->volume = 1;
if (modinfo->weight >= 0 || art->weight > abs(modinfo->weight))
art->weight += modinfo->weight;
else
art->weight = 1;
art->encumber += modinfo->encumb;
if (modinfo->dmg_resist > 0 || art->dmg_resist > abs(modinfo->dmg_resist))
art->dmg_resist += modinfo->dmg_resist;
else
art->dmg_resist = 0;
if (modinfo->cut_resist > 0 || art->cut_resist > abs(modinfo->cut_resist))
art->cut_resist += modinfo->cut_resist;
else
art->cut_resist = 0;
if (modinfo->env_resist > 0 || art->env_resist > abs(modinfo->env_resist))
art->env_resist += modinfo->env_resist;
else
art->env_resist = 0;
art->warmth += modinfo->warmth;
if (modinfo->storage > 0 || art->storage > abs(modinfo->storage))
art->storage += modinfo->storage;
else
art->storage = 0;
description << "\n" << (info->plural ? "They are " : "It is ") <<
modinfo->name;
}
}
art->description = description.str();
// Finally, pick some effects
int num_good = 0, num_bad = 0, value = 0;
art_effect_passive passive_tmp = AEP_NULL;
std::vector<art_effect_passive> good_effects = fill_good_passive();
std::vector<art_effect_passive> bad_effects = fill_bad_passive();
while (!good_effects.empty() && !bad_effects.empty() &&
num_good < 3 && num_bad < 3 &&
(num_good < 1 || one_in(num_good * 2) || value > 1 ||
(num_bad < 3 && !one_in(3 - num_bad)))) {
if (value < 1 && one_in(2)) { // Good effect
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
num_good++;
} else { // Bad effect
int index = rng(0, bad_effects.size() - 1);
passive_tmp = bad_effects[index];
bad_effects.erase(bad_effects.begin() + index);
num_bad++;
}
value += passive_effect_cost[passive_tmp];
art->effects_worn.push_back(passive_tmp);
}
art->id = itypes.size();
itypes.push_back(art);
return art;
}
}
itype* game::new_natural_artifact(artifact_natural_property prop)
{
// Natural artifacts are always tools.
it_artifact_tool *art = new it_artifact_tool();
// Pick a form
artifact_natural_shape shape =
artifact_natural_shape(rng(ARTSHAPE_NULL + 1, ARTSHAPE_MAX - 1));
artifact_shape_datum *shape_data = &(artifact_shape_data[shape]);
// Pick a property
artifact_natural_property property = (prop > ARTPROP_NULL ? prop :
artifact_natural_property(rng(ARTPROP_NULL + 1, ARTPROP_MAX - 1)));
artifact_property_datum *property_data = &(artifact_property_data[property]);
art->sym = ':';
art->color = c_yellow;
art->m1 = STONE;
art->m2 = MNULL;
art->volume = rng(shape_data->volume_min, shape_data->volume_max);
art->weight = rng(shape_data->weight_min, shape_data->weight_max);
art->melee_dam = 0;
art->melee_cut = 0;
art->m_to_hit = 0;
art->item_flags = 0;
art->name = property_data->name + " " + shape_data->name;
std::stringstream desc;
desc << "This " << shape_data->desc << " " << property_data->desc << ".";
art->description = desc.str();
// Add line breaks to the description as necessary
size_t pos = 76;
while (art->description.length() - pos >= 76) {
pos = art->description.find_last_of(' ', pos);
if (pos == std::string::npos)
pos = art->description.length();
else {
art->description[pos] = '\n';
pos += 76;
}
}
// Three possibilities: good passive + bad passive, good active + bad active,
// and bad passive + good active
bool good_passive = false, bad_passive = false,
good_active = false, bad_active = false;
switch (rng(1, 3)) {
case 1:
good_passive = true;
bad_passive = true;
break;
case 2:
good_active = true;
bad_active = true;
break;
case 3:
bad_passive = true;
good_active = true;
break;
}
int value_to_reach = 0; // This is slowly incremented, allowing for better arts
int value = 0;
art_effect_passive aep_good = AEP_NULL, aep_bad = AEP_NULL;
art_effect_active aea_good = AEA_NULL, aea_bad = AEA_NULL;
do {
if (good_passive) {
aep_good = property_data->passive_good[ rng(0, 3) ];
if (aep_good == AEP_NULL || one_in(4))
aep_good = art_effect_passive(rng(AEP_NULL + 1, AEP_SPLIT - 1));
}
if (bad_passive) {
aep_bad = property_data->passive_bad[ rng(0, 3) ];
if (aep_bad == AEP_NULL || one_in(4))
aep_bad = art_effect_passive(rng(AEP_SPLIT + 1, NUM_AEAS - 1));
}
if (good_active) {
aea_good = property_data->active_good[ rng(0, 3) ];
if (aea_good == AEA_NULL || one_in(4))
aea_good = art_effect_active(rng(AEA_NULL + 1, AEA_SPLIT - 1));
}
if (bad_active) {
aea_bad = property_data->active_bad[ rng(0, 3) ];
if (aea_bad == AEA_NULL || one_in(4))
aea_bad = art_effect_active(rng(AEA_SPLIT + 1, NUM_AEAS - 1));
}
value = passive_effect_cost[aep_good] + passive_effect_cost[aep_bad] +
active_effect_cost[aea_good] + active_effect_cost[aea_bad];
value_to_reach++; // Yes, it is intentional that this is 1 the first check
} while (value > value_to_reach);
if (aep_good != AEP_NULL)
art->effects_carried.push_back(aep_good);
if (aep_bad != AEP_NULL)
art->effects_carried.push_back(aep_bad);
if (aea_good != AEA_NULL)
art->effects_activated.push_back(aea_good);
if (aea_bad != AEA_NULL)
art->effects_activated.push_back(aea_bad);
// Natural artifacts ALWAYS can recharge
// (When "implanting" them in a mundane item, this ability may be lost
if (!art->effects_activated.empty()) {
art->max_charges = rng(1, 4);
art->def_charges = art->max_charges;
art->charge_type = art_charge( rng(ARTC_NULL + 1, NUM_ARTCS - 1) );
}
art->id = itypes.size();
itypes.push_back(art);
return art;
}
std::vector<art_effect_passive> fill_good_passive()
{
std::vector<art_effect_passive> ret;
for (int i = AEP_NULL + 1; i < AEP_SPLIT; i++)
ret.push_back( art_effect_passive(i) );
return ret;
}
std::vector<art_effect_passive> fill_bad_passive()
{
std::vector<art_effect_passive> ret;
for (int i = AEP_SPLIT + 1; i < NUM_AEPS; i++)
ret.push_back( art_effect_passive(i) );
return ret;
}
std::vector<art_effect_active> fill_good_active()
{
std::vector<art_effect_active> ret;
for (int i = AEA_NULL + 1; i < AEA_SPLIT; i++)
ret.push_back( art_effect_active(i) );
return ret;
}
std::vector<art_effect_active> fill_bad_active()
{
std::vector<art_effect_active> ret;
for (int i = AEA_SPLIT + 1; i < NUM_AEAS; i++)
ret.push_back( art_effect_active(i) );
return ret;
}
std::string artifact_name(std::string type)
{
std::stringstream ret;
ret << type << " of ";
std::string noun = artifact_noun[rng(0, NUM_ART_NOUNS - 1)];
if (noun[0] == '+') {
ret << "the ";
noun = noun.substr(1); // Chop off '+'
}
ret << artifact_adj[rng(0, NUM_ART_ADJS - 1)] << " " << noun;
return ret.str();
}
void game::process_artifact(item *it, player *p, bool wielded)
{
std::vector<art_effect_passive> effects;
if (it->is_armor()) {
it_artifact_armor* armor = dynamic_cast<it_artifact_armor*>(it->type);
effects = armor->effects_worn;
} else if (it->is_tool()) {
it_artifact_tool* tool = dynamic_cast<it_artifact_tool*>(it->type);
effects = tool->effects_carried;
if (wielded) {
for (int i = 0; i < tool->effects_wielded.size(); i++)
effects.push_back(tool->effects_wielded[i]);
}
// Recharge it if necessary
if (it->charges < tool->max_charges) {
switch (tool->charge_type) {
case ARTC_TIME:
if (turn.second == 0 && turn.minute == 0) // Once per hour
it->charges++;
break;
case ARTC_SOLAR:
if (turn.second == 0 && turn.minute % 10 == 0 &&
is_in_sunlight(p->posx, p->posy))
it->charges++;
break;
case ARTC_PAIN:
if (turn.second == 0) {
add_msg("You suddenly feel sharp pain for no reason.");
p->pain += 3 * rng(1, 3);
it->charges++;
}
break;
case ARTC_HP:
if (turn.second == 0) {
add_msg("You feel your body decaying.");
p->hurtall(1);
it->charges++;
}
break;
}
}
}
for (int i = 0; i < effects.size(); i++) {
switch (effects[i]) {
case AEP_STR_UP:
p->str_cur += 4;
break;
case AEP_DEX_UP:
p->dex_cur += 4;
break;
case AEP_PER_UP:
p->per_cur += 4;
break;
case AEP_INT_UP:
p->int_cur += 4;
break;
case AEP_ALL_UP:
p->str_cur += 2;
p->dex_cur += 2;
p->per_cur += 2;
p->int_cur += 2;
break;
case AEP_SPEED_UP: // Handled in player::current_speed()
break;
case AEP_IODINE:
if (p->radiation > 0)
p->radiation--;
break;
case AEP_SMOKE:
if (one_in(10)) {
int x = p->posx + rng(-1, 1), y = p->posy + rng(-1, 1);
if (m.add_field(this, x, y, fd_smoke, rng(1, 3)))
add_msg("The %s emits some smoke.", it->tname().c_str());
}
break;
case AEP_SNAKES:
break; // Handled in player::hit()
case AEP_EXTINGUISH:
for (int x = p->posx - 1; x <= p->posx + 1; x++) {
for (int y = p->posy - 1; y <= p->posy + 1; y++) {
if (m.field_at(x, y).type == fd_fire) {
if (m.field_at(x, y).density == 0)
m.remove_field(x, y);
else
m.field_at(x, y).density--;
}
}
}
break;
case AEP_HUNGER:
if (one_in(100))
p->hunger++;
break;
case AEP_THIRST:
if (one_in(120))
p->thirst++;
break;
case AEP_EVIL:
if (one_in(150)) { // Once every 15 minutes, on average
p->add_disease(DI_EVIL, 300, this);
if (!wielded && !it->is_armor())
add_msg("You have an urge to %s the %s.",
(it->is_armor() ? "wear" : "wield"), it->tname().c_str());
}
break;
case AEP_SCHIZO:
break; // Handled in player::suffer()
case AEP_RADIOACTIVE:
if (one_in(4))
p->radiation++;
break;
case AEP_STR_DOWN:
p->str_cur -= 3;
break;
case AEP_DEX_DOWN:
p->dex_cur -= 3;
break;
case AEP_PER_DOWN:
p->per_cur -= 3;
break;
case AEP_INT_DOWN:
p->int_cur -= 3;
break;
case AEP_ALL_DOWN:
p->str_cur -= 2;
p->dex_cur -= 2;
p->per_cur -= 2;
p->int_cur -= 2;
break;
case AEP_SPEED_DOWN:
break; // Handled in player::current_speed()
}
}
}
void game::add_artifact_messages(std::vector<art_effect_passive> effects)
{
int net_str = 0, net_dex = 0, net_per = 0, net_int = 0, net_speed = 0;
for (int i = 0; i < effects.size(); i++) {
switch (effects[i]) {
case AEP_STR_UP: net_str += 4; break;
case AEP_DEX_UP: net_dex += 4; break;
case AEP_PER_UP: net_per += 4; break;
case AEP_INT_UP: net_int += 4; break;
case AEP_ALL_UP: net_str += 2;
net_dex += 2;
net_per += 2;
net_int += 2; break;
case AEP_STR_DOWN: net_str -= 3; break;
case AEP_DEX_DOWN: net_dex -= 3; break;
case AEP_PER_DOWN: net_per -= 3; break;
case AEP_INT_DOWN: net_int -= 3; break;
case AEP_ALL_DOWN: net_str -= 2;
net_dex -= 2;
net_per -= 2;
net_int -= 2; break;
case AEP_SPEED_UP: net_speed += 20; break;
case AEP_SPEED_DOWN: net_speed -= 20; break;
case AEP_IODINE:
break; // No message
case AEP_SNAKES:
add_msg("Your skin feels slithery.");
break;
case AEP_INVISIBLE:
add_msg("You fade into invisibility!");
break;
case AEP_CLAIRVOYANCE:
add_msg("You can see through walls!");
break;
case AEP_STEALTH:
add_msg("Your steps stop making noise.");
break;
case AEP_GLOW:
add_msg("A glow of light forms around you.");
break;
case AEP_PSYSHIELD:
add_msg("Your mental state feels protected.");
break;
case AEP_RESIST_ELECTRICITY:
add_msg("You feel insulated.");
break;
case AEP_CARRY_MORE:
add_msg("Your back feels strengthened.");
break;
case AEP_HUNGER:
add_msg("You feel hungry.");
break;
case AEP_THIRST:
add_msg("You feel thirsty.");
break;
case AEP_EVIL:
add_msg("You feel an evil presence...");
break;
case AEP_SCHIZO:
add_msg("You feel a tickle of insanity.");
break;
case AEP_RADIOACTIVE:
add_msg("Your skin prickles with radiation.");
break;
case AEP_MUTAGENIC:
add_msg("You feel your genetic makeup degrading.");
break;
case AEP_ATTENTION:
add_msg("You feel an otherworldly attention upon you...");
break;
case AEP_FORCE_TELEPORT:
add_msg("You feel a force pulling you inwards.");
break;
case AEP_MOVEMENT_NOISE:
add_msg("You hear a rattling noise coming from inside yourself.");
break;
case AEP_BAD_WEATHER:
add_msg("You feel storms coming.");
break;
}
}
std::stringstream stat_info;
if (net_str != 0)
stat_info << "Str " << (net_str > 0 ? "+" : "") << net_str << "! ";
if (net_dex != 0)
stat_info << "Dex " << (net_dex > 0 ? "+" : "") << net_dex << "! ";
if (net_int != 0)
stat_info << "Int " << (net_int > 0 ? "+" : "") << net_int << "! ";
if (net_per != 0)
stat_info << "Per " << (net_per > 0 ? "+" : "") << net_per << "! ";
if (stat_info.str().length() > 0)
add_msg(stat_info.str().c_str());
if (net_speed != 0)
add_msg("Speed %s%d", (net_speed > 0 ? "+" : ""), net_speed);
}
+141 -23
View File
@@ -1,29 +1,147 @@
#ifndef _ARTIFACT_H_
#define _ARTIFACT_H_
#include "itype.h"
#include <string>
#include <vector>
struct it_artifact : itype
{
itype base;
virtual bool is_artifact() { return true; }
// is_* returns the value for the base type
virtual bool is_food() { return base.is_food(); };
virtual bool is_ammo() { return base.is_ammo(); };
virtual bool is_armor() { return base.is_armor(); };
virtual bool is_book() { return base.is_book(); };
virtual bool is_tool() { return base.is_tool(); };
virtual bool is_container() { return base.is_container(); };
// Can have one or two invoked uses
void (iuse::*use1)(game *, item *, bool);
void (iuse::*use2)(game *, item *, bool);
// *wield is every-turn effect while wielded or worn
void (iuse::*wield)(game *, item *, bool);
// *unwield is effect upon unwielding or taking off
void (iuse::*unwield)(game *, item *, bool);
// *carry is every-turn effect while it's in your inventory
void (iuse::*carry)(game *, item *, bool);
enum art_effect_passive {
AEP_NULL = 0,
// Good
AEP_STR_UP, // Strength + 4
AEP_DEX_UP, // Dexterity + 4
AEP_PER_UP, // Perception + 4
AEP_INT_UP, // Intelligence + 4
AEP_ALL_UP, // All stats + 2
AEP_SPEED_UP, // +20 speed
AEP_IODINE, // Reduces radiation
AEP_SNAKES, // Summons friendly snakes when you're hit
AEP_INVISIBLE, // Makes you invisible
AEP_CLAIRVOYANCE, // See through walls
AEP_STEALTH, // Your steps are quieted
AEP_EXTINGUISH, // May extinguish nearby flames
AEP_GLOW, // Four-tile light source
AEP_PSYSHIELD, // Protection from stare attacks
AEP_RESIST_ELECTRICITY, // Protection from electricity
AEP_CARRY_MORE, // Increases carrying capacity by 200
AEP_SAP_LIFE, // Killing non-zombie monsters may heal you
// Splits good from bad
AEP_SPLIT,
// Bad
AEP_HUNGER, // Increases hunger
AEP_THIRST, // Increases thirst
AEP_SMOKE, // Emits smoke occasionally
AEP_EVIL, // Addiction to the power
AEP_SCHIZO, // Mimicks schizophrenia
AEP_RADIOACTIVE, // Increases your radiation
AEP_MUTAGENIC, // Mutates you slowly
AEP_ATTENTION, // Draws netherworld attention slowly
AEP_STR_DOWN, // Strength - 3
AEP_DEX_DOWN, // Dex - 3
AEP_PER_DOWN, // Per - 3
AEP_INT_DOWN, // Int - 3
AEP_ALL_DOWN, // All stats - 2
AEP_SPEED_DOWN, // -20 speed
AEP_FORCE_TELEPORT, // Occasionally force a teleport
AEP_MOVEMENT_NOISE, // Makes noise when you move
AEP_BAD_WEATHER, // More likely to experience bad weather
AEP_SICK, // Decreases health
NUM_AEPS
};
enum art_effect_active {
AEA_NULL = 0,
AEA_STORM, // Emits shock fields
AEA_FIREBALL, // Targeted
AEA_ADRENALINE, // Adrenaline rush
AEA_MAP, // Maps the area around you
AEA_BLOOD, // Shoots blood all over
AEA_FATIGUE, // Creates interdimensional fatigue
AEA_ACIDBALL, // Targeted acid
AEA_PULSE, // Destroys adjacent terrain
AEA_HEAL, // Heals minor damage
AEA_CONFUSED, // Confuses all monsters in view
AEA_ENTRANCE, // Chance to make nearby monsters friendly
AEA_BUGS, // Chance to summon friendly insects
AEA_TELEPORT, // Teleports you
AEA_LIGHT, // Temporary light source
AEA_GROWTH, // Grow plants, a la triffid queen
AEA_HURTALL, // Hurts all monsters!
AEA_SPLIT, // Split between good and bad
AEA_RADIATION, // Spew radioactive gas
AEA_PAIN, // Increases player pain
AEA_MUTATE, // Chance of mutation
AEA_PARALYZE, // You lose several turns
AEA_FIRESTORM, // Spreads minor fire all around you
AEA_ATTENTION, // Attention from sub-prime denizens
AEA_TELEGLOW, // Teleglow disease
AEA_NOISE, // Loud noise
AEA_SCREAM, // Noise & morale penalty
AEA_DIM, // Darkens the sky slowly
AEA_FLASH, // Flashbang
AEA_VOMIT, // User vomits
AEA_SHADOWS, // Summon shadow creatures
NUM_AEAS
};
enum art_charge
{
ARTC_NULL, // Never recharges!
ARTC_TIME, // Very slowly recharges with time
ARTC_SOLAR, // Recharges in sunlight
ARTC_PAIN, // Creates pain to recharge
ARTC_HP, // Drains HP to recharge
NUM_ARTCS
};
enum artifact_natural_shape
{
ARTSHAPE_NULL,
ARTSHAPE_SPHERE,
ARTSHAPE_ROD,
ARTSHAPE_TEARDROP,
ARTSHAPE_LAMP,
ARTSHAPE_SNAKE,
ARTSHAPE_DISC,
ARTSHAPE_BEADS,
ARTSHAPE_NAPKIN,
ARTSHAPE_URCHIN,
ARTSHAPE_JELLY,
ARTSHAPE_SPIRAL,
ARTSHAPE_PIN,
ARTSHAPE_TUBE,
ARTSHAPE_PYRAMID,
ARTSHAPE_CRYSTAL,
ARTSHAPE_KNOT,
ARTSHAPE_CRESCENT,
ARTSHAPE_MAX
};
enum artifact_natural_property
{
ARTPROP_NULL,
ARTPROP_WRIGGLING, //
ARTPROP_GLOWING, //
ARTPROP_HUMMING, //
ARTPROP_MOVING, //
ARTPROP_WHISPERING, //
ARTPROP_BREATHING, //
ARTPROP_DEAD, //
ARTPROP_ITCHY, //
ARTPROP_GLITTERING, //
ARTPROP_ELECTRIC, //
ARTPROP_SLIMY, //
ARTPROP_ENGRAVED, //
ARTPROP_CRACKLING, //
ARTPROP_WARM, //
ARTPROP_RATTLING, //
ARTPROP_SCALED,
ARTPROP_FRACTAL,
ARTPROP_MAX
};
#endif
+488
View File
@@ -0,0 +1,488 @@
#ifndef _ARTIFACTDATA_H_
#define _ARTIFACTDATA_H_
#include <vector>
#include "artifact.h"
#include "itype.h"
int passive_effect_cost[NUM_AEPS] = {
0, // AEP_NULL
3, // AEP_STR_UP
3, // AEP_DEX_UP
3, // AEP_PER_UP
3, // AEP_INT_UP
5, // AEP_ALL_UP
4, // AEP_SPEED_UP
2, // AEP_IODINE
4, // AEP_SNAKES
7, // AEP_INVISIBLE
5, // AEP_CLAIRVOYANCE
2, // AEP_STEALTH
2, // AEP_EXTINGUISH
1, // AEP_GLOW
1, // AEP_PSYSHIELD
3, // AEP_RESIST_ELECTRICITY
3, // AEP_CARRY_MORE
5, // AEP_SAP_LIFE
0, // AEP_SPLIT
-2, // AEP_HUNGER
-2, // AEP_THIRST
-1, // AEP_SMOKE
-5, // AEP_EVIL
-3, // AEP_SCHIZO
-5, // AEP_RADIOACTIVE
-3, // AEP_MUTAGENIC
-5, // AEP_ATTENTION
-2, // AEP_STR_DOWN
-2, // AEP_DEX_DOWN
-2, // AEP_PER_DOWN
-2, // AEP_INT_DOWN
-5, // AEP_ALL_DOWN
-4, // AEP_SPEED_DOWN
-5, // AEP_FORCE_TELEPORT
-3, // AEP_MOVEMENT_NOISE
-2, // AEP_BAD_WEATHER
-1 // AEP_SICK
};
int active_effect_cost[NUM_AEAS] = {
0, // AEA_NULL
2, // AEA_STORM
4, // AEA_FIREBALL
5, // AEA_ADRENALINE
4, // AEA_MAP
0, // AEA_BLOOD
0, // AEA_FATIGUE
4, // AEA_ACIDBALL
5, // AEA_PULSE
4, // AEA_HEAL
3, // AEA_CONFUSED
3, // AEA_ENTRANCE
3, // AEA_BUGS
5, // AEA_TELEPORT
1, // AEA_LIGHT
4, // AEA_GROWTH
6, // AEA_HURTALL
0, // AEA_SPLIT
-3, // AEA_RADIATION
-2, // AEA_PAIN
-3, // AEA_MUTATE
-2, // AEA_PARALYZE
-3, // AEA_FIRESTORM
-6, // AEA_ATTENTION
-4, // AEA_TELEGLOW
-2, // AEA_NOISE
-2, // AEA_SCREAM
-3, // AEA_DIM
-4, // AEA_FLASH
-2, // AEA_VOMIT
-5 // AEA_SHADOWS
};
struct artifact_shape_datum
{
std::string name;
std::string desc;
int volume_min, volume_max;
int weight_min, weight_max;
};
artifact_shape_datum artifact_shape_data[ARTSHAPE_MAX] = {
{"BUG", "BUG", 0, 0, 0, 0},
{"sphere", "smooth sphere", 2, 4, 0, 10},
{"rod", "tapered rod", 1, 7, 1, 7},
{"teardrop", "teardrop-shaped stone", 2, 6, 0, 8},
{"lamp", "hollow, transparent cube", 4, 9, 0, 3},
{"snake", "winding, flexible rod", 0, 8, 0, 8},
{"disc", "smooth disc", 4, 6, 2, 4},
{"beads", "string of beads", 3, 7, 0, 6},
{"napkin", "very thin sheet", 0, 3, 0, 3},
{"urchin", "spiked sphere", 3, 5, 2, 6},
{"jelly", "malleable blob", 2, 8, 2, 4},
{"spiral", "spiraling rod", 5, 6, 2, 3},
{"pin", "pointed rod", 1, 5, 1, 9},
{"tube", "hollow tube", 2, 5, 3, 6},
{"pyramid", "regular tetrahedron", 3, 7, 2, 4},
{"crystal", "translucent crystal", 1, 6, 2, 7},
{"knot", "twisted, knotted cord", 2, 6, 1, 7},
{"crescent", "crescent-shaped stone", 2, 6, 2, 6}
};
struct artifact_property_datum
{
std::string name;
std::string desc;
art_effect_passive passive_good[4];
art_effect_passive passive_bad[4];
art_effect_active active_good[4];
art_effect_active active_bad[4];
};
artifact_property_datum artifact_property_data[ARTPROP_MAX] = {
{"BUG", "BUG",
{AEP_NULL, AEP_NULL, AEP_NULL, AEP_NULL},
{AEP_NULL, AEP_NULL, AEP_NULL, AEP_NULL},
{AEA_NULL, AEA_NULL, AEA_NULL, AEA_NULL},
{AEA_NULL, AEA_NULL, AEA_NULL, AEA_NULL}
},
{"wriggling", "is constantly wriggling",
{AEP_SPEED_UP, AEP_SNAKES, AEP_NULL, AEP_NULL},
{AEP_DEX_DOWN, AEP_FORCE_TELEPORT, AEP_SICK, AEP_NULL},
{AEA_TELEPORT, AEA_ADRENALINE, AEA_NULL, AEA_NULL},
{AEA_MUTATE, AEA_ATTENTION, AEA_VOMIT, AEA_NULL}
},
{"glowing", "glows faintly",
{AEP_INT_UP, AEP_GLOW, AEP_CLAIRVOYANCE, AEP_NULL},
{AEP_RADIOACTIVE, AEP_MUTAGENIC, AEP_ATTENTION, AEP_NULL},
{AEA_LIGHT, AEA_LIGHT, AEA_LIGHT, AEA_NULL},
{AEA_ATTENTION, AEA_TELEGLOW, AEA_FLASH, AEA_SHADOWS}
},
{"humming", "hums very quietly",
{AEP_ALL_UP, AEP_PSYSHIELD, AEP_NULL, AEP_NULL},
{AEP_SCHIZO, AEP_PER_DOWN, AEP_INT_DOWN, AEP_NULL},
{AEA_PULSE, AEA_ENTRANCE, AEA_NULL, AEA_NULL},
{AEA_NOISE, AEA_NOISE, AEA_SCREAM, AEA_NULL}
},
{"moving", "shifts from side to side slowly",
{AEP_STR_UP, AEP_DEX_UP, AEP_SPEED_UP, AEP_NULL},
{AEP_HUNGER, AEP_PER_DOWN, AEP_FORCE_TELEPORT, AEP_NULL},
{AEA_TELEPORT, AEA_TELEPORT, AEA_MAP, AEA_NULL},
{AEA_PARALYZE, AEA_VOMIT, AEA_VOMIT, AEA_NULL}
},
{"whispering", "makes very faint whispering sounds",
{AEP_CLAIRVOYANCE, AEP_EXTINGUISH, AEP_STEALTH, AEP_NULL},
{AEP_EVIL, AEP_SCHIZO, AEP_ATTENTION, AEP_NULL},
{AEA_FATIGUE, AEA_ENTRANCE, AEA_ENTRANCE, AEA_NULL},
{AEA_ATTENTION, AEA_SCREAM, AEA_SCREAM, AEA_SHADOWS}
},
{"breathing",
"shrinks and grows very slightly with a regular pulse, as if breathing",
{AEP_SAP_LIFE, AEP_ALL_UP, AEP_SPEED_UP, AEP_CARRY_MORE},
{AEP_HUNGER, AEP_THIRST, AEP_SICK, AEP_BAD_WEATHER},
{AEA_ADRENALINE, AEA_HEAL, AEA_ENTRANCE, AEA_GROWTH},
{AEA_MUTATE, AEA_ATTENTION, AEA_SHADOWS, AEA_NULL}
},
{"dead", "is icy cold to the touch",
{AEP_INVISIBLE, AEP_CLAIRVOYANCE, AEP_EXTINGUISH, AEP_SAP_LIFE},
{AEP_HUNGER, AEP_EVIL, AEP_ALL_DOWN, AEP_SICK},
{AEA_BLOOD, AEA_HURTALL, AEA_NULL, AEA_NULL},
{AEA_PAIN, AEA_SHADOWS, AEA_DIM, AEA_VOMIT}
},
{"itchy", "makes your skin itch slightly when it is close",
{AEP_DEX_UP, AEP_SPEED_UP, AEP_PSYSHIELD, AEP_NULL},
{AEP_RADIOACTIVE, AEP_MUTAGENIC, AEP_SICK, AEP_NULL},
{AEA_ADRENALINE, AEA_BLOOD, AEA_HEAL, AEA_BUGS},
{AEA_RADIATION, AEA_PAIN, AEA_PAIN, AEA_VOMIT}
},
{"glittering", "glitters faintly under direct light",
{AEP_INT_UP, AEP_EXTINGUISH, AEP_GLOW, AEP_NULL},
{AEP_SMOKE, AEP_ATTENTION, AEP_NULL, AEP_NULL},
{AEA_MAP, AEA_LIGHT, AEA_CONFUSED, AEA_ENTRANCE},
{AEA_RADIATION, AEA_MUTATE, AEA_ATTENTION, AEA_FLASH}
},
{"electric", "very weakly shocks you when touched",
{AEP_RESIST_ELECTRICITY, AEP_DEX_UP, AEP_SPEED_UP, AEP_PSYSHIELD},
{AEP_THIRST, AEP_SMOKE, AEP_STR_DOWN, AEP_BAD_WEATHER},
{AEA_STORM, AEA_ADRENALINE, AEA_LIGHT, AEA_NULL},
{AEA_PAIN, AEA_PARALYZE, AEA_FLASH, AEA_FLASH}
},
{"slimy", "feels slimy",
{AEP_SNAKES, AEP_STEALTH, AEP_EXTINGUISH, AEP_SAP_LIFE},
{AEP_THIRST, AEP_DEX_DOWN, AEP_SPEED_DOWN, AEP_SICK},
{AEA_BLOOD, AEA_ACIDBALL, AEA_GROWTH, AEA_ACIDBALL},
{AEA_MUTATE, AEA_MUTATE, AEA_VOMIT, AEA_VOMIT}
},
{"engraved", "is covered with odd etchings",
{AEP_CLAIRVOYANCE, AEP_INVISIBLE, AEP_PSYSHIELD, AEP_SAP_LIFE},
{AEP_EVIL, AEP_ATTENTION, AEP_NULL, AEP_NULL},
{AEA_FATIGUE, AEA_TELEPORT, AEA_HEAL, AEA_FATIGUE},
{AEA_ATTENTION, AEA_ATTENTION, AEA_TELEGLOW, AEA_DIM}
},
{"crackling", "occasionally makes a soft crackling sound",
{AEP_EXTINGUISH, AEP_RESIST_ELECTRICITY, AEP_NULL, AEP_NULL},
{AEP_SMOKE, AEP_RADIOACTIVE, AEP_MOVEMENT_NOISE, AEP_NULL},
{AEA_STORM, AEA_FIREBALL, AEA_PULSE, AEA_NULL},
{AEA_PAIN, AEA_PARALYZE, AEA_NOISE, AEA_NOISE}
},
{"warm", "is warm to the touch",
{AEP_STR_UP, AEP_EXTINGUISH, AEP_GLOW, AEP_NULL},
{AEP_SMOKE, AEP_RADIOACTIVE, AEP_NULL, AEP_NULL},
{AEA_FIREBALL, AEA_FIREBALL, AEA_FIREBALL, AEA_LIGHT},
{AEA_FIRESTORM, AEA_FIRESTORM, AEA_TELEGLOW, AEA_NULL}
},
{"rattling", "makes a rattling sound when moved",
{AEP_DEX_UP, AEP_SPEED_UP, AEP_SNAKES, AEP_CARRY_MORE},
{AEP_ATTENTION, AEP_INT_DOWN, AEP_MOVEMENT_NOISE, AEP_MOVEMENT_NOISE},
{AEA_BLOOD, AEA_PULSE, AEA_BUGS, AEA_NULL},
{AEA_PAIN, AEA_ATTENTION, AEA_NOISE, AEA_NULL}
},
{"scaled", "has a surface reminiscent of reptile scales",
{AEP_SNAKES, AEP_SNAKES, AEP_SNAKES, AEP_STEALTH},
{AEP_THIRST, AEP_MUTAGENIC, AEP_SPEED_DOWN, AEP_NULL},
{AEA_ADRENALINE, AEA_BUGS, AEA_GROWTH, AEA_NULL},
{AEA_MUTATE, AEA_SCREAM, AEA_DIM, AEA_NULL}
},
{"fractal",
"has a self-similar pattern which repeats until it is too small for you to see",
{AEP_ALL_UP, AEP_ALL_UP, AEP_CLAIRVOYANCE, AEP_PSYSHIELD},
{AEP_SCHIZO, AEP_ATTENTION, AEP_FORCE_TELEPORT, AEP_BAD_WEATHER},
{AEA_STORM, AEA_FATIGUE, AEA_TELEPORT, AEA_NULL},
{AEA_RADIATION, AEA_MUTATE, AEA_TELEGLOW, AEA_TELEGLOW}
}
};
enum artifact_weapon_type
{
ARTWEAP_NULL,
ARTWEAP_BULK, // A bulky item that works okay for bashing
ARTWEAP_CLUB, // An item designed to bash
ARTWEAP_SPEAR, // A stab-only weapon
ARTWEAP_SWORD, // A long slasher
ARTWEAP_KNIFE, // Short, slash and stab
NUM_ARTWEAPS
};
struct artifact_tool_form_datum
{
std::string name;
char sym;
nc_color color;
material m1;
material m2;
int volume_min, volume_max;
int weight_min, weight_max;
artifact_weapon_type base_weapon;
artifact_weapon_type extra_weapons[3];
/*
artifact_tool_form_datum
(std::string Name, char Sym, nc_color Color, material M1, material M2,
int Volmin, int Volmax, int Wgtmin, int Wgtmax, artifact_weapon_type Base,
artifact_weapon_type extra[3])
: name (Name), sym (Sym), color (Color), m1 (M1), m2 (M2),
volume_min (Volmin), volume_max (Volmax), weight_min (Wgtmin),
weight_max (Wgtmax), base_weapon (Base), extra_weapons (extra) { };
*/
};
enum artifact_tool_form
{
ARTTOOLFORM_NULL,
ARTTOOLFORM_HARP,
ARTTOOLFORM_STAFF,
ARTTOOLFORM_SWORD,
ARTTOOLFORM_KNIFE,
ARTTOOLFORM_CUBE,
NUM_ARTTOOLFORMS
};
artifact_tool_form_datum artifact_tool_form_data[NUM_ARTTOOLFORMS] = {
{"", '*', c_white, MNULL, MNULL, 0, 0, 0, 0, ARTWEAP_BULK,
{ARTWEAP_NULL, ARTWEAP_NULL, ARTWEAP_NULL}},
{"Harp", ';', c_yellow, WOOD, MNULL, 20, 30, 10, 18, ARTWEAP_BULK,
{ARTWEAP_SPEAR, ARTWEAP_SWORD, ARTWEAP_KNIFE}},
{"Staff", '/', c_brown, WOOD, MNULL, 6, 12, 4, 10, ARTWEAP_CLUB,
{ARTWEAP_BULK, ARTWEAP_SPEAR, ARTWEAP_KNIFE}},
{"Sword", '/', c_ltblue, STEEL, MNULL, 8, 14, 8, 28, ARTWEAP_SWORD,
{ARTWEAP_BULK, ARTWEAP_NULL, ARTWEAP_NULL}},
{"Dagger", ';', c_ltblue, STEEL, MNULL, 1, 4, 1, 6, ARTWEAP_KNIFE,
{ARTWEAP_NULL, ARTWEAP_NULL, ARTWEAP_NULL}},
{"Cube", '*', c_white, STEEL, MNULL, 1, 3, 1, 20, ARTWEAP_BULK,
{ARTWEAP_SPEAR, ARTWEAP_NULL, ARTWEAP_NULL}}
};
struct artifact_weapon_datum
{
std::string adjective;
int volume, weight; // Only applicable if this is an *extra* weapon
int bash_min, bash_max;
int cut_min, cut_max;
int to_hit_min, to_hit_max;
unsigned flags : NUM_ITEM_FLAGS;
};
artifact_weapon_datum artifact_weapon_data[NUM_ARTWEAPS] = {
{"", 0, 0, 0, 0, 0, 0, 0, 0, 0},
// Adjective Vol,wgt Bash Cut To-Hit
{"Heavy", 0, 12, 10, 20, 0, 0, -2, 0,
0},
{"Knobbed", 1, 2, 14, 30, 0, 0, -1, 1,
0},
{"Spiked", 1, 1, 0, 0, 20, 40, -1, 1,
mfb(IF_SPEAR)},
{"Edged", 2, 4, 0, 0, 20, 50, -1, 2,
0},
{"Bladed", 1, 2, 0, 0, 12, 30, -1, 1,
mfb(IF_STAB)}
};
enum artifact_armor_mod
{
ARMORMOD_NULL,
ARMORMOD_LIGHT,
ARMORMOD_BULKY,
ARMORMOD_POCKETED,
ARMORMOD_FURRED,
ARMORMOD_PADDED,
ARMORMOD_PLATED,
NUM_ARMORMODS
};
struct artifact_armor_form_datum
{
std::string name;
nc_color color;
material m1;
material m2;
int volume, weight;
int encumb;
int dmg_resist;
int cut_resist;
int env_resist;
int warmth;
int storage;
int melee_bash, melee_cut, melee_hit;
unsigned char covers;
bool plural;
artifact_armor_mod available_mods[5];
/*
// Constructor
artifact_armor_form_datum
(std::string Name, nc_color Color, material M1, material M2, int Volume,
int Weight, int Encumb, int Dmg_res, int Cut_res, int Env_res,
int Warmth, int Storage, int Bash, int Cut, int Hit, unsigned char Covers,
bool Plural, artifact_armor_mod Mods[5])
: name (Name), color (Color), m1 (M1), m2 (M2), volume (Volume),
weight (Weight), encumb (Encumb), dmg_resist (Dmg_res),
cut_resist (Cut_res), env_resist (Env_res), warmth (Warmth),
storage (Storage), melee_bash (Bash), melee_cut (Cut), melee_hit (Hit),
covers (Covers), plural (Plural), available_mods (Mods) { };
*/
};
enum artifact_armor_form
{
ARTARMFORM_NULL,
ARTARMFORM_ROBE,
ARTARMFORM_COAT,
ARTARMFORM_MASK,
ARTARMFORM_HELM,
ARTARMFORM_GLOVES,
ARTARMFORM_BOOTS,
ARTARMFORM_RING,
NUM_ARTARMFORMS
};
artifact_armor_form_datum artifact_armor_form_data[NUM_ARTARMFORMS] = {
{"", c_white, MNULL, MNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Robe", c_red, WOOL, MNULL, 6, 6, 1, 3, 1, 0, 2, 0, -8, 0, -3,
mfb(bp_torso)|mfb(bp_legs), false,
{ARMORMOD_LIGHT, ARMORMOD_BULKY, ARMORMOD_POCKETED, ARMORMOD_FURRED,
ARMORMOD_PADDED}},
{"Coat", c_brown,LEATHER,MNULL, 14, 14, 2, 4, 12, 1, 4, 4, -6, 0, -3,
mfb(bp_torso), false,
{ARMORMOD_LIGHT, ARMORMOD_POCKETED, ARMORMOD_FURRED, ARMORMOD_PADDED,
ARMORMOD_PLATED}},
{"Mask", c_white, WOOD, MNULL, 4, 1, 2, 2, 16, 1, 2, 0, 2, 0, -2,
mfb(bp_eyes)|mfb(bp_mouth), false,
{ARMORMOD_FURRED, ARMORMOD_FURRED, ARMORMOD_NULL, ARMORMOD_NULL,
ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Helm", c_dkgray,SILVER, MNULL, 6, 6, 2, 4, 18, 0, 1, 0, 8, 0, -2,
mfb(bp_head), false,
{ARMORMOD_BULKY, ARMORMOD_FURRED, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
{"Gloves", c_ltblue,LEATHER,MNULL, 2, 1, 1, 6, 6, 1, 2, 0, -4, 0, -2,
mfb(bp_hands), true,
{ARMORMOD_BULKY, ARMORMOD_FURRED, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Boots", c_blue, LEATHER, MNULL, 6, 2, 1, 6, 6, 1, 3, 0, 4, 0, -1,
mfb(bp_feet), true,
{ARMORMOD_LIGHT, ARMORMOD_BULKY, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
{"Ring", c_ltgreen, SILVER, MNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, true,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}}
};
/* Armor mods alter the normal values of armor.
* If the basic armor type has MNULL as its second material, and the mod has a
* material attached, the second material will be changed.
*/
artifact_armor_form_datum artifact_armor_mod_data[NUM_ARMORMODS] = {
{"", c_white, MNULL, MNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
// Description; "It is ..." or "They are ..."
{"very thin and light.", c_white, MNULL, MNULL,
// Vol Wgt Enc Dmg Cut Env Wrm Sto
-4, -8, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"extremely bulky.", c_white, MNULL, MNULL,
8, 10, 2, 1, 1, 0, 1, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"covered in pockets.", c_white, MNULL, MNULL,
1, 1, 1, 0, 0, 0, 0, 16, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"disgustingly furry.", c_white, WOOL, MNULL,
// Vol Wgt Enc Dmg Cut Env Wrm Sto
4, 2, 1, 4, 0, 1, 3, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"leather-padded.", c_white, LEATHER, MNULL,
4, 4, 1, 10, 4, 0, 1, -3, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"plated in iron.", c_white, IRON, MNULL,
4, 12, 3, 8, 14, 0, 1, -4, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
};
#define NUM_ART_ADJS 20
std::string artifact_adj[NUM_ART_ADJS] = {
"Forbidden", "Unknown", "Forgotten", "Hideous", "Eldritch",
"Gelatinous", "Ancient", "Cursed", "Bloody", "Undying",
"Shadowy", "Silent", "Cyclopean", "Fungal", "Unspeakable",
"Grotesque", "Frigid", "Shattered", "Sleeping", "Repellent"
};
#define NUM_ART_NOUNS 20
// Prepending + makes it proper, e.g. "The Forbidden Abyss"
std::string artifact_noun[NUM_ART_NOUNS] = {
"Technique", "Dreams", "Beasts", "Evil", "Miasma",
"+Abyss", "+City", "Shadows", "Shade", "Illusion",
"Justice", "+Necropolis", "Ichor", "+Monolith", "Aeons",
"Graves", "Horrors", "Suffering", "Death", "Horror"
};
#endif
+301 -19
View File
@@ -1,11 +1,15 @@
#include "player.h"
#include "game.h"
#include "rng.h"
#include "keypress.h"
#include "input.h"
#include "item.h"
#include "bionics.h"
#include "line.h"
#define BATTERY_AMOUNT 4 // How much batteries increase your power
void bionics_install_failure(game *g, player *u, int success);
// Why put this in a Big Switch? Why not let bionics have pointers to
// functions, much like monsters and items?
@@ -15,13 +19,15 @@
void player::activate_bionic(int b, game *g)
{
bionic bio = my_bionics[b];
if (power_level < bionics[bio.id].power_cost) {
int power_cost = bionics[bio.id].power_cost;
if (weapon.type->id == itm_bio_claws && bio.id == bio_claws)
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());
my_bionics[b].powered = false;
} else {
} else
g->add_msg("You cannot power your %s", bionics[bio.id].name.c_str());
}
return;
}
@@ -34,26 +40,31 @@ void player::activate_bionic(int b, game *g)
my_bionics[b].powered = true;
my_bionics[b].charge = bionics[bio.id].charge_time;
}
power_level -= bionics[bio.id].power_cost;
power_level -= power_cost;
}
std::string junk;
std::vector<point> traj;
std::vector<std::string> good;
std::vector<std::string> bad;
WINDOW *w;
WINDOW* w;
int dirx, diry, t, l, index;
InputEvent input;
item tmp_item;
switch (bio.id) {
case bio_painkiller:
pkill += 6;
pain -= 2;
if (pkill > pain)
pkill = pain;
break;
case bio_nanobots:
healall(4);
break;
case bio_resonator:
g->sound(posx, posy, 30, "VRRRRMP!");
for (int i = posx - 1; i <= posx + 1; i++) {
@@ -66,6 +77,7 @@ void player::activate_bionic(int b, game *g)
}
}
break;
case bio_time_freeze:
moves += 100 * power_level;
power_level = 0;
@@ -81,10 +93,12 @@ void player::activate_bionic(int b, game *g)
if (one_in(5))
add_disease(DI_TELEGLOW, rng(50, 400), g);
break;
case bio_teleport:
g->teleport();
add_disease(DI_TELEGLOW, 300, g);
break;
// TODO: More stuff here (and bio_blood_filter)
case bio_blood_anal:
w = newwin(20, 40, 3, 10);
@@ -92,6 +106,8 @@ void player::activate_bionic(int b, game *g)
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
if (has_disease(DI_FUNGUS))
bad.push_back("Fungal Parasite");
if (has_disease(DI_DERMATIK))
bad.push_back("Insect Parasite");
if (has_disease(DI_POISON))
bad.push_back("Poison");
if (radiation > 0)
@@ -120,7 +136,7 @@ void player::activate_bionic(int b, game *g)
mvwprintz(w, 1, 1, c_white, "No effects.");
else {
for (int line = 1; line < 39 && line <= good.size() + bad.size(); line++) {
if (line < bad.size())
if (line <= bad.size())
mvwprintz(w, line, 1, c_red, bad[line - 1].c_str());
else
mvwprintz(w, line, 1, c_green, good[line - 1 - bad.size()].c_str());
@@ -129,7 +145,9 @@ void player::activate_bionic(int b, game *g)
wrefresh(w);
refresh();
getch();
delwin(w);
break;
case bio_blood_filter:
rem_disease(DI_FUNGUS);
rem_disease(DI_POISON);
@@ -143,9 +161,8 @@ void player::activate_bionic(int b, game *g)
rem_disease(DI_TOOK_PROZAC);
rem_disease(DI_TOOK_FLUMED);
rem_disease(DI_ADRENALINE);
pkill = rng(0, pkill);
stim = rng(0, stim);
break;
case bio_evap:
if (query_yn("Drink directly? Otherwise you will need a container.")) {
tmp_item = item(g->itypes[itm_water], 0);
@@ -180,10 +197,12 @@ void player::activate_bionic(int b, game *g)
}
}
break;
case bio_lighter:
g->draw();
mvprintw(0, 0, "Torch in which direction?");
get_direction(dirx, diry, input());
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_lighter].power_cost;
@@ -194,6 +213,7 @@ void player::activate_bionic(int b, game *g)
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) {
g->add_msg("You withdraw your claws.");
@@ -203,11 +223,14 @@ void player::activate_bionic(int b, game *g)
weapon.tname().c_str());
g->m.add_item(posx, posy, weapon);
weapon = item(g->itypes[itm_bio_claws], 0);
weapon.invlet = '#';
} else {
g->add_msg("Your claws extend!");
weapon = item(g->itypes[itm_bio_claws], 0);
weapon.invlet = '#';
}
break;
case bio_blaster:
tmp_item = weapon;
weapon = item(g->itypes[itm_bio_blaster], 0);
@@ -217,6 +240,7 @@ void player::activate_bionic(int b, game *g)
g->plfire(false);
weapon = tmp_item;
break;
case bio_laser:
tmp_item = weapon;
weapon = item(g->itypes[itm_v29], 0);
@@ -226,10 +250,12 @@ void player::activate_bionic(int b, game *g)
g->plfire(false);
weapon = tmp_item;
break;
case bio_emp:
g->draw();
mvprintw(0, 0, "Fire EMP in which direction?");
get_direction(dirx, diry, input());
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_emp].power_cost;
@@ -239,9 +265,11 @@ void player::activate_bionic(int b, game *g)
diry += posy;
g->emp_blast(dirx, diry);
break;
case bio_hydraulics:
g->add_msg("Your muscles hiss as hydraulic strength fills them!");
break;
case 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];
@@ -270,6 +298,7 @@ void player::activate_bionic(int b, game *g)
power_level += bionics[bio_water_extractor].power_cost;
}
break;
case bio_magnet:
for (int i = posx - 10; i <= posx + 10; i++) {
for (int j = posy - 10; j <= posy + 10; j++) {
@@ -279,6 +308,7 @@ void player::activate_bionic(int b, game *g)
else
traj = line_to(i, j, posx, posy, 0);
}
traj.insert(traj.begin(), point(i, j));
for (int k = 0; k < g->m.i_at(i, j).size(); k++) {
if (g->m.i_at(i, j)[k].made_of(IRON) || g->m.i_at(i, j)[k].made_of(STEEL)){
tmp_item = g->m.i_at(i, j)[k];
@@ -286,13 +316,12 @@ void player::activate_bionic(int b, game *g)
for (l = 0; l < traj.size(); l++) {
index = g->mon_at(traj[l].x, traj[l].y);
if (index != -1) {
if (g->z[index].hurt(tmp_item.weight() * tmp_item.volume()))
g->kill_mon(index);
if (g->z[index].hurt(tmp_item.weight() * 2))
g->kill_mon(index, true);
g->m.add_item(traj[l].x, traj[l].y, tmp_item);
l = traj.size() + 1;
} else if (l > 0 && g->m.move_cost(traj[l].x, traj[l].y) == 0) {
g->m.bash(traj[l].x, traj[l].y, tmp_item.weight() * tmp_item.volume(),
junk);
g->m.bash(traj[l].x, traj[l].y, tmp_item.weight() * 2, junk);
g->sound(traj[l].x, traj[l].y, 12, junk);
if (g->m.move_cost(traj[l].x, traj[l].y) == 0) {
g->m.add_item(traj[l - 1].x, traj[l - 1].y, tmp_item);
@@ -302,16 +331,17 @@ void player::activate_bionic(int b, game *g)
}
if (l == traj.size())
g->m.add_item(posx, posy, tmp_item);
k--;
}
}
}
}
break;
case bio_lockpick:
g->draw();
mvprintw(0, 0, "Unlock in which direction?");
get_direction(dirx, diry, input());
input = get_input();
get_direction(dirx, diry, input);
if (dirx == -2) {
g->add_msg("Invalid direction.");
power_level += bionics[bio_lockpick].power_cost;
@@ -324,8 +354,260 @@ void player::activate_bionic(int b, game *g)
g->add_msg("You unlock the door.");
g->m.ter(dirx, diry) = t_door_c;
} else
g->add_msg("You can't unlock that %s", g->m.tername(dirx, diry).c_str());
g->add_msg("You can't unlock that %s.", g->m.tername(dirx, diry).c_str());
break;
}
}
bool player::install_bionics(game *g, it_bionic* type)
{
if (type == NULL) {
debugmsg("Tried to install NULL bionic");
return false;
}
std::string bio_name = type->name.substr(5); // Strip off "CBM: "
WINDOW* w = newwin(25, 80, 0, 0);
int pl_skill = int_cur +
skillLevel("electronics").level() * 4 +
skillLevel("firstaid").level() * 3 +
skillLevel("mechanics").level() * 2;
int skint = int(pl_skill / 4);
int skdec = int((pl_skill * 10) / 4) % 10;
// Header text
mvwprintz(w, 0, 0, c_white, "Installing bionics:");
mvwprintz(w, 0, 20, type->color, bio_name.c_str());
// Dividing bars
for (int i = 0; i < 80; i++) {
mvwputch(w, 1, i, c_ltgray, LINE_OXOX);
mvwputch(w, 21, i, c_ltgray, LINE_OXOX);
}
// Init the list of bionics
for (int i = 1; i < type->options.size(); i++) {
bionic_id id = type->options[i];
mvwprintz(w, i + 2, 0, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
}
// Helper text
mvwprintz(w, 2, 40, c_white, "Difficulty of this module: %d",
type->difficulty);
mvwprintz(w, 3, 40, c_white, "Your installation skill: %d.%d",
skint, skdec);
mvwprintz(w, 4, 40, c_white, "Installation requires high intelligence,");
mvwprintz(w, 5, 40, c_white, "and skill in electronics, first aid, and");
mvwprintz(w, 6, 40, c_white, "mechanics (in that order of importance).");
int chance_of_success = int((100 * pl_skill) /
(pl_skill + 4 * type->difficulty));
mvwprintz(w, 8, 40, c_white, "Chance of success:");
nc_color col_suc;
if (chance_of_success >= 95)
col_suc = c_green;
else if (chance_of_success >= 80)
col_suc = c_ltgreen;
else if (chance_of_success >= 60)
col_suc = c_yellow;
else if (chance_of_success >= 35)
col_suc = c_ltred;
else
col_suc = c_red;
mvwprintz(w, 8, 59, col_suc, "%d%%%%", chance_of_success);
mvwprintz(w, 10, 40, c_white, "Failure may result in crippling damage,");
mvwprintz(w, 11, 40, c_white, "loss of existing bionics, genetic damage");
mvwprintz(w, 12, 40, c_white, "or faulty installation.");
wrefresh(w);
if (type->id == itm_bionics_battery) { // No selection list; just confirm
mvwprintz(w, 2, 0, h_ltblue, "Battery Level +%d", BATTERY_AMOUNT);
mvwprintz(w, 22, 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\
charge mechanism, which must be installed from another CBM.", BATTERY_AMOUNT);
InputEvent input;
wrefresh(w);
do
input = get_input();
while (input != Confirm && input != Close);
if (input == Confirm) {
practice("electronics", (100 - chance_of_success) * 1.5);
practice("firstaid", (100 - chance_of_success) * 1.0);
practice("mechanics", (100 - chance_of_success) * 0.5);
int success = chance_of_success - rng(1, 100);
if (success > 0) {
g->add_msg("Successfully installed batteries.");
max_power_level += BATTERY_AMOUNT;
} else
bionics_install_failure(g, this, success);
werase(w);
delwin(w);
g->refresh_all();
return true;
}
werase(w);
delwin(w);
g->refresh_all();
return false;
}
int selection = 0;
InputEvent input;
do {
bionic_id id = type->options[selection];
mvwprintz(w, 2 + selection, 0, (has_bionic(id) ? h_ltred : h_ltblue),
bionics[id].name.c_str());
// Clear the bottom three lines...
mvwprintz(w, 22, 0, c_ltgray, "\
\n\
\n\
");
// ...and then fill them with the description of the selected bionic
mvwprintz(w, 22, 0, c_ltblue, bionics[id].description.c_str());
wrefresh(w);
input = get_input();
switch (input) {
case DirectionS:
mvwprintz(w, 2 + selection, 0, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
if (selection == type->options.size() - 1)
selection = 0;
else
selection++;
break;
case DirectionN:
mvwprintz(w, 2 + selection, 0, (has_bionic(id) ? c_ltred : c_ltblue),
bionics[id].name.c_str());
if (selection == 0)
selection = type->options.size() - 1;
else
selection--;
break;
}
if (input == Confirm && has_bionic(id)) {
popup("You already have a %s!", bionics[id].name.c_str());
input = Nothing;
}
} while (input != Cancel && input != Confirm);
if (input == Confirm) {
practice("electronics", (100 - chance_of_success) * 1.5);
practice("firstaid", (100 - chance_of_success) * 1.0);
practice("mechanics", (100 - chance_of_success) * 0.5);
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());
add_bionic(id);
} else
bionics_install_failure(g, this, success);
werase(w);
delwin(w);
g->refresh_all();
return true;
}
werase(w);
delwin(w);
g->refresh_all();
return false;
}
void bionics_install_failure(game *g, player *u, int success)
{
success = abs(success) - rng(1, 10);
int failure_level = 0;
if (success <= 0) {
g->add_msg("The installation fails without incident.");
return;
}
while (success > 0) {
failure_level++;
success -= rng(1, 10);
}
int fail_type = rng(1, (failure_level > 5 ? 5 : failure_level));
std::string fail_text;
switch (rng(1, 5)) {
case 1: fail_text = "You flub the installation"; break;
case 2: fail_text = "You mess up the installation"; break;
case 3: fail_text = "The installation fails"; break;
case 4: fail_text = "The installation is a failure"; break;
case 5: fail_text = "You screw up the installation"; break;
}
if (fail_type == 3 && u->my_bionics.size() == 0)
fail_type = 2; // If we have no bionics, take damage instead of losing some
switch (fail_type) {
case 1:
fail_text += ", causing great pain.";
u->pain += rng(failure_level * 3, failure_level * 6);
break;
case 2:
fail_text += " and your body is damaged.";
u->hurtall(rng(failure_level, failure_level * 2));
break;
case 3:
fail_text += " and ";
fail_text += (u->my_bionics.size() <= failure_level ? "all" : "some");
fail_text += " of your existing bionics are lost.";
for (int i = 0; i < failure_level && u->my_bionics.size() > 0; i++) {
int rem = rng(0, u->my_bionics.size() - 1);
u->my_bionics.erase(u->my_bionics.begin() + rem);
}
break;
case 4:
fail_text += " and do damage to your genetics, causing mutation.";
g->add_msg(fail_text.c_str()); // Failure text comes BEFORE mutation text
while (failure_level > 0) {
u->mutate(g);
failure_level -= rng(1, failure_level + 2);
}
return; // So the failure text doesn't show up twice
break;
case 5:
{
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);
}
if (valid.size() == 0) { // We've got all the bad bionics!
if (u->max_power_level > 0) {
g->add_msg("You lose power capacity!");
u->max_power_level = rng(0, u->max_power_level - 1);
}
// TODO: What if we can't lose power capacity? No penalty?
} else {
int index = rng(0, valid.size() - 1);
u->add_bionic(valid[index]);
}
}
break;
}
delwin(w);
g->add_msg(fail_text.c_str());
}
+50 -16
View File
@@ -6,6 +6,7 @@
* 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
@@ -16,13 +17,12 @@ 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_flashlight, bio_night_vision, bio_infrared,
bio_face_mask, // TODO
bio_ads, bio_ods, bio_scent_mask, bio_cloak, bio_painkiller, bio_nanobots,
bio_heatsink, bio_resonator, bio_time_freeze, bio_teleport, bio_blood_anal,
bio_blood_filter, bio_alarm,
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,
// TODO: fingerhack
bio_hydraulics, bio_water_extractor, bio_magnet, bio_fingerhack, bio_lockpick,
bio_ground_sonar,
max_bio_start,
@@ -30,6 +30,10 @@ max_bio_start,
// 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
};
@@ -62,11 +66,14 @@ struct bionic {
charge = 0;
};
};
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."},
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."},
@@ -102,8 +109,7 @@ 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, at the\n\
cost of a small amount of power."},
their way into your windpipe, the filter will attempt to remove them."},
{"Internal Climate Control", false, false, 0, 0, "\
Throughout your body lies a network of thermal piping which eases the effects\n\
of high and low ambient temperatures. It has an operating range of 0 to 140\n\
@@ -118,10 +124,11 @@ 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 food-born illness, and can sometimes eat rotten food."},
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 much more. You no longer need any tools when crafting."},
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\
@@ -140,10 +147,10 @@ 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 and decreasing dexterity by 1."},
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 2."},
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."},
@@ -171,6 +178,10 @@ 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\
@@ -223,7 +234,7 @@ anything else."},
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-Mounter Laser", false, true, 2, 0, "\
{"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."},
@@ -232,7 +243,7 @@ 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 muslces in your arms will be greatly enchanced,\n\
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\
@@ -291,7 +302,30 @@ 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."}
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."}
};
#endif
+21 -6
View File
@@ -9,7 +9,7 @@ std::string body_part_name (body_part bp, int side)
case bp_eyes:
return "eyes";
case bp_mouth:
return "jaw";
return "mouth";
case bp_torso:
return "torso";
case bp_arms:
@@ -41,18 +41,33 @@ std::string body_part_name (body_part bp, int side)
}
}
std::string encumb_text(body_part bp)
{
switch (bp) {
case bp_head: return "";
case bp_eyes: return "Ranged combat is hampered.";
case bp_mouth: return "Running is slowed.";
case bp_torso: return "Dodging and melee is hampered.";
case bp_arms: return "Melee and ranged combat is hampered.";
case bp_hands: return "Manual tasks are slowed.";
case bp_legs: return "Running and swimming are slowed.";
case bp_feet: return "Running is slowed.";
default: return "It's inflammed.";
}
}
body_part random_body_part()
{
int rn = rng(0, 30);
int rn = rng(0, 100);
if (rn == 0)
return bp_eyes;
if (rn <= 2)
if (rn <= 1)
return bp_mouth;
if (rn <= 6)
if (rn <= 7)
return bp_head;
if (rn <= 12)
if (rn <= 28)
return bp_legs;
if (rn <= 20)
if (rn <= 50)
return bp_arms;
return bp_torso;
}
+4 -2
View File
@@ -4,10 +4,10 @@
#include <string>
enum body_part {
bp_head = 0,
bp_torso = 0,
bp_head,
bp_eyes,
bp_mouth,
bp_torso,
bp_arms,
bp_hands,
bp_legs,
@@ -16,6 +16,8 @@ enum body_part {
};
std::string body_part_name(body_part bp, int side);
std::string encumb_text(body_part bp);
body_part random_body_part();
#endif
+416
View File
@@ -0,0 +1,416 @@
#include <sstream>
#include "calendar.h"
#include "output.h"
#include "options.h"
calendar::calendar()
{
second = 0;
minute = 0;
hour = 0;
day = 0;
season = SPRING;
year = 0;
}
calendar::calendar(const calendar &copy)
{
second = copy.second;
minute = copy.minute;
hour = copy.hour;
day = copy.day;
season = copy.season;
year = copy.year;
}
calendar::calendar(int Minute, int Hour, int Day, season_type Season, int Year)
{
second = 0;
minute = Minute;
hour = Hour;
day = Day;
season = Season;
year = Year;
}
calendar::calendar(int turn)
{
int minutes = int(turn / 10);
int hours = minutes / 60;
int days = hours / 24;
int seasons = days / DAYS_IN_SEASON;
second = 6 * (turn % 10);
minute = minutes % 60;
hour = hours % 24;
day = 1 + days % DAYS_IN_SEASON;
season = season_type(seasons % 4);
year = seasons / 4;
}
int calendar::get_turn()
{
int ret = second / 6;
ret += minute * 10;
ret += hour * 600;
ret += day * 14400;
ret += int(season) * 14400 * DAYS_IN_SEASON;
ret += year * 14400 * 4 * DAYS_IN_SEASON;
return ret;
}
calendar::operator int() const
{
int ret = second / 6;
ret += minute * 10;
ret += hour * 600;
ret += day * 14400;
ret += int(season) * 14400 * DAYS_IN_SEASON;
ret += year * 14400 * 4 * DAYS_IN_SEASON;
return ret;
}
calendar& calendar::operator =(calendar &rhs)
{
if (this == &rhs)
return *this;
second = rhs.second;
minute = rhs.minute;
hour = rhs.hour;
day = rhs.day;
season = rhs.season;
year = rhs.year;
return *this;
}
calendar& calendar::operator =(int rhs)
{
int minutes = int(rhs / 10);
int hours = minutes / 60;
int days = hours / 24;
int seasons = days / DAYS_IN_SEASON;
second = 6 * (rhs % 10);
minute = minutes % 60;
hour = hours % 24;
day = days % DAYS_IN_SEASON;
season = season_type(seasons % 4);
year = seasons / 4;
return *this;
}
calendar& calendar::operator -=(calendar &rhs)
{
calendar tmp(rhs);
tmp.standardize();
second -= tmp.second;
minute -= tmp.minute;
hour -= tmp.hour;
day -= tmp.day;
int tmpseason = int(season) - int(tmp.season);
while (tmpseason < 0) {
year--;
tmpseason += 4;
}
season = season_type(tmpseason);
year -= tmp.year;
standardize();
return *this;
}
calendar& calendar::operator -=(int rhs)
{
calendar tmp(rhs);
*this -= tmp;
return *this;
}
calendar& calendar::operator +=(calendar &rhs)
{
second += rhs.second;
minute += rhs.minute;
hour += rhs.hour;
day += rhs.day;
int tmpseason = int(season) + int(rhs.season);
while (tmpseason >= 4) {
year++;
tmpseason -= 4;
}
season = season_type(tmpseason);
year += rhs.year;
standardize();
return *this;
}
calendar& calendar::operator +=(int rhs)
{
second += rhs * 6;
standardize();
return *this;
}
bool calendar::operator ==(int rhs)
{
return int(*this) == rhs;
}
bool calendar::operator ==(calendar &rhs)
{
return (second == rhs.second &&
minute == rhs.minute &&
hour == rhs.hour &&
day == rhs.day &&
season == rhs.season &&
year == rhs.year);
}
/*
calendar& calendar::operator ++()
{
*this += 1;
return *this;
}
*/
calendar calendar::operator -(calendar &rhs)
{
return calendar(*this) -= rhs;
}
calendar calendar::operator -(int rhs)
{
return calendar(*this) -= rhs;
}
calendar calendar::operator +(calendar &rhs)
{
return calendar(*this) += rhs;
}
calendar calendar::operator +(int rhs)
{
return calendar(*this) += rhs;
}
void calendar::increment()
{
second += 6;
if (second >= 60)
standardize();
}
void calendar::standardize()
{
if (second >= 60) {
minute += second / 60;
second %= 60;
}
if (minute >= 60) {
hour += minute / 60;
minute %= 60;
}
if (hour >= 24) {
day += hour / 24;
hour %= 24;
}
int tmpseason = int(season);
if (day >= DAYS_IN_SEASON) {
tmpseason += day / DAYS_IN_SEASON;
day %= DAYS_IN_SEASON;
}
if (tmpseason >= 4) {
year += tmpseason / 4;
tmpseason %= 4;
}
season = season_type(tmpseason);
}
int calendar::minutes_past_midnight()
{
//debugmsg("minute: %d hour: %d");
int ret = minute + hour * 60;
return ret;
}
moon_phase calendar::moon()
{
int phase = day / (DAYS_IN_SEASON / 4);
//phase %= 4; Redundant?
if (phase == 3)
return MOON_HALF;
else
return moon_phase(phase);
}
calendar calendar::sunrise()
{
calendar ret;
int start_hour = 0, end_hour = 0;
switch (season) {
case SPRING:
start_hour = SUNRISE_SOLSTICE;
end_hour = SUNRISE_SUMMER;
break;
case SUMMER:
start_hour = SUNRISE_SUMMER;
end_hour = SUNRISE_SOLSTICE;
break;
case AUTUMN:
start_hour = SUNRISE_SOLSTICE;
end_hour = SUNRISE_WINTER;
break;
case WINTER:
start_hour = SUNRISE_WINTER;
end_hour = SUNRISE_SOLSTICE;
break;
}
double percent = double(double(day) / DAYS_IN_SEASON);
double time = double(start_hour) * (1.- percent) + double(end_hour) * percent;
ret.hour = int(time);
time -= int(time);
ret.minute = int(time * 60);
return ret;
}
calendar calendar::sunset()
{
calendar ret;
int start_hour = 0, end_hour = 0;
switch (season) {
case SPRING:
start_hour = SUNSET_SOLSTICE;
end_hour = SUNSET_SUMMER;
break;
case SUMMER:
start_hour = SUNSET_SUMMER;
end_hour = SUNSET_SOLSTICE;
break;
case AUTUMN:
start_hour = SUNSET_SOLSTICE;
end_hour = SUNSET_WINTER;
break;
case WINTER:
start_hour = SUNSET_WINTER;
end_hour = SUNSET_SOLSTICE;
break;
}
double percent = double(double(day) / DAYS_IN_SEASON);
double time = double(start_hour) * (1.- percent) + double(end_hour) * percent;
ret.hour = int(time);
time -= int(time);
ret.minute = int(time * 60);
return ret;
}
bool calendar::is_night()
{
calendar sunrise_time = sunrise(), sunset_time = sunset();
int mins = minutes_past_midnight(),
sunrise_mins = sunrise_time.minutes_past_midnight(),
sunset_mins = sunset_time.minutes_past_midnight();
return (mins > sunset_mins + TWILIGHT_MINUTES || mins < sunrise_mins);
}
int calendar::sunlight()
{
calendar sunrise_time = sunrise(), sunset_time = sunset();
int mins = 0, sunrise_mins = 0, sunset_mins = 0;
mins = minutes_past_midnight();
sunrise_mins = sunrise_time.minutes_past_midnight();
sunset_mins = sunset_time.minutes_past_midnight();
int moonlight = 1 + int(moon()) * MOONLIGHT_LEVEL;
if (mins > sunset_mins + TWILIGHT_MINUTES || mins < sunrise_mins) // Night
return moonlight;
else if (mins >= sunrise_mins && mins <= sunrise_mins + TWILIGHT_MINUTES) {
double percent = double(mins - sunrise_mins) / TWILIGHT_MINUTES;
return int( double(moonlight) * (1. - percent) +
double(DAYLIGHT_LEVEL) * percent );
} else if (mins >= sunset_mins && mins <= sunset_mins + TWILIGHT_MINUTES) {
double percent = double(mins - sunset_mins) / TWILIGHT_MINUTES;
return int( double(DAYLIGHT_LEVEL) * (1. - percent) +
double(moonlight) * percent );
} else
return DAYLIGHT_LEVEL;
}
std::string calendar::print_time(bool twentyfour)
{
std::stringstream ret;
if (twentyfour) {
ret << hour << ":";
if (minute < 10)
ret << "0";
ret << minute;
} else {
if (OPTIONS[OPT_24_HOUR] == 1) {
int hours = hour % 24;
if (hours < 10)
ret << "0";
ret << hours;
} else if (OPTIONS[OPT_24_HOUR] == 2) {
int hours = hour % 24;
ret << hours << ":";
}else {
int hours = hour % 12;
if (hours == 0)
hours = 12;
ret << hours << ":";
}
if (minute < 10)
ret << "0";
ret << minute;
if (OPTIONS[OPT_24_HOUR] == 0) {
if (hour < 12)
ret << " AM";
else
ret << " PM";
}
}
return ret.str();
}
std::string calendar::textify_period()
{
standardize();
std::stringstream ret;
int am;
std::string tx;
// Describe the biggest time period, as "<am> <tx>s", am = amount, tx = name
if (year > 0) {
am = year;
tx = "year";
} else if (season > 0) {
am = season;
tx = "season";
} else if (day > 0) {
am = day;
tx = "day";
} else if (hour > 0) {
am = hour;
tx = "hour";
} else if (minute >= 5) {
am = minute;
tx = "minute";
} else {
am = second / 6 + minute * 10;
tx = "turn";
}
ret << am << " " << tx << (am > 1 ? "s" : "");
return ret.str();
}
+83
View File
@@ -0,0 +1,83 @@
#include <string>
#include "weather.h"
// How many minutes exist when the game starts - 8:00 AM
#define STARTING_MINUTES 480
// The number of days in a season - this also defines moon cycles
#define DAYS_IN_SEASON 14
// Convert minutes, hours, days to turns
#define MINUTES(x) ((x) * 10)
#define HOURS(x) ((x) * 600)
#define DAYS(x) ((x) * 14400)
// Times for sunrise, sunset at equinoxes
#define SUNRISE_WINTER 7
#define SUNRISE_SOLSTICE 6
#define SUNRISE_SUMMER 5
#define SUNSET_WINTER 17
#define SUNSET_SOLSTICE 19
#define SUNSET_SUMMER 21
// How long, in minutes, does sunrise/sunset last?
#define TWILIGHT_MINUTES 60
// How much light moon provides--double for full moon
#define MOONLIGHT_LEVEL 4
// How much light is provided in full daylight
#define DAYLIGHT_LEVEL 60
enum moon_phase {
MOON_NEW = 0,
MOON_HALF,
MOON_FULL
};
class calendar
{
public:
// The basic data; note that "second" should always be a multiple of 6
int second;
int minute;
int hour;
int day;
season_type season;
int year;
// End data
calendar();
calendar(const calendar &copy);
calendar(int Minute, int Hour, int Day, season_type Season, int Year);
calendar(int turn);
int get_turn();
operator int() const; // Returns get_turn() for backwards compatibility
calendar& operator = (calendar &rhs);
calendar& operator = (int rhs);
calendar& operator -=(calendar &rhs);
calendar& operator -=(int rhs);
calendar& operator +=(calendar &rhs);
calendar& operator +=(int rhs);
calendar operator - (calendar &rhs);
calendar operator - (int rhs);
calendar operator + (calendar &rhs);
calendar operator + (int rhs);
bool operator ==(int rhs);
bool operator ==(calendar &rhs);
void increment(); // Add one turn / 6 seconds
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
// Print-friendly stuff
std::string print_time(bool twentyfour = false);
std::string textify_period(); // "1 second" "2 hours" "two days"
};
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR && ./cataclysm
+812
View File
@@ -0,0 +1,812 @@
#if (defined _WIN32 || defined WINDOWS)
#include "catacurse.h"
#include "options.h"
#include <cstdlib>
#include <fstream>
//***********************************
//Globals *
//***********************************
WINDOW *mainwin;
const WCHAR *szWindowClass = (L"CataCurseWindow"); //Class name :D
HINSTANCE WindowINST; //the instance of the window
HWND WindowHandle; //the handle of the window
HDC WindowDC; //Device Context of the window, used for backbuffer
int WindowX; //X pos of the actual window, not the curses window
int WindowY; //Y pos of the actual window, not the curses window
int WindowWidth; //Width of the actual window, not the curses window
int WindowHeight; //Height of the actual window, not the curses window
int lastchar; //the last character that was pressed, resets in getch
int inputdelay; //How long getch will wait for a character to be typed
//WINDOW *_windows; //Probably need to change this to dynamic at some point
//int WindowCount; //The number of curses windows currently in use
HDC backbuffer; //an off-screen DC to prevent flickering, lower cpu
HBITMAP backbit; //the bitmap that is used in conjunction wth the above
int fontwidth; //the width of the font, background is always this size
int fontheight; //the height of the font, background is always this size
int halfwidth; //half of the font width, used for centering lines
int halfheight; //half of the font height, used for centering lines
HFONT font; //Handle to the font created by CreateFont
RGBQUAD *windowsPalette; //The coor palette, 16 colors emulates a terminal
pairs *colorpairs; //storage for pair'ed colored, should be dynamic, meh
unsigned char *dcbits; //the bits of the screen image, for direct access
char szDirectory[MAX_PATH] = "";
//***********************************
//Non-curses, Window functions *
//***********************************
//Registers, creates, and shows the Window!!
bool WinCreate()
{
int success;
WNDCLASSEXW WindowClassType;
int WinBorderHeight;
int WinBorderWidth;
int WinTitleSize;
unsigned int WindowStyle;
const WCHAR *szTitle= (L"Cataclysm");
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
WindowClassType.cbSize = sizeof(WNDCLASSEXW);
WindowClassType.style = 0;//No point in having a custom style, no mouse, etc
WindowClassType.lpfnWndProc = ProcessMessages;//the procedure that gets msgs
WindowClassType.cbClsExtra = 0;
WindowClassType.cbWndExtra = 0;
WindowClassType.hInstance = WindowINST;// hInstance
WindowClassType.hIcon = LoadIcon(WindowINST, IDI_APPLICATION);//Default Icon
WindowClassType.hIconSm = LoadIcon(WindowINST, IDI_APPLICATION);//Default Icon
WindowClassType.hCursor = LoadCursor(NULL, IDC_ARROW);//Default Pointer
WindowClassType.lpszMenuName = NULL;
WindowClassType.hbrBackground = 0;//Thanks jday! Remove background brush
WindowClassType.lpszClassName = szWindowClass;
success = RegisterClassExW(&WindowClassType);
if ( success== 0){
return false;
}
WindowStyle = WS_OVERLAPPEDWINDOW & ~(WS_THICKFRAME) & ~(WS_MAXIMIZEBOX);
WindowHandle = CreateWindowExW(WS_EX_APPWINDOW || WS_EX_TOPMOST * 0,
szWindowClass , szTitle,WindowStyle, WindowX,
WindowY, WindowWidth + (WinBorderWidth) * 1,
WindowHeight + (WinBorderHeight +
WinTitleSize) * 1, 0, 0, WindowINST, NULL);
if (WindowHandle == 0){
return false;
}
ShowWindow(WindowHandle,5);
return true;
};
//Unregisters, releases the DC if needed, and destroys the window.
void WinDestroy()
{
if ((WindowDC > 0) && (ReleaseDC(WindowHandle, WindowDC) == 0)){
WindowDC = 0;
}
if ((!WindowHandle == 0) && (!(DestroyWindow(WindowHandle)))){
WindowHandle = 0;
}
if (!(UnregisterClassW(szWindowClass, WindowINST))){
WindowINST = 0;
}
};
//This function processes any Windows messages we get. Keyboard, OnClose, etc
LRESULT CALLBACK ProcessMessages(HWND__ *hWnd,unsigned int Msg,
WPARAM wParam, LPARAM lParam)
{
switch (Msg){
case WM_CHAR: //This handles most key presses
lastchar=(int)wParam;
switch (lastchar){
case 13: //Reroute ENTER key for compatilbity purposes
lastchar=10;
break;
case 8: //Reroute BACKSPACE key for compatilbity purposes
lastchar=127;
break;
};
break;
case WM_KEYDOWN: //Here we handle non-character input
switch (wParam){
case VK_LEFT:
lastchar = KEY_LEFT;
break;
case VK_RIGHT:
lastchar = KEY_RIGHT;
break;
case VK_UP:
lastchar = KEY_UP;
break;
case VK_DOWN:
lastchar = KEY_DOWN;
break;
default:
break;
};
case WM_ERASEBKGND:
return 1; //We don't want to erase our background
case WM_PAINT: //Pull from our backbuffer, onto the screen
BitBlt(WindowDC, 0, 0, WindowWidth, WindowHeight, backbuffer, 0, 0,SRCCOPY);
ValidateRect(WindowHandle,NULL);
break;
case WM_DESTROY:
exit(0);//A messy exit, but easy way to escape game loop
default://If we didnt process a message, return the default value for it
return DefWindowProcW(hWnd, Msg, wParam, lParam);
};
return 0;
};
//The following 3 methods use mem functions for fast drawing
inline void VertLineDIB(int x, int y, int y2,int thickness, unsigned char color)
{
int j;
for (j=y; j<y2; j++)
memset(&dcbits[x+j*WindowWidth],color,thickness);
};
inline void HorzLineDIB(int x, int y, int x2,int thickness, unsigned char color)
{
int j;
for (j=y; j<y+thickness; j++)
memset(&dcbits[x+j*WindowWidth],color,x2-x);
};
inline void FillRectDIB(int x, int y, int width, int height, unsigned char color)
{
int j;
for (j=y; j<y+height; j++)
memset(&dcbits[x+j*WindowWidth],color,width);
};
void DrawWindow(WINDOW *win)
{
int i,j,drawx,drawy;
char tmp;
for (j=0; j<win->height; j++){
if (win->line[j].touched)
for (i=0; i<win->width; i++){
win->line[j].touched=false;
drawx=((win->x+i)*fontwidth);
drawy=((win->y+j)*fontheight);//-j;
if (((drawx+fontwidth)<=WindowWidth) && ((drawy+fontheight)<=WindowHeight)){
tmp = win->line[j].chars[i];
int FG = win->line[j].FG[i];
int BG = win->line[j].BG[i];
FillRectDIB(drawx,drawy,fontwidth,fontheight,BG);
if ( tmp > 0){
//if (tmp==95){//If your font doesnt draw underscores..uncomment
// HorzLineDIB(drawx,drawy+fontheight-2,drawx+fontwidth,1,FG);
// } else { // all the wa to here
int color = RGB(windowsPalette[FG].rgbRed,windowsPalette[FG].rgbGreen,windowsPalette[FG].rgbBlue);
SetTextColor(backbuffer,color);
ExtTextOut(backbuffer,drawx,drawy,0,NULL,&tmp,1,NULL);
// } //and this line too.
} else if ( tmp < 0 ) {
switch (tmp) {
case -60://box bottom/top side (horizontal line)
HorzLineDIB(drawx,drawy+halfheight,drawx+fontwidth,1,FG);
break;
case -77://box left/right side (vertical line)
VertLineDIB(drawx+halfwidth,drawy,drawy+fontheight,2,FG);
break;
case -38://box top left
HorzLineDIB(drawx+halfwidth,drawy+halfheight,drawx+fontwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy+halfheight,drawy+fontheight,2,FG);
break;
case -65://box top right
HorzLineDIB(drawx,drawy+halfheight,drawx+halfwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy+halfheight,drawy+fontheight,2,FG);
break;
case -39://box bottom right
HorzLineDIB(drawx,drawy+halfheight,drawx+halfwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy,drawy+halfheight+1,2,FG);
break;
case -64://box bottom left
HorzLineDIB(drawx+halfwidth,drawy+halfheight,drawx+fontwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy,drawy+halfheight+1,2,FG);
break;
case -63://box bottom north T (left, right, up)
HorzLineDIB(drawx,drawy+halfheight,drawx+fontwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy,drawy+halfheight,2,FG);
break;
case -61://box bottom east T (up, right, down)
VertLineDIB(drawx+halfwidth,drawy,drawy+fontheight,2,FG);
HorzLineDIB(drawx+halfwidth,drawy+halfheight,drawx+fontwidth,1,FG);
break;
case -62://box bottom south T (left, right, down)
HorzLineDIB(drawx,drawy+halfheight,drawx+fontwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy+halfheight,drawy+fontheight,2,FG);
break;
case -59://box X (left down up right)
HorzLineDIB(drawx,drawy+halfheight,drawx+fontwidth,1,FG);
VertLineDIB(drawx+halfwidth,drawy,drawy+fontheight,2,FG);
break;
case -76://box bottom east T (left, down, up)
VertLineDIB(drawx+halfwidth,drawy,drawy+fontheight,2,FG);
HorzLineDIB(drawx,drawy+halfheight,drawx+halfwidth,1,FG);
break;
default:
// SetTextColor(DC,_windows[w].line[j].chars[i].color.FG);
// TextOut(DC,drawx,drawy,&tmp,1);
break;
}
};//switch (tmp)
}//(tmp < 0)
};//for (i=0;i<_windows[w].width;i++)
};// for (j=0;j<_windows[w].height;j++)
win->draw=false; //We drew the window, mark it as so
};
//Check for any window messages (keypress, paint, mousemove, etc)
void CheckMessages()
{
MSG msg;
while (PeekMessage(&msg, 0 , 0, 0, PM_REMOVE)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
};
//***********************************
//Psuedo-Curses Functions *
//***********************************
//Basic Init, create the font, backbuffer, etc
WINDOW *initscr(void)
{
// _windows = new WINDOW[20]; //initialize all of our variables
BITMAPINFO bmi;
lastchar=-1;
inputdelay=-1;
std::string typeface;
char * typeface_c;
std::ifstream fin;
fin.open("data\\FONTDATA");
if (!fin.is_open()){
MessageBox(WindowHandle, "Failed to open FONTDATA, loading defaults.",
NULL, NULL);
fontheight=16;
fontwidth=8;
} else {
getline(fin, typeface);
typeface_c= new char [typeface.size()+1];
strcpy (typeface_c, typeface.c_str());
fin >> fontwidth;
fin >> fontheight;
if ((fontwidth <= 4) || (fontheight <=4)){
MessageBox(WindowHandle, "Invalid font size specified!",
NULL, NULL);
fontheight=16;
fontwidth=8;
}
}
halfwidth=fontwidth / 2;
halfheight=fontheight / 2;
WindowWidth= (55 + (OPTIONS[OPT_VIEWPORT_X] * 2 + 1)) * fontwidth;
WindowHeight= (OPTIONS[OPT_VIEWPORT_Y] * 2 + 1) *fontheight;
WindowX=(GetSystemMetrics(SM_CXSCREEN) / 2)-WindowWidth/2; //center this
WindowY=(GetSystemMetrics(SM_CYSCREEN) / 2)-WindowHeight/2; //sucker
WinCreate(); //Create the actual window, register it, etc
CheckMessages(); //Let the message queue handle setting up the window
WindowDC = GetDC(WindowHandle);
backbuffer = CreateCompatibleDC(WindowDC);
ZeroMemory(&bmi, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = WindowWidth;
bmi.bmiHeader.biHeight = -WindowHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount=8;
bmi.bmiHeader.biCompression = BI_RGB; //store it in uncompressed bytes
bmi.bmiHeader.biSizeImage = WindowWidth * WindowHeight * 1;
bmi.bmiHeader.biClrUsed=16; //the number of colors in our palette
bmi.bmiHeader.biClrImportant=16; //the number of colors in our palette
backbit = CreateDIBSection(0, &bmi, DIB_RGB_COLORS, (void**)&dcbits, NULL, 0);
DeleteObject(SelectObject(backbuffer, backbit));//load the buffer into DC
int nResults = AddFontResourceExA("data\\termfont",FR_PRIVATE,NULL);
if (nResults>0){
font = CreateFont(fontheight, fontwidth, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, FF_MODERN, typeface_c); //Create our font
} else {
MessageBox(WindowHandle, "Failed to load default font, using FixedSys.",
NULL, NULL);
font = CreateFont(fontheight, fontwidth, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, FF_MODERN, "FixedSys"); //Create our font
}
//FixedSys will be user-changable at some point in time??
SetBkMode(backbuffer, TRANSPARENT);//Transparent font backgrounds
SelectObject(backbuffer, font);//Load our font into the DC
// WindowCount=0;
delete typeface_c;
mainwin = newwin((OPTIONS[OPT_VIEWPORT_Y] * 2 + 1),(55 + (OPTIONS[OPT_VIEWPORT_Y] * 2 + 1)),0,0);
return mainwin; //create the 'stdscr' window and return its ref
};
WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
{
int i,j;
WINDOW *newwindow = new WINDOW;
//newwindow=&_windows[WindowCount];
newwindow->x=begin_x;
newwindow->y=begin_y;
newwindow->width=ncols;
newwindow->height=nlines;
newwindow->inuse=true;
newwindow->draw=false;
newwindow->BG=0;
newwindow->FG=8;
newwindow->cursorx=0;
newwindow->cursory=0;
newwindow->line = new curseline[nlines];
for (j=0; j<nlines; j++)
{
newwindow->line[j].chars= new char[ncols];
newwindow->line[j].FG= new char[ncols];
newwindow->line[j].BG= new char[ncols];
newwindow->line[j].touched=true;//Touch them all !?
for (i=0; i<ncols; i++)
{
newwindow->line[j].chars[i]=0;
newwindow->line[j].FG[i]=0;
newwindow->line[j].BG[i]=0;
}
}
//WindowCount++;
return newwindow;
};
//Deletes the window and marks it as free. Clears it just in case.
int delwin(WINDOW *win)
{
int j;
win->inuse=false;
win->draw=false;
for (j=0; j<win->height; j++){
delete win->line[j].chars;
delete win->line[j].FG;
delete win->line[j].BG;
}
delete win->line;
delete win;
return 1;
};
inline int newline(WINDOW *win){
if (win->cursory < win->height - 1){
win->cursory++;
win->cursorx=0;
return 1;
}
return 0;
};
inline void addedchar(WINDOW *win){
win->cursorx++;
win->line[win->cursory].touched=true;
if (win->cursorx > win->width)
newline(win);
};
//Borders the window with fancy lines!
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
{
int i, j;
int oldx=win->cursorx;//methods below move the cursor, save the value!
int oldy=win->cursory;//methods below move the cursor, save the value!
if (ls>0)
for (j=1; j<win->height-1; j++)
mvwaddch(win, j, 0, 179);
if (rs>0)
for (j=1; j<win->height-1; j++)
mvwaddch(win, j, win->width-1, 179);
if (ts>0)
for (i=1; i<win->width-1; i++)
mvwaddch(win, 0, i, 196);
if (bs>0)
for (i=1; i<win->width-1; i++)
mvwaddch(win, win->height-1, i, 196);
if (tl>0)
mvwaddch(win,0, 0, 218);
if (tr>0)
mvwaddch(win,0, win->width-1, 191);
if (bl>0)
mvwaddch(win,win->height-1, 0, 192);
if (br>0)
mvwaddch(win,win->height-1, win->width-1, 217);
//_windows[w].cursorx=oldx;//methods above move the cursor, put it back
//_windows[w].cursory=oldy;//methods above move the cursor, put it back
wmove(win,oldy,oldx);
return 1;
};
//Refreshes a window, causing it to redraw on top.
int wrefresh(WINDOW *win)
{
if (win==0) win=mainwin;
if (win->draw)
DrawWindow(win);
return 1;
};
//Refreshes window 0 (stdscr), causing it to redraw on top.
int refresh(void)
{
return wrefresh(mainwin);
};
//Not terribly sure how this function is suppose to work,
//but jday helped to figure most of it out
int getch(void)
{
refresh();
InvalidateRect(WindowHandle,NULL,true);
lastchar=ERR;//ERR=-1
if (inputdelay < 0)
{
do
{
CheckMessages();
if (lastchar!=ERR) break;
MsgWaitForMultipleObjects(0, NULL, FALSE, 50, QS_ALLEVENTS);//low cpu wait!
}
while (lastchar==ERR);
}
else if (inputdelay > 0)
{
unsigned long starttime=GetTickCount();
unsigned long endtime;
do
{
CheckMessages(); //MsgWaitForMultipleObjects won't work very good here
endtime=GetTickCount(); //it responds to mouse movement, and WM_PAINT, not good
if (lastchar!=ERR) break;
Sleep(2);
}
while (endtime<(starttime+inputdelay));
}
else
{
CheckMessages();
};
Sleep(25);
return lastchar;
};
//The core printing function, prints characters to the array, and sets colors
inline int printstring(WINDOW *win, char *fmt)
{
int size = strlen(fmt);
int j;
for (j=0; j<size; j++){
if (!(fmt[j]==10)){//check that this isnt a newline char
if (win->cursorx <= win->width - 1 && win->cursory <= win->height - 1) {
win->line[win->cursory].chars[win->cursorx]=fmt[j];
win->line[win->cursory].FG[win->cursorx]=win->FG;
win->line[win->cursory].BG[win->cursorx]=win->BG;
win->line[win->cursory].touched=true;
addedchar(win);
} else
return 0; //if we try and write anything outside the window, abort completely
} else // if the character is a newline, make sure to move down a line
if (newline(win)==0){
return 0;
}
}
win->draw=true;
return 1;
}
//Prints a formatted string to a window at the current cursor, base function
int wprintw(WINDOW *win, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
return printstring(win,printbuf);
};
//Prints a formatted string to a window, moves the cursor
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
if (wmove(win,y,x)==0) return 0;
return printstring(win,printbuf);
};
//Prints a formatted string to window 0 (stdscr), moves the cursor
int mvprintw(int y, int x, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2048];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
if (move(y,x)==0) return 0;
return printstring(mainwin,printbuf);
};
//Prints a formatted string to window 0 (stdscr) at the current cursor
int printw(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
char printbuf[2078];
vsnprintf(printbuf, 2047, fmt, args);
va_end(args);
return printstring(mainwin,printbuf);
};
//erases a window of all text and attributes
int werase(WINDOW *win)
{
int j,i;
for (j=0; j<win->height; j++)
{
for (i=0; i<win->width; i++) {
win->line[j].chars[i]=0;
win->line[j].FG[i]=0;
win->line[j].BG[i]=0;
}
win->line[j].touched=true;
}
win->draw=true;
wmove(win,0,0);
wrefresh(win);
return 1;
};
//erases window 0 (stdscr) of all text and attributes
int erase(void)
{
return werase(mainwin);
};
//pairs up a foreground and background color and puts it into the array of pairs
int init_pair(short pair, short f, short b)
{
colorpairs[pair].FG=f;
colorpairs[pair].BG=b;
return 1;
};
//moves the cursor in a window
int wmove(WINDOW *win, int y, int x)
{
if (x>=win->width)
{return 0;}//FIXES MAP CRASH -> >= vs > only
if (y>=win->height)
{return 0;}// > crashes?
if (y<0)
{return 0;}
if (x<0)
{return 0;}
win->cursorx=x;
win->cursory=y;
return 1;
};
//Clears windows 0 (stdscr) I'm not sure if its suppose to do this?
int clear(void)
{
return wclear(mainwin);
};
//Ends the terminal, destroy everything
int endwin(void)
{
DeleteObject(font);
WinDestroy();
RemoveFontResourceExA("data\\termfont",FR_PRIVATE,NULL);//Unload it
return 1;
};
//adds a character to the window
int mvwaddch(WINDOW *win, int y, int x, const chtype ch)
{
if (wmove(win,y,x)==0) return 0;
return waddch(win, ch);
};
//clears a window
int wclear(WINDOW *win)
{
werase(win);
wrefresh(win);
return 1;
};
//gets the max x of a window (the width)
int getmaxx(WINDOW *win)
{
if (win==0) return mainwin->width; //StdScr
return win->width;
};
//gets the max y of a window (the height)
int getmaxy(WINDOW *win)
{
if (win==0) return mainwin->height; //StdScr
return win->height;
};
inline RGBQUAD BGR(int b, int g, int r)
{
RGBQUAD result;
result.rgbBlue=b; //Blue
result.rgbGreen=g; //Green
result.rgbRed=r; //Red
result.rgbReserved=0;//The Alpha, isnt used, so just set it to 0
return result;
};
int start_color(void)
{
colorpairs=new pairs[50];
windowsPalette=new RGBQUAD[16]; //Colors in the struct are BGR!! not RGB!!
windowsPalette[0]= BGR(0,0,0); //Oddzball - Black
windowsPalette[1]= BGR(0, 0, 255); //Oddzball - Red
windowsPalette[2]= BGR(0,100,0); //Oddzball- Green
windowsPalette[3]= BGR(23,51,92); //Oddzball- Brown??? -Made Darker
windowsPalette[4]= BGR(150, 0, 0); //Oddzball-Blue
windowsPalette[5]= BGR(98, 58, 139); //Oddzball-Pink? -Made Purple
windowsPalette[6]= BGR(180, 150, 0); //Oddzball-Cyan
windowsPalette[7]= BGR(196, 196, 196);//Oddzball-Gray
windowsPalette[8]= BGR(77, 77, 77);//Oddzball-Dark Gray -Made Darker Gray
windowsPalette[9]= BGR(150, 150, 255); //Oddzball-Light Red/Salmon? -Made Lighter red
windowsPalette[10]= BGR(0, 255, 0); //Oddzball-Bright Green
windowsPalette[11]= BGR(0, 255, 255); //Oddzball-Yellow
windowsPalette[12]= BGR(255, 100, 100); //Oddzball-Dark Blue? -Made Light Blue
windowsPalette[13]= BGR(240, 0, 255); //Oddzball- Pink
windowsPalette[14]= BGR(255, 240, 0); //Oddzball -Light Cyan?
windowsPalette[15]= BGR(255, 255, 255);
return SetDIBColorTable(backbuffer, 0, 16, windowsPalette);
};
int keypad(WINDOW *faux, bool bf)
{
return 1;
};
int noecho(void)
{
return 1;
};
int cbreak(void)
{
return 1;
};
int keypad(int faux, bool bf)
{
return 1;
};
int curs_set(int visibility)
{
return 1;
};
int mvaddch(int y, int x, const chtype ch)
{
return mvwaddch(mainwin,y,x,ch);
};
int wattron(WINDOW *win, int attrs)
{
bool isBold = !!(attrs & A_BOLD);
bool isBlink = !!(attrs & A_BLINK);
int pairNumber = (attrs & A_COLOR) >> 17;
win->FG=colorpairs[pairNumber].FG;
win->BG=colorpairs[pairNumber].BG;
if (isBold) win->FG += 8;
if (isBlink) win->BG += 8;
return 1;
};
int wattroff(WINDOW *win, int attrs)
{
win->FG=8; //reset to white
win->BG=0; //reset to black
return 1;
};
int attron(int attrs)
{
return wattron(mainwin, attrs);
};
int attroff(int attrs)
{
return wattroff(mainwin,attrs);
};
int waddch(WINDOW *win, const chtype ch)
{
char charcode;
charcode=ch;
switch (ch){ //LINE_NESW - X for on, O for off
case 4194424: //#define LINE_XOXO 4194424
charcode=179;
break;
case 4194417: //#define LINE_OXOX 4194417
charcode=196;
break;
case 4194413: //#define LINE_XXOO 4194413
charcode=192;
break;
case 4194412: //#define LINE_OXXO 4194412
charcode=218;
break;
case 4194411: //#define LINE_OOXX 4194411
charcode=191;
break;
case 4194410: //#define LINE_XOOX 4194410
charcode=217;
break;
case 4194422: //#define LINE_XXOX 4194422
charcode=193;
break;
case 4194420: //#define LINE_XXXO 4194420
charcode=195;
break;
case 4194421: //#define LINE_XOXX 4194421
charcode=180;
break;
case 4194423: //#define LINE_OXXX 4194423
charcode=194;
break;
case 4194414: //#define LINE_XXXX 4194414
charcode=197;
break;
default:
charcode = (char)ch;
break;
}
int curx=win->cursorx;
int cury=win->cursory;
//if (win2 > -1){
win->line[cury].chars[curx]=charcode;
win->line[cury].FG[curx]=win->FG;
win->line[cury].BG[curx]=win->BG;
win->draw=true;
addedchar(win);
return 1;
// else{
// win2=win2+1;
};
//Move the cursor of windows 0 (stdscr)
int move(int y, int x)
{
return wmove(mainwin,y,x);
};
//Set the amount of time getch waits for input
void timeout(int delay)
{
inputdelay=delay;
};
void set_escdelay(int delay) { } //PORTABILITY, DUMMY FUNCTION
#endif
+154
View File
@@ -0,0 +1,154 @@
#ifndef __CATACURSE__
#define __CATACURSE__
#define _WIN32_WINNT 0x0500
#define WIN32_LEAN_AND_MEAN
//#define VC_EXTRALEAN
#include <windows.h>
#include <stdio.h>
typedef int chtype;
typedef unsigned short attr_t;
typedef unsigned int u_int32_t;
#define __CHARTEXT 0x000000ff /* bits for 8-bit characters */ //<---------not used
#define __NORMAL 0x00000000 /* Added characters are normal. */ //<---------not used
#define __STANDOUT 0x00000100 /* Added characters are standout. */ //<---------not used
#define __UNDERSCORE 0x00000200 /* Added characters are underscored. */ //<---------not used
#define __REVERSE 0x00000400 /* Added characters are reverse //<---------not used
video. */
#define __BLINK 0x00000800 /* Added characters are blinking. */
#define __DIM 0x00001000 /* Added characters are dim. */ //<---------not used
#define __BOLD 0x00002000 /* Added characters are bold. */
#define __BLANK 0x00004000 /* Added characters are blanked. */ //<---------not used
#define __PROTECT 0x00008000 /* Added characters are protected. */ //<---------not used
#define __ALTCHARSET 0x00010000 /* Added characters are ACS */ //<---------not used
#define __COLOR 0x03fe0000 /* Color bits */
#define __ATTRIBUTES 0x03ffff00 /* All 8-bit attribute bits */ //<---------not used
//a pair of colors[] indexes, foreground and background
typedef struct
{
int FG;//foreground index in colors[]
int BG;//foreground index in colors[]
} pairs;
//The curse character struct, just a char, attribute, and color pair
//typedef struct
//{
// char character;//the ascii actual character
// int attrib;//attributes, mostly for A_BLINK and A_BOLD
// pairs color;//pair of foreground/background, indexed into colors[]
//} cursechar;
//Individual lines, so that we can track changed lines
typedef struct{
bool touched;
char *chars;
char *FG;
char *BG;
//cursechar chars [80];
} curseline;
//The curses window struct
typedef struct {
int x;//left side of window
int y;//top side of window
int width;//width of the curses window
int height;//height of the curses window
int FG;//current foreground color from attron
int BG;//current background color from attron
bool inuse;// Does this window actually exist?
bool draw;//Tracks if the window text has been changed
int cursorx;//x location of the cursor
int cursory;//y location of the cursor
curseline *line;
} WINDOW;
#define A_NORMAL __NORMAL
#define A_STANDOUT __STANDOUT
#define A_UNDERLINE __UNDERSCORE
#define A_REVERSE __REVERSE
#define A_BLINK __BLINK
#define A_DIM __DIM
#define A_BOLD __BOLD
#define A_BLANK __BLANK
#define A_PROTECT __PROTECT
#define A_ALTCHARSET __ALTCHARSET
#define A_ATTRIBUTES __ATTRIBUTES
#define A_CHARTEXT __CHARTEXT
#define A_COLOR __COLOR
#define COLOR_BLACK 0x00 //RGB{0,0,0}
#define COLOR_RED 0x01 //RGB{196, 0, 0}
#define COLOR_GREEN 0x02 //RGB{0,196,0}
#define COLOR_YELLOW 0x03 //RGB{196,180,30}
#define COLOR_BLUE 0x04 //RGB{0, 0, 196}
#define COLOR_MAGENTA 0x05 //RGB{196, 0, 180}
#define COLOR_CYAN 0x06 //RGB{0, 170, 200}
#define COLOR_WHITE 0x07 //RGB{196, 196, 196}
#define COLOR_PAIR(n) ((((u_int32_t)n) << 17) & A_COLOR)
//#define PAIR_NUMBER(n) ((((u_int32_t)n) & A_COLOR) >> 17)
#define KEY_MIN 0x101 /* minimum extended key value */ //<---------not used
#define KEY_BREAK 0x101 /* break key */ //<---------not used
#define KEY_DOWN 0x102 /* down arrow */
#define KEY_UP 0x103 /* up arrow */
#define KEY_LEFT 0x104 /* left arrow */
#define KEY_RIGHT 0x105 /* right arrow*/
#define KEY_HOME 0x106 /* home key */ //<---------not used
#define KEY_BACKSPACE 0x107 /* Backspace */ //<---------not used
/* Curses external declarations. */
#define stdscr 0
//WINDOW *stdscr; //Define this for portability, strscr will basically be window[0] anyways
#define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w))
//Curses Functions
#define ERR (-1) /* Error return. */
#define OK (0) /* Success return. */
WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x);
int delwin(WINDOW *win);
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br);
int wrefresh(WINDOW *win);
int refresh(void);
int getch(void);
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
int mvprintw(int y, int x, const char *fmt, ...);
int werase(WINDOW *win);
int start_color(void);
int init_pair(short pair, short f, short b);
int wmove(WINDOW *win, int y, int x);
int clear(void);
int erase(void);
int endwin(void);
int mvwaddch(WINDOW *win, int y, int x, const chtype ch);
int wclear(WINDOW *win);
int wprintw(WINDOW *win, const char *fmt, ...);
WINDOW *initscr(void);
int noecho(void);//PORTABILITY, DUMMY FUNCTION
int cbreak(void);//PORTABILITY, DUMMY FUNCTION
int keypad(WINDOW *faux, bool bf);//PORTABILITY, DUMMY FUNCTION
int curs_set(int visibility);//PORTABILITY, DUMMY FUNCTION
int mvaddch(int y, int x, const chtype ch);
int wattron(WINDOW *win, int attrs);
int wattroff(WINDOW *win, int attrs);
int attron(int attrs);
int attroff(int attrs);
int waddch(WINDOW *win, const chtype ch);
int printw(const char *fmt,...);
int getmaxx(WINDOW *win);
int getmaxy(WINDOW *win);
int move(int y, int x);
void timeout(int delay);//PORTABILITY, DUMMY FUNCTION
void set_escdelay(int delay);//PORTABILITY, DUMMY FUNCTION
//Window Functions, Do not call these outside of catacurse.cpp
void WinDestroy();
bool WinCreate(bool initgl);
void CheckMessages();
int FindWin(WINDOW *wnd);
LRESULT CALLBACK ProcessMessages(HWND__ *hWnd,u_int32_t Msg,WPARAM wParam, LPARAM lParam);
#endif
+41
View File
@@ -0,0 +1,41 @@
ADDITIONS
1.1 Adding an item
1) Edit itype.h. Change the enum item_id and insert a unique identifier for
your new item type. Be sure to put it among similar items.
2) Edit itypedef.cpp. Macros are used for all item types, and they are pretty
self-explanatory. Be ABSOLUTELY sure that you insert the macro at the same
point in the list as you inserted the identifier in item_id!
3) Your item type is now valid, but won't be spawned. If you want it to be
spawned among similar items, edit mapitemsdef.cpp. Find the appropriate
array(s), and insert the identifier for your item (e.g. itm_aspirin). Make
sure it comes in before the NULL at the end of the list.
5) Some items, like tools or food, also take an iuse::function reference.
Edit iuse.h and include the function in the class declaration; then edit
iuse.cpp and define your function. Functions may be shared among different
item types.
1.2 Adding a monster
1) Edit mtype.h. Change the enum mon_id and insert a unique identifier for
your new monster type. Be sure to put it among similar monsters.
2) Edit montypedef.cpp. A macro is used for monsters and it is pretty
straightforward (Any of this ring a bell?). Be ABSOLUTELY sure that you
insert the macro at the same point in the list as your inserted the
identifier in mon_id!
3) Your monster type is now valid, but won't be spawned. If you want it to be
spawned among similar monsters, edit mongroupdef.cpp. Find the appropriate
array, and insert the identifier for your monster (e.g, mon_zombie). Make
sure it comes in before the NULL at the end of the list.
4) If you want your monster to drop items, edit monitemsdef.cpp. Make a new
array for your monster type with all the map item groups it may carry, and a
chance value for each.
5) Your monster may have a special attack, a monattack::function reference.
Edit monattack.h and include the function in the class definition; then
edit monattack.cpp and define your function. Functions may be shared among
different monster types. Be aware that the function should contain a
statement that the monster uses to decide whether or not to use the attack,
and if they do, should reset the monster's attack timer.
7) Just like attacks, some monsters may have a special function called when
they die. This works the same as attacks, but the relevent files are
mondeath.h and mondeath.cpp.
+84
View File
@@ -0,0 +1,84 @@
ENUMS
This is a guide to all the enumerations in the game. If you encounter a flag
you don't understand, grep it here. Likewise if a function accepts an m_flags
tag, grep this document for 'm_flags'. Enums are also labeled with the file in
which they are defined.
Format:
<File with definition> : <Name of enum>
<List of values...>
<Related classes, files, notes...>
----------------------------------------
bionics.h : bionic_id
bio_null, bio_batteries, bio_metabolics, bio_solar, bio_furnace, bio_ethanol,
bio_memory, bio_ears, bio_eye_enhancer, bio_membrane, bio_targeting, bio_gills,
bio_purifier, bio_climate, bio_storage, bio_recycler, bio_digestion, bio_tools,
bio_shock, bio_heat_absorb, bio_carbon, bio_armor_head, bio_armor_torso,
bio_armor_arms, bio_armor_legs, bio_flashlight, bio_night_vision, bio_infrared,
bio_face_mask, bio_ads, bio_ods, bio_scent_mask, 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,
bio_banish, bio_gate_out, bio_gate_in, bio_nightfall, bio_drilldown,
bio_heatwave, bio_lightning, bio_tremor, bio_flashflood, max_bio_good,
bio_dis_shock, bio_dis_acid, bio_drain, bio_noise, bio_power_weakness,
bio_stiff, max_bio
bodypart.h : body_part
color.h : col_attribute
color.h : nc_color
crafting.h : craft_cat
dialogue.h : talk_topic
enums.h : material
event.h : event_type
faction.h : faction_goal
faction.h : faction_job
faction.h : faction_value
game.h : tut_type
itype.h : itype_id
itype.h : item_cat
itype.h : ammotype
itype.h : weapon_flag
itype.h : container_flags
line.h : direction
map.cpp : astar_list
mapdata.h : t_flag
mapdata.h : ter_id
mapdata.h : map_extra
mapdata.h : field_id
mapgen.cpp : room_type
mapitems.h : items_location
mission.h : mission_id
mission.h : mission_origin
mission.h : mission_goal
mongroup.h : moncat_id
monster.h : monster_effect_type
morale.h:enum morale_type
mtype.h : mon_id
mtype.h : m_size
mtype.h : m_flags
npc.h : npc_attitude
npc.h : npc_mission
npc.h : npc_class
npc.h : npc_action
npc.h : npc_need
npc.h : npc_flag
omdata.h : oter_id
omdata.h:// Order MUST match enum oter_id above!
overmap.h:#include "enums.h"
pldata.h : character_type
pldata.h : dis_type
pldata.h : add_type
pldata.h : activity_type
pldata.h : pl_flag
pldata.h : hp_part
skill.h : skill
trap.h : trap_id
tutorial.h : tut_lesson
weather.h : season_type
weather.h : weather_type
+121
View File
@@ -0,0 +1,121 @@
#0 Table of Contents
#0 Table of Contents
#1 Files
#2 special_game class
#3 Functions
#3.0 id()
#3.1 init()
#3.2 per_turn()
#3.3 pre_action()
#3.4 post_action()
#3.5 game_over()
#1 Files
The main file to be concerned with is gamemode.h.
This is where you can insert the class definition for your game mode, and any
enums it might use.
gamemode.cpp is also important, if short. It contains two functions:
special_game_name() returns the name of each special game.
get_special_game() returns a pointer to a special game of the proper
type.
Also of note are tutorial.h (houses text snippets for tutorials), and
tutorial.cpp and defense.cpp, which house code for tutorials and defense games
respectively.
If you add a new game mode, use <mode name>.cpp for its code and <mode name>.h
for any static data associated with it.
#2 special_game class
Every new game mode is a child class of special_game. It may house any private
functions and variables it needs, as well as a constructor, but otherwise the
only public members should be the five functions described below.
The game class holds a pointer to a special_game. The five functions are
called as is appropriate, and thus are cast to the proper function in a child
class.
There is an enum, special_game_id, at the top of gamemode.h. There should be
one entry for every game mode in existance. Add one for yours.
#3 Functions
#3.0 id()
virtual special_game_id id();
Returns the special_game_id assigned to your game mode.
#3.1 init()
virtual void init(game *g);
This is run when your game mode begins.
Some ideas:
>>Change the itype and mtype definitions--remove certain monsters from
the game, make certain items weightless, make baseballs bats uber-powerful
>>Change the recipes. Add new ones, reduce the time crafting takes.
>>Start the game in a special area. Edit the world to be entirely swamp.
#3.2 per_turn()
virtual void per_turn(game *g);
This is run every turn, before anything else is done, including player actions.
Some ideas:
>>Reset the player's thirst, hunger, or fatigue to 0, eliminating these needs
>>Spawn some monsters every 50 turns
>>Make fire burn off faster
>>Add a chance for a space debris to fall
#3.3 pre_action()
virtual void pre_action(game *g, action_id &act);
This is run after a keypress, but before the action is performed. The action
is passed by reference, so you can modify it if you like.
Some ideas:
>>Rewrite the functionality of actions entirely; change the long wait menu,
for example
>>Disallow certain actions by setting act to ACTION_NULL
>>Add a confirmation request to certain actions
>>Make the availability of certain actions dependant on game state
#3.4 post_action()
virtual void post_action(game *g, action_id act);
This is run after an action is performed.
Some ideas:
>>Make certain actions perform faster by rebating movement points
>>Add extra effects to certain actions
>>Display a message upon execution of certain actions
#3.5 game_over()
virtual void game_over(game *g);
This is run when the game is over (player quit or died).
Some ideas:
>>Add a special achievement message, e.g. number of rounds survived
>>Delete any special files created during play
+258
View File
@@ -0,0 +1,258 @@
NOTABLE BUGS:
Factions cannot be saved at all, or they corrupt the master save file
LONG-TERM FEATURES: Stuff I hope to finish in a year
Add a "list nearby items" command, which lists visible items by distance,
name, type, etc. Make it searchable, perhaps allow the player to define
highlighted items which are always moved to the top of the list.
Missions need to have save() and load() functions.
Save NPCs.
Once NPCs are working, populate settlements with them. Make sure that the
code for placing an NPC REALLY WORKS, so that shopkeepers stay where
they're supposed to.
Most settlements belong to a faction; its citizens should too (mostly?)
Factions already get generated and placed in the world, but they have no
effect on it. Once NPCs are working, place faction patrols in the world.
Factions could control radio towers, spewing propaganda or using it to
recruit or start missions
Factions could have projects; exterminating the zombies in a given town,
clearing a particular forest, paving a new road!
Replace the Skills tab in character creation with a Class tab
Classes come with a set of items and the skills needed to use them
e.g. a handgun, ammo, & holster, plus handgun & firearms skills
Cap at one class? Or make it mix-and-match, purchasable with points?
Mix-and-match has the problem of giving the player too many
items to store, unless we start them with a backpack
Maybe add a trait that allows a player to take 2 classes
Classes may also have unique effects upon the game
Priests start with robe & collar and have bonuses when
interacting with religious NPCs
Support terminals larger than 80x25, with the extra space being utilized
Larger terminals should not be given any real advantages over smaller
ones; this means that the visible terrain should not be a larger
area, but rather the extra space could be used for a larger visible
message buffer.
Wrap WINDOW* in a custom class. This will eliminate the possibility of
memory leaks from undeleted temporary windows, and will make porting to
different display libraries (e.g. tiles) much easier.
Eventually a tiles port would be nice. The biggest obstacle to this is the
actual tile graphics; once those are acquired, the only things needing a
rewrite should be output.{h,cpp} and keypress.{h,cpp}
Though mtypedef and itypedef might need to have item glyphs replaced or
enchanced with a link to a image file or part of an image file. Same
with terrain data
Sustained high morale generates "life points" (think of a less stupid name).
These can be spent on a permanent stat increase, crafting a "legendary" item,
or other otherwise unobtainable goodies. This gives the player motivation to
maintain high morale without the artificial-feeling stat bonuses.
High morale now generates XP points, which go into increasing your
skills without the use of books. Maybe these XP points could be used
for the above effects?
GENERAL:
More cultural references!
LOST: Black cloud monster, polar bear, hatches
Resident Evil style zombies
Kinda done with The Thing dog
->The whole game is already a reference to Fallout, let's admit it. So
avoid Fallout references in general, they're too easy.
->Ditto for Half-Life, the game is saturated with HL references
Hellraiser: High level Void monsters could be Cenobites.
Bladerunner: "Androids And The People Who Kill Them"
Steam powered robots (built by post-apoc factions)
Wild Wild West, Miyazaki, Iron Giant, Neverhood, etc. etc.
2001: Get locked in a chamber with an insane computer which you must
disable
What are the other great "insane computer" movies?
Logan's Run: A faction that kills people when they reach 30
Six-String Samurai: Like, all the bad guys. Wind People.
Nausicaa: Radiation-purifying mushroom forests
They Live!: Special glasses that let you see "reality" somehow
Hidden doors? Some people are really disguised monsters?
Indiana Jones: Archeologist class, religious artifacts
The Warriors: Making gangs (basically small factions) with cool themes
and costumes would be nice.
Dr Strangelove: Mineshafts converted into bunkers; quotes
Ghostbusters: Weapons! Maybe ghosts.
OTHERS: Escape From New York,
Classes (see above under LONG-TERM) could draw from pop culture heros
Archeologist: Indiana Jones (a la nethack)
Road Warrior: Mad Max
Pushable furniture; push dressers, fridges, etc. in front of doors
Configurable options:
Colors (e.g. highlight color, currently blue)
Also ncurses options, e.g. A_BLINK support--not all terminals
can display bright background colors, so black-on-dark-gray
will just show up as a blank tile. We should have an option
to turn off bright background colors.
Run Mode behavior / Run Mode auto-on
Auto-drop food containers (empty soda cans, etc)
Fix eating/fullness; right now only overeating when Full is a risk of puking,
which comes too quickly and feels unfair. Thirst (and small amounts of
nutrition) never causes puking, which allows players to exploit cola by
drinking 10 at once.
Possible solutions:
>Two levels; "Full" and "Overfull"; Only when Overfull is puking a risk
>Three levels, hunger, thirst, and stomach fullness
Make cooking a rotten item result in a rotten item
Or, average the original item's birthday with the current turn, to allow
for some freshening.
When picking items up, highlight useful ones in particular colors
DONE Red: Ammo for a gun you have, or vice versa
Green: Important medical (1st aid, bandages, painkiller, etc.)
Possibly context-dependant? Painkillers if you're in pain, etc.
Blue: Items you can craft with
Purple: User-defined criteria
Food canning. We already have tin cans, add an item "canning kit"
Or make it a craft; canning requires boiling water + equipment
Highlight or color-invert monsters that're fleeing; also make indifference
visually obvious in some way (change glyph foreground color?)
Audit how we're using screen space in the data window
Maybe make a special data structure for how the data section is used and
layed out; easier to audit, player configurable
Make swimming more interesting
Items at the bottoms of rivers, only discoverable by diving underwater
Entrances to special dungeons;
Sewage treatment plant?
Underwater monster lair?
Water-dwelling monsters. Probably rare, because for unskilled swimmers
almost any monsters would be deadly
Automatically drop items if our volume capacity suddenly drops (e.g. from a
torn-open backpack)
Add a warning in the data screen if volume carried is over capacity
Allow basic movement while reloading, or make it possible to resume
interrupted reloading
Make computer usage more widespread and more convincing. Possibly add a
class for computer networks; an area on the overmap, protected by a password.
Once you hack the password, you gain access to certain commands on computers
found inside that area.
Make computer functions use skills other than sk_computer. For
instance, the computers in hospitals should use sk_firstaid
Desires, as in The Sims 3. These could be their own class, or a special
type of mission; added more or less randomly, they include things like "eat an
orange," "read a novel" and other banal actions, and reward the player with a
larger-than-usual morale boost.
ITEMS / BIONICS:
Book: Bible; high morale boost if you have the Religious trait
Canning kit (see canning under GENERAL)
Fire extinguisher bionic
Make this, and real fire extinguishers, more effective
Road maps, found in gas stations; using it adds some map data.
MAP:
Hatch (see cultural references, above)
Terrain tiles, such as heavy doors, which require the help of an extra NPC
or two to open (or very high strength)
CHARACTER CREATION:
Illiterate makes read speed show up as "N/A" on stats tab
Glass Jaw makes Head HP show up on stats tab, alongside Base HP
Show skill erosion rate on stats tab (modded by Forgetful)
Greater transparency for skill comprehension (at level 0, 4, 8, etc.)
Show food consumption rate? (Modified by Light Eater)
Should high Strength increase this rate?
Save our position in both Traits lists, even when changing tabs
Display player::miss_penalty() in Stats tab (Under Str and/or Dex)
Modified by Dex, by Str with heavy weapons, and the Deft trait
Show penalty under various circumstances? Unarmed, crowbar, chainsaw etc
Make skill levels affect values in Stats tab?
Bottom 3 lines could be a color legend, blue=from stat, green=from skill
Make Drunken Master bonus appear in Stats tab?
Make the Description tab more interesting? Maybe hair color, etc.
Any effect on gameplay? Probably not.
Make the effect of gender on gameplay transparent
List specific effects on gameplay mechanics in the Skills tab, comparable to
those listed in the Stats tab.
TRAITS:
More Schizophrenic effects
Make auditory hallucinations more realistic/varied
Balance/fix/remove Jittery
More obvious Wool Allergy text (remind the player that they're allergic)
Wool Allergy prevents eating wool (with Internal Furnace bionic)
Make Fast Learner affect skill comprehension directly
Rewrite description
Android encourages start-scumming. Maybe make it a static set, or present
the player with a few different options?
Make Android a class instead? (see above under LONG-TERM)
CRAFTING:
Expand cooking; much more morale-boosting (i.e. tasty) recipes
Fruit drying; remove quench and some nutrition, but won't go bad
KEYBINDINGS/INPUT:
Configurable bindings!
This ties into options in general.
Make ctrl+movement equivalent to 'e'+movement
"Repeat last command" command
Macros--are they necessary or useful at all?
+188
View File
@@ -0,0 +1,188 @@
#include "color.h"
#define HILIGHT COLOR_BLUE
void init_colors()
{
start_color();
init_pair( 1, COLOR_WHITE, COLOR_BLACK );
init_pair( 2, COLOR_RED, COLOR_BLACK );
init_pair( 3, COLOR_GREEN, COLOR_BLACK );
init_pair( 4, COLOR_BLUE, COLOR_BLACK );
init_pair( 5, COLOR_CYAN, COLOR_BLACK );
init_pair( 6, COLOR_MAGENTA, COLOR_BLACK );
init_pair( 7, COLOR_YELLOW, COLOR_BLACK );
// Inverted Colors
init_pair( 8, COLOR_BLACK, COLOR_WHITE );
init_pair( 9, COLOR_BLACK, COLOR_RED );
init_pair(10, COLOR_BLACK, COLOR_GREEN );
init_pair(11, COLOR_BLACK, COLOR_BLUE );
init_pair(12, COLOR_BLACK, COLOR_CYAN );
init_pair(13, COLOR_BLACK, COLOR_MAGENTA);
init_pair(14, COLOR_BLACK, COLOR_YELLOW );
// Highlighted - blue background
init_pair(15, COLOR_WHITE, HILIGHT);
init_pair(16, COLOR_RED, HILIGHT);
init_pair(17, COLOR_GREEN, HILIGHT);
init_pair(18, COLOR_BLUE, HILIGHT);
init_pair(19, COLOR_CYAN, HILIGHT);
init_pair(20, COLOR_BLACK, HILIGHT);
init_pair(21, COLOR_MAGENTA, HILIGHT);
init_pair(22, COLOR_YELLOW, HILIGHT);
// Red background - for monsters on fire
init_pair(23, COLOR_WHITE, COLOR_RED);
init_pair(24, COLOR_RED, COLOR_RED);
init_pair(25, COLOR_GREEN, COLOR_RED);
init_pair(26, COLOR_BLUE, COLOR_RED);
init_pair(27, COLOR_CYAN, COLOR_RED);
init_pair(28, COLOR_MAGENTA, COLOR_RED);
init_pair(29, COLOR_YELLOW, COLOR_RED);
init_pair(30, COLOR_BLACK, COLOR_BLACK );
}
int color_to_int(nc_color col)
{
switch (col) {
case c_black : return 0;
case c_white : return 1;
case c_ltgray : return 2;
case c_dkgray : return 3;
case c_red : return 4;
case c_green : return 5;
case c_blue : return 6;
case c_cyan : return 7;
case c_magenta: return 8;
case c_brown : return 9;
case c_ltred : return 10;
case c_ltgreen: return 11;
case c_ltblue : return 12;
case c_ltcyan : return 13;
case c_pink : return 14;
case c_yellow : return 15;
case h_black : return 16;
case h_white : return 17;
case h_ltgray : return 18;
case h_dkgray : return 19;
case h_red : return 20;
case h_green : return 21;
case h_cyan : return 23;
case h_magenta: return 24;
case h_brown : return 25;
case h_ltred : return 26;
case h_ltgreen: return 27;
case h_ltblue : return 28;
case h_ltcyan : return 29;
case h_pink : return 30;
case h_yellow : return 31;
case i_white : return 33;
case i_ltgray : return 34;
case i_dkgray : return 35;
case i_red : return 36;
case i_green : return 37;
case i_blue : return 38;
case i_cyan : return 39;
case i_magenta: return 40;
case i_brown : return 41;
case i_ltred : return 42;
case i_ltgreen: return 43;
case i_ltblue : return 44;
case i_ltcyan : return 45;
case i_pink : return 46;
case i_yellow : return 47;
case c_white_red : return 48;
case c_ltgray_red : return 49;
case c_green_red : return 52;
case c_blue_red : return 53;
case c_cyan_red : return 54;
case c_magenta_red: return 55;
case c_brown_red : return 56;
case c_ltred_red : return 57;
case c_ltgreen_red: return 58;
case c_ltblue_red : return 59;
case c_ltcyan_red : return 60;
case c_pink_red : return 61;
case c_yellow_red : return 62;
}
return 0;
}
nc_color int_to_color(int key)
{
switch (key) {
case 0: return c_black ;
case 1: return c_white ;
case 2: return c_ltgray ;
case 3: return c_dkgray ;
case 4: return c_red ;
case 5: return c_green ;
case 6: return c_blue ;
case 7: return c_cyan ;
case 8: return c_magenta;
case 9: return c_brown ;
case 10: return c_ltred ;
case 11: return c_ltgreen;
case 12: return c_ltblue ;
case 13: return c_ltcyan ;
case 14: return c_pink ;
case 15: return c_yellow ;
case 16: return h_black ;
case 17: return h_white ;
case 18: return h_ltgray ;
case 19: return h_dkgray ;
case 20: return h_red ;
case 21: return h_green ;
case 22: return h_blue ;
case 23: return h_cyan ;
case 24: return h_magenta;
case 25: return h_brown ;
case 26: return h_ltred ;
case 27: return h_ltgreen;
case 28: return h_ltblue ;
case 29: return h_ltcyan ;
case 30: return h_pink ;
case 31: return h_yellow ;
case 32: return i_black ;
case 33: return i_white ;
case 34: return i_ltgray ;
case 35: return i_dkgray ;
case 36: return i_red ;
case 37: return i_green ;
case 38: return i_blue ;
case 39: return i_cyan ;
case 40: return i_magenta;
case 41: return i_brown ;
case 42: return i_ltred ;
case 43: return i_ltgreen;
case 44: return i_ltblue ;
case 45: return i_ltcyan ;
case 46: return i_pink ;
case 47: return i_yellow ;
case 48: return c_white_red ;
case 49: return c_ltgray_red ;
case 50: return c_dkgray_red ;
case 51: return c_red_red ;
case 52: return c_green_red ;
case 53: return c_blue_red ;
case 54: return c_cyan_red ;
case 55: return c_magenta_red;
case 56: return c_brown_red ;
case 57: return c_ltred_red ;
case 58: return c_ltgreen_red;
case 59: return c_ltblue_red ;
case 60: return c_ltcyan_red ;
case 61: return c_pink_red ;
case 62: return c_yellow_red ;
}
return c_black;
}
+29 -7
View File
@@ -1,11 +1,13 @@
#ifndef _COLOR_H_
#define _COLOR_H
#include <ncurses.h>
#ifndef _COLOR_LIST_
#define _COLOR_LIST_
#include "cursesdef.h"
void init_colors();
enum col_attribute {
WA_NULL = 0,
HI = 1,
@@ -13,10 +15,10 @@ INV = 2
};
enum nc_color {
c_black = COLOR_PAIR(23),
c_black = COLOR_PAIR(30),
c_white = COLOR_PAIR(1) | A_BOLD,
c_ltgray = COLOR_PAIR(1),
c_dkgray = COLOR_PAIR(23) | A_BOLD,
c_dkgray = COLOR_PAIR(30) | A_BOLD,
c_red = COLOR_PAIR(2),
c_green = COLOR_PAIR(3),
c_blue = COLOR_PAIR(4),
@@ -47,10 +49,10 @@ h_ltcyan = COLOR_PAIR(19) | A_BOLD,
h_pink = COLOR_PAIR(21) | A_BOLD,
h_yellow = COLOR_PAIR(22) | A_BOLD,
i_black = COLOR_PAIR(23),
i_black = COLOR_PAIR(30),
i_white = COLOR_PAIR(8) | A_BLINK,
i_ltgray = COLOR_PAIR(8),
i_dkgray = COLOR_PAIR(23) | A_BLINK,
i_dkgray = COLOR_PAIR(30) | A_BLINK,
i_red = COLOR_PAIR(9),
i_green = COLOR_PAIR(10),
i_blue = COLOR_PAIR(11),
@@ -62,9 +64,29 @@ i_ltgreen = COLOR_PAIR(10) | A_BLINK,
i_ltblue = COLOR_PAIR(11) | A_BLINK,
i_ltcyan = COLOR_PAIR(12) | A_BLINK,
i_pink = COLOR_PAIR(13) | A_BLINK,
i_yellow = COLOR_PAIR(14) | A_BLINK
i_yellow = COLOR_PAIR(14) | A_BLINK,
c_white_red = COLOR_PAIR(23) | A_BOLD,
c_ltgray_red = COLOR_PAIR(23),
c_dkgray_red = COLOR_PAIR(9),
c_red_red = COLOR_PAIR(9),
c_green_red = COLOR_PAIR(25),
c_blue_red = COLOR_PAIR(26),
c_cyan_red = COLOR_PAIR(27),
c_magenta_red = COLOR_PAIR(28),
c_brown_red = COLOR_PAIR(29),
c_ltred_red = COLOR_PAIR(24) | A_BOLD,
c_ltgreen_red = COLOR_PAIR(25) | A_BOLD,
c_ltblue_red = COLOR_PAIR(26) | A_BOLD,
c_ltcyan_red = COLOR_PAIR(27) | A_BOLD,
c_pink_red = COLOR_PAIR(28) | A_BOLD,
c_yellow_red = COLOR_PAIR(29) | A_BOLD
};
int color_to_int(nc_color col);
nc_color int_to_color(int key);
void setattr(nc_color &col, col_attribute attr);
#endif
+909
View File
@@ -0,0 +1,909 @@
#include "computer.h"
#include "game.h"
#include "monster.h"
#include "overmap.h"
#include "output.h"
#include <fstream>
#include <string>
#include <sstream>
computer::computer()
{
security = 0;
name = DEFAULT_COMPUTER_NAME;
w_terminal = NULL;
mission_id = -1;
}
computer::computer(std::string Name, int Security)
{
security = Security;
name = Name;
w_terminal = NULL;
mission_id = -1;
}
computer::~computer()
{
if (w_terminal != NULL)
delwin(w_terminal);
}
computer& computer::operator=(const computer &rhs)
{
security = rhs.security;
name = rhs.name;
mission_id = rhs.mission_id;
options.clear();
for (int i = 0; i < rhs.options.size(); i++)
options.push_back(rhs.options[i]);
failures.clear();
for (int i = 0; i < rhs.failures.size(); i++)
failures.push_back(rhs.failures[i]);
w_terminal = NULL;
return *this;
}
void computer::set_security(int Security)
{
security = Security;
}
void computer::add_option(std::string opt_name, computer_action action,
int Security)
{
options.push_back(computer_option(opt_name, action, Security));
}
void computer::add_failure(computer_failure failure)
{
failures.push_back(failure);
}
void computer::shutdown_terminal()
{
werase(w_terminal);
delwin(w_terminal);
w_terminal = NULL;
}
void computer::use(game *g)
{
if (w_terminal == NULL)
w_terminal = newwin(25, 80, 0, 0);
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
print_line("Logging into %s...", name.c_str());
if (security > 0) {
print_error("ERROR! Access denied!");
switch (query_ynq("Bypass security?")) {
case 'q':
case 'Q':
shutdown_terminal();
return;
case 'n':
case 'N':
print_line("Shutting down... press any key.");
getch();
shutdown_terminal();
return;
case 'y':
case 'Y':
if (!hack_attempt(&(g->u))) {
if (failures.size() == 0) {
print_line("Maximum login attempts exceeded. Press any key...");
getch();
shutdown_terminal();
return;
}
activate_random_failure(g);
shutdown_terminal();
return;
} else { // Successful hack attempt
security = 0;
print_line("Login successful. Press any key...");
getch();
reset_terminal();
}
}
} else { // No security
print_line("Login successful. Press any key...");
getch();
reset_terminal();
}
// Main computer loop
bool done = false; // Are we done using the computer?
do {
//reset_terminal();
print_line("");
print_line("%s - Root Menu", name.c_str());
for (int i = 0; i < options.size(); i++)
print_line("%d - %s", i + 1, options[i].name.c_str());
print_line("Q - Quit and shut down");
print_line("");
char ch;
do
ch = getch();
while (ch != 'q' && ch != 'Q' && (ch < '1' || ch - '1' >= options.size()));
if (ch == 'q' || ch == 'Q')
done = true;
else { // We selected an option other than quit.
ch -= '1'; // So '1' -> 0; index in options.size()
computer_option current = options[ch];
if (current.security > 0) {
print_error("Password required.");
if (query_bool("Hack into system?")) {
if (!hack_attempt(&(g->u), current.security)) {
activate_random_failure(g);
shutdown_terminal();
return;
} else {
activate_function(g, current.action);
reset_terminal();
}
}
} else // No need to hack, just activate
activate_function(g, current.action);
} // Done processing a selected option.
} while (!done); // Done with main terminal loop
shutdown_terminal(); // This should have been done by now, but just in case.
}
bool computer::hack_attempt(player *p, int Security)
{
if (Security == -1)
Security = security; // Set to main system security if no value passed
p->practice("computer", 5 + Security * 2);
int player_roll = p->skillLevel("computer").level();
if (p->int_cur < 8 && one_in(2))
player_roll -= rng(0, 8 - p->int_cur);
else if (p->int_cur > 8 && one_in(3))
player_roll += rng(0, p->int_cur - 8);
return (dice(player_roll, 6) >= dice(Security, 6));
}
std::string computer::save_data()
{
std::stringstream data;
std::string savename = name; // Replace " " with "_"
size_t found = savename.find(" ");
while (found != std::string::npos) {
savename.replace(found, 1, "_");
found = savename.find(" ");
}
data << savename << " " << security << " " << mission_id << " " <<
options.size() << " ";
for (int i = 0; i < options.size(); i++) {
savename = options[i].name;
found = savename.find(" ");
while (found != std::string::npos) {
savename.replace(found, 1, "_");
found = savename.find(" ");
}
data << savename << " " << int(options[i].action) << " " <<
options[i].security << " ";
}
data << failures.size() << " ";
for (int i = 0; i < failures.size(); i++)
data << int(failures[i]) << " ";
return data.str();
}
void computer::load_data(std::string data)
{
options.clear();
failures.clear();
std::stringstream dump;
std::string buffer;
dump << data;
// Pull in name and security
dump >> name >> security >> mission_id;
size_t found = name.find("_");
while (found != std::string::npos) {
name.replace(found, 1, " ");
found = name.find("_");
}
// Pull in options
int optsize;
dump >> optsize;
for (int n = 0; n < optsize; n++) {
std::string tmpname;
int tmpaction, tmpsec;
dump >> tmpname >> tmpaction >> tmpsec;
size_t found = tmpname.find("_");
while (found != std::string::npos) {
tmpname.replace(found, 1, " ");
found = tmpname.find("_");
}
add_option(tmpname, computer_action(tmpaction), tmpsec);
}
// Pull in failures
int failsize, tmpfail;
dump >> failsize;
for (int n = 0; n < failsize; n++) {
dump >> tmpfail;
failures.push_back(computer_failure(tmpfail));
}
}
void computer::activate_function(game *g, computer_action action)
{
switch (action) {
case COMPACT_NULL:
break; // Why would this be called?
case COMPACT_OPEN:
g->m.translate(t_door_metal_locked, t_floor);
print_line("Doors opened.");
break;
case COMPACT_SAMPLE:
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) {
for (int x1 = x - 1; x1 <= x + 1; x1++) {
for (int y1 = y - 1; y1 <= y + 1; y1++ ) {
if (g->m.ter(x1, y1) == t_counter) {
bool found_item = false;
for (int i = 0; i < g->m.i_at(x1, y1).size(); i++) {
item *it = &(g->m.i_at(x1, y1)[i]);
if (it->is_container() && it->contents.empty()) {
it->put_in( item(g->itypes[itm_sewage], g->turn) );
found_item = true;
}
}
if (!found_item) {
item sewage(g->itypes[itm_sewage], g->turn);
g->m.add_item(x1, y1, sewage);
}
}
}
}
}
}
}
break;
case COMPACT_RELEASE:
g->sound(g->u.posx, g->u.posy, 40, "An alarm sounds!");
g->m.translate(t_reinforced_glass_h, t_floor);
g->m.translate(t_reinforced_glass_v, t_floor);
print_line("Containment shields opened.");
break;
case COMPACT_TERMINATE:
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
int mondex = g->mon_at(x, y);
if (mondex != -1 &&
((g->m.ter(x, y - 1) == t_reinforced_glass_h &&
g->m.ter(x, y + 1) == t_wall_h) ||
(g->m.ter(x, y + 1) == t_reinforced_glass_h &&
g->m.ter(x, y - 1) == t_wall_h)))
g->kill_mon(mondex, true);
}
}
print_line("Subjects terminated.");
break;
case COMPACT_PORTAL:
for (int i = 0; i < SEEX * MAPSIZE; i++) {
for (int j = 0; j < SEEY * MAPSIZE; j++) {
int numtowers = 0;
for (int xt = i - 2; xt <= i + 2; xt++) {
for (int yt = j - 2; yt <= j + 2; yt++) {
if (g->m.ter(xt, yt) == t_radio_tower)
numtowers++;
}
}
if (numtowers == 4) {
if (g->m.tr_at(i, j) == tr_portal)
g->m.tr_at(i, j) = tr_null;
else
g->m.add_trap(i, j, tr_portal);
}
}
}
break;
case COMPACT_CASCADE: {
if (!query_bool("WARNING: Resonance cascade carries severe risk! Continue?"))
return;
std::vector<point> cascade_points;
for (int i = g->u.posx - 10; i <= g->u.posx + 10; i++) {
for (int j = g->u.posy - 10; j <= g->u.posy + 10; j++) {
if (g->m.ter(i, j) == t_radio_tower)
cascade_points.push_back(point(i, j));
}
}
if (cascade_points.size() == 0)
g->resonance_cascade(g->u.posx, g->u.posy);
else {
point p = cascade_points[rng(0, cascade_points.size() - 1)];
g->resonance_cascade(p.x, p.y);
}
} break;
case COMPACT_RESEARCH: {
int lines = 0, notes = 0;
std::string log, tmp;
int ch;
std::ifstream fin;
fin.open("data/LAB_NOTES");
if (!fin.is_open()) {
debugmsg("Couldn't open ./data/LAB_NOTES for reading");
return;
}
while (fin.good()) {
ch = fin.get();
if (ch == '%')
notes++;
}
while (lines < 10) {
fin.clear();
fin.seekg(0, std::ios::beg);
fin.clear();
int choice = rng(1, notes);
while (choice > 0) {
getline(fin, tmp);
if (tmp.find_first_of('%') == 0)
choice--;
}
getline(fin, tmp);
do {
lines++;
if (lines < 15 && tmp.find_first_of('%') != 0) {
log.append(tmp);
log.append("\n");
}
} while(tmp.find_first_of('%') != 0 && getline(fin, tmp));
}
print_line(" %s", log.c_str());
print_line("Press any key...");
getch();
} break;
case COMPACT_MAPS: {
int minx = int((g->levx + int(MAPSIZE / 2)) / 2) - 40;
int maxx = int((g->levx + int(MAPSIZE / 2)) / 2) + 40;
int miny = int((g->levy + int(MAPSIZE / 2)) / 2) - 40;
int maxy = int((g->levy + int(MAPSIZE / 2)) / 2) + 40;
if (minx < 0) minx = 0;
if (maxx >= OMAPX) maxx = OMAPX - 1;
if (miny < 0) miny = 0;
if (maxy >= OMAPY) maxy = OMAPY - 1;
overmap tmp(g, g->cur_om.posx, g->cur_om.posy, 0);
for (int i = minx; i <= maxx; i++) {
for (int j = miny; j <= maxy; j++)
tmp.seen(i, j) = true;
}
tmp.save(g->u.name, g->cur_om.posx, g->cur_om.posy, 0);
print_line("Surface map data downloaded.");
} break;
case COMPACT_MAP_SEWER: {
int minx = int((g->levx + int(MAPSIZE / 2)) / 2) - 60;
int maxx = int((g->levx + int(MAPSIZE / 2)) / 2) + 60;
int miny = int((g->levy + int(MAPSIZE / 2)) / 2) - 60;
int maxy = int((g->levy + int(MAPSIZE / 2)) / 2) + 60;
if (minx < 0) minx = 0;
if (maxx >= OMAPX) maxx = OMAPX - 1;
if (miny < 0) miny = 0;
if (maxy >= OMAPY) maxy = OMAPY - 1;
for (int i = minx; i <= maxx; i++) {
for (int j = miny; j <= maxy; j++)
if ((g->cur_om.ter(i, j) >= ot_sewer_ns &&
g->cur_om.ter(i, j) <= ot_sewer_nesw) ||
(g->cur_om.ter(i, j) >= ot_sewage_treatment &&
g->cur_om.ter(i, j) <= ot_sewage_treatment_under))
g->cur_om.seen(i, j) = true;
}
print_line("Sewage map data downloaded.");
} break;
case COMPACT_MISS_LAUNCH: {
overmap tmp_om(g, g->cur_om.posx, g->cur_om.posy, 0);
// Target Acquisition.
point target = tmp_om.choose_point(g);
if (target.x == -1) {
print_line("Launch canceled.");
return;
}
// Figure out where the glass wall is...
int wall_spot = 0;
for (int i = g->u.posx; i < g->u.posx + SEEX * 2 && wall_spot == 0; i++) {
if (g->m.ter(i, 10) == t_wall_glass_v)
wall_spot = i;
}
// ...and put radioactive to the right of it
for (int i = wall_spot + 1; i < SEEX * 2 - 1; i++) {
for (int j = 1; j < SEEY * 2 - 1; j++) {
if (one_in(3))
g->m.add_field(NULL, i, j, fd_nuke_gas, 3);
}
}
// For each level between here and the surface, remove the missile
for (int level = g->cur_om.posz; level < 0; level++) {
tmp_om = g->cur_om;
g->cur_om = overmap(g, tmp_om.posx, tmp_om.posy, level);
tinymap tmpmap(&g->itypes, &g->mapitems, &g->traps);
tmpmap.load(g, g->levx, g->levy, false);
tmpmap.translate(t_missile, t_hole);
tmpmap.save(&tmp_om, g->turn, g->levx, g->levy);
}
g->cur_om = tmp_om;
for (int x = target.x - 2; x <= target.x + 2; x++) {
for (int y = target.y - 2; y <= target.y + 2; y++)
g->nuke(x, y);
}
} break;
case COMPACT_MISS_DISARM: // TODO: This!
break;
case COMPACT_LIST_BIONICS: {
std::vector<std::string> names;
int more = 0;
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y)[i].is_bionic()) {
if (names.size() < 9)
names.push_back(g->m.i_at(x, y)[i].tname());
else
more++;
}
}
}
}
for (int i = 0; i < names.size(); i++)
print_line(names[i].c_str());
if (more > 0)
print_line("%d OTHERS FOUND...");
} 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;
}
}
print_line("Elevator activated.");
break;
case COMPACT_AMIGARA_LOG: // TODO: This is static, move to data file?
print_line("NEPower Mine(%d:%d) Log", g->levx, g->levy);
print_line("\
ENTRY 47:\n\
Our normal mining routine has unearthed a hollow chamber. This would not be\n\
out of the ordinary, save for the odd, perfectly vertical faultline found.\n\
This faultline has several odd concavities in it which have the more\n\
superstitious crew members alarmed; they seem to be of human origin.\n\
\n\
ENTRY 48:\n\
The concavities are between 10 and 20 feet tall, and run the length of the\n\
faultline. Each one is vaguely human in shape, but with the proportions of\n\
the limbs, neck and head greatly distended, all twisted and curled in on\n\
themselves.\n");
if (!query_bool("Continue reading?"))
return;
reset_terminal();
print_line("NEPower Mine(%d:%d) Log", g->levx, g->levy);
print_line("\
ENTRY 49:\n\
We've stopped mining operations in this area, obviously, until archaeologists\n\
have the chance to inspect the area. This is going to set our schedule back\n\
by at least a week. This stupid artifact-preservation law has been in place\n\
for 50 years, and hasn't even been up for termination despite the fact that\n\
these mining operations are the backbone of our economy.\n\
\n\
ENTRY 52:\n\
Still waiting on the archaeologists. We've done a little light insepction of\n\
the faultline; our sounding equipment is insufficient to measure the depth of\n\
the concavities. The equipment is rated at 15 miles depth, but it isn't made\n\
for such narrow tunnels, so it's hard to say exactly how far back they go.\n");
if (!query_bool("Continue reading?"))
return;
reset_terminal();
print_line("NEPower Mine(%d:%d) Log", g->levx, g->levy);
print_line("\
ENTRY 54:\n\
I noticed a couple of the guys down in the chamber with a chisel, breaking\n\
off a piece of the sheer wall. I'm looking the other way. It's not like\n\
the eggheads are going to notice a little piece missing. Fuck em.\n\
\n\
ENTRY 55:\n\
Well, the archaeologists are down there now with a couple of the boys as\n\
guides. They're hardly Indiana Jones types; I doubt they been below 20\n\
feet. I hate taking guys off assignment just to babysit the scientists, but\n\
if they get hurt we'll be shut down for god knows how long.\n\
\n\
ENTRY 58:\n\
They're bringing in ANOTHER CREW? Christ, it's just some cave carvings! I\n\
know that's sort of a big deal, but come on, these guys can't handle it?\n");
if (!query_bool("Continue reading?"))
return;
reset_terminal();
for (int i = 0; i < 10; i++)
print_gibberish_line();
print_line("");
print_line("");
print_line("");
print_line("AMIGARA PROJECT");
print_line("");
print_line("");
if (!query_bool("Continue reading?"))
return;
reset_terminal();
print_line("\
SITE %d%d%d%d%d\n\
PERTINANT FOREMAN LOGS WILL BE PREPENDED TO NOTES",
g->cur_om.posx, g->cur_om.posy, g->levx, g->levy, abs(g->levz));
print_line("\n\
MINE OPERATIONS SUSPENDED; CONTROL TRANSFERRED TO AMIGARA PROJECT UNDER\n\
IMPERATIVE 2:07B\n\
FAULTLINE SOUNDING HAS PLACED DEPTH AT 30.09 KM\n\
DAMAGE TO FAULTLINE DISCOVERED; NEPOWER MINE CREW PLACED UNDER ARREST FOR\n\
VIOLATION OF REGULATION 87.08 AND TRANSFERRED TO LAB 89-C FOR USE AS\n\
SUBJECTS\n\
QUALITIY OF FAULTLINE NOT COMPROMISED\n\
INITIATING STANDARD TREMOR TEST...");
print_gibberish_line();
print_gibberish_line();
print_line("");
print_error("FILE CORRUPTED, PRESS ANY KEY...");
getch();
reset_terminal();
break;
case COMPACT_AMIGARA_START:
g->add_event(EVENT_AMIGARA, int(g->turn) + 10, 0, 0, 0);
if (!g->u.has_artifact_with(AEP_PSYSHIELD))
g->u.add_disease(DI_AMIGARA, 20, g);
break;
case COMPACT_STEMCELL_TREATMENT:
g->u.add_disease(DI_STEMCELL_TREATMENT, 120, g);
print_line("The machine injects your eyeball with the solution \n\
of pureed bone & LSD.");
g->u.pain += rng(40,90);
break;
case COMPACT_DOWNLOAD_SOFTWARE:
if (!g->u.has_amount(itm_usb_drive, 1))
print_error("USB drive required!");
else {
mission *miss = g->find_mission(mission_id);
if (miss == NULL) {
debugmsg("Computer couldn't find its mission!");
return;
}
item software(g->itypes[miss->item_id], 0);
software.mission_id = mission_id;
int index = g->u.pick_usb();
g->u.inv[index].contents.clear();
g->u.inv[index].put_in(software);
print_line("Software downloaded.");
}
break;
case COMPACT_BLOOD_ANAL:
for (int x = g->u.posx - 2; x <= g->u.posx + 2; x++) {
for (int y = g->u.posy - 2; y <= g->u.posy + 2; y++) {
if (g->m.ter(x, y) == t_centrifuge) {
if (g->m.i_at(x, y).empty())
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)
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)
print_error("ERROR: Please only use blood samples.");
else { // Success!
item *blood = &(g->m.i_at(x, y)[0].contents[0]);
if (blood->corpse == NULL || blood->corpse->id == mon_null)
print_line("Result: Human blood, no pathogens found.");
else if (blood->corpse->sym == 'Z') {
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))
print_error("USB drive required!");
else {
item software(g->itypes[itm_software_blood_data], 0);
int index = g->u.pick_usb();
g->u.inv[index].contents.clear();
g->u.inv[index].put_in(software);
print_line("Software downloaded.");
}
}
} else
print_line("Result: Unknown blood type. Test nonconclusive.");
print_line("Press any key...");
getch();
}
}
}
}
break;
} // switch (action)
}
void computer::activate_random_failure(game *g)
{
computer_failure fail = (failures.empty() ? COMPFAIL_SHUTDOWN :
failures[rng(0, failures.size() - 1)]);
activate_failure(g, fail);
}
void computer::activate_failure(game *g, computer_failure fail)
{
switch (fail) {
case COMPFAIL_NULL:
break; // Do nothing. Why was this even called >:|
case COMPFAIL_SHUTDOWN:
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;
}
}
break;
case COMPFAIL_ALARM:
g->sound(g->u.posx, g->u.posy, 60, "An alarm sounds!");
if (g->levz > 0 && !g->event_queued(EVENT_WANTED))
g->add_event(EVENT_WANTED, int(g->turn) + 300, 0, g->levx, g->levy);
break;
case COMPFAIL_MANHACKS: {
int num_robots = rng(4, 8);
for (int i = 0; i < num_robots; i++) {
int mx, my, tries = 0;
do {
mx = rng(g->u.posx - 3, g->u.posx + 3);
my = rng(g->u.posy - 3, g->u.posy + 3);
tries++;
} while (!g->is_empty(mx, my) && tries < 10);
if (tries != 10) {
g->add_msg("Manhacks drop from compartments in the ceiling.");
monster robot(g->mtypes[mon_manhack]);
robot.spawn(mx, my);
g->z.push_back(robot);
}
}
} break;
case COMPFAIL_SECUBOTS: {
int num_robots = 1;
for (int i = 0; i < num_robots; i++) {
int mx, my, tries = 0;
do {
mx = rng(g->u.posx - 3, g->u.posx + 3);
my = rng(g->u.posy - 3, g->u.posy + 3);
tries++;
} while (!g->is_empty(mx, my) && tries < 10);
if (tries != 10) {
g->add_msg("Secubots emerge from compartments in the floor.");
monster robot(g->mtypes[mon_secubot]);
robot.spawn(mx, my);
g->z.push_back(robot);
}
}
} break;
case COMPFAIL_DAMAGE:
g->add_msg("The console electrocutes you!");
g->u.hurtall(rng(1, 10));
break;
case COMPFAIL_PUMP_EXPLODE:
g->add_msg("The pump explodes!");
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->explosion(x, y, 10, 0, false);
}
}
}
break;
case COMPFAIL_PUMP_LEAK:
g->add_msg("Sewage leaks!");
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) {
point p(x, y);
int leak_size = rng(4, 10);
for (int i = 0; i < leak_size; i++) {
std::vector<point> next_move;
if (g->m.move_cost(p.x, p.y - 1) > 0)
next_move.push_back( point(p.x, p.y - 1) );
if (g->m.move_cost(p.x + 1, p.y) > 0)
next_move.push_back( point(p.x + 1, p.y) );
if (g->m.move_cost(p.x, p.y + 1) > 0)
next_move.push_back( point(p.x, p.y + 1) );
if (g->m.move_cost(p.x - 1, p.y) > 0)
next_move.push_back( point(p.x - 1, p.y) );
if (next_move.empty())
i = leak_size;
else {
p = next_move[rng(0, next_move.size() - 1)];
g->m.ter(p.x, p.y) = t_sewage;
}
}
}
}
}
break;
case COMPFAIL_AMIGARA:
g->add_event(EVENT_AMIGARA, int(g->turn) + 5, 0, 0, 0);
g->u.add_disease(DI_AMIGARA, 20, g);
g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
break;
case COMPFAIL_DESTROY_BLOOD:
print_error("ERROR: Disruptive Spin");
for (int x = g->u.posx - 2; x <= g->u.posx + 2; x++) {
for (int y = g->u.posy - 2; y <= g->u.posy + 2; y++) {
if (g->m.ter(x, y) == t_centrifuge) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y).empty())
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)
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)
print_error("ERROR: Please only use blood samples.");
else {
print_error("ERROR: Blood sample destroyed.");
g->m.i_at(x, y)[i].contents.clear();
}
}
}
}
}
getch();
break;
}// switch (fail)
}
bool computer::query_bool(const char *mes, ...)
{
// Translate the printf flags
va_list ap;
va_start(ap, mes);
char buff[6000];
vsprintf(buff, mes, ap);
va_end(ap);
// Append with (Y/N/Q)
std::string full_line = buff;
full_line += " (Y/N/Q)";
// Print the resulting text
print_line(full_line.c_str());
char ret;
do
ret = getch();
while (ret != 'y' && ret != 'Y' && ret != 'n' && ret != 'N' && ret != 'q' &&
ret != 'Q');
return (ret == 'y' || ret == 'Y');
}
char computer::query_ynq(const char *mes, ...)
{
// Translate the printf flags
va_list ap;
va_start(ap, mes);
char buff[6000];
vsprintf(buff, mes, ap);
va_end(ap);
// Append with (Y/N/Q)
std::string full_line = buff;
full_line += " (Y/N/Q)";
// Print the resulting text
print_line(full_line.c_str());
char ret;
do
ret = getch();
while (ret != 'y' && ret != 'Y' && ret != 'n' && ret != 'N' && ret != 'q' &&
ret != 'Q');
return ret;
}
void computer::print_line(const char *mes, ...)
{
// Translate the printf flags
va_list ap;
va_start(ap, mes);
char buff[6000];
vsprintf(buff, mes, ap);
va_end(ap);
// Replace any '\n' with "\n " to allow for the border
std::string message = buff;
size_t pos = 0;
while (pos != std::string::npos) {
pos = message.find("\n", pos);
if (pos != std::string::npos) {
message.replace(pos, 1, "\n ");
pos += 2;
}
}
// Print the line.
wprintz(w_terminal, c_green, " %s\n", message.c_str());
// Reprint the border, in case we pushed a line over it
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
wrefresh(w_terminal);
}
void computer::print_error(const char *mes, ...)
{
// Translate the printf flags
va_list ap;
va_start(ap, mes);
char buff[6000];
vsprintf(buff, mes, ap);
va_end(ap);
// Print the line.
wprintz(w_terminal, c_red, " %s%s", buff, "\n");
// Reprint the border, in case we pushed a line over it
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
wrefresh(w_terminal);
}
void computer::print_gibberish_line()
{
std::string gibberish;
int length = rng(50, 70);
for (int i = 0; i < length; i++) {
switch (rng(0, 4)) {
case 0: gibberish += '0' + rng(0, 9); break;
case 1:
case 2: gibberish += 'a' + rng(0, 25); break;
case 3:
case 4: gibberish += 'A' + rng(0, 25); break;
}
}
wprintz(w_terminal, c_yellow, gibberish.c_str());
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
wrefresh(w_terminal);
}
void computer::reset_terminal()
{
werase(w_terminal);
wborder(w_terminal, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
wmove(w_terminal, 1, 1);
wrefresh(w_terminal);
}
+115
View File
@@ -0,0 +1,115 @@
#ifndef _COMPUTER_H_
#define _COMPUTER_H_
//#include "texthash.h"
#include "output.h"
#include <vector>
#include <string>
#define DEFAULT_COMPUTER_NAME ""
class game;
class player;
enum computer_action
{
COMPACT_NULL = 0,
COMPACT_OPEN,
COMPACT_SAMPLE,
COMPACT_RELEASE,
COMPACT_TERMINATE,
COMPACT_PORTAL,
COMPACT_CASCADE,
COMPACT_RESEARCH,
COMPACT_MAPS,
COMPACT_MAP_SEWER,
COMPACT_MISS_LAUNCH,
COMPACT_MISS_DISARM,
COMPACT_LIST_BIONICS,
COMPACT_ELEVATOR_ON,
COMPACT_AMIGARA_LOG,
COMPACT_AMIGARA_START,
COMPACT_DOWNLOAD_SOFTWARE,
COMPACT_BLOOD_ANAL,
COMPACT_STEMCELL_TREATMENT,
NUM_COMPUTER_ACTIONS
};
enum computer_failure
{
COMPFAIL_NULL = 0,
COMPFAIL_SHUTDOWN,
COMPFAIL_ALARM,
COMPFAIL_MANHACKS,
COMPFAIL_SECUBOTS,
COMPFAIL_DAMAGE,
COMPFAIL_PUMP_EXPLODE,
COMPFAIL_PUMP_LEAK,
COMPFAIL_AMIGARA,
COMPFAIL_DESTROY_BLOOD,
NUM_COMPUTER_FAILURES
};
struct computer_option
{
std::string name;
computer_action action;
int security;
computer_option() { name = "Unknown", action = COMPACT_NULL, security = 0; };
computer_option(std::string N, computer_action A, int S) :
name (N), action (A), security (S) {};
};
class computer
{
public:
computer();
computer(std::string Name, int Security);
~computer();
computer & operator=(const computer &rhs);
// Initialization
void set_security(int Security);
void add_option(std::string opt_name, computer_action action, int Security);
void add_failure(computer_failure failure);
// Basic usage
void shutdown_terminal(); // Shutdown (free w_terminal, etc)
void use(game *g);
bool hack_attempt(player *p, int Security = -1);// -1 defaults to main security
// Save/load
std::string save_data();
void load_data(std::string data);
std::string name; // "Jon's Computer", "Lab 6E77-B Terminal Omega"
int mission_id; // Linked to a mission?
private:
int security; // Difficulty of simply logging in
std::vector<computer_option> options; // Things we can do
std::vector<computer_failure> failures; // Things that happen if we fail a hack
WINDOW *w_terminal; // Output window
// Called by use()
void activate_function (game *g, computer_action action);
// Generally called when we fail a hack attempt
void activate_random_failure(game *g);
// ...but we can also choose a specific failure.
void activate_failure (game *g, computer_failure fail);
// OUTPUT/INPUT
// Reset to a blank terminal (e.g. at start of usage loop)
void reset_terminal();
// Prints a line to the terminal (with printf flags)
void print_line(const char *text, ...);
// For now, the same as print_line but in red (TODO: change this?)
void print_error(const char *text, ...);
// Prints code-looking gibberish
void print_gibberish_line();
// Prints a line and waits for Y/N/Q
char query_ynq(const char *text, ...);
// Same as query_ynq, but returns true for y or Y
bool query_bool(const char *text, ...);
};
#endif
+942
View File
@@ -0,0 +1,942 @@
#include "game.h"
#include "setvector.h"
#include "output.h"
#include "keypress.h"
#include "player.h"
#include "inventory.h"
#include "mapdata.h"
#include "skill.h"
#include "crafting.h" // For the use_comps use_tools functions
bool will_flood_stop(map *m, bool (&fill)[SEEX * MAPSIZE][SEEY * MAPSIZE],
int x, int y);
void game::init_construction()
{
int id = -1;
int tl, cl, sl;
#define CONSTRUCT(name, difficulty, able, done) \
sl = -1; id++; \
constructions.push_back( new constructable(id, name, difficulty, able, done))
#define STAGE(...)\
tl = 0; cl = 0; 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++
/* CONSTRUCT( name, time, able, done )
* Name is the name as it appears in the menu; 30 characters or less, please.
* time is the time in MINUTES that it takes to finish this construction.
* note that 10 turns = 1 minute.
* able is a function which returns true if you can build it on a given tile
* See construction.h for options, and this file for definitions.
* done is a function which runs each time the construction finishes.
* This is useful, for instance, for removing the trap from a pit, or placing
* items after a deconstruction.
*/
CONSTRUCT("Dig Pit", 0, &construct::able_dig, &construct::done_nothing);
STAGE(t_pit_shallow, 10);
TOOL(itm_shovel, NULL);
STAGE(t_pit, 10);
TOOL(itm_shovel, NULL);
CONSTRUCT("Spike Pit", 0, &construct::able_pit, &construct::done_nothing);
STAGE(t_pit_spiked, 5);
COMP(itm_spear_wood, 4, NULL);
CONSTRUCT("Fill Pit", 0, &construct::able_pit, &construct::done_nothing);
STAGE(t_pit_shallow, 5);
TOOL(itm_shovel, NULL);
STAGE(t_dirt, 5);
TOOL(itm_shovel, NULL);
CONSTRUCT("Chop Down Tree", 0, &construct::able_tree, &construct::done_tree);
STAGE(t_dirt, 10);
TOOL(itm_ax, itm_chainsaw_on, NULL);
CONSTRUCT("Chop Up Log", 0, &construct::able_log, &construct::done_log);
STAGE(t_dirt, 20);
TOOL(itm_ax, itm_chainsaw_on, NULL);
CONSTRUCT("Move Furniture", -1, &construct::able_furniture, &construct::done_furniture);
STAGE(t_null, 1);
CONSTRUCT("Clean Broken Window", 0, &construct::able_broken_window,
&construct::done_nothing);
STAGE(t_window_empty, 5);
/* CONSTRUCT("Remove Window Pane", 1, &construct::able_window_pane,
&construct::done_window_pane);
STAGE(t_window_empty, 10);
TOOL(itm_hammer, itm_rock, itm_hatchet, NULL);
TOOL(itm_screwdriver, itm_knife_butter, itm_toolset, NULL);
*/
CONSTRUCT("Repair Door", 1, &construct::able_door_broken,
&construct::done_nothing);
STAGE(t_door_c, 10);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 3, NULL);
COMP(itm_nail, 12, NULL);
CONSTRUCT("Board Up Door", 0, &construct::able_door, &construct::done_nothing);
STAGE(t_door_boarded, 8);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 8, NULL);
CONSTRUCT("Board Up Window", 0, &construct::able_window,
&construct::done_nothing);
STAGE(t_window_boarded, 5);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 8, NULL);
CONSTRUCT("Build Wall", 2, &construct::able_empty, &construct::done_nothing);
STAGE(t_wall_half, 10);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_nail, 20, NULL);
STAGE(t_wall_wood, 10);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_nail, 20, NULL);
CONSTRUCT("Build Log Wall", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_wall_log_half, 20);
TOOL(itm_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_stick, 3, NULL);
STAGE(t_wall_log, 20);
TOOL(itm_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_stick, 3, NULL);
CONSTRUCT("Build Palisade Wall", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_palisade, 20);
TOOL(itm_shovel, NULL);
COMP(itm_log, 3, NULL);
COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);
CONSTRUCT("Build Palisade Gate", 2, &construct::able_pit, &construct::done_nothing);
STAGE(t_palisade_gate, 20);
TOOL(itm_shovel, NULL);
COMP(itm_log, 2, NULL);
COMP(itm_2x4, 3, NULL);
COMP(itm_rope_30, 1, itm_rope_6, 5, NULL);
CONSTRUCT("Build Window", 2, &construct::able_empty,
&construct::done_nothing);
STAGE(t_window_empty, 10);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 15, itm_log, 2, NULL);
COMP(itm_nail, 30, NULL);
STAGE(t_window, 5);
COMP(itm_glass_sheet, 1, NULL);
STAGE(t_window_domestic, 5);
TOOL(itm_saw, NULL);
COMP(itm_nail, 4, NULL);
COMP(itm_sheet, 2, NULL);
COMP(itm_stick, 1, NULL);
CONSTRUCT("Build Door", 2, &construct::able_empty,
&construct::done_nothing);
STAGE(t_door_frame, 15);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 12, NULL);
COMP(itm_nail, 24, NULL);
STAGE(t_door_c, 15);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 4, NULL);
COMP(itm_nail, 12, NULL);
CONSTRUCT("Build Wire Fence",3, &construct::able_dig,
&construct::done_nothing);
STAGE(t_chainfence_posts, 20);
TOOL(itm_hammer, itm_hatchet, itm_rock, NULL);
COMP(itm_pipe, 6, NULL);
COMP(itm_scrap, 8, NULL);
STAGE(t_chainfence_v, 20);
COMP(itm_wire, 15, NULL);
CONSTRUCT("Realign Fence", 0, &construct::able_chainlink,
&construct::done_nothing);
STAGE(t_chainfence_h, 0);
STAGE(t_chainfence_v, 0);
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);
/* 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_hatchet, NULL);
COMP(itm_2x4, 5, itm_nail, 8, NULL);
*/
CONSTRUCT("Build Roof", 3, &construct::able_between_walls,
&construct::done_nothing);
STAGE(t_floor, 40);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_2x4, 8, NULL);
COMP(itm_nail, 40, NULL);
// Household stuff
CONSTRUCT("Build Dresser", 1, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_dresser, 20);
TOOL(itm_saw, NULL);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 6, NULL);
CONSTRUCT("Build Bookcase", 1, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_bookcase, 20);
TOOL(itm_saw, NULL);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 16, NULL);
COMP(itm_2x4, 12, NULL);
CONSTRUCT("Build Counter", 0, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_counter, 20);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 6, NULL);
CONSTRUCT("Build Makeshift Bed", 0, &construct::able_indoors,
&construct::done_nothing);
STAGE(t_makeshift_bed, 20);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
COMP(itm_nail, 8, NULL);
COMP(itm_2x4, 10, NULL);
COMP(itm_sheet, 1, NULL);
CONSTRUCT("Tape up window", 0, &construct::able_window,
&construct::done_tape);
STAGE(t_null, 2);
COMP(itm_duct_tape, 50, NULL);
CONSTRUCT("Deconstruct Furniture", 0, &construct::able_deconstruct,
&construct::done_deconstruct);
STAGE(t_null, 20);
TOOL(itm_hammer, itm_hatchet, itm_nailgun, NULL);
TOOL(itm_screwdriver, itm_toolset, NULL);
CONSTRUCT("Start vehicle construction", 0, &construct::able_empty, &construct::done_vehicle);
STAGE(t_null, 10);
COMP(itm_frame, 1, NULL);
CONSTRUCT("Fence Posts", 0, &construct::able_dig,
&construct::done_nothing);
STAGE(t_fence_post, 5);
TOOL(itm_hammer, itm_shovel, itm_rock, itm_hatchet, itm_ax, NULL);
COMP(itm_spear_wood, 2, NULL);
}
void game::construction_menu()
{
WINDOW *w_con = newwin(25, 80, 0, 0);
wborder(w_con, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
mvwprintz(w_con, 0, 1, c_red, "Construction");
mvwputch(w_con, 0, 30, c_white, LINE_OXXX);
mvwputch(w_con, 24, 30, c_white, LINE_XXOX);
for (int i = 1; i < 24; i++)
mvwputch(w_con, i, 30, c_white, LINE_XOXO);
mvwprintz(w_con, 1, 31, c_white, "Difficulty:");
wrefresh(w_con);
bool update_info = true;
int select = 0;
char ch;
inventory total_inv = crafting_inventory();
do {
// Erase existing list of constructions
for (int i = 1; i < 24; i++) {
for (int j = 1; j < 29; j++)
mvwputch(w_con, i, j, c_black, 'x');
}
// Determine where in the master list to start printing
//int offset = select - 11;
int offset = 0;
if (select >= 22)
offset = select - 22;
// Print the constructions between offset and max (or how many will fit)
for (int i = 0; i <= 22 && (i + offset) < constructions.size(); i++) {
int current = i + offset;
nc_color col = (player_can_build(u, total_inv, constructions[current]) ?
c_white : c_dkgray);
// Map menu items to hotkey letters, skipping j, k, l, and q.
char hotkey = current + ((current < 9) ? 97 : ((current < 13) ? 100 : 101));
if (current == select)
col = hilite(col);
mvwprintz(w_con, 1 + i, 1, col, "%c %s", hotkey,
constructions[current]->name.c_str());
}
if (update_info) {
update_info = false;
constructable* current_con = constructions[select];
// Print difficulty
int pskill = u.skillLevel("carpentry").level();
int diff = current_con->difficulty > 0 ? current_con->difficulty : 0;
mvwprintz(w_con, 1, 43, (pskill >= diff ? c_white : c_red),
"%d ", diff);
// Clear out lines for tools & materials
for (int i = 2; i < 24; i++) {
for (int j = 31; j < 79; j++)
mvwputch(w_con, i, j, c_black, 'x');
}
// Print stages and their requirements
int posx = 33, posy = 2;
for (int n = 0; n < current_con->stages.size(); n++) {
nc_color color_stage = (player_can_build(u, total_inv, current_con, n,
false, true) ?
c_white : c_dkgray);
mvwprintz(w_con, posy, 31, color_stage, "Stage %d: %s", n + 1,
current_con->stages[n].terrain == t_null? "" : terlist[current_con->stages[n].terrain].name.c_str());
posy++;
// Print tools
construction_stage stage = current_con->stages[n];
bool has_tool[3] = {stage.tools[0].empty(),
stage.tools[1].empty(),
stage.tools[2].empty()};
for (int i = 0; i < 3 && !has_tool[i]; i++) {
posy++;
posx = 33;
for (int j = 0; j < stage.tools[i].size(); j++) {
itype_id tool = stage.tools[i][j];
nc_color col = c_red;
if (total_inv.has_amount(tool, 1)) {
has_tool[i] = true;
col = c_green;
}
int length = itypes[tool]->name.length();
if (posx + length > 79) {
posy++;
posx = 33;
}
mvwprintz(w_con, posy, posx, col, itypes[tool]->name.c_str());
posx += length + 1; // + 1 for an empty space
if (j < stage.tools[i].size() - 1) { // "OR" if there's more
if (posx > 77) {
posy++;
posx = 33;
}
mvwprintz(w_con, posy, posx, c_white, "OR");
posx += 3;
}
}
}
// Print components
posy++;
posx = 33;
bool has_component[3] = {stage.components[0].empty(),
stage.components[1].empty(),
stage.components[2].empty()};
for (int i = 0; i < 3; i++) {
posx = 33;
while (has_component[i])
i++;
for (int j = 0; j < stage.components[i].size() && i < 3; j++) {
nc_color col = c_red;
component comp = stage.components[i][j];
if (( itypes[comp.type]->is_ammo() &&
total_inv.has_charges(comp.type, comp.count)) ||
(!itypes[comp.type]->is_ammo() &&
total_inv.has_amount(comp.type, comp.count))) {
has_component[i] = true;
col = c_green;
}
int length = itypes[comp.type]->name.length();
if (posx + length > 79) {
posy++;
posx = 33;
}
mvwprintz(w_con, posy, posx, col, "%s x%d",
itypes[comp.type]->name.c_str(), comp.count);
posx += length + 3; // + 2 for " x", + 1 for an empty space
// Add more space for the length of the count
if (comp.count < 10)
posx++;
else if (comp.count < 100)
posx += 2;
else
posx += 3;
if (j < stage.components[i].size() - 1) { // "OR" if there's more
if (posx > 77) {
posy++;
posx = 33;
}
mvwprintz(w_con, posy, posx, c_white, "OR");
posx += 3;
}
}
posy++;
}
}
wrefresh(w_con);
} // Finished updating
ch = input();
switch (ch) {
case 'j':
update_info = true;
if (select < constructions.size() - 1)
select++;
else
select = 0;
break;
case 'k':
update_info = true;
if (select > 0)
select--;
else
select = constructions.size() - 1;
break;
case '\n':
case 'l':
if (player_can_build(u, total_inv, constructions[select])) {
place_construction(constructions[select]);
ch = 'q';
} else {
popup("You can't build that!");
for (int i = 1; i < 24; i++)
mvwputch(w_con, i, 30, c_white, LINE_XOXO);
update_info = true;
}
break;
case 'q':
case 'Q':
case KEY_ESCAPE:
break;
default:
if (ch < 97 || ch > constructions.size() + 101) break;
// Map menu items to hotkey letters, skipping j, k, l, and q.
char hotkey = ch - ((ch < 106) ? 97 : ((ch < 112) ? 100 : 101));
if (player_can_build(u, total_inv, constructions[hotkey])) {
place_construction(constructions[hotkey]);
ch = 'q';
} else {
popup("You can't build that!");
for (int i = 1; i < 24; i++)
mvwputch(w_con, i, 30, c_white, LINE_XOXO);
update_info = true;
}
break;
}
} while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE);
refresh_all();
}
bool game::player_can_build(player &p, inventory inv, constructable* con,
const int level, bool cont, bool exact_level)
{
int last_level = level;
// default behavior: return true if any of the stages up to L can be constr'd
// if exact_level, require that this level be constructable
if (p.skillLevel("carpentry") < con->difficulty)
return false;
if (level < 0)
last_level = con->stages.size();
int start = 0;
if (cont)
start = level;
bool can_build_any = false;
for (int i = start; i < con->stages.size() && i <= last_level; i++) {
construction_stage stage = con->stages[i];
bool has_tool = false;
bool has_component = false;
bool tools_required = false;
bool components_required = false;
for (int j = 0; j < 3; j++) {
if (stage.tools[j].size() > 0) {
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))
has_tool = true;
}
if (!has_tool) // missing one of the tools for this stage
break;
}
if (stage.components[j].size() > 0) {
components_required = true;
has_component = false;
for (int k = 0; k < stage.components[j].size() && !has_component; k++) {
if (( itypes[stage.components[j][k].type]->is_ammo() &&
inv.has_charges(stage.components[j][k].type,
stage.components[j][k].count) ) ||
(!itypes[stage.components[j][k].type]->is_ammo() &&
inv.has_amount (stage.components[j][k].type,
stage.components[j][k].count) ))
has_component = true;
}
if (!has_component) // missing one of the comps for this stage
break;
}
} // j in [0,2]
can_build_any |= (has_component || !components_required) &&
(has_tool || !tools_required);
if (exact_level && (i == level)) {
return ((has_component || !components_required) &&
(has_tool || !tools_required));
}
} // stage[i]
return can_build_any;
}
void game::place_construction(constructable *con)
{
refresh_all();
inventory total_inv = crafting_inventory();
std::vector<point> valid;
for (int x = u.posx - 1; x <= u.posx + 1; x++) {
for (int y = u.posy - 1; y <= u.posy + 1; y++) {
if (x == u.posx && y == u.posy)
y++;
construct test;
bool place_okay = (test.*(con->able))(this, point(x, y));
for (int i = 0; i < con->stages.size() && !place_okay; i++) {
if (m.ter(x, y) == con->stages[i].terrain)
place_okay = true;
}
if (place_okay) {
// Make sure we're not trying to continue a construction that we can't finish
int starting_stage = 0, max_stage = -1;
for (int i = 0; i < con->stages.size(); i++) {
if (m.ter(x, y) == con->stages[i].terrain)
starting_stage = i + 1;
}
for(int i = starting_stage; i < con->stages.size(); i++) {
if (player_can_build(u, total_inv, con, i, true, true))
max_stage = i;
else
break;
}
if (max_stage >= starting_stage) {
valid.push_back(point(x, y));
m.drawsq(w_terrain, u, x, y, true, false);
wrefresh(w_terrain);
}
}
}
}
mvprintz(0, 0, c_red, "Pick a direction in which to construct:");
int dirx, diry;
get_direction(this, dirx, diry, input());
if (dirx == -2) {
add_msg("Invalid direction.");
return;
}
dirx += u.posx;
diry += u.posy;
bool point_is_okay = false;
for (int i = 0; i < valid.size() && !point_is_okay; i++) {
if (valid[i].x == dirx && valid[i].y == diry)
point_is_okay = true;
}
if (!point_is_okay) {
add_msg("You cannot build there!");
return;
}
// Figure out what stage to start at, and what stage is the maximum
int starting_stage = 0, max_stage = 0;
for (int i = 0; i < con->stages.size(); i++) {
if (m.ter(dirx, diry) == con->stages[i].terrain)
starting_stage = i + 1;
if (player_can_build(u, total_inv, con, i, true))
max_stage = i;
}
u.assign_activity(ACT_BUILD, con->stages[starting_stage].time * 1000, con->id);
u.moves = 0;
std::vector<int> stages;
for (int i = starting_stage; i <= max_stage; i++)
stages.push_back(i);
u.activity.values = stages;
u.activity.placement = point(dirx, diry);
}
void game::complete_construction()
{
inventory map_inv;
map_inv.form_from_map(this, point(u.posx, u.posy), PICKUP_RANGE);
int stage_num = u.activity.values[0];
constructable *built = constructions[u.activity.index];
construction_stage stage = built->stages[stage_num];
std::vector<component> player_use;
std::vector<component> map_use;
u.practice("carpentry", built->difficulty * 10);
if (built->difficulty == 0)
u.practice("carpentry", 10);
for (int i = 0; i < 3; i++) {
if (!stage.components[i].empty())
consume_items(stage.components[i]);
}
// 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;
// Strip off the first stage in our list...
u.activity.values.erase(u.activity.values.begin());
// ...and start the next one, if it exists
if (u.activity.values.size() > 0) {
construction_stage next = built->stages[u.activity.values[0]];
u.activity.moves_left = next.time * 1000;
} else // We're finished!
u.activity.type = ACT_NULL;
// This comes after clearing the activity, in case the function interrupts
// activities
construct effects;
(effects.*(built->done))(this, point(terx, tery));
}
bool construct::able_empty(game *g, point p)
{
return (g->m.move_cost(p.x, p.y) == 2);
}
bool construct::able_tree(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_tree);
}
bool construct::able_log(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_log);
}
bool construct::able_furniture(game *g, point p)
{
int required_str = 0;
switch(g->m.ter(p.x, p.y)) {
case t_fridge:
case t_glass_fridge:
required_str = 10;
break;
case t_bookcase:
case t_locker:
required_str = 9;
break;
case t_dresser:
case t_rack:
case t_chair:
case t_armchair:
case t_bench:
required_str = 8;
break;
default:
//Not a furniture we can move
return false;
}
if( g->u.str_cur < required_str ) {
return false;
}
return true;
}
bool construct::able_window(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_window_frame ||
g->m.ter(p.x, p.y) == t_window_empty ||
g->m.ter(p.x, p.y) == t_window_domestic ||
g->m.ter(p.x, p.y) == t_window);
}
bool construct::able_empty_window(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_window_empty);
}
bool construct::able_window_pane(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_window || g->m.ter(p.x, p.y) == t_window_domestic || g->m.ter(p.x, p.y) == t_window_alarm);
}
bool construct::able_broken_window(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_window_frame);
}
bool construct::able_door(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_door_c ||
g->m.ter(p.x, p.y) == t_door_b ||
g->m.ter(p.x, p.y) == t_door_o ||
g->m.ter(p.x, p.y) == t_door_locked);
}
bool construct::able_door_broken(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_door_b);
}
bool construct::able_wall(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_wall_h || g->m.ter(p.x, p.y) == t_wall_v ||
g->m.ter(p.x, p.y) == t_wall_wood);
}
bool construct::able_wall_wood(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_wall_wood);
}
bool construct::able_indoors(game *g, point p)
{
return (g->m.is_indoor(p.x, p.y));
}
bool construct::able_dig(game *g, point p)
{
return (g->m.has_flag(diggable, p.x, p.y));
}
bool construct::able_chainlink(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_chainfence_v || g->m.ter(p.x, p.y) == t_chainfence_h);
}
bool construct::able_pit(game *g, point p)
{
return (g->m.ter(p.x, p.y) == t_pit);//|| g->m.ter(p.x, p.y) == t_pit_shallow);
}
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));
}
bool construct::able_deconstruct(game *g, point p)
{
return (g->m.has_flag(deconstruct, p.x, p.y));
}
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);
}
void construct::done_furniture(game *g, point p)
{
mvprintz(0, 0, c_red, "Press a direction for the furniture to move (. to cancel):");
int x = 0, y = 0;
//Keep looping until we get a valid direction or a cancel.
while(true){
do
get_direction(g, x, y, input());
while (x == -2 || y == -2);
if(x == 0 && y == 0)
return;
x += p.x;
y += p.y;
if(!g->m.ter(x, y) == t_floor || !g->is_empty(x, y)) {
mvprintz(0, 0, c_red, "Can't move furniture there! Choose a direction with open floor.");
continue;
}
break;
}
g->m.ter(x, y) = g->m.ter(p.x, p.y);
g->m.ter(p.x, p.y) = t_floor;
//Move all Items within a container
std::vector <item> vItemMove = g->m.i_at(p.x, p.y);
for (int i=0; i < vItemMove.size(); i++)
g->m.add_item(x, y, vItemMove[i]);
g->m.i_clear(p.x, p.y);
}
void construct::done_tree(game *g, point p)
{
mvprintz(0, 0, c_red, "Press a direction for the tree to fall in:");
int x = 0, y = 0;
do
get_direction(g, x, y, input());
while (x == -2 || y == -2);
x = p.x + x * 3 + rng(-1, 1);
y = p.y + y * 3 + rng(-1, 1);
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;
}
}
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));
}
void construct::done_vehicle(game *g, point p)
{
std::string name = string_input_popup("Enter new vehicle name", 20);
vehicle *veh = g->m.add_vehicle (g, veh_custom, p.x, p.y, 270);
if (!veh)
{
debugmsg ("error constructing vehicle");
return;
}
veh->name = name;
veh->install_part (0, 0, vp_frame_v2);
}
void construct::done_tape(game *g, point p)
{
g->add_msg("You tape up the %s.", g->m.tername(p.x, p.y).c_str());
switch (g->m.ter(p.x, p.y))
{
case t_window_alarm:
g->m.ter(p.x, p.y) = t_window_alarm_taped;
case t_window_domestic:
g->m.ter(p.x, p.y) = t_window_domestic_taped;
case t_window:
g->m.ter(p.x, p.y) = t_window_taped;
}
}
void construct::done_deconstruct(game *g, point p)
{
g->add_msg("You disassemble the %s.", g->m.tername(p.x, p.y).c_str());
switch (g->m.ter(p.x, p.y))
{
case t_makeshift_bed:
case t_bed:
case t_armchair:
g->m.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;
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;
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;
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;
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;
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;
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;
break;
case t_slide:
g->m.add_item(p.x, p.y, g->itypes[itm_steel_plate], 0);
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;
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;
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;
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;
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;
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;
break;
}
}
+76
View File
@@ -0,0 +1,76 @@
bool able_window(game *, point); // Any window tile#include <vector>
#include <string>
#include "crafting.h"
struct construct;
struct construction_stage
{
ter_id terrain;
int time; // In minutes, i.e. 10 turns
std::vector<itype_id> tools[3];
std::vector<component> components[3];
construction_stage(ter_id Terrain, int Time) :
terrain (Terrain), time (Time) { };
};
struct constructable
{
int id;
std::string name; // Name as displayed
int difficulty; // Carpentry skill level required
std::vector<construction_stage> stages;
bool (construct::*able) (game *, point);
void (construct::*done) (game *, point);
constructable(int Id, std::string Name, int Diff,
bool (construct::*Able) (game *, point),
void (construct::*Done) (game *, point)) :
id (Id), name (Name), difficulty (Diff), able (Able), done (Done) {};
};
struct construct // Construction functions.
{
// Bools - able to build at the given point?
bool able_always(game *, point) { return true; }
bool able_never (game *, point) { return false; }
bool able_empty (game *, point); // Able if tile is empty
bool able_window(game *, point); // Any window tile
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
bool able_door(game *, point); // Any door tile
bool able_door_broken(game *, point); // Broken door
bool able_wall (game *, point); // Able if tile is wall
bool able_wall_wood(game *g, point); // Only player-built walls
bool able_indoors(game *g, point); // Able on floors
bool able_between_walls(game *, point); // Flood-fill contained by walls
bool able_dig(game *, point); // Able if diggable terrain
bool able_chainlink(game *, point); // Able on chain link fences
bool able_pit(game *, point); // Able only on pits
bool able_tree(game *, point); // Able on trees
bool able_log(game *, point); // Able on logs
bool able_furniture(game *, point); // Able on furniture
bool able_deconstruct(game *, point);
// Does anything special happen when we're finished?
void done_nothing(game *, point) { }
void done_window_pane(game *, point);
void done_vehicle(game *, point);
void done_tree(game *, point);
void done_log(game *, point);
void done_furniture(game *, point);
void done_tape(game *, point);
void done_deconstruct(game *, point);
};
+1471 -318
View File
File diff suppressed because it is too large Load Diff
+36 -17
View File
@@ -7,13 +7,19 @@
#include "skill.h"
#include "rng.h"
#define MAX_DISPLAYED_RECIPES 18
enum craft_cat {
CC_NULL = 0,
CC_WEAPON,
CC_AMMO,
CC_FOOD,
CC_DRINK,
CC_CHEM,
CC_ELECTRONIC,
CC_ARMOR,
CC_MISC,
CC_NONCRAFT,
NUM_CC
};
@@ -25,25 +31,38 @@ struct component
component(itype_id TYPE, int COUNT) : type (TYPE), count (COUNT) {}
};
struct recipe
{
int id;
itype_id result;
craft_cat category;
skill sk_primary;
skill sk_secondary;
int difficulty;
int time;
struct recipe {
int id;
itype_id result;
craft_cat category;
Skill *sk_primary;
Skill *sk_secondary;
int difficulty;
int time;
bool reversible; // can the item be disassembled?
std::vector<component> tools[5];
std::vector<component> components[5];
std::vector<component> tools[5];
std::vector<component> components[10];
recipe() { id = 0; result = itm_null; category = CC_NULL; sk_primary = sk_null;
sk_secondary = sk_null; difficulty = 0; time = 0; }
recipe(int pid, itype_id pres, craft_cat cat, skill p1, skill p2, int pdiff,
int ptime) :
id (pid), result (pres), category (cat), sk_primary (p1), sk_secondary (p2),
difficulty (pdiff), time (ptime) {}
recipe() {
id = 0;
result = itm_null;
category = CC_NULL;
sk_primary = NULL;
sk_secondary = NULL;
difficulty = 0;
time = 0;
reversible = false;
}
recipe(int pid, itype_id pres, craft_cat cat, const char *p1, const char *p2,
int pdiff, int ptime, bool preversible) :
id (pid), result (pres), category (cat), difficulty (pdiff), time (ptime), reversible (preversible)
{
sk_primary = p1?Skill::skill(p1):NULL;
sk_secondary = p2?Skill::skill(p2):NULL;
}
};
#endif
+12
View File
@@ -0,0 +1,12 @@
#ifndef _CURSES_DEF_H_
#define _CURSES_DEF_H_
#if (defined _WIN32 || defined WINDOWS)
#include "catacurse.h"
#elif (defined __CYGWIN__)
#include "ncurses/curses.h"
#else
#include <curses.h>
#endif
#endif // CURSES_DEF_H
+3
View File
@@ -0,0 +1,3 @@
# These are both generated if missing at program startup
keymap.txt
options.txt
+3
View File
@@ -0,0 +1,3 @@
Terminus
8
16
+14 -3
View File
@@ -20,6 +20,17 @@ Our research on teleportation has ground to a halt. For some reason, the
creation of a long-range transportation device eludes us, and one can transfer
no further than 30 meters.
%
I don't know how it happened, but a janitor managed to activate the portal
while cleaning the lab, shifting in an assortment of prehistoric fauna.
Security was called in immediately but was unable to save the janitor from
being torn apart. By the time the confusion settled, all the fauna had been
terminated.
%
Tests on the prehistoric fauna show extremely close genetic relationships with
extant and extinct terranian animals. It might be that the portal had performed
a transposition in time, unfortunately the portal device had been destroyed
when security had put down the fauna.
%
An incident occured in the teleportation lab, wherein a subject managed to
teleport into another subject. The latter was completely destroyed from the
inside out, while the former sustained little damage. I would like to explore
@@ -52,7 +63,7 @@ slime-like structure as XE037, suggesting a close genetic relationship.
%
Today we tested weaponry against XE142 and XE157, two amorphous subprime
samples. Their form proved to be nearly invulnerable to projectile based
weaponry, but they were susceptible to energy weapons and fire.
weaponry, but they were susceptible to directed energy weapons and flagration.
%
Our cloning department has failed to produce results. In vats containing stem
cell treatments, XE037, and control vats, the subjects simple disintegrated.
@@ -61,11 +72,11 @@ destructive effects on prime plane lifeforms.
%
The vivisection program has shown mixed results, revealing an incredible
degree of variation in subplane lifeforms. Certain specimens have an internal
structure that is amazingly similar to that of humans, while others seem to
structure that is amazingly similar to that of mammals, while others seem to
have no internal structure at all.
%
Our security department has identified several key flaws. Though our surface
entrance is quite secure, there are several possible points of entrance below
entrance is quite secure, there are several possible points of entry below
the surface, particularly in the sewage systems.
%
Today we applied a very small sample of XE037, suspended in water, to subject
+1 -2
View File
@@ -172,7 +172,7 @@ Most gun stores follow pretty similar layouts. The restricted stuff--SMGs, assa
I've spent many nights in the changing rooms at the back of clothing stores. Walls on four sides, far from the store's entrance, a corridor for easy defense... it's perfect!
If you're getting chased by a hoarde of zombies, try ducking into the subways and traveling a block or two, then coming back up.
If you're getting chased by a hoard of zombies, try ducking into the subways and traveling a block or two, then coming back up.
Have you seen those weird science labs out in the middle of nowhere? I think you need some kind of special ID card to get in.
@@ -184,4 +184,3 @@ In a lot of places, there's little hallways connecting the subways with the sewe
Be careful of drinking water from rivers and stuff, it's a good way to get sick. But if you have a water purifier, it'll make it safe.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+17
View File
@@ -0,0 +1,17 @@
# This message may be 16 lines long at maximum.
# Max length of a line is 64 characters; the following line is for reference
################################################################
This branch contains much work by Creidieki, Uzername,
Kevingranade, HerbertJones, Gim, Shades and Origamiwolf.
The game now has configurable options.
You can directly edit options.txt in the data directory, or you
can edit the options via the help menu.
For latest discussions on Cataclysm and its mods, please visit:
http://www.cataclysm.glyphgryph.com/smf/index.php
Check out the options listing by pressing ?2
As always, please visit the forums at:
http://www.cataclysmdda.com/smf/index.php
View File
Executable
View File
+302
View File
@@ -0,0 +1,302 @@
[
{ "name" : "Aaliyah", "gender" : "female", "usage" : "given" },
{ "name" : "Aaron", "gender" : "male", "usage" : "given" },
{ "name" : "Abigail", "gender" : "female", "usage" : "given" },
{ "name" : "Adam", "gender" : "male", "usage" : "given" },
{ "name" : "Adams", "gender" : "unisex", "usage" : "family" },
{ "name" : "Addison", "gender" : "female", "usage" : "given" },
{ "name" : "Adrian", "gender" : "male", "usage" : "given" },
{ "name" : "Aidan", "gender" : "male", "usage" : "given" },
{ "name" : "Aiden", "gender" : "male", "usage" : "given" },
{ "name" : "Alex", "gender" : "male", "usage" : "given" },
{ "name" : "Alexa", "gender" : "female", "usage" : "given" },
{ "name" : "Alexander", "gender" : "male", "usage" : "given" },
{ "name" : "Alexander", "gender" : "unisex", "usage" : "family" },
{ "name" : "Alexandra", "gender" : "female", "usage" : "given" },
{ "name" : "Alexis", "gender" : "female", "usage" : "given" },
{ "name" : "Allen", "gender" : "unisex", "usage" : "family" },
{ "name" : "Allison", "gender" : "female", "usage" : "given" },
{ "name" : "Alyssa", "gender" : "female", "usage" : "given" },
{ "name" : "Amelia", "gender" : "female", "usage" : "given" },
{ "name" : "Anderson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Andrea", "gender" : "female", "usage" : "given" },
{ "name" : "Andrew", "gender" : "male", "usage" : "given" },
{ "name" : "Angel", "gender" : "male", "usage" : "given" },
{ "name" : "Angelina", "gender" : "female", "usage" : "given" },
{ "name" : "Anna", "gender" : "female", "usage" : "given" },
{ "name" : "Anthony", "gender" : "male", "usage" : "given" },
{ "name" : "Ariana", "gender" : "female", "usage" : "given" },
{ "name" : "Arianna", "gender" : "female", "usage" : "given" },
{ "name" : "Ashley", "gender" : "female", "usage" : "given" },
{ "name" : "Aubrey", "gender" : "female", "usage" : "given" },
{ "name" : "Audrey", "gender" : "female", "usage" : "given" },
{ "name" : "Austin", "gender" : "male", "usage" : "given" },
{ "name" : "Autumn", "gender" : "female", "usage" : "given" },
{ "name" : "Ava", "gender" : "female", "usage" : "given" },
{ "name" : "Avery", "gender" : "female", "usage" : "given" },
{ "name" : "Ayden", "gender" : "male", "usage" : "given" },
{ "name" : "Bailey", "gender" : "female", "usage" : "given" },
{ "name" : "Bailey", "gender" : "unisex", "usage" : "family" },
{ "name" : "Baker", "gender" : "unisex", "usage" : "family" },
{ "name" : "Barnes", "gender" : "unisex", "usage" : "family" },
{ "name" : "Bell", "gender" : "unisex", "usage" : "family" },
{ "name" : "Benjamin", "gender" : "male", "usage" : "given" },
{ "name" : "Bennett", "gender" : "unisex", "usage" : "family" },
{ "name" : "Blake", "gender" : "male", "usage" : "given" },
{ "name" : "Brady", "gender" : "male", "usage" : "given" },
{ "name" : "Brandon", "gender" : "male", "usage" : "given" },
{ "name" : "Brayden", "gender" : "male", "usage" : "given" },
{ "name" : "Brian", "gender" : "male", "usage" : "given" },
{ "name" : "Brianna", "gender" : "female", "usage" : "given" },
{ "name" : "Brody", "gender" : "male", "usage" : "given" },
{ "name" : "Brooke", "gender" : "female", "usage" : "given" },
{ "name" : "Brooklyn", "gender" : "female", "usage" : "given" },
{ "name" : "Brooks", "gender" : "unisex", "usage" : "family" },
{ "name" : "Brown", "gender" : "unisex", "usage" : "family" },
{ "name" : "Bryan", "gender" : "male", "usage" : "given" },
{ "name" : "Bryant", "gender" : "unisex", "usage" : "family" },
{ "name" : "Butler", "gender" : "unisex", "usage" : "family" },
{ "name" : "Caden", "gender" : "male", "usage" : "given" },
{ "name" : "Caleb", "gender" : "male", "usage" : "given" },
{ "name" : "Cameron", "gender" : "male", "usage" : "given" },
{ "name" : "Camilla", "gender" : "female", "usage" : "given" },
{ "name" : "Campbell", "gender" : "unisex", "usage" : "family" },
{ "name" : "Carlos", "gender" : "male", "usage" : "given" },
{ "name" : "Caroline", "gender" : "female", "usage" : "given" },
{ "name" : "Carson", "gender" : "male", "usage" : "given" },
{ "name" : "Carter", "gender" : "male", "usage" : "given" },
{ "name" : "Carter", "gender" : "unisex", "usage" : "family" },
{ "name" : "Charles", "gender" : "male", "usage" : "given" },
{ "name" : "Charlotte", "gender" : "female", "usage" : "given" },
{ "name" : "Chase", "gender" : "male", "usage" : "given" },
{ "name" : "Chloe", "gender" : "female", "usage" : "given" },
{ "name" : "Christian", "gender" : "male", "usage" : "given" },
{ "name" : "Christopher", "gender" : "male", "usage" : "given" },
{ "name" : "Claire", "gender" : "female", "usage" : "given" },
{ "name" : "Clark", "gender" : "unisex", "usage" : "family" },
{ "name" : "Cole", "gender" : "male", "usage" : "given" },
{ "name" : "Coleman", "gender" : "unisex", "usage" : "family" },
{ "name" : "Collins", "gender" : "unisex", "usage" : "family" },
{ "name" : "Colton", "gender" : "male", "usage" : "given" },
{ "name" : "Connor", "gender" : "male", "usage" : "given" },
{ "name" : "Cook", "gender" : "unisex", "usage" : "family" },
{ "name" : "Cooper", "gender" : "male", "usage" : "given" },
{ "name" : "Cooper", "gender" : "unisex", "usage" : "family" },
{ "name" : "Cox", "gender" : "unisex", "usage" : "family" },
{ "name" : "Daniel", "gender" : "male", "usage" : "given" },
{ "name" : "David", "gender" : "male", "usage" : "given" },
{ "name" : "Davis", "gender" : "unisex", "usage" : "family" },
{ "name" : "Destiny", "gender" : "female", "usage" : "given" },
{ "name" : "Diaz", "gender" : "unisex", "usage" : "family" },
{ "name" : "Diego", "gender" : "male", "usage" : "given" },
{ "name" : "Dominic", "gender" : "male", "usage" : "given" },
{ "name" : "Dylan", "gender" : "male", "usage" : "given" },
{ "name" : "Edwards", "gender" : "unisex", "usage" : "family" },
{ "name" : "Eli", "gender" : "male", "usage" : "given" },
{ "name" : "Elijah", "gender" : "male", "usage" : "given" },
{ "name" : "Elizabeth", "gender" : "female", "usage" : "given" },
{ "name" : "Ella", "gender" : "female", "usage" : "given" },
{ "name" : "Emily", "gender" : "female", "usage" : "given" },
{ "name" : "Emma", "gender" : "female", "usage" : "given" },
{ "name" : "Eric", "gender" : "male", "usage" : "given" },
{ "name" : "Ethan", "gender" : "male", "usage" : "given" },
{ "name" : "Evan", "gender" : "male", "usage" : "given" },
{ "name" : "Evans", "gender" : "unisex", "usage" : "family" },
{ "name" : "Evelyn", "gender" : "female", "usage" : "given" },
{ "name" : "Faith", "gender" : "female", "usage" : "given" },
{ "name" : "Flores", "gender" : "unisex", "usage" : "family" },
{ "name" : "Foster", "gender" : "unisex", "usage" : "family" },
{ "name" : "Gabriel", "gender" : "male", "usage" : "given" },
{ "name" : "Gabriella", "gender" : "female", "usage" : "given" },
{ "name" : "Gabrielle", "gender" : "female", "usage" : "given" },
{ "name" : "Garcia", "gender" : "unisex", "usage" : "family" },
{ "name" : "Gavin", "gender" : "male", "usage" : "given" },
{ "name" : "Genesis", "gender" : "female", "usage" : "given" },
{ "name" : "Gianna", "gender" : "female", "usage" : "given" },
{ "name" : "Gonzales", "gender" : "unisex", "usage" : "family" },
{ "name" : "Gonzalez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Grace", "gender" : "female", "usage" : "given" },
{ "name" : "Gracie", "gender" : "female", "usage" : "given" },
{ "name" : "Gray", "gender" : "unisex", "usage" : "family" },
{ "name" : "Green", "gender" : "unisex", "usage" : "family" },
{ "name" : "Griffin", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hailey", "gender" : "female", "usage" : "given" },
{ "name" : "Hall", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hannah", "gender" : "female", "usage" : "given" },
{ "name" : "Harris", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hayden", "gender" : "male", "usage" : "given" },
{ "name" : "Hayes", "gender" : "unisex", "usage" : "family" },
{ "name" : "Henderson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Henry", "gender" : "male", "usage" : "given" },
{ "name" : "Hernandez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hill", "gender" : "unisex", "usage" : "family" },
{ "name" : "Howard", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hughes", "gender" : "unisex", "usage" : "family" },
{ "name" : "Hunter", "gender" : "male", "usage" : "given" },
{ "name" : "Ian", "gender" : "male", "usage" : "given" },
{ "name" : "Isaac", "gender" : "male", "usage" : "given" },
{ "name" : "Isabel", "gender" : "female", "usage" : "given" },
{ "name" : "Isabella", "gender" : "female", "usage" : "given" },
{ "name" : "Isabelle", "gender" : "female", "usage" : "given" },
{ "name" : "Isaiah", "gender" : "male", "usage" : "given" },
{ "name" : "Jack", "gender" : "male", "usage" : "given" },
{ "name" : "Jackson", "gender" : "male", "usage" : "given" },
{ "name" : "Jackson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Jacob", "gender" : "male", "usage" : "given" },
{ "name" : "Jaden", "gender" : "male", "usage" : "given" },
{ "name" : "James", "gender" : "male", "usage" : "given" },
{ "name" : "James", "gender" : "unisex", "usage" : "family" },
{ "name" : "Jasmine", "gender" : "female", "usage" : "given" },
{ "name" : "Jason", "gender" : "male", "usage" : "given" },
{ "name" : "Jayden", "gender" : "male", "usage" : "given" },
{ "name" : "Jen", "gender" : "female", "usage" : "given" },
{ "name" : "Jenkins", "gender" : "unisex", "usage" : "family" },
{ "name" : "Jennifer", "gender" : "female", "usage" : "given" },
{ "name" : "Jeremiah", "gender" : "male", "usage" : "given" },
{ "name" : "Jessica", "gender" : "female", "usage" : "given" },
{ "name" : "Jessie", "gender" : "female", "usage" : "given" },
{ "name" : "Jesus", "gender" : "male", "usage" : "given" },
{ "name" : "Jocelyn", "gender" : "female", "usage" : "given" },
{ "name" : "John", "gender" : "male", "usage" : "given" },
{ "name" : "Johnson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Jonathan", "gender" : "male", "usage" : "given" },
{ "name" : "Jones", "gender" : "unisex", "usage" : "family" },
{ "name" : "Jordan", "gender" : "male", "usage" : "given" },
{ "name" : "Jose", "gender" : "male", "usage" : "given" },
{ "name" : "Joseph", "gender" : "male", "usage" : "given" },
{ "name" : "Joshua", "gender" : "male", "usage" : "given" },
{ "name" : "Josiah", "gender" : "male", "usage" : "given" },
{ "name" : "Juan", "gender" : "male", "usage" : "given" },
{ "name" : "Julia", "gender" : "female", "usage" : "given" },
{ "name" : "Julian", "gender" : "male", "usage" : "given" },
{ "name" : "Justin", "gender" : "male", "usage" : "given" },
{ "name" : "Kaden", "gender" : "male", "usage" : "given" },
{ "name" : "Kaitlin", "gender" : "female", "usage" : "given" },
{ "name" : "Katelyn", "gender" : "female", "usage" : "given" },
{ "name" : "Katie", "gender" : "female", "usage" : "given" },
{ "name" : "Kayla", "gender" : "female", "usage" : "given" },
{ "name" : "Kaylee", "gender" : "female", "usage" : "given" },
{ "name" : "Kelly", "gender" : "unisex", "usage" : "family" },
{ "name" : "Kevin", "gender" : "male", "usage" : "given" },
{ "name" : "Kim", "gender" : "female", "usage" : "given" },
{ "name" : "Kimberly", "gender" : "female", "usage" : "given" },
{ "name" : "King", "gender" : "unisex", "usage" : "family" },
{ "name" : "Kyle", "gender" : "male", "usage" : "given" },
{ "name" : "Kylie", "gender" : "female", "usage" : "given" },
{ "name" : "Landon", "gender" : "male", "usage" : "given" },
{ "name" : "Lauren", "gender" : "female", "usage" : "given" },
{ "name" : "Layla", "gender" : "female", "usage" : "given" },
{ "name" : "Leah", "gender" : "female", "usage" : "given" },
{ "name" : "Lee", "gender" : "unisex", "usage" : "family" },
{ "name" : "Lewis", "gender" : "unisex", "usage" : "family" },
{ "name" : "Liam", "gender" : "male", "usage" : "given" },
{ "name" : "Lillian", "gender" : "female", "usage" : "given" },
{ "name" : "Lily", "gender" : "female", "usage" : "given" },
{ "name" : "Logan", "gender" : "male", "usage" : "given" },
{ "name" : "Long", "gender" : "unisex", "usage" : "family" },
{ "name" : "Lopez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Lucas", "gender" : "male", "usage" : "given" },
{ "name" : "Luis", "gender" : "male", "usage" : "given" },
{ "name" : "Luke", "gender" : "male", "usage" : "given" },
{ "name" : "Madeline", "gender" : "female", "usage" : "given" },
{ "name" : "Madelyn", "gender" : "female", "usage" : "given" },
{ "name" : "Madison", "gender" : "female", "usage" : "given" },
{ "name" : "Makayla", "gender" : "female", "usage" : "given" },
{ "name" : "Maria", "gender" : "female", "usage" : "given" },
{ "name" : "Mariah", "gender" : "female", "usage" : "given" },
{ "name" : "Martin", "gender" : "unisex", "usage" : "family" },
{ "name" : "Martinez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Mary", "gender" : "female", "usage" : "given" },
{ "name" : "Mason", "gender" : "male", "usage" : "given" },
{ "name" : "Matthew", "gender" : "male", "usage" : "given" },
{ "name" : "Maya", "gender" : "female", "usage" : "given" },
{ "name" : "Megan", "gender" : "female", "usage" : "given" },
{ "name" : "Melanie", "gender" : "female", "usage" : "given" },
{ "name" : "Mia", "gender" : "female", "usage" : "given" },
{ "name" : "Michael", "gender" : "male", "usage" : "given" },
{ "name" : "Miller", "gender" : "unisex", "usage" : "family" },
{ "name" : "Mitchell", "gender" : "unisex", "usage" : "family" },
{ "name" : "Moore", "gender" : "unisex", "usage" : "family" },
{ "name" : "Morgan", "gender" : "female", "usage" : "given" },
{ "name" : "Morgan", "gender" : "unisex", "usage" : "family" },
{ "name" : "Morris", "gender" : "unisex", "usage" : "family" },
{ "name" : "Murphy", "gender" : "unisex", "usage" : "family" },
{ "name" : "Natalie", "gender" : "female", "usage" : "given" },
{ "name" : "Nathan", "gender" : "male", "usage" : "given" },
{ "name" : "Nathaniel", "gender" : "male", "usage" : "given" },
{ "name" : "Nelson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Nevaeh", "gender" : "female", "usage" : "given" },
{ "name" : "Nicholas", "gender" : "male", "usage" : "given" },
{ "name" : "Noah", "gender" : "male", "usage" : "given" },
{ "name" : "Olivia", "gender" : "female", "usage" : "given" },
{ "name" : "Owen", "gender" : "male", "usage" : "given" },
{ "name" : "Paige", "gender" : "female", "usage" : "given" },
{ "name" : "Parker", "gender" : "unisex", "usage" : "family" },
{ "name" : "Patterson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Payton", "gender" : "female", "usage" : "given" },
{ "name" : "Perez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Perry", "gender" : "unisex", "usage" : "family" },
{ "name" : "Peterson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Phillips", "gender" : "unisex", "usage" : "family" },
{ "name" : "Powell", "gender" : "unisex", "usage" : "family" },
{ "name" : "Price", "gender" : "unisex", "usage" : "family" },
{ "name" : "Rachel", "gender" : "female", "usage" : "given" },
{ "name" : "Ramirez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Reed", "gender" : "unisex", "usage" : "family" },
{ "name" : "Richardson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Riley", "gender" : "female", "usage" : "given" },
{ "name" : "Rivera", "gender" : "unisex", "usage" : "family" },
{ "name" : "Robert", "gender" : "male", "usage" : "given" },
{ "name" : "Roberts", "gender" : "unisex", "usage" : "family" },
{ "name" : "Robinson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Rodriguez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Rogers", "gender" : "unisex", "usage" : "family" },
{ "name" : "Ross", "gender" : "unisex", "usage" : "family" },
{ "name" : "Russell", "gender" : "unisex", "usage" : "family" },
{ "name" : "Ryan", "gender" : "male", "usage" : "given" },
{ "name" : "Sabastian", "gender" : "male", "usage" : "given" },
{ "name" : "Samantha", "gender" : "female", "usage" : "given" },
{ "name" : "Samuel", "gender" : "male", "usage" : "given" },
{ "name" : "Sanchez", "gender" : "unisex", "usage" : "family" },
{ "name" : "Sanders", "gender" : "unisex", "usage" : "family" },
{ "name" : "Sara", "gender" : "female", "usage" : "given" },
{ "name" : "Sarah", "gender" : "female", "usage" : "given" },
{ "name" : "Savannah", "gender" : "female", "usage" : "given" },
{ "name" : "Scott", "gender" : "unisex", "usage" : "family" },
{ "name" : "Sean", "gender" : "male", "usage" : "given" },
{ "name" : "Simmons", "gender" : "unisex", "usage" : "family" },
{ "name" : "Smith", "gender" : "unisex", "usage" : "family" },
{ "name" : "Sofia", "gender" : "female", "usage" : "given" },
{ "name" : "Sophie", "gender" : "female", "usage" : "given" },
{ "name" : "Sophie", "gender" : "female", "usage" : "given" },
{ "name" : "Stewart", "gender" : "unisex", "usage" : "family" },
{ "name" : "Sydney", "gender" : "female", "usage" : "given" },
{ "name" : "Taylor", "gender" : "unisex", "usage" : "family" },
{ "name" : "Thomas", "gender" : "male", "usage" : "given" },
{ "name" : "Thomas", "gender" : "unisex", "usage" : "family" },
{ "name" : "Thompson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Torres", "gender" : "unisex", "usage" : "family" },
{ "name" : "Trinity", "gender" : "female", "usage" : "given" },
{ "name" : "Tristan", "gender" : "male", "usage" : "given" },
{ "name" : "Turner", "gender" : "unisex", "usage" : "family" },
{ "name" : "Tyler", "gender" : "male", "usage" : "given" },
{ "name" : "Valeria", "gender" : "female", "usage" : "given" },
{ "name" : "Vanessa", "gender" : "female", "usage" : "given" },
{ "name" : "Victoria", "gender" : "female", "usage" : "given" },
{ "name" : "Walker", "gender" : "unisex", "usage" : "family" },
{ "name" : "Ward", "gender" : "unisex", "usage" : "family" },
{ "name" : "Washington", "gender" : "unisex", "usage" : "family" },
{ "name" : "Watson", "gender" : "unisex", "usage" : "family" },
{ "name" : "White", "gender" : "unisex", "usage" : "family" },
{ "name" : "William", "gender" : "male", "usage" : "given" },
{ "name" : "Williams", "gender" : "unisex", "usage" : "family" },
{ "name" : "Wilson", "gender" : "unisex", "usage" : "family" },
{ "name" : "Wood", "gender" : "unisex", "usage" : "family" },
{ "name" : "Wright", "gender" : "unisex", "usage" : "family" },
{ "name" : "Wyatt", "gender" : "male", "usage" : "given" },
{ "name" : "Xavier", "gender" : "male", "usage" : "given" },
{ "name" : "Young", "gender" : "unisex", "usage" : "family" },
{ "name" : "Zachary", "gender" : "male", "usage" : "given" },
{ "name" : "Zoe", "gender" : "female", "usage" : "given" },
{ "name" : "Zoey", "gender" : "female", "usage" : "given" }
]
+142
View File
@@ -0,0 +1,142 @@
[
[
"null",
"null",
"The skill of true Zen."
],
[
"dodge",
"dodge",
"Your skill at dodging, whether it be from an attack, a trap, or a natural\noccurrence. It is also used when attempting to fall gracefully, or in other\nacrobatic feats."
],
[
"melee",
"melee",
"Your skill at hand-to-hand combat, both with and without a weapon. At low\nlevels this merely increases your chance to hit, but at higher levels it also\nincreases the damage done significantly."
],
[
"unarmed",
"unarmed combat",
"Your skill at combat without a weapon. While at low levels, unarmed combat is\na good way to die quickly, those skilled in it can eventually use throws and\ncrushing blows to quickly dispatch enemies."
],
[
"bashing",
"bashing weapons",
"Your skill at combat with weapons that club or bash your enemies. This\nincludes everything from rocks to baseball bats, and even the butt of rifles.\nThis increases damage, and at higher levels will improve your chance to hit."
],
[
"cutting",
"cutting weapons",
"Your skill at combat with weapons that cut or slice your enemies. At first\nthis will simply slightly increase accuracy and damage; later on it will\nhelp you bypass armor and thick hides."
],
[
"stabbing",
"piercing weapons",
"Your skill at combat that involves piercing weapons. This includes spears,\nwhich only have a stabbing attack, and things like knives, which can cut or\npierce. This increases your accuracy and chance of a deadly critical."
],
[
"throw",
"throwing",
"Your skill at throwing items and getting them to go where you want. Increases\nboth accuracy and, at higher levels, range."
],
[
"gun",
"firearms",
"Your general skill at firearms. This increases your accuracy with any gun,\nbut not as much as the skill associated with the gun in question."
],
[
"pistol",
"handguns",
"Your skill with handguns. These have poor accuracy, but generally are fired\nand reloaded faster than other guns, and are good in close quarters."
],
[
"shotgun",
"shotguns",
"Your skill with shotguns. Shot is easy to hit with, and does massive damage,\nbut has short range. Shotguns may also be loaded with slugs, which go further\nand do as much damage, but are not very accurate."
],
[
"smg",
"submachine guns",
"Your skill with submachine guns and machine pistols. Halfway between a pistol\nand an assault rifle, these weapons fire and reload quickly, and may fire in\nbursts, but they are not very accurate."
],
[
"rifle",
"rifles",
"Your skill with rifles, both assault rifles and semi-auto hunting rifles.\nThese have terrific range and accuracy, but are very slow to fire and reload,\nand are not very good in close quarters."
],
[
"archery",
"archery",
"Your skill with all kinds of bows, from crossbows to handmade long bows.\nThese are quiet, but require some amount of strength to use, and are not\nterribly accurate. They can only be deadly in skilled hands."
],
[
"launcher",
"grenade launcher",
"Your skill with grenade launchers, whether standalone or as a rifle mod.\nThese launchers fire a variety of 40mm grenades with different uses,\nbut they and their rounds are hard to find."
],
[
"computer",
"computers",
"Your skill with computers, both in terms of legitimate use, and hacking. This\nwill help you use complex systems, and bypass their security."
],
[
"mechanics",
"mechanics",
"Your skill with repairs to mechanical systems, and the crafting of many items\nthat use complex parts, but are not electronics."
],
[
"electronics",
"electronics",
"Your skill with repairs to electrical systems, and the crafting of many items\nthat use electrical parts."
],
[
"cooking",
"cooking",
"Your skill in combining food ingredients to make other, tastier food items.\nThis may also be used in mixing chemicals and other more esoteric tasks."
],
[
"carpentry",
"construction",
"Your general knowledge in construction. This is used primarily when building\nterrain, via the * screen."
],
[
"survival",
"survival",
"Your skill in wilderness survival. This helps you butcher meat from a corpse\nand craft various basic survival items. High levels may allow you to remove\npoison from tainted meat. Also used for skinning corpses to acquire pelts."
],
[
"traps",
"traps",
"Your skill at setting and disarming traps safely and effectively. Note that\nthis does not help you detect traps, or avoid their effects if you activate\nthem."
],
[
"tailor",
"tailoring",
"Your skill at repairing clothing, and at higher levels, creating clothing\nfrom basic materials. Generally a sewing kit is needed. Also applies to\nother methods of clothing repair and textile crafting."
],
[
"firstaid",
"first aid",
"Your skill at emergency medical treatment, such as that from first aid kits\nand bandages. High levels of this skill may help heal more HP. Some drugs\nmay be more effective as well."
],
[
"speech",
"speech",
"Your skill at talking to people, convincing them of things, lying, and many\nothers. Works best in conjunction with a high intelligence."
],
[
"barter",
"barter",
"Your skill at getting a good deal when trading with others. Very high levels\nmight even see you getting freebies."
],
[
"swimming",
"swimming",
"Your skill at swimming. This affects speed, your ability to swim while\nwearing clothes or carrying weights, and in-water combat."
],
[
"driving",
"driving",
"Your skill at driving. This affects how well you can control a vehicle,\nas well as the penalty of shooting while driving."
]
]
BIN
View File
Binary file not shown.
+217
View File
@@ -0,0 +1,217 @@
#include "debug.h"
#include <time.h>
#if !(defined _WIN32 || defined WINDOWS || defined __CYGWIN__)
#include <execinfo.h>
#include <stdlib.h>
#endif
// Static defines {{{1
// ---------------------------------------------------------------------
static int debugLevel = DL_ALL;
static int debugClass = DC_ALL;
// Normal functions {{{1
// ---------------------------------------------------------------------
void setupDebug()
{
int level = 0;
#ifdef DEBUG_INFO
level |= D_INFO;
#endif
#ifdef DEBUG_WARNING
level |= D_WARNING;
#endif
#ifdef DEBUG_ERROR
level |= D_ERROR;
#endif
#ifdef DEBUG_PEDANTIC_INFO
level |= D_PEDANTIC_INFO;
#endif
if( level != 0 )
limitDebugLevel(level);
int cl = 0;
#ifdef DEBUG_ENABLE_MAIN
cl |= D_MAIN;
#endif
#ifdef DEBUG_ENABLE_MAP
cl |= D_MAP;
#endif
#ifdef DEBUG_ENABLE_MAP_GEN
cl |= D_MAP_GEN;
#endif
#ifdef DEBUG_ENABLE_GAME
cl |= D_GAME;
#endif
if( cl != 0 )
limitDebugClass(cl);
}
void limitDebugLevel( int i )
{
dout() << "Set debug level to: " << (DebugLevel)i;
debugLevel = i;
}
void limitDebugClass( int i )
{
dout() << "Set debug class to: " << (DebugClass)i;
debugClass = i;
}
// Debug only {{{1
// ---------------------------------------------------------------------
#ifdef ENABLE_LOGGING
#define TRACE_SIZE 20
void* tracePtrs[TRACE_SIZE];
// Debug Includes {{{2
// ---------------------------------------------------------------------
#include <fstream>
#include <streambuf>
// Null OStream {{{2
// ---------------------------------------------------------------------
struct NullBuf : public std::streambuf
{
NullBuf() {}
int overflow(int c) { return c; }
};
struct DebugFile
{
DebugFile();
~DebugFile();
std::ofstream & currentTime();
std::ofstream file;
};
static NullBuf nullBuf;
static std::ostream nullStream(&nullBuf);
// DebugFile OStream Wrapper {{{2
// ---------------------------------------------------------------------
static DebugFile debugFile;
DebugFile::DebugFile()
{
file.open("data/debug.txt", std::ios::out | std::ios::app );
file << "\n\n-----------------------------------------\n";
currentTime() << " : Starting log.";
}
DebugFile::~DebugFile()
{
file << "\n";
currentTime() << " : Log shutdown.\n";
file << "-----------------------------------------\n\n";
file.close();
}
// OStream Operators {{{2
// ---------------------------------------------------------------------
std::ostream & operator<<(std::ostream & out, DebugLevel lev)
{
if( lev != DL_ALL )
{
if( lev & D_INFO )
out << "INFO ";
if( lev & D_WARNING )
out << "WARNING ";
if( lev & D_ERROR )
out << "ERROR ";
if( lev & D_PEDANTIC_INFO )
out << "PEDANTIC ";
}
return out;
}
std::ostream & operator<<(std::ostream & out, DebugClass cl)
{
if( cl != DC_ALL )
{
if( cl & D_MAIN )
out << "MAIN ";
if( cl & D_MAP )
out << "MAP ";
}
return out;
}
std::ofstream & DebugFile::currentTime()
{
struct tm *current;
time_t now;
time(&now);
current = localtime(&now);
file << current->tm_hour << ":" << current->tm_min << ":" <<
current->tm_sec;
return file;
}
std::ostream & dout(DebugLevel lev,DebugClass cl)
{
if( (lev & debugLevel) && (cl & debugClass) )
{
debugFile.file << std::endl;
debugFile.currentTime() << " ";
if( lev != debugLevel )
debugFile.file << lev;
if( cl != debugClass )
debugFile.file << cl;
debugFile.file << ": ";
// Backtrace on error.
#if !(defined _WIN32 || defined WINDOWS)
if( lev == D_ERROR )
{
int count = backtrace( tracePtrs, TRACE_SIZE );
char** funcNames = backtrace_symbols( tracePtrs, count );
for(int i = 0; i < count; ++i)
debugFile.file << "\n\t(" << funcNames[i] << "), ";
debugFile.file << "\n\t";
free(funcNames);
}
#endif
return debugFile.file;
}
return nullStream;
}
// Non Debug Only {{{1
// ---------------------------------------------------------------------
#else // If NOT defined ENABLE_LOGGING
DebugVoid dout(DebugLevel,DebugClass)
{ return DebugVoid(); }
#endif // END If NOT defined ENABLE_LOGGING
// vim:tw=72:sw=1:fdm=marker:fdl=0:
+105
View File
@@ -0,0 +1,105 @@
#ifndef DEBUG_H_1YCYLZSS
#define DEBUG_H_1YCYLZSS
// Includes {{{1
// ---------------------------------------------------------------------
#include <iostream>
#include <vector>
#include <fstream>
// Enumerations {{{1
// ---------------------------------------------------------------------
enum DebugLevel
{
D_INFO = 1,
D_WARNING = 1<<2,
D_ERROR = 1<<3,
D_PEDANTIC_INFO = 1<<4,
DL_ALL = (1<<5)-1
};
enum DebugClass
{
D_MAIN = 1,
D_MAP = 1<<2,
D_MAP_GEN = 1<<3,
D_GAME = 1<<4,
D_NPC = 1<<5,
DC_ALL = (1<<6)-1
};
void setupDebug();
// Function Declatations {{{1
// ---------------------------------------------------------------------
void limitDebugLevel( int );
void limitDebugClass( int );
// Debug Only {{{1
// ---------------------------------------------------------------------
#ifdef ENABLE_LOGGING
std::ostream & dout(DebugLevel=DL_ALL,DebugClass=DC_ALL);
#else // if NOT defined ENABLE_LOGGING
// Non debug only {{{1
// ---------------------------------------------------------------------
struct DebugVoid {};
template<class T>
DebugVoid operator<< ( const DebugVoid & dv, const T & )
{ return dv; }
DebugVoid dout(DebugLevel=DL_ALL,DebugClass=DC_ALL);
#endif // END if NOT defined ENABLE_LOGGING
// OStream operators {{{1
// ---------------------------------------------------------------------
template<typename C, typename A>
std::ostream & operator<<(std::ostream & out, const std::vector<C,A> & elm)
{
bool first = true;
for( typename std::vector<C>::const_iterator
it = elm.begin(),
end = elm.end();
it != end; ++it )
{
if( first )
first = false;
else
out << ",";
out << *it;
}
return out;
}
struct DebugLog
{
DebugLog() {
fout.open("logg.txt", std::ios_base::app | std::ios_base::out);
}
~DebugLog() {
fout.close();
}
template <class T>
DebugLog& operator<<(T& t) {
fout << t;
return *this;
}
private:
std::ofstream fout;
};
// vim:tw=72:sw=1:fdm=marker:fdl=0:
#endif /* end of include guard: DEBUG_H_1YCYLZSS */
+1311
View File
File diff suppressed because it is too large Load Diff
+341 -31
View File
@@ -1,3 +1,6 @@
#ifndef _DIALOGUE_H_
#define _DIALOGUE_H_
#include "player.h"
#include "output.h"
#include "npc.h"
@@ -10,51 +13,157 @@ struct dialogue {
WINDOW *win;
bool done;
std::vector<std::string> history;
std::vector<talk_topic> topic_stack;
int opt(std::string challenge, ...);
talk_topic opt(talk_topic topic, game *g);
dialogue()
{
alpha = NULL;
beta = NULL;
win = NULL;
done = false;
}
};
std::string talk_okay[10] = {
"okay", "get it", "you dig", "dig", "got it", "you see", "see, <name_g>",
"savvy", "that clear"};
struct talk_function
{
void nothing (game *g, npc *p) {};
void assign_mission (game *g, npc *p);
void mission_success (game *g, npc *p);
void mission_failure (game *g, npc *p);
void clear_mission (game *g, npc *p);
void mission_reward (game *g, npc *p);
void mission_favor (game *g, npc *p);
void give_equipment (game *g, npc *p);
void start_trade (game *g, npc *p);
void follow (game *g, npc *p); // p follows u
void deny_follow (game *g, npc *p); // p gets DI_ASKED_TO_FOLLOW
void deny_lead (game *g, npc *p); // p gets DI_ASKED_TO_LEAD
void deny_equipment (game *g, npc *p); // p gets DI_ASKED_FOR_ITEM
void enslave (game *g, npc *p) {}; // p becomes slave of u
void hostile (game *g, npc *p); // p turns hostile to u
void flee (game *g, npc *p);
void leave (game *g, npc *p); // p becomes indifferant
std::string talk_bad_names[10] = {
"punk", "bitch", "mark", "asshole", "fucker",
"sucker", "fuckwad", "fuckface", "motherfucker", "shithead"};
void start_mugging (game *g, npc *p);
void player_leaving (game *g, npc *p);
std::string talk_good_names[10] = {
"stranger", "friend", "pilgrim", "traveler", "pal",
"fella", "you", "dude", "buddy", "man"};
void drop_weapon (game *g, npc *p);
void player_weapon_away (game *g, npc *p);
void player_weapon_drop (game *g, npc *p);
std::string talk_greeting_gen[10] = {
"Hey <name_g>.", "Greetings <name_g>.", "Hi <name_g><punc> You okay?",
"<name_g><punc> Let's talk.", "Well hey there.",
"<name_g><punc> Hello.", "What's up, <name_g>?", "You okay, <name_g>?",
"Hello, <name_g>.", "Hi <name_g>"};
void lead_to_safety (game *g, npc *p);
void start_training (game *g, npc *p);
std::string ill_die[10] = {
"I'm not gonna last much longer", "I'll be dead soon", "I'll be a goner",
"I'm dead, <name_g>,", "I'm dead meat", "I'm in serious trouble", "I'm doomed",
"I'm done for", "I won't last much longer", "my days are numbered"};
void toggle_use_guns (game *g, npc *p);
void toggle_use_grenades (game *g, npc *p);
void set_engagement_none (game *g, npc *p);
void set_engagement_close (game *g, npc *p);
void set_engagement_weak (game *g, npc *p);
void set_engagement_hit (game *g, npc *p);
void set_engagement_all (game *g, npc *p);
};
enum talk_trial
{
TALK_TRIAL_NONE, // No challenge here!
TALK_TRIAL_LIE, // Straight up lying
TALK_TRIAL_PERSUADE, // Convince them
TALK_TRIAL_INTIMIDATE, // Physical intimidation
NUM_TALK_TRIALS
};
std::string talk_trial_text[NUM_TALK_TRIALS] = {
"", "LIE", "PERSUADE", "INTIMIDATE"
};
struct talk_response
{
std::string text;
talk_trial trial;
int difficulty;
int mission_index;
mission_id miss; // If it generates a new mission
int tempvalue; // Used for various stuff
npc_opinion opinion_success;
npc_opinion opinion_failure;
void (talk_function::*effect_success)(game *, npc *);
void (talk_function::*effect_failure)(game *, npc *);
talk_topic success;
talk_topic failure;
talk_response()
{
text = "";
trial = TALK_TRIAL_NONE;
difficulty = 0;
mission_index = -1;
miss = MISSION_NULL;
tempvalue = -1;
effect_success = &talk_function::nothing;
effect_failure = &talk_function::nothing;
opinion_success = npc_opinion();
opinion_failure = npc_opinion();
success = TALK_NONE;
failure = TALK_NONE;
}
talk_response(const talk_response &rhs)
{
text = rhs.text;
trial = rhs.trial;
difficulty = rhs.difficulty;
mission_index = rhs.mission_index;
miss = rhs.miss;
tempvalue = rhs.tempvalue;
effect_success = rhs.effect_success;
effect_failure = rhs.effect_failure;
opinion_success = rhs.opinion_success;
opinion_failure = rhs.opinion_failure;
success = rhs.success;
failure = rhs.failure;
}
};
struct talk_response_list
{
std::vector<talk_response> none(game *g, npc *p);
std::vector<talk_response> shelter(game *g, npc *p);
std::vector<talk_response> shopkeep(game *g, npc *p);
};
/* There is a array of tag_data, "tags", at the bottom of this file.
* It maps tags to the array of string replacements;
* e.g. "<name_g>" => talk_good_names
* Other tags, like "<yrwp>", are mapped to dynamic things
* (like the player's weapon), and are defined in parse_tags() (npctalk.cpp)
*/
struct tag_data
{
std::string tag;
std::string (*replacement)[10];
};
std::string talk_needs[num_needs][5] = {
{"", "", "", "", ""},
{"Hey<punc> You got any <ammo>?", "I'll need some <ammo> soon, got any?",
"I really need some <ammo><punc>", "I need <ammo> for my <mywp>, got any?",
"I need some <ammo> bad<punc>"},
"I need some <ammo> <very> bad<punc>"},
{"Got anything I can use as a weapon?",
"<ill_die> without a good weapon<punc>",
"I'm sick of fighting with my <mywp>, got something better?",
"I'm sick of fighting with my <swear> <mywp>, got something better?",
"Hey <name_g>, care to sell me a weapon?",
"My <mywp> just won't cut it, I need a real weapon..."},
{"Hey <name_g>, I could really use a gun.",
"Hey, you got a spare gun? It'd be better than my <mywp><punc>",
"Hey, you got a spare gun? It'd be better than my <swear> <mywp><punc>",
"<ill_die> if I don't find a gun soon!",
"<name_g><punc> Feel like selling me a gun?",
"I need a gun, any kind will do!"},
{"I could use some food, here.", "I need some food, real bad!",
"Man, am I glad to see you! Got any food to trade?",
"<ill_die> unless I get some food in me... got any?",
{"I could use some food, here.", "I need some food, <very> bad!",
"Man, am I <happy> to see you! Got any food to trade?",
"<ill_die> unless I get some food in me<punc> <okay>?",
"Please tell me you have some food to trade!"},
{"Got anything to drink?", "I need some water or something.",
"<name_g>, I need some water... got any?",
@@ -66,21 +175,83 @@ std::string talk_needs[num_needs][5] = {
*/
};
std::string talk_drop_weap[10] = {
"Drop your weapon!",
std::string talk_okay[10] = {
"okay", "get it", "you dig", "dig", "got it", "you see", "see, <name_g>",
"alright", "that clear"};
std::string talk_no[10] = {
"no", "fuck no", "hell no", "no way", "not a chance",
"I don't think so", "no way in hell", "nuh uh", "nope", "fat chance"};
std::string talk_bad_names[10] = {
"punk", "bitch", "dickhead", "asshole", "fucker",
"sucker", "fuckwad", "cocksucker", "motherfucker", "shithead"};
std::string talk_good_names[10] = {
"stranger", "friend", "pilgrim", "traveler", "pal",
"fella", "you", "dude", "buddy", "man"};
std::string talk_swear[10] = { // e.g. "drop the <swear> weapon"
"fucking", "goddamn", "motherfucking", "freaking", "damn", "<swear> <swear>",
"fucking", "fuckin'", "god damn", "mafuckin'"};
std::string talk_swear_interjection[10] = {
"fuck", "damn", "damnit", "shit", "cocksucker", "crap",
"motherfucker", "<swear><punc> <swear!>", "<very> <swear!>", "son of a bitch"};
std::string talk_fuck_you[10] = {
"fuck you", "fuck off", "go fuck yourself", "<fuck_you>, <name_b>",
"<fuck_you>, <swear> <name_b>", "<name_b>", "<swear> <name_b>",
"fuck you", "fuck off", "go fuck yourself"};
std::string talk_very[10] = { // Synonyms for "very" -- applied to adjectives
"really", "fucking", "super", "wicked", "very", "mega", "uber", "ultra",
"so <very>", "<very> <very>"};
std::string talk_really[10] = { // Synonyms for "really" -- applied to verbs
"really", "fucking", "absolutely", "definitely", "for real", "honestly",
"<really> <really>", "most <really>", "urgently", "REALLY"};
std::string talk_happy[10] = {
"glad", "happy", "overjoyed", "ecstatic", "thrilled", "stoked",
"<very> <happy>", "tickled pink", "delighted", "pumped"};
std::string talk_sad[10] = {
"sad", "bummed", "depressed", "pissed", "unhappy", "<very> <sad>", "dejected",
"down", "blue", "glum"};
std::string talk_greeting_gen[10] = {
"Hey <name_g>.", "Greetings <name_g>.", "Hi <name_g><punc> You okay?",
"<name_g><punc> Let's talk.", "Well hey there.",
"<name_g><punc> Hello.", "What's up, <name_g>?", "You okay, <name_g>?",
"Hello, <name_g>.", "Hi <name_g>"};
std::string talk_ill_die[10] = {
"I'm not gonna last much longer", "I'll be dead soon", "I'll be a goner",
"I'm dead, <name_g>,", "I'm dead meat", "I'm in <very> serious trouble",
"I'm <very> doomed", "I'm done for", "I won't last much longer",
"my days are <really> numbered"};
std::string talk_ill_kill_you[10] = {
"I'll kill you", "you're dead", "I'll <swear> kill you", "you're dead meat",
"<ill_kill_you>, <name_b>", "you're a dead <man>", "you'll taste my <mywp>",
"you're <swear> dead", "<name_b>, <ill_kill_you>"};
std::string talk_drop_weapon[10] = {
"Drop your <swear> weapon!",
"Okay <name_b>, drop your weapon!",
"Put your weapon down!",
"Put your <swear> weapon down!",
"Drop the <yrwp>, <name_b>!",
"Drop the <yrwp>!",
"Drop the <swear> <yrwp>!",
"Drop your <yrwp>!",
"Put down the <yrwp>!",
"Drop your weapon, <name_b>!",
"Drop your <swear> weapon, <name_b>!",
"Put down your <yrwp>!",
"Alright, drop the <yrwp>!"
};
std::string talk_hands_up[10] = {
"Put your hands up!",
"Put your <swear> hands up!",
"Put your hands up, <name_b>!",
"Reach for the sky!",
"Hands up!",
@@ -102,5 +273,144 @@ std::string talk_no_faction[10] = {
"I'm a free agent, more money that way.",
"I prefer to work uninhibited by that kind of connection.",
"I haven't found one that's good enough for me.",
"I don't belong to a faction, <name_g>"
"I don't belong to a faction, <name_g>."
};
std::string talk_come_here[10] = {
"Wait up, let's talk!",
"Hey, I <really> want to talk to you!",
"Come on, talk to me!",
"Hey <name_g>, let's talk!",
"<name_g>, we <really> need to talk!",
"Hey, we should talk, <okay>?",
"<name_g>! Wait up!",
"Wait up, <okay>?",
"Let's talk, <name_g>!",
"Look, <name_g><punc> let's talk!"
};
std::string talk_keep_up[10] = {
"Catch up!",
"Get over here!",
"Catch up, <name_g>!",
"Keep up!",
"Come on, <catch_up>!",
"Keep it moving!",
"Stay with me!",
"Keep close!",
"Stay close!",
"Let's keep going!"
};
std::string talk_wait[10] = {
"Hey, where are you?",
"Wait up, <name_g>!",
"<name_g>, wait for me!",
"Hey, wait up, <okay>?",
"You <really> need to wait for me!",
"You <swear> need to wait!",
"<name_g>, where are you?",
"Hey <name_g><punc> Wait for me!",
"Where are you?!",
"Hey, I'm over here!"
};
std::string talk_let_me_pass[10] = {
"Excuse me, let me pass.",
"Hey <name_g>, can I get through?",
"Let me get past you, <name_g>.",
"Let me through, <okay>?",
"Can I get past you, <name_g>?",
"I need to get past you, <name_g>.",
"Move your <swear> ass, <name_b>!",
"Out of my way, <name_b>!",
"Move it, <name_g>!",
"You need to move, <name_g>, <okay>?"
};
// Used to tell player to move to avoid friendly fire
std::string talk_move[10] = {
"Move",
"Move your ass",
"Get out of the way",
"You need to move"
"Hey <name_g>, move",
"<swear> move it",
"Move your <swear> ass",
"Get out of my way, <name_b>,",
"Move to the side",
"Get out of my line of fire"
};
std::string talk_done_mugging[10] = {
"Thanks for the cash, <name_b>!",
"So long, <name_b>!",
"Thanks a lot, <name_g>!",
"Catch you later, <name_g>!",
"See you later, <name_b>!",
"See you in hell, <name_b>!",
"Hasta luego, <name_g>!",
"I'm outta here! <done_mugging>",
"Bye bye, <name_b>!",
"Thanks, <name_g>!"
};
std::string talk_leaving[10] = {
"So long, <name_b>!",
"Hasta luego, <name_g>!",
"I'm outta here!",
"Bye bye, <name_b>!",
"So long, <name_b>!",
"Hasta luego, <name_g>!",
"I'm outta here!",
"Bye bye, <name_b>!",
"I'm outta here!",
"Bye bye, <name_b>!"
};
std::string talk_catch_up[10] = {
"You're too far away, <name_b>!",
"Hurry up, <name_g>!",
"I'm outta here soon!",
"Come on molasses!",
"What's taking so long?",
"Get with the program laggard!",
"Did the zombies get you?",
"Wait up <name_b>!",
"Did you evolve from a snail?",
"How 'bout picking up the pace!"
};
#define NUM_STATIC_TAGS 26
tag_data talk_tags[NUM_STATIC_TAGS] = {
{"<okay>", &talk_okay},
{"<no>", &talk_no},
{"<name_b>", &talk_bad_names},
{"<name_g>", &talk_good_names},
{"<swear>", &talk_swear},
{"<swear!>", &talk_swear_interjection},
{"<fuck_you>", &talk_fuck_you},
{"<very>", &talk_very},
{"<really>", &talk_really},
{"<happy>", &talk_happy},
{"<sad>", &talk_sad},
{"<greet>", &talk_greeting_gen},
{"<ill_die>", &talk_ill_die},
{"<ill_kill_you>", &talk_ill_kill_you},
{"<drop_it>", &talk_drop_weapon},
{"<hands_up>", &talk_hands_up},
{"<no_faction>", &talk_no_faction},
{"<come_here>", &talk_come_here},
{"<keep_up>", &talk_keep_up},
{"<lets_talk>", &talk_come_here},
{"<wait>", &talk_wait},
{"<let_me_pass>", &talk_let_me_pass},
{"<move>", &talk_move},
{"<done_mugging>", &talk_done_mugging},
{"<catch_up>", &talk_catch_up},
{"<im_leaving_you>", &talk_leaving}
};
#endif
+1518
View File
File diff suppressed because it is too large Load Diff
Regular → Executable
+9 -638
View File
@@ -6,647 +6,18 @@
#include "bodypart.h"
#include <sstream>
#define MIN_DISEASE_AGE (-43200) // Permanent disease capped @ 3 days
struct game;
void dis_msg(game *g, dis_type type)
{
switch (type) {
case DI_HEATSTROKE:
g->add_msg("You have heatstroke!");
break;
case DI_FBFACE:
g->add_msg("Your face is frostbitten.");
break;
case DI_FBHANDS:
g->add_msg("Your hands are frostbitten.");
break;
case DI_FBFEET:
g->add_msg("Your feet are frostbitten.");
break;
case DI_ONFIRE:
g->add_msg("You're on fire!");
break;
case DI_SMOKE:
g->add_msg("You inhale a lungful of thick smoke.");
break;
case DI_TEARGAS:
g->add_msg("You inhale a lungful of tear gas.");
break;
case DI_BOOMERED:
g->add_msg("You're covered in bile!");
break;
case DI_SPORES:
g->add_msg("You're covered in tiny spores!");
break;
case DI_SLIMED:
g->add_msg("You're covered in thick goo!");
break;
case DI_LYING_DOWN:
g->add_msg("You lie down to go to sleep...");
break;
case DI_DRUNK:
case DI_HIGH:
g->add_msg("You feel lightheaded.");
break;
case DI_ADRENALINE:
g->add_msg("You feel a surge of adrenaline!");
g->u.moves += 800;
break;
case DI_ASTHMA:
g->add_msg("You can't breathe... asthma attack!");
break;
case DI_BLIND:
g->add_msg("You're blinded!");
break;
}
}
void dis_effect(game *g, player &p, disease &dis)
{
int bonus;
int junk;
switch (dis.type) {
case DI_HEATSTROKE:
p.moves -= 15;
p.str_cur -= 2;
p.per_cur -= 1;
p.int_cur -= 2;
break;
case DI_FBFACE:
p.per_cur -= 2;
break;
case DI_FBHANDS:
p.dex_cur -= 4;
break;
case DI_FBFEET:
p.moves -= 40;
p.str_cur -= 1;
break;
case DI_SMOKE:
p.str_cur--;
p.dex_cur--;
if (one_in(5)) {
if (!p.is_npc()) {
g->add_msg("You cough heavily.");
g->sound(p.posx, p.posy, 12, "");
} else
g->sound(p.posx, p.posy, 12, "a hacking cough.");
p.moves -= 80;
p.hurt(g, bp_torso, 0, 1 - (rng(0, 1) * rng(0, 1)));
}
break;
case DI_TEARGAS:
p.str_cur -= 2;
p.dex_cur -= 2;
p.int_cur -= 1;
p.per_cur -= 4;
if (one_in(3)) {
if (!p.is_npc()) {
g->add_msg("You cough heavily.");
g->sound(p.posx, p.posy, 12, "");
} else
g->sound(p.posx, p.posy, 12, "a hacking cough");
p.moves -= 100;
p.hurt(g, bp_torso, 0, rng(0, 3) * rng(0, 1));
}
break;
case DI_ONFIRE:
p.hurtall(3);
for (int i = 0; i < p.worn.size(); i++) {
if (p.worn[i].made_of(VEGGY) || p.worn[i].made_of(PAPER) ||
p.worn[i].made_of(PAPER)) {
p.worn.erase(p.worn.begin() + i);
i--;
} else if ((p.worn[i].made_of(COTTON) || p.worn[i].made_of(WOOL)) &&
one_in(10)) {
p.worn.erase(p.worn.begin() + i);
i--;
} else if (p.worn[i].made_of(PLASTIC) && one_in(50)) {
p.worn.erase(p.worn.begin() + i);
i--;
}
}
break;
case DI_BOOMERED:
p.per_cur -= 5;
break;
case DI_SPORES:
p.moves -= 40;
if (one_in(30))
p.add_disease(DI_FUNGUS, -1, g);
break;
case DI_FUNGUS:
bonus = 0;
if (p.has_trait(PF_POISRESIST))
bonus = 100;
p.moves -= 10;
p.str_cur -= 1;
p.dex_cur -= 1;
if (dis.duration > -600) { // First hour symptoms
if (one_in(160 + bonus)) {
if (!p.is_npc()) {
g->add_msg("You cough heavily.");
g->sound(p.posx, p.posy, 12, "");
} else
g->sound(p.posx, p.posy, 12, "a hacking cough");
p.pain++;
}
if (one_in(100 + bonus)) {
if (!p.is_npc())
g->add_msg("You feel nauseous.");
}
if (one_in(100 + bonus)) {
if (!p.is_npc())
g->add_msg("You smell and taste mushrooms.");
}
} else if (dis.duration > -3600) { // One to six hours
if (one_in(600 + bonus * 3)) {
if (!p.is_npc())
g->add_msg("You spasm suddenly!");
p.moves = 0;
p.hurt(g, bp_torso, 0, 5);
}
if ((p.has_trait(PF_WEAKSTOMACH) && one_in(1600 + bonus * 8)) ||
one_in(2000 + bonus * 10)) {
if (!p.is_npc())
g->add_msg("You vomit a thick, gray goop.");
else if (g->u_see(p.posx, p.posy, junk))
g->add_msg("%s vomits a thick, gray goop.", p.name.c_str());
p.moves = -200;
p.hunger += 50;
p.thirst += 68;
}
} else { // Full symptoms
if (one_in(1000 + bonus * 8)) {
if (!p.is_npc())
g->add_msg("You double over, spewing live spores from your mouth!");
else if (g->u_see(p.posx, p.posy, junk))
g->add_msg("%s coughs up a stream of live spores!", p.name.c_str());
p.moves = -500;
int sporex, sporey;
monster spore(g->mtypes[mon_spore]);
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
sporex = p.posx + i;
sporey = p.posy + j;
if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
if (g->mon_at(sporex, sporey) >= 0) { // Spores hit a monster
if (g->u_see(sporex, sporey, junk))
g->add_msg("The %s is covered in tiny spores!",
g->z[g->mon_at(sporex, sporey)].name().c_str());
if (!g->z[g->mon_at(sporex, sporey)].make_fungus(g))
g->kill_mon(g->mon_at(sporex, sporey));
} else {
spore.spawn(sporex, sporey);
g->z.push_back(spore);
}
}
}
}
} else if (one_in(6000 + bonus * 20)) {
if (!p.is_npc())
g->add_msg("Fungus stalks burst through your hands!");
else if (g->u_see(p.posx, p.posy, junk))
g->add_msg("Fungus stalks burst through %s's hands!", p.name.c_str());
p.hurt(g, bp_arms, 0, 60);
p.hurt(g, bp_arms, 1, 60);
}
}
break;
case DI_SLIMED:
p.moves -= 30;
if (p.moves < 1)
p.moves = 1;
p.dex_cur -= 2;
break;
case DI_LYING_DOWN:
p.moves = 0;
if (p.can_sleep(g)) {
dis.duration = 1;
if (!p.is_npc())
g->add_msg("You fall asleep.");
p.add_disease(DI_SLEEP, 6000, g);
}
if (dis.duration == 1 && !p.has_disease(DI_SLEEP))
if (!p.is_npc())
g->add_msg("You try to sleep, but can't...");
break;
case DI_SLEEP:
p.moves = 0;
if (g->turn % 25 == 0) {
if (p.fatigue > 0)
p.fatigue -= rng(1, 2);
if (p.has_trait(PF_FASTHEALER) && one_in(2))
p.healall(rng(0, 1)); // Sum chance of 1/4, PLUS normal rate
else
p.healall(rng(0, 1) * rng(0, 1) * rng(0, 1));
if (p.fatigue <= 0 && p.fatigue > -20) {
p.fatigue = -25;
g->add_msg("Fully rested.");
dis.duration = dice(3, 100);
}
}
if (g->turn % 100 == 0) {
// Hunger and thirst advance more slowly while we sleep.
p.hunger--;
p.thirst--;
}
if (rng(2, 80) + rng(0, 100) + rng(0, 120) + rng(0, p.fatigue) <
g->light_level() && (one_in(p.fatigue / 10) || p.fatigue < 10)) {
g->add_msg("The light wakes you up.");
dis.duration = 1;
}
break;
case DI_PKILL1:
if (dis.duration <= 70 && dis.duration % 7 == 0 && p.pkill < 35)
p.pkill++;
break;
case DI_PKILL2:
if (dis.duration % 7 == 0 &&
(one_in(p.addiction_level(ADD_PKILLER)) ||
one_in(p.addiction_level(ADD_PKILLER)) ))
p.pkill += 2;
break;
case DI_PKILL3:
if (dis.duration % 2 == 0 &&
(one_in(p.addiction_level(ADD_PKILLER)) ||
one_in(p.addiction_level(ADD_PKILLER)) ))
p.pkill++;
break;
case DI_PKILL_L:
if (dis.duration % 20 == 0 && p.pkill < 49 &&
(one_in(p.addiction_level(ADD_PKILLER)) ||
one_in(p.addiction_level(ADD_PKILLER)) ))
p.pkill++;
break;
case DI_TOOK_XANAX:
if (dis.duration % 25 == 0 && (p.stim > 0 || one_in(2)))
p.stim--;
break;
case DI_DRUNK:
// We get 600 turns, or one hour, of DI_DRUNK for each drink we have (on avg)
// So, the duration of DI_DRUNK is a good indicator of how much alcohol is in
// our system.
p.per_cur -= int(dis.duration / 800);
p.dex_cur -= int(dis.duration / 800);
p.int_cur -= int(dis.duration / 800);
p.str_cur -= int(dis.duration / 1000);
if (dis.duration <= 600)
p.str_cur += 1;
if (dis.duration > 2000 + 100 * dice(2, 100) &&
(p.has_trait(PF_WEAKSTOMACH) || one_in(20)))
p.vomit(g);
if (!p.has_disease(DI_SLEEP) && dis.duration >= 4500 &&
one_in(500 - int(dis.duration / 80))) {
if (!p.is_npc())
g->add_msg("You pass out.");
p.add_disease(DI_SLEEP, dis.duration / 2, g);
}
break;
case DI_CIG:
if (dis.duration >= 200) { // Smoked too much
p.str_cur -= 1;
p.dex_cur -= 1;
if (dis.duration >= 500 && (one_in(50) ||
one_in(20) && p.has_trait(PF_WEAKSTOMACH)))
p.vomit(g);
} else {
p.dex_cur++;
p.int_cur++;
p.per_cur++;
}
break;
case DI_HIGH:
p.dex_cur--;
p.int_cur--;
p.per_cur--;
break;
case DI_POISON:
if ((!p.has_trait(PF_POISRESIST) && one_in(150)) ||
( p.has_trait(PF_POISRESIST) && one_in(900)) ) {
if (!p.is_npc())
g->add_msg("You're suddenly wracked with pain!");
p.pain += 2;
p.hurt(g, bp_torso, 0, rng(0, 2) * rng(0, 1));
}
p.per_cur--;
p.dex_cur--;
if (!p.has_trait(PF_POISRESIST))
p.str_cur -= 2;
break;
case DI_FOODPOISON:
bonus = 0;
if (p.has_trait(PF_POISRESIST))
bonus = 600;
if (one_in(300 + bonus)) {
if (!p.is_npc())
g->add_msg("You're suddenly wracked with pain and nausea!");
p.pain += 2;
p.hurt(g, bp_torso, 0, 2);
}
if ((p.has_trait(PF_WEAKSTOMACH) && one_in(350 + bonus)) ||
one_in(900 + bonus))
p.vomit(g);
p.moves -= 35;
p.str_cur -= 3;
p.dex_cur--;
p.per_cur--;
if (p.has_trait(PF_POISRESIST)) {
p.moves += 15;
p.str_cur += 2;
}
break;
case DI_SHAKES:
p.dex_cur -= 4;
p.str_cur--;
break;
case DI_HALLU:
// This assumes that we were given DI_HALLU with a 3600 (6-hour) lifespan
if (dis.duration > 3000) { // First hour symptoms
if (one_in(300)) {
if (!p.is_npc())
g->add_msg("You feel a little strange.");
}
} else if (dis.duration > 2400) { // Coming up
if (one_in(100) || (p.has_trait(PF_WEAKSTOMACH) && one_in(100))) {
if (!p.is_npc())
g->add_msg("You feel nauseous.");
p.hunger -= 5;
}
if (!p.is_npc()) {
if (one_in(200))
g->add_msg("Huh? What was that?");
else if (one_in(200))
g->add_msg("Oh god, what's happening?");
else if (one_in(200))
g->add_msg("Of course... it's all fractals!");
}
} else if (dis.duration == 2400) // Visuals start
p.add_disease(DI_VISUALS, 2400, g);
else { // Full symptoms
p.per_cur -= 2;
p.int_cur -= 1;
p.dex_cur -= 2;
p.str_cur -= 1;
if (one_in(50)) { // Generate phantasm
monster phantasm(g->mtypes[mon_hallu_zom + rng(0, 3)]);
phantasm.spawn(p.posx + rng(-10, 10), p.posy + rng(-10, 10));
g->z.push_back(phantasm);
}
}
break;
case DI_ADRENALINE:
if (dis.duration > 400) { // 20 minutes positive effects
p.moves += rng(40, 100);
p.str_cur += 5;
p.dex_cur += 3;
p.int_cur -= 8;
p.per_cur += 1;
} else if (dis.duration == 400) { // 40 minutes come-down
if (!p.is_npc())
g->add_msg("Your adrenaline rush wears off. You feel AWFUL!");
p.moves -= 300;
} else {
p.str_cur -= 2;
p.dex_cur -= 1;
p.int_cur -= 1;
p.per_cur -= 1;
}
break;
case DI_ASTHMA:
if (dis.duration > 1200) {
if (!p.is_npc())
g->add_msg("Your asthma overcomes you. You stop breathing and die...");
p.hurtall(500);
}
p.moves -= dis.duration / 5;
p.str_cur -= 2;
p.dex_cur -= 3;
break;
case DI_METH:
if (dis.duration > 600) {
p.str_cur += 2;
p.dex_cur += 2;
p.int_cur += 2;
p.per_cur += 2;
p.moves += 50;
} else {
p.str_cur -= 3;
p.dex_cur -= 2;
p.int_cur -= 1;
p.moves -= 40;
}
break;
case DI_TELEGLOW:
// Default we get around 300 duration points per teleport (possibly more
// depending on the source).
// TODO: Include a chance to teleport to the nether realm.
if (dis.duration > 6000) { // 20 teles (no decay; in practice at least 21)
if (one_in(1000 - ((dis.duration - 6000) / 10))) {
if (!p.is_npc())
g->add_msg("Glowing lights surround you, and you teleport.");
g->teleport();
if (one_in(4))
p.rem_disease(DI_TELEGLOW);
}
if (one_in(1200 - ((dis.duration - 6000) / 5)) && one_in(20)) {
if (!p.is_npc())
g->add_msg("You pass out.");
p.add_disease(DI_SLEEP, 1200, g);
if (one_in(6))
p.rem_disease(DI_TELEGLOW);
}
}
if (dis.duration > 3600) { // 12 teles
if (one_in(4000 - int(.25 * (dis.duration - 3600)))) {
int range = g->moncats[mcat_nether].size();
mon_id type = (g->moncats[mcat_nether])[rng(0, range - 1)];
monster beast(g->mtypes[type]);
int x, y, tries = 0;
do {
x = p.posx + rng(-4, 4);
y = p.posy + rng(-4, 4);
} while ((x == p.posx && y == p.posy) || g->mon_at(x, y) != -1);
if (g->m.move_cost(x, y) == 0)
g->m.ter(x, y) = t_rubble;
beast.spawn(x, y);
g->z.push_back(beast);
if (g->u_see(x, y, junk))
g->add_msg("A portal opens nearby, and a monster crawls through!");
if (one_in(2))
p.rem_disease(DI_TELEGLOW);
}
if (one_in(3500 - int(.25 * (dis.duration - 3600)))) {
if (!p.is_npc())
g->add_msg("You shudder suddenly.");
p.mutate(g);
if (one_in(4))
p.rem_disease(DI_TELEGLOW);
}
}
if (dis.duration > 2400) { // 8 teleports
if (one_in(10000 - dis.duration))
p.add_disease(DI_SHAKES, rng(40, 80), g);
if (one_in(12000 - dis.duration)) {
if (!p.is_npc())
g->add_msg("Your vision is filled with bright lights...");
p.add_disease(DI_BLIND, rng(10, 20), g);
if (one_in(8))
p.rem_disease(DI_TELEGLOW);
}
if (one_in(5000) && !p.has_disease(DI_HALLU)) {
p.add_disease(DI_HALLU, 3600, g);
if (one_in(5))
p.rem_disease(DI_TELEGLOW);
}
}
if (one_in(4000)) {
if (!p.is_npc())
g->add_msg("You're suddenly covered in ectoplasm.");
p.add_disease(DI_BOOMERED, 100, g);
if (one_in(4))
p.rem_disease(DI_TELEGLOW);
}
if (one_in(10000)) {
p.add_disease(DI_FUNGUS, -1, g);
p.rem_disease(DI_TELEGLOW);
}
break;
}
}
void dis_msg(game *g, dis_type type);
std::string dis_name(disease dis)
{
switch (dis.type) {
case DI_NULL: return "";
case DI_HEATSTROKE: return "Heatstroke";
case DI_FBFACE: return "Frostbite - Face";
case DI_FBHANDS: return "Frostbite - Hands";
case DI_FBFEET: return "Frostbite - Feet";
case DI_SMOKE: return "Smoke";
case DI_TEARGAS: return "Tear gas";
case DI_ONFIRE: return "On Fire";
case DI_BOOMERED: return "Boomered";
case DI_SPORES: return "Spores";
case DI_SLIMED: return "Slimed";
case DI_BLIND: return "Blind";
case DI_POISON: return "Poisoned";
case DI_FOODPOISON: return "Food Poisoning";
case DI_SHAKES: return "Shakes";
case DI_DRUNK:
if (dis.duration > 2200)
return "Wasted";
if (dis.duration > 1400)
return "Trashed";
if (dis.duration > 800)
return "Drunk";
return "Tipsy";
case DI_CIG: return "Cigarette";
case DI_HIGH: return "High";
case DI_VISUALS: return "Hallucinating";
case DI_ADRENALINE:
if (dis.duration > 400)
return "Adrenaline Rush";
return "Adrenaline Comedown";
case DI_ASTHMA:
if (dis.duration > 800)
return "Heavy Asthma";
return "Asthma";
case DI_METH:
if (dis.duration > 600)
return "High on Meth";
return "Meth Comedown";
case DI_IN_PIT: return "Stuck in Pit";
default: return "";
}
}
void dis_effect(game *g, player &p, disease &dis);
std::string dis_description(disease dis)
{
int strpen, allpen;
std::stringstream stream;
switch (dis.type) {
case DI_NULL:
return "None";
case DI_HEATSTROKE: return "\
Speed -15%; Strength - 2; Intelligence - 2; Perception - 1";
case DI_FBFACE: return "\
Perception - 2";
case DI_FBHANDS: return "\
Dexterity - 2";
case DI_FBFEET: return "\
Speed -40%; Strength - 1";
case DI_SMOKE: return "\
Strength - 1; Dexterity - 1;\n\
Occasionally you will cough, costing movement and creating noise.\n\
Loss of health - Torso";
case DI_TEARGAS: return "\
Strength - 2; Dexterity - 2; Intelligence - 1; Perception - 4\n\
Occasionally you will cough, costing movement and creating noise.\n\
Loss of health - Torso";
case DI_ONFIRE: return "\
Loss of health - Entire Body\n\
Your clothing and other equipment may be consumed by the flames.";
case DI_BOOMERED: return "\
Perception - 5\n\
Range of Sight: 1; All sight is tinted magenta";
case DI_SPORES: return "\
Speed -40%\
You can feel the tiny spores sinking directly into your flesh.";
case DI_SLIMED: return "\
Speed -40%; Dexterity - 2";
case DI_BLIND: return "\
Range of Sight: 0";
case DI_POISON: return "\
Perception - 1; Dexterity - 1; Strength - 2 IF not resistant\n\
Occasional pain and/or damage.";
case DI_FOODPOISON: return "\
Speed - 35%; Strength - 3; Dexterity - 1; Perception - 1\n\
Your stomach is extremely upset, and you keep having pangs of pain and nausea.";
case DI_SHAKES: return "\
Strength - 1; Dexterity - 4;";
case DI_DRUNK:
strpen = int(dis.duration / 1000);
allpen = int(dis.duration / 800);
stream << "Strength - " << strpen << "; Dexterity - " << allpen <<
"; Intelligence - " << allpen << "; Perception - " << allpen;
return stream.str();
case DI_CIG:
if (dis.duration > 200)
return "\
Strength - 1; Dexterity - 1\n\
You smoked too much.";
return "\
Dexterity + 1; Intelligence + 1; Perception + 1";
case DI_HIGH:
return "\
Dexterity - 1; Intelligence - 1; Perception - 1";
case DI_VISUALS:
return "\
You can't trust everything that you see.";
case DI_ADRENALINE:
if (dis.duration > 400)
return "\
Speed +80; Strength + 5; Dexterity + 3; Intelligence - 8; Perception + 1";
return "\
Strength - 2; Dexterity - 1; Intelligence - 1; Perception - 1";
case DI_ASTHMA:
stream<< "Speed - " << int(dis.duration / 5) << "%; Strength - 2; " <<
"Dexterity - 3";
return stream.str();
case DI_METH:
if (dis.duration > 600)
return "\
Speed +50; Strength + 2; Dexterity + 2; Intelligence + 2; Perception + 2";
return "\
Speed -30; Strength - 3; Dexterity - 2; Intelligence - 2";
case DI_IN_PIT:
return "\
You're stuck in a pit. Sight distance is limited and you have to climb out.";
default:
return "Who knows?";
}
}
int disease_speed_boost(disease dis);
std::string dis_name(disease dis);
std::string dis_description(disease dis);
#endif
+10
View File
@@ -19,7 +19,17 @@ struct point {
int x;
int y;
point(int X = 0, int Y = 0) : x (X), y (Y) {}
point(const point &p) : x (p.x), y (p.y) {}
~point(){}
};
struct tripoint {
int x;
int y;
int z;
tripoint(int X = 0, int Y = 0, int Z = 0) : x (X), y (Y), z (Z) {}
tripoint(const tripoint &p) : x (p.x), y (p.y), z (p.z) {}
~tripoint(){}
};
#endif
+242 -13
View File
@@ -5,25 +5,254 @@
void event::actualize(game *g)
{
npc tmp;
switch (type) {
case EVENT_HELP:
if (relevant_faction == NULL) {
tmp.randomize(g);
tmp.attitude = NPCATT_DEFEND;
tmp.posx = g->u.posx - SEEX * 2 + rng(-5, 5);
tmp.posy = g->u.posy - SEEY * 2 + rng(-5, 5);
g->active_npc.push_back(tmp);
} else {
int num = rng(1, 6);
case EVENT_HELP: {
npc tmp;
int num = 1;
if (faction_id >= 0)
num = rng(1, 6);
for (int i = 0; i < num; i++) {
tmp.randomize_from_fact(g, relevant_faction);
if (faction_id != -1) {
faction* fac = g->faction_by_id(faction_id);
if (fac)
tmp.randomize_from_faction(g, fac);
else
debugmsg("EVENT_HELP run with invalid faction_id");
} else
tmp.randomize(g);
tmp.attitude = NPCATT_DEFEND;
tmp.posx = g->u.posx - SEEX * 2 + rng(-5, 5);
tmp.posy = g->u.posy - SEEY * 2 + rng(-5, 5);
g->active_npc.push_back(tmp);
}
}
break;
} break;
case EVENT_ROBOT_ATTACK: {
if (rl_dist(g->levx, g->levy, map_point.x, map_point.y) <= 4) {
mtype *robot_type = g->mtypes[mon_tripod];
if (faction_id == 0) // The cops!
robot_type = g->mtypes[mon_copbot];
monster robot(robot_type);
int robx = (g->levx > map_point.x ? 0 - SEEX * 2 : SEEX * 4),
roby = (g->levy > map_point.y ? 0 - SEEY * 2 : SEEY * 4);
robot.spawn(robx, roby);
g->z.push_back(robot);
}
} break;
case EVENT_SPAWN_WYRMS: {
if (g->levz >= 0)
return;
monster wyrm(g->mtypes[mon_dark_wyrm]);
int num_wyrms = rng(1, 4);
for (int i = 0; i < num_wyrms; i++) {
int tries = 0;
int monx = -1, mony = -1;
do {
monx = rng(0, SEEX * MAPSIZE);
mony = rng(0, SEEY * MAPSIZE);
tries++;
} while (tries < 10 && !g->is_empty(monx, mony) &&
rl_dist(g->u.posx, g->u.posx, monx, mony) <= 2);
if (tries < 10) {
wyrm.spawn(monx, mony);
g->z.push_back(wyrm);
}
}
if (!one_in(25)) // They just keep coming!
g->add_event(EVENT_SPAWN_WYRMS, int(g->turn) + rng(15, 25));
} break;
case EVENT_AMIGARA: {
int num_horrors = rng(3, 5);
int faultx = -1, faulty = -1;
bool horizontal;
for (int x = 0; x < SEEX * MAPSIZE && faultx == -1; x++) {
for (int y = 0; y < SEEY * MAPSIZE && faulty == -1; y++) {
if (g->m.ter(x, y) == t_fault) {
faultx = x;
faulty = y;
if (g->m.ter(x - 1, y) == t_fault || g->m.ter(x + 1, y) == t_fault)
horizontal = true;
else
horizontal = false;
}
}
}
monster horror(g->mtypes[mon_amigara_horror]);
for (int i = 0; i < num_horrors; i++) {
int tries = 0;
int monx = -1, mony = -1;
do {
if (horizontal) {
monx = rng(faultx, faultx + 2 * SEEX - 8);
for (int n = -1; n <= 1; n++) {
if (g->m.ter(monx, faulty + n) == t_rock_floor)
mony = faulty + n;
}
} else { // Vertical fault
mony = rng(faulty, faulty + 2 * SEEY - 8);
for (int n = -1; n <= 1; n++) {
if (g->m.ter(faultx + n, mony) == t_rock_floor)
monx = faultx + n;
}
}
tries++;
} while ((monx == -1 || mony == -1 || g->is_empty(monx, mony)) &&
tries < 10);
if (tries < 10) {
horror.spawn(monx, mony);
g->z.push_back(horror);
}
}
} break;
case EVENT_ROOTS_DIE:
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;
}
}
break;
case EVENT_TEMPLE_OPEN: {
bool saw_grate = false;
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;
int j;
if (!saw_grate && g->u_see(x, y, j))
saw_grate = true;
}
}
}
if (saw_grate)
g->add_msg("The nearby grates open to reveal a staircase!");
} break;
case EVENT_TEMPLE_FLOOD: {
bool flooded = false;
ter_id flood_buf[SEEX*MAPSIZE][SEEY*MAPSIZE];
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++)
flood_buf[x][y] = g->m.ter(x, y);
}
for (int x = 0; x < SEEX * MAPSIZE; x++) {
for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_water_sh) {
bool deepen = false;
for (int wx = x - 1; wx <= x + 1 && !deepen; wx++) {
for (int wy = y - 1; wy <= y + 1 && !deepen; wy++) {
if (g->m.ter(wx, wy) == t_water_dp)
deepen = true;
}
}
if (deepen) {
flood_buf[x][y] = t_water_dp;
flooded = true;
}
} else if (g->m.ter(x, y) == t_rock_floor) {
bool flood = false;
for (int wx = x - 1; wx <= x + 1 && !flood; wx++) {
for (int wy = y - 1; wy <= y + 1 && !flood; wy++) {
if (g->m.ter(wx, wy) == t_water_dp || g->m.ter(wx, wy) == t_water_sh)
flood = true;
}
}
if (flood) {
flood_buf[x][y] = t_water_sh;
flooded = true;
}
}
}
}
if (!flooded)
return; // We finished flooding the entire chamber!
// Check if we should print a message
if (flood_buf[g->u.posx][g->u.posy] != g->m.ter(g->u.posx, g->u.posy)) {
if (flood_buf[g->u.posx][g->u.posy] == t_water_sh)
g->add_msg("Water quickly floods up to your knees.");
else { // Must be deep water!
g->add_msg("Water fills nearly to the ceiling!");
g->plswim(g->u.posx, g->u.posy);
}
}
// 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->add_event(EVENT_TEMPLE_FLOOD, int(g->turn) + rng(2, 3));
} break;
case EVENT_TEMPLE_SPAWN: {
mon_id montype;
switch (rng(1, 4)) {
case 1: montype = mon_sewer_snake; break;
case 2: montype = mon_centipede; break;
case 3: montype = mon_dermatik; break;
case 4: montype = mon_spider_widow; break;
}
monster spawned( g->mtypes[montype] );
int tries = 0, x, y;
do {
x = rng(g->u.posx - 5, g->u.posx + 5);
y = rng(g->u.posy - 5, g->u.posy + 5);
tries++;
} while (tries < 20 && !g->is_empty(x, y) &&
rl_dist(x, y, g->u.posx, g->u.posy) <= 2);
if (tries < 20) {
spawned.spawn(x, y);
g->z.push_back(spawned);
}
} break;
default:
break; // Nothing happens for other events
}
}
void event::per_turn(game *g)
{
switch (type) {
case EVENT_WANTED: {
if (g->levz >= 0 && one_in(100)) { // About once every 10 minutes
monster eyebot(g->mtypes[mon_eyebot]);
eyebot.faction_id = faction_id;
point place = g->m.random_outdoor_tile();
if (place.x == -1 && place.y == -1)
return; // We're safely indoors!
eyebot.spawn(place.x, place.y);
g->z.push_back(eyebot);
int t;
if (g->u_see(place.x, place.y, t))
g->add_msg("An eyebot swoops down nearby!");
}
} break;
case EVENT_SPAWN_WYRMS:
if (g->levz >= 0) {
turn--;
return;
}
if (int(g->turn) % 3 == 0)
g->add_msg("You hear screeches from the rock above and around you!");
break;
case EVENT_AMIGARA:
g->add_msg("The entire cavern shakes!");
break;
case EVENT_TEMPLE_OPEN:
g->add_msg("The earth rumbles.");
break;
default:
break; // Nothing happens for other events
}
}
+22 -5
View File
@@ -2,33 +2,50 @@
#define _EVENT_H_
#include "faction.h"
#include "line.h"
class game;
enum event_type {
EVENT_NULL,
EVENT_HELP,
EVENT_WANTED,
EVENT_ROBOT_ATTACK,
EVENT_SPAWN_WYRMS,
EVENT_AMIGARA,
EVENT_ROOTS_DIE,
EVENT_TEMPLE_OPEN,
EVENT_TEMPLE_FLOOD,
EVENT_TEMPLE_SPAWN,
EVENT_DIM,
EVENT_ARTIFACT_LIGHT,
NUM_EVENT_TYPES
};
struct event {
event_type type;
int turn;
faction* relevant_faction;
int faction_id;
point map_point;
event() {
type = EVENT_NULL;
turn = 0;
relevant_faction = NULL;
faction_id = -1;
map_point.x = -1;
map_point.y = -1;
}
event(event_type e_t, int t, faction* r_f) {
event(event_type e_t, int t, int f_id, int x, int y) {
type = e_t;
turn = t;
relevant_faction = r_f;
faction_id = f_id;
map_point.x = x;
map_point.y = y;
}
void actualize(game *g);
void actualize(game *g); // When the time runs out
void per_turn(game *g); // Every turn
};
#endif
+15 -8
View File
@@ -2,12 +2,14 @@
std::string faction_adj_pos[15] = {
"Shining", "Sacred", "Golden", "Holy", "Righteous", "Devoted", "Virtuous",
"Splendid", "Divine", "Radiant", "Noble", "Venerable", "Immaculate"
"Splendid", "Divine", "Radiant", "Noble", "Venerable", "Immaculate",
"Heroic", "Bright"};
std::string faction_adj_neu[15] = {
"Original", "Crystal", "Metal", "Mighty", "Powerful", "Solid", "Stone",
"Firey", "Colossal", "Famous", "Supreme", "Invincible", "Unlimited",
"Great", "Electric"};
std::string faction_adj_bad[15] = {
"Poisonous", "Deadly", "Foul", "Nefarious", "Wicked", "Vile", "Ruinous",
"Horror", "Devastating", "Vicious", "Sinister", "Baleful", "Pestilent",
@@ -17,17 +19,21 @@ std::string faction_noun_strong[15] = {
"Fists", "Slayers", "Furies", "Dervishes", "Tigers", "Destroyers",
"Berserkers", "Samurai", "Valkyries", "Army", "Killers", "Paladins",
"Knights", "Warriors", "Huntsmen"};
std::string faction_noun_sneak[15] = {
"Snakes", "Rats", "Assassins", "Ninja", "Agents", "Shadows", "Guerillas",
"Eliminators", "Snipers", "Smoke", "Arachnids", "Creepers", "Shade",
"Stalkers", "Eels"};
std::string faction_noun_crime[15] = {
"Bandits", "Punks", "Family", "Mafia", "Mob", "Gang", "Vandals", "Sharks",
"Muggers", "Cutthroats", "Guild", "Faction", "Thugs", "Racket", "Crooks"};
std::string faction_noun_cult[15] = {
"Brotherhood", "Church", "Ones", "Crucible", "Sect", "Creed", "Doctrine",
"Priests", "Tenet", "Monks", "Clerics", "Pastors", "Gnostics", "Elders",
"Inquisitors"};
std::string faction_noun_none[15] = {
"Settlers", "People", "Men", "Faction", "Tribe", "Clan", "Society", "Folk",
"Nation", "Republic", "Colony", "State", "Kingdom", "Party", "Company"};
@@ -53,11 +59,12 @@ faction_value_datum facgoal_data[NUM_FACGOALS] = {
{"contact with unseen powers", -1, 0, 1, 0, 4},
{"bringing the apocalypse", -5, 1, 2, 0, 7},
{"general chaos and anarchy", -3, 2, -3, 2, -1},
{"the cultivation of knowledge", 2, -3, -1, -1, 0},
{"the cultivation of knowledge", 2, -3, 2, -1, 0},
{"harmony with nature", 2, -2, 0, -1, 2},
{"rebuilding civilization", 2, 1, -2, -2, -4}
{"rebuilding civilization", 2, 1, -2, -2, -4},
{"spreading the fungus", -2, 1, 1, 0, 4}
};
// TOTAL: -3 2 -5 0 3
// TOTAL: -5 3 -2 0 7
faction_value_datum facjob_data[NUM_FACJOBS] = {
// "They earn money via <name>"
@@ -86,18 +93,18 @@ faction_value_datum facval_data[NUM_FACVALS] = {
{"Null", 0, 0, 0, 0, 0},
{"their charitable nature", 5, -1, -1, -2, -2},
{"their isolationism", 0, -2, 1, 0, 2},
{"exploring extensively", 1, 0, 0, -2, -1},
{"collecting rare artifacts", 0, 1, 1, -1, 3},
{"exploring extensively", 1, 0, 0, -1, -1},
{"collecting rare artifacts", 0, 1, 1, 0, 3},
{"their knowledge of bionics", 1, 2, 0, 0, 0},
{"their libraries", 1, -3, 0, -2, 1},
{"their elite training", 0, 4, 2, 0, 2},
{"their robotics factories", 0, 3, -1, 0, -2},
{"treachery", -3, 0, 1, 3, 0},
{"the avoidance of drugs", 1, 0, 0, -2, 1},
{"the avoidance of drugs", 1, 0, 0, -1, 1},
{"their adherance to the law", 2, -1, -1, -4, -1},
{"their cruelty", -3, 1, -1, 4, 1}
};
// TOTALS: 5 4 1 -6 4
// TOTALS: 5 4 1 -3 4
/* Note: It's nice to keep the totals around 0 for Good, and about even for the
* other four. It's okay if Good is slightly negative (after all, in a post-
* apocalyptic world people might be a LITTLE less virtuous), and to keep
+79 -1
View File
@@ -6,10 +6,37 @@
#include "omdata.h"
#include "game.h"
#include <sstream>
std::string invent_name();
std::string invent_adj();
faction::faction()
{
// debugmsg("Warning: Faction created without UID!");
name = "";
values = 0;
likes_u = 0;
respects_u = 0;
known_by_u = false;
goal = FACGOAL_NULL;
job1 = FACJOB_NULL;
job2 = FACJOB_NULL;
strength = 0;
sneak = 0;
crime = 0;
cult = 0;
good = 0;
omx = 0;
omy = 0;
mapx = 0;
mapy = 0;
size = 0;
power = 0;
id = -1;
}
faction::faction(int uid)
{
name = "";
values = 0;
@@ -19,12 +46,63 @@ faction::faction()
goal = FACGOAL_NULL;
job1 = FACJOB_NULL;
job2 = FACJOB_NULL;
strength = 0;
sneak = 0;
crime = 0;
cult = 0;
good = 0;
omx = 0;
omy = 0;
mapx = 0;
mapy = 0;
size = 0;
power = 0;
uid = id;
}
faction::~faction()
{
}
std::string faction::save_info()
{
std::stringstream dump;
dump << id << " " << values << " " << goal << " " << job1 << " " << job2 <<
" " << likes_u << " " << respects_u << " " << known_by_u << " " <<
strength << " " << sneak << " " << crime << " " << cult << " " <<
good << " " << omx << " " << omy << " " << mapx << " " << mapy <<
" " << size << " " << power << " ";
dump << opinion_of.size() << " ";
for (int i = 0; i < opinion_of.size(); i++)
dump << opinion_of[i] << " ";
dump << name;
return dump.str();
}
void faction::load_info(std::string data)
{
std::stringstream dump;
int valuetmp, goaltmp, jobtmp1, jobtmp2;
dump << data;
dump >> id >> valuetmp >> goaltmp >> jobtmp1 >> jobtmp2 >> likes_u >>
respects_u >> known_by_u >> strength >> sneak >> crime >> cult >>
good >> omx >> omy >> mapx >> mapy >> size >> power;
values = valuetmp;
goal = faction_goal(goaltmp);
job1 = faction_job(jobtmp1);
job2 = faction_job(jobtmp2);
int size, tmpop;
dump >> size;
for (int i = 0; i < size; i++) {
dump >> tmpop;
opinion_of.push_back(tmpop);
}
std::string subname;
while (dump >> subname)
name += " " + subname;
}
void faction::randomize()
{
// Set up values
@@ -475,6 +553,6 @@ std::string fac_respect_text(int val)
return "Leech";
if (val <= -10)
return "Laughingstock";
return "Neutral";
}
+18 -12
View File
@@ -8,7 +8,7 @@
#define MAX_FAC_NAME_SIZE 40
#ifndef mfb
#define mfb(n) int(pow(2,(int)n))
#define mfb(n) long(1 << (n))
#endif
std::string fac_ranking_text(int val);
@@ -17,17 +17,18 @@ std::string fac_respect_text(int val);
class game;
enum faction_goal {
FACGOAL_NULL = 0, // Not meant to be used; denotes a bug
FACGOAL_NONE, // No particular goal outside of prosperity
FACGOAL_WEALTH, // Financial wealth
FACGOAL_DOMINANCE, // Complete military dominance
FACGOAL_CLEANSE, // Destroy zombies &c
FACGOAL_SHADOW, // Contact, control, etc. of the shadow world
FACGOAL_APOCALYPSE, // Destroy the world!
FACGOAL_ANARCHY, // Nihilistic; destroy anything
FACGOAL_KNOWLEDGE, // Golden age of knowledge; a new renaissance
FACGOAL_NATURE, // Golden age of ecological harmony
FACGOAL_CIVILIZATION, // Rebuilding society as it was before
FACGOAL_NULL = 0,
FACGOAL_NONE,
FACGOAL_WEALTH,
FACGOAL_DOMINANCE,
FACGOAL_CLEANSE,
FACGOAL_SHADOW,
FACGOAL_APOCALYPSE,
FACGOAL_ANARCHY,
FACGOAL_KNOWLEDGE,
FACGOAL_NATURE,
FACGOAL_CIVILIZATION,
FACGOAL_FUNGUS,
NUM_FACGOALS
};
@@ -67,10 +68,15 @@ enum faction_value {
NUM_FACVALS
};
struct faction {
faction();
faction(int uid);
~faction();
std::string save_info();
void load_info(std::string data);
void randomize();
void make_army();
bool has_job(faction_job j);
+620 -125
View File
@@ -2,25 +2,45 @@
#include "map.h"
#include "game.h"
#define INBOUNDS(x, y) \
(x >= 0 && x < SEEX * my_MAPSIZE && y >= 0 && y < SEEY * my_MAPSIZE)
bool vector_has(std::vector <item> vec, itype_id type);
bool map::process_fields(game *g)
{
bool found_field = false;
for (int x = 0; x < my_MAPSIZE; x++) {
for (int y = 0; y < my_MAPSIZE; y++) {
if (grid[x + y * my_MAPSIZE]->field_count > 0)
found_field |= process_fields_in_submap(g, x + y * my_MAPSIZE);
}
}
return found_field;
}
bool map::process_fields_in_submap(game *g, int gridn)
{
bool found_field = false;
field *cur;
field_id curtype;
for (int x = 0; x < SEEX * 3; x++) {
for (int y = 0; y < SEEY * 3; y++) {
cur = &field_at(x, y);
for (int locx = 0; locx < SEEX; locx++) {
for (int locy = 0; locy < SEEY; locy++) {
cur = &(grid[gridn]->fld[locx][locy]);
int x = locx + SEEX * (gridn % my_MAPSIZE),
y = locy + SEEY * int(gridn / my_MAPSIZE);
curtype = cur->type;
if (!found_field && curtype != fd_null)
found_field = true;
if (cur->density > 3)
if (cur->density > 3 || cur->density < 1)
debugmsg("Whoooooa density of %d", cur->density);
if (cur->age == 0) // Don't process "newborn" fields
curtype = fd_null;
int part;
vehicle *veh;
switch (curtype) {
case fd_null:
@@ -36,58 +56,118 @@ bool map::process_fields(game *g)
if (has_flag(swimmable, x, y)) // Dissipate faster in water
cur->age += 20;
for (int i = 0; i < i_at(x, y).size(); i++) {
if (i_at(x, y)[i].made_of(LIQUID) || i_at(x, y)[i].made_of(VEGGY) ||
i_at(x, y)[i].made_of(FLESH) || i_at(x, y)[i].made_of(POWDER) ||
i_at(x, y)[i].made_of(COTTON) || i_at(x, y)[i].made_of(WOOL) ||
i_at(x, y)[i].made_of(PAPER) || i_at(x, y)[i].made_of(PLASTIC) ||
i_at(x, y)[i].made_of(GLASS)) { // Whew! Acid-destructable.
cur->age += i_at(x, y)[i].volume();
for (int m = 0; m < i_at(x, y)[i].contents.size(); m++)
i_at(x, y).push_back( i_at(x, y)[i].contents[m] );
i_at(x, y).erase(i_at(x, y).begin() + i);
i--;
item *melting = &(i_at(x, y)[i]);
if (melting->made_of(LIQUID) || melting->made_of(VEGGY) ||
melting->made_of(FLESH) || melting->made_of(POWDER) ||
melting->made_of(COTTON) || melting->made_of(WOOL) ||
melting->made_of(PAPER) || melting->made_of(PLASTIC) ||
(melting->made_of(GLASS) && !one_in(3)) || one_in(4)) {
// Acid destructable objects here
melting->damage++;
if (melting->damage >= 5 ||
(melting->made_of(PAPER) && melting->damage >= 3)) {
cur->age += melting->volume();
for (int m = 0; m < i_at(x, y)[i].contents.size(); m++)
i_at(x, y).push_back( i_at(x, y)[i].contents[m] );
i_at(x, y).erase(i_at(x, y).begin() + i);
i--;
}
}
}
break;
case fd_fire:
case fd_sap:
break; // It doesn't do anything.
case fd_fire: {
// Consume items as fuel to help us grow/last longer.
bool destroyed;
int vol;
for (int i = 0; i < i_at(x, y).size(); i++) {
bool destroyed = false;
int vol = 0, smoke = 0, consumed = 0;
for (int i = 0; i < i_at(x, y).size() && consumed < cur->density * 2; i++) {
destroyed = false;
vol = i_at(x, y)[i].volume();
if (i_at(x, y)[i].is_ammo()) {
item *it = &(i_at(x, y)[i]);
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 -= 300;
cur->age -= 600;
destroyed = true;
} else if (i_at(x, y)[i].made_of(PAPER)) {
cur->age -= vol * 10;
destroyed = true;
} else if ((i_at(x, y)[i].made_of(WOOD) || i_at(x, y)[i].made_of(VEGGY)) &&
(vol <= cur->density*10-(cur->age>0 ? rng(0,cur->age/10) : 0) ||
cur->density == 3)) {
cur->age -= vol * 10;
destroyed = true;
} else if ((i_at(x, y)[i].made_of(COTTON) || i_at(x, y)[i].made_of(FLESH)||
i_at(x, y)[i].made_of(WOOL)) &&
(vol <= cur->density*2 || (cur->density == 3 && one_in(vol)))) {
cur->age -= vol * 5;
destroyed = true;
} else if (i_at(x, y)[i].made_of(LIQUID) || i_at(x, y)[i].made_of(POWDER)||
i_at(x, y)[i].made_of(PLASTIC)||
(cur->density >= 2 && i_at(x, y)[i].made_of(GLASS)) ||
(cur->density == 3 && i_at(x, y)[i].made_of(IRON))) {
switch (i_at(x, y)[i].type->id) { // TODO: Make this be not a hack.
smoke += 6;
consumed++;
} else if (it->made_of(PAPER)) {
destroyed = it->burn(cur->density * 3);
consumed++;
if (cur->density == 1)
cur->age -= vol * 10;
if (vol >= 4)
smoke++;
} else if ((it->made_of(WOOD) || it->made_of(VEGGY))) {
if (vol <= cur->density * 10 || cur->density == 3) {
cur->age -= 4;
destroyed = it->burn(cur->density);
smoke++;
consumed++;
} else if (it->burnt < cur->density) {
destroyed = it->burn(1);
smoke++;
}
} else if ((it->made_of(COTTON) || it->made_of(WOOL))) {
if (vol <= cur->density * 5 || cur->density == 3) {
cur->age--;
destroyed = it->burn(cur->density);
smoke++;
consumed++;
} else if (it->burnt < cur->density) {
destroyed = it->burn(1);
smoke++;
}
} else if (it->made_of(FLESH)) {
if (vol <= cur->density * 5 || (cur->density == 3 && one_in(vol / 20))) {
cur->age--;
destroyed = it->burn(cur->density);
smoke += 3;
consumed++;
} else if (it->burnt < cur->density * 5 || cur->density >= 2) {
destroyed = it->burn(1);
smoke++;
}
} 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 -= 220;
cur->age -= 300;
smoke += 6;
break;
default:
cur->age += rng(80 * vol, 300 * vol);
smoke++;
}
destroyed = true;
consumed++;
} else if (it->made_of(POWDER)) {
cur->age -= vol;
destroyed = true;
smoke += 2;
} else if (it->made_of(PLASTIC)) {
smoke += 3;
if (it->burnt <= cur->density * 2 || (cur->density == 3 && one_in(vol))) {
destroyed = it->burn(cur->density);
if (one_in(vol + it->burnt))
cur->age--;
}
}
if (destroyed) {
for (int m = 0; m < i_at(x, y)[i].contents.size(); m++)
i_at(x, y).push_back( i_at(x, y)[i].contents[m] );
@@ -95,73 +175,132 @@ bool map::process_fields(game *g)
i--;
}
}
// Consume the terrain we're on
if (terlist[ter(x, y)].flags & mfb(flammable) && one_in(8 - cur->density)) {
cur->age -= cur->density * cur->density * 40;
if (cur->density == 3)
ter(x, y) = t_rubble;
} else if (terlist[ter(x, y)].flags & mfb(explodes)) {
ter(x, y) = t_gas_pump_smashed;
cur->age = 0;
cur->density = 3;
g->explosion(x, y, 40, 0, true);
} else if (terlist[ter(x, y)].flags & mfb(swimmable))
cur->age += 800; // Flames die quickly on water
veh = veh_at(x, y, part);
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)) {
// Consume the terrain we're on
if (has_flag(explodes, x, y)) {
ter(x, y) = ter_id(int(ter(x, y)) + 1);
cur->age = 0;
cur->density = 3;
g->explosion(x, y, 40, 0, true);
} else if (has_flag(flammable, x, y) && one_in(32 - cur->density * 10)) {
cur->age -= cur->density * cur->density * 40;
smoke += 15;
if (cur->density == 3)
g->m.destroy(g, x, y, false);
} else if (has_flag(flammable2, x, y) && one_in(32 - cur->density * 10)) {
cur->age -= cur->density * cur->density * 40;
smoke += 15;
if (cur->density == 3)
ter(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;
smoke += 10;
if (cur->density == 3)
g->m.destroy(g, x, y, false);
} else if (terlist[ter(x, y)].flags & mfb(swimmable))
cur->age += 800; // Flames die quickly on water
}
// If we consumed a lot, the flames grow higher
while (cur->density < 3 && cur->age < 0) {
cur->age += 300;
cur->density++;
}
// 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) {
if (cur->density == 3 && cur->age < 0 && tr_brazier != tr_at(x, y)) {
// 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);
for (int i = 0; i < 3 && cur->age < 0; i++) {
for (int j = 0; j < 3 && cur->age < 0; j++) {
if (field_at(x+((i+starti)%3), y+((j+startj)%3)).type == fd_fire &&
field_at(x+((i+starti)%3), y+((j+startj)%3)).density < 3) {
field_at(x+((i+starti)%3), y+((j+startj)%3)).density++;
field_at(x+((i+starti)%3), y+((j+startj)%3)).age = 0;
int fx = x + ((i + starti) % 3) - 1, fy = y + ((j + startj) % 3) - 1;
if (field_at(fx, fy).type == fd_fire && field_at(fx, fy).density < 3 &&
(in_pit == (ter(fx, fy) == t_pit))) {
field_at(fx, fy).density++;
field_at(fx, fy).age = 0;
cur->age = 0;
}
}
}
}
// Consume adjacent fuel / terrain to spread.
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (x+i >= 0 && y+j >= 0 && x+i < SEEX * 3 && y+j <= SEEY * 3) {
if (has_flag(explodes, x + i, y + j) && one_in(8 - cur->density)) {
ter(x+i, y+j) = t_gas_pump_smashed;
g->explosion(x+i, y+j, 40, 0, true);
} else if ((i != 0 || j != 0) && (i_at(x+i, y+j).size() > 0 ||
rng(15, 120) < cur->density * 10)) {
if (field_at(x+i, y+j).type == fd_smoke)
field_at(x+i, y+j) = field(fd_fire, 1, 0);
else
add_field(g, x+i, y+j, fd_fire, 1);
// Consume adjacent fuel / terrain / webs to spread.
// 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);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
int fx = x + ((i + starti) % 3) - 1, fy = y + ((j + startj) % 3) - 1;
if (INBOUNDS(fx, fy)) {
int spread_chance = 20 * (cur->density - 1) + 10 * smoke;
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);
g->explosion(fx, fy, 40, 0, true);
} else if ((i != 0 || j != 0) && rng(1, 100) < spread_chance &&
tr_brazier != tr_at(x, y) &&
(in_pit == (ter(fx, fy) == t_pit)) &&
((cur->density == 3 &&
(has_flag(flammable, fx, fy) || one_in(20))) ||
(cur->density == 3 &&
(has_flag(l_flammable, fx, fy) && one_in(10))) ||
flammable_items_at(fx, fy) ||
field_at(fx, fy).type == fd_web)) {
if (field_at(fx, fy).type == fd_smoke ||
field_at(fx, fy).type == fd_web)
field_at(fx, fy) = field(fd_fire, 1, 0);
else
add_field(g, fx, fy, fd_fire, 1);
} else {
bool nosmoke = true;
for (int ii = -1; ii <= 1; ii++) {
for (int jj = -1; jj <= 1; jj++) {
if (field_at(x+ii, y+jj).type == fd_fire &&
field_at(x+ii, y+jj).density == 3)
smoke++;
else if (field_at(x+ii, y+jj).type == fd_smoke)
nosmoke = false;
}
}
// If we're not spreading, maybe we'll stick out some smoke, huh?
} else if (move_cost(x+i, y+j) > 0 &&
rng(7, 40) < cur->density * 10 && cur->age < 1000) {
add_field(g, x+i, y+j, fd_smoke, rng(1, cur->density));
if (move_cost(fx, fy) > 0 &&
(!one_in(smoke) || (nosmoke && one_in(40))) &&
rng(3, 35) < cur->density * 10 && cur->age < 1000) {
smoke--;
add_field(g, fx, fy, fd_smoke, rng(1, cur->density));
}
}
}
}
}
break;
} break;
case fd_smoke:
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++)
g->scent(x+i, y+j) = 0;
}
if (one_in(3)) {
if (is_outside(x, y))
cur->age += 50;
if (one_in(2)) {
std::vector <point> spread;
for (int a = -1; a <= 1; a++) {
for (int b = -1; b <= 1; b++) {
if ((field_at(x+a, y+b).type == fd_smoke &&
field_at(x+a, y+b).density < 3) ||
field_at(x+a, y+b).density < 3 ) ||
(field_at(x+a, y+b).is_null() && move_cost(x+a, y+b) > 0))
spread.push_back(point(x+a, y+b));
}
@@ -187,6 +326,8 @@ bool map::process_fields(game *g)
for (int j = -1; j <= 1; j++)
g->scent(x+i, y+j) = 0;
}
if (is_outside(x, y))
cur->age += 30;
// One in three chance that it spreads (less than smoke!)
if (one_in(3)) {
std::vector <point> spread;
@@ -221,12 +362,59 @@ bool map::process_fields(game *g)
}
break;
case fd_toxic_gas:
// Reset nearby scents to zero
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++)
g->scent(x+i, y+j) = 0;
}
if (is_outside(x, y))
cur->age += 40;
if (one_in(2)) {
std::vector <point> spread;
// Pick all eligible points to spread to
for (int a = -1; a <= 1; a++) {
for (int b = -1; b <= 1; b++) {
if (((field_at(x+a, y+b).type == fd_smoke ||
field_at(x+a, y+b).type == fd_tear_gas ||
field_at(x+a, y+b).type == fd_toxic_gas ||
field_at(x+a, y+b).type == fd_nuke_gas ) &&
field_at(x+a, y+b).density < 3 ) ||
(field_at(x+a, y+b).is_null() && move_cost(x+a, y+b) > 0))
spread.push_back(point(x+a, y+b));
}
}
// Then, spread to a nearby point
if (cur->density > 0 && cur->age > 0 && spread.size() > 0) {
point p = spread[rng(0, spread.size() - 1)];
// Nearby toxic gas grows thicker
if (field_at(p.x, p.y).type == fd_toxic_gas &&
field_at(p.x, p.y).density < 3) {
field_at(p.x, p.y).density++;
cur->density--;
// Nearby smoke & teargas is converted into toxic gas
} else if (field_at(p.x, p.y).type == fd_smoke ||
field_at(p.x, p.y).type == fd_tear_gas) {
field_at(p.x, p.y).type = fd_toxic_gas;
// Or, just create a new field.
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
add_field(g, p.x, p.y, fd_toxic_gas, 1)) {
cur->density--;
field_at(p.x, p.y).age = cur->age;
}
}
}
break;
case fd_nuke_gas:
// Reset nearby scents to zero
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++)
g->scent(x+i, y+j) = 0;
}
if (is_outside(x, y))
cur->age += 40;
// Increase long-term radiation in the land underneath
radiation(x, y) += rng(0, cur->density);
if (one_in(2)) {
@@ -236,6 +424,7 @@ bool map::process_fields(game *g)
for (int b = -1; b <= 1; b++) {
if (((field_at(x+a, y+b).type == fd_smoke ||
field_at(x+a, y+b).type == fd_tear_gas ||
field_at(x+a, y+b).type == fd_toxic_gas ||
field_at(x+a, y+b).type == fd_nuke_gas ) &&
field_at(x+a, y+b).density < 3 ) ||
(field_at(x+a, y+b).is_null() && move_cost(x+a, y+b) > 0))
@@ -250,8 +439,9 @@ bool map::process_fields(game *g)
field_at(p.x, p.y).density < 3) {
field_at(p.x, p.y).density++;
cur->density--;
// Nearby smoke & teargas is converted into nukegas
// Nearby smoke, tear, and toxic gas is converted into nukegas
} else if (field_at(p.x, p.y).type == fd_smoke ||
field_at(p.x, p.y).type == fd_toxic_gas ||
field_at(p.x, p.y).type == fd_tear_gas) {
field_at(p.x, p.y).type = fd_nuke_gas;
// Or, just create a new field.
@@ -263,6 +453,37 @@ bool map::process_fields(game *g)
}
}
break;
case fd_gas_vent:
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
if (field_at(i, j).type == fd_toxic_gas && field_at(i, j).density < 3)
field_at(i, j).density++;
else
add_field(g, i, j, fd_toxic_gas, 3);
}
}
break;
case fd_fire_vent:
if (cur->density > 1) {
if (one_in(3))
cur->density--;
} else {
cur->type = fd_flame_burst;
cur->density = 3;
}
break;
case fd_flame_burst:
if (cur->density > 1)
cur->density--;
else {
cur->type = fd_fire_vent;
cur->density = 3;
}
break;
case fd_electricity:
if (!one_in(5)) { // 4 in 5 chance to spread
std::vector<point> valid;
@@ -303,17 +524,137 @@ bool map::process_fields(game *g)
}
}
break;
}
if (cur->type != fd_null) {
cur->age++;
case fd_fatigue:
if (cur->density < 3 && int(g->turn) % 3600 == 0 && one_in(10))
cur->density++;
else if (cur->density == 3 && one_in(600)) { // Spawn nether creature!
mon_id type = mon_id(rng(mon_flying_polyp, mon_blank));
monster creature(g->mtypes[type]);
creature.spawn(x + rng(-3, 3), y + rng(-3, 3));
g->z.push_back(creature);
}
break;
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)
i++;
else {
item tmp = (*it)[i];
tmp.bday = int(g->turn);
it->erase(it->begin() + i);
i--;
std::vector<point> valid;
for (int xx = x - 1; xx <= x + 1; xx++) {
for (int yy = y - 1; yy <= y + 1; yy++) {
if (field_at(xx, yy).type == fd_push_items)
valid.push_back( point(xx, yy) );
}
}
if (!valid.empty()) {
point newp = valid[rng(0, valid.size() - 1)];
add_item(newp.x, newp.y, tmp);
if (g->u.posx == newp.x && g->u.posy == newp.y) {
g->add_msg("A %s hits you!", tmp.tname().c_str());
g->u.hit(g, random_body_part(), rng(0, 1), 6, 0);
}
int npcdex = g->npc_at(newp.x, newp.y),
mondex = g->mon_at(newp.x, newp.y);
if (npcdex != -1) {
int junk;
npc *p = &(g->active_npc[npcdex]);
p->hit(g, random_body_part(), rng(0, 1), 6, 0);
if (g->u_see(newp.x, newp.y, junk))
g->add_msg("A %s hits %s!", tmp.tname().c_str(), p->name.c_str());
}
if (mondex != -1) {
int junk;
monster *mon = &(g->z[mondex]);
mon->hurt(6 - mon->armor_bash());
if (g->u_see(newp.x, newp.y, junk))
g->add_msg("A %s hits the %s!", tmp.tname().c_str(),
mon->name().c_str());
}
}
}
}
} break;
case fd_shock_vent:
if (cur->density > 1) {
if (one_in(5))
cur->density--;
} else {
cur->density = 3;
int num_bolts = rng(3, 6);
for (int i = 0; i < num_bolts; i++) {
int xdir = 0, ydir = 0;
while (xdir == 0 && ydir == 0) {
xdir = rng(-1, 1);
ydir = rng(-1, 1);
}
int dist = rng(4, 12);
int boltx = x, bolty = y;
for (int n = 0; n < dist; n++) {
boltx += xdir;
bolty += ydir;
add_field(g, boltx, bolty, fd_electricity, rng(2, 3));
if (one_in(4)) {
if (xdir == 0)
xdir = rng(0, 1) * 2 - 1;
else
xdir = 0;
}
if (one_in(4)) {
if (ydir == 0)
ydir = rng(0, 1) * 2 - 1;
else
ydir = 0;
}
}
}
}
break;
case fd_acid_vent:
if (cur->density > 1) {
if (cur->age >= 10) {
cur->density--;
cur->age = 0;
}
} else {
cur->density = 3;
for (int i = x - 5; i <= x + 5; i++) {
for (int j = y - 5; j <= y + 5; j++) {
if (field_at(i, j).type == fd_null || field_at(i, j).density == 0) {
int newdens = 3 - (rl_dist(x, y, i, j) / 2) + (one_in(3) ? 1 : 0);
if (newdens > 3)
newdens = 3;
if (newdens > 0)
add_field(g, i, j, fd_acid, newdens);
}
}
}
}
break;
} // switch (curtype)
cur->age++;
if (fieldlist[cur->type].halflife > 0) {
if (cur->age > 0 &&
dice(3, cur->age) > dice(3, fieldlist[cur->type].halflife)) {
cur->age = 0;
cur->density--;
}
if (cur->density <= 0)
field_at(x, y) = field();
if (cur->density <= 0) { // Totally dissapated.
grid[gridn]->field_count--;
grid[gridn]->fld[locx][locy] = field();
}
}
}
}
@@ -323,58 +664,103 @@ bool map::process_fields(game *g)
void map::step_in_field(int x, int y, game *g)
{
field *cur = &field_at(x, y);
int veh_part;
vehicle *veh = NULL;
bool inside = false;
int adjusted_intensity;
if (g->u.in_vehicle) {
veh = g->m.veh_at(x, y, veh_part);
inside = (veh && veh->is_inside(veh_part));
}
switch (cur->type) {
case fd_null:
case fd_blood: // It doesn't actually do anything
case fd_bile: // Ditto
return;
case fd_web: {
if (!g->u.has_trait(PF_WEB_WALKER) && !g->u.in_vehicle) {
int web = cur->density * 5 - g->u.disease_level(DI_WEBBED);
if (web > 0)
g->u.add_disease(DI_WEBBED, web, g);
remove_field(x, y);
}
} break;
case fd_acid:
if (cur->density == 3) {
if (cur->density == 3 && !inside) {
g->add_msg("The acid burns your legs and feet!");
g->u.hit(g, bp_feet, 0, 0, rng(4, 10));
g->u.hit(g, bp_feet, 1, 0, rng(4, 10));
g->u.hit(g, bp_legs, 0, 0, rng(2, 8));
g->u.hit(g, bp_legs, 1, 0, rng(2, 8));
} else {
g->add_msg("The acid burns your feet!");
g->u.hit(g, bp_feet, 0, 0, rng(cur->density, 4 * cur->density));
g->u.hit(g, bp_feet, 1, 0, rng(cur->density, 4 * cur->density));
}
break;
case fd_sap:
if( g->u.in_vehicle ) break;
g->add_msg("The sap sticks to you!");
g->u.add_disease(DI_SAP, cur->density * 2, g);
if (cur->density == 1)
remove_field(x, y);
else
cur->density--;
break;
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 (cur->density == 1) {
if (adjusted_intensity == 1) {
g->add_msg("You burn your legs and feet!");
g->u.hit(g, bp_feet, 0, 0, rng(2, 6));
g->u.hit(g, bp_feet, 1, 0, rng(2, 6));
g->u.hit(g, bp_legs, 0, 0, rng(1, 4));
g->u.hit(g, bp_legs, 1, 0, rng(1, 4));
} else if (cur->density == 2) {
} else if (adjusted_intensity == 2) {
g->add_msg("You're burning up!");
g->u.hit(g, bp_legs, 0, 0, rng(2, 6));
g->u.hit(g, bp_legs, 1, 0, rng(2, 6));
g->u.hit(g, bp_torso, 0, 4, rng(4, 9));
g->u.infect(DI_SMOKE, bp_mouth, 5, 20, g);
} else if (cur->density == 3) {
} else if (adjusted_intensity == 3) {
g->add_msg("You're set ablaze!");
g->u.hit(g, bp_legs, 0, 0, rng(2, 6));
g->u.hit(g, bp_legs, 1, 0, rng(2, 6));
g->u.hit(g, bp_torso, 0, 4, rng(4, 9));
g->u.add_disease(DI_ONFIRE, 5, g);
g->u.infect(DI_SMOKE, bp_mouth, 7, 30, g);
}
if (adjusted_intensity == 2)
g->u.infect(DI_SMOKE, bp_mouth, 5, 20, g);
else if (adjusted_intensity == 3)
g->u.infect(DI_SMOKE, bp_mouth, 7, 30, g);
}
break;
case fd_smoke:
if (cur->density == 3)
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))
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;
case fd_nuke_gas:
g->u.radiation += rng(0, cur->density * (cur->density + 1));
if (cur->density == 3) {
@@ -382,31 +768,68 @@ void map::step_in_field(int x, int y, game *g)
g->u.hurtall(rng(1, 3));
}
break;
case fd_flame_burst:
if (inside) break;
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));
g->u.hit(g, bp_torso, 0, 4, rng(4, 9));
} else
g->add_msg("These flames do not burn you.");
break;
case fd_electricity:
g->add_msg("You're electrocuted!");
g->u.hurtall(rng(1, cur->density));
if (one_in(8 - cur->density) && !one_in(30 - g->u.str_cur)) {
g->add_msg("You're paralyzed!");
g->u.moves -= cur->density * 150;
if (g->u.has_artifact_with(AEP_RESIST_ELECTRICITY))
g->add_msg("The electricity flows around you.");
else {
g->add_msg("You're electrocuted!");
g->u.hurtall(rng(1, cur->density));
if (one_in(8 - cur->density) && !one_in(30 - g->u.str_cur)) {
g->add_msg("You're paralyzed!");
g->u.moves -= rng(cur->density * 50, cur->density * 150);
}
}
break;
case fd_fatigue:
if (rng(0, 2) < cur->density) {
g->add_msg("You're violently teleported!");
g->u.hurtall(cur->density);
g->teleport();
}
break;
case fd_shock_vent:
case fd_acid_vent:
remove_field(x, y);
break;
}
}
void map::mon_in_field(int x, int y, game *g, monster *z)
{
if (z->has_flag(MF_DIGS))
return; // Digging monsters are immune to fields
field *cur = &field_at(x, y);
int dam = 0, j;
int dam = 0;
switch (cur->type) {
case fd_null:
case fd_blood: // It doesn't actually do anything
case fd_bile: // Ditto
break;
case fd_web:
if (!z->has_flag(MF_WEBWALK)) {
z->speed *= .8;
remove_field(x, y);
}
break;
case fd_acid:
if (!z->has_flag(MF_DIGS) && !z->has_flag(MF_ACIDPROOF)) {
if (!z->has_flag(MF_DIGS) && !z->has_flag(MF_FLIES) &&
!z->has_flag(MF_ACIDPROOF)) {
if (cur->density == 3)
dam = rng(4, 10) + rng(2, 8);
else
@@ -414,6 +837,14 @@ void map::mon_in_field(int x, int y, game *g, monster *z)
}
break;
case fd_sap:
z->speed -= cur->density * 5;
if (cur->density == 1)
remove_field(x, y);
else
cur->density--;
break;
case fd_fire:
if (z->made_of(FLESH))
dam = 3;
@@ -421,22 +852,32 @@ void map::mon_in_field(int x, int y, game *g, monster *z)
dam = 12;
if (z->made_of(PAPER) || z->made_of(LIQUID) || z->made_of(POWDER) ||
z->made_of(WOOD) || z->made_of(COTTON) || z->made_of(WOOL))
dam = 50;
dam = 20;
if (z->made_of(STONE) || z->made_of(KEVLAR) || z->made_of(STEEL))
dam = -25;
dam = -20;
if (z->has_flag(MF_FLIES))
dam -= 20;
dam -= 15;
if (cur->density == 1)
dam += rng(4, 12);
dam += rng(2, 6);
else if (cur->density == 2) {
dam += rng(6, 18);
z->moves -= 50;
dam += rng(6, 12);
if (!z->has_flag(MF_FLIES)) {
z->moves -= 20;
if (!z->made_of(LIQUID) && !z->made_of(STONE) && !z->made_of(KEVLAR) &&
!z->made_of(STEEL) && !z->has_flag(MF_FIREY))
z->add_effect(ME_ONFIRE, rng(3, 8));
}
} else if (cur->density == 3) {
dam += rng(10, 30);
z->moves -= 80;
dam += rng(10, 20);
if (!z->has_flag(MF_FLIES) || one_in(3)) {
z->moves -= 40;
if (!z->made_of(LIQUID) && !z->made_of(STONE) && !z->made_of(KEVLAR) &&
!z->made_of(STEEL) && !z->has_flag(MF_FIREY))
z->add_effect(ME_ONFIRE, rng(8, 12));
}
}
break;
// Drop through to smoke
case fd_smoke:
if (cur->density == 3)
@@ -446,19 +887,28 @@ void map::mon_in_field(int x, int y, game *g, monster *z)
break;
case fd_tear_gas:
if (cur->density == 3) {
z->speed -= rng(30, 60);
dam = rng(8, 20);
} else if (cur->density == 2) {
z->speed -= rng(10, 25);
dam = rng(4, 10);
} else
z->speed -= rng(0, 6);
if (z->made_of(VEGGY)) {
z->speed -= rng(cur->density * 5, cur->density * 12);
dam += cur->density * 10;
if (z->made_of(FLESH) || z->made_of(VEGGY)) {
z->add_effect(ME_BLIND, cur->density * 8);
if (cur->density == 3) {
z->add_effect(ME_STUNNED, rng(10, 20));
dam = rng(4, 10);
} else if (cur->density == 2) {
z->add_effect(ME_STUNNED, rng(5, 10));
dam = rng(2, 5);
} else
z->add_effect(ME_STUNNED, rng(1, 5));
if (z->made_of(VEGGY)) {
z->speed -= rng(cur->density * 5, cur->density * 12);
dam += cur->density * rng(8, 14);
}
}
break;
case fd_toxic_gas:
dam = cur->density;
z->speed -= cur->density;
break;
case fd_nuke_gas:
if (cur->density == 3) {
z->speed -= rng(60, 120);
@@ -475,13 +925,58 @@ void map::mon_in_field(int x, int y, game *g, monster *z)
dam *= cur->density;
}
break;
case fd_flame_burst:
if (z->made_of(FLESH))
dam = 3;
if (z->made_of(VEGGY))
dam = 12;
if (z->made_of(PAPER) || z->made_of(LIQUID) || z->made_of(POWDER) ||
z->made_of(WOOD) || z->made_of(COTTON) || z->made_of(WOOL))
dam = 50;
if (z->made_of(STONE) || z->made_of(KEVLAR) || z->made_of(STEEL))
dam = -25;
dam += rng(0, 8);
z->moves -= 20;
break;
case fd_electricity:
dam = rng(1, cur->density);
if (one_in(8 - cur->density) && one_in(z->armor()))
if (one_in(8 - cur->density))
z->moves -= cur->density * 150;
break;
case fd_fatigue:
if (rng(0, 2) < cur->density) {
dam = cur->density;
int tries = 0;
int newposx, newposy;
do {
newposx = rng(z->posx - SEEX, z->posx + SEEX);
newposy = rng(z->posy - SEEY, z->posy + SEEY);
tries++;
} while (g->m.move_cost(newposx, newposy) == 0 && tries != 10);
if (tries == 10)
g->explode_mon(g->mon_at(z->posx, z->posy));
else {
int mon_hit = g->mon_at(newposx, newposy), t;
if (mon_hit != -1) {
if (g->u_see(z, t))
g->add_msg("The %s teleports into a %s, killing them both!",
z->name().c_str(), g->z[mon_hit].name().c_str());
g->explode_mon(mon_hit);
} else {
z->posx = newposx;
z->posy = newposy;
}
}
}
break;
}
z->hurt(dam);
if (dam > 0)
z->hurt(dam);
}
bool vector_has(std::vector <item> vec, itype_id type)
+6453 -3277
View File
File diff suppressed because it is too large Load Diff
+316 -94
View File
@@ -4,6 +4,7 @@
#include "mtype.h"
#include "monster.h"
#include "map.h"
#include "lightmap.h"
#include "player.h"
#include "overmap.h"
#include "omdata.h"
@@ -11,10 +12,27 @@
#include "crafting.h"
#include "trap.h"
#include "npc.h"
#include "tutorial.h"
#include "faction.h"
#include "event.h"
#include "mission.h"
#include "weather.h"
#include "construction.h"
#include "calendar.h"
#include "posix_time.h"
#include "artifact.h"
#include "mutation.h"
#include "gamemode.h"
#include "action.h"
#include <vector>
#include <map>
#include <stdarg.h>
#define LONG_RANGE 10
#define BLINK_SPEED 300
#define BULLET_SPEED 10000000
#define EXPLOSION_SPEED 70000000
#define PICKUP_RANGE 2
enum tut_type {
TUT_NULL,
@@ -22,188 +40,392 @@ enum tut_type {
TUT_MAX
};
enum input_ret {
IR_GOOD,
IR_BAD,
IR_TIMEOUT
};
enum quit_status {
QUIT_NO = 0, // Still playing
QUIT_MENU, // Quit at the menu
QUIT_SUICIDE, // Quit with 'Q'
QUIT_SAVED, // Saved and quit
QUIT_DIED, // Actual death
QUIT_DELETE_WORLD // Quit and delete world
};
struct monster_and_count
{
monster mon;
int count;
monster_and_count(monster M, int C) : mon (M), count (C) {};
};
struct game_message
{
calendar turn;
int count;
std::string message;
game_message() { turn = 0; count = 1; message = ""; };
game_message(calendar T, std::string M) : turn (T), message (M) { count = 1; };
};
struct mtype;
struct mission_type;
class map;
class player;
class calendar;
struct mutation_branch;
class game
{
public:
game();
~game();
void setup();
bool game_quit(); // True if we actually quit the game - used in main.cpp
quit_status uquit; // used in main.cpp to determine what type of quit
void save();
void delete_save();
void cleanup_at_end();
bool do_turn();
void tutorial_message(tut_lesson lesson);
void draw();
void draw_ter();
void draw_ter(int posx = -999, int posy = -999);
void advance_nextinv(); // Increment the next inventory letter
void decrease_nextinv(); // Decrement the next inventory letter
void vadd_msg(const char* msg, va_list ap );
void add_msg(const char* msg, ...);
void add_event(event_type type, int on_turn, faction* rel);
void add_msg_if_player(player *p, const char* msg, ...);
void add_event(event_type type, int on_turn, int faction_id = -1,
int x = -1, int y = -1);
bool event_queued(event_type type);
// Sound at (x, y) of intensity (vol), described to the player is (description)
void sound(int x, int y, int vol, std::string description);
// creates a list of coordinates to draw footsteps
void add_footstep(int x, int y, int volume, int distance);
std::vector<point> footsteps;
// visual cue to monsters moving out of the players sight
void draw_footsteps();
// Explosion at (x, y) of intensity (power), with (shrapnel) chunks of shrapnel
void explosion(int x, int y, int power, int shrapnel, bool fire);
// Flashback at (x, y)
void flashbang(int x, int y);
// Move the player vertically, if (force) then they fell
void vertical_move(int z, bool force);
void use_computer(int x, int y);
bool pl_refill_vehicle (vehicle &veh, int part, bool test=false);
void resonance_cascade(int x, int y);
void scrambler_blast(int x, int y);
void emp_blast(int x, int y);
int npc_at(int x, int y); // Index of the npc at (x, y); -1 for none
int npc_by_id(int id); // Index of the npc at (x, y); -1 for none
// void build_monmap(); // Caches data for mon_at()
int mon_at(int x, int y); // Index of the monster at (x, y); -1 for none
void kill_mon(int index); // Kill that monster; fixes any pointers etc
void plfire(bool burst); // Player fires a gun (setup of target)...
bool is_empty(int x, int y); // True if no PC, no monster, move cost > 0
bool isBetween(int test, int down, int up);
bool is_in_sunlight(int x, int y); // Checks outdoors + sunny
// Kill that monster; fixes any pointers etc
void kill_mon(int index, bool player_did_it = false);
void explode_mon(int index); // Explode a monster; like kill_mon but messier
// hit_monster_with_flags processes ammo flags (e.g. incendiary, etc)
void hit_monster_with_flags(monster &z, unsigned int flags);
void plfire(bool burst); // Player fires a gun (target selection)...
// ... a gun is fired, maybe by an NPC (actual damage, etc.).
void fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
bool burst);
void throw_item(player &p, int tarx, int tary, item &thrown,
std::vector<point> &trajectory);
void cancel_activity();
void cancel_activity_query(std::string message);
void teleport();
void cancel_activity_query(const char* message, ...);
int assign_mission_id(); // Just returns the next available one
void give_mission(mission_id type); // Create the mission and assign it
void assign_mission(int id); // Just assign an existing mission
// reserve_mission() creates a new mission of the given type and pushes it to
// active_missions. The function returns the UID of the new mission, which can
// then be passed to a MacGuffin or something else that needs to track a mission
int reserve_mission(mission_id type, int npc_id = -1);
int reserve_random_mission(mission_origin origin, point p = point(-1, -1),
int npc_id = -1);
npc* find_npc(int id);
mission* find_mission(int id); // Mission with UID=id; NULL if non-existant
mission_type* find_mission_type(int id); // Same, but returns its type
bool mission_complete(int id, int npc_id); // True if we made it
bool mission_failed(int id); // True if we failed it
void wrap_up_mission(int id); // Perform required actions
void fail_mission(int id); // Perform required actions, move to failed list
void mission_step_complete(int id, int step); // Parial completion
void process_missions(); // Process missions, see if time's run out
void teleport(player *p = NULL);
void plswim(int x, int y); // Called by plmove. Handles swimming
// when player is thrown (by impact or something)
void fling_player_or_monster(player *p, monster *zz, int dir, int flvel);
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();
unsigned char light_level();
void reset_light_level();
int assign_npc_id();
int assign_faction_id();
faction* faction_by_id(int it);
bool sees_u(int x, int y, int &t);
bool u_see (int x, int y, int &t);
bool u_see (monster *mon, int &t);
bool pl_sees(player *p, monster *mon, int &t);
void refresh_all();
void update_map(int &x, int &y); // Called by plmove when the map updates
void update_overmap_seen(); // Update which overmap tiles we can see
point om_location(); // levx and levy converted to overmap coordinates
char inv(std::string title = "INVENTORY:");
faction* random_good_faction();
faction* random_evil_faction();
itype* new_artifact();
itype* new_natural_artifact(artifact_natural_property prop = ARTPROP_NULL);
void process_artifact(item *it, player *p, bool wielded = false);
void add_artifact_messages(std::vector<art_effect_passive> effects);
void peek();
point look_around();// Look at nearby terrain ';'
void list_items(); //List all items around the player
bool list_items_match(std::string sText, std::string sPattern);
std::string sFilter;
char inv(std::string title = "Inventory:");
char inv_type(std::string title = "Inventory:", int inv_item_type = 0);
std::vector<item> multidrop();
faction* list_factions(std::string title = "FACTIONS:");
point find_item(item *it);
void remove_item(item *it);
inventory crafting_inventory(); // inv_from_map, inv, & 'weapon'
void consume_items(std::vector<component> components);
void consume_tools(std::vector<component> tools);
std::vector <itype*> itypes;
std::vector <mtype*> mtypes;
std::vector <vehicle*> vtypes;
std::vector <trap*> traps;
std::vector<recipe*> recipes; // The list of valid recipes
std::vector<constructable*> constructions; // The list of constructions
std::vector <itype_id> mapitems[num_itloc]; // Items at various map types
std::vector <items_location_and_chance> monitems[num_monsters];
unsigned int turn;
std::vector <mission_type> mission_types; // The list of mission templates
mutation_branch mutation_data[PF_MAX2]; // Mutation data
std::map<char, action_id> keymap;
calendar turn;
signed char temperature; // The air temperature
weather_type weather; // Weather pattern--SEE weather.h
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;
std::vector<monster> monbuff;
int monbuffx, monbuffy, monbuffz, monbuff_turn;
std::vector<monster_and_count> coming_to_stairs;
int monstairx, monstairy, monstairz;
std::vector<npc> active_npc;
std::vector<mon_id> moncats[num_moncats];
std::vector<faction> factions;
std::vector<mission> active_missions; // Missions which may be assigned
// NEW: Dragging a piece of furniture, with a list of items contained
ter_id dragging;
std::vector<item> items_dragged;
int weight_dragged; // Computed once, when you start dragging
bool debugmon;
bool no_npc;
// Display data... TODO: Make this more portable?
int VIEWX;
int VIEWY;
int TERRAIN_WINDOW_WIDTH;
int TERRAIN_WINDOW_HEIGHT;
WINDOW *w_terrain;
WINDOW *w_minimap;
WINDOW *w_HP;
WINDOW *w_moninfo;
WINDOW *w_messages;
WINDOW *w_location;
WINDOW *w_status;
overmap *om_hori, *om_vert, *om_diag; // Adjacent overmaps
private:
// Game-start procedures
bool opening_screen();
void load(std::string name);
void save();
void start_game();
void start_tutorial(tut_type type);
bool opening_screen();// Warn about screen size, then present the main menu
bool load_master(); // Load the master data file, with factions &c
void load(std::string name); // Load a player-specific save file
void start_game(); // Starts a new game
void start_special_game(special_game_id gametype); // See gamemode.cpp
// Data Initialization
void init_itypes();
void init_mapitems();
void init_mtypes();
void init_moncats();
void init_monitems();
void init_traps();
void init_recipes();
void init_factions();
void init_itypes(); // Initializes item types
void init_mapitems(); // Initializes item placement
void init_mtypes(); // Initializes monster types
void init_moncats(); // Initializes monster categories
void init_monitems(); // Initializes monster inventory selection
void init_traps(); // Initializes trap types
void init_recipes(); // Initializes crafting recipes
void init_construction(); // Initializes construction "recipes"
void init_missions(); // Initializes mission templates
void init_mutations(); // Initializes mutation "tech tree"
void init_vehicles(); // Initializes vehicle types
void init_autosave(); // Initializes autosave parameters
void load_keyboard_settings(); // Load keybindings 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
void create_factions(); // Creates new factions (for a new game world)
void create_starting_npcs(); // Creates NPCs that start near you
// Player actions
void wish();
void plmove(int x, int y);
void plswim(int x, int y);
void update_map(int &x, int &y); // Called by plmove, sometimes
void spawn_mon(int shift, int shifty); // Called by update_map, sometimes
mon_id valid_monster_from(std::vector<mon_id> group);
int valid_group(mon_id type, int x, int y);
moncat_id mt_to_mc(mon_id type);
void wait();
void open();
void close();
void smash();
void craft(); // See crafting.cpp
void make_craft(recipe *making); // See crafting.cpp
void complete_craft(); // See crafting.cpp
void wish(); // Cheat by wishing for an item 'Z'
void monster_wish(); // Create a monster
void mutation_wish(); // Mutate
void pldrive(int x, int y); // drive vehicle
void plmove(int x, int y); // Standard movement; handles attacks, traps, &c
void wait(); // Long wait (player action) '^'
void open(); // Open a door 'o'
void close(); // Close a door 'c'
void smash(); // Smash terrain
void craft(); // See crafting.cpp
void make_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 examine();
void look_around();
void pickup(int posx, int posy, int min);
void drop();
void butcher();
void eat();
void use_item();
void wear();
void takeoff();
void reload();
void unload();
void wield();
void read();
void chat(); // Chat to an NPC
void plthrow();
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
bool player_can_build(player &p, inventory inv, constructable* con,
const int level = -1, bool cont = false,
bool exact_level=false);
void place_construction(constructable *con); // See construction.cpp
void complete_construction(); // See construction.cpp
bool pl_choose_vehicle (int &x, int &y);
bool vehicle_near ();
void handbrake ();
void examine();// Examine nearby terrain 'e'
// open vehicle interaction screen
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'
void reassign_item(); // Reassign the letter of an item '='
void butcher(); // Butcher a corpse 'B'
void complete_butcher(int index); // Finish the butchering process
void forage(); // Foraging ('a' on underbrush)
void eat(char chInput = '.'); // Eat food or fuel 'E' (or 'a')
void use_item(char chInput = '.');// Use item; also tries E,R,W 'a'
void use_wielded_item();
void wear(char chInput = '.'); // Wear armor 'W' (or 'a')
void takeoff(char chInput = '.'); // Remove armor 'T'
void reload(); // Reload a wielded gun/tool 'r'
void reload(char chInput);
void unload(); // Unload a wielded gun/tool 'U'
void unload(char chInput);
void wield(char chInput = '.'); // Wield a weapon 'w'
void read(); // Read a book 'R' (or 'a')
void chat(); // Talk to a nearby NPC 'C'
void plthrow(char chInput = '.'); // Throw an item 't'
void help(); // Help screen '?'
// Target is an interactive function which allows the player to choose a nearby
// square. It display information on any monster/NPC on that square, and also
// returns a Bresenham line to that square. It is called by plfire() and
// throw().
std::vector<point> target(int &x, int &y, int lowx, int lowy, int hix,
int hiy, std::vector <monster> t, int &target,
item *relevent);
void help();
// Map updating and monster spawning
void replace_stair_monsters();
void update_stair_monsters();
void despawn_monsters(const bool stairs = false, const int shiftx = 0, const int shifty = 0);
void spawn_mon(int shift, int shifty); // Called by update_map, sometimes
mon_id valid_monster_from(std::vector<mon_id> group);
int valid_group(mon_id type, int x, int y);// Picks a group from cur_om
moncat_id mt_to_mc(mon_id type);// Monster type to monster category
void set_adjacent_overmaps(bool from_scratch = false);
// Routine loop functions, approximately in order of execution
void monmove();
void om_npcs_move();
void check_warmth();
void update_skills();
void process_events();
void process_activity();
void hallucinate();
void mon_info();
void get_input();
void update_scent();
bool is_game_over();
void gameover();
void write_msg();
void draw_minimap();
void draw_HP();
void cleanup_dead(); // Delete any dead NPCs/monsters
void monmove(); // Monster movement
void rustCheck(); // Degrades practice levels
void update_bodytemp(); // Maintains body temperature
void process_events(); // Processes and enacts long-term events
void process_activity(); // Processes and enacts the player's activity
void update_weather(); // Updates the temperature and weather patten
void hallucinate(const int x, const int y); // Prints hallucination junk to the screen
void mon_info(); // Prints a list of nearby monsters (top right)
bool handle_action();
void update_scent(); // Updates the scent map
bool is_game_over(); // Returns true if the player quit or died
void death_screen(); // Display our stats, "GAME OVER BOO HOO"
void gameover(); // Ends the game
void write_msg(); // Prints the messages in the messages list
void msg_buffer(); // Opens a window with old messages in it
void draw_minimap(); // Draw the 5x5 minimap
void draw_HP(); // Draws the player's HP and Power level
int autosave_timeout(); // If autosave enabled, how long we should wait for user inaction before saving.
void autosave(); // Saves map
// On-request draw functions
void draw_overmap();
void disp_kills();
void disp_NPCs();
void draw_overmap(); // Draws the overmap, allows note-taking etc.
void disp_kills(); // Display the player's kill counts
void disp_NPCs(); // Currently UNUSED. Lists global NPCs.
void list_missions(); // Listed current, completed and failed missions.
// If x & y are OOB, gens a new overmap returns the proper terrain; also, may
// mark the square as seen by the player
// If x & y are OOB, creates a new overmap and returns the proper terrain; also,
// may mark the square as seen by the player
oter_id ter_at(int x, int y, bool& mark_as_seen);
// Debug functions
void debug();
void display_scent();
void mondebug();
void groupdebug();
// Data
void debug(); // All-encompassing debug screen. TODO: This.
void display_scent(); // Displays the scent map
void mondebug(); // Debug monster behavior directly
void groupdebug(); // Get into on monster groups
// ########################## DATA ################################
signed char last_target;// The last monster targeted
char run_mode; // 0 - Normal run always; 1 - Running allowed, but if a new
// monsters spawns, go to 2 - No movement allowed
int mostseen; // # of mons seen last turn; if this increases, run_mode++
int mostseen; // # of mons seen last turn; if this increases, run_mode++
bool autosafemode; // is autosafemode enabled?
int turnssincelastmon; // needed for auto run mode
// quit_status uquit; // Set to true if the player quits ('Q')
bool uquit;
int nextspawn;
signed char temp;
std::vector <std::string> messages;
char curmes; // The last-seen message. Older than 256 is deleted.
int grscent[SEEX * 3][SEEY * 3]; // The scent map
calendar nextspawn; // The turn on which monsters will spawn next.
calendar nextweather; // The turn on which weather will shift next.
int next_npc_id, next_faction_id, next_mission_id; // Keep track of UIDs
std::vector <game_message> messages; // Messages to be printed
int curmes; // The last-seen message.
int grscent[SEEX * MAPSIZE][SEEY * MAPSIZE]; // The scent map
//int monmap[SEEX * MAPSIZE][SEEY * MAPSIZE]; // Temp monster map, for mon_at()
int nulscent; // Returned for OOB scent checks
std::vector<recipe> recipes;
std::vector<event> events;
int kills[num_monsters];
std::vector<event> events; // Game events to be processed
int kills[num_monsters]; // Player's kill count
std::string last_action; // The keypresses of last turn
bool tutorials_seen[NUM_LESSONS]; // Which tutorial lessons have we learned
bool in_tutorial;
int moves_since_last_save;
int item_exchanges_since_save;
unsigned char latest_lightlevel;
calendar latest_lightlevel_turn;
special_game *gamemode;
};
#endif
+35
View File
@@ -0,0 +1,35 @@
#include "gamemode.h"
#include "output.h"
std::string special_game_name(special_game_id id)
{
switch (id) {
case SGAME_NULL:
case NUM_SPECIAL_GAMES: return "nethack (this is a bug)";
case SGAME_TUTORIAL: return "Tutorial";
case SGAME_DEFENSE: return "Defense";
default: return "Uncoded (this is a bug)";
}
}
special_game* get_special_game(special_game_id id)
{
special_game* ret;
switch (id) {
case SGAME_NULL:
ret = new special_game;
break;
case SGAME_TUTORIAL:
ret = new tutorial_game;
break;
case SGAME_DEFENSE:
ret = new defense_game;
break;
default:
debugmsg("Missing something in get_special_game()?");
ret = new special_game;
break;
}
return ret;
}
+182
View File
@@ -0,0 +1,182 @@
#ifndef _GAMEMODE_H_
#define _GAMEMODE_H_
#include <vector>
#include <string>
#include "action.h"
#include "itype.h"
#include "mtype.h"
class game;
struct special_game;
enum special_game_id {
SGAME_NULL = 0,
SGAME_TUTORIAL,
SGAME_DEFENSE,
NUM_SPECIAL_GAMES
};
std::string special_game_name(special_game_id id);
special_game* get_special_game(special_game_id id);
struct special_game
{
virtual special_game_id id() { return SGAME_NULL; };
// init is run when the game begins
virtual bool init(game *g) { return true; };
// per_turn is run every turn--before any player actions
virtual void per_turn(game *g) { };
// pre_action is run after a keypress, but before the game handles the action
// It may modify the action, e.g. to cancel it
virtual void pre_action(game *g, action_id &act) { };
// post_action is run after the game handles the action
virtual void post_action(game *g, action_id act) { };
// game_over is run when the player dies (or the game otherwise ends)
virtual void game_over(game *g) { };
};
// TUTORIAL:
enum tut_lesson {
LESSON_INTRO,
LESSON_MOVE, LESSON_LOOK, LESSON_OPEN, LESSON_CLOSE, LESSON_SMASH,
LESSON_WINDOW, LESSON_PICKUP, LESSON_EXAMINE, LESSON_INTERACT,
LESSON_FULL_INV, LESSON_WIELD_NO_SPACE, LESSON_AUTOWIELD, LESSON_ITEM_INTO_INV,
LESSON_GOT_ARMOR, LESSON_GOT_WEAPON, LESSON_GOT_FOOD, LESSON_GOT_TOOL,
LESSON_GOT_GUN, LESSON_GOT_AMMO, LESSON_WORE_ARMOR, LESSON_WORE_STORAGE,
LESSON_WORE_MASK,
LESSON_WEAPON_INFO, LESSON_HIT_MONSTER, LESSON_PAIN, LESSON_BUTCHER,
LESSON_TOOK_PAINKILLER, LESSON_TOOK_CIG, LESSON_DRANK_WATER,
LESSON_ACT_GRENADE, LESSON_ACT_BUBBLEWRAP,
LESSON_OVERLOADED,
LESSON_GUN_LOAD, LESSON_GUN_FIRE, LESSON_RECOIL,
LESSON_STAIRS, LESSON_DARK_NO_FLASH, LESSON_DARK, LESSON_PICKUP_WATER,
NUM_LESSONS
};
struct tutorial_game : public special_game
{
virtual special_game_id id() { return SGAME_TUTORIAL; };
virtual bool init(game *g);
virtual void per_turn(game *g);
virtual void pre_action(game *g, action_id &act);
virtual void post_action(game *g, action_id act);
virtual void game_over(game *g) { };
private:
void add_message(game *g, tut_lesson lesson);
bool tutorials_seen[NUM_LESSONS];
};
// DEFENSE
enum defense_style {
DEFENSE_CUSTOM = 0,
DEFENSE_EASY,
DEFENSE_MEDIUM,
DEFENSE_HARD,
DEFENSE_SHAUN,
DEFENSE_DAWN,
DEFENSE_SPIDERS,
DEFENSE_TRIFFIDS,
DEFENSE_SKYNET,
DEFENSE_LOVECRAFT,
NUM_DEFENSE_STYLES
};
enum defense_location {
DEFLOC_NULL = 0,
DEFLOC_HOSPITAL,
DEFLOC_MALL,
DEFLOC_BAR,
DEFLOC_MANSION,
NUM_DEFENSE_LOCATIONS
};
enum caravan_category {
CARAVAN_CART = 0,
CARAVAN_MELEE,
CARAVAN_GUNS,
CARAVAN_COMPONENTS,
CARAVAN_FOOD,
CARAVAN_CLOTHES,
CARAVAN_TOOLS,
NUM_CARAVAN_CATEGORIES
};
struct defense_game : public special_game
{
defense_game();
virtual special_game_id id() { return SGAME_DEFENSE; };
virtual bool init(game *g);
virtual void per_turn(game *g);
virtual void pre_action(game *g, action_id &act);
virtual void post_action(game *g, action_id act);
virtual void game_over(game *g);
private:
void init_to_style(defense_style new_style);
void load_style(std::string style_name);
void setup();
void refresh_setup(WINDOW *w, int selection);
void init_itypes(game *g);
void init_mtypes(game *g);
void init_constructions(game *g);
void init_recipes(game *g);
void init_map(game *g);
std::vector<itype_id> carvan_items(caravan_category cat);
void spawn_wave(game *g);
void caravan(game *g);
std::vector<mon_id> pick_monster_wave(game *g);
void spawn_wave_monster(game *g, mtype *type);
std::string special_wave_message(std::string name);
// DATA
int current_wave;
defense_style style; // What type of game is it?
defense_location location; // Where are we?
int initial_difficulty; // Total "level" of monsters in first wave
int wave_difficulty; // Increased "level" of monsters per wave
int time_between_waves; // Cooldown / building / healing time
int waves_between_caravans; // How many waves until we get to trade?
int initial_cash; // How much cash do we start with?
int cash_per_wave; // How much cash do we get per wave?
int cash_increase; // How much does the above increase per wave?
bool zombies;
bool specials;
bool spiders;
bool triffids;
bool robots;
bool subspace;
bool hunger; // Do we hunger?
bool thirst; // Do we thirst?
bool sleep; // Do we need to sleep?
bool mercenaries; // Do caravans offer the option of hiring a mercenary?
};
#endif
+26
View File
@@ -0,0 +1,26 @@
#include "graffiti.h"
#include "output.h"
graffiti::graffiti()
{
this->contents = NULL;
}
graffiti::graffiti(std::string newstr)
{
this->contents = new std::string(newstr);
}
graffiti::~graffiti()
{
// delete contents;
}
graffiti graffiti::operator=(graffiti rhs)
{
if(rhs.contents)
this->contents = new std::string(*rhs.contents);
else
this->contents = 0;
return *this;
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef _GRAFFITI_H_
#define _GRAFFITI_H_
#include <string>
#include "itype.h"
#include "mtype.h"
class graffiti
{
public:
graffiti();
graffiti(std::string contents);
~graffiti();
graffiti operator=(graffiti rhs);
std::string *contents;
};
#endif
+535 -103
View File
@@ -1,5 +1,6 @@
#include "game.h"
#include "keypress.h"
#include "options.h"
#ifndef LINE_XOXO
#define LINE_XOXO 4194424
@@ -22,28 +23,27 @@ void game::help()
erase();
mvprintz(0, 38, c_red, "HELP");
mvprintz(1, 0, c_white, "\
Please press one of the following for\n\
help on that topic:\n\
Please press one of the following for help on that topic:\n\
Press q or ESC to return to the game.\n\
\n\
a: Introduction\n\
b: Movement\n\
c: Hunger, Thirst, and Sleep\n\
d: Pain and Stimulatants\n\
e: Addiction\n\
f: Morale\n\
g: Radioactivity and Mutation\n\
h: Bionics\n\
i: Crafting\n\
j: Items overview\n\
k: Combat\n\
l: Survival tips\n\
a: Introduction i: Bionics\n\
b: Movement j: Crafting\n\
c: Viewing k: Traps\n\
d: Hunger, Thirst, and Sleep l: Items overview\n\
e: Pain and Stimulants m: Combat\n\
f: Addiction n: Unarmed Styles\n\
g: Morale and XP o: Survival tips\n\
h: Radioactivity and Mutation\n\
\n\
1: List of all commands\n\
2: List of item types and data\n\
3: Description of map symbols\n\
1: List of all commands (you can change key commands here)\n\
2: List of all options (you can change options here)\n\
3: List of item types and data\n\
4: Description of map symbols\n\
5: Description of gun types\n\
6: Frequently Asked Questions (Some spoilers!)\n\
\n\
q: Return to game");
ch = getch();
switch (ch) {
case 'a':
@@ -64,7 +64,7 @@ setting makes some tasks easier. Firearms, medications, and a wide variety of\n\
tools are all available to help you survive.");
getch();
break;
case 'b':
case 'B':
erase();
@@ -93,6 +93,20 @@ movement will be ignored if new monsters enter the player's view.");
case 'C':
erase();
mvprintz(0, 0, c_white, "\
The player can often see more than can be displayed on the screen at a time.\n\
Pressing ';' or 'x' enters look around mode, which allows you to scoll around\n\
using the movement keys and view irems on the map. Pressing 'V' provides a\n\
list of nearby visible items, though items shut away in crates, cubpoards,\n\
refrigerators and the like will not be displayed. Pressing Shift+vikeys\n\
will scroll the view persistently, allowing you to keep an eye on things\n\
as you move around.");
getch();
break;
case 'd':
case 'D':
erase();
mvprintz(0, 0, c_white, "\
As time passes, you will begin to feel hunger and thirst. A status warning\n\
at the bottom of the screen will appear. As hunger and thirst reach critical\n\
levels, you will begin to suffer movement penalties. Thirst is more dangerous\n\
@@ -100,7 +114,10 @@ than hunger. Finding food in a city is usually easy; outside of a city, you\n\
may have to hunt an animal, then stand over its corpse and 'B'utcher it into\n\
small chunks of meat. Likewise, outside of a city you may have to drink water\n\
from a river or other natural source; stand in shallow water and press 'g' or\n\
',' to pick it up. You'll need a watertight container.\n\
',' to pick it up. You'll need a watertight container. Be forewarned that\n\
some sources of water aren't trustworthy and may produce diseased water. To\n\
be sure it's healthy, run all water you collect through a water filter before\n\
drinking.\n\
\n\
Every 14 to 20 hours, you'll find yourself growing sleepy. If you do not\n\
sleep by pressing '$', you'll start suffering stat and movement penalties.\n\
@@ -111,8 +128,8 @@ try to find a safe place, or set traps for unwary intruders.");
getch();
break;
case 'd':
case 'D':
case 'e':
case 'E':
erase();
mvprintz(0, 0, c_white, "\
When you take damage from almost any source, you'll start to feel pain. Pain\n\
@@ -122,18 +139,29 @@ oxycodone, and more are all great options. Be aware that while under the\n\
influence of a lot of painkillers, the physiological effects may slow you or\n\
reduce your stats.\n\
\n\
Note that most painkillers take a little while to kick in. If you take some\n\
oxycodone, and don't notice the effects right away, don't start taking more;\n\
you may overdose and die!\n\
\n\
Pain will also disappear with time, so if drugs aren't available and you're\n\
in a lot of pain, it may be wise to find a safe spot and simply rest for an\n\
extended period of time.");
extended period of time.\n\
\n\
Another common class of drugs is stimulants. Stimulants provide you with a\n\
temporary rush of energy, increasing your movement speed and many stats, most\n\
notably intelligence, making them useful study aids. There are two drawbacks\n\
to stimulants; they make it more difficult to sleep, and, more importantly,\n\
most are highly addictive. Stimulants range from the caffeine rush of cola to\n\
the more intense high of Adderall and methamphetamine.");
getch();
break;
case 'e':
case 'E':
case 'f':
case 'F':
erase();
mvprintz(0, 0, c_white, "\
Many drugs have a potential for addiction. Each time you consume such a drug\n\
there is a chance that you will grow dependant on it. Consuming more of that\n\
there is a chance that you will grow dependent on it. Consuming more of that\n\
drug will increase your dependance. Effects vary greatly between drugs, but\n\
all addictions have only one cure; going cold turkey. The process may last\n\
days, and will leave you very weak, so try to do it in a safe area.\n\
@@ -143,8 +171,8 @@ the effects to cease immediately, but may deepen your dependance.");
getch();
break;
case 'f':
case 'F':
case 'g':
case 'G':
erase();
mvprintz(0, 0, c_white, "\
Your character has a morale level, which affects you in many ways. The\n\
@@ -164,12 +192,25 @@ Low morale will make you sluggish and unmotivated. It will also reduce your\n\
stats, particularly intelligence. If your morale drops very low, you may\n\
even commit suicide. Very high morale fills you with gusto and energy, and\n\
you will find yourself moving faster. At extremely high levels, you will\n\
receive stat bonuses.");
receive stat bonuses.\n\
\n\
Press any key for more...");
getch();
erase();
mvprintz(0, 0, c_white, "\
Morale is also responsible for filling your XP pool. This XP pool is used\n\
for improving your skills; as you use your skills, points are taken from the\n\
XP pool and placed into the skill used. If your XP pool is empty, your\n\
skills cannot be improved except through the use of books.\n\
\n\
Your XP pool will not fill unless your morale is at least 0. A morale level\n\
between 0 and 100 gives the percentage chance for your XP to increase by 1\n\
each turn. Above 100, you get 1 XP point each turn for every 100 morale.");
getch();
break;
case 'g':
case 'G':
case 'h':
case 'H':
erase();
mvprintz(0, 0, c_white, "\
Though it is relatively rare, certain areas of the world may be contamiated\n\
@@ -180,13 +221,13 @@ slowly decrease. Taking iodine tablets will help speed the process.\n\
If you become very irradiated, you may develop mutations. Most of the time,\n\
these mutations will be negative; however, many are beneficial, and others\n\
have both positive and negative effects. Your mutations may change your play\n\
style considerably. They are extremely rare, but it is possible to find\n\
substances that will remove mutations.");
style considerably. It is possible to find substances that will remove\n\
mutations, though these are extremely rare.");
getch();
break;
case 'h':
case 'H':
case 'i':
case 'I':
erase();
mvprintz(0, 0, c_white, "\
Bionics are biomechanical upgrades to your body. While many are simply\n\
@@ -198,19 +239,17 @@ to store energy for them. Your current amount of energy is displayed below\n\
your health. Replenishing energy can be done in a variety of ways, but all\n\
require the installation of a special bionic just for fuel consumption.\n\
\n\
Bionics come in ready-to-install canisters, most of which contain supplies\n\
for several different modules. Installing a bionic will consume the entire\n\
canister, so choose your upgrade carefully. Installation of a bionic is best\n\
left to a trained professional; however, you may attempt to perform a self-\n\
installation. Performing such a task requires high levels of surgery,\n\
mechanics, and/or electrions, and failure may cripple you! Bionics canisters\n\
are difficult to find, but they may be purchased from certain NPCs for a very\n\
high price.");
Bionics come in ready-to-install canisters. Installation of a bionic is best\n\
left to a trained professional. However, you may attempt to perform a self-\n\
installation. Performing such a task requires high levels of intelligence,\n\
first aid, mechanics, and/or electronics, and failure may cripple you!\n\
Many bionics canisters are difficult to find, but may be purchased from\n\
certain wandering vagabonds for a very high price.");
getch();
break;
case 'i':
case 'I':
case 'j':
case 'J':
erase();
mvprintz(0, 0, c_white, "\
Many important items can be very hard to find, or will cost a great deal of\n\
@@ -238,8 +277,36 @@ all required for certain items.");
getch();
break;
case 'j':
case 'J':
case 'k':
case 'K':
erase();
mvprintz(0, 0, c_white, "\
While sleeping in dangerous territory, it may be wise to set traps to ward off\n\
unwanted intrusions. There are a few traps to be found in the world, most\n\
notably bubblewrap (which will make a loud noise if stepped on, helping to\n\
wake you up) and bear traps (which make noise AND damage and trap anything\n\
that steps on them). Others need to be crafted; this requires the Traps skill\n\
and possibly Mechanics.\n\
\n\
To set a trap, simply use the item ('a') and choose a direction; the trap will\n\
be placed on an adjacent tile. Some traps may require additional tools, like\n\
a shovel, to be set. Once set, a trap will remain in place until stepped on\n\
or disarmed.\n\
\n\
To disarm a trap, examine ('e') the space it is on. Your success depends upon\n\
your Traps skill and Dexterity. If you succeed, the trap is removed and\n\
replaced by some or all of its constituent parts; however, if you fail, there\n\
is a chance that you will set off the trap, suffering the consequences.\n\
\n\
Many traps are fully or partially hidden. Your ability to detect traps is\n\
entirely dependent upon your Perception. Should you stumble into a trap, you\n\
may have a chance to avoid it, depending on your Dodge skill.");
getch();
break;
case 'l':
case 'L':
erase();
mvprintz(0, 0, c_white, "\
There are a wide variety of items available for your use. You may find them\n\
@@ -248,15 +315,23 @@ same square. Some items are found inside a container, drawn as a { with a\n\
blue background. Pressing 'e', then a direction, will allow you to examine\n\
these containers and loot their contents.\n\
\n\
Pressing 'I' opens a comparison menu, where you can see two items\n\
side-by-side with their attributes highlighted to indicate which is surperior.\n\
You can also access the item comparison menu by pressing 'C' when the 'V'iew\n\
nearby items menu is open and an item is selected.\n\
\n\
All items may be used as a melee weapon, though some are better than others.\n\
You can check the melee attributes of an item you're carrying by hitting 'i'\n\
to enter your inventory, then pressing the letter of the item. There are 3\n\
values, displayed as (B#/C#/H#). B indicates the bashing damage dealt, C is\n\
cutting damage, and H is a bonus (or penalty) to your chance to hit.\n\
melee values, bashing, cutting, and to-hit bonus (or penalty).\n\
Bashing damage is universally effective, but is capped by low strength.\n\
Cutting damage is a guaranteed increase in damage, but it may be reduced by\n\
a monster's natural armor.\n\
\n\
Press any key for more...");
getch();
erase();
mvprintz(0, 0, c_white, "\
To wield an item as a weapon, press 'w' then the proper letter. Pressing '-'\n\
in lieu of a letter will make you wield nothing. A wielded weapon will not\n\
contribute to your volume carried, so holding a large item in your hands may\n\
@@ -268,8 +343,9 @@ damage and helps you resist things like smoke. To take off an item, press\n\
'T' then the proper letter.");
getch();
break;
case 'k':
case 'K':
case 'm':
case 'M':
erase();
mvprintz(0, 0, c_white, "\
After 30 minutes of warmup time, monsters will begin to appear. They are\n\
@@ -279,18 +355,18 @@ positions relative to you, is displayed on the right side of the screen.\n\
To attack a monster with a melee weapon, simply move into them. The time it\n\
takes to attack depends on the size and weight of your weapon. Small, light\n\
weapons are the fastest; unarmed attacks increase in speed with your Unarmed\n\
Combat skill, and will eventually be VERY fast. A successful hit will stun\n\
the monster temporarily, and most one-on-one fights will be easily won by the\n\
player. On the other hand, a miss will make you stumble and cost YOU\n\
movement points.\n\
Combat skill, and will eventually be VERY fast. A successful hit with a\n\
bashing weapon may stun the monster temporarily, while cutting weapons may get\n\
stuck, possibly pulling the weapon from your hands--but a monster with a weapon\n\
stuck in it will move much more slowly. A miss may make you stumble and lose\n\
movement points. If a monster hits you, your clothing may absorb some damage,\n\
but you will absorb the excess.\n\
\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. If\n\
you are hit, your clothing will absorb some damage, but you will suffer\n\
the excess.\n\
fire; to shoot a burst, press 'F'. This 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\
@@ -299,10 +375,33 @@ escape tactic.");
getch();
break;
case 'n':
case 'N':
erase();
mvprintz(0, 0, c_white, "\
For the unarmed fighter, a variety of fighting styles are available. You can\n\
start with your choice of a single, commonly-taught style by starting with\n\
the Martial Arts Training trait. Many, many more can be taught by wandering\n\
masters.\n\
\n\
To select a fighting style, press _ (underscore). If you are already unarmed\n\
this will make you start using the style. Otherwise, it will be locked in as\n\
your default unarmed style; to start using it, press w-.\n\
\n\
Most styles have a variety of special moves associated with them. Most have\n\
a skill requirement, and will be unavailable until you reach a level of\n\
unarmed skill. You can check the moves by examining your style via the\n\
inventory screen (i key).\n\
\n\
Many styles also have special effects unlocked under certain conditions.\n\
These are varied and unique to each style, and range from special combo moves\n\
to bonuses depending on the situation you are in. You can check these by\n\
examining your style.");
getch();
break;
case 'l':
case 'L':
case 'o':
case 'O':
erase();
mvprintz(0, 0, c_white, "\
The first thing to do is to check your home for useful items. Your initial\n\
@@ -326,47 +425,203 @@ Irregular terrain, like forests, may help you lose monsters.\n\
Firearms are the easiest way to kill an enemy, but the sound will attract\n\
unwanted attention. Save the guns for emergencies, and melee when you can.\n\
\n\
Press any key for more...");
getch();
erase();
mvprintz(0, 0, c_white, "\
Try to keep your inventory as full as possible without being overloaded. You\n\
never know when you might need an item, and most are good to sell, and you\n\
can easily drop unwanted items on the floor.");
never know when you might need an item, most are good to sell, and you can\n\
easily drop unwanted items on the floor.\n\
\n\
Keep an eye on the weather. At night, sleeping might be difficult if you\n\
don't have a warm place to rest your head. Be sure to protect your extremities\n\
from frostbite and to keep your distance from large fires.");
getch();
break;
case '1':
case '1': {
erase();
mvprintz(0, 0, c_white, "MOVEMENT:");
mvprintz(1, 0, c_ltgray, "\
vikeys or numpad - Movement or attack . or 5 - Pause for one turn\n\
o - Open a door c - Close a door\n\
s - Smash terrain , or g - Pick up items\n\
e - Examine terrain, open container < or > - Go up or down stairs\n\
$ - Lie down to sleep ^ - Long wait\n\
! - Toggle Run Mode");
mvprintz(7, 0, c_white, "ITEMS:");
mvprintz(8, 0, c_ltgray, "\
i - View Inventory d - Drop item\n\
w - Wield item t - Throw item\n\
W - Wear item T - Take off item\n\
a - Activate tool E - Eat comestible\n\
r - Reload wielded gun or tool U - Unload wielded gun or tool\n\
f - Fire gun F - Burst-fire gun\n\
p - Power up / List bionics R - Read book\n\
& - Craft items B - Butcher a corpse");
mvprintz(16, 0, c_white, "INFORMATION:");
mvprintz(17, 0, c_ltgray, "\
@ - View character status # - List factions\n\
: - Open world map ; - Look around\n\
C - Chat with NPC ? - Help page\n\
% - View kill counts");
mvprintz(21, 0, c_white, "META:");
mvprintz(22, 0, c_ltgray, "\
S - Save game Q - Quit w/o saving");
mvprintz(23, 0, c_red, "\
Note that 'a' is context-sensitive, and can be used in place of 'W', 'E', or\n\
'R', if you like.");
getch();
break;
case '2':
int offset = 1;
char ch = ' ';
bool changed_keymap = false;
bool needs_refresh = true;
do {
if (needs_refresh) {
erase();
mvprintz(0, 40, c_white, "Use the arrow keys (or movement keys)");
mvprintz(1, 40, c_white, "to scroll.");
mvprintz(2, 40, c_white, "Press ESC or q to return. ");
mvprintz(3, 40, c_white, "Press - to clear the keybindings for ");
mvprintz(4, 40, c_white, "an action. ");
mvprintz(5, 40, c_white, "Press + to add a keybinding for an ");
mvprintz(6, 40, c_white, "action. ");
needs_refresh = false;
}
// Clear the lines
for (int i = 0; i < 25; i++)
mvprintz(i, 0, c_black, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
for (int i = 0; i < 25 && offset + i < NUM_ACTIONS; i++) {
std::vector<char> keys = keys_bound_to( action_id(offset + i) );
nc_color col = (keys.empty() ? c_ltred : c_white);
mvprintz(i, 3, col, "%s: ", action_name( action_id(offset + i) ).c_str());
if (keys.empty())
printz(c_red, "Unbound!");
else {
for (int j = 0; j < keys.size(); j++) {
printz(c_yellow, "%c", keys[j]);
if (j < keys.size() - 1)
printz(c_white, " or ");
}
}
}
refresh();
ch = input();
int sx = 0, sy = 0;
get_direction(this, sx, sy, ch);
if (sy == -1 && offset > 1)
offset--;
if (sy == 1 && offset + 20 < NUM_ACTIONS)
offset++;
if (ch == '-' || ch == '+') {
needs_refresh = true;
for (int i = 0; i < 25 && i + offset < NUM_ACTIONS; i++) {
mvprintz(i, 0, c_ltblue, "%c", 'a' + i);
mvprintz(i, 1, c_white, ":");
}
refresh();
char actch = getch();
if (actch >= 'a' && actch <= 'a' + 24 &&
actch - 'a' + offset < NUM_ACTIONS) {
action_id act = action_id(actch - 'a' + offset);
if (ch == '-' && query_yn("Clear keys for %s?",action_name(act).c_str())){
clear_bindings(act);
changed_keymap = true;
} else if (ch == '+') {
char newbind = popup_getkey("New key for %s:", action_name(act).c_str());
if (keymap.find(newbind) == keymap.end()) { // It's not in use! Good.
keymap[ newbind ] = act;
changed_keymap = true;
} else
popup("%c is used for %s.", newbind,
action_name( keymap[newbind] ).c_str());
}
}
}
} while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE);
if (changed_keymap && query_yn("Save changes?"))
save_keymap();
erase();
} break;
case '2': {
erase();
int offset = 1;
int line = 0;
char ch = ' ';
bool changed_options = false;
bool needs_refresh = true;
do {
// TODO: change instructions
if (needs_refresh) {
erase();
mvprintz(0, 40, c_white, "Use up/down keys to scroll through");
mvprintz(1, 40, c_white, "available options.");
mvprintz(2, 40, c_white, "Use left/right keys to toggle.");
mvprintz(3, 40, c_white, "Press ESC or q to return. ");
// highlight options for option descriptions
std::string tmp = option_desc(option_key(offset + line));
std::string out;
size_t pos;
int displayline = 5;
do {
pos = tmp.find_first_of('\n');
out = tmp.substr(0, pos);
mvprintz(displayline, 40, c_white, out.c_str());
tmp = tmp.substr(pos + 1);
displayline++;
} while (pos != std::string::npos && displayline < 12);
needs_refresh = false;
}
// Clear the lines
for (int i = 0; i < 25; i++)
mvprintz(i, 0, c_black, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
int valid_option_count = 0;
// display options
for (int i = 0; i < 25 && offset + i < NUM_OPTION_KEYS; i++)
{
valid_option_count++;
mvprintz(i, 0, c_white, "%s: ",
option_name( option_key(offset + i) ).c_str());
if (option_is_bool(option_key(offset + i)))
{
bool on = OPTIONS[ option_key(offset + i) ];
if (i == line)
mvprintz(i, 30, hilite(c_ltcyan), (on ? "True" : "False"));
else
mvprintz(i, 30, (on ? c_ltgreen : c_ltred), (on ? "True" : "False"));
} else
{
char option_val = OPTIONS[ option_key(offset + i) ];
if (i == line)
mvprintz(i, 30, hilite(c_ltcyan), "%d", option_val );
else
mvprintz(i, 30, c_ltgreen, "%d", option_val );
}
}
refresh();
ch = input();
needs_refresh = true;
refresh();
switch (ch) {
// move up and down
case 'j':
line++;
if (line == NUM_OPTION_KEYS - 1)
line = 0;
break;
case 'k':
line--;
if (line < 0)
line = NUM_OPTION_KEYS - 2;
break;
// toggle options with left/right keys
case 'h':
if (option_is_bool(option_key(offset + line)))
OPTIONS[ option_key(offset + line) ] = !(OPTIONS[ option_key(offset + line) ]);
else
{
OPTIONS[ option_key(offset + line) ]--;
if ((OPTIONS[ option_key(offset + line) ]) < 0 )
OPTIONS[ option_key(offset + line) ] = option_max_options(option_key(offset + line)) - 1;
}
changed_options = true;
break;
case 'l':
if (option_is_bool(option_key(offset + line)))
OPTIONS[ option_key(offset + line) ] = !(OPTIONS[ option_key(offset + line) ]);
else
{
OPTIONS[ option_key(offset + line) ]++;
if ((OPTIONS[ option_key(offset + line) ]) >= option_max_options(option_key(offset + line)))
OPTIONS[ option_key(offset + line) ] = 0;
}
changed_options = true;
break;
}
} while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE);
if (changed_options && query_yn("Save changes?"))
save_options();
erase();
} break;
case '3':
erase();
mvprintz(0, 0, c_white, "\
ITEM TYPES:\n\
@@ -406,7 +661,7 @@ ITEM TYPES:\n\
fired with 'f'. Some have automatic fire, which may be used with 'F' at a\n\
penalty to accuracy. The color refers to the type; handguns are gray, shotguns\n\
are red, submachine guns are cyan, rifles are brown, assault rifles are blue,\n\
and heavy machine guns are green. Each has an accuracy rating, a bonus to\n\
and heavy machine guns are light red. Each has an accuracy rating, a bonus to\n\
damage, a rate of fire, and a maximum load. Note that most firearms load\n\
fully in one action, while shotguns must be loaded one shell at a time.\n\
\n\
@@ -424,24 +679,35 @@ ITEM TYPES:\n\
These items are suited for throwing, and many are only useful when\n\
thrown, such as grenades, molotov cocktails, or tear gas.\n\
\n\
+ Book or magazine\n\
? Book or magazine\n\
This can be read for training or entertainment by pressing 'R'. Most\n\
require a basic level of intelligence; some require some base knowledge in\n\
the relevant subject.");
getch();
erase();
break;
case '3':
case '4':
erase();
mvprintz( 0, 0, c_ltgray, "MAP SYMBOLS:");
mvprintz( 1, 0, c_brown, "\
. Field - Empty grassland, occasional wild fruit.");
mvprintz( 2, 0, c_green, "\
F Forest - May be dense or sparse. Slow moving; foragable food.");
mvprintz( 3, 0, c_dkgray, "\
%c%c%c%c%c%c%c%c%c%c%c Road - Safe from burrowing animals.", LINE_XOXO,
LINE_OXOX, LINE_XXOO, LINE_OXXO, LINE_OOXX, LINE_XOOX, LINE_XXXO,
LINE_XXOX, LINE_XOXX, LINE_OXXX, LINE_XXXX);
mvputch(3, 0, c_dkgray, LINE_XOXO);
mvputch(3, 1, c_dkgray, LINE_OXOX);
mvputch(3, 2, c_dkgray, LINE_XXOO);
mvputch(3, 3, c_dkgray, LINE_OXXO);
mvputch(3, 4, c_dkgray, LINE_OOXX);
mvputch(3, 5, c_dkgray, LINE_XOOX);
mvputch(3, 6, c_dkgray, LINE_XXXO);
mvputch(3, 7, c_dkgray, LINE_XXOX);
mvputch(3, 8, c_dkgray, LINE_XOXX);
mvputch(3, 9, c_dkgray, LINE_OXXX);
mvputch(3, 10, c_dkgray, LINE_XXXX);
mvprintz( 3, 12, c_dkgray, "\
Road - Safe from burrowing animals.");
mvprintz( 4, 0, c_dkgray, "\
H= Highway - Like roads, but lined with guard rails.");
mvprintz( 5, 0, c_dkgray, "\
@@ -477,6 +743,172 @@ O Parking lot - Empty lot, few items. Mostly useless.");
getch();
erase();
break;
case '5':
erase();
mvprintz(0, 0, c_white, "Gun types:");
mvprintz(2, 0, c_ltgray, "( Handguns");
mvprintz(3, 0, c_white, "\
Handguns are small weapons held in one or both hands. They are much more\n\
difficult to aim and control than larger firearms, and this is reflected in\n\
their poor accuracy. However, their small size makes them appropriate for\n\
short-range combat, where largers guns fare poorly.\n\
They are also relatively quick to reload, and use a very wide selection of\n\
ammunition. Their small size and low weight make it possible to carry\n\
several loaded handguns, switching from one to the next once their ammo is\n\
spent.");
mvprintz(12, 0, c_green, "( Crossbows");
mvprintz(13, 0, c_white, "\
The best feature of crossbows is their silence. The bolts they fire are only\n\
rarely destroyed; if you pick up the bolts after firing them, your ammunition\n\
will last much longer. Crossbows suffer from a short range and a very long\n\
reload time (modified by your strength); plus, most only hold a single round.\n\
For this reason, it is advisable to carry a few loaded crossbows.\n\
Crossbows can be very difficult to find; however, it is possible to craft one\n\
given enough Mechanics skill. Likewise, it is possible to make wooden bolts\n\
from any number of wooden objects, though these are much less effective than\n\
steel bolts.\n\
Crossbows use the handgun skill.");
mvprintz(24, 0, c_white, "Press any key to continue...");
getch();
erase();
mvprintz(0, 0, c_white, "Gun types:");
mvprintz(2, 0, c_red, "( Shotguns");
mvprintz(3, 0, c_white, "\
Shotguns are one of the most powerful weapons in the game, capable of taking\n\
out almost any enemy with a single hit. Birdshot and 00 shot spread, making\n\
it very easy to hit nearby monsters. However, they are very ineffective\n\
against armor, and some armored monsters might shrug off 00 shot completely.\n\
Shotgun slugs are the answer to this problem; they also offer much better\n\
range than shot.\n\
The biggest drawback to shotguns is their noisiness. They are very loud,\n\
and impossible to silence. A shot that kills one zombie might attract three\n\
more! Because of this, shotguns are best reserved for emergencies.");
mvprintz(13, 0, c_cyan, "( Submachine Guns");
mvprintz(14, 0, c_white, "\
Submachine guns are small weapons (some are barely larger than a handgun),\n\
designed for relatively close combat and the ability to spray large amounts\n\
of bullets. However, they are more effective when firing single shots, so\n\
use discretion. They mainly use the 9mm and .45 ammunition; however, other\n\
SMGs exist. They reload moderately quickly, and are suitable for close or\n\
medium-long range combat.");
mvprintz(22, 0, c_white, "Press any key to continue...");
getch();
erase();
mvprintz(0, 0, c_white, "Gun types:");
mvprintz(2, 0, c_brown, "( Hunting Rifles");
mvprintz(3, 0, c_white, "\
Hunting rifles are popular for their superior range and accuracy. What's\n\
more, their scopes or sights make shots fired at targets more than 10 tiles\n\
away as accurate as those with a shorter range. However, they are very poor\n\
at hitting targets 4 squares or less from the player.\n\
Unlike assault rifles, hunting rifles have no automatic fire. They are also\n\
slow to reload and fire, so when facing a large group of nearby enemies, they\n\
are not the best pick.");
mvprintz(11, 0, c_blue, "( Assault Rifles");
mvprintz(12, 0, c_white, "\
Assault rifles are similar to hunting rifles in many ways; they are also\n\
suited for long range combat, with similar bonuses and penalties. Unlike\n\
hunting rifles, assault rifles are capable of automatic fire. Assault rifles\n\
are less accurate than hunting rifles, and this is worsened under automatic\n\
fire, so save it for when you're highly skilled.\n\
Assault rifles are an excellent choice for medium or long range combat, or\n\
even close-range bursts again a large number of enemies. They are difficult\n\
to use, and are best saved for skilled riflemen.");
mvprintz(24, 0, c_white, "Press any key to continue...");
getch();
erase();
mvprintz(0, 0, c_white, "Gun types:");
mvprintz(2, 0, c_ltred, "( Machine Guns");
mvprintz(3, 0, c_white, "\
Machine guns are one of the most powerful firearms available. They are even\n\
larger than assault rifles, and make poor melee weapons; however, they are\n\
capable of holding 100 or more rounds of highly-damaging ammunition. They\n\
are not built for accuracy, and firing single rounds is not very effective.\n\
However, they also possess a very high rate of fire and somewhat low recoil,\n\
making them very good at clearing out large numbers of enemies.");
mvprintz(10, 0, c_magenta, "( Energy Weapons");
mvprintz(11, 0, c_white, "\
Energy weapons is an umbrella term used to describe a variety of rifles and\n\
handguns which fire lasers, plasma, or energy atttacks. They started to\n\
appear in military use just prior to the start of the apocalypse, and as such\n\
are very difficult to find.\n\
Energy weapons have no recoil at all; they are nearly silent, have a long\n\
range, and are fairly damaging. The biggest drawback to energy weapons is\n\
scarcity of ammunition; it is wise to reserve the precious ammo for when you\n\
really need it.");
mvprintz(24, 0, c_white, "Press any key to continue...");
getch();
erase();
break;
case '6':
mvprintz(0, 0, c_white, "\
Q: What is Run Mode, and why does it prevent me from moving?\n\
A: Run Mode is a way to guarantee that you won't die by holding a movement\n\
key down. When a monster comes into view, your movement will be ignored\n\
until Run Mode is turned off with the ! key. This ensures that the\n\
sudden appearence of a monster won't catch you off guard.\n\
\n\
Q: It seems like everything I eat makes me sick! What's wrong?\n\
A: Lots of the food found in towns is perishable, and will only last a few\n\
days after the start of a new game (July 12). Fruit, milk, and others are\n\
the first to go. After the first couple of days, you should switch to\n\
canned food, jerky, and hunting.\n\
\n\
Q: Why doesn't reading a book seem to give me any training?\n\
A: Your skills will not be displayed in the @ screen until they reach level\n\
one. Generally it will take several reads of the same book to gain a\n\
single level in a skill.\n\
\n\
Q: How can I board up windows and doors?\n\
A: You'll need a hammer, nails, and two by fours. Use the hammer and choose\n\
the direction in which the terrain you wish to barricade lies.\n\
\n\
Q: How can I prevent monsters from attacking while I sleep?\n\
A: Find a safe place to sleep, in a building far from the front door. Set\n\
traps if you have them, or build a fire.");
getch();
erase();
mvprintz(0, 0, c_white, "\
Q: Why do I always sink when I try to swim?\n\
A: Your swimming ability is reduced greatly by the weight you are carrying,\n\
and is also adversely affected by the clothing you wear. Until you reach\n\
a high level in the swimming skill, you'll need to drop your equipment and\n\
remove your clothing to swim, making it a last-ditch escape plan.\n\
\n\
Q: How can I cure a fungal infection?\n\
A: At present time, there is only one cure, royal jelly. You can find royal\n\
jelly in the bee hives which dot forests.\n\
\n\
Q: How do I get into science labs?\n\
A: You can enter the front door if you have an ID card by 'e'xamining the\n\
keypad. If you are skilled in computers and have an electrohack, it is\n\
possible to hack the keypad. An EMP blast has a chance to force the doors\n\
open, but it's more likely to break them. You can also sneak in through\n\
the sewers sometimes, or try to smash through the walls with explosions.\n\
\n\
Q: Why does my crafting fail so often?\n\
A: Check the difficulty of the recipe, and the primary skill used; your skill\n\
level should be around one and a half times the difficulty to be confident\n\
that it will succeed.");
getch();
erase();
mvprintz(0, 0, c_white, "\
Q: Shotguns bring in more zombies than they kill! What's the point?\n\
A: Shotguns are intended for emergency use. If you are cornered, use your\n\
shotgun to escape, then just run from the zombies it attracts.\n\
\n\
Q: The game just told me to quit, and other weird stuff is happening.\n\
A: You have the Schizophrenic trait, which might make the game seem buggy.\n\
\n\
Q: I have a question that's not addressed here. How can I get an answer?\n\
A: Email your question to TheDarklingWolf@Gmail.com. I'll answer it for you,\n\
and possibly include it on this list.");
getch();
erase();
break;
}
} while (ch != 'q' && ch != KEY_ESCAPE);
}
Executable
+7
View File
@@ -0,0 +1,7 @@
#ifndef RESOURCE_RC_INCLUDED
#define RESOURCE_RC_INCLUDED
MAINICON ICON "data/cataicon.ico"
#endif // RESOURCE_RC_INCLUDED
+111
View File
@@ -0,0 +1,111 @@
#include "cursesdef.h"
#include "input.h"
/* TODO Replace the hardcoded values with an abstraction layer.
* Lower redundancy across the methods. */
InputEvent get_input(int ch)
{
if (ch == '\0')
ch = getch();
switch(ch)
{
case 'k':
case '8':
case KEY_UP:
return DirectionN;
case 'j':
case '2':
case KEY_DOWN:
return DirectionS;
case 'l':
case '6':
case KEY_RIGHT:
return DirectionE;
case 'h':
case '4':
case KEY_LEFT:
return DirectionW;
case 'y':
case '7':
return DirectionNW;
case 'u':
case '9':
return DirectionNE;
case 'b':
case '1':
return DirectionSW;
case 'n':
case '3':
return DirectionSE;
case '.':
case '5':
return DirectionNone;
case '>':
return DirectionDown;
case '<':
return DirectionUp;
case '\n':
return Confirm;
case ' ':
return Close;
case 27: /* TODO Fix delay */
case 'q':
return Cancel;
case '?':
return Help;
case ',':
case 'g':
return Pickup;
default:
return Undefined;
}
}
void get_direction(int &x, int &y, InputEvent &input)
{
x = 0;
y = 0;
switch(input) {
case DirectionN:
--y;
break;
case DirectionS:
++y;
break;
case DirectionE:
++x;
break;
case DirectionW:
--x;
break;
case DirectionNW:
--x;
--y;
break;
case DirectionNE:
++x;
--y;
break;
case DirectionSW:
--x;
++y;
break;
case DirectionSE:
++x;
++y;
break;
case DirectionNone:
case Pickup:
break;
default:
x = -2;
y = -2;
}
}
+31
View File
@@ -0,0 +1,31 @@
#ifndef _INPUT_H_
#define _INPUT_H_
enum InputEvent {
Confirm,
Cancel,
Close,
Help,
DirectionN,
DirectionS,
DirectionE,
DirectionW,
DirectionNW,
DirectionNE,
DirectionSE,
DirectionSW,
DirectionNone,
DirectionDown, /* Think stairs */
DirectionUp,
Pickup,
Nothing,
Undefined
};
InputEvent get_input(int ch = '\0');
void get_direction(int &x, int &y, InputEvent &input);
#endif
+483
View File
@@ -0,0 +1,483 @@
#include <sstream>
#include "inventory.h"
#include "game.h"
#include "keypress.h"
#include "mapdata.h"
item& inventory::operator[] (int i)
{
if (i < 0 || i > items.size()) {
debugmsg("Attempted to access item %d in an inventory (size %d)",
i, items.size());
return nullitem;
}
return items[i][0];
}
std::vector<item>& inventory::stack_at(int i)
{
if (i < 0 || i > items.size()) {
debugmsg("Attempted to access stack %d in an inventory (size %d)",
i, items.size());
return nullstack;
}
return items[i];
}
std::vector<item> inventory::const_stack(int i) const
{
if (i < 0 || i > items.size()) {
debugmsg("Attempted to access stack %d in an inventory (size %d)",
i, items.size());
return nullstack;
}
return items[i];
}
std::vector<item> inventory::as_vector()
{
std::vector<item> ret;
for (int i = 0; i < size(); i++) {
for (int j = 0; j < stack_at(i).size(); j++)
ret.push_back(items[i][j]);
}
return ret;
}
int inventory::size() const
{
return items.size();
}
int inventory::num_items() const
{
int ret = 0;
for (int i = 0; i < items.size(); i++)
ret += items[i].size();
return ret;
}
inventory& inventory::operator= (inventory &rhs)
{
if (this == &rhs)
return *this; // No self-assignment
clear();
for (int i = 0; i < rhs.size(); i++)
items.push_back(rhs.stack_at(i));
return *this;
}
inventory& inventory::operator= (const inventory &rhs)
{
if (this == &rhs)
return *this; // No self-assignment
clear();
for (int i = 0; i < rhs.size(); i++)
items.push_back(rhs.const_stack(i));
return *this;
}
inventory& inventory::operator+= (const inventory &rhs)
{
for (int i = 0; i < rhs.size(); i++)
add_stack(rhs.const_stack(i));
return *this;
}
inventory& inventory::operator+= (const std::vector<item> &rhs)
{
for (int i = 0; i < rhs.size(); i++)
add_item(rhs[i]);
return *this;
}
inventory& inventory::operator+= (const item &rhs)
{
add_item(rhs);
return *this;
}
inventory inventory::operator+ (const inventory &rhs)
{
return inventory(*this) += rhs;
}
inventory inventory::operator+ (const std::vector<item> &rhs)
{
return inventory(*this) += rhs;
}
inventory inventory::operator+ (const item &rhs)
{
return inventory(*this) += rhs;
}
void inventory::clear()
{
items.clear();
}
void inventory::add_stack(const std::vector<item> newits)
{
for (int i = 0; i < newits.size(); i++)
add_item(newits[i], true);
}
void inventory::push_back(std::vector<item> newits)
{
add_stack(newits);
}
void inventory::add_item(item newit, bool keep_invlet)
{
if (keep_invlet && !newit.invlet_is_okay())
assign_empty_invlet(newit); // Keep invlet is true, but invlet is invalid!
if (newit.is_style())
return; // Styles never belong in our inventory.
for (int i = 0; i < items.size(); i++) {
if (items[i][0].stacks_with(newit)) {
newit.invlet = items[i][0].invlet;
items[i].push_back(newit);
return;
} else if (keep_invlet && items[i][0].invlet == newit.invlet)
assign_empty_invlet(items[i][0]);
}
if (!newit.invlet_is_okay() || index_by_letter(newit.invlet) != -1)
assign_empty_invlet(newit);
std::vector<item> newstack;
newstack.push_back(newit);
items.push_back(newstack);
}
void inventory::add_item_keep_invlet(item newit)
{
add_item(newit, true);
}
void inventory::push_back(item newit)
{
add_item(newit);
}
void inventory::restack(player *p)
{
inventory tmp;
for (int i = 0; i < size(); i++) {
for (int j = 0; j < items[i].size(); j++)
tmp.add_item(items[i][j]);
}
clear();
if (p) {
for (int i = 0; i < tmp.size(); i++) {
if (!tmp[i].invlet_is_okay() || p->has_weapon_or_armor(tmp[i].invlet)) {
//debugmsg("Restacking item %d (invlet %c)", i, tmp[i].invlet);
tmp.assign_empty_invlet(tmp[i], p);
for (int j = 1; j < tmp.stack_at(i).size(); j++)
tmp.stack_at(i)[j].invlet = tmp[i].invlet;
}
}
}
for (int i = 0; i < tmp.size(); i++)
items.push_back(tmp.stack_at(i));
}
void inventory::form_from_map(game *g, point origin, int range)
{
items.clear();
for (int x = origin.x - range; x <= origin.x + range; x++) {
for (int y = origin.y - range; y <= origin.y + range; y++) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++)
if (!g->m.i_at(x, y)[i].made_of(LIQUID))
add_item(g->m.i_at(x, y)[i]);
// Kludges for now!
if (g->m.field_at(x, y).type == fd_fire) {
item fire(g->itypes[itm_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_sink || terrain_id == t_water_sh || terrain_id == t_water_dp){
item water(g->itypes[itm_water], 0);
water.charges = 50;
add_item(water);
}
}
}
}
std::vector<item> inventory::remove_stack(int index)
{
if (index < 0 || index >= items.size()) {
debugmsg("Tried to remove_stack(%d) from an inventory (size %d)",
index, items.size());
std::vector<item> nullvector;
return nullvector;
}
std::vector<item> ret = stack_at(index);
items.erase(items.begin() + index);
return ret;
}
item inventory::remove_item(int index)
{
if (index < 0 || index >= items.size()) {
debugmsg("Tried to remove_item(%d) from an inventory (size %d)",
index, items.size());
return nullitem;
}
item ret = items[index][0];
items[index].erase(items[index].begin());
if (items[index].empty())
items.erase(items.begin() + index);
return ret;
}
item inventory::remove_item(int stack, int index)
{
if (stack < 0 || stack >= items.size()) {
debugmsg("Tried to remove_item(%d, %d) from an inventory (size %d)",
stack, index, items.size());
return nullitem;
} else if (index < 0 || index >= items[stack].size()) {
debugmsg("Tried to remove_item(%d, %d) from an inventory (stack is size %d)",
stack, index, items[stack].size());
return nullitem;
}
item ret = items[stack][index];
items[stack].erase(items[stack].begin() + index);
if (items[stack].empty())
items.erase(items.begin() + stack);
return ret;
}
item inventory::remove_item_by_letter(char ch)
{
for (int i = 0; i < items.size(); i++) {
if (items[i][0].invlet == ch) {
if (items[i].size() > 1)
items[i][1].invlet = ch;
return remove_item(i);
}
}
return nullitem;
}
item inventory::remove_item_by_quantity(int index, int quantity)
{
// using this assumes the item has charges
if (index < 0 || index >= items.size()) {
debugmsg("Quantity: Tried to remove_item(%d) from an inventory (size %d)",
index, items.size());
return nullitem;
}
item ret = items[index][0];
ret.charges = quantity;
return ret;
}
item& inventory::item_by_letter(char ch)
{
for (int i = 0; i < items.size(); i++) {
if (items[i][0].invlet == ch)
return items[i][0];
}
return nullitem;
}
int inventory::index_by_letter(char ch)
{
if (ch == KEY_ESCAPE)
return -1;
for (int i = 0; i < items.size(); i++) {
if (items[i][0].invlet == ch)
return i;
}
return -1;
}
int inventory::amount_of(itype_id it)
{
int count = 0;
for (int i = 0; i < items.size(); i++) {
for (int j = 0; j < items[i].size(); j++) {
if (items[i][j].type->id == it)
{
// check if it's a container, if so, it should be empty
if (items[i][j].type->is_container())
{
if (items[i][j].contents.empty())
count++;
} else count++;
}
for (int k = 0; k < items[i][j].contents.size(); k++) {
if (items[i][j].contents[k].type->id == it)
count++;
}
}
}
return count;
}
int inventory::charges_of(itype_id it)
{
int count = 0;
for (int i = 0; i < items.size(); i++) {
for (int j = 0; j < items[i].size(); j++) {
if (items[i][j].type->id == it) {
if (items[i][j].charges < 0)
count++;
else
count += items[i][j].charges;
}
for (int k = 0; k < items[i][j].contents.size(); k++) {
if (items[i][j].contents[k].type->id == it) {
if (items[i][j].contents[k].charges < 0)
count++;
else
count += items[i][j].contents[k].charges;
}
}
}
}
return count;
}
void inventory::use_amount(itype_id it, int quantity, bool use_container)
{
for (int i = 0; i < items.size() && quantity > 0; i++) {
for (int j = 0; j < items[i].size() && quantity > 0; j++) {
// First, check contents
bool used_item_contents = false;
for (int k = 0; k < items[i][j].contents.size() && quantity > 0; k++) {
if (items[i][j].contents[k].type->id == it) {
quantity--;
items[i][j].contents.erase(items[i][j].contents.begin() + k);
k--;
used_item_contents = true;
}
}
// Now check the item itself
if (use_container && used_item_contents) {
items[i].erase(items[i].begin() + j);
j--;
if (items[i].empty()) {
items.erase(items.begin() + i);
i--;
j = 0;
}
} else if (items[i][j].type->id == it && quantity > 0) {
quantity--;
items[i].erase(items[i].begin() + j);
j--;
if (items[i].empty()) {
items.erase(items.begin() + i);
i--;
j = 0;
}
}
}
}
}
void inventory::use_charges(itype_id it, int quantity)
{
for (int i = 0; i < items.size() && quantity > 0; i++) {
for (int j = 0; j < items[i].size() && quantity > 0; j++) {
// First, check contents
for (int k = 0; k < items[i][j].contents.size() && quantity > 0; k++) {
if (items[i][j].contents[k].type->id == it) {
if (items[i][j].contents[k].charges <= quantity) {
quantity -= items[i][j].contents[k].charges;
if (items[i][j].contents[k].destroyed_at_zero_charges()) {
items[i][j].contents.erase(items[i][j].contents.begin() + k);
k--;
} else
items[i][j].contents[k].charges = 0;
} else {
items[i][j].contents[k].charges -= quantity;
return;
}
}
}
// Now check the item itself
if (items[i][j].type->id == it) {
if (items[i][j].charges <= quantity) {
quantity -= items[i][j].charges;
if (items[i][j].destroyed_at_zero_charges()) {
items[i].erase(items[i].begin() + j);
j--;
if (items[i].empty()) {
items.erase(items.begin() + i);
i--;
j = 0;
}
} else
items[i][j].charges = 0;
} else {
items[i][j].charges -= quantity;
return;
}
}
}
}
}
bool inventory::has_amount(itype_id it, int quantity)
{
return (amount_of(it) >= quantity);
}
bool inventory::has_charges(itype_id it, int quantity)
{
return (charges_of(it) >= quantity);
}
bool inventory::has_item(item *it)
{
for (int i = 0; i < items.size(); i++) {
for (int j = 0; j < items[i].size(); j++) {
if (it == &(items[i][j]))
return true;
for (int k = 0; k < items[i][j].contents.size(); k++) {
if (it == &(items[i][j].contents[k]))
return true;
}
}
}
return false;
}
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 (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");
}
+79
View File
@@ -0,0 +1,79 @@
#ifndef _INVENTORY_H_
#define _INVENTORY_H_
#include "item.h"
#include <string>
#include <vector>
class game;
class map;
class inventory
{
public:
item& operator[] (int i);
std::vector<item>& stack_at(int i);
std::vector<item> const_stack(int i) const;
std::vector<item> as_vector();
item& front();
item& back();
int size() const;
int num_items() const;
inventory& operator= (inventory &rhs);
inventory& operator= (const inventory &rhs);
inventory& operator+= (const inventory &rhs);
inventory& operator+= (const item &rhs);
inventory& operator+= (const std::vector<item> &rhs);
inventory operator+ (const inventory &rhs);
inventory operator+ (const item &rhs);
inventory operator+ (const std::vector<item> &rhs);
void clear();
void add_stack(std::vector<item> newits);
void push_back(std::vector<item> newits);
void add_item (item newit, bool keep_invlet = false);
void add_item_keep_invlet(item newit);
void push_back(item newit);
/* Check all items for proper stacking, rearranging as needed
* game pointer is not necessary, but if supplied, will ensure no overlap with
* the player's worn items / weapon
*/
void restack(player *p = NULL);
void form_from_map(game *g, point origin, int distance);
std::vector<item> remove_stack(int index);
item remove_item(int index);
item remove_item(int stack, int index);
item remove_item_by_letter(char ch);
item remove_item_by_quantity(int index, int quantity);
item& item_by_letter(char ch);
int index_by_letter(char ch);
// Below, "amount" refers to quantity
// "charges" refers to charges
int amount_of (itype_id it);
int charges_of(itype_id it);
void use_amount (itype_id it, int quantity, bool use_container = false);
void use_charges(itype_id it, int quantity);
bool has_amount (itype_id it, int quantity);
bool has_charges(itype_id it, int quantity);
bool has_item(item *it); // Looks for a specific item
/* TODO: This stuff, I guess?
std::string save();
void load(std::string data);
*/
item nullitem;
std::vector<item> nullstack;
private:
void assign_empty_invlet(item &it, player *p = NULL);
std::vector< std::vector<item> > items;
};
#endif
+702
View File
@@ -0,0 +1,702 @@
#include "game.h"
#include "output.h"
#include "keypress.h"
#include <string>
#include <vector>
#include <map>
#include <sstream>
std::string CATEGORIES[9] =
{"GROUND:", "FIREARMS:", "AMMUNITION:", "CLOTHING:", "COMESTIBLES:",
"TOOLS:", "BOOKS:", "WEAPONS:", "OTHER:"};
void print_inv_statics(game *g, WINDOW* w_inv, std::string title,
std::vector<char> dropped_items)
{
// Print our header
mvwprintw(w_inv, 0, 0, title.c_str());
// Print weight
mvwprintw(w_inv, 0, 45, "Weight: ");
if (g->u.weight_carried() >= g->u.weight_capacity() * .25)
wprintz(w_inv, c_red, "%d", g->u.weight_carried());
else
wprintz(w_inv, c_ltgray, "%d", g->u.weight_carried());
wprintz(w_inv, c_ltgray, "/%d", int(g->u.weight_capacity() * .25));//, g->u.weight_capacity());
// Print volume
mvwprintw(w_inv, 0, 62, "Volume: ");
if (g->u.volume_carried() > g->u.volume_capacity() - 2)
wprintz(w_inv, c_red, "%d", g->u.volume_carried());
else
wprintz(w_inv, c_ltgray, "%d", g->u.volume_carried());
wprintw(w_inv, "/%d", g->u.volume_capacity() - 2);
// Print our weapon
int n_items = 0;
mvwprintz(w_inv, 2, 45, c_magenta, "WEAPON:");
int dropping_weapon = false;
for (int i = 0; i < dropped_items.size() && !dropping_weapon; i++) {
if (dropped_items[i] == g->u.weapon.invlet)
dropping_weapon = true;
}
if (g->u.is_armed()) {
n_items++;
if (dropping_weapon)
mvwprintz(w_inv, 3, 45, c_white, "%c + %s", g->u.weapon.invlet,
g->u.weapname().c_str());
else
mvwprintz(w_inv, 3, 45, g->u.weapon.color_in_inventory(&(g->u)), "%c - %s",
g->u.weapon.invlet, g->u.weapname().c_str());
} else if (g->u.weapon.is_style()) {
n_items++;
mvwprintz(w_inv, 3, 45, c_ltgray, "%c - %s",
g->u.weapon.invlet, g->u.weapname().c_str());
} else
mvwprintz(w_inv, 3, 45, c_ltgray, g->u.weapname().c_str());
// Print worn items
if (g->u.worn.size() > 0)
mvwprintz(w_inv, 5, 45, c_magenta, "ITEMS WORN:");
for (int i = 0; i < g->u.worn.size(); i++) {
n_items++;
bool dropping_armor = false;
for (int j = 0; j < dropped_items.size() && !dropping_armor; j++) {
if (dropped_items[j] == g->u.worn[i].invlet)
dropping_armor = true;
}
if (dropping_armor)
mvwprintz(w_inv, 6 + i, 45, c_white, "%c + %s", g->u.worn[i].invlet,
g->u.worn[i].tname(g).c_str());
else
mvwprintz(w_inv, 6 + i, 45, c_ltgray, "%c - %s", g->u.worn[i].invlet,
g->u.worn[i].tname(g).c_str());
}
// 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);
}
std::vector<int> find_firsts(inventory &inv)
{
std::vector<int> firsts;
for (int i = 0; i < 8; i++)
firsts.push_back(-1);
for (int i = 0; i < inv.size(); i++) {
if (firsts[0] == -1 && inv[i].is_gun())
firsts[0] = i;
else if (firsts[1] == -1 && inv[i].is_ammo())
firsts[1] = i;
else if (firsts[2] == -1 && inv[i].is_armor())
firsts[2] = i;
else if (firsts[3] == -1 &&
(inv[i].is_food() || inv[i].is_food_container()))
firsts[3] = i;
else if (firsts[4] == -1 && (inv[i].is_tool() || inv[i].is_gunmod() ||
inv[i].is_bionic()))
firsts[4] = i;
else if (firsts[5] == -1 && inv[i].is_book())
firsts[5] = i;
else if (firsts[6] == -1 && inv[i].is_weap())
firsts[6] = i;
else if (firsts[7] == -1 && inv[i].is_other())
firsts[7] = i;
}
return firsts;
}
// Display current inventory.
char game::inv(std::string title)
{
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), 0, 0);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
char ch = '.';
int start = 0, cur_it;
u.sort_inv();
u.inv.restack(&u);
std::vector<char> null_vector;
print_inv_statics(this, w_inv, title, null_vector);
// Gun, ammo, weapon, armor, food, tool, book, other
std::vector<int> firsts = find_firsts(u.inv);
do {
if (ch == '<' && start > 0) { // Clear lines and shift
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
if (ch == '>' && cur_it < u.inv.size()) { // Clear lines and shift
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
}
int cur_line = 2;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
// Print category header
for (int i = 1; i < 9; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
cur_line++;
}
}
if (cur_it < u.inv.size()) {
mvwputch (w_inv, cur_line, 0, c_white, u.inv[cur_it].invlet);
mvwprintz(w_inv, cur_line, 1, u.inv[cur_it].color_in_inventory(&u), " %s",
u.inv[cur_it].tname(this).c_str());
if (u.inv.stack_at(cur_it).size() > 1)
wprintw(w_inv, " [%d]", u.inv.stack_at(cur_it).size());
if (u.inv[cur_it].charges > 0)
wprintw(w_inv, " (%d)", u.inv[cur_it].charges);
else if (u.inv[cur_it].contents.size() == 1 &&
u.inv[cur_it].contents[0].charges > 0)
wprintw(w_inv, " (%d)", u.inv[cur_it].contents[0].charges);
}
cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
} while (ch == '<' || ch == '>');
werase(w_inv);
delwin(w_inv);
erase();
refresh_all();
return ch;
}
char game::inv_type(std::string title, int inv_item_type)
{
// this function lists inventory objects by type
// refer to enum item_cat in itype.h for list of categories
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), 0, 0);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
char ch = '.';
int start = 0, cur_it;
u.sort_inv();
u.inv.restack(&u);
std::vector<char> null_vector;
print_inv_statics(this, w_inv, title, null_vector);
// Gun, ammo, weapon, armor, food, tool, book, other
// Create the reduced inventory
inventory reduced_inv = u.inv;
reduced_inv.clear();
int inv_index = 0;
if (u.inv.size() > 0)
{
do
{
switch (inv_item_type)
{
case IC_COMESTIBLE: // food
if (u.inv[inv_index].is_food(&u) || u.inv[inv_index].is_food_container(&u))
reduced_inv += u.inv[inv_index];
break;
case IC_AMMO: // ammo
if (u.inv[inv_index].is_ammo() || u.inv[inv_index].is_ammo_container())
reduced_inv += u.inv[inv_index];
break;
case IC_ARMOR: // armour
if (u.inv[inv_index].is_armor())
reduced_inv += u.inv[inv_index];
break;
case IC_BOOK: // books
if (u.inv[inv_index].is_book())
reduced_inv += u.inv[inv_index];
break;
case IC_TOOL: // tools
if (u.inv[inv_index].is_tool())
reduced_inv += u.inv[inv_index];
break;
case IC_CONTAINER: // containers for liquid handling
if (u.inv[inv_index].is_tool() || u.inv[inv_index].is_gun())
{
if (u.inv[inv_index].ammo_type() == AT_GAS)
reduced_inv += u.inv[inv_index];
}
else
{
if (u.inv[inv_index].is_container())
reduced_inv += u.inv[inv_index];
}
break;
}
inv_index++;
} while (inv_index < u.inv.size());
}
std::vector<int> firsts = find_firsts(reduced_inv);
do {
if (ch == '<' && start > 0) { // Clear lines and shift
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
if (ch == '>' && cur_it < reduced_inv.size()) { // Clear lines and shift
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
}
int cur_line = 2;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
for (int i = 1; i < 9; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
cur_line++;
}
}
if (cur_it < reduced_inv.size())
{
mvwputch (w_inv, cur_line, 0, c_white, reduced_inv[cur_it].invlet);
mvwprintz(w_inv, cur_line, 1, reduced_inv[cur_it].color_in_inventory(&u), " %s",
reduced_inv[cur_it].tname(this).c_str());
if (reduced_inv.stack_at(cur_it).size() > 1)
wprintw(w_inv, " [%d]", reduced_inv.stack_at(cur_it).size());
if (reduced_inv[cur_it].charges > 0)
wprintw(w_inv, " (%d)", reduced_inv[cur_it].charges);
else if (reduced_inv[cur_it].contents.size() == 1 &&
reduced_inv[cur_it].contents[0].charges > 0)
wprintw(w_inv, " (%d)", reduced_inv[cur_it].contents[0].charges);
cur_line++;
}
// cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
if (cur_it < reduced_inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
} while (ch == '<' || ch == '>');
werase(w_inv);
delwin(w_inv);
erase();
refresh_all();
return ch;
}
std::vector<item> game::multidrop()
{
u.sort_inv();
u.inv.restack(&u);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), 0, 0);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int dropping[u.inv.size()]; // Count of how many we'll drop from each stack
for (int i = 0; i < u.inv.size(); i++)
dropping[i] = 0;
int count = 0; // The current count
std::vector<char> weapon_and_armor; // Always single, not counted
bool warned_about_bionic = false; // Printed add_msg re: dropping bionics
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
// Gun, ammo, weapon, armor, food, tool, book, other
std::vector<int> firsts = find_firsts(u.inv);
char ch = '.';
int start = 0, cur_it;
do {
if (ch == '<' && start > 0) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
if (ch == '>' && cur_it < u.inv.size()) {
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
}
int cur_line = 2;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
// Print category header
for (int i = 1; i < 9; i++) {
if (cur_it == firsts[i-1]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
cur_line++;
}
}
if (cur_it < u.inv.size()) {
mvwputch (w_inv, cur_line, 0, c_white, u.inv[cur_it].invlet);
char icon = '-';
if (dropping[cur_it] >= u.inv.stack_at(cur_it).size())
icon = '+';
else if (dropping[cur_it] > 0)
icon = '#';
nc_color col = (dropping[cur_it] == 0 ? c_ltgray : c_white);
mvwprintz(w_inv, cur_line, 1, col, " %c %s", icon,
u.inv[cur_it].tname(this).c_str());
if (u.inv.stack_at(cur_it).size() > 1)
wprintz(w_inv, col, " [%d]", u.inv.stack_at(cur_it).size());
if (u.inv[cur_it].charges > 0)
wprintz(w_inv, col, " (%d)", u.inv[cur_it].charges);
else if (u.inv[cur_it].contents.size() == 1 &&
u.inv[cur_it].contents[0].charges > 0)
wprintw(w_inv, " (%d)", u.inv[cur_it].contents[0].charges);
}
cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
if (ch >= '0' && ch <= '9') {
ch -= '0';
count *= 10;
count += ch;
} else if (u.has_item(ch)) {
int index = u.inv.index_by_letter(ch);
if (index == -1) { // Not from inventory
int found = false;
for (int i = 0; i < weapon_and_armor.size() && !found; i++) {
if (weapon_and_armor[i] == ch) {
weapon_and_armor.erase(weapon_and_armor.begin() + i);
found = true;
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
}
}
if (!found) {
if (ch == u.weapon.invlet && u.weapon.type->id > num_items &&
u.weapon.type->id < num_all_items) {
if (!warned_about_bionic)
add_msg("You cannot drop your %s.", u.weapon.tname(this).c_str());
warned_about_bionic = true;
} else {
weapon_and_armor.push_back(ch);
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
}
}
} else {
if (count == 0) {
if (u.inv.stack_at(index)[0].count_by_charges())
{
if (dropping[index] == 0)
dropping[index] = -1;
else
dropping[index] = 0;
}
else
{
if (dropping[index] == 0)
dropping[index] = u.inv.stack_at(index).size();
else
dropping[index] = 0;
}
}
else if (count >= u.inv.stack_at(index).size() && !u.inv.stack_at(index)[0].count_by_charges())
dropping[index] = u.inv.stack_at(index).size();
else
dropping[index] = count;
count = 0;
}
}
} while (ch != '\n' && ch != KEY_ESCAPE && ch != ' ');
werase(w_inv);
delwin(w_inv);
erase();
refresh_all();
std::vector<item> ret;
if (ch != '\n')
return ret; // Canceled!
int current_stack = 0;
int max_size = u.inv.size();
for (int i = 0; i < max_size; i++) {
if (dropping[i] == -1) { // drop whole stack of charges
ret.push_back(u.inv.remove_item(current_stack));
current_stack--;
}
for (int j = 0; j < dropping[i]; j++) {
if (u.inv.stack_at(current_stack)[0].count_by_charges()) { // dropping parts of stacks
int tmpcount = dropping[i];
if (tmpcount >= u.inv.stack_at(current_stack)[0].charges) {
ret.push_back(u.inv.remove_item(current_stack));
current_stack--;
} else {
u.inv.stack_at(current_stack)[0].charges -= tmpcount;
ret.push_back(u.inv.remove_item_by_quantity(current_stack, tmpcount));
}
j = dropping[i];
} else {
if (current_stack >= 0) {
if (u.inv.stack_at(current_stack).size() == 1) {
ret.push_back(u.inv.remove_item(current_stack));
current_stack--;
} else
ret.push_back(u.inv.remove_item(current_stack));
}
}
}
current_stack++;
}
for (int i = 0; i < weapon_and_armor.size(); i++)
ret.push_back(u.i_rem(weapon_and_armor[i]));
return ret;
}
void game::compare(int iCompareX, int iCompareY)
{
int examx, examy;
char ch = '.';
if (iCompareX != -999 && iCompareX != -999) {
examx = iCompareX;
examy = iCompareY;
} else {
mvwprintw(w_terrain, 0, 0, "Compare where? (Direction button)");
wrefresh(w_terrain);
ch = input();
last_action += ch;
if (ch == KEY_ESCAPE || ch == 'q')
return;
if (ch == '\n' || ch == 'I')
ch = '.';
get_direction(this, examx, examy, ch);
if (examx == -2 || examy == -2) {
add_msg("Invalid direction.");
return;
}
}
examx += u.posx;
examy += u.posy;
std::vector <item> here = m.i_at(examx, examy);
std::vector <item> grounditems;
//Filter out items with the same name (keep only one of them)
std::map <std::string, bool> dups;
for (int i = 0; i < here.size(); i++) {
if (!dups[here[i].tname(this).c_str()]) {
grounditems.push_back(here[i]);
dups[here[i].tname(this).c_str()] = true;
}
}
//Only the first 10 Items due to numbering 0-9
const int groundsize = (grounditems.size() > 10 ? 10 : grounditems.size());
u.sort_inv();
u.inv.restack(&u);
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), 0, 0);
int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int compare[u.inv.size() + groundsize]; // Count of how many we'll drop from each stack
bool bFirst = false; // First Item selected
bool bShowCompare = false;
char cLastCh;
for (int i = 0; i < u.inv.size() + groundsize; i++)
compare[i] = 0;
std::vector<char> weapon_and_armor; // Always single, not counted
print_inv_statics(this, w_inv, "Compare:", weapon_and_armor);
// Gun, ammo, weapon, armor, food, tool, book, other
std::vector<int> first = find_firsts(u.inv);
std::vector<int> firsts;
if (groundsize > 0) {
firsts.push_back(0);
}
for (int i = 0; i < first.size(); i++) {
firsts.push_back((first[i] >= 0) ? first[i]+groundsize : -1);
}
ch = '.';
int start = 0, cur_it;
do {
if (ch == '<' && start > 0) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
if (ch == '>' && cur_it < u.inv.size() + groundsize) {
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
}
int cur_line = 2;
int iHeaderOffset = (groundsize > 0) ? 0 : 1;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
// Print category header
for (int i = iHeaderOffset; i < 9; i++) {
if (cur_it == firsts[i-iHeaderOffset]) {
mvwprintz(w_inv, cur_line, 0, c_magenta, CATEGORIES[i].c_str());
cur_line++;
}
}
if (cur_it < u.inv.size() + groundsize) {
char icon = '-';
if (compare[cur_it] == 1)
icon = '+';
if (cur_it < groundsize) {
mvwputch (w_inv, cur_line, 0, c_white, '1'+((cur_it<9) ? cur_it: -1));
nc_color col = (compare[cur_it] == 0 ? c_ltgray : c_white);
mvwprintz(w_inv, cur_line, 1, col, " %c %s", icon,
grounditems[cur_it].tname(this).c_str());
} else {
mvwputch (w_inv, cur_line, 0, c_white, u.inv[cur_it-groundsize].invlet);
nc_color col = (compare[cur_it] == 0 ? c_ltgray : c_white);
mvwprintz(w_inv, cur_line, 1, col, " %c %s", icon,
u.inv[cur_it-groundsize].tname(this).c_str());
if (u.inv.stack_at(cur_it-groundsize).size() > 1)
wprintz(w_inv, col, " [%d]", u.inv.stack_at(cur_it-groundsize).size());
if (u.inv[cur_it-groundsize].charges > 0)
wprintz(w_inv, col, " (%d)", u.inv[cur_it-groundsize].charges);
else if (u.inv[cur_it-groundsize].contents.size() == 1 &&
u.inv[cur_it-groundsize].contents[0].charges > 0)
wprintw(w_inv, " (%d)", u.inv[cur_it-groundsize].contents[0].charges);
}
}
cur_line++;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
if (cur_it < u.inv.size() + groundsize)
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
if (u.has_item(ch)) {
int index = u.inv.index_by_letter(ch);
if (index == -1) { // Not from inventory
bool found = false;
for (int i = 0; i < weapon_and_armor.size() && !found; i++) {
if (weapon_and_armor[i] == ch) {
weapon_and_armor.erase(weapon_and_armor.begin() + i);
found = true;
bFirst = false;
print_inv_statics(this, w_inv, "Compare:", weapon_and_armor);
}
}
if (!found) {
if (ch == u.weapon.invlet && u.weapon.type->id > num_items &&
u.weapon.type->id < num_all_items) {
//Do Bionic stuff here?!
} else {
if (!bFirst)
{
weapon_and_armor.push_back(ch);
print_inv_statics(this, w_inv, "Compare:", weapon_and_armor);
bFirst = true;
cLastCh = ch;
} else {
bShowCompare = true;
}
}
}
} else {
if (compare[index+groundsize] == 1)
{
compare[index+groundsize] = 0;
bFirst = false;
} else {
if (!bFirst)
{
compare[index+groundsize] = 1;
bFirst = true;
cLastCh = ch;
} else {
bShowCompare = true;
}
}
}
} else if ((ch >= '1' && ch <= '9' && ch-'1' < groundsize) || (ch == '0' && groundsize == 10)) {
//Ground Items
int iZero = 0;
if (ch == '0') {
iZero = 10;
}
if (compare[ch-'1'+iZero] == 1)
{
compare[ch-'1'+iZero] = 0;
bFirst = false;
} else {
if (!bFirst)
{
compare[ch-'1'+iZero] = 1;
bFirst = true;
cLastCh = ch;
} else {
bShowCompare = true;
}
}
}
if (bShowCompare) {
std::vector<iteminfo> vItemLastCh, vItemCh;
std::string sItemLastCh, sItemCh;
if (cLastCh >= '0' && cLastCh <= '9') {
int iZero = 0;
if (cLastCh == '0') {
iZero = 10;
}
grounditems[cLastCh-'1'+iZero].info(true, &vItemLastCh);
sItemLastCh = grounditems[cLastCh-'1'+iZero].tname(this);
} else {
u.i_at(cLastCh).info(true, &vItemLastCh);
sItemLastCh = u.i_at(cLastCh).tname(this);
}
if (ch >= '0' && ch <= '9') {
int iZero = 0;
if (ch == '0') {
iZero = 10;
}
grounditems[ch-'1'+iZero].info(true, &vItemCh);
sItemCh = grounditems[ch-'1'+iZero].tname(this);
} else {
u.i_at(ch).info(true, &vItemCh);
sItemCh = u.i_at(ch).tname(this);
}
compare_split_screen_popup(true, sItemLastCh, vItemLastCh, vItemCh);
compare_split_screen_popup(false, sItemCh, vItemCh, vItemLastCh);
wclear(w_inv);
print_inv_statics(this, w_inv, "Compare:", weapon_and_armor);
bShowCompare = false;
}
} while (ch != '\n' && ch != KEY_ESCAPE && ch != ' ');
werase(w_inv);
delwin(w_inv);
erase();
refresh_all();
}
+1286 -286
View File
File diff suppressed because it is too large Load Diff
+98 -20
View File
@@ -10,6 +10,27 @@
class player;
class npc;
struct iteminfo{
public:
std::string sType; //Itemtype
std::string sName; //Main item text
std::string sPre; //Text between main item and value
int iValue; //Set to -999 if no compare value is present
std::string sPost; //Text after value
bool bNewLine; //New line at the end
bool bLowerIsBetter; //Lower values are better (red <-> green)
iteminfo(std::string sIn0, std::string sIn1, std::string sIn2 = "", int iIn0 = -999, std::string sIn3 = "", bool bIn0 = true, bool bIn1 = false) {
sType = sIn0;
sName = sIn1;
sPre = sIn2;
iValue = iIn0;
sPost = sIn3;
bNewLine = bIn0;
bLowerIsBetter = bIn1;
}
};
class item
{
public:
@@ -20,71 +41,128 @@ public:
item(std::string itemdata, game *g);
~item();
void make(itype* it);
// returns the default container of this item, with this item in it
item in_its_container(std::vector<itype*> *itypes);
std::string tname();
nc_color color(player *u);
nc_color color_in_inventory(player *u);
std::string tname(game *g = NULL); // g needed for rotten-test
void use(player &u);
bool burn(int amount = 1); // Returns true if destroyed
// Firearm specifics
int reload_time(player &u);
int clip_size();
int accuracy();
int gun_damage();
int gun_damage(bool with_ammo = true);
int noise();
int burst_size();
int recoil();
ammotype ammo();
int recoil(bool with_ammo = true);
int range(player *p = NULL);
ammotype ammo_type();
int pick_reload_ammo(player &u, bool interactive);
bool reload(player &u, int index);
void next_mode();
std::string save_info(); // Formatted for save files
void load_info(std::string data, game *g);
std::string info(bool showtext = false); // Formatted for human viewing
//std::string info(bool showtext = false); // Formatted for human viewing
std::string info(bool showtext = false);
std::string info(bool showtext, std::vector<iteminfo> *dump);
char symbol();
nc_color color();
int price();
bool invlet_is_okay();
bool stacks_with(item rhs);
void put_in(item payload);
unsigned int weight();
unsigned int volume();
unsigned char volume_contained();
int weight();
int volume();
int volume_contained();
int attack_time();
int damage_bash();
int damage_cut();
bool has_flag(item_flag f);
bool has_technique(technique_id t, player *p = NULL);
int has_gunmod(int type);
item* active_gunmod();
std::vector<technique_id> techniques();
bool goes_bad();
bool count_by_charges();
bool craft_has_charges();
int num_charges();
bool rotten(game *g);
// Our value as a weapon, given particular skills
int weapon_value(int skills[num_skill_types]);
// As above, but discounts its use as a ranged weapon
int melee_value (int skills[num_skill_types]);
// Returns the data associated with tech, if we are an it_style
style_move style_data(technique_id tech);
bool is_two_handed(player *u);
bool made_of(material mat);
bool conductive();
bool conductive(); // Electricity
bool destroyed_at_zero_charges();
// Most of the is_whatever() functions call the same function in our itype
bool is_null(); // True if type is NULL, or points to the null item (id == 0)
bool is_food(player *u);// Some non-food items are food to certain players
bool is_food_container(player *u); // Ditto
bool is_food(); // Ignoring the ability to eat batteries, etc.
bool is_food_container(); // Ignoring the ability to eat batteries, etc.
bool is_food_container(player *u); // Ditto
bool is_food(); // Ignoring the ability to eat batteries, etc.
bool is_food_container(); // Ignoring the ability to eat batteries, etc.
bool is_ammo_container();
bool is_drink();
bool is_weap();
bool is_bashing_weapon();
bool is_cutting_weapon();
bool is_gun();
bool is_gunmod();;
bool is_gunmod();
bool is_bionic();
bool is_ammo();
bool is_armor();
bool is_book();
bool is_container();
bool is_tool();
bool is_software();
bool is_macguffin();
bool is_style();
bool is_other(); // Doesn't belong in other categories
bool is_var_veh_part();
bool is_artifact();
itype* type;
mtype* corpse;
int typeId();
itype* type;
mtype* corpse;
it_ammo* curammo;
std::vector<item> contents;
std::string name;
char invlet;
char invlet; // Inventory letter
int charges;
bool active; // If true, it has active effects to be processed
signed char damage; // How much damage it's sustained; generally, max is 5
unsigned int bday; // The turn on which it was created
bool owned; // If true, NPCs will shout at you for picking it up
bool active; // If true, it has active effects to be processed
signed char damage; // How much damage it's sustained; generally, max is 5
char burnt; // How badly we're burnt
unsigned int bday; // The turn on which it was created
int owned; // UID of NPC owner; 0 = player, -1 = unowned
union{
int poison; // How badly poisoned is it?
int bigness; // engine power, wheel size
};
int mode; // Mode of operation, can be changed by the player.
int mission_id;// Refers to a mission in game's master list
int player_id; // Only give a mission to the right player!
static itype * nullitem();
private:
static itype * nullitem_m;
};
std::ostream & operator<<(std::ostream &, const item &);
std::ostream & operator<<(std::ostream &, const item *);
#endif
+699 -173
View File
File diff suppressed because it is too large Load Diff
+3407 -1187
View File
File diff suppressed because it is too large Load Diff
+2665 -641
View File
File diff suppressed because it is too large Load Diff
+130 -62
View File
@@ -3,74 +3,142 @@
class game;
class item;
class player;
class iuse
{
public:
void none (game *g, item *it, bool t) { };
void none (game *g, player *p, item *it, bool t) { };
// FOOD AND DRUGS (ADMINISTRATION)
void royal_jelly (game *g, item *it, bool t);
void bandage (game *g, item *it, bool t);
void firstaid (game *g, item *it, bool t);
void caff (game *g, item *it, bool t);
void alcohol (game *g, item *it, bool t);
void pkill_1 (game *g, item *it, bool t);
void pkill_2 (game *g, item *it, bool t);
void pkill_3 (game *g, item *it, bool t);
void pkill_4 (game *g, item *it, bool t);
void pkill_l (game *g, item *it, bool t);
void xanax (game *g, item *it, bool t);
void cig (game *g, item *it, bool t);
void weed (game *g, item *it, bool t);
void coke (game *g, item *it, bool t);
void meth (game *g, item *it, bool t);
void poison (game *g, item *it, bool t);
void hallu (game *g, item *it, bool t);
void thorazine (game *g, item *it, bool t);
void prozac (game *g, item *it, bool t);
void sleep (game *g, item *it, bool t);
void flumed (game *g, item *it, bool t);
void flusleep (game *g, item *it, bool t);
void inhaler (game *g, item *it, bool t);
void blech (game *g, item *it, bool t);
void mutagen (game *g, item *it, bool t);
void purifier (game *g, item *it, bool t);
void sewage (game *g, player *p, item *it, bool t);
void honeycomb (game *g, player *p, item *it, bool t);
void royal_jelly (game *g, player *p, item *it, bool t);
void bandage (game *g, player *p, item *it, bool t);
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 pkill_1 (game *g, player *p, item *it, bool t);
void pkill_2 (game *g, player *p, item *it, bool t);
void pkill_3 (game *g, player *p, item *it, bool t);
void pkill_4 (game *g, player *p, item *it, bool t);
void pkill_l (game *g, player *p, item *it, bool t);
void xanax (game *g, player *p, item *it, bool t);
void cig (game *g, player *p, item *it, bool t);
void weed (game *g, player *p, item *it, bool t);
void coke (game *g, player *p, item *it, bool t);
void crack (game *g, player *p, item *it, bool t);
void grack (game *g, player *p, item *it, bool t);
void meth (game *g, player *p, item *it, bool t);
void poison (game *g, player *p, item *it, bool t);
void hallu (game *g, player *p, item *it, bool t);
void thorazine (game *g, player *p, item *it, bool t);
void prozac (game *g, player *p, item *it, bool t);
void sleep (game *g, player *p, item *it, bool t);
void iodine (game *g, player *p, item *it, bool t);
void flumed (game *g, player *p, item *it, bool t);
void flusleep (game *g, player *p, item *it, bool t);
void inhaler (game *g, player *p, item *it, bool t);
void blech (game *g, player *p, item *it, bool t);
void mutagen (game *g, player *p, item *it, bool t);
void mutagen_3 (game *g, player *p, item *it, bool t);
void purifier (game *g, player *p, item *it, bool t);
void marloss (game *g, player *p, item *it, bool t);
void dogfood (game *g, player *p, item *it, bool t);
// TOOLS
void lighter (game *g, item *it, bool t);
void sew (game *g, item *it, bool t);
void scissors (game *g, item *it, bool t);
void extinguisher (game *g, item *it, bool t);
void hammer (game *g, item *it, bool t);
void light_off (game *g, item *it, bool t);
void light_on (game *g, item *it, bool t);
void water_purifier (game *g, item *it, bool t);
void two_way_radio (game *g, item *it, bool t);
void radio_off (game *g, item *it, bool t);
void radio_on (game *g, item *it, bool t);
void crowbar (game *g, item *it, bool t);
void makemound (game *g, item *it, bool t);
void dig (game *g, item *it, bool t);
void chainsaw_off (game *g, item *it, bool t);
void chainsaw_on (game *g, item *it, bool t);
void jackhammer (game *g, item *it, bool t);
void set_trap (game *g, item *it, bool t);
void geiger (game *g, item *it, bool t);
void teleport (game *g, item *it, bool t);
void can_goo (game *g, item *it, bool t);
void grenade (game *g, item *it, bool t);
void grenade_act (game *g, item *it, bool t);
void gasbomb (game *g, item *it, bool t);
void gasbomb_act (game *g, item *it, bool t);
void smokebomb (game *g, item *it, bool t);
void smokebomb_act (game *g, item *it, bool t);
void molotov (game *g, item *it, bool t);
void molotov_lit (game *g, item *it, bool t);
void dynamite (game *g, item *it, bool t);
void dynamite_act (game *g, item *it, bool t);
void mininuke (game *g, item *it, bool t);
void mininuke_act (game *g, item *it, bool t);
void pheromone (game *g, item *it, bool t);
void portal (game *g, item *it, bool t);
void lighter (game *g, player *p, item *it, bool t);
void sew (game *g, player *p, item *it, bool t);
void scissors (game *g, player *p, item *it, bool t);
void extinguisher (game *g, player *p, item *it, bool t);
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 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 picklock (game *g, player *p, item *it, bool t);
void crowbar (game *g, player *p, item *it, bool t);
void makemound (game *g, player *p, item *it, bool t);
void dig (game *g, player *p, item *it, bool t);
void chainsaw_off (game *g, player *p, item *it, bool t);
void chainsaw_on (game *g, player *p, item *it, bool t);
void jackhammer (game *g, player *p, item *it, bool t);
void jacqueshammer (game *g, player *p, item *it, bool t);
void pickaxe (game *g, player *p, item *it, bool t);
void set_trap (game *g, player *p, item *it, bool t);
void geiger (game *g, player *p, item *it, bool t);
void teleport (game *g, player *p, item *it, bool t);
void can_goo (game *g, player *p, item *it, bool t);
void pipebomb (game *g, player *p, item *it, bool t);
void pipebomb_act (game *g, player *p, item *it, bool t);
void grenade (game *g, player *p, item *it, bool t);
void grenade_act (game *g, player *p, item *it, bool t);
void flashbang (game *g, player *p, item *it, bool t);
void flashbang_act (game *g, player *p, item *it, bool t);
void c4 (game *g, player *p, item *it, bool t);
void c4armed (game *g, player *p, item *it, bool t);
void EMPbomb (game *g, player *p, item *it, bool t);
void EMPbomb_act (game *g, player *p, item *it, bool t);
void scrambler (game *g, player *p, item *it, bool t);
void scrambler_act (game *g, player *p, item *it, bool t);
void gasbomb (game *g, player *p, item *it, bool t);
void gasbomb_act (game *g, player *p, item *it, bool t);
void smokebomb (game *g, player *p, item *it, bool t);
void smokebomb_act (game *g, player *p, item *it, bool t);
void acidbomb (game *g, player *p, item *it, bool t);
void acidbomb_act (game *g, player *p, item *it, bool t);
void molotov (game *g, player *p, item *it, bool t);
void molotov_lit (game *g, player *p, item *it, bool t);
void dynamite (game *g, player *p, item *it, bool t);
void dynamite_act (game *g, player *p, item *it, bool t);
void mininuke (game *g, player *p, item *it, bool t);
void mininuke_act (game *g, player *p, item *it, bool t);
void pheromone (game *g, player *p, item *it, bool t);
void portal (game *g, player *p, item *it, bool t);
void manhack (game *g, player *p, item *it, bool t);
void turret (game *g, player *p, item *it, bool t);
void UPS_off (game *g, player *p, item *it, bool t);
void UPS_on (game *g, player *p, item *it, bool t);
void tazer (game *g, player *p, item *it, bool t);
void mp3 (game *g, player *p, item *it, bool t);
void mp3_on (game *g, player *p, item *it, bool t);
void vortex (game *g, player *p, item *it, bool t);
void dog_whistle (game *g, player *p, item *it, bool t);
void vacutainer (game *g, player *p, item *it, bool t);
void knife (game *g, player *p, item *it, bool t);
void lumber (game *g, player *p, item *it, bool t);
void hacksaw (game *g, player *p, item *it, bool t);
void tent (game *g, player *p, item *it, bool t);
void torch (game *g, player *p, item *it, bool t);
void torch_lit (game *g, player *p, item *it, bool t);
void candle (game *g, player *p, item *it, bool t);
void candle_lit (game *g, player *p, item *it, bool t);
void bullet_puller (game *g, player *p, item *it, bool t);
void screwdriver (game *g, player *p, item *it, bool t);
void wrench (game *g, player *p, item *it, bool t);
void boltcutters (game *g, player *p, item *it, bool t);
void mop (game *g, player *p, item *it, bool t);
void spray_can (game *g, player *p, item *it, bool t);
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);
// MACGUFFINS
void mcg_note (game *g, player *p, item *it, bool t);
// ARTIFACTS
// This function is used when an artifact is activated
// It examines the item's artifact-specific properties
// See artifact.h for a list
void artifact (game *g, player *p, item *it, bool t);
void heal (game *g, player *p, item *it, bool t);
void twist_space (game *g, player *p, item *it, bool t);
void mass_vampire (game *g, player *p, item *it, bool t);
void growth (game *g, player *p, item *it, bool t);
void water (game *g, player *p, item *it, bool t);
void lava (game *g, player *p, item *it, bool t);
};
#endif
+182 -23
View File
@@ -1,61 +1,220 @@
#include "keypress.h"
#include "action.h"
#include "game.h"
long input()
{
long ch = getch();
switch (ch) {
case '7': return 'y';
case KEY_UP:
case '8': return 'k';
case '9': return 'u';
case KEY_LEFT:
case '4': return 'h';
case '5': return '.';
case KEY_RIGHT:
case '6': return 'l';
case '1': return 'b';
case KEY_DOWN:
case '2': return 'j';
case '3': return 'n';
case KEY_UP: return 'k';
case KEY_LEFT: return 'h';
case KEY_RIGHT: return 'l';
case KEY_DOWN: return 'j';
case 459: return '\n';
default: return ch;
}
}
void get_direction(int &x, int &y, char ch)
bool input_wait(char & ret_ch, int delay_ms)
{
while(true)
{
ret_ch = '\0';
timeout(delay_ms);
long ch = getch();
switch (ch) {
case KEY_UP:
ret_ch = 'k';
break;
case KEY_LEFT:
ret_ch = 'h';
break;
case KEY_RIGHT:
ret_ch = 'l';
break;
case KEY_DOWN:
ret_ch = 'j';
break;
case 459:
ret_ch = '\n';
break;
case ERR:
if(errno == EINTR)
return input_wait(ret_ch, delay_ms);
break;
default:
ret_ch = ch;
break;
}
timeout(-1);
if( ret_ch != '\0' )
return true;
return false;
}
}
void get_direction(game *g, int &x, int &y, char ch)
{
x = 0;
y = 0;
switch (ch) {
case 'y':
action_id act;
if (g->keymap.find(ch) == g->keymap.end())
act = ACTION_NULL;
else
act = g->keymap[ch];
switch (act) {
case ACTION_MOVE_NW:
x = -1;
y = -1;
return;
case 'u':
case ACTION_MOVE_NE:
x = 1;
y = -1;
return;
case 'h':
case ACTION_MOVE_W:
x = -1;
return;
case 'j':
case ACTION_MOVE_S:
y = 1;
return;
case 'k':
case ACTION_MOVE_N:
y = -1;
return;
case 'l':
case ACTION_MOVE_E:
x = 1;
return;
case 'b':
case ACTION_MOVE_SW:
x = -1;
y = 1;
return;
case 'n':
case ACTION_MOVE_SE:
x = 1;
y = 1;
return;
case ACTION_PAUSE:
case ACTION_PICKUP:
x = 0;
y = 0;
return;
default:
x = -2;
y = -2;
}
}
std::string default_keymap_txt()
{
return "\
# This is the keymapping for Cataclysm.\n\
# You can start a line with # to make it a comment--it will be ignored.\n\
# Blank lines are ignored too.\n\
# Extra whitespace, including tab, is ignored, so format things how you like.\n\
# If you wish to restore defaults, simply remove this file.\n\
\n\
# The format for each line is an action identifier, followed by several\n\
# keys. Any action may have an unlimited number of keys bound to it.\n\
# If you bind the same key to multiple actions, the second and subsequent\n\
# bindings will be ignored--and you'll get a warning when the game starts.\n\
# Keys are case-sensitive, of course; c and C are different.\n\
\n\
# WARNING: If you skip an action identifier, there will be no key bound to\n\
# that action! You will be NOT be warned of this when the game starts.\n\
# If you're going to mess with stuff, maybe you should back this file up?\n\
\n\
# It is okay to split commands across lines.\n\
# pause . 5 is equivalent to:\n\
# pause .\n\
# pause 5\n\
\n\
# Note that movement keybindings ONLY apply to movement (for now).\n\
# That is, binding w to move_n will let you use w to move north, but you\n\
# cannot use w to smash north, examine to the north, etc.\n\
# For now, you must use vikeys, the numpad, or arrow keys for those actions.\n\
# This is planned to change in the future.\n\
\n\
# Finally, there is no support for special keys, like spacebar, Home, and\n\
# so on. This is not a planned feature, but if it's important to you, please\n\
# let me know.\n\
\n\
# MOVEMENT:\n\
pause . 5\n\
move_n k 8\n\
move_ne u 9\n\
move_e l 6\n\
move_se n 3\n\
move_s j 2\n\
move_sw b 1\n\
move_w h 4\n\
move_nw y 7\n\
move_down >\n\
move_up <\n\
\n\
# MOVEMENT:\n\
center G\n\
shift_n K\n\
shift_e L\n\
shift_s J\n\
shift_w H\n\
\n\
# ENVIRONMENT INTERACTION\n\
open o\n\
close c\n\
smash s\n\
examine e\n\
pickup , g\n\
butcher B\n\
chat C\n\
look ; x\n\
peek X\n\
listitems V\n\
\n\
# INVENTORY & QUASI-INVENTORY INTERACTION\n\
inventory i\n\
compare I\n\
organize =\n\
apply a\n\
apply_wielded A\n\
wear W\n\
take_off T\n\
eat E\n\
read R\n\
wield w\n\
pick_style _\n\
reload r\n\
unload U\n\
throw t\n\
fire f\n\
#fire_burst F\n\
select_fire_mode F\n\
drop d\n\
drop_adj D\n\
bionics p\n\
\n\
# LONG TERM & SPECIAL ACTIONS\n\
wait ^\n\
craft &\n\
construct *\n\
disassemble (\n\
sleep $\n\
safemode !\n\
autosafe \"\n\
ignore_enemy '\n\
save S\n\
quit Q\n\
\n\
# INFO SCREENS\n\
player_data @\n\
map m :\n\
missions M\n\
factions #\n\
morale %\n\
messages P\n\
help ?\n\
\n\
# DEBUG FUNCTIONS\n\
debug_mode ~\n\
# debug Z\n\
# debug_scent -\n\
";
}
+11 -3
View File
@@ -1,10 +1,18 @@
#ifndef _KEYPRESS_H_
#define _KEYPRESS_H_
#include <ncurses.h>
#include <string>
#include "cursesdef.h"
class game;
// Simple text input--translates numpad to vikeys
long input();
// If ch is vikey, x & y are set to corresponding direction; ch=='y'->x=-1,y=-1
void get_direction(int &x, int &y, char ch);
bool input_wait(char & ret_ch, int timeout);
// Uses the keymap to figure out direction properly
void get_direction(game *g, int &x, int &y, char ch);
std::string default_keymap_txt();
#define CTRL(n) (n - 'A' + 1 < 1 ? n - 'a' + 1 : n - 'A' + 1)
#define KEY_ESCAPE 27
+497
View File
@@ -0,0 +1,497 @@
#include "mapdata.h"
#include "map.h"
#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)
light_map::light_map()
: lm()
, sm()
{
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 };
// 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) {
// In bright light indoor light exists to some degree
if (!is_outside(sx - x + LIGHTMAP_RANGE_X, sy - y + LIGHTMAP_RANGE_Y))
lm[sx - x + SEEX][sy - y + SEEY] = LIGHT_AMBIENT_LOW;
}
}
}
// Apply player light sources
if (luminance > LIGHT_AMBIENT_LOW)
apply_light_source(g->u.posx, g->u.posy, x, y, 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 + LIGHTMAP_RANGE_X, sy - y + LIGHTMAP_RANGE_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 + LIGHTMAP_RANGE_X + dir_x[i], sy - y + LIGHTMAP_RANGE_Y + dir_y[i])) {
if (INBOUNDS(sx - x, sy - y) && is_outside(LIGHTMAP_RANGE_X, LIGHTMAP_RANGE_Y))
lm[sx - x + SEEX][sy - y + SEEY] = 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 (items.size() == 1 &&
items[0].type->id == itm_flashlight_on)
apply_light_source(sx, sy, x, y, 20);
if(terrain == t_lava)
apply_light_source(sx, sy, x, y, 50);
if(terrain == t_console)
apply_light_source(sx, sy, x, y, 3);
if (items.size() == 1 &&
items[0].type->id == itm_candle_lit)
apply_light_source(sx, sy, x, y, 4);
if(terrain == t_emergency_light)
apply_light_source(sx, sy, x, y, 3);
// TODO: [lightmap] Attach light brightness to fields
switch(current_field.type) {
case fd_fire:
if (3 == current_field.density)
apply_light_source(sx, sy, x, y, 160);
else if (2 == current_field.density)
apply_light_source(sx, sy, x, y, 60);
else
apply_light_source(sx, sy, x, y, 16);
break;
case fd_fire_vent:
case fd_flame_burst:
apply_light_source(sx, sy, x, y, 8);
break;
case fd_electricity:
if (3 == current_field.density)
apply_light_source(sx, sy, x, y, 8);
else if (2 == current_field.density)
apply_light_source(sx, sy, x, y, 1);
else
apply_light_source(sx, sy, x, y, 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);
}
}
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;
}
}
}
}
}
lit_level light_map::at(int dx, int dy)
{
if (!INBOUNDS(dx, dy))
return LL_DARK; // Out of bounds
if (sm[dx + SEEX][dy + SEEY] >= LIGHT_SOURCE_BRIGHT)
return LL_BRIGHT;
if (lm[dx + SEEX][dy + SEEY] >= LIGHT_AMBIENT_LIT)
return LL_LIT;
if (lm[dx + SEEX][dy + SEEY] >= LIGHT_AMBIENT_LOW)
return LL_LOW;
return LL_DARK;
}
float light_map::ambient_at(int dx, int dy)
{
if (!INBOUNDS(dx, dy))
return 0.0f;
return lm[dx + SEEX][dy + SEEY];
}
bool light_map::is_outside(int dx, int dy)
{
// 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 (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);
}
void light_map::apply_light_source(int x, int y, int cx, int cy, float luminance)
{
bool lit[LIGHTMAP_X][LIGHTMAP_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 (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;
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);
}
// 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);
}
}
}
void light_map::apply_light_arc(int x, int y, int angle, int cx, int cy, float luminance)
{
if (luminance <= LIGHT_SOURCE_LOCAL)
return;
bool lit[LIGHTMAP_X][LIGHTMAP_Y];
memset(lit, 0, sizeof(lit));
int range = LIGHT_RANGE(luminance);
apply_light_source(x, y, cx, cy, 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 ox = x - cx + range;
for(int oy = sy; oy <= ey; ++oy)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, 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 oy = y - cy + range;
for(int ox = sx; ox <= ex; ++ox)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, 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 ox = x - cx - range;
for(int oy = sy; oy <= ey; ++oy)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, 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 oy = y - cy - range;
for(int ox = sx; ox <= ex; ++ox)
apply_light_ray(lit, x, y, cx + ox, cy + oy, cx, cy, 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)
{
int ax = abs(ex - sx) << 1;
int ay = abs(ey - sy) << 1;
int dx = (sx < ex) ? 1 : -1;
int dy = (sy < ey) ? 1 : -1;
int x = sx;
int y = sy;
float transparency = LIGHT_TRANSPARENCY_CLEAR;
// 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;
t -= ax;
}
x += dx;
t += ay;
if (INBOUNDS(x - cx, y - cy) && !lit[x - cx + SEEX][y - cy + SEEY]) {
// Multiple rays will pass through the same squares so we need to record that
lit[x - cx + SEEX][y - cy + SEEY] = 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;
}
if (INBOUNDS_LARGE(x - cx, y - cy))
transparency *= c[x - cx + LIGHTMAP_RANGE_X][y - cy + LIGHTMAP_RANGE_Y].transparency;
if (transparency <= LIGHT_TRANSPARENCY_SOLID)
break;
} while(!(x == ex && y == ey));
} else {
int t = ax - (ay >> 1);
do {
if(t >= 0) {
x += dx;
t -= ay;
}
y += dy;
t += ax;
if (INBOUNDS(x - cx, y - cy) && !lit[x - cx + SEEX][y - cy + SEEY]) {
// Multiple rays will pass through the same squares so we need to record that
lit[x - cx + SEEX][y - cy + SEEY] = 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;
}
if (INBOUNDS_LARGE(x - cx, y - cy))
transparency *= c[x - cx + LIGHTMAP_RANGE_X][y - cy + LIGHTMAP_RANGE_Y].transparency;
if (transparency <= LIGHT_TRANSPARENCY_SOLID)
break;
} 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) {
for( int dx = -1; dx <=1; dx++ ) {
for( int dy = -1; dy <=1; dy++ ) {
if( INBOUNDS(x + dx, x + dy) ) {
outside_cache[x + dx][y + dy] = false;
}
}
}
} else if(terrain == t_bed || terrain == t_groundsheet) {
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
// Initialize cache of outside tiles
memset(outside_cache, true, sizeof(outside_cache));
for(int sx = cx - LIGHTMAP_RANGE_X; sx <= cx + LIGHTMAP_RANGE_X; ++sx) {
for(int sy = cy - LIGHTMAP_RANGE_Y; sy <= cy + LIGHTMAP_RANGE_Y; ++sy) {
int x = sx - cx + LIGHTMAP_RANGE_X;
int y = sy - cy + 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 sx = cx - LIGHTMAP_RANGE_X; sx <= cx + LIGHTMAP_RANGE_X; ++sx) {
for(int sy = cy - LIGHTMAP_RANGE_Y; sy <= cy + LIGHTMAP_RANGE_Y; ++sy) {
int x = sx - cx + LIGHTMAP_RANGE_X;
int y = sy - 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
}
}
}
}
+73
View File
@@ -0,0 +1,73 @@
#ifndef _LIGHTMAP_H_
#define _LIGHTMAP_H_
#include "mapdata.h"
#include "map.h"
#define LIGHT_SOURCE_LOCAL 0.1
#define LIGHT_SOURCE_BRIGHT 10
#define LIGHT_AMBIENT_LOW 1
#define LIGHT_AMBIENT_LIT 2
#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,
LL_LOW, // Hard to see
LL_LIT,
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
+167 -23
View File
@@ -1,9 +1,10 @@
#include "line.h"
#include "map.h"
#include <stdlib.h>
#define SGN(a) (((a)<0) ? -1 : 1)
std::vector <point> line_to(int x1, int y1, int x2, int y2, int t) {
std::vector <point> line_to(int x1, int y1, int x2, int y2, int t)
{
std::vector<point> ret;
int dx = x2 - x1;
int dy = y2 - y1;
@@ -17,7 +18,22 @@ std::vector <point> line_to(int x1, int y1, int x2, int y2, int t) {
cur.x = x1;
cur.y = y1;
if (ax > ay) {
int xmin = (x1 < x2 ? x1 : x2), ymin = (y1 < y2 ? y1 : y2),
xmax = (x1 > x2 ? x1 : x2), ymax = (y1 > y2 ? y1 : y2);
xmin -= abs(dx);
ymin -= abs(dy);
xmax += abs(dx);
ymax += abs(dy);
if (ax == ay) {
do {
cur.y += sy;
cur.x += sx;
ret.push_back(cur);
} while ((cur.x != x2 || cur.y != y2) &&
(cur.x >= xmin && cur.x <= xmax && cur.y >= ymin && cur.y <= ymax));
} else if (ax > ay) {
do {
if (t > 0) {
cur.y += sy;
@@ -27,8 +43,7 @@ std::vector <point> line_to(int x1, int y1, int x2, int y2, int t) {
t += ay;
ret.push_back(cur);
} while ((cur.x != x2 || cur.y != y2) &&
(cur.x >= 0 - SEEX * 3 && cur.x <= SEEX * 6 &&
cur.y >= 0 - SEEY * 3 && cur.y <= SEEY * 6 ));
(cur.x >= xmin && cur.x <= xmax && cur.y >= ymin && cur.y <= ymax));
} else {
do {
if (t > 0) {
@@ -39,15 +54,14 @@ std::vector <point> line_to(int x1, int y1, int x2, int y2, int t) {
t += ax;
ret.push_back(cur);
} while ((cur.x != x2 || cur.y != y2) &&
(cur.x >= 0 - SEEX * 3 && cur.x <= SEEX * 6 &&
cur.y >= 0 - SEEY * 3 && cur.y <= SEEY * 6 ));
(cur.x >= xmin && cur.x <= xmax && cur.y >= ymin && cur.y <= ymax));
}
return ret;
}
int trig_dist(int x1, int y1, int x2, int y2)
{
return int(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)));
return int(sqrt(double(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0))));
}
int rl_dist(int x1, int y1, int x2, int y2)
@@ -58,37 +72,167 @@ int rl_dist(int x1, int y1, int x2, int y2)
return dy;
}
std::string direction_from(int x1, int y1, int x2, int y2)
int rl_dist(point a, point b)
{
int dx = abs(a.x - b.x), dy = abs(a.y - b.y);
if (dx > dy)
return dx;
return dy;
}
double slope_of(std::vector<point> line)
{
double dX = line.back().x - line.front().x, dY = line.back().y - line.front().y;
if (dX == 0)
return SLOPE_VERTICAL;
return (dY / dX);
}
std::vector<point> continue_line(std::vector<point> line, int distance)
{
point start = line.back(), end = line.back();
double slope = slope_of(line);
int sX = (line.front().x < line.back().x ? 1 : -1),
sY = (line.front().y < line.back().y ? 1 : -1);
if (abs(slope) == 1) {
end.x += distance * sX;
end.y += distance * sY;
} else if (abs(slope) < 1) {
end.x += distance * sX;
end.y += int(distance * abs(slope) * sY);
} else {
end.y += distance * sY;
if (slope != SLOPE_VERTICAL)
end.x += int(distance / abs(slope)) * sX;
}
return line_to(start.x, start.y, end.x, end.y, 0);
}
direction direction_from(int x1, int y1, int x2, int y2)
{
int dx = x2 - x1;
int dy = y2 - y1;
if (dx < 0) {
if (abs(dx) >> 1 > abs(dy) || dy == 0) {
return "the west";
} else if (abs(dy) >> 1 > abs(dx)) {
if (abs(dx) / 2 > abs(dy) || dy == 0) {
return WEST;
} else if (abs(dy) / 2 > abs(dx)) {
if (dy < 0)
return "the north";
return NORTH;
else
return "the south";
return SOUTH;
} else {
if (dy < 0)
return "the northwest";
return NORTHWEST;
else
return "the southwest";
return SOUTHWEST;
}
} else {
if (dx >> 1 > abs(dy) || dy == 0) {
return "the east";
} else if (abs(dy) >> 1 > dx || dx == 0) {
if (dx / 2 > abs(dy) || dy == 0) {
return EAST;
} else if (abs(dy) / 2 > dx || dx == 0) {
if (dy < 0)
return "the north";
return NORTH;
else
return "the south";
return SOUTH;
} else {
if (dy < 0)
return "the northeast";
return NORTHEAST;
else
return "the southeast";
return SOUTHEAST;
}
}
}
std::string direction_name(direction dir)
{
switch (dir) {
case NORTH: return "north";
case NORTHEAST: return "northeast";
case EAST: return "east";
case SOUTHEAST: return "southeast";
case SOUTH: return "south";
case SOUTHWEST: return "southwest";
case WEST: return "west";
case NORTHWEST: return "northwest";
}
return "WEIRD DIRECTION_NAME() BUG";
}
std::string direction_name_short(direction dir)
{
switch (dir) {
case NORTH: return "N ";
case NORTHEAST: return "NE";
case EAST: return "E ";
case SOUTHEAST: return "SE";
case SOUTH: return "W ";
case SOUTHWEST: return "SW";
case WEST: return "W ";
case NORTHWEST: return "NW";
}
return "WEIRD DIRECTION_NAME() BUG";
}
float rl_vec2d::norm(){
if (fabs(x) > fabs(y))
return fabs(x);
return fabs(y);
}
rl_vec2d rl_vec2d::normalized(){
rl_vec2d ret;
if (is_null()){ // shouldn't happen?
ret.x = ret.y = 1;
return ret;
}
float n = norm();
ret.x = x/n;
ret.y = y/n;
return ret;
}
float rl_vec2d::dot_product (rl_vec2d &v){
float dot = x*v.x + y*v.y;
// this is messy, but the dot of normalized rl_vecs should somehow be max 1
float tot1 = fabs(x) + fabs(y);
float tot2 = fabs(v.x) + fabs(v.y);
dot /= ((tot1+tot2)/2);
dot *= norm() * v.norm();
return dot;
}
bool rl_vec2d::is_null(){
return !(x || y);
}
// scale.
rl_vec2d rl_vec2d::operator* (const float rhs){
rl_vec2d ret;
ret.x = x * rhs;
ret.y = y * rhs;
return ret;
}
// subtract
rl_vec2d rl_vec2d::operator- (const rl_vec2d &rhs){
rl_vec2d ret;
ret.x = x - rhs.x;
ret.y = y - rhs.y;
return ret;
}
// unary negation
rl_vec2d rl_vec2d::operator- (){
rl_vec2d ret;
ret.x = -x;
ret.y = -y;
return ret;
}
rl_vec2d rl_vec2d::operator+ (const rl_vec2d &rhs){
rl_vec2d ret;
ret.x = x + rhs.x;
ret.y = y + rhs.y;
return ret;
}
rl_vec2d rl_vec2d::operator/ (const float rhs){
rl_vec2d ret;
ret.x = x / rhs;
ret.y = y / rhs;
return ret;
}
+49 -1
View File
@@ -4,11 +4,59 @@
#include <vector>
#include <string>
#include "enums.h"
#include <math.h>
#define SLOPE_VERTICAL 999999
enum direction {
NORTH = 0,
NORTHEAST,
EAST,
SOUTHEAST,
SOUTH,
SOUTHWEST,
WEST,
NORTHWEST
};
// The "t" value decides WHICH Bresenham line is used.
std::vector <point> line_to(int x1, int y1, int x2, int y2, int t);
// sqrt(dX^2 + dY^2)
int trig_dist(int x1, int y1, int x2, int y2);
// Roguelike distance; minimum of dX and dY
int rl_dist(int x1, int y1, int x2, int y2);
std::string direction_from(int x1, int y1, int x2, int y2);
int rl_dist(point a, point b);
double slope_of(std::vector<point> line);
std::vector<point> continue_line(std::vector<point> line, int distance);
direction direction_from(int x1, int y1, int x2, int y2);
std::string direction_name(direction dir);
std::string direction_name_short(direction dir);
// weird class for 2d vectors where dist is derived from rl_dist
struct rl_vec2d {
float x;
float y;
// vec2d(){}
rl_vec2d(float X = 0, float Y = 0) : x (X), y (Y) {}
rl_vec2d(const rl_vec2d &v) : x (v.x), y (v.y) {}
~rl_vec2d(){}
float norm();
rl_vec2d normalized();
float dot_product (rl_vec2d &v);
bool is_null();
// scale.
rl_vec2d operator* (const float rhs);
rl_vec2d operator/ (const float rhs);
// subtract
rl_vec2d operator- (const rl_vec2d &rhs);
// unary negation
rl_vec2d operator- ();
rl_vec2d operator+ (const rl_vec2d &rhs);
};
#endif
+93 -47
View File
@@ -4,65 +4,111 @@
* Who knows
*/
#include <ncurses.h>
#include "cursesdef.h"
#include <ctime>
#include "game.h"
#include "color.h"
#include "options.h"
#include "mapbuffer.h"
#include "debug.h"
#include <sys/stat.h>
#include <cstdlib>
#include <signal.h>
// FUNCTIONS
void do_colors();
//void load_items();
void exit_handler(int s);
int main(int argc, char *argv[])
{
srand(time(NULL));
#ifdef ENABLE_LOGGING
setupDebug();
#endif
int seed = time(NULL);
initscr();
noecho();
cbreak();
keypad(stdscr, true);
do_colors();
curs_set(0);
//args: world seeding only.
argc--; argv++;
while (argc){
if(std::string(argv[0]) == "--seed"){
argc--; argv++;
if(argc){
seed = djb2_hash((unsigned char*)argv[0]);
argc--; argv++;
}
}
else // ignore unknown args.
argc--; argv++;
}
// ncurses stuff
load_options(); // For getting size options
initscr(); // Initialize ncurses
noecho(); // Don't echo keypresses
cbreak(); // C-style breaks (e.g. ^C to SIGINT)
keypad(stdscr, true); // Numpad is numbers
init_colors(); // See color.cpp
curs_set(0); // Invisible cursor
set_escdelay(10); // Make escape actually responsive
std::srand(seed);
bool quit_game = false;
bool delete_world = false;
game *g = new game;
MAPBUFFER.set_game(g);
MAPBUFFER.load();
#if (!(defined _WIN32 || defined WINDOWS))
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = exit_handler;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
#endif
do {
g->setup();
while (!g->do_turn()) ;
if (g->uquit == QUIT_DELETE_WORLD)
delete_world = true;
if (g->game_quit())
quit_game = true;
} while (!quit_game);
if (delete_world)
{
g->delete_save();
} else {
MAPBUFFER.save_if_dirty();
}
exit_handler(-999);
rand();
game g;
while (!g.do_turn());
erase();
endwin();
system("clear");
return 0;
}
#define HILIGHT COLOR_BLUE
void do_colors()
{
start_color();
void exit_handler(int s) {
bool bExit = false;
init_pair( 1, COLOR_WHITE, COLOR_BLACK );
init_pair( 2, COLOR_RED, COLOR_BLACK );
init_pair( 3, COLOR_GREEN, COLOR_BLACK );
init_pair( 4, COLOR_BLUE, COLOR_BLACK );
init_pair( 5, COLOR_CYAN, COLOR_BLACK );
init_pair( 6, COLOR_MAGENTA, COLOR_BLACK );
init_pair( 7, COLOR_YELLOW, COLOR_BLACK );
if (s == 2) {
if (query_yn("Really Quit without saving?")) {
bExit = true;
}
} else if (s == -999) {
bExit = true;
} else {
//query_yn("Signal received: %d", s);
bExit = true;
}
// Inverted Colors
init_pair( 8, COLOR_BLACK, COLOR_WHITE );
init_pair( 9, COLOR_BLACK, COLOR_RED );
init_pair(10, COLOR_BLACK, COLOR_GREEN );
init_pair(11, COLOR_BLACK, COLOR_BLUE );
init_pair(12, COLOR_BLACK, COLOR_CYAN );
init_pair(13, COLOR_BLACK, COLOR_MAGENTA);
init_pair(14, COLOR_BLACK, COLOR_YELLOW );
if (bExit) {
erase(); // Clear screen
endwin(); // End ncurses
#if (defined _WIN32 || defined WINDOWS)
system("cls"); // Tell the terminal to clear itself
system("color 07");
#else
system("clear"); // Tell the terminal to clear itself
#endif
// Highlighted - blue background
init_pair(15, COLOR_WHITE, HILIGHT);
init_pair(16, COLOR_RED, HILIGHT);
init_pair(17, COLOR_GREEN, HILIGHT);
init_pair(18, COLOR_BLUE, HILIGHT);
init_pair(19, COLOR_CYAN, HILIGHT);
init_pair(20, COLOR_BLACK, HILIGHT);
init_pair(21, COLOR_MAGENTA, HILIGHT);
init_pair(22, COLOR_YELLOW, HILIGHT);
init_pair(23, COLOR_BLACK, COLOR_BLACK );
exit(1);
}
}
+2570 -449
View File
File diff suppressed because it is too large Load Diff
+178 -51
View File
@@ -1,10 +1,13 @@
#ifndef _MAP_H_
#define _MAP_H_
#include <ncurses.h>
#include "cursesdef.h"
#include <stdlib.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include "mapdata.h"
#include "mapitems.h"
@@ -12,103 +15,227 @@
#include "item.h"
#include "monster.h"
#include "npc.h"
#include "vehicle.h"
#include "graffiti.h"
#define MAPSIZE 11
class player;
class item;
struct itype;
// TODO: This should be const& but almost no functions are const
struct wrapped_vehicle{
int x;
int y;
int i; // submap col
int j; // submap row
vehicle* v;
};
typedef std::vector<wrapped_vehicle> VehicleList;
class map
{
public:
// Constructors & Initialization
map();
map(std::vector<itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
~map();
void init(game *g, int x, int y);
void generate(game *g, overmap *om, int x, int y, int turn);
// Visual Output
void draw(game *g, WINDOW* w);
void draw(game *g, WINDOW* w, const point center);
void debug();
void drawsq(WINDOW* w, player &u, int x, int y, bool invert, bool show_items);
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 bool low_light = false, const bool bright_level = false);
// File I/O
void save(overmap *om, unsigned int turn, int x, int y);
void load(game *g, int wx, int wy);
void shift(game *g, int wx, int wy, int x, int y);
virtual void save(overmap *om, unsigned const int turn, const int x, const int y);
virtual void load(game *g, const int wx, const int wy, const bool update_vehicles = true);
void shift(game *g, const int wx, const int wy, const int x, const int y);
void spawn_monsters(game *g);
void clear_spawns();
void clear_traps();
// Movement and LOS
int move_cost(int x, int y); // Cost to move through; 0 = impassible
bool trans(int x, int y); // Transparent?
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?
// (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(int Fx, int Fy, int Tx, int Ty, int range, int &tc);
//std::vector<point> route(int Fx, int Fy, int Tx, int Ty); // Best route
bool sees(const int Fx, const int Fy, const int Tx, const int Ty,
const int range, int &tc, char * trans_buf = NULL);
// 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);
// route() generates an A* best path; if bash is true, we can bash through doors
std::vector<point> route(const int Fx, const int Fy, const int Tx, const int Ty,
const bool bash = true);
// vehicles
VehicleList get_vehicles();
VehicleList get_vehicles(const int sx, const int sy, const int ex, const int ey);
// checks, if tile is occupied by vehicle and by which part
vehicle* veh_at(const int x, const int y, int &part_num);
vehicle* veh_at(const int x, const int y);// checks, if tile is occupied by vehicle
// put player on vehicle at x,y
void board_vehicle(game *g, int x, int y, player *p);
void unboard_vehicle(game *g, const int x, const int y);//remove player from vehicle at x,y
void update_vehicle_cache(vehicle *, const bool brand_new = false);
void reset_vehicle_cache();
void clear_vehicle_cache();
void update_vehicle_list(const int to);
void destroy_vehicle (vehicle *veh);
// Change vehicle coords and move vehicle's driver along.
// Returns true, if there was a submap change.
// If test is true, function only checks for submap change, no displacement
// WARNING: not checking collisions!
bool displace_vehicle (game *g, int &x, int &y, const int dx, const int dy, bool test);
void vehmove(game* g); // Vehicle movement
bool vehproceed(game* g);
// move water under wheels. true if moved
bool displace_water (const int x, const int y);
// Terrain
ter_id& ter(int x, int y); // Terrain at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
std::string tername(int x, int y); // Name of terrain at (x, y)
std::string features(int x, int y); // Words relevant to terrain (sharp, etc)
bool has_flag(t_flag flag, int x, int y);
bool is_destructable(int x, int y);
ter_id& ter(const int x, const int y); // Terrain at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
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)
bool has_flag(const t_flag flag, const int x, const int y); // checks terrain and vehicles
bool has_flag_ter_only(const t_flag flag, const int x, const int y); // only checks terrain
bool is_destructable(const int x, const int y); // checks terrain and vehicles
bool is_destructable_ter_only(const int x, const int y); // only checks terrain
bool is_outside(const int x, const int y);
bool flammable_items_at(const int x, const int y);
bool moppable_items_at(const int x, const int y);
point random_outdoor_tile();
bool close_door(int x, int y);
bool open_door(int x, int y, bool inside);
bool bash(int x, int y, int str, std::string &sound);
void destroy(game *g, int x, int y, bool makesound);
void shoot(game *g, int x, int y, int &dam, bool hit_items);
void translate(const ter_id from, const ter_id to); // Change all instances of $from->$to
bool close_door(const int x, const int y, const bool inside);
bool open_door(const int x, const int y, const bool inside);
// bash: if res pointer is supplied, res will contain absorbed impact or -1
bool bash(const int x, const int y, const int str, std::string &sound, int *res = 0);
void destroy(game *g, const int x, const int y, const bool makesound);
void shoot(game *g, const int x, const int y, int &dam, const bool hit_items, const unsigned flags);
bool hit_with_acid(game *g, const int x, const int y);
void marlossify(const int x, const int y);
bool has_adjacent_furniture(const int x, const int y);
void mop_spills(const int x, const int y);
// Radiation
int& radiation(int x, int y); // Amount of radiation at (x, y);
int& radiation(const int x, const int y); // Amount of radiation at (x, y);
// Items
std::vector<item>& i_at(int x, int y);
item water_from(int x, int y);
void i_clear(int x, int y);
void i_rem(int x, int y, int index);
point find_item(item *it);
void add_item(int x, int y, itype* type, int birthday);
void add_item(int x, int y, item new_item);
item water_from(const int x, const int y);
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 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);
void process_vehicles(game *g);
void use_amount(const point origin, const int range, const itype_id type, const int amount,
const bool use_container = false);
void use_charges(const point origin, const int range, const itype_id type, const int amount);
// Traps
trap_id& tr_at(int x, int y);
void add_trap(int x, int y, trap_id t);
void disarm_trap( game *g, int x, int y);
trap_id& tr_at(const int x, const int y);
void add_trap(const int x, const int y, const trap_id t);
void disarm_trap( game *g, const int x, const int y);
// Fields
field& field_at(int x, int y);
bool add_field(game *g, int x, int y, field_id t, unsigned char density);
bool process_fields(game *g);
void step_in_field(int x, int y, game *g);
void mon_in_field(int x, int y, game *g, monster *z);
// mapgen.h functions
void place_items(items_location loc, int chance, int x1, int y1,
int x2, int y2, bool ongrass, int turn);
void make_all_items_owned();
void add_spawn(mon_id type, int count, int x, int y);
private:
void saven(overmap *om, unsigned int turn, int x, int y, int gridx, int gridy);
bool loadn(game *g, int x, int y, int gridx, int gridy);
void draw_map(oter_id terrain_type, oter_id t_north, oter_id t_east,
oter_id t_south, oter_id t_west, oter_id t_above, int turn);
void rotate(int turns);// Rotates the current map 90*turns degress clockwise
field& field_at(const int x, const int y);
bool add_field(game *g, const int x, const int y, const field_id t, const unsigned char density);
void remove_field(const int x, const int y);
bool process_fields(game *g); // See fields.cpp
bool process_fields_in_submap(game *g, const int gridn); // See fields.cpp
void step_in_field(const int x, const int y, game *g); // See fields.cpp
void mon_in_field(const int x, const int y, game *g, monster *z); // See fields.cpp
// Computers
computer* computer_at(const int x, const int y);
// Graffiti
graffiti graffiti_at(int x, int y);
bool add_graffiti(game *g, int x, int y, std::string contents);
// mapgen.cpp functions
void generate(game *g, overmap *om, const int x, const int y, const int turn);
void post_process(game *g, unsigned zones);
void place_spawns(game *g, const moncat_id monster_type, const int chance,
const int x1, const int y1, const int x2, const int y2, const float density);
void place_items(items_location loc, const int chance, const int x1, const int y1,
const int x2, const int y2, bool ongrass, const int turn);
// put_items_from puts exactly num items, based on chances
void put_items_from(items_location loc, const int num, const int x, const int y, const int turn = 0);
void add_spawn(mon_id type, const int count, const int x, const int y, bool friendly = false,
const int faction_id = -1, const int mission_id = -1,
std::string name = "NONE");
void add_spawn(monster *mon);
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);
std::vector <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];
protected:
void saven(overmap *om, unsigned const int turn, const int x, const int y,
const int gridx, const int gridy);
bool loadn(game *g, const int x, const int y, const int gridx, const int gridy,
const bool update_vehicles = true);
void copy_grid(const int to, const int from);
void draw_map(const oter_id terrain_type, const oter_id t_north, const oter_id t_east,
const oter_id t_south, const oter_id t_west, const oter_id t_above, const int turn,
game *g, const float density);
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
submap grid[9];
bool inbounds(const int x, const int y);
int my_MAPSIZE;
virtual bool is_tiny() { return false; };
std::vector<item> nulitems; // Returned when &i_at() is asked for an OOB value
ter_id nulter; // Returned when &ter() is asked for an OOB value
trap_id nultrap; // Returned when &tr_at() is asked for an OOB value
field nulfield; // Returned when &field_at() is asked for an OOB value
vehicle nulveh; // Returned when &veh_at() is asked for an OOB value
int nulrad; // OOB &radiation()
std::vector <itype*> *itypes;
std::vector <trap*> *traps;
std::vector <itype_id> (*mapitems)[num_itloc];
bool veh_in_active_range;
private:
submap* grid[MAPSIZE * MAPSIZE];
};
class tinymap : public map
{
public:
tinymap();
tinymap(std::vector<itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
std::vector<trap*> *trptr);
~tinymap();
protected:
virtual bool is_tiny() { return true; };
private:
submap* grid[4];
};
#endif
+304
View File
@@ -0,0 +1,304 @@
#include "mapbuffer.h"
#include "game.h"
#include "output.h"
#include "debug.h"
#include <fstream>
#define dbg(x) dout((DebugLevel)(x),D_MAP) << __FILE__ << ":" << __LINE__ << ": "
mapbuffer MAPBUFFER;
// g defaults to NULL
mapbuffer::mapbuffer()
{
dirty = false;
}
mapbuffer::~mapbuffer()
{
reset();
}
void mapbuffer::reset(){
std::list<submap*>::iterator it;
for (it = submap_list.begin(); it != submap_list.end(); it++)
delete *it;
submaps.clear();
submap_list.clear();
}
// game g's existance does not imply that it has been identified, started, or loaded.
void mapbuffer::set_game(game *g)
{
master_game = g;
}
// set to dirty right before the game starts & the player starts changing stuff.
void mapbuffer::set_dirty()
{
dirty = true;
}
// initial state; no need to synchronize.
// make volatile after game has ended.
void mapbuffer::make_volatile()
{
dirty = false;
}
bool mapbuffer::add_submap(int x, int y, int z, submap *sm)
{
dbg(D_INFO) << "mapbuffer::add_submap( x["<< x <<"], y["<< y <<"], z["<< z <<"], submap["<< sm <<"])";
tripoint p(x, y, z);
if (submaps.count(p) != 0)
return false;
if (master_game)
sm->turn_last_touched = int(master_game->turn);
submap_list.push_back(sm);
submaps[p] = sm;
return true;
}
submap* mapbuffer::lookup_submap(int x, int y, int z)
{
dbg(D_INFO) << "mapbuffer::lookup_submap( x["<< x <<"], y["<< y <<"], z["<< z <<"])";
tripoint p(x, y, z);
if (submaps.count(p) == 0)
return NULL;
dbg(D_INFO) << "mapbuffer::lookup_submap success: "<< submaps[p];
return submaps[p];
}
void mapbuffer::save_if_dirty()
{
if(dirty)
save();
}
void mapbuffer::save()
{
std::map<tripoint, submap*>::iterator it;
std::ofstream fout;
fout.open("save/maps.txt");
fout << submap_list.size() << std::endl;
int num_saved_submaps = 0;
int num_total_submaps = submap_list.size();
for (it = submaps.begin(); it != submaps.end(); it++) {
if (num_saved_submaps % 100 == 0)
popup_nowait("Please wait as the map saves [%d/%d]",
num_saved_submaps, num_total_submaps);
fout << it->first.x << " " << it->first.y << " " << it->first.z << std::endl;
submap *sm = it->second;
fout << sm->turn_last_touched << std::endl;
// Dump the terrain.
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++)
fout << int(sm->ter[i][j]) << " ";
fout << std::endl;
}
// Dump the radiation
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++)
fout << sm->rad[i][j] << " ";
}
fout << std::endl;
// Items section; designate it with an I. Then check itm[][] for each square
// in the grid and print the coords and the item's details.
// Designate it with a C if it's contained in the prior item.
// Also, this wastes space since we print the coords for each item, when we
// could be printing a list of items for each coord (except the empty ones)
item tmp;
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
for (int k = 0; k < sm->itm[i][j].size(); k++) {
tmp = sm->itm[i][j][k];
fout << "I " << i << " " << j << std::endl;
fout << tmp.save_info() << std::endl;
for (int l = 0; l < tmp.contents.size(); l++)
fout << "C " << std::endl << tmp.contents[l].save_info() << std::endl;
}
}
}
// Output the traps
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
if (sm->trp[i][j] != tr_null)
fout << "T " << i << " " << j << " " << sm->trp[i][j] <<
std::endl;
}
}
// Output the fields
field tmpf;
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
tmpf = sm->fld[i][j];
if (tmpf.type != fd_null)
fout << "F " << i << " " << j << " " << int(tmpf.type) << " " <<
int(tmpf.density) << " " << tmpf.age << std::endl;
}
}
// Output the spawn points
spawn_point tmpsp;
for (int i = 0; i < sm->spawns.size(); i++) {
tmpsp = sm->spawns[i];
fout << "S " << int(tmpsp.type) << " " << tmpsp.count << " " << tmpsp.posx <<
" " << tmpsp.posy << " " << tmpsp.faction_id << " " <<
tmpsp.mission_id << (tmpsp.friendly ? " 1 " : " 0 ") <<
tmpsp.name << std::endl;
}
// Output the vehicles
for (int i = 0; i < sm->vehicles.size(); i++) {
fout << "V ";
sm->vehicles[i]->save (fout);
}
// Output the computer
if (sm->comp.name != "")
fout << "c " << sm->comp.save_data() << std::endl;
// Output the graffiti
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
if (sm->graf[i][j].contents)
fout << "G " << i << " " << j << *sm->graf[i][j].contents << std::endl;
}
}
fout << "----" << std::endl;
num_saved_submaps++;
}
// Close the file; that's all we need.
fout.close();
}
void mapbuffer::load()
{
if (!master_game) {
debugmsg("Can't load mapbuffer without a master_game");
return;
}
std::map<tripoint, submap*>::iterator it;
std::ifstream fin;
fin.open("save/maps.txt");
if (!fin.is_open())
return;
int itx, ity, t, d, a, num_submaps, num_loaded=0;
bool fields_here = false;
item it_tmp;
std::string databuff;
fin >> num_submaps;
while (!fin.eof()) {
if (num_loaded % 100 == 0)
popup_nowait("Please wait as the map loads [%d/%d]",
num_loaded, num_submaps);
int locx, locy, locz, turn;
submap* sm = new submap;
fin >> locx >> locy >> locz >> turn;
sm->turn_last_touched = turn;
int turndif = (master_game ? int(master_game->turn) - turn : 0);
if (turndif < 0)
turndif = 0;
// Load terrain
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
int tmpter;
fin >> tmpter;
sm->ter[i][j] = ter_id(tmpter);
sm->itm[i][j].clear();
sm->trp[i][j] = tr_null;
sm->fld[i][j] = field();
sm->graf[i][j] = graffiti();
}
}
// Load irradiation
for (int j = 0; j < SEEY; j++) {
for (int i = 0; i < SEEX; i++) {
int radtmp;
fin >> radtmp;
radtmp -= int(turndif / 100); // Radiation slowly decays
if (radtmp < 0)
radtmp = 0;
sm->rad[i][j] = radtmp;
}
}
// Load items and traps and fields and spawn points and vehicles
std::string string_identifier;
do {
fin >> string_identifier; // "----" indicates end of this submap
t = 0;
if (string_identifier == "I") {
fin >> itx >> ity;
getline(fin, databuff); // Clear out the endline
getline(fin, databuff);
it_tmp.load_info(databuff, master_game);
sm->itm[itx][ity].push_back(it_tmp);
if (it_tmp.active)
sm->active_item_count++;
} else if (string_identifier == "C") {
getline(fin, databuff); // Clear out the endline
getline(fin, databuff);
int index = sm->itm[itx][ity].size() - 1;
it_tmp.load_info(databuff, master_game);
sm->itm[itx][ity][index].put_in(it_tmp);
if (it_tmp.active)
sm->active_item_count++;
} else if (string_identifier == "T") {
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++;
} else if (string_identifier == "S") {
char tmpfriend;
int tmpfac = -1, tmpmis = -1;
std::string spawnname;
fin >> t >> a >> itx >> ity >> tmpfac >> tmpmis >> tmpfriend >> spawnname;
spawn_point tmp(mon_id(t), a, itx, ity, tmpfac, tmpmis, (tmpfriend == '1'),
spawnname);
sm->spawns.push_back(tmp);
} else if (string_identifier == "V") {
vehicle * veh = new vehicle(master_game);
veh->load (fin);
//veh.smx = gridx;
//veh.smy = gridy;
master_game->m.vehicle_list.insert(veh);
sm->vehicles.push_back(veh);
} else if (string_identifier == "c") {
getline(fin, databuff);
sm->comp.load_data(databuff);
} else if (string_identifier == "G") {
std::string s;
int j;
int i;
fin >> j >> i;
getline(fin,s);
sm->graf[j][i] = graffiti(s);
}
} while (string_identifier != "----" && !fin.eof());
submap_list.push_back(sm);
submaps[ tripoint(locx, locy, locz) ] = sm;
num_loaded++;
}
fin.close();
}
int mapbuffer::size()
{
return submap_list.size();
}
+51
View File
@@ -0,0 +1,51 @@
#include "map.h"
#include "line.h"
#include <map>
#include <list>
class game;
struct pointcomp
{
bool operator() (const tripoint &lhs, const tripoint &rhs) const
{
if (lhs.x < rhs.x) return true;
if (lhs.x > rhs.x) return false;
if (lhs.y < rhs.y) return true;
if (lhs.y > rhs.y) return false;
if (lhs.z < rhs.z) return true;
if (lhs.z > rhs.z) return false;
return false;
};
};
class mapbuffer
{
public:
mapbuffer();
~mapbuffer();
void set_game(game *g);
//help save_if_dirty() know to save as many times as it's supposed to.
void set_dirty();
void make_volatile();
void load();
void save();
void save_if_dirty();
void reset();
bool add_submap(int x, int y, int z, submap *sm);
submap* lookup_submap(int x, int y, int z);
int size();
private:
std::map<tripoint, submap*, pointcomp> submaps;
std::list<submap*> submap_list;
game *master_game;
bool dirty;
};
extern mapbuffer MAPBUFFER;
+47
View File
@@ -0,0 +1,47 @@
#include "mapdata.h"
#include <ostream>
std::ostream & operator<<(std::ostream & out, const submap * sm)
{
out << "submap(";
if( !sm )
{
out << "NULL)";
return out;
}
out << "\n\tter:";
for(int x = 0; x < SEEX; ++x)
{
out << "\n\t" << x << ": ";
for(int y = 0; y < SEEY; ++y)
out << sm->ter[x][y] << ", ";
}
out << "\n\titm:";
for(int x = 0; x < SEEX; ++x)
{
for(int y = 0; y < SEEY; ++y)
{
if( !sm->itm[x][y].empty() )
{
for( std::vector<item>::const_iterator it = sm->itm[x][y].begin(),
end = sm->itm[x][y].end(); it != end; ++it )
{
out << "\n\t("<<x<<","<<y<<") ";
out << *it << ", ";
}
}
}
}
out << "\n\t)";
return out;
}
std::ostream & operator<<(std::ostream & out, const submap & sm)
{
out << (&sm);
return out;
}
+649 -186
View File
@@ -8,42 +8,57 @@
#include "trap.h"
#include "monster.h"
#include "enums.h"
#include "computer.h"
#include "vehicle.h"
#include "graffiti.h"
#include <iosfwd>
class game;
class monster;
#ifndef SEEX // SEEX is how far the player can see in the X direction (at
// least, without scrolling). All map segments will need to be at least
// this wide. The map therefore needs to be 3 times as wide.
#define SEEX 12
#endif
#define SEEX 12 // least, without scrolling). All map segments will need to be
#endif // at least this wide. The map therefore needs to be 3x as wide.
#ifndef SEEY // Same as SEEX
#define SEEY 12 // Requires 2*SEEY+1= 25 vertical squares
// Nuts to 80x24 terms. Mostly exists in graphical clients, and
#endif // Nuts to 80x24 terms. Mostly exists in graphical clients, and
// those fatcats can resize.
#endif
// mfb(t_flag) converts a flag to a bit for insertion into a bitfield
#ifndef mfb
#define mfb(n) int(pow(2,(int)n))
#define mfb(n) long(1 << (n))
#endif
enum t_flag {
transparent, // Player & monsters can see through/past it
bashable, // Player & monsters can bash this & make it the next in the list
container,// Items on this square are hidden until looted by the player
flammable,// May be lit on fire
explodes, // Explodes when on fire
diggable, // Digging monsters, seeding monsters, digging w/ shovel, etc.
swimmable,// You (and monsters) swim here
sharp, // May do minor damage to players/monsters passing it
rough, // May hurt the player's feet
sealed, // Can't 'e' to retrieve items here
noitem, // Items "fall off" this space
goes_down,// Can '>' to go down a level
goes_up, // Can '<' to go up a level
computer, // Used as a computer
num_t_flags // MUST be last
transparent = 0,// Player & monsters can see through/past it
bashable, // Player & monsters can bash this & make it the next in the list
container, // Items on this square are hidden until looted by the player
place_item, // Valid terrain for place_item() to put items on
door, // Can be opened--used for NPC pathfinding.
flammable, // May be lit on fire
l_flammable, // Harder to light on fire, but still possible
explodes, // Explodes when on fire
diggable, // Digging monsters, seeding monsters, digging w/ shovel, etc.
tentable, // I'm lazy, this is just diggable with a few more tacked on.
liquid, // Blocks movement but isn't a wall, e.g. lava or water
swimmable, // You (and monsters) swim here
sharp, // May do minor damage to players/monsters passing it
painful, // May cause a small amount of pain
rough, // May hurt the player's feet
sealed, // Can't 'e' to retrieve items here
noitem, // Items "fall off" this space
goes_down, // Can '>' to go down a level
goes_up, // Can '<' to go up a level
console, // Used as a computer
alarmed, // Sets off an alarm if smashed
supports_roof,// Used as a boundary for roof construction
// can also knock down adjacent supports_roof and collapses tiles when destroyed
thin_obstacle,// passable by player and monsters, but not by vehicles
collapses, // Tiles that have a roof over them (which can collapse)
flammable2, // Burn to ash rather than rubble.
deconstruct, // Can be deconstructed
num_t_flags // MUST be last
};
struct ter_t {
@@ -51,206 +66,584 @@ struct ter_t {
char sym;
nc_color color;
unsigned char movecost;
unsigned flags : num_t_flags;
trap_id trap;
unsigned long flags;// : num_t_flags;
};
enum ter_id {
t_null = 0,
t_hole, // Real nothingness; makes you fall a z-level
// Ground
t_dirt, t_dirtmound, t_pit,
t_rock_floor, t_rubble,
t_dirt, t_sand, t_dirtmound, t_pit_shallow, t_pit,
t_pit_corpsed, t_pit_covered, t_pit_spiked, t_pit_spiked_covered,
t_rock_floor, t_rubble, t_ash, t_metal, t_wreckage,
t_grass,
t_metal_floor,
t_pavement, t_pavement_y, t_sidewalk,
t_floor,
t_dirtfloor,//Dirt floor(Has roof)
t_hay,
t_grate,
t_slime,
// Walls & doors
t_wall_v, t_wall_h,
t_bridge,
// Tent Walls & doors
t_canvas_wall, t_canvas_door, t_canvas_door_o, t_groundsheet, t_fema_groundsheet,
// Lighting related
t_skylight, t_emergency_light_flicker, t_emergency_light,
// Walls
t_wall_log_half, t_wall_log, t_wall_log_chipped, t_wall_log_broken, t_palisade, t_palisade_gate, t_palisade_gate_o,
t_wall_half, t_wall_wood, t_wall_wood_chipped, t_wall_wood_broken,
t_wall_v, t_wall_h, t_concrete_v, t_concrete_h,
t_wall_metal_v, t_wall_metal_h,
t_wall_glass_v, t_wall_glass_h,
t_wall_glass_v_alarm, t_wall_glass_h_alarm,
t_reinforced_glass_v, t_reinforced_glass_h,
t_bars,
t_door_c, t_door_b, t_door_o, t_door_locked, t_door_frame, t_door_boarded,
t_door_c, t_door_b, t_door_o, t_door_locked, t_door_locked_alarm, t_door_frame,
t_chaingate_l, t_fencegate_c, t_fencegate_o, t_chaingate_c, t_chaingate_o, t_door_boarded,
t_door_metal_c, t_door_metal_o, t_door_metal_locked,
t_door_glass_c, t_door_glass_o,
t_bulletin,
t_portcullis,
t_window, t_window_frame, t_window_boarded,
t_rock,
t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, t_curtains,
t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded,
t_rock, t_fault,
t_paper,
// Tree
t_tree, t_tree_young, t_underbrush,
t_tree, t_tree_young, t_tree_apple, t_underbrush, t_shrub, t_shrub_blueberry, t_log,
t_root_wall,
t_wax, t_floor_wax,
t_fence_v, t_fence_h,
t_fence_v, t_fence_h, t_chainfence_v, t_chainfence_h, t_chainfence_posts,
t_fence_post, t_fence_wire, t_fence_barbed, t_fence_rope,
t_railing_v, t_railing_h,
// Nether
t_marloss, t_fungus, t_tree_fungal,
// Water, lava, etc.
t_water_sh, t_water_dp, t_sewage,
t_lava,
// Embellishments
t_bed, t_toilet,
t_gas_pump, t_gas_pump_smashed,
t_bed, t_toilet, t_makeshift_bed,
// More embellishments than you can shake a stick at.
t_sink, t_oven, t_woodstove, t_bathtub, t_chair, t_armchair, t_sofa, t_cupboard, t_trashcan, t_desk,
t_sandbox, t_slide, t_monkey_bars, t_backboard,
t_bench, t_table, t_pool_table,
t_gas_pump, t_gas_pump_smashed, t_gas_pump_empty,
t_missile, t_missile_exploded,
t_counter,
t_radio_tower, t_radio_controls,
t_computer_broken, t_computer_nether, t_computer_lab,
t_console_broken, t_console, t_gates_mech_control, t_barndoor,
t_sewage_pipe, t_sewage_pump,
t_centrifuge,
t_column,
// Containers
t_fridge, t_dresser,
t_fridge, t_glass_fridge, t_dresser, t_locker,
t_rack, t_bookcase,
t_dumpster,
t_vat,
t_vat, t_crate_c, t_crate_o,
// Staircases etc.
t_stairs_down, t_stairs_up, t_manhole, t_ladder, t_slope_down, t_slope_up,
t_stairs_down, t_stairs_up, t_manhole, t_ladder_up, t_ladder_down, t_slope_down,
t_slope_up, t_rope_up,
t_manhole_cover,
// Special
t_card_reader, t_card_reader_broken, t_manhole_cover, t_slot_machine,
t_card_science, t_card_military, t_card_reader_broken, t_slot_machine,
t_elevator_control, t_elevator_control_off, t_elevator, t_pedestal_wyrm,
t_pedestal_temple,
// Temple tiles
t_rock_red, t_rock_green, t_rock_blue, t_floor_red, t_floor_green, t_floor_blue,
t_switch_rg, t_switch_gb, t_switch_rb, t_switch_even,
// found at fields
t_mutpoppy, //mutated poppy flower
num_terrain_types
};
const ter_t terlist[num_terrain_types] = { // MUST match enum ter_id above!
{"nothing", ' ', c_white, 2,
{"nothing", ' ', c_white, 2, tr_null,
mfb(transparent)|mfb(diggable)},
{"empty space", '#', c_black, 2, tr_ledge,
mfb(transparent)},
{"dirt", '.', c_brown, 2,
{"dirt", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
{"sand", '.', c_yellow, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
{"mound of dirt", '#', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)},
{"mound of dirt", '#', c_brown, 3,
{"shallow pit", '0', c_yellow, 8, tr_null,
mfb(transparent)|mfb(diggable)},
{"shallow pit", '0', c_brown, 14,
{"pit", '0', c_brown, 10, tr_pit,
mfb(transparent)|mfb(diggable)},
{"rock floor", '.', c_ltgray, 2,
{"corpse filled pit",'#', c_green, 5, tr_null,
mfb(transparent)|mfb(diggable)},
{"covered pit", '#', c_ltred, 2, tr_null,
mfb(transparent)},
{"pile of rubble", '#', c_ltgray, 4,
{"spiked pit", '0', c_ltred, 10, tr_spike_pit,
mfb(transparent)|mfb(diggable)},
{"covered spiked pit",'#',c_ltred, 2, tr_null,
mfb(transparent)},
{"rock floor", '.', c_ltgray, 2, tr_null,
mfb(transparent)},
{"pile of rubble", '^', c_ltgray, 4, tr_null,
mfb(transparent)|mfb(rough)|mfb(diggable)},
{"grass", '.', c_green, 2,
{"pile of ash", '#', c_ltgray, 2, tr_null,
mfb(transparent)|mfb(diggable)},
{"pavement", '.', c_dkgray, 2,
{"twisted metal", '#', c_cyan, 5, tr_null,
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item)},
{"metal wreckage", '#', c_cyan, 5, tr_null,
mfb(transparent)|mfb(rough)|mfb(sharp)|mfb(place_item)},
{"grass", '.', c_green, 2, tr_null,
mfb(transparent)|mfb(diggable)|mfb(tentable)},
{"metal floor", '.', c_ltcyan, 2, tr_null,
mfb(transparent)},
{"yellow pavement", '.', c_yellow, 2,
{"pavement", '.', c_dkgray, 2, tr_null,
mfb(transparent)},
{"sidewalk", '.', c_ltgray, 2,
{"yellow pavement", '.', c_yellow, 2, tr_null,
mfb(transparent)},
{"floor", '.', c_cyan, 2,
{"sidewalk", '.', c_ltgray, 2, tr_null,
mfb(transparent)},
{"metal grate", '#', c_dkgray, 2,
{"floor", '.', c_cyan, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)},
{"dirt floor", '.', c_brown, 2, tr_null, //Dirt Floor, must have roofs!
mfb(transparent)|mfb(diggable)|mfb(supports_roof)|mfb(collapses)},
{"hay", '#', i_brown, 5, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(collapses)},
{"metal grate", '#', c_dkgray, 2, tr_null,
mfb(transparent)},
{"slime", '~', c_green, 6,
mfb(transparent)|mfb(container)|mfb(flammable)},
{"wall", '|', c_ltgray, 0,
mfb(flammable)},
{"wall", '-', c_ltgray, 0,
mfb(flammable)},
{"glass wall", '|', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)},
{"glass wall", '-', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)},
{"reinforced glass", '|', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)},
{"reinforced glass", '-', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)},
{"metal bars", '"', c_ltgray, 0,
{"slime", '~', c_green, 6, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(place_item)},
{"walkway", '#', c_yellow, 2, tr_null,
mfb(transparent)},
{"closed wood door", '+', c_brown, 0,
mfb(bashable)|mfb(flammable)},
{"damaged wood door",'&', c_brown, 0,
mfb(transparent)|mfb(bashable)|mfb(flammable)},
{"open wood door", '\'', c_brown, 2,
mfb(transparent)},
{"closed wood door", '+', c_brown, 0, // Actually locked
mfb(bashable)|mfb(flammable)},
{"empty door frame", '.', c_brown, 2,
mfb(transparent)},
{"boarded up door", '#', c_brown, 0,
mfb(bashable)|mfb(flammable)},
{"closed metal door",'+', c_cyan, 0,
0},
{"open metal door", '\'', c_cyan, 2,
mfb(transparent)},
{"closed metal door",'+', c_cyan, 0, // Actually locked
0},
{"bulletin board", '6', c_blue, 0,
0},
{"makeshift portcullis", '&', c_cyan, 0,
0},
{"window", '"', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)|mfb(flammable)},
{"window frame", '0', c_ltcyan, 12,
mfb(container)|mfb(transparent)|mfb(sharp)|mfb(flammable)|mfb(noitem)},
{"boarded up window",'#', c_brown, 0,
mfb(bashable)|mfb(flammable)},
{"solid rock", '#', c_white, 0,
0},
{"tree", '7', c_green, 0,
mfb(flammable)},
{"young tree", '1', c_green, 0,
mfb(transparent)|mfb(bashable)|mfb(flammable)},
{"underbrush", '#', c_green, 7,
mfb(transparent)|mfb(bashable)|mfb(diggable)|mfb(container)|mfb(rough)|
mfb(flammable)},
{"wax wall", '#', c_yellow, 0,
mfb(container)|mfb(flammable)},
{"wax floor", '.', c_yellow, 2,
mfb(transparent)},
{"picket fence", '|', c_brown, 3,
mfb(transparent)|mfb(diggable)|mfb(flammable)|mfb(noitem)},
{"picket fence", '-', c_brown, 3,
mfb(transparent)|mfb(diggable)|mfb(flammable)|mfb(noitem)},
{"railing", '|', c_yellow, 3,
{"canvas wall", '#', c_blue, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
{"canvas flap", '+', c_blue, 0, tr_null,
mfb(l_flammable)|mfb(bashable)|mfb(noitem)|mfb(tentable)},
{"open canvas flap", '.', c_blue, 2, tr_null,
mfb(transparent)},
{"groundsheet", ';', c_green, 2, tr_null,
mfb(transparent)|mfb(tentable)},
{"groundsheet", ';', c_green, 2, tr_null,
mfb(transparent)},
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Skylight
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Emergency Light
{"floor", '.', c_white, 2, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(supports_roof)|mfb(collapses)}, // Regular Light
{"half-built wall", '#', c_brown, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
{"log wall", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"chipped log wall",'#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"broken log wall", '&', c_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)|
mfb(supports_roof)},
{"palisade wall", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(transparent)},
{"palisade gate", '+', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(door)|mfb(transparent)},
{"open palisade gate", '#', c_ltred, 2, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)|mfb(transparent)},
{"half-built wall", '#', c_ltred, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
{"wooden wall", '#', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"chipped wood wall",'#', c_ltred, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"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(transparent)|mfb(bashable)|mfb(alarmed)|mfb(noitem)|
mfb(supports_roof)},
{"glass wall", '-', 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)},
{"metal bars", '"', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(noitem)},
{"railing", '-', c_yellow, 3,
{"closed wood door", '+', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(door)|mfb(noitem)|mfb(supports_roof)},
{"damaged wood door",'&', c_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)|
mfb(supports_roof)},
{"open wood door", '\'', c_brown, 2, tr_null,
mfb(flammable2)|mfb(transparent)|mfb(supports_roof)},
{"closed wood door", '+', c_brown, 0, tr_null, // Actually locked
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
{"closed wood door", '+', c_brown, 0, tr_null, // Locked and alarmed
mfb(bashable)|mfb(flammable2)|mfb(alarmed)|mfb(noitem)|mfb(supports_roof)},
{"empty door frame", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"locked wire gate", '+', c_cyan, 0, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"closed wooden gate", '+', c_brown, 3, tr_null,
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2)},
{"open wooden gate", '.', c_brown, 2, tr_null,
mfb(transparent)|mfb(supports_roof) |mfb(bashable)|mfb(flammable2)},
{"closed wire gate", '+', c_cyan, 0, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"open wire gate", '.', c_cyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"boarded up door", '#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
{"closed metal door",'+', c_cyan, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"open metal door", '\'', c_cyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"closed metal door",'+', c_cyan, 0, tr_null, // Actually locked
mfb(noitem)|mfb(supports_roof)},
{"closed glass door",'+', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(door)|mfb(noitem)|mfb(supports_roof)},
{"open glass door", '\'', c_ltcyan, 2, tr_null,
mfb(transparent)|mfb(supports_roof)},
{"bulletin board", '6', c_blue, 0, tr_null,
mfb(flammable)|mfb(noitem)},
{"makeshift portcullis", '&', c_cyan, 0, tr_null,
mfb(noitem)},
{"steel compactor", '&', c_green, 0, tr_null,
mfb(transparent)},
{"window", '"', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)|mfb(deconstruct)}, // Plain Ol' window
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)}, // Regular window
{"window", '"', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)|mfb(deconstruct)}, //has curtains
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)}, // Curtain window
{"open window", '\'', c_ltcyan, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)},
{"closed curtains", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)},
{"window", '"', c_ltcyan, 0, tr_null, // Actually alarmed
mfb(transparent)|mfb(bashable)|mfb(flammable)|mfb(alarmed)|mfb(noitem)|
mfb(supports_roof)},
{"taped window", '"', c_dkgray, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)| mfb(supports_roof)|mfb(alarmed)}, //Alarmed, duh.
{"empty window", '0', c_yellow, 8, tr_null,
mfb(transparent)|mfb(flammable)|mfb(supports_roof)},
{"window frame", '0', c_ltcyan, 8, tr_null,
mfb(transparent)|mfb(sharp)|mfb(flammable)|mfb(noitem)|
mfb(supports_roof)},
{"boarded up window",'#', c_brown, 0, tr_null,
mfb(bashable)|mfb(flammable)|mfb(noitem)|mfb(supports_roof)},
{"solid rock", '#', c_white, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"odd fault", '#', c_magenta, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"paper wall", '#', c_white, 0, tr_null,
mfb(bashable)|mfb(flammable2)|mfb(noitem)},
{"tree", '7', c_green, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
{"young tree", '1', c_green, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(noitem)},
{"apple tree", '7', c_ltgreen, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)},
{"underbrush", '#', c_ltgreen, 6, tr_null,
mfb(transparent)|mfb(bashable)|mfb(diggable)|mfb(container)|
mfb(flammable2)|mfb(thin_obstacle)|mfb(place_item)},
{"shrub", '#', c_green, 8, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable2)|
mfb(thin_obstacle)|mfb(place_item)},
{"blueberry bush", '#', c_ltgreen, 8, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable2)|mfb(thin_obstacle)},
{"tree trunk", '1', c_brown, 4, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(diggable)},
{"root wall", '#', c_brown, 0, tr_null,
mfb(noitem)|mfb(supports_roof)},
{"wax wall", '#', c_yellow, 0, tr_null,
mfb(flammable2)|mfb(noitem)|mfb(supports_roof)|mfb(place_item)},
{"wax floor", '.', c_yellow, 2, tr_null,
mfb(transparent)|mfb(l_flammable)},
{"picket fence", '|', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle)},
{"picket fence", '-', c_brown, 3, tr_null,
mfb(transparent)|mfb(diggable)|mfb(flammable2)|mfb(noitem)|mfb(thin_obstacle)},
{"chain link fence", '|', c_cyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle)},
{"chain link fence", '-', c_cyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)|mfb(thin_obstacle)},
{"metal post", '#', c_cyan, 2, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
{"fence post", '#', c_brown, 2, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
{"wire fence", '$', c_blue, 4, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
{"barbed wire fence",'$', c_blue, 4, tr_null,
mfb(transparent)|mfb(sharp)|mfb(thin_obstacle)},
{"rope fence", '$', c_brown, 3, tr_null,
mfb(transparent)|mfb(thin_obstacle)},
{"railing", '|', c_yellow, 3, tr_null,
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle)},
{"railing", '-', c_yellow, 3, tr_null,
mfb(transparent)|mfb(noitem)|mfb(thin_obstacle)},
{"marloss bush", '1', c_dkgray, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)},
{"fungal bed", '#', c_dkgray, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(diggable)},
{"fungal tree", '7', c_dkgray, 0, tr_null,
mfb(flammable2)|mfb(noitem)},
{"shallow water", '~', c_ltblue, 5, tr_null,
mfb(transparent)|mfb(liquid)|mfb(swimmable)},
{"deep water", '~', c_blue, 0, tr_null,
mfb(transparent)|mfb(liquid)|mfb(swimmable)},
{"sewage", '~', c_ltgreen, 6, tr_null,
mfb(transparent)|mfb(swimmable)},
{"lava", '~', c_red, 4, tr_lava,
mfb(transparent)|mfb(liquid)},
{"bed", '#', c_magenta, 5, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable2)|mfb(collapses)|
mfb(deconstruct)|mfb(place_item)},
{"toilet", '&', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)},
{"makeshift bed", '#', c_magenta, 5, tr_null,
mfb(transparent)|mfb(bashable)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
{"sink", '&', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
{"oven", '#', c_dkgray, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
{"wood stove", '#', i_red, 4, tr_null,
mfb(transparent)|mfb(container)|mfb(place_item)},
{"bathtub", '~', c_white, 4, tr_null,
mfb(transparent)|mfb(bashable)|mfb(l_flammable)|mfb(collapses)|mfb(container)|mfb(place_item)},
{"chair", '#', c_brown, 2, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
{"arm chair", 'H', c_green, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
{"sofa", 'H', i_red, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
{"cupboard", '#', c_blue, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)|
mfb(container)|mfb(place_item)},
{"trash can", '&', c_ltcyan, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(container)|mfb(place_item)},
{"desk", '#', c_ltred, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)|
mfb(container)|mfb(place_item)},
{"sandbox", '#', c_yellow, 3, tr_null,
mfb(transparent)|mfb(deconstruct)},
{"slide", '#', c_ltcyan, 4, tr_null,
mfb(transparent)|mfb(deconstruct)},
{"monkey bars", '#', c_cyan, 4, tr_null,
mfb(transparent)|mfb(deconstruct)},
{"backboard", '7', c_red, 0, tr_null,
mfb(transparent)|mfb(deconstruct)},
{"bench", '#', c_brown, 3, tr_null,
mfb(transparent)|mfb(flammable2)|mfb(collapses)|mfb(deconstruct)},
{"table", '#', c_red, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
{"pool table", '#', c_green, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
{"gasoline pump", '&', c_red, 0, tr_null,
mfb(transparent)|mfb(explodes)|mfb(noitem)},
{"smashed gas pump", '&', c_ltred, 0, tr_null,
mfb(transparent)|mfb(noitem)},
{"shallow water", '~', c_ltblue, 5,
mfb(transparent)|mfb(swimmable)},
{"deep water", '~', c_blue, 0,
mfb(transparent)|mfb(swimmable)},
{"sewage", '~', c_ltgreen, 6,
mfb(transparent)|mfb(swimmable)},
{"lava", '~', c_red, 0,
{"out-of-order gasoline pump", '&', c_red, 0, tr_null,
mfb(transparent)|mfb(noitem)},
{"missile", '#', c_ltblue, 0, tr_null,
mfb(explodes)|mfb(noitem)},
{"blown-out missile",'#', c_ltgray, 0, tr_null,
mfb(noitem)},
{"counter", '#', c_blue, 4, tr_null,
mfb(transparent)|mfb(flammable)|mfb(collapses)|mfb(deconstruct)},
{"radio tower", '&', c_ltgray, 0, tr_null,
mfb(noitem)},
{"radio controls", '6', c_green, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(noitem)},
{"broken console", '6', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
{"computer console", '6', c_blue, 0, tr_null,
mfb(transparent)|mfb(console)|mfb(noitem)|mfb(collapses)},
{"mechanical winch", '6', c_cyan_red, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
{"rope and pulley", '|', i_brown, 0, tr_null,
mfb(transparent)|mfb(noitem)|mfb(collapses)},
{"sewage pipe", '1', c_ltgray, 0, tr_null,
mfb(transparent)},
{"bed", '#', c_magenta, 5,
mfb(transparent)|mfb(container)|mfb(flammable)},
{"toilet", '&', c_white, 0,
mfb(transparent)|mfb(bashable)},
{"gasoline pump", '&', c_red, 0,
mfb(transparent)|mfb(explodes)},
{"smashed gas pump", '&', c_ltred, 0,
{"sewage pump", '&', c_ltgray, 0, tr_null,
mfb(noitem)},
{"centrifuge", '{', c_magenta, 0, tr_null,
mfb(transparent)},
{"counter", '#', c_blue, 4,
mfb(transparent)},
{"radio tower", '&', c_ltgray, 0,
0},
{"radio controls", '6', c_green, 0,
mfb(transparent)|mfb(bashable)},
{"broken computer", '6', c_ltgray, 0,
mfb(transparent)|mfb(computer)},
{"computer console", '6', c_blue, 0,
mfb(transparent)|mfb(computer)},
{"computer console", '6', c_blue, 0,
mfb(transparent)|mfb(computer)},
{"refrigerator", '{', c_ltcyan, 0,
mfb(container)},
{"dresser", '{', c_brown, 0,
mfb(transparent)|mfb(container)|mfb(flammable)},
{"display rack", '{', c_ltgray, 0,
mfb(transparent)|mfb(container)},
{"book case", '{', c_brown, 0,
mfb(container)|mfb(flammable)},
{"dumpster", '{', c_green, 0,
mfb(container)},
{"cloning vat", '0', c_ltcyan, 0,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(sealed)},
{"stairs down", '>', c_yellow, 2,
mfb(transparent)|mfb(goes_down)},
{"stairs up", '<', c_yellow, 2,
{"column", '1', c_ltgray, 0, tr_null,
mfb(flammable)},
{"refrigerator", '{', c_ltcyan, 0, tr_null,
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item)},
{"glass door fridge",'{', c_ltcyan, 0, tr_null,
mfb(collapses)|mfb(bashable)|mfb(place_item)},
{"dresser", '{', c_brown, 0, tr_null,
mfb(transparent)|mfb(container)|mfb(flammable)|mfb(collapses)|
mfb(bashable)|mfb(deconstruct)|mfb(place_item)},
{"locker", '{', c_ltgray, 0, tr_null,
mfb(container)|mfb(collapses)|mfb(bashable)|mfb(place_item)},
{"display rack", '{', c_ltgray, 0, tr_null,
mfb(transparent)|mfb(l_flammable)|mfb(collapses)|mfb(bashable)|
mfb(deconstruct)|mfb(place_item)},
{"book case", '{', c_brown, 0, tr_null,
mfb(flammable)|mfb(collapses)|mfb(bashable)|mfb(deconstruct)|mfb(place_item)},
{"dumpster", '{', c_green, 0, tr_null,
mfb(container)|mfb(bashable)|mfb(place_item)},
{"cloning vat", '0', c_ltcyan, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(sealed)|mfb(place_item)},
{"crate", 'X', i_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(sealed)|
mfb(flammable)|mfb(deconstruct)|mfb(place_item)},
{"open crate", 'O', i_brown, 0, tr_null,
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(flammable)|mfb(place_item)},
{"stairs down", '>', c_yellow, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
{"stairs up", '<', c_yellow, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
{"manhole", '>', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
{"ladder", '<', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
{"ladder", '>', c_dkgray, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
{"downward slope", '>', c_brown, 2, tr_null,
mfb(transparent)|mfb(goes_down)|mfb(place_item)},
{"upward slope", '<', c_brown, 2, tr_null,
mfb(transparent)|mfb(goes_up)|mfb(place_item)},
{"rope leading up", '<', c_white, 2, tr_null,
mfb(transparent)|mfb(goes_up)},
{"manhole", '>', c_dkgray, 2,
mfb(transparent)|mfb(goes_down)},
{"ladder", '<', c_dkgray, 2,
mfb(transparent)|mfb(goes_up)},
{"downward slope", '>', c_brown, 2,
mfb(transparent)|mfb(goes_down)},
{"upward slope", '<', c_brown, 2,
mfb(transparent)|mfb(goes_up)},
{"card reader", '6', c_pink, 0,
0},
{"broken card reader",'6', c_ltgray, 0,
0},
{"manhole cover", '0', c_dkgray, 2,
{"manhole cover", '0', c_dkgray, 2, tr_null,
mfb(transparent)},
{"slot machine", '6', c_green, 0,
mfb(bashable)}
{"card reader", '6', c_pink, 0, tr_null, // Science
mfb(noitem)},
{"card reader", '6', c_pink, 0, tr_null, // Military
mfb(noitem)},
{"broken card reader",'6',c_ltgray, 0, tr_null,
mfb(noitem)},
{"slot machine", '6', c_green, 0, tr_null,
mfb(bashable)|mfb(noitem)},
{"elevator controls",'6', c_ltblue, 0, tr_null,
mfb(noitem)},
{"powerless controls",'6',c_ltgray, 0, tr_null,
mfb(noitem)},
{"elevator", '.', c_magenta, 2, tr_null,
0},
{"dark pedestal", '&', c_dkgray, 0, tr_null,
mfb(transparent)},
{"light pedestal", '&', c_white, 0, tr_null,
mfb(transparent)},
{"red stone", '#', c_red, 0, tr_null,
0},
{"green stone", '#', c_green, 0, tr_null,
0},
{"blue stone", '#', c_blue, 0, tr_null,
0},
{"red floor", '.', c_red, 2, tr_null,
mfb(transparent)},
{"green floor", '.', c_green, 2, tr_null,
mfb(transparent)},
{"blue floor", '.', c_blue, 2, tr_null,
mfb(transparent)},
{"yellow switch", '6', c_yellow, 0, tr_null,
mfb(transparent)},
{"cyan switch", '6', c_cyan, 0, tr_null,
mfb(transparent)},
{"purple switch", '6', c_magenta, 0, tr_null,
mfb(transparent)},
{"checkered switch", '6', c_white, 0, tr_null,
mfb(transparent)},
{"mutated poppy flower", 'f', c_red, 3, tr_null,
mfb(transparent)}
};
enum map_extra {
mx_null = 0,
mx_helicopter,
mx_military,
mx_science,
mx_stash,
mx_drugdeal,
mx_supplydrop,
mx_portal,
mx_minefield,
mx_wolfpack,
mx_cougar,
mx_puddle,
mx_crater,
mx_fumarole,
mx_portal_in,
mx_anomaly,
num_map_extras
};
// 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] = {
0, // Null - 0 chance
40, // Helicopter
50, // Military
120, // Science
200, // Stash
20, // Drug deal
10, // Supply drop
5, // Portal
70, // Minefield
30, // Wolf pack
40, // Cougar
250, // Puddle
10, // Crater
8, // Fumarole
7, // One-way portal into this world
10, // Anomaly
0 // Just a cap value; leave this as the last one
};
struct map_extras {
unsigned int chance;
int chances[num_map_extras + 1];
map_extras(unsigned int embellished, int helicopter = 0, int mili = 0,
int sci = 0, int stash = 0, int drug = 0, int supply = 0,
int portal = 0, int minefield = 0, int wolves = 0, int cougar = 0, int puddle = 0,
int crater = 0, int lava = 0, int marloss = 0, int anomaly = 0)
: chance(embellished)
{
chances[ 0] = 0;
chances[ 1] = helicopter;
chances[ 2] = mili;
chances[ 3] = sci;
chances[ 4] = stash;
chances[ 5] = drug;
chances[ 6] = supply;
chances[ 7] = portal;
chances[ 8] = minefield;
chances[ 9] = wolves;
chances[10] = cougar;
chances[11] = puddle;
chances[12] = crater;
chances[13] = lava;
chances[14] = marloss;
chances[15] = anomaly;
chances[16] = 0;
}
};
struct field_t {
@@ -266,37 +659,86 @@ enum field_id {
fd_null = 0,
fd_blood,
fd_bile,
fd_web,
fd_slime,
fd_acid,
fd_sap,
fd_fire,
fd_smoke,
fd_toxic_gas,
fd_tear_gas,
fd_nuke_gas,
fd_gas_vent,
fd_fire_vent,
fd_flame_burst,
fd_electricity,
fd_fatigue,
fd_push_items,
fd_shock_vent,
fd_acid_vent,
num_fields
};
const field_t fieldlist[] = {
{{"", "", "",}, '%',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"", "", ""}, '%',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"blood splatter", "blood stain", "puddle of blood"}, '%',
{c_red, c_red, c_red}, {true, true, true}, {false, false, false},2500},
{{"bile splatter", "bile stain", "puddle of bile"}, '%',
{c_pink, c_pink, c_pink}, {true, true, true}, {false, false, false},2500},
{{"cobwebs","webs", "thick webs"}, '}',
{c_white, c_white, c_white}, {true, true, false},{false, false, false}, 0},
{{"slime trail", "slime stain", "puddle of slime"}, '%',
{c_ltgreen, c_ltgreen, c_green},{true, true, true},{false, false, false},2500},
{{"acid splatter", "acid streak", "pool of acid"}, '5',
{c_ltgreen, c_green, c_green}, {true, true, true}, {true, true, true}, 10},
{c_ltgreen, c_green, c_green}, {true, true, true}, {true, true, true}, 10},
{{"sap splatter", "glob of sap", "pool of sap"}, '5',
{c_yellow, c_brown, c_brown}, {true, true, true}, {true, true, true}, 20},
{{"small fire", "fire", "raging fire"}, '4',
{c_yellow, c_ltred, c_red}, {true, true, true}, {true, true, true}, 2000},
{c_yellow, c_ltred, c_red}, {true, true, true}, {true, true, true}, 800},
{{"thin smoke", "smoke", "thick smoke"}, '8',
{c_white, c_ltgray, c_dkgray}, {true, false, false},{false, true, true}, 400},
{c_white, c_ltgray, c_dkgray}, {true, false, false},{false, true, true}, 300},
{{"hazy cloud","toxic gas","thick toxic gas"}, '8',
{c_white, c_ltgreen, c_green}, {true, false, false},{false, true, true}, 900},
{{"hazy cloud","tear gas","thick tear gas"}, '8',
{c_white, c_yellow, c_brown}, {true, false, false},{true, true, true}, 600},
{c_white, c_yellow, c_brown}, {true, false, false},{true, true, true}, 600},
{{"hazy cloud","radioactive gas", "thick radioactive gas"}, '8',
{c_white, c_ltgreen, c_green}, {true, true, false}, {true, true, true}, 1000},
{c_white, c_ltgreen, c_green}, {true, true, false}, {true, true, true}, 1000},
{{"gas vent", "gas vent", "gas vent"}, '%',
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"", "", ""}, '&', // fire vents
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"fire", "fire", "fire"}, '5',
{c_red, c_red, c_red}, {true, true, true}, {true, true, true}, 0},
{{"sparks", "electric crackle", "electric cloud"}, '9',
{c_white, c_cyan, c_blue}, {true, true, true}, {true, true, true}, 2}
{c_white, c_cyan, c_blue}, {true, true, true}, {true, true, true}, 2},
{{"odd ripple", "swirling air", "tear in reality"}, '*',
{c_ltgray, c_dkgray, c_magenta},{true, true, false},{false, false, false}, 0},
{{"", "", ""}, '&', // push items
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"", "", ""}, '&', // shock vents
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
{{"", "", ""}, '&', // acid vents
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0}
};
struct field {
@@ -309,26 +751,38 @@ struct field {
density = d;
age = a;
}
bool is_null() {
if (type == fd_null || type == fd_blood || type == fd_bile ||
type == fd_slime)
return true;
return false;
bool is_null()
{
return (type == fd_null || type == fd_blood || type == fd_bile ||
type == fd_slime);
}
bool is_dangerous() {
bool is_dangerous()
{
return fieldlist[type].dangerous[density - 1];
}
std::string name() {
std::string name()
{
return fieldlist[type].name[density - 1];
}
};
struct spawn_point {
int posx, posy;
int count;
mon_id type;
spawn_point(mon_id T = mon_null, int C = 0, int X = -1, int Y = -1) :
posx (X), posy (Y), count (C), type (T) {}
int faction_id;
int mission_id;
bool friendly;
std::string name;
spawn_point(mon_id T = mon_null, int C = 0, int X = -1, int Y = -1,
int FAC = -1, int MIS = -1, bool F = false,
std::string N = "NONE") :
posx (X), posy (Y), count (C), type (T), faction_id (FAC),
mission_id (MIS), friendly (F), name (N) {}
};
struct submap {
@@ -337,7 +791,16 @@ struct submap {
trap_id trp[SEEX][SEEY]; // Trap on each square
field fld[SEEX][SEEY]; // Field on each square
int rad[SEEX][SEEY]; // Irradiation of each square
graffiti graf[SEEX][SEEY]; // Graffiti on each square
int active_item_count;
int field_count;
int turn_last_touched;
std::vector<spawn_point> spawns;
std::vector<vehicle*> vehicles;
computer comp;
};
std::ostream & operator<<(std::ostream &, const submap *);
std::ostream & operator<<(std::ostream &, const submap &);
#endif
+6074 -983
View File
File diff suppressed because it is too large Load Diff
+25 -5
View File
@@ -4,36 +4,56 @@ enum items_location {
mi_none,
mi_field, mi_forest, mi_hive, mi_hive_center,
mi_road,
mi_livingroom, mi_kitchen, mi_fridge, mi_bedroom, mi_homeguns, mi_dresser,
mi_livingroom, mi_kitchen, mi_fridge, mi_home_hw, mi_bedroom, mi_homeguns,
mi_dresser, mi_dining,
mi_snacks, mi_fridgesnacks, mi_behindcounter, mi_magazines,
mi_softdrugs, mi_harddrugs,
mi_cannedfood, mi_pasta, mi_produce,
mi_cleaning,
mi_hardware, mi_tools, mi_bigtools, mi_mischw,
mi_consumer_electronics,
mi_sports, mi_camping, mi_allsporting,
mi_alcohol,
mi_pool_table,
mi_trash,
mi_ammo, mi_pistols, mi_shotguns, mi_rifles, mi_smg, mi_assault, mi_allguns,
mi_gunxtras,
mi_shoes, mi_pants, mi_shirts, mi_jackets, mi_winter, mi_bags, mi_allclothes,
mi_novels, mi_manuals, mi_textbooks,
mi_cop_weapons, mi_cop_evidence,
mi_hospital_lab, mi_hospital_samples, mi_surgery,
mi_office, mi_vault,
mi_art, mi_pawn, mi_mil_surplus,
mi_shelter, mi_mechanics,
mi_chemistry, mi_teleport, mi_goo, mi_cloning_vat, mi_dissection,
mi_hydro, mi_electronics, mi_monparts, mi_bionics,
mi_hydro, mi_electronics, mi_monparts, mi_bionics, mi_bionics_common,
mi_bots, mi_launchers, mi_mil_rifles, mi_grenades, mi_mil_armor, mi_mil_food,
mi_mil_food_nodrugs, mi_bionics_mil,
mi_weapons, mi_survival_armor, mi_survival_tools,
mi_sewage_plant,
mi_mine_storage, mi_mine_equipment,
mi_spiral,
mi_radio,
mi_toxic_dump_equipment,
mi_subway, mi_sewer,
mi_cavern,
mi_spider,
mi_ant_food, mi_ant_egg,
// Monster drops
mi_ants, mi_bees, mi_robots,
mi_biollante, mi_bugs, mi_bees, mi_wasps, mi_robots,
// Map Extras
mi_helicopter, mi_military, mi_science, mi_rare, mi_stash_food, mi_stash_ammo,
mi_stash_wood, mi_stash_drugs, mi_drugdealer, mi_wreckage,
// Shopkeeps &c
mi_npc_hacker,
mi_trader_avoid,
num_itloc
};
// This is used only for monsters; they get a list of items_locations, and
// a chance that each one will be used.
struct items_location_and_chance {
struct items_location_and_chance
{
items_location loc;
int chance;
items_location_and_chance (items_location l, int c) {
@@ -41,4 +61,4 @@ struct items_location_and_chance {
chance = c;
};
};
#endif
#endif
+640 -132
View File
File diff suppressed because it is too large Load Diff
+1593
View File
File diff suppressed because it is too large Load Diff
+241
View File
@@ -0,0 +1,241 @@
#include "mission.h"
#include "game.h"
mission mission_type::create(game *g, int npc_id)
{
mission ret;
ret.uid = g->assign_mission_id();
ret.type = this;
ret.npc_id = npc_id;
ret.item_id = item_id;
ret.value = value;
ret.follow_up = follow_up;
if (deadline_low != 0 || deadline_high != 0)
ret.deadline = int(g->turn) + rng(deadline_low, deadline_high);
else
ret.deadline = 0;
return ret;
}
std::string mission::name()
{
if (type == NULL)
return "NULL";
return type->name;
}
std::string mission::save_info()
{
std::stringstream ret;
if (type == NULL)
ret << -1;
else
ret << type->id;
ret << description << " <> " << (failed ? 1 : 0) << " " << value <<
" " << reward.type << " " << reward.value << " " << reward.item_id <<
" " << (reward.skill?reward.skill->id():0) << " " << uid << " " << target.x << " " <<
target.y << " " << item_id << " " << count << " " << deadline << " " <<
npc_id << " " << good_fac_id << " " << bad_fac_id << " " << step <<
" " << follow_up;
return ret.str();
}
void mission::load_info(game *g, std::ifstream &data)
{
int type_id, rewtype, reward_id, rew_item, rew_skill, itemid, tmpfollow;
data >> type_id;
type = &(g->mission_types[type_id]);
std::string tmpdesc;
do {
data >> tmpdesc;
if (tmpdesc != "<>")
description += tmpdesc + " ";
} while (tmpdesc != "<>");
description = description.substr( 0, description.size() - 1 ); // Ending ' '
data >> failed >> value >> rewtype >> reward_id >> rew_item >> rew_skill >>
uid >> target.x >> target.y >> itemid >> count >> deadline >> npc_id >>
good_fac_id >> bad_fac_id >> step >> tmpfollow;
follow_up = mission_id(tmpfollow);
reward.type = npc_favor_type(reward_id);
reward.item_id = itype_id( rew_item );
reward.skill = Skill::skill( rew_skill );
item_id = itype_id(itemid);
}
std::string mission_dialogue (mission_id id, talk_topic state)
{
switch (id) {
case MISSION_GET_ANTIBIOTICS:
switch (state) {
case TALK_MISSION_DESCRIBE:
switch (rng(1, 4)) {
case 1: return "Hey <name_g>... I really need your help...";
case 2: return "<swear!><punc> I'm hurting...";
case 3: return "This infection is bad, <very> bad...";
case 4: return "Oh god, it <swear> hurts...";
}
break;
case TALK_MISSION_OFFER:
return "\
I'm infected. Badly. I need you to get some antibiotics for me...";
case TALK_MISSION_ACCEPTED:
return "\
Oh, thank god, thank you so much! I won't last more than a couple of days, \
so hurry...";
case TALK_MISSION_REJECTED:
return "\
What?! Please, <ill_die> without your help!";
case TALK_MISSION_ADVICE:
return "\
There's a town nearby. Check pharmacies; it'll be behind the counter.";
case TALK_MISSION_INQUIRE:
return "Find any antibiotics yet?";
case TALK_MISSION_SUCCESS:
return "Oh thank god! I'll be right as rain in no time.";
case TALK_MISSION_SUCCESS_LIE:
return "What?! You're lying, I can tell! Ugh, forget it!";
case TALK_MISSION_FAILURE:
return "How am I not dead already?!";
}
break;
case MISSION_GET_SOFTWARE:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "Oh man, I can't believe I forgot to download it...";
case TALK_MISSION_OFFER:
return "There's some important software on my computer that I need on USB.";
case TALK_MISSION_ACCEPTED:
return "\
Thanks! Just pull the data onto this USB drive and bring it to me.";
case TALK_MISSION_REJECTED:
return "Seriously? It's an easy job...";
case TALK_MISSION_ADVICE:
return "Take this USB drive. Use the console, and download the software.";
case TALK_MISSION_INQUIRE:
return "So, do you have my software yet?";
case TALK_MISSION_SUCCESS:
return "Excellent, thank you!";
case TALK_MISSION_SUCCESS_LIE:
return "What?! You liar!";
case TALK_MISSION_FAILURE:
return "Wow, you failed? All that work, down the drain...";
}
break;
case MISSION_GET_ZOMBIE_BLOOD_ANAL:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "\
It could be very informative to perform an analysis of zombie blood...";
case TALK_MISSION_OFFER:
return "\
I need someone to get a sample of zombie blood, take it to a hospital, and \
perform a centrifuge analysis of it.";
case TALK_MISSION_ACCEPTED:
return "\
Excellent. Take this vacutainer; once you've produced a zombie corpse, use it \
to extrace blood from the body, then take it to a hospital for analysis.";
case TALK_MISSION_REJECTED:
return "\
Are you sure? The scientific value of that blood data could be priceless...";
case TALK_MISSION_ADVICE:
return "\
The centrifuge is a bit technical; you might want to study up on the usage of \
computers before completing that part.";
case TALK_MISSION_INQUIRE:
return "Well, do you have the data yet?";
case TALK_MISSION_SUCCESS:
return "Excellent! This may be the key to removing the infection.";
case TALK_MISSION_SUCCESS_LIE:
return "Wait, you couldn't possibly have the data! Liar!";
case TALK_MISSION_FAILURE:
return "What a shame, that data could have proved invaluable...";
}
break;
case MISSION_RESCUE_DOG:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "Oh, my poor puppy...";
case TALK_MISSION_OFFER:
return "\
I left my poor dog in a house, not far from here. Can you retrieve it?";
case TALK_MISSION_ACCEPTED:
return "\
Thank you! Please hurry back!";
case TALK_MISSION_REJECTED:
return "\
Please, think of my poor little puppy!";
case TALK_MISSION_ADVICE:
return "\
Take my dog whistle; if the dog starts running off, blow it and he'll return \
to your side.";
case TALK_MISSION_INQUIRE:
return "\
Have you found my dog yet?";
case TALK_MISSION_SUCCESS:
return "\
Thank you so much for finding him!";
case TALK_MISSION_SUCCESS_LIE:
return "What?! You're lying, I can tell! Ugh, forget it!";
case TALK_MISSION_FAILURE:
return "Oh no! My poor puppy...";
}
break;
case MISSION_KILL_ZOMBIE_MOM:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "Oh god, I can't believe it happened...";
case TALK_MISSION_OFFER:
return "\
My mom... she's... she was killed, but then she just got back up... she's one \
of those things now. Can you put her out of her misery for me?";
case TALK_MISSION_ACCEPTED:
return "Thank you... she would've wanted it this way.";
case TALK_MISSION_REJECTED:
return "Please reconsider, I know she's suffering...";
case TALK_MISSION_ADVICE:
return "Find a gun if you can, make it quick...";
case TALK_MISSION_INQUIRE:
return "Well...? Did you... finish things for my mom?";
case TALK_MISSION_SUCCESS:
return "Thank you. I couldn't rest until I knew that was finished.";
case TALK_MISSION_SUCCESS_LIE:
return "What?! You're lying, I can tell! Ugh, forget it!";
case TALK_MISSION_FAILURE:
return "Really... that's too bad.";
}
break;
default:
switch (state) {
case TALK_MISSION_DESCRIBE:
case TALK_MISSION_OFFER:
case TALK_MISSION_ACCEPTED:
case TALK_MISSION_REJECTED:
case TALK_MISSION_ADVICE:
case TALK_MISSION_INQUIRE:
case TALK_MISSION_SUCCESS:
case TALK_MISSION_SUCCESS_LIE:
case TALK_MISSION_FAILURE:
return "Someone forgot to code this message!";
}
break;
}
return "Someone forgot to code this message!";
}

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