Compare commits
190 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 625a0ec5ec | |||
| 6b79ead016 | |||
| f2504649e9 | |||
| b4326d972d | |||
| 2f23974f81 | |||
| 26c4be927a | |||
| 87baa3cc79 | |||
| 189354b8e9 | |||
| 345c1c0d27 | |||
| c98ee8dbef | |||
| 6b2ab31824 | |||
| 31ad94a1ee | |||
| 33f71fa042 | |||
| 8e35b4dd35 | |||
| 47de02a172 | |||
| 256f1a99de | |||
| 1361276e1a | |||
| 54a996a989 | |||
| d13493e7fe | |||
| d1f3bd9938 | |||
| cb164a8236 | |||
| 88a9b6ce7b | |||
| 97b6d7e4cf | |||
| cf3250e11b | |||
| d1cf4fcf61 | |||
| afd99f6ec0 | |||
| fcfe75b906 | |||
| 17d955042f | |||
| 1a72165a2c | |||
| 834754b3a3 | |||
| 160bd243a6 | |||
| ba6c7353d9 | |||
| 90c1b7b5c1 | |||
| b83267d257 | |||
| c9915d2b0b | |||
| bb38735679 | |||
| 1f2ba5df16 | |||
| 04850d017f | |||
| ac04d717af | |||
| ddbb41e71a | |||
| 856e285427 | |||
| 3d0816a284 | |||
| c1d8ec0cd2 | |||
| dc817bf2b9 | |||
| 9452acb749 | |||
| c850ae3aea | |||
| 7e43f1bfbf | |||
| d0f8c7c6a9 | |||
| 1e3420aa8f | |||
| 62185ef48b | |||
| e851085b9b | |||
| 748a5ed5b5 | |||
| 4b62a06af9 | |||
| f191347e05 | |||
| a195028061 | |||
| 72ccb94cba | |||
| 53541e8e38 | |||
| 40d1691b40 | |||
| d38c685772 | |||
| b56181e59f | |||
| 8496a93690 | |||
| 3984f0197f | |||
| 73827b40c8 | |||
| 42e34087fc | |||
| 7292ac7b92 | |||
| 931236ec82 | |||
| d25a043958 | |||
| 8c2f5c109a | |||
| f2834c0079 | |||
| 487a686c9a | |||
| 5f8eb8d704 | |||
| 8ee5a039d9 | |||
| 6f62316525 | |||
| e86adb7b4a | |||
| bc139be5ac | |||
| 89606d54f1 | |||
| afaeab92a6 | |||
| e2a81e3626 | |||
| 80c519df6b | |||
| 85b70b1bef | |||
| 10c7b24130 | |||
| 725700952e | |||
| 386d664d2f | |||
| d17b905747 | |||
| f6d198b4fb | |||
| 5e81da6827 | |||
| 8c6b82564a | |||
| dd72f62e06 | |||
| 90dd579372 | |||
| c3c77d79ed | |||
| 128d69039e | |||
| 668ca4d4d5 | |||
| 33e7dc1b04 | |||
| 856b06a9d7 | |||
| 6a95b78584 | |||
| b5631470ad | |||
| 757e29b223 | |||
| 6e17b80cd2 | |||
| d9e8b3bb17 | |||
| 3889ef8d11 | |||
| 9d16ab056b | |||
| 339b665712 | |||
| 71c2f0acf9 | |||
| 6c79e7fb41 | |||
| 98220d224f | |||
| c57923f1a9 | |||
| 13beb3e0f4 | |||
| c5e612a48b | |||
| 14cd8db985 | |||
| 194c87c271 | |||
| d5478c5d26 | |||
| ffd16169a8 | |||
| 69321de26f | |||
| 2608758799 | |||
| 1d2f7bff6b | |||
| b7eb63e481 | |||
| c9efd9e07d | |||
| 2fbb555d1f | |||
| d05bb314c6 | |||
| a8202034ed | |||
| a072ef1ac8 | |||
| c779eaa368 | |||
| e252913a04 | |||
| a7a4b27974 | |||
| db309cab30 | |||
| 44eb59a505 | |||
| dedf57fac0 | |||
| e398f9bafd | |||
| 979b06b3d7 | |||
| 764717a692 | |||
| 955ddf5a68 | |||
| c11694c8f5 | |||
| 71c137cb7b | |||
| 236a8eaf2b | |||
| 11584605aa | |||
| 7ba6ddd36c | |||
| 1919ec2d1f | |||
| 4e0431a322 | |||
| 32dfe1835c | |||
| 39c70d5215 | |||
| 53f46d6cbc | |||
| cac6b77701 | |||
| 10a53e345e | |||
| 858cb2c70c | |||
| 55917f29ee | |||
| 8e298bf3c8 | |||
| 2cd7f3b231 | |||
| df8b9c496b | |||
| 26ed97b25e | |||
| 89b144fe69 | |||
| 7a090660f0 | |||
| 1b864a9a90 | |||
| f302db99fd | |||
| aa71c25eee | |||
| 8ddb42e3b7 | |||
| 3d3b660f35 | |||
| b648d80e52 | |||
| aa744bfc9d | |||
| 157c2f3ebc | |||
| 0277830d44 | |||
| 4478b07e9c | |||
| 9fbd2684e8 | |||
| ad69d1bbbe | |||
| c83d72ee59 | |||
| 079f0e3cbc | |||
| 6d26f077ca | |||
| 884582f056 | |||
| dc01a8cb0b | |||
| 843e548735 | |||
| 3f8605b480 | |||
| fb5597ecc2 | |||
| c0f9e865bd | |||
| c406d589a4 | |||
| 2ca266e1f2 | |||
| 0ed563b102 | |||
| 114c25454b | |||
| eedabd57c2 | |||
| 07b6f36115 | |||
| f87bf17412 | |||
| 877552c3a4 | |||
| 07fcf7d196 | |||
| dff69f7269 | |||
| 9654131119 | |||
| ff4619146e | |||
| 0e366475a3 | |||
| b420f16e3c | |||
| 2d50f82c1b | |||
| 7e99570f41 | |||
| 51f537e2fc | |||
| 6e566bb0dd |
+213
-5
@@ -1,8 +1,216 @@
|
||||
!src/chkjson
|
||||
*.7z
|
||||
*.a
|
||||
*.d
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.tmp
|
||||
*.zip
|
||||
*.apk
|
||||
/WinDepend/
|
||||
/bindist/
|
||||
/build/
|
||||
/build-start-time
|
||||
/cmake-build-debug/
|
||||
/config/
|
||||
/data/*.template
|
||||
/data/mods/user-default-mods.json
|
||||
/dep/
|
||||
/doxygen_doc/html/*
|
||||
/doxygen_doc/latex/*
|
||||
/font/
|
||||
/graveyard/
|
||||
/memorial/
|
||||
/mods/
|
||||
/obj/
|
||||
/objwin/
|
||||
/save/
|
||||
/src/version.h
|
||||
/sound/
|
||||
/templates/
|
||||
/tools/format/json_formatter.cgi
|
||||
CataclysmWin.cscope_file_list
|
||||
CataclysmWin.depend
|
||||
CataclysmWin.layout
|
||||
cata_test
|
||||
cata_test-tiles
|
||||
cataclysm
|
||||
data/*.template
|
||||
save/
|
||||
obj/
|
||||
cataclysm-tiles
|
||||
cataclysm-vcpkg
|
||||
cataclysmdda-*
|
||||
chkjson*
|
||||
debug.log
|
||||
logg.txt
|
||||
bindist/
|
||||
cataclysmdda-*
|
||||
json_formatter
|
||||
|
||||
# Visual Studio files
|
||||
*.code-workspace
|
||||
*.exp
|
||||
*.ilk
|
||||
*.opensdf
|
||||
*.pdb
|
||||
*.lib
|
||||
*.sdf
|
||||
*.suo
|
||||
*.user
|
||||
*.vcxproj.filters
|
||||
.vs/
|
||||
.vscode/
|
||||
Debug*/
|
||||
Release*/
|
||||
|
||||
# Distribution script results
|
||||
/msvc-full-features/distribution
|
||||
|
||||
# Visual Studio 2015
|
||||
/msvc-full-features/*db
|
||||
/msvc-full-features/ipch
|
||||
lnk*.tmp
|
||||
Cataclysm.exe.lastcodeanalysissucceeded
|
||||
|
||||
#Visual Studio 2017
|
||||
/msvc-full-features/PredictedInputCache_Debug_x64.dat
|
||||
|
||||
#vcpkg
|
||||
/msvc-full-features/vcpkg_installed
|
||||
/msvc-object_creator/vcpkg_installed
|
||||
|
||||
# PVS Studio
|
||||
/msvc-full-features/*PVS-Studio*
|
||||
|
||||
# Temporary and backup files
|
||||
*.bak
|
||||
*.cbTemp
|
||||
*.sw?
|
||||
*~
|
||||
\#*
|
||||
gmon.out
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
._.DS_Store
|
||||
Thumbs.db
|
||||
cscope.*
|
||||
tags
|
||||
|
||||
# Generated translation source
|
||||
/lang/po/cataclysm-dda.pot
|
||||
/lang/po/en.po
|
||||
|
||||
# Compiled binary translations
|
||||
/lang/mo/
|
||||
|
||||
# Directory for translatable strings
|
||||
/lang/json/*
|
||||
!/lang/json/README
|
||||
|
||||
# Netbeans IDE folders
|
||||
nbproject/
|
||||
|
||||
# Python runtime files
|
||||
*.pyc
|
||||
|
||||
# vim files
|
||||
*.vim
|
||||
*.session
|
||||
.ycm_extra_conf.py
|
||||
.vimrc
|
||||
|
||||
# taskwarrior files
|
||||
*.task*
|
||||
|
||||
# GitEye files
|
||||
*.project
|
||||
|
||||
# vimdiff backup
|
||||
*.orig
|
||||
|
||||
# OSX
|
||||
Cataclysm.app
|
||||
build-data/osx/AppIcon.icns
|
||||
Cataclysm.dmg
|
||||
|
||||
# Jetbrains CLion
|
||||
.idea/
|
||||
|
||||
# test executables and generated data
|
||||
/tests/obj
|
||||
/tests/cata_test
|
||||
/tests/line_test
|
||||
/tests/map_iterator_test
|
||||
/tests/shadowcasting_test
|
||||
/tests/data/jsionized_overmap.sav
|
||||
/test_user_dir
|
||||
monfactions.txt
|
||||
|
||||
# temporary files generated by tools/reduce_tests.sh
|
||||
/list_of_tests
|
||||
/list_of_tests.ok
|
||||
/log
|
||||
/multidelta.log
|
||||
|
||||
# static library used to link the test executable
|
||||
cataclysm.a
|
||||
|
||||
# coredumps
|
||||
*.core
|
||||
|
||||
# sublime-text workspace
|
||||
*.sublime-workspace
|
||||
|
||||
# cppcheck
|
||||
*cppcheck.xml
|
||||
*.cppcheck
|
||||
|
||||
# clang tooling
|
||||
compile_commands.json
|
||||
.clangd
|
||||
|
||||
# IDA database
|
||||
Cataclysm.i64
|
||||
Cataclysm.id*
|
||||
Cataclysm.til
|
||||
Cataclysm.nam
|
||||
|
||||
# Snapcraft build directories
|
||||
prime
|
||||
snap
|
||||
stage
|
||||
|
||||
# Snapcraft build file
|
||||
*.snap
|
||||
|
||||
# Eclipse IDE
|
||||
.cproject
|
||||
.settings/
|
||||
|
||||
# Apple Xcode IDE
|
||||
Xcode/
|
||||
|
||||
# gdb
|
||||
.gdb_history
|
||||
|
||||
# Flatpak build artifacts
|
||||
/.flatpak-builder/
|
||||
/repo/
|
||||
/build-dir/
|
||||
|
||||
# precompiled headers
|
||||
/pch/pch.hpp.pch
|
||||
/pch/main-pch.hpp.gch
|
||||
/pch/main-pch.hpp.pch
|
||||
/tests/pch/pch.hpp.pch
|
||||
/tests/pch/tests-pch.hpp.gch
|
||||
/tests/pch/tests-pch.hpp.pch
|
||||
/tests/catch/catch.hpp.gch
|
||||
/tests/catch/catch.hpp.pch
|
||||
weather.output
|
||||
|
||||
# bundler local directories and files for jekyll site
|
||||
/.bundle/
|
||||
/_site/
|
||||
/vendor/
|
||||
.sass-cache
|
||||
.jekyll-metadata
|
||||
Gemfile.lock
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1e7d902c-02b7-4619-bf01-fe4b9c0ba8ca
|
||||
@@ -1,20 +0,0 @@
|
||||
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
|
||||
@@ -1,176 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,82 +0,0 @@
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
source "https://rubygems.org"
|
||||
ruby RUBY_VERSION
|
||||
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
# gem "jekyll", "3.4.2"
|
||||
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.0"
|
||||
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
gem "github-pages", group: :jekyll_plugins
|
||||
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
# 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
|
||||
#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 $(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}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
# 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)
|
||||
@@ -1,56 +0,0 @@
|
||||
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!
|
||||
@@ -1,13 +0,0 @@
|
||||
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?
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
# Welcome to Jekyll!
|
||||
#
|
||||
# This config file is meant for settings that affect your whole blog, values
|
||||
# which you are expected to set up once and rarely edit after that. If you find
|
||||
# yourself editing this file very often, consider using Jekyll's data files
|
||||
# feature for the data you need to update frequently.
|
||||
#
|
||||
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
||||
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
|
||||
|
||||
# Site settings
|
||||
# These are used to personalize your new site. If you look in the HTML files,
|
||||
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
|
||||
# You can create any custom variable you would like, and they will be accessible
|
||||
# in the templates via {{ site.myvariable }}.
|
||||
title: "Cataclysm: Dark Days Ahead"
|
||||
email: kevin.granade@gmail.com
|
||||
description: > # this means to ignore newlines until "baseurl:"
|
||||
Official homepage of Cataclysm: Dark Days Ahead open source turn-based survival RPG development project.
|
||||
Hosts downloads of game and links to community sites and resources.
|
||||
baseurl: "" # the subpath of your site, e.g. /blog
|
||||
url: "https://cataclysmdda.org" # the base hostname & protocol for your site, e.g. http://example.com
|
||||
repository: CleverRaven/Cataclysm-DDA
|
||||
|
||||
# Build settings
|
||||
markdown: kramdown
|
||||
theme: minima
|
||||
plugins:
|
||||
- jekyll-feed
|
||||
exclude:
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- vendor
|
||||
include:
|
||||
- .well-known
|
||||
@@ -0,0 +1,18 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
|
||||
<meta name="description" content="{{ page.excerpt | default: site.description | strip_html | normalize_whitespace | truncate: 160 | escape }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
|
||||
<link rel="canonical" href="{{ page.url | replace:'index.html','' | absolute_url }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | relative_url }}">
|
||||
<link rel="me" href="https://mastodon.gamedev.place/@kevingranade">
|
||||
<link rel="me" href="https://social.treehouse.systems/@itsmaya">
|
||||
|
||||
{% if jekyll.environment == 'production' and site.google_analytics %}
|
||||
{% include google-analytics.html %}
|
||||
{% endif %}
|
||||
</head>
|
||||
@@ -0,0 +1,31 @@
|
||||
<header class="site-header">
|
||||
|
||||
<div class="wrapper">
|
||||
{%- assign default_paths = site.pages | map: "path" -%}
|
||||
{%- assign page_paths = site.header_pages | default: default_paths -%}
|
||||
{%- assign titles_size = site.pages | map: 'title' | join: '' | size -%}
|
||||
<a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>
|
||||
|
||||
{%- if titles_size > 0 -%}
|
||||
<nav class="site-nav">
|
||||
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
||||
<label for="nav-trigger">
|
||||
<span class="menu-icon">
|
||||
<svg viewBox="0 0 18 15" width="18px" height="15px">
|
||||
<path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="trigger">
|
||||
<a class="page-link" href="/">Home</a>
|
||||
<a class="page-link" href="/releases/">Releases</a>
|
||||
<!--<a class="page-link" href="/changes/">Changes</a>-->
|
||||
<a class="page-link" href="/contributions/">Contribution Guidelines</a>
|
||||
<a class="page-link" href="/donations/">Donations</a>
|
||||
<a class="page-link" href="https://github.com/CleverRaven/Cataclysm-DDA/">GitHub</a>
|
||||
</div>
|
||||
</nav>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</header>
|
||||
-394
@@ -1,394 +0,0 @@
|
||||
#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.";
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#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
|
||||
-215
@@ -1,215 +0,0 @@
|
||||
#ifndef _ADDICTION_H_
|
||||
#define _ADDICTION_H_
|
||||
|
||||
#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:
|
||||
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 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--;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_CAFFEINE:
|
||||
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 caffeine craving.");
|
||||
g->u.add_morale(MORALE_CRAVING_CAFFEINE, -5, -30);
|
||||
if (rng(0, 10) < in)
|
||||
g->u.stim--;
|
||||
if (rng(8, 400) < in) {
|
||||
g->add_msg("Your hands start shaking... you need it bad!");
|
||||
g->u.add_disease(DI_SHAKES, 20, g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_ALCOHOL:
|
||||
g->u.per_cur--;
|
||||
g->u.int_cur--;
|
||||
if (rng(40, 1200) <= in * 10)
|
||||
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 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 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);
|
||||
break;
|
||||
|
||||
case ADD_SLEEP:
|
||||
// No effects here--just in player::can_sleep()
|
||||
// EXCEPT! Prolong this addiction longer than usual.
|
||||
if (one_in(2) && add.sated < 0)
|
||||
add.sated++;
|
||||
break;
|
||||
|
||||
case ADD_PKILLER:
|
||||
if ((in >= 25 || int(g->turn) % (100 - in * 4) == 0) && g->u.pkill > 0)
|
||||
g->u.pkill--; // Tolerance increases!
|
||||
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: {
|
||||
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 (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 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 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)
|
||||
g->u.add_disease(DI_HALLU, 3600, g);
|
||||
} break;
|
||||
|
||||
case ADD_COKE:
|
||||
g->u.int_cur--;
|
||||
g->u.per_cur--;
|
||||
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 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 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;
|
||||
}
|
||||
}
|
||||
|
||||
std::string addiction_name(addiction cur)
|
||||
{
|
||||
switch (cur.type) {
|
||||
case ADD_CIG: return "Nicotine Withdrawal";
|
||||
case ADD_CAFFEINE: return "Caffeine Withdrawal";
|
||||
case ADD_ALCOHOL: return "Alcohol Withdrawal";
|
||||
case ADD_SLEEP: return "Sleeping Pill Dependance";
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
std::string addiction_text(addiction cur)
|
||||
{
|
||||
std::stringstream dump;
|
||||
int strpen = 1 + int(cur.intensity / 7);
|
||||
switch (cur.type) {
|
||||
case ADD_CIG:
|
||||
return "Intelligence - 1; Occasional cravings";
|
||||
|
||||
case ADD_CAFFEINE:
|
||||
return "Strength - 1; Slight sluggishness; Occasional cravings";
|
||||
|
||||
case ADD_ALCOHOL:
|
||||
return "\
|
||||
Perception - 1; Intelligence - 1; Occasional Cravings;\n\
|
||||
Risk of delirium tremens";
|
||||
|
||||
case ADD_SLEEP:
|
||||
return "You may find it difficult to sleep without medication.";
|
||||
|
||||
case ADD_PKILLER:
|
||||
dump << "Strength -" << strpen << "; Perception - 1; Dexterity - 1;" <<
|
||||
std::endl <<
|
||||
"Depression and physical pain to some degree. Frequent cravings. Vomiting.";
|
||||
return dump.str();
|
||||
|
||||
case ADD_SPEED:
|
||||
return "Strength - 1; Intelligence - 1;\n\
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
-680
@@ -1,680 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
#ifndef _ARTIFACT_H_
|
||||
#define _ARTIFACT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
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
@@ -1,488 +0,0 @@
|
||||
#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
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
-613
@@ -1,613 +0,0 @@
|
||||
#include "player.h"
|
||||
#include "game.h"
|
||||
#include "rng.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?
|
||||
//
|
||||
// Well, because like diseases, which are also in a Big Switch, bionics don't
|
||||
// share functions....
|
||||
void player::activate_bionic(int b, game *g)
|
||||
{
|
||||
bionic bio = my_bionics[b];
|
||||
int power_cost = bionics[bio.id].power_cost;
|
||||
if (weapon.type->id == itm_bio_claws && bio.id == bio_claws)
|
||||
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
|
||||
g->add_msg("You cannot power your %s", bionics[bio.id].name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (my_bionics[b].powered && my_bionics[b].charge > 0) {
|
||||
// Already-on units just lose a bit of charge
|
||||
my_bionics[b].charge--;
|
||||
} else {
|
||||
// Not-on units, or those with zero charge, have to pay the power cost
|
||||
if (bionics[bio.id].charge_time > 0) {
|
||||
my_bionics[b].powered = true;
|
||||
my_bionics[b].charge = bionics[bio.id].charge_time;
|
||||
}
|
||||
power_level -= power_cost;
|
||||
}
|
||||
|
||||
std::string junk;
|
||||
std::vector<point> traj;
|
||||
std::vector<std::string> good;
|
||||
std::vector<std::string> bad;
|
||||
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++) {
|
||||
for (int j = posy - 1; j <= posy + 1; j++) {
|
||||
g->m.bash(i, j, 40, junk);
|
||||
g->m.bash(i, j, 40, junk); // Multibash effect, so that doors &c will fall
|
||||
g->m.bash(i, j, 40, junk);
|
||||
if (g->m.is_destructable(i, j) && rng(1, 10) >= 4)
|
||||
g->m.ter(i, j) = t_rubble;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case bio_time_freeze:
|
||||
moves += 100 * power_level;
|
||||
power_level = 0;
|
||||
g->add_msg("Your speed suddenly increases!");
|
||||
if (one_in(3)) {
|
||||
g->add_msg("Your muscles tear with the strain.");
|
||||
hurt(g, bp_arms, 0, rng(5, 10));
|
||||
hurt(g, bp_arms, 1, rng(5, 10));
|
||||
hurt(g, bp_legs, 0, rng(7, 12));
|
||||
hurt(g, bp_legs, 1, rng(7, 12));
|
||||
hurt(g, bp_torso, 0, rng(5, 15));
|
||||
}
|
||||
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);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
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)
|
||||
bad.push_back("Irradiated");
|
||||
if (has_disease(DI_PKILL1))
|
||||
good.push_back("Minor Painkiller");
|
||||
if (has_disease(DI_PKILL2))
|
||||
good.push_back("Moderate Painkiller");
|
||||
if (has_disease(DI_PKILL3))
|
||||
good.push_back("Heavy Painkiller");
|
||||
if (has_disease(DI_PKILL_L))
|
||||
good.push_back("Slow-Release Painkiller");
|
||||
if (has_disease(DI_DRUNK))
|
||||
good.push_back("Alcohol");
|
||||
if (has_disease(DI_CIG))
|
||||
good.push_back("Nicotine");
|
||||
if (has_disease(DI_HIGH))
|
||||
good.push_back("Intoxicant: Other");
|
||||
if (has_disease(DI_TOOK_PROZAC))
|
||||
good.push_back("Prozac");
|
||||
if (has_disease(DI_TOOK_FLUMED))
|
||||
good.push_back("Antihistamines");
|
||||
if (has_disease(DI_ADRENALINE))
|
||||
good.push_back("Adrenaline Spike");
|
||||
if (good.size() == 0 && bad.size() == 0)
|
||||
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())
|
||||
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());
|
||||
}
|
||||
}
|
||||
wrefresh(w);
|
||||
refresh();
|
||||
getch();
|
||||
delwin(w);
|
||||
break;
|
||||
|
||||
case bio_blood_filter:
|
||||
rem_disease(DI_FUNGUS);
|
||||
rem_disease(DI_POISON);
|
||||
rem_disease(DI_PKILL1);
|
||||
rem_disease(DI_PKILL2);
|
||||
rem_disease(DI_PKILL3);
|
||||
rem_disease(DI_PKILL_L);
|
||||
rem_disease(DI_DRUNK);
|
||||
rem_disease(DI_CIG);
|
||||
rem_disease(DI_HIGH);
|
||||
rem_disease(DI_TOOK_PROZAC);
|
||||
rem_disease(DI_TOOK_FLUMED);
|
||||
rem_disease(DI_ADRENALINE);
|
||||
break;
|
||||
|
||||
case bio_evap:
|
||||
if (query_yn("Drink directly? Otherwise you will need a container.")) {
|
||||
tmp_item = item(g->itypes[itm_water], 0);
|
||||
thirst -= 50;
|
||||
if (has_trait(PF_GOURMAND) && thirst < -60) {
|
||||
g->add_msg("You can't finish it all!");
|
||||
thirst = -60;
|
||||
} else if (!has_trait(PF_GOURMAND) && thirst < -20) {
|
||||
g->add_msg("You can't finish it all!");
|
||||
thirst = -20;
|
||||
}
|
||||
} else {
|
||||
t = g->inv("Choose a container:");
|
||||
if (i_at(t).type == 0) {
|
||||
g->add_msg("You don't have that item!");
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else if (!i_at(t).is_container()) {
|
||||
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else {
|
||||
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
|
||||
if (i_at(t).volume_contained() + 1 > cont->contains) {
|
||||
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else if (!(cont->flags & con_wtight)) {
|
||||
g->add_msg("Your %s isn't watertight!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else {
|
||||
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
|
||||
i_at(t).put_in(item(g->itypes[itm_water], 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case bio_lighter:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Torch in which direction?");
|
||||
input = get_input();
|
||||
get_direction(dirx, diry, input);
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_lighter].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
diry += posy;
|
||||
if (!g->m.add_field(g, dirx, diry, fd_fire, 1)) // Unsuccessful.
|
||||
g->add_msg("You can't light a fire there.");
|
||||
break;
|
||||
|
||||
case bio_claws:
|
||||
if (weapon.type->id == itm_bio_claws) {
|
||||
g->add_msg("You withdraw your claws.");
|
||||
weapon = ret_null;
|
||||
} else if (weapon.type->id != 0) {
|
||||
g->add_msg("Your claws extend, forcing you to drop your %s.",
|
||||
weapon.tname().c_str());
|
||||
g->m.add_item(posx, posy, weapon);
|
||||
weapon = item(g->itypes[itm_bio_claws], 0);
|
||||
weapon.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);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_bio_fusion]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
break;
|
||||
|
||||
case bio_laser:
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes[itm_v29], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_laser_pack]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
break;
|
||||
|
||||
case bio_emp:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Fire EMP in which direction?");
|
||||
input = get_input();
|
||||
get_direction(dirx, diry, input);
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_emp].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
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];
|
||||
if (tmp.type->id == itm_corpse && query_yn("Extract water from the %s",
|
||||
tmp.tname().c_str())) {
|
||||
i = g->m.i_at(posx, posy).size() + 1; // Loop is finished
|
||||
t = g->inv("Choose a container:");
|
||||
if (i_at(t).type == 0) {
|
||||
g->add_msg("You don't have that item!");
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else if (!i_at(t).is_container()) {
|
||||
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else {
|
||||
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
|
||||
if (i_at(t).volume_contained() + 1 > cont->contains) {
|
||||
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else {
|
||||
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
|
||||
i_at(t).put_in(item(g->itypes[itm_water], 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == g->m.i_at(posx, posy).size() - 1) // We never chose a corpse
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
}
|
||||
break;
|
||||
|
||||
case bio_magnet:
|
||||
for (int i = posx - 10; i <= posx + 10; i++) {
|
||||
for (int j = posy - 10; j <= posy + 10; j++) {
|
||||
if (g->m.i_at(i, j).size() > 0) {
|
||||
if (g->m.sees(i, j, posx, posy, -1, t))
|
||||
traj = line_to(i, j, posx, posy, t);
|
||||
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];
|
||||
g->m.i_rem(i, j, k);
|
||||
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() * 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() * 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);
|
||||
l = traj.size() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l == traj.size())
|
||||
g->m.add_item(posx, posy, tmp_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case bio_lockpick:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Unlock in which direction?");
|
||||
input = get_input();
|
||||
get_direction(dirx, diry, input);
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_lockpick].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
diry += posy;
|
||||
if (g->m.ter(dirx, diry) == t_door_locked) {
|
||||
moves -= 40;
|
||||
g->add_msg("You unlock the door.");
|
||||
g->m.ter(dirx, diry) = t_door_c;
|
||||
} else
|
||||
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;
|
||||
}
|
||||
|
||||
g->add_msg(fail_text.c_str());
|
||||
|
||||
}
|
||||
@@ -1,331 +0,0 @@
|
||||
#ifndef _BIONICS_H_
|
||||
#define _BIONICS_H_
|
||||
#include <string>
|
||||
|
||||
/* Thought: Perhaps a HUD bionic that changes the display of the game?
|
||||
* Showing more information or something. */
|
||||
|
||||
enum bionic_id {
|
||||
bio_null,
|
||||
// Power sources
|
||||
bio_batteries, bio_metabolics, bio_solar, bio_furnace, bio_ethanol,
|
||||
// Automatic / Always-On
|
||||
bio_memory, bio_ears,
|
||||
bio_eye_enhancer, bio_membrane, bio_targeting,
|
||||
bio_gills, bio_purifier,
|
||||
bio_climate, bio_storage, bio_recycler, bio_digestion, // TODO: Ynnn
|
||||
bio_tools, bio_shock, bio_heat_absorb,
|
||||
bio_carbon, bio_armor_head, bio_armor_torso, bio_armor_arms, bio_armor_legs,
|
||||
// Player Activated
|
||||
bio_flashlight, bio_night_vision, bio_infrared,
|
||||
bio_face_mask, // TODO
|
||||
bio_ads, bio_ods, bio_scent_mask,bio_scent_vision, bio_cloak, bio_painkiller,
|
||||
bio_nanobots, bio_heatsink, bio_resonator, bio_time_freeze, bio_teleport,
|
||||
bio_blood_anal, bio_blood_filter, bio_alarm,
|
||||
bio_evap, bio_lighter, bio_claws, bio_blaster, bio_laser, bio_emp,
|
||||
bio_hydraulics, bio_water_extractor, bio_magnet, bio_fingerhack, bio_lockpick,
|
||||
bio_ground_sonar,
|
||||
max_bio_start,
|
||||
// EVERYTHING below this point is not available to brand-new players
|
||||
// TODO: all these suckers
|
||||
bio_banish, bio_gate_out, bio_gate_in, bio_nightfall, bio_drilldown,
|
||||
bio_heatwave, bio_lightning, bio_tremor, bio_flashflood,
|
||||
max_bio_good,
|
||||
// Everything below THIS point is bad bionics, meant to be punishments
|
||||
bio_dis_shock, bio_dis_acid, bio_drain, bio_noise, bio_power_weakness,
|
||||
bio_stiff,
|
||||
max_bio
|
||||
};
|
||||
|
||||
struct bionic_data {
|
||||
std::string name;
|
||||
bool power_source;
|
||||
bool activated; // If true, then the below function only happens when
|
||||
// activated; otherwise, it happens every turn
|
||||
int power_cost;
|
||||
int charge_time; // How long, when activated, between drawing power_cost
|
||||
// If 0, it draws power once
|
||||
std::string description;
|
||||
};
|
||||
|
||||
struct bionic {
|
||||
bionic_id id;
|
||||
char invlet;
|
||||
bool powered;
|
||||
int charge;
|
||||
bionic() {
|
||||
id = bio_batteries;
|
||||
invlet = 'a';
|
||||
powered = false;
|
||||
charge = 0;
|
||||
}
|
||||
bionic(bionic_id pid, char pinvlet) {
|
||||
id = pid;
|
||||
invlet = pinvlet;
|
||||
powered = false;
|
||||
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. Use 'E' to consume batteries."},
|
||||
{"Metabolic Interchange", true, false, 0, 0, "\
|
||||
Your digestive system and power supply are interconnected. Any drain on\n\
|
||||
energy instead increases your hunger."},
|
||||
{"Solar Panels", true, false, 0, 0, "\
|
||||
You have a few solar panels installed. While in direct sunlight, your power\n\
|
||||
level will slowly recharge."},
|
||||
{"Internal Furnace", true, false, 0, 0, "\
|
||||
You can burn nearly any organic material as fuel (use 'E'), recharging your\n\
|
||||
power level. Some materials will burn better than others."},
|
||||
{"Ethanol Burner", true, false, 0, 0, "\
|
||||
You burn alcohol as fuel in an extremely efficient reaction. However, you\n\
|
||||
will still suffer the inebriating effects of the substance."},
|
||||
|
||||
{"Enhanced Memory Banks", false, false, 1, 0, "\
|
||||
Your memory has been enhanced with small quantum storage drives. Any time\n\
|
||||
you start to forget a skill, you have a chance at retaining all knowledge, at\n\
|
||||
the cost of a small amount of power."},
|
||||
{"Enhanced Hearing", false, false, 0, 0, "\
|
||||
Your hearing has been drastically improved, allowing you to hear ten times\n\
|
||||
better than the average person. Additionally, high-intensity sounds will be\n\
|
||||
automatically dampened before they can damage your hearing."},
|
||||
{"Diamond Cornea", false, false, 0, 0, "\
|
||||
Your vision is greatly enhanced, giving you a +2 bonus to perception."},
|
||||
{"Nictating Membrane", false, false, 0, 0, "\
|
||||
Your eyes have a thin membrane that closes over your eyes while underwater,\n\
|
||||
negating any vision penalties."},
|
||||
{"Targeting System", false, false, 0, 0, "\
|
||||
Your eyes are equipped with range finders, and their movement is synced with\n\
|
||||
that of your arms, to a degree. Shots you fire will be much more accurate,\n\
|
||||
particularly at long range."},
|
||||
{"Membrane Oxygenator", false, false, 1, 0, "\
|
||||
An oxygen interchange system automatically switches on while underwater,\n\
|
||||
slowly draining your energy reserves but providing oxygen."},
|
||||
{"Air Filtration System", false, false, 1, 0, "\
|
||||
Implanted in your trachea is an advanced filtration system. If toxins find\n\
|
||||
their way into your windpipe, the filter will attempt to remove them."},
|
||||
{"Internal Climate Control", false, 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\
|
||||
degrees Fahrenheit."},
|
||||
{"Internal Storage", false, false, 0, 0, "\
|
||||
Space inside your chest cavity has been converted into a storage area. You\n\
|
||||
may carry an extra 8 units of volume."},
|
||||
{"Recycler Unit", false, false, 0, 0, "\
|
||||
Your digestive system has been outfitted with a series of filters and\n\
|
||||
processors, allowing you to reclaim waste liquid and, to a lesser degree,\n\
|
||||
nutrients. The net effect is a greatly reduced need to eat and drink."},
|
||||
{"Expanded Digestive System", false, false, 0, 0, "\
|
||||
You have been outfitted with three synthetic stomachs and industrial-grade\n\
|
||||
intestines. Not only can you extract much more nutrition from food, but you\n\
|
||||
are highly resistant to foodborne illness, and can sometimes eat rotten food."},
|
||||
{"Integrated Toolset", false, false, 0, 0, "\
|
||||
Implanted in your hands and fingers is a complete tool set - screwdriver,\n\
|
||||
hammer, wrench, and heating elements. You can use this in place of many\n\
|
||||
tools when crafting."},
|
||||
{"Electroshock Unit", false, false, 1, 0, "\
|
||||
While fighting unarmed, or with a weapon that conducts electricity, there is\n\
|
||||
a chance that a successful hit will shock your opponent, inflicting extra\n\
|
||||
damage and disabling them temporarily at the cost of some energy."},
|
||||
{"Heat Drain", false, false, 1, 0, "\
|
||||
While fighting unarmed against a warm-blooded opponent, there is a chance\n\
|
||||
that a successful hit will drain body heat, inflicting a small amount of\n\
|
||||
extra damage, and increasing your power reserves slightly."},
|
||||
{"Subdermal Carbon Filament", false, false, 0, 0, "\
|
||||
Lying just beneath your skin is a thin armor made of carbon nanotubes. This\n\
|
||||
reduces bashing damage by 2 and cutting damage by 4, but also reduces your\n\
|
||||
dexterity by 2."},
|
||||
{"Alloy Plating - Head", false, false, 0, 0, "\
|
||||
The flesh on your head has been replaced by a strong armor, protecting both\n\
|
||||
your head and jaw regions, but increasing encumberance by 2 and decreasing\n\
|
||||
perception by 1."},
|
||||
{"Alloy Plating - Torso", false, false, 0, 0, "\
|
||||
The flesh on your torso has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but increasing your encumberance by 2."},
|
||||
{"Alloy Plating - Arms", false, false, 0, 0, "\
|
||||
The flesh on your arms has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but decreasing your dexterity by 1."},
|
||||
{"Alloy Plating - Legs", false, false, 0, 0, "\
|
||||
The flesh on your legs has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but decreasing your speed by 15."},
|
||||
|
||||
{"Cranial Flashlight", false, true, 1, 30, "\
|
||||
Mounted between your eyes is a small but powerful LED flashlight."},
|
||||
{"Implanted Night Vision", false, true, 1, 20, "\
|
||||
Your eyes have been modified to amplify existing light, allowing you to see\n\
|
||||
in the dark."},
|
||||
{"Infrared Vision", false, true, 1, 4, "\
|
||||
Your range of vision extends into the infrared, allowing you to see warm-\n\
|
||||
blooded creatures in the dark, and even through walls."},
|
||||
{"Facial Distortion", false, true, 1, 10, "\
|
||||
Your face is actually made of a compound which may be molded by electrical\n\
|
||||
impulses, making you impossible to recognize. While not powered, however,\n\
|
||||
the compound reverts to its default shape."},
|
||||
{"Active Defense System", false, true, 1, 7, "\
|
||||
A thin forcefield surrounds your body, continually draining power. Anything\n\
|
||||
attempting to penetrate this field has a chance of being deflected at the\n\
|
||||
cost of more energy. Melee attacks will be stopped more often than bullets."},
|
||||
{"Offensive Defense System", false, true, 1, 6, "\
|
||||
A thin forcefield surrounds your body, continually draining power. This\n\
|
||||
field does not deflect penetration, but rather delivers a very strong shock,\n\
|
||||
damaging unarmed attackers and those with a conductive weapon."},
|
||||
{"Olfactory Mask", false, true, 1, 8, "\
|
||||
While this system is powered, your body will produce very little odor, making\n\
|
||||
it nearly impossible for creatures to track you by scent."},
|
||||
{"Scent Vision", false, true, 1, 30, "\
|
||||
While this system is powered, you're able to visually sense your own scent,\n\
|
||||
making it possible for you to recognize your surroundings even if you can't\n\
|
||||
see it."},
|
||||
{"Cloaking System", false, true, 2, 1, "\
|
||||
This high-power system uses a set of cameras and LEDs to make you blend into\n\
|
||||
your background, rendering you fully invisible to normal vision. However,\n\
|
||||
you may be detected by infrared, sonar, etc."},
|
||||
{"Sensory Dulling", false, true, 2, 0, "\
|
||||
Your nervous system is wired to allow you to inhibit the signals of pain,\n\
|
||||
allowing you to dull your senses at will. However, the use of this system\n\
|
||||
may cause delayed reaction time and drowsiness."},
|
||||
{"Repair Nanobots", false, true, 5, 0, "\
|
||||
Inside your body is a fleet of tiny dormant robots. Once charged from your\n\
|
||||
energy banks, they will flit about your body, repairing any damage."},
|
||||
{"Thermal Dissapation", false, true, 1, 6, "\
|
||||
Powerful heatsinks supermaterials are woven into your flesh. While powered,\n\
|
||||
this system will prevent heat damage up to 2000 degrees fahrenheit. Note\n\
|
||||
that this does not affect your internal temperature."},
|
||||
{"Sonic Resonator", false, true, 4, 0, "\
|
||||
Your entire body may resonate at very high power, creating a short-range\n\
|
||||
shockwave. While it will not to much damage to flexible creatures, stiff\n\
|
||||
items such as walls, doors, and even robots will be severely damaged."},
|
||||
{"Time Dilation", false, true, 3, 0, "\
|
||||
At an immense cost of power, you may increase your body speed and reactions\n\
|
||||
dramatically, essentially freezing time. You are still delicate, however,\n\
|
||||
and violent or rapid movements may damage you due to friction."},
|
||||
{"Teleportation Unit", false, true, 10, 0, "\
|
||||
This highly experimental unit folds space over short distances, instantly\n\
|
||||
transporting your body up to 25 feet at the cost of much power. Note that\n\
|
||||
prolonged or frequent use may have dangerous side effects."},
|
||||
{"Blood Analysis", false, true, 1, 0, "\
|
||||
Small sensors have been implanted in your heart, allowing you to analyse your\n\
|
||||
blood. This will detect many illnesses, drugs, and other conditions."},
|
||||
{"Blood Filter", false, true, 3, 0, "\
|
||||
A filtration system in your heart allows you to actively filter out chemical\n\
|
||||
impurities, primarily drugs. It will have limited impact on viruses. Note\n\
|
||||
that it is not a targeted filter; ALL drugs in your system will be affected."},
|
||||
{"Alarm System", false, true, 1, 400, "\
|
||||
A motion-detecting alarm system will notice almost all movement within a\n\
|
||||
fifteen-foot radius, and will silently alert you. This is very useful during\n\
|
||||
sleep, or if you suspect a cloaked pursuer."},
|
||||
{"Aero-Evaporator", false, true, 8, 0, "\
|
||||
This unit draws moisture from the surrounding air, which then is poured from\n\
|
||||
a fingertip in the form of water. It may fail in very dry environments."},
|
||||
{"Mini-Flamethrower", false, true, 3, 0, "\
|
||||
The index fingers of both hands have powerful fire starters which extend from\n\
|
||||
the tip."},
|
||||
{"Adamantium Claws", false, true, 3, 0, "\
|
||||
Your fingers can withdraw into your hands, allowing a set of vicious claws to\n\
|
||||
extend. These do considerable cutting damage, but prevent you from holding\n\
|
||||
anything else."},
|
||||
{"Fusion Blaster Arm", false, true, 2, 0, "\
|
||||
Your left arm has been replaced by a heavy-duty fusion blaster! You may use\n\
|
||||
your energy banks to fire a damaging heat ray; however, you are unable to use\n\
|
||||
or carry two-handed items, and may only fire handguns."},
|
||||
{"Finger-Mounted Laser", false, true, 2, 0, "\
|
||||
One of your fingers has a small high-powered laser embedded in it. This long\n\
|
||||
range weapon is not incredibly damaging, but is very accurate, and has the\n\
|
||||
potential to start fires."},
|
||||
{"Directional EMP", false, true, 4, 0, "\
|
||||
Mounted in the palms of your hand are small parabolic EMP field generators.\n\
|
||||
You may use power to fire a short-ranged blast which will disable electronics\n\
|
||||
and robots."},
|
||||
{"Hydraulic Muscles", false, true, 1, 3, "\
|
||||
While activated, the muscles in your arms will be greatly enchanced,\n\
|
||||
increasing your strength by 20."},
|
||||
{"Water Extraction Unit", false, true, 2, 0, "\
|
||||
Nanotubs embedded in the palm of your hand will pump any available fluid out\n\
|
||||
of a dead body, cleanse it of impurities and convert it into drinkable water.\n\
|
||||
You must, however, have a container to store the water in."},
|
||||
{"Electromagnetic Unit", false, true, 2, 0, "\
|
||||
Embedded in your hand is a powerful electromagnet, allowing you to pull items\n\
|
||||
made of iron over short distances."},
|
||||
{"Fingerhack", false, true, 1, 0, "\
|
||||
One of your fingers has an electrohack embedded in it; an all-purpose hacking\n\
|
||||
unit used to override control panels and the like (but not computers). Skill\n\
|
||||
in computers is important, and a failed use may damage your circuits."},
|
||||
{"Fingerpick", false, true, 1, 0, "\
|
||||
One of your fingers has an electronic lockpick embedded in it. This auto-\n\
|
||||
matic system will quickly unlock all but the most advanced key locks without\n\
|
||||
any skill required on the part of the user."},
|
||||
{"Terranian Sonar", false, true, 1, 5, "\
|
||||
Your feet are equipped with precision sonar equipment, allowing you to detect\n\
|
||||
the movements of creatures below the ground."},
|
||||
|
||||
{"max_bio_start - BUG", false, false, 0, 0, "\
|
||||
This is a placeholder bionic meant to demarkate those which a new character\n\
|
||||
can start with. If you are reading this, you have found a bug!"},
|
||||
|
||||
{"Banishment", false, true, 40, 0, "\
|
||||
You can briefly open a one-way gate to the nether realm, banishing a single\n\
|
||||
target there permanently. This is not without its dangers, however, as the\n\
|
||||
inhabitants of the nether world may take notice."},
|
||||
{"Gate Out", false, true, 55, 0, "\
|
||||
You can temporarily open a two-way gate to the nether realm, accessible only\n\
|
||||
by you. This will remove you from immediate danger, but may attract the\n\
|
||||
attention of the nether world's inhabitants..."},
|
||||
{"Gate In", false, true, 35, 0, "\
|
||||
You can temporarily open a one-way gate from the nether realm. This will\n\
|
||||
attract the attention of its horrifying inhabitants, who may begin to pour\n\
|
||||
into reality."},
|
||||
{"Artificial Night", false, true, 5, 1, "\
|
||||
Photon absorbtion panels will attract and obliterate photons within a 100'\n\
|
||||
radius, casting an area around you into pitch darkness."},
|
||||
{"Borehole Drill", false, true, 30, 0, "\
|
||||
Your legs can transform into a powerful drill which will bury you 50 feet\n\
|
||||
into the earth. Be careful to only drill down when you know you will be able\n\
|
||||
to get out, or you'll simply dig your own tomb."},
|
||||
{"Heatwave", false, true, 45, 0, "\
|
||||
At the cost of immense power, you can cause dramatic spikes in the ambient\n\
|
||||
temperature around you. These spikes are very short-lived, but last long\n\
|
||||
enough to ignite wood, paper, gunpowder, and other substances."},
|
||||
{"Chain Lightning", false, true, 48, 0, "\
|
||||
Powerful capacitors unleash an electrical storm at your command, sending a\n\
|
||||
chain of highly-damaging lightning through the air. It has the power to\n\
|
||||
injure several opponents before grounding itself."},
|
||||
{"Tremor Pads", false, true, 40, 0, "\
|
||||
Using tremor pads in your feet, you can cause a miniature earthquake. The\n\
|
||||
shockwave will damage enemies (particularly those digging underground), tear\n\
|
||||
down walls, and churn the earth."},
|
||||
{"Flashflood", false, true, 35, 0, "\
|
||||
By drawing the moisture from the air, and synthesizing water from in-air\n\
|
||||
elements, you can create a massive puddle around you. The effects are more\n\
|
||||
powerful when used near a body of water."},
|
||||
|
||||
{"max_bio_good - BUG", false, false, 0, 0, "\
|
||||
This is a placeholder bionic. If you are reading this, you have found a bug!"},
|
||||
|
||||
{"Electrical Discharge", false, false, 0, 0, "\
|
||||
A malfunctioning bionic which occasionally discharges electricity through\n\
|
||||
your body, causing pain and brief paralysis but no damage."},
|
||||
{"Acidic Discharge", false, false, 0, 0, "\
|
||||
A malfunctioning bionic which occasionally discharges acid into your muscles,\n\
|
||||
causing sharp pain and minor damage."},
|
||||
{"Electrical Drain", false, false, 0, 0, "\
|
||||
A malfunctioning bionic. It doesn't perform any useful function, but will\n\
|
||||
occasionally draw power from your batteries."},
|
||||
{"Noisemaker", false, false, 0, 0, "\
|
||||
A malfunctioning bionic. It will occasionally emit a loud burst of noise."},
|
||||
{"Power Overload", false, false, 0, 0, "\
|
||||
Damaged power circuits cause short-circuiting inside your muscles when your\n\
|
||||
batteries are above 75%%%% capacity, causing greatly reduced strength. This\n\
|
||||
has no effect if you have no internal batteries."},
|
||||
{"Wire-induced Stiffness", false, false, 0, 0, "\
|
||||
Improperly installed wires cause a physical stiffness in most of your body,\n\
|
||||
causing increased encumberance."}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
#include "bodypart.h"
|
||||
#include "rng.h"
|
||||
|
||||
std::string body_part_name (body_part bp, int side)
|
||||
{
|
||||
switch (bp) {
|
||||
case bp_head:
|
||||
return "head";
|
||||
case bp_eyes:
|
||||
return "eyes";
|
||||
case bp_mouth:
|
||||
return "mouth";
|
||||
case bp_torso:
|
||||
return "torso";
|
||||
case bp_arms:
|
||||
if (side == 0)
|
||||
return "left arm";
|
||||
if (side == 1)
|
||||
return "right arm";
|
||||
return "arms";
|
||||
case bp_hands:
|
||||
if (side == 0)
|
||||
return "left hand";
|
||||
if (side == 1)
|
||||
return "right hand";
|
||||
return "hands";
|
||||
case bp_legs:
|
||||
if (side == 0)
|
||||
return "left leg";
|
||||
if (side == 1)
|
||||
return "right leg";
|
||||
return "legs";
|
||||
case bp_feet:
|
||||
if (side == 0)
|
||||
return "left foot";
|
||||
if (side == 1)
|
||||
return "right foot";
|
||||
return "feet";
|
||||
default:
|
||||
return "appendix";
|
||||
}
|
||||
}
|
||||
|
||||
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, 100);
|
||||
if (rn == 0)
|
||||
return bp_eyes;
|
||||
if (rn <= 1)
|
||||
return bp_mouth;
|
||||
if (rn <= 7)
|
||||
return bp_head;
|
||||
if (rn <= 28)
|
||||
return bp_legs;
|
||||
if (rn <= 50)
|
||||
return bp_arms;
|
||||
return bp_torso;
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
#ifndef _BODYPART_H_
|
||||
#define _BODYPART_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
enum body_part {
|
||||
bp_torso = 0,
|
||||
bp_head,
|
||||
bp_eyes,
|
||||
bp_mouth,
|
||||
bp_arms,
|
||||
bp_hands,
|
||||
bp_legs,
|
||||
bp_feet,
|
||||
num_bp
|
||||
};
|
||||
|
||||
std::string body_part_name(body_part bp, int side);
|
||||
std::string encumb_text(body_part bp);
|
||||
|
||||
body_part random_body_part();
|
||||
|
||||
#endif
|
||||
-416
@@ -1,416 +0,0 @@
|
||||
#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 ©)
|
||||
{
|
||||
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
@@ -1,83 +0,0 @@
|
||||
#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 ©);
|
||||
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"
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR && ./cataclysm
|
||||
-812
@@ -1,812 +0,0 @@
|
||||
#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
@@ -1,154 +0,0 @@
|
||||
#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
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: page
|
||||
title: Changes
|
||||
permalink: /changes/
|
||||
---
|
||||
{% for pull in site.github.pulls %}
|
||||
{{ pull.title }}
|
||||
------------------
|
||||
|
||||
{{ pull.body }}
|
||||
{% endfor %}
|
||||
@@ -1,41 +0,0 @@
|
||||
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.
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
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
|
||||
@@ -1,121 +0,0 @@
|
||||
#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
@@ -1,258 +0,0 @@
|
||||
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?
|
||||
@@ -1,188 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
#ifndef _COLOR_H_
|
||||
#define _COLOR_H
|
||||
|
||||
#ifndef _COLOR_LIST_
|
||||
#define _COLOR_LIST_
|
||||
|
||||
#include "cursesdef.h"
|
||||
|
||||
void init_colors();
|
||||
|
||||
enum col_attribute {
|
||||
WA_NULL = 0,
|
||||
HI = 1,
|
||||
INV = 2
|
||||
};
|
||||
|
||||
enum nc_color {
|
||||
c_black = COLOR_PAIR(30),
|
||||
c_white = COLOR_PAIR(1) | A_BOLD,
|
||||
c_ltgray = COLOR_PAIR(1),
|
||||
c_dkgray = COLOR_PAIR(30) | A_BOLD,
|
||||
c_red = COLOR_PAIR(2),
|
||||
c_green = COLOR_PAIR(3),
|
||||
c_blue = COLOR_PAIR(4),
|
||||
c_cyan = COLOR_PAIR(5),
|
||||
c_magenta = COLOR_PAIR(6),
|
||||
c_brown = COLOR_PAIR(7),
|
||||
c_ltred = COLOR_PAIR(2) | A_BOLD,
|
||||
c_ltgreen = COLOR_PAIR(3) | A_BOLD,
|
||||
c_ltblue = COLOR_PAIR(4) | A_BOLD,
|
||||
c_ltcyan = COLOR_PAIR(5) | A_BOLD,
|
||||
c_pink = COLOR_PAIR(6) | A_BOLD,
|
||||
c_yellow = COLOR_PAIR(7) | A_BOLD,
|
||||
|
||||
h_black = COLOR_PAIR(20),
|
||||
h_white = COLOR_PAIR(15) | A_BOLD,
|
||||
h_ltgray = COLOR_PAIR(15),
|
||||
h_dkgray = COLOR_PAIR(20) | A_BOLD,
|
||||
h_red = COLOR_PAIR(16),
|
||||
h_green = COLOR_PAIR(17),
|
||||
h_blue = COLOR_PAIR(20),
|
||||
h_cyan = COLOR_PAIR(19),
|
||||
h_magenta = COLOR_PAIR(21),
|
||||
h_brown = COLOR_PAIR(22),
|
||||
h_ltred = COLOR_PAIR(16) | A_BOLD,
|
||||
h_ltgreen = COLOR_PAIR(17) | A_BOLD,
|
||||
h_ltblue = COLOR_PAIR(18) | A_BOLD,
|
||||
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(30),
|
||||
i_white = COLOR_PAIR(8) | A_BLINK,
|
||||
i_ltgray = COLOR_PAIR(8),
|
||||
i_dkgray = COLOR_PAIR(30) | A_BLINK,
|
||||
i_red = COLOR_PAIR(9),
|
||||
i_green = COLOR_PAIR(10),
|
||||
i_blue = COLOR_PAIR(11),
|
||||
i_cyan = COLOR_PAIR(12),
|
||||
i_magenta = COLOR_PAIR(13),
|
||||
i_brown = COLOR_PAIR(14),
|
||||
i_ltred = COLOR_PAIR(9) | A_BLINK,
|
||||
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,
|
||||
|
||||
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
|
||||
|
||||
#endif
|
||||
-909
@@ -1,909 +0,0 @@
|
||||
#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
@@ -1,115 +0,0 @@
|
||||
#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
|
||||
@@ -1,942 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
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);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Contribution Guidelines"
|
||||
permalink: /contributions/
|
||||
---
|
||||
|
||||
# Contribute
|
||||
|
||||
**Opening a new issue?** Please read our [issue guidelines]({{ site.baseurl }}{% link pages/issues.md %}) first.
|
||||
|
||||
**Contributing code?** Check the [code contribution guidelines]({{ site.baseurl }}{% link pages/code_contributions.md %}).
|
||||
|
||||
**Investigating bugs?** These [debugging commands]({{ site.baseurl }}{% link pages/debugging.md %}) can help.
|
||||
|
||||
**Need help with git?** [git howto]({{ site.baseurl }}{% link pages/branch_management.md %}) might be what you're looking for.
|
||||
|
||||
Contributing code or data to Cataclysm: Dark Days Ahead is easy - simply fork the repository on our [GitHub](https://github.com/CleverRaven/Cataclysm-DDA/), make your changes, and then send us a pull request.
|
||||
|
||||
Cataclysm: Dark Days Ahead is released under the Creative Commons Attribution ShareAlike 3.0 license. The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever. See [https://creativecommons.org/licenses/by-sa/3.0/](https://creativecommons.org/licenses/by-sa/3.0/) for details.
|
||||
This means any contribution you make to the project will also be covered by the same license, and this license is irrevocable.
|
||||
|
||||
## Guidelines
|
||||
|
||||
There are a couple of guidelines we suggest sticking to:
|
||||
|
||||
* Add the repository as an `upstream` remote.
|
||||
* Keep your `master` branch clean. This means you can easily pull changes made to this repository into yours.
|
||||
* Create a new branch for each new feature or set of related bug fixes.
|
||||
* Never merge from your local branches into your `master` branch. Only update `master` by pulling from `upstream/master`.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
#### Why does `git pull --ff-only` result in an error?
|
||||
|
||||
If `git pull --ff-only` shows an error, it means that you've committed directly to your local `master` branch. To fix this, you can create a new branch with these commits, find the point at which you diverged from `upstream/master`, and then reset `master` to that point.
|
||||
|
||||
$ git pull --ff-only upstream master
|
||||
From https://github.com/CleverRaven/Cataclysm-DDA
|
||||
* branch master -> FETCH_HEAD
|
||||
fatal: Not possible to fast-forward, aborting.
|
||||
$ git branch new_branch master # mark the current commit with a tmp branch
|
||||
$ git merge-base master upstream/master
|
||||
cc31d0... # the last commit before we committed directly to master
|
||||
$ git reset --hard cc31d0....
|
||||
HEAD is now at cc31d0... ...
|
||||
|
||||
Now that `master` has been cleaned up, you can easily pull from `upstream/master`, and then continue working on `new_branch`.
|
||||
|
||||
$ git pull --ff-only upstream master
|
||||
# gets changes from the "upstream" remote for the matching branch, in this case "master"
|
||||
$ git checkout new_branch
|
||||
|
||||
#### How does the project work anyway?
|
||||
|
||||
I-am-Erk has written a guide outlining project governance.
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/development_process.md
|
||||
-1978
File diff suppressed because it is too large
Load Diff
-68
@@ -1,68 +0,0 @@
|
||||
#ifndef _CRAFTING_H_
|
||||
#define _CRAFTING_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "itype.h"
|
||||
#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
|
||||
};
|
||||
|
||||
struct component
|
||||
{
|
||||
itype_id type;
|
||||
int count;
|
||||
component() { type = itm_null; count = 0; }
|
||||
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;
|
||||
bool reversible; // can the item be disassembled?
|
||||
|
||||
std::vector<component> tools[5];
|
||||
std::vector<component> components[10];
|
||||
|
||||
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
@@ -1,12 +0,0 @@
|
||||
#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
|
||||
@@ -1,3 +0,0 @@
|
||||
# These are both generated if missing at program startup
|
||||
keymap.txt
|
||||
options.txt
|
||||
@@ -1,3 +0,0 @@
|
||||
Terminus
|
||||
8
|
||||
16
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
%
|
||||
Our chemical department has made great strides in the production of a
|
||||
concentrated mutagen, derived from samples of mutated individuals. This
|
||||
substance has been denoted PE012.
|
||||
%
|
||||
Our chemical department has perfected an untargeted stem cell treatment.
|
||||
Consumption of the treatment will reverse the effects of mutation, and may
|
||||
even cure congenital defects. This substance has been denoted PE018.
|
||||
%
|
||||
Both PE012 and PE018 show great stability. A subject was exposed to both
|
||||
substances, alternating between the mutagen and the purifier. Ultimately, the
|
||||
subject returned to baseline state with no apparent side effects.
|
||||
%
|
||||
We have made a fascinating discovery; by creating a miniature portal with low
|
||||
stability and high power, one can transpose into the 4th dimension and return
|
||||
immediately, but shifted by several meters. Our subjects oscillated so
|
||||
quickly that none were even aware that they had visited lower planes.
|
||||
%
|
||||
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
|
||||
the phenomenon further, but subjects are expensive.
|
||||
%
|
||||
Test subjects in the teleportation department are showing alarming symptoms.
|
||||
It seems prolonged rapid transposition along the 4th dimension weakens the
|
||||
forces holding one on this plane.
|
||||
%
|
||||
Catastrophe struck in our teleportation department yesterday. It seems that
|
||||
our test subjects are so detached from this plane that they create occasional
|
||||
tunnels along the 4th dimension, allowing life forms to transfer to this
|
||||
plane. All subjects with prolonged exposure have been terminated.
|
||||
%
|
||||
Our lifeform extraction program continues to produce samples of specimen
|
||||
XE037. It seems to be a kind of living, semi-sentient primordal ooze, and is
|
||||
the basis of much of the life we have found.
|
||||
%
|
||||
Specimen XE037, jokingly referred to as "the blob," has been observed entering
|
||||
a kind of dormant state, forming a depression in the floor. Hendelson stepped
|
||||
into one of these pits yesterday, and was immediately coated and attacked.
|
||||
%
|
||||
XE037 shows promise as a catalyst for both cloning and treatments that mimic
|
||||
stem cells. This is further evidence supporting Hendelson's theory of a near
|
||||
universal symbiotic relationship involving XE037.
|
||||
%
|
||||
Several of the more advanced specimens we have retrieved show stunning
|
||||
similarity to XE037. XE142 and XE157 in particular show the same amorphous,
|
||||
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 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.
|
||||
This suggests that XE037, while compatible with subprime lifeforms, shows only
|
||||
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 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 entry below
|
||||
the surface, particularly in the sewage systems.
|
||||
%
|
||||
Today we applied a very small sample of XE037, suspended in water, to subject
|
||||
TP92, prior to necessary termination. During the postmortem examination, the
|
||||
subject went through a revivication progress, but displayed next to no human
|
||||
intelligence.
|
||||
%
|
||||
Mendelson shows a dismaying lack of organization and security consciousness.
|
||||
Containment of all samples of XE037 is of critical importance, as shown by
|
||||
contamination experiments.
|
||||
%
|
||||
Mendelson has been terminated following an incident with XE037. A substantial
|
||||
mobile sample departed his lab and encountered our security forces. Before
|
||||
the sample was destroyed, it managed to kill two men. Alarmingly, their
|
||||
corpses displayed mobility and extreme aggression.
|
||||
%
|
||||
We have created a new department to investigate the effects of XE037 on the
|
||||
human body, specifically to examine the revivification effect observed on two
|
||||
prior occasions. Sadly, our human subject pool is dwindling due to the short
|
||||
lifespan of subjects in this program. More will be acquired soon.
|
||||
%
|
||||
Testing XE037 on non-human mammal subjects does not appear to display the same
|
||||
revivifying effect, oddly enough. Acquiring non-human subjects, sadly, is a
|
||||
long and costly process, and research into this area is lacking.
|
||||
%
|
||||
After our curious results with testing XE037 on non-human mammals, we decided
|
||||
to introduce the substance to some of the insects which have found their way
|
||||
into the lab. Horrifyingly, XE037 caused near-instant mutation and gigantism
|
||||
in the insects, and security intervention was required.
|
||||
%
|
||||
Program S37ZBE, investigation of XE037 on inert human bodies, is making great
|
||||
strides. Recently we found that XE037 has no effect when introduced to a
|
||||
deceased body; revivication only occurs when the subject is exposed to XE037
|
||||
prior to expiration.
|
||||
%
|
||||
S37ZBE, the special investigation into the effects of XE037 on inert human
|
||||
bodies, has made terrific discoveries. It seems that it occasionally displays
|
||||
a mutagenic property which manifests itself after termination of the subject,
|
||||
resulting in a striking variety in postmortem morphology.
|
||||
%
|
||||
S37ZBE may be put on indefinate hold shortly. Postmortem morphological
|
||||
changes have reached extreme levels; this morning one subject nearly doubled
|
||||
in size, acquiring enough strength to reduce a concrete wall to rubble. It
|
||||
required a 6 man team, heavily armed, to re-terminate the subject.
|
||||
%
|
||||
Jakobson insists that S37ZBE must continue, despite the extreme security and
|
||||
safety risks. Nearly half our security forces have been redirected to the
|
||||
project, simply to deal with the occasional escape of a subject.
|
||||
%
|
||||
Jakobson was killed today by one of S37ZBE's subjects; ironic considering how
|
||||
hard he fought to keep the project active. Alarmingly, his corpse revivified
|
||||
immediately. This suggests that XE037 may have contaminated the lab at large.
|
||||
%
|
||||
Termination of a subject which was never a part of S37ZBE has confirmed my
|
||||
fears. XE037 has contaminated most if not all of the laboratory, most likely
|
||||
via the water supply. Research has started immediately into a process to
|
||||
destroy XE037 within the human body.
|
||||
%
|
||||
Despite a wide variety of treatments, we have been completely unsuccessful in
|
||||
removing XE037 from human subjects. Every individual displayed revivication
|
||||
post termination. Interestingly, XE037 seems to be completely inert prior to
|
||||
termination.
|
||||
%
|
||||
We have finally found success in S37BEP, our emergency investigation into the
|
||||
destruction of XE037 in living subjects. 8 of 10 of the subjects showed no
|
||||
revivication, despite confirmed dosages of XE037.
|
||||
%
|
||||
PE062, our "cure" for XE037 contamination, has neared perfection. Sadly, the
|
||||
production of PE062 is a costly and time-consuming process. What is more, the
|
||||
substance shows no effect on postmortem subjects whatsoever; a substance which
|
||||
renders XE037 inert after it has activated would be immensely useful in the
|
||||
case of an outbreak.
|
||||
%
|
||||
An alarming discovery has been made. A colony of XE037 has formed nearly a
|
||||
half mile from the laboratory. It is unclear how it escaped; it is quite
|
||||
possible that it is in the ground water now.
|
||||
%
|
||||
An emergency meeting was held today to discuss the possible implications of
|
||||
widespread XE037 contamination. It was agreed that neturalization must be
|
||||
instated immediately to prevent a catastrophic event.
|
||||
%
|
||||
It has begun. The XE037 contamination has spread for miles, and those who
|
||||
have since deceased have revivified. It is my fear that extremely large
|
||||
populations will be decimated by this pandemic. We must find a way to remove
|
||||
XE037 from revivified bodies.
|
||||
%
|
||||
Today we found our solution, quite by accident. It was found that XE037 is
|
||||
completely removed from a revivified body following a series of extremely-high
|
||||
energy 4th dimensional transpositions. Unfortunately, this invariably allows
|
||||
subplane life forms to pass into the prime plan. The cure is worse than the
|
||||
disease.
|
||||
%
|
||||
-186
@@ -1,186 +0,0 @@
|
||||
Squirrels are pretty yummy, but if you shoot them with a high-powered gun you'll probably be left with no meat! Use a BB gun or maybe a .22 rifle.
|
||||
|
||||
Ever run into those big worm things? If you see trails of churned-up dirt, you can be sure they're around.
|
||||
|
||||
I got chased last week by some big digging creature. I couldn't see it, but I could tell where it was by the trail of churned-up earth.
|
||||
|
||||
Try to stay on the roads as much as you can. Giant worms can't cross them!
|
||||
|
||||
Don't relax after killing a giant worm. Little bits of them can break off and still attack!
|
||||
|
||||
If you see a big mob of zombies coming, RUN! Trying to fight them all is suicide unless you have a big tactical advantage.
|
||||
|
||||
Watch out for those zombies that shriek; they'll let other zombies know where you are, and will attract them from all over.
|
||||
|
||||
Those acid-spitting zombies are pretty nasty, but if you're smart, you can get other zombies to wade through the acid.
|
||||
|
||||
If there's a pool of acid blocking your way, trying tossing a junk item into it. Eating up items will help neutralize the acid faster.
|
||||
|
||||
There's this type of zombie that can shoot bolts of lightning! Stay away from walls and stuff when they do... the electricity can travel along solid surfaces.
|
||||
|
||||
Zombie hulks are NASTY, but they're easy to outsmart. If there's other monsters between you and them, they'll kill the monster for you!
|
||||
|
||||
If you run into a zombie hulk, it's probably a good idea to run. They're fast as hell, but pretty dumb; they'll try to smash through obstacles rather than going around, and that slows them down a lot.
|
||||
|
||||
Zombie brutes and hulks have really tough hide. Don't bother shooting at them with lower-caliber guns, the bullet will bounce right off!
|
||||
|
||||
Try not to kill a boomer if it's standing right next to you. They tend to explode when they die, and that pink goop will get all over you.
|
||||
|
||||
Skeletons are a tough target. They're so skinny and full of holes that bullets fired at them will usually just fly right past.
|
||||
|
||||
Skeletons are too delicate to smash through doors or windows. They also can't smell you, unlike zombies, so if you turn your light off at night you can sneak right past.
|
||||
|
||||
Don't try to take on a skeleton with a bladed weapon... you'll just leave scratch marks. You've got to shatter those bones with a hammer or something.
|
||||
|
||||
It's a good idea to butcher corpses if you have the time, even if you don't plan on eating them. I've seen these weird zombies bring their friends back from the dead!
|
||||
|
||||
Triffids are tough. They've got natural armor, and it takes a lot to bring them down. I don't recommend getting into a fight with them.
|
||||
|
||||
Triffids can't see! They figure out where you are by your smell, but if you mask it with smoke or something, you're as good as invisible.
|
||||
|
||||
I figured out how to take care of those triffids! Let me just say this: they're made of wood, and wood and fire don't mix.
|
||||
|
||||
Have you heard about those queen triffids? You gotta keep your distance from them, unless you like having a tree grow right through your chest.
|
||||
|
||||
I have a buddy who was sleeping in this cabin way out in the woods, when he suddenly woke up to trees and vines growing right up through the floor and walls! He said it was some kind of huge triffid making it happen...
|
||||
|
||||
Oh man, have you gone down into the old subway systems? I'd be careful... there's these things down there that're like zombies, but tougher.
|
||||
|
||||
There's snakes down in most of the old sewer systems. They're slow on land, but boy, those suckers can swim fast!
|
||||
|
||||
If you're planning on wandering around the sewers--not that you'd have a reason too--watch out for those fish. Those suckers are fast, and vicious too!
|
||||
|
||||
Have you seen those eyebots flying around? It's hard to say, but some faction's controlling them--maybe the military. All I know is, I don't want them taking my picture...
|
||||
|
||||
Ever go toe-to-toe with a manhack? Tiny little helicopters covered in knives. Best be packing a shotgun!
|
||||
|
||||
They're rare, but molebots are nasty things. They bore through the ground, then pop up to stab ya. Still, you're safe from them if you stay on pavement...
|
||||
|
||||
Don't fire your gun if you can help it--the noise attracts monsters!
|
||||
|
||||
Standing behind a window is a good tactic. It takes zombies a long time to crawl through, giving you lots of opportunities to hit them.
|
||||
|
||||
Zombies are pretty dumb... heck, most monsters are! If you can get a fire going between you and them, they'll just run straight through it.
|
||||
|
||||
I know it's tempting to just go full-auto and unload as many bullets as possible, but don't except as a last resort. It's inaccurate and wastes ammo.
|
||||
|
||||
If there's a bunch of zombies in a straight line, try unloading a burst from your gun. Be sure to aim at the zombie furthest away; you'll hit more of them that way.
|
||||
|
||||
If you shoot a zombie, but don't quite kill it, try to finish it off with a punch or something instead of wasting a bullet.
|
||||
|
||||
If you're in a corridor or something, and there's a bunch of zombies chasing you down it, try to wound the guy in front badly. He'll start moving slow and cause a serious traffic jam!
|
||||
|
||||
Here's a trick for taking care of a huge swarm of zombies chasing you: head into a liquor store, shoot out as many bottles as you can, then light the alcohol on fire. Then duck out the back door, and watch the zombies run into a burning building!
|
||||
|
||||
Sledge hammers may seem like a great weapon, but swinging them is really slow, and you won't do much damage unless you're really strong.
|
||||
|
||||
For a good melee weapon, you can't beat a machete. I've seen a guy take down a zombie brute with one! Of course, if you can find a katana, that might be even better...
|
||||
|
||||
You know, a glass bottle can make a good weapon in a pinch. If you break it over someone's head, the shattering glass will hurt them extra. Of course, it might hurt your hands, too...
|
||||
|
||||
You know what makes a nice weapon? Take a two by four, or a baseball bat or something, and stick a bunch of nails through the end!
|
||||
|
||||
BB guns may seem like a joke, but they've got their uses. They're good for hunting small game, or getting to know the basics of rifles.
|
||||
|
||||
Crossbows are a great weapon for long term use. Most of the time, you can retrieve the bolt after shooting it, so running out of ammo is less of a concern.
|
||||
|
||||
It's good to keep a pistol handy, in case your main gun runs out of ammo or something. They're also better than most guns at short range.
|
||||
|
||||
Shotguns are nice; you can take out lots of baddies with a single shot. Just remember that they're noisy as hell, and you might end up attracting more than you kill.
|
||||
|
||||
A good submachine gun can't be beat. Most of them use common ammo, they're good at short and long range, and you can burst-fire if you need to!
|
||||
|
||||
Hunting rifles are great at long range, but suck close up. Plus, most of them don't carry many rounds. Keep a pistol as a sidearm if you use a rifle.
|
||||
|
||||
You know, you don't have to go full auto with an assault rifle. Firing single shots is more accurate and efficient!
|
||||
|
||||
I've seen a couple guys running around with laser pistols. They seem like the perfect weapon... quiet, accurate, and deadly. But I've never found one, and I bet ammo is wicked scarce...
|
||||
|
||||
When it comes to footwear, you've got two basic choices as far as I see it; sneakers, for running extra fast, or boots for durability. Depends on your style, I guess.
|
||||
|
||||
You don't really need to wear gloves most of the time, but once in a while they'll really come in handy.
|
||||
|
||||
It's good to keep a filter mask or gas mask handy. You never know when you'll have to go into a smoke-filled room or something.
|
||||
|
||||
There's basically no reason not to wear safety glasses... nothing's worse than taking a hit to the eyes and getting blinded for a few seconds.
|
||||
|
||||
Ski goggles are a great choice if you're worried about getting stuff in your eyes. Perfect for dealing with boomers!
|
||||
|
||||
If you get a pair of night vision goggles, hold on to them! A flashlight will give you away, but with goggles you can be sneaky.
|
||||
|
||||
I know they look dumb, but wearing a fanny pack gives you that extra bit of storage without encumbering you.
|
||||
|
||||
Backpacks let you carry lots of stuff, but they limit your movement a lot. If you're an unarmed fighter, don't wear one!
|
||||
|
||||
Don't underestimate a good book. Not only will it keep you company on lonely nights, but you can learn a hell of a lot from some of them.
|
||||
|
||||
It's a good idea to carry around a couple of empty bottles. You can fill them up with water, gasoline, or whatever!
|
||||
|
||||
If you need a bunch of rags for making molotov cocktails, take a pair of scissors to an old t-shirt or something.
|
||||
|
||||
Carrying a lighter is something all veterans do. It takes up almost no space, and can easily save your life.
|
||||
|
||||
If you can spare the space, you might want to carry a fire extinguisher along. Nothing's worse than being trapped in a burning building!
|
||||
|
||||
Crowbars not only make a pretty good weapon, they're also useful for opening locked doors and lifting manhole covers.
|
||||
|
||||
If you're spending the night in a dangerous area, grab a shovel and dig pits all around your camp.
|
||||
|
||||
A chainsaw may seem like a great weapon, but remember that they're slow, unwieldy, and very noisy.
|
||||
|
||||
Bubblewrap is pretty harmless, but setting it up around you before going to sleep will keep you from waking up to a zombie punching you.
|
||||
|
||||
Beartraps are a nice way to cover an escape. If you place one in a doorway, the first zombie through will get stuck, and the rest won't be able to get past!
|
||||
|
||||
Smoke grenades aren't really offensive weapons, but they'll cover up your scent and hide you from view--perfect for making a quick escape.
|
||||
|
||||
Don't use molotovs indoors. Especially in a liquor store.
|
||||
|
||||
If you're going to be playing with molotov cocktails around a gas station, just make sure you're a long way from those pumps.
|
||||
|
||||
I once knew a guy who figured he'd survive a night in the subway by setting fires blocking off the tunnel in both directions and sleeping between them. He wound up asphyxiating on the smoke.
|
||||
|
||||
Don't light a molotov until you're ready to throw it. Not only can they go out, but if you accidentally drop it or something, you're in trouble.
|
||||
|
||||
If you're weak or clumsy, it might be a good idea not to mess with molotovs or grenades. Accidentally dropping them when you meant to throw them could be deadly.
|
||||
|
||||
If you're wandering in the wilderness, or following a road, keep an eye out for wild strawberries or blueberries.
|
||||
|
||||
Be careful eating wild mushrooms. Some are poisonous, and others can make you hallucinate.
|
||||
|
||||
Try to go around swamps, if you can. Some of them have sinkholes that can pull you right underground.
|
||||
|
||||
I heard about this group that raided a bee hive a while ago. Everyone got massacred but one, and he came home with this weird, magic honey stuff.
|
||||
|
||||
If you need to, you can swim across a river to escape; most monsters can't swim. Just make sure you drop as much stuff as possible first, and maybe strip naked, or you'll sink like a rock.
|
||||
|
||||
Houses can be a surprisingly good resource for all kinds of stuff; clothing, medication, food, books, and more.
|
||||
|
||||
While there's not much to loot, gas stations are a good source for gasoline, to power tools or to make molotov cocktails.
|
||||
|
||||
It's not like in the movies--shooting a gas pump won't make it explode. But it WILL make it leak all over the place, which is a definite fire hazard.
|
||||
|
||||
I know grocery stores and stuff are full of fruit, but be careful, it's probably rotten.
|
||||
|
||||
Next time you visit a grocery store, load up on canned goods. They never go bad!
|
||||
|
||||
I've found more good weapons in hardware stores than anywhere else. Except gun stores, of course.
|
||||
|
||||
Liquor stores are a great place to pick up non-alcoholic beverages, too. Not that I mind alcohol!
|
||||
|
||||
Most gun stores follow pretty similar layouts. The restricted stuff--SMGs, assault rifles, and most importantly ammo--are always behind the counter.
|
||||
|
||||
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 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.
|
||||
|
||||
I've thought about raiding an ant hill before, but I realized it wasn't worth the risk. I doubt they have any loot beyond some scraps of food, you know?
|
||||
|
||||
This guy I know was walking through the subway when he came across a giant rift in the earth, with lava far below. Weird, huh?
|
||||
|
||||
In a lot of places, there's little hallways connecting the subways with the sewers, with heavy metal doors on both ends. It's a perfect place to sleep!
|
||||
|
||||
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.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB |
@@ -1,17 +0,0 @@
|
||||
# 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
|
||||
@@ -1,302 +0,0 @@
|
||||
[
|
||||
{ "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" }
|
||||
]
|
||||
@@ -1,142 +0,0 @@
|
||||
[
|
||||
[
|
||||
"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."
|
||||
]
|
||||
]
|
||||
Binary file not shown.
@@ -1,217 +0,0 @@
|
||||
#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:
|
||||
@@ -1,105 +0,0 @@
|
||||
#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
File diff suppressed because it is too large
Load Diff
-416
@@ -1,416 +0,0 @@
|
||||
#ifndef _DIALOGUE_H_
|
||||
#define _DIALOGUE_H_
|
||||
|
||||
#include "player.h"
|
||||
#include "output.h"
|
||||
#include "npc.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct dialogue {
|
||||
player *alpha;
|
||||
npc *beta;
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
void start_mugging (game *g, npc *p);
|
||||
void player_leaving (game *g, npc *p);
|
||||
|
||||
void drop_weapon (game *g, npc *p);
|
||||
void player_weapon_away (game *g, npc *p);
|
||||
void player_weapon_drop (game *g, npc *p);
|
||||
|
||||
void lead_to_safety (game *g, npc *p);
|
||||
void start_training (game *g, npc *p);
|
||||
|
||||
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> <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 <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 <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, <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?",
|
||||
"<ill_die> without something to drink.", "You got anything to drink?"}
|
||||
/*
|
||||
{"<ill_die> unless I get healed<punc>", "You gotta heal me up, <name_g><punc>",
|
||||
"Help me<punc> <ill_die> if you don't heal me<punc>",
|
||||
"Please... I need medical help<punc>", "
|
||||
*/
|
||||
};
|
||||
|
||||
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 <swear> weapon down!",
|
||||
"Drop the <yrwp>, <name_b>!",
|
||||
"Drop the <swear> <yrwp>!",
|
||||
"Drop your <yrwp>!",
|
||||
"Put down the <yrwp>!",
|
||||
"Drop your <swear> weapon, <name_b>!",
|
||||
"Put down your <yrwp>!",
|
||||
"Alright, drop the <yrwp>!"
|
||||
};
|
||||
|
||||
std::string talk_hands_up[10] = {
|
||||
"Put your <swear> hands up!",
|
||||
"Put your hands up, <name_b>!",
|
||||
"Reach for the sky!",
|
||||
"Hands up!",
|
||||
"Hands in the air!",
|
||||
"Hands up, <name_b>!",
|
||||
"Hands where I can see them!",
|
||||
"Okay <name_b>, hands up!",
|
||||
"Okay <name_b><punc> hands up!",
|
||||
"Hands in the air, <name_b>!"
|
||||
};
|
||||
|
||||
std::string talk_no_faction[10] = {
|
||||
"I'm unaffiliated.",
|
||||
"I don't run with a crew.",
|
||||
"I'm a solo artist, <okay>?",
|
||||
"I don't kowtow to any group, <okay>?",
|
||||
"I'm a freelancer.",
|
||||
"I work alone, <name_g>.",
|
||||
"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>."
|
||||
};
|
||||
|
||||
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
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
||||
#ifndef _DISEASE_H_
|
||||
#define _DISEASE_H_
|
||||
|
||||
#include "rng.h"
|
||||
#include "game.h"
|
||||
#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);
|
||||
|
||||
void dis_effect(game *g, player &p, disease &dis);
|
||||
|
||||
int disease_speed_boost(disease dis);
|
||||
|
||||
std::string dis_name(disease dis);
|
||||
|
||||
std::string dis_description(disease dis);
|
||||
|
||||
#endif
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
docker run --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
--volume="$PWD/vendor/bundle:/usr/local/bundle" \
|
||||
-p 4000:4000 \
|
||||
-it jekyll/jekyll \
|
||||
jekyll serve
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Donations"
|
||||
permalink: /donations/
|
||||
---
|
||||
|
||||
If ever you wanted to give back to Cataclysm: Dark Days Ahead, this is the place! There are multiple ways to give out monetary help: you can either help fund the forums through the [official Patreon](https://www.patreon.com/user?u=15922455) or help sponsor individual developers.
|
||||
|
||||
|
||||
### Sponsor a developer
|
||||
[KorGgenT](https://github.com/CleverRaven/Cataclysm-DDA/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Amerged+author%3AKorGgenT) - [Donate via Github Sponsors](https://github.com/sponsors/KorGgenT)
|
||||
|
||||
[John-Candlebury](https://github.com/CleverRaven/Cataclysm-DDA/pulls?q=is%3Apr+is%3Amerged+author%3AJohn-Candlebury) - [Donate via Patreon](https://www.patreon.com/Candlebury)
|
||||
|
||||
[gettingusedto](https://github.com/I-am-Erk/CDDA-Tilesets/pulls?q=is%3Apr+is%3Amerged+author%3Agettingusedto+) - [Donate via Ko-fi](https://ko-fi.com/gettingusedto)
|
||||
|
||||
[nameless-kitty](https://github.com/CleverRaven/Cataclysm-DDA/pulls?q=is%3Apr+is%3Amerged+author%3Akuutekitty) - [Donate via Ko-fi](https://ko-fi.com/namelesskitty)
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef _ENUMS_H_
|
||||
#define _ENUMS_H_
|
||||
|
||||
#ifndef sgn
|
||||
#define sgn(x) (((x) < 0) ? -1 : 1)
|
||||
#endif
|
||||
|
||||
enum material {
|
||||
MNULL = 0,
|
||||
//Food Materials
|
||||
LIQUID, VEGGY, FLESH, POWDER,
|
||||
//Clothing
|
||||
COTTON, WOOL, LEATHER, KEVLAR,
|
||||
//Other
|
||||
STONE, PAPER, WOOD, PLASTIC, GLASS, IRON, STEEL, SILVER
|
||||
};
|
||||
|
||||
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
|
||||
@@ -1,258 +0,0 @@
|
||||
#include "event.h"
|
||||
#include "npc.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
|
||||
void event::actualize(game *g)
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case EVENT_HELP: {
|
||||
npc tmp;
|
||||
int num = 1;
|
||||
if (faction_id >= 0)
|
||||
num = rng(1, 6);
|
||||
for (int i = 0; i < num; i++) {
|
||||
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;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef _EVENT_H_
|
||||
#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;
|
||||
int faction_id;
|
||||
point map_point;
|
||||
|
||||
event() {
|
||||
type = EVENT_NULL;
|
||||
turn = 0;
|
||||
faction_id = -1;
|
||||
map_point.x = -1;
|
||||
map_point.y = -1;
|
||||
}
|
||||
|
||||
event(event_type e_t, int t, int f_id, int x, int y) {
|
||||
type = e_t;
|
||||
turn = t;
|
||||
faction_id = f_id;
|
||||
map_point.x = x;
|
||||
map_point.y = y;
|
||||
}
|
||||
|
||||
void actualize(game *g); // When the time runs out
|
||||
void per_turn(game *g); // Every turn
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,113 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
std::string faction_adj_pos[15] = {
|
||||
"Shining", "Sacred", "Golden", "Holy", "Righteous", "Devoted", "Virtuous",
|
||||
"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",
|
||||
"Pernicious", "Dread"};
|
||||
|
||||
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"};
|
||||
|
||||
|
||||
struct faction_value_datum {
|
||||
std::string name;
|
||||
int good; // A measure of how "good" the value is (naming purposes &c)
|
||||
int strength;
|
||||
int sneak;
|
||||
int crime;
|
||||
int cult;
|
||||
};
|
||||
|
||||
faction_value_datum facgoal_data[NUM_FACGOALS] = {
|
||||
// "Their ultimate goal is <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"Null", 0, 0, 0, 0, 0},
|
||||
{"basic survival", 0, 0, 0, 0, 0},
|
||||
{"financial wealth", 0, -1, 0, 2, -1},
|
||||
{"dominance of the region", -1, 1, -1, 1, -1},
|
||||
{"the extermination of monsters",1, 3, -1, -1, -1},
|
||||
{"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, 2, -1, 0},
|
||||
{"harmony with nature", 2, -2, 0, -1, 2},
|
||||
{"rebuilding civilization", 2, 1, -2, -2, -4},
|
||||
{"spreading the fungus", -2, 1, 1, 0, 4}
|
||||
};
|
||||
// TOTAL: -5 3 -2 0 7
|
||||
|
||||
faction_value_datum facjob_data[NUM_FACJOBS] = {
|
||||
// "They earn money via <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"Null", 0, 0, 0, 0, 0},
|
||||
{"protection rackets", -3, 2, -1, 4, 0},
|
||||
{"the sale of information", -1, -1, 4, 1, 0},
|
||||
{"their bustling trade centers", 1, -1, -2, -4, -4},
|
||||
{"trade caravans", 2, -1, -1, -3, -2},
|
||||
{"scavenging supplies", 0, -1, 0, -1, -1},
|
||||
{"mercenary work", 0, 3, -1, 1, -1},
|
||||
{"assassinations", -1, 2, 2, 1, 1},
|
||||
{"raiding settlements", -4, 4, -3, 3, -2},
|
||||
{"the theft of property", -3, -1, 4, 4, 1},
|
||||
{"gambling parlors", -1, -2, -1, 1, -1},
|
||||
{"medical aid", 4, -3, -2, -3, 0},
|
||||
{"farming & selling food", 3, -4, -2, -4, 1},
|
||||
{"drug dealing", -2, 0, -1, 2, 0},
|
||||
{"selling manufactured goods", 1, 0, -1, -2, 0}
|
||||
};
|
||||
// TOTAL: -5 -3 -5 0 -6
|
||||
|
||||
faction_value_datum facval_data[NUM_FACVALS] = {
|
||||
// "They are known for <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"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, -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, -1, 1},
|
||||
{"their adherance to the law", 2, -1, -1, -4, -1},
|
||||
{"their cruelty", -3, 1, -1, 4, 1}
|
||||
};
|
||||
// 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
|
||||
* strength valued a bit higher than the others.
|
||||
*/
|
||||
|
||||
-558
@@ -1,558 +0,0 @@
|
||||
#include "faction.h"
|
||||
#include "facdata.h"
|
||||
#include "rng.h"
|
||||
#include "math.h"
|
||||
#include "output.h"
|
||||
#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;
|
||||
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;
|
||||
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
|
||||
// TODO: Not always in overmap 0,0
|
||||
omx = 0;
|
||||
omy = 0;
|
||||
mapx = rng(OMAPX / 10, OMAPX - OMAPX / 10);
|
||||
mapy = rng(OMAPY / 10, OMAPY - OMAPY / 10);
|
||||
// Pick an overall goal.
|
||||
goal = faction_goal(rng(1, NUM_FACGOALS - 1));
|
||||
if (one_in(4))
|
||||
goal = FACGOAL_NONE; // Slightly more likely to not have a real goal
|
||||
good = facgoal_data[goal].good;
|
||||
strength = facgoal_data[goal].strength;
|
||||
sneak = facgoal_data[goal].sneak;
|
||||
crime = facgoal_data[goal].crime;
|
||||
cult = facgoal_data[goal].cult;
|
||||
job1 = faction_job(rng(1, NUM_FACJOBS - 1));
|
||||
do
|
||||
job2 = faction_job(rng(0, NUM_FACJOBS - 1));
|
||||
while (job2 == job1);
|
||||
good += facjob_data[job1].good + facjob_data[job2].good;
|
||||
strength += facjob_data[job1].strength + facjob_data[job2].strength;
|
||||
sneak += facjob_data[job1].sneak + facjob_data[job2].sneak;
|
||||
crime += facjob_data[job1].crime + facjob_data[job2].crime;
|
||||
cult += facjob_data[job1].cult + facjob_data[job2].cult;
|
||||
|
||||
int num_values = 0;
|
||||
int tries = 0;
|
||||
values = 0;
|
||||
do {
|
||||
int v = rng(1, NUM_FACVALS - 1);
|
||||
if (!has_value(faction_value(v)) && matches_us(faction_value(v))) {
|
||||
values |= mfb(v);
|
||||
tries = 0;
|
||||
num_values++;
|
||||
good += facval_data[v].good;
|
||||
strength += facval_data[v].strength;
|
||||
sneak += facval_data[v].sneak;
|
||||
crime += facval_data[v].crime;
|
||||
cult += facval_data[v].cult;
|
||||
} else
|
||||
tries++;
|
||||
} while((one_in(num_values) || one_in(num_values)) && tries < 15);
|
||||
|
||||
std::string noun;
|
||||
int sel = 1, best = strength;
|
||||
if (sneak > best) {
|
||||
sel = 2;
|
||||
best = sneak;
|
||||
}
|
||||
if (crime > best) {
|
||||
sel = 3;
|
||||
best = crime;
|
||||
}
|
||||
if (cult > best)
|
||||
sel = 4;
|
||||
if (strength <= 0 && sneak <= 0 && crime <= 0 && cult <= 0)
|
||||
sel = 0;
|
||||
|
||||
switch (sel) {
|
||||
case 1:
|
||||
noun = faction_noun_strong[rng(0, 14)];
|
||||
power = dice(5, 20);
|
||||
size = dice(5, 6);
|
||||
break;
|
||||
case 2:
|
||||
noun = faction_noun_sneak [rng(0, 14)];
|
||||
power = dice(5, 8);
|
||||
size = dice(5, 8);
|
||||
break;
|
||||
case 3:
|
||||
noun = faction_noun_crime [rng(0, 14)];
|
||||
power = dice(5, 16);
|
||||
size = dice(5, 8);
|
||||
break;
|
||||
case 4:
|
||||
noun = faction_noun_cult [rng(0, 14)];
|
||||
power = dice(8, 8);
|
||||
size = dice(4, 6);
|
||||
break;
|
||||
default:
|
||||
noun = faction_noun_none [rng(0, 14)];
|
||||
power = dice(6, 8);
|
||||
size = dice(6, 6);
|
||||
}
|
||||
|
||||
if (one_in(4)) {
|
||||
do
|
||||
name = "The " + noun + " of " + invent_name();
|
||||
while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
else if (one_in(2)) {
|
||||
do
|
||||
name = "The " + invent_adj() + " " + noun;
|
||||
while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
std::string adj;
|
||||
if (good >= 3)
|
||||
adj = faction_adj_pos[rng(0, 14)];
|
||||
else if (good <= -3)
|
||||
adj = faction_adj_bad[rng(0, 14)];
|
||||
else
|
||||
adj = faction_adj_neu[rng(0, 14)];
|
||||
name = "The " + adj + " " + noun;
|
||||
if (one_in(4))
|
||||
name += " of " + invent_name();
|
||||
} while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void faction::make_army()
|
||||
{
|
||||
name = "The army";
|
||||
omx = 0;
|
||||
omy = 0;
|
||||
mapx = OMAPX / 2;
|
||||
mapy = OMAPY / 2;
|
||||
size = OMAPX * 2;
|
||||
power = OMAPX;
|
||||
goal = FACGOAL_DOMINANCE;
|
||||
job1 = FACJOB_MERCENARIES;
|
||||
job2 = FACJOB_NULL;
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_CHARITABLE);
|
||||
if (!one_in(4))
|
||||
values |= mfb(FACVAL_EXPLORATION);
|
||||
if (one_in(3))
|
||||
values |= mfb(FACVAL_BIONICS);
|
||||
if (one_in(3))
|
||||
values |= mfb(FACVAL_ROBOTS);
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_TREACHERY);
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_STRAIGHTEDGE);
|
||||
if (!one_in(3))
|
||||
values |= mfb(FACVAL_LAWFUL);
|
||||
if (one_in(8))
|
||||
values |= mfb(FACVAL_CRUELTY);
|
||||
id = 0;
|
||||
}
|
||||
|
||||
bool faction::has_job(faction_job j)
|
||||
{
|
||||
return (job1 == j || job2 == j);
|
||||
}
|
||||
|
||||
bool faction::has_value(faction_value v)
|
||||
{
|
||||
return values & mfb(v);
|
||||
}
|
||||
|
||||
bool faction::matches_us(faction_value v)
|
||||
{
|
||||
int numvals = 2;
|
||||
if (job2 != FACJOB_NULL)
|
||||
numvals++;
|
||||
for (int i = 0; i < NUM_FACVALS; i++) {
|
||||
if (has_value(faction_value(i)))
|
||||
numvals++;
|
||||
}
|
||||
if (has_job(FACJOB_DRUGS) && v == FACVAL_STRAIGHTEDGE) // Mutually exclusive
|
||||
return false;
|
||||
int avggood = (good / numvals + good) / 2;
|
||||
int avgstrength = (strength / numvals + strength) / 2;
|
||||
int avgsneak = (sneak / numvals + sneak / 2);
|
||||
int avgcrime = (crime / numvals + crime / 2);
|
||||
int avgcult = (cult / numvals + cult / 2);
|
||||
/*
|
||||
debugmsg("AVG: GOO %d STR %d SNK %d CRM %d CLT %d\n\
|
||||
VAL: GOO %d STR %d SNK %d CRM %d CLT %d (%s)", avggood, avgstrength,
|
||||
avgsneak, avgcrime, avgcult, facval_data[v].good, facval_data[v].strength,
|
||||
facval_data[v].sneak, facval_data[v].crime, facval_data[v].cult,
|
||||
facval_data[v].name.c_str());
|
||||
*/
|
||||
if ((abs(facval_data[v].good - avggood) <= 3 ||
|
||||
(avggood >= 5 && facval_data[v].good >= 1) ||
|
||||
(avggood <= -5 && facval_data[v].good <= 0)) &&
|
||||
(abs(facval_data[v].strength - avgstrength) <= 5 ||
|
||||
(avgstrength >= 5 && facval_data[v].strength >= 3) ||
|
||||
(avgstrength <= -5 && facval_data[v].strength <= -1)) &&
|
||||
(abs(facval_data[v].sneak - avgsneak) <= 4 ||
|
||||
(avgsneak >= 5 && facval_data[v].sneak >= 1) ||
|
||||
(avgsneak <= -5 && facval_data[v].sneak <= -1)) &&
|
||||
(abs(facval_data[v].crime - avgcrime) <= 4 ||
|
||||
(avgcrime >= 5 && facval_data[v].crime >= 0) ||
|
||||
(avgcrime <= -5 && facval_data[v].crime <= -1)) &&
|
||||
(abs(facval_data[v].cult - avgcult) <= 3 ||
|
||||
(avgcult >= 5 && facval_data[v].cult >= 1) ||
|
||||
(avgcult <= -5 && facval_data[v].cult <= -1)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string faction::describe()
|
||||
{
|
||||
std::string ret = name + " have the ultimate goal of " +
|
||||
facgoal_data[goal].name + ". Their primary concern is " +
|
||||
facjob_data[job1].name;
|
||||
if (job2 == FACJOB_NULL)
|
||||
ret += ".";
|
||||
else
|
||||
ret += ", but they are also involved in " + facjob_data[job2].name + ".";
|
||||
if (values != 0) {
|
||||
ret += " They are known for ";
|
||||
for (int i = 0; i < NUM_FACVALS; i++) {
|
||||
if (has_value(faction_value(i)))
|
||||
ret += facval_data[i].name + ", ";
|
||||
}
|
||||
}
|
||||
size_t pos = ret.find_last_of(",");
|
||||
if (pos != std::string::npos) {
|
||||
ret.replace(pos, 2, ".");
|
||||
pos = ret.find_last_of(",");
|
||||
if (pos != std::string::npos)
|
||||
ret.replace(pos, 2, ", and ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int faction::response_time(game *g)
|
||||
{
|
||||
int base = abs(mapx - g->levx);
|
||||
if (abs(mapy - g->levy) > base)
|
||||
base = abs(mapy - g->levy);
|
||||
if (base > size) // Out of our sphere of influence
|
||||
base *= 2.5;
|
||||
base *= 24; // 24 turns to move one overmap square
|
||||
int maxdiv = 10;
|
||||
if (goal == FACGOAL_DOMINANCE)
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_CARAVANS))
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_SCAVENGE))
|
||||
maxdiv++;
|
||||
if (has_job(FACJOB_MERCENARIES))
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_FARMERS))
|
||||
maxdiv -= 2;
|
||||
if (has_value(FACVAL_EXPLORATION))
|
||||
maxdiv += 2;
|
||||
if (has_value(FACVAL_LONERS))
|
||||
maxdiv -= 3;
|
||||
if (has_value(FACVAL_TREACHERY))
|
||||
maxdiv -= rng(0, 3);
|
||||
int mindiv = (maxdiv > 9 ? maxdiv - 9 : 1);
|
||||
base /= rng(mindiv, maxdiv);// We might be in the field
|
||||
base -= likes_u; // We'll hurry, if we like you
|
||||
if (base < 100)
|
||||
base = 100;
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
// END faction:: MEMBER FUNCTIONS
|
||||
|
||||
|
||||
std::string invent_name()
|
||||
{
|
||||
std::string ret = "";
|
||||
std::string tmp;
|
||||
int syllables = rng(2, 3);
|
||||
for (int i = 0; i < syllables; i++) {
|
||||
switch (rng(0, 25)) {
|
||||
case 0: tmp = "ab"; break;
|
||||
case 1: tmp = "bon"; break;
|
||||
case 2: tmp = "cor"; break;
|
||||
case 3: tmp = "den"; break;
|
||||
case 4: tmp = "el"; break;
|
||||
case 5: tmp = "fes"; break;
|
||||
case 6: tmp = "gun"; break;
|
||||
case 7: tmp = "hit"; break;
|
||||
case 8: tmp = "id"; break;
|
||||
case 9: tmp = "jan"; break;
|
||||
case 10: tmp = "kal"; break;
|
||||
case 11: tmp = "ler"; break;
|
||||
case 12: tmp = "mal"; break;
|
||||
case 13: tmp = "nor"; break;
|
||||
case 14: tmp = "or"; break;
|
||||
case 15: tmp = "pan"; break;
|
||||
case 16: tmp = "qua"; break;
|
||||
case 17: tmp = "ros"; break;
|
||||
case 18: tmp = "sin"; break;
|
||||
case 19: tmp = "tor"; break;
|
||||
case 20: tmp = "urr"; break;
|
||||
case 21: tmp = "ven"; break;
|
||||
case 22: tmp = "wel"; break;
|
||||
case 23: tmp = "oxo"; break;
|
||||
case 24: tmp = "yen"; break;
|
||||
case 25: tmp = "zu"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
}
|
||||
ret[0] += 'A' - 'a';
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string invent_adj()
|
||||
{
|
||||
int syllables = dice(2, 2) - 1;
|
||||
std::string ret, tmp;
|
||||
switch (rng(0, 25)) {
|
||||
case 0: ret = "Ald"; break;
|
||||
case 1: ret = "Brogg"; break;
|
||||
case 2: ret = "Cald"; break;
|
||||
case 3: ret = "Dredd"; break;
|
||||
case 4: ret = "Eld"; break;
|
||||
case 5: ret = "Forr"; break;
|
||||
case 6: ret = "Gugg"; break;
|
||||
case 7: ret = "Horr"; break;
|
||||
case 8: ret = "Ill"; break;
|
||||
case 9: ret = "Jov"; break;
|
||||
case 10: ret = "Kok"; break;
|
||||
case 11: ret = "Lill"; break;
|
||||
case 12: ret = "Moom"; break;
|
||||
case 13: ret = "Nov"; break;
|
||||
case 14: ret = "Orb"; break;
|
||||
case 15: ret = "Perv"; break;
|
||||
case 16: ret = "Quot"; break;
|
||||
case 17: ret = "Rar"; break;
|
||||
case 18: ret = "Suss"; break;
|
||||
case 19: ret = "Torr"; break;
|
||||
case 20: ret = "Umbr"; break;
|
||||
case 21: ret = "Viv"; break;
|
||||
case 22: ret = "Warr"; break;
|
||||
case 23: ret = "Xen"; break;
|
||||
case 24: ret = "Yend"; break;
|
||||
case 25: ret = "Zor"; break;
|
||||
}
|
||||
for (int i = 0; i < syllables - 2; i++) {
|
||||
switch (rng(0, 17)) {
|
||||
case 0: tmp = "al"; break;
|
||||
case 1: tmp = "arn"; break;
|
||||
case 2: tmp = "astr"; break;
|
||||
case 3: tmp = "antr"; break;
|
||||
case 4: tmp = "ent"; break;
|
||||
case 5: tmp = "ell"; break;
|
||||
case 6: tmp = "ev"; break;
|
||||
case 7: tmp = "emm"; break;
|
||||
case 8: tmp = "empr"; break;
|
||||
case 9: tmp = "ill"; break;
|
||||
case 10: tmp = "ial"; break;
|
||||
case 11: tmp = "ior"; break;
|
||||
case 12: tmp = "ordr"; break;
|
||||
case 13: tmp = "oth"; break;
|
||||
case 14: tmp = "omn"; break;
|
||||
case 15: tmp = "uv"; break;
|
||||
case 16: tmp = "ulv"; break;
|
||||
case 17: tmp = "urn"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
}
|
||||
switch (rng(0, 24)) {
|
||||
case 0: tmp = ""; break;
|
||||
case 1: tmp = "al"; break;
|
||||
case 2: tmp = "an"; break;
|
||||
case 3: tmp = "ard"; break;
|
||||
case 4: tmp = "ate"; break;
|
||||
case 5: tmp = "e"; break;
|
||||
case 6: tmp = "ed"; break;
|
||||
case 7: tmp = "en"; break;
|
||||
case 8: tmp = "er"; break;
|
||||
case 9: tmp = "ial"; break;
|
||||
case 10: tmp = "ian"; break;
|
||||
case 11: tmp = "iated"; break;
|
||||
case 12: tmp = "ier"; break;
|
||||
case 13: tmp = "ious"; break;
|
||||
case 14: tmp = "ish"; break;
|
||||
case 15: tmp = "ive"; break;
|
||||
case 16: tmp = "oo"; break;
|
||||
case 17: tmp = "or"; break;
|
||||
case 18: tmp = "oth"; break;
|
||||
case 19: tmp = "old"; break;
|
||||
case 20: tmp = "ous"; break;
|
||||
case 21: tmp = "ul"; break;
|
||||
case 22: tmp = "un"; break;
|
||||
case 23: tmp = "ule"; break;
|
||||
case 24: tmp = "y"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Used in game.cpp
|
||||
std::string fac_ranking_text(int val)
|
||||
{
|
||||
if (val <= -100)
|
||||
return "Archenemy";
|
||||
if (val <= -80)
|
||||
return "Wanted Dead";
|
||||
if (val <= -60)
|
||||
return "Enemy of the People";
|
||||
if (val <= -40)
|
||||
return "Wanted Criminal";
|
||||
if (val <= -20)
|
||||
return "Not Welcome";
|
||||
if (val <= -10)
|
||||
return "Pariah";
|
||||
if (val <= -5)
|
||||
return "Disliked";
|
||||
if (val >= 100)
|
||||
return "Hero";
|
||||
if (val >= 80)
|
||||
return "Idol";
|
||||
if (val >= 60)
|
||||
return "Beloved";
|
||||
if (val >= 40)
|
||||
return "Highly Valued";
|
||||
if (val >= 20)
|
||||
return "Valued";
|
||||
if (val >= 10)
|
||||
return "Well-Liked";
|
||||
if (val >= 5)
|
||||
return "Liked";
|
||||
|
||||
return "Neutral";
|
||||
}
|
||||
|
||||
// Used in game.cpp
|
||||
std::string fac_respect_text(int val)
|
||||
{
|
||||
// Respected, feared, etc.
|
||||
if (val >= 100)
|
||||
return "Legendary";
|
||||
if (val >= 80)
|
||||
return "Unchallenged";
|
||||
if (val >= 60)
|
||||
return "Mighty";
|
||||
if (val >= 40)
|
||||
return "Famous";
|
||||
if (val >= 20)
|
||||
return "Well-Known";
|
||||
if (val >= 10)
|
||||
return "Spoken Of";
|
||||
|
||||
// Disrepected, laughed at, etc.
|
||||
if (val <= -100)
|
||||
return "Worthless Scum";
|
||||
if (val <= -80)
|
||||
return "Vermin";
|
||||
if (val <= -60)
|
||||
return "Despicable";
|
||||
if (val <= -40)
|
||||
return "Parasite";
|
||||
if (val <= -20)
|
||||
return "Leech";
|
||||
if (val <= -10)
|
||||
return "Laughingstock";
|
||||
|
||||
return "Neutral";
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
#ifndef _FACTION_H_
|
||||
#define _FACTION_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// TODO: Redefine?
|
||||
#define MAX_FAC_NAME_SIZE 40
|
||||
|
||||
#ifndef mfb
|
||||
#define mfb(n) long(1 << (n))
|
||||
#endif
|
||||
|
||||
std::string fac_ranking_text(int val);
|
||||
std::string fac_respect_text(int val);
|
||||
|
||||
class game;
|
||||
|
||||
enum faction_goal {
|
||||
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
|
||||
};
|
||||
|
||||
enum faction_job {
|
||||
FACJOB_NULL = 0,
|
||||
FACJOB_EXTORTION, // Protection rackets, etc
|
||||
FACJOB_INFORMATION, // Gathering & sale of information
|
||||
FACJOB_TRADE, // Bazaars, etc.
|
||||
FACJOB_CARAVANS, // Transportation of goods
|
||||
FACJOB_SCAVENGE, // Scavenging & sale of general supplies
|
||||
FACJOB_MERCENARIES, // General fighters-for-hire
|
||||
FACJOB_ASSASSINS, // Targeted discreet killing
|
||||
FACJOB_RAIDERS, // Raiding settlements, trade routes, &c
|
||||
FACJOB_THIEVES, // Less violent; theft of property without killing
|
||||
FACJOB_GAMBLING, // Maitenance of gambling parlors
|
||||
FACJOB_DOCTORS, // Doctors for hire
|
||||
FACJOB_FARMERS, // Farming & sale of food
|
||||
FACJOB_DRUGS, // Drug dealing
|
||||
FACJOB_MANUFACTURE, // Manufacturing & selling goods
|
||||
NUM_FACJOBS
|
||||
};
|
||||
|
||||
enum faction_value {
|
||||
FACVAL_NULL = 0,
|
||||
FACVAL_CHARITABLE, // Give their job for free (often)
|
||||
FACVAL_LONERS, // Avoid associating with outsiders
|
||||
FACVAL_EXPLORATION, // Like to explore new territory
|
||||
FACVAL_ARTIFACTS, // Seek out unique items
|
||||
FACVAL_BIONICS, // Collection & installation of bionic parts
|
||||
FACVAL_BOOKS, // Collection of books
|
||||
FACVAL_TRAINING, // Training among themselves and others
|
||||
FACVAL_ROBOTS, // Creation / use of robots
|
||||
FACVAL_TREACHERY, // Untrustworthy
|
||||
FACVAL_STRAIGHTEDGE, // No drugs, alcohol, etc.
|
||||
FACVAL_LAWFUL, // Abide by the old laws
|
||||
FACVAL_CRUELTY, // Torture, murder, etc.
|
||||
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);
|
||||
bool has_value(faction_value v);
|
||||
bool matches_us(faction_value v);
|
||||
std::string describe();
|
||||
|
||||
int response_time(game *g); // Time it takes for them to get to u
|
||||
|
||||
std::string name;
|
||||
unsigned values : NUM_FACVALS; // Bitfield of values
|
||||
faction_goal goal;
|
||||
faction_job job1, job2;
|
||||
std::vector<int> opinion_of;
|
||||
int likes_u;
|
||||
int respects_u;
|
||||
bool known_by_u;
|
||||
int id;
|
||||
int strength, sneak, crime, cult, good; // Defining values
|
||||
int omx, omy; // Which overmap are we based in?
|
||||
int mapx, mapy;// Where in that overmap are we?
|
||||
int size; // How big is our sphere of influence?
|
||||
int power; // General measure of our power
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,989 +0,0 @@
|
||||
#include "rng.h"
|
||||
#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 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 || 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:
|
||||
break; // Do nothing, obviously. OBVIOUSLY.
|
||||
|
||||
case fd_blood:
|
||||
case fd_bile:
|
||||
if (has_flag(swimmable, x, y)) // Dissipate faster in water
|
||||
cur->age += 250;
|
||||
break;
|
||||
|
||||
case fd_acid:
|
||||
if (has_flag(swimmable, x, y)) // Dissipate faster in water
|
||||
cur->age += 20;
|
||||
for (int i = 0; i < i_at(x, y).size(); 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_sap:
|
||||
break; // It doesn't do anything.
|
||||
|
||||
case fd_fire: {
|
||||
// Consume items as fuel to help us grow/last longer.
|
||||
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();
|
||||
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 -= 600;
|
||||
destroyed = true;
|
||||
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 -= 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] );
|
||||
i_at(x, y).erase(i_at(x, y).begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
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 && 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++) {
|
||||
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 / 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?
|
||||
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;
|
||||
|
||||
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 (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).is_null() && move_cost(x+a, y+b) > 0))
|
||||
spread.push_back(point(x+a, y+b));
|
||||
}
|
||||
}
|
||||
if (cur->density > 0 && cur->age > 0 && spread.size() > 0) {
|
||||
point p = spread[rng(0, spread.size() - 1)];
|
||||
if (field_at(p.x, p.y).type == fd_smoke &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
|
||||
add_field(g, p.x, p.y, fd_smoke, 1)){
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_tear_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 += 30;
|
||||
// One in three chance that it spreads (less than smoke!)
|
||||
if (one_in(3)) {
|
||||
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).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 teargas grows thicker
|
||||
if (field_at(p.x, p.y).type == fd_tear_gas &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
// Nearby smoke is converted into teargas
|
||||
} else if (field_at(p.x, p.y).type == fd_smoke) {
|
||||
field_at(p.x, p.y).type = fd_tear_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_tear_gas, 1)) {
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
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 nukegas grows thicker
|
||||
if (field_at(p.x, p.y).type == fd_nuke_gas &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
// 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.
|
||||
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
|
||||
add_field(g, p.x, p.y, fd_nuke_gas, 1)) {
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
if (move_cost(x, y) == 0 && cur->density > 1) { // We're grounded
|
||||
int tries = 0;
|
||||
while (tries < 10 && cur->age < 50) {
|
||||
int cx = x + rng(-1, 1), cy = y + rng(-1, 1);
|
||||
if (move_cost(cx, cy) != 0 && field_at(cx, cy).is_null()) {
|
||||
add_field(g, cx, cy, fd_electricity, 1);
|
||||
cur->density--;
|
||||
tries = 0;
|
||||
} else
|
||||
tries++;
|
||||
}
|
||||
} else { // We're not grounded; attempt to ground
|
||||
for (int a = -1; a <= 1; a++) {
|
||||
for (int b = -1; b <= 1; b++) {
|
||||
if (move_cost(x + a, y + b) == 0 && // Grounded tiles first
|
||||
field_at(x + a, y + b).is_null())
|
||||
valid.push_back(point(x + a, y + b));
|
||||
}
|
||||
}
|
||||
if (valid.size() == 0) { // Spread to adjacent space, then
|
||||
int px = x + rng(-1, 1), py = y + rng(-1, 1);
|
||||
if (move_cost(px, py) > 0 && field_at(px, py).type == fd_electricity &&
|
||||
field_at(px, py).density < 3)
|
||||
field_at(px, py).density++;
|
||||
else if (move_cost(px, py) > 0)
|
||||
add_field(g, px, py, fd_electricity, 1);
|
||||
cur->density--;
|
||||
}
|
||||
while (valid.size() > 0 && cur->density > 0) {
|
||||
int index = rng(0, valid.size() - 1);
|
||||
add_field(g, valid[index].x, valid[index].y, fd_electricity, 1);
|
||||
cur->density--;
|
||||
valid.erase(valid.begin() + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
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) { // Totally dissapated.
|
||||
grid[gridn]->field_count--;
|
||||
grid[gridn]->fld[locx][locy] = field();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return found_field;
|
||||
}
|
||||
|
||||
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 && !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));
|
||||
}
|
||||
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 (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 (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));
|
||||
} 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);
|
||||
}
|
||||
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 && !inside)
|
||||
g->u.infect(DI_SMOKE, bp_mouth, 4, 15, g);
|
||||
break;
|
||||
|
||||
case fd_tear_gas:
|
||||
if ((cur->density > 1 || !one_in(3)) && !inside || inside && one_in(3))
|
||||
g->u.infect(DI_TEARGAS, bp_mouth, 5, 20, g);
|
||||
if (cur->density > 1 && !inside || inside && one_in(3))
|
||||
g->u.infect(DI_BLIND, bp_eyes, cur->density * 2, 10, g);
|
||||
break;
|
||||
|
||||
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) {
|
||||
g->add_msg("This radioactive gas burns!");
|
||||
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:
|
||||
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;
|
||||
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_FLIES) &&
|
||||
!z->has_flag(MF_ACIDPROOF)) {
|
||||
if (cur->density == 3)
|
||||
dam = rng(4, 10) + rng(2, 8);
|
||||
else
|
||||
dam = rng(cur->density, cur->density * 4);
|
||||
}
|
||||
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;
|
||||
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 = 20;
|
||||
if (z->made_of(STONE) || z->made_of(KEVLAR) || z->made_of(STEEL))
|
||||
dam = -20;
|
||||
if (z->has_flag(MF_FLIES))
|
||||
dam -= 15;
|
||||
|
||||
if (cur->density == 1)
|
||||
dam += rng(2, 6);
|
||||
else if (cur->density == 2) {
|
||||
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, 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));
|
||||
}
|
||||
}
|
||||
// Drop through to smoke
|
||||
|
||||
case fd_smoke:
|
||||
if (cur->density == 3)
|
||||
z->speed -= rng(10, 20);
|
||||
if (z->made_of(VEGGY)) // Plants suffer from smoke even worse
|
||||
z->speed -= rng(1, cur->density * 12);
|
||||
break;
|
||||
|
||||
case fd_tear_gas:
|
||||
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);
|
||||
dam = rng(30, 50);
|
||||
} else if (cur->density == 2) {
|
||||
z->speed -= rng(20, 50);
|
||||
dam = rng(10, 25);
|
||||
} else {
|
||||
z->speed -= rng(0, 15);
|
||||
dam = rng(0, 12);
|
||||
}
|
||||
if (z->made_of(VEGGY)) {
|
||||
z->speed -= rng(cur->density * 5, cur->density * 12);
|
||||
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))
|
||||
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;
|
||||
|
||||
}
|
||||
if (dam > 0)
|
||||
z->hurt(dam);
|
||||
}
|
||||
|
||||
bool vector_has(std::vector <item> vec, itype_id type)
|
||||
{
|
||||
for (int i = 0; i < vec.size(); i++) {
|
||||
if (vec[i].type->id == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
+184
File diff suppressed because one or more lines are too long
@@ -1,431 +0,0 @@
|
||||
#ifndef _GAME_H_
|
||||
#define _GAME_H_
|
||||
|
||||
#include "mtype.h"
|
||||
#include "monster.h"
|
||||
#include "map.h"
|
||||
#include "lightmap.h"
|
||||
#include "player.h"
|
||||
#include "overmap.h"
|
||||
#include "omdata.h"
|
||||
#include "mapitems.h"
|
||||
#include "crafting.h"
|
||||
#include "trap.h"
|
||||
#include "npc.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,
|
||||
TUT_BASIC, TUT_COMBAT,
|
||||
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 draw();
|
||||
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_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
|
||||
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(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
|
||||
|
||||
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];
|
||||
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_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();// 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(); // 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(); // 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*> ¤t,
|
||||
std::vector<bool> &available, craft_cat tab);// crafting.cpp
|
||||
void disassemble(); // See crafting.cpp
|
||||
void disassemble_item(recipe *dis); // See crafting.cpp
|
||||
void complete_disassemble(); // See crafting.cpp
|
||||
void construction_menu(); // See construction.cpp
|
||||
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);
|
||||
|
||||
// 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 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(); // 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, 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(); // 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++
|
||||
bool autosafemode; // is autosafemode enabled?
|
||||
int turnssincelastmon; // needed for auto run mode
|
||||
// quit_status uquit; // Set to true if the player quits ('Q')
|
||||
|
||||
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<event> events; // Game events to be processed
|
||||
int kills[num_monsters]; // Player's kill count
|
||||
std::string last_action; // The keypresses of last turn
|
||||
|
||||
int moves_since_last_save;
|
||||
int item_exchanges_since_save;
|
||||
unsigned char latest_lightlevel;
|
||||
calendar latest_lightlevel_turn;
|
||||
|
||||
special_game *gamemode;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,35 +0,0 @@
|
||||
#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
@@ -1,182 +0,0 @@
|
||||
#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
|
||||
@@ -1,26 +0,0 @@
|
||||
#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
@@ -1,18 +0,0 @@
|
||||
#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
|
||||
@@ -1,914 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "keypress.h"
|
||||
#include "options.h"
|
||||
|
||||
#ifndef LINE_XOXO
|
||||
#define LINE_XOXO 4194424
|
||||
#define LINE_OXOX 4194417
|
||||
#define LINE_XXOO 4194413
|
||||
#define LINE_OXXO 4194412
|
||||
#define LINE_OOXX 4194411
|
||||
#define LINE_XOOX 4194410
|
||||
#define LINE_XXXO 4194420
|
||||
#define LINE_XXOX 4194422
|
||||
#define LINE_XOXX 4194421
|
||||
#define LINE_OXXX 4194423
|
||||
#define LINE_XXXX 4194414
|
||||
#endif
|
||||
|
||||
void game::help()
|
||||
{
|
||||
char ch;
|
||||
do {
|
||||
erase();
|
||||
mvprintz(0, 38, c_red, "HELP");
|
||||
mvprintz(1, 0, c_white, "\
|
||||
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 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 (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':
|
||||
case 'A':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Cataclysm is a roguelike with a monster apocalypse setting. You have survived\n\
|
||||
the original onslaught, and are ready to set out in search of safety.\n\
|
||||
\n\
|
||||
Cataclysm differs from most roguelikes in several ways. Rather than exploring\n\
|
||||
an underground dungeon, with a limited area on each level, you are exploring\n\
|
||||
a truly infinite world, stretching in all four cardinal directions.\n\
|
||||
As in most roguelikes, you will have to find food; you also need to keep\n\
|
||||
yourself hydrated, and sleep periodically.\n\
|
||||
\n\
|
||||
While Cataclysm has more challenges than many roguelikes, the near-future\n\
|
||||
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();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Movement is performed using the numpad, or vikeys. Each step will take 100\n\
|
||||
movement points (or more, depending on the terrain); you\n\
|
||||
y k u 7 8 9 will then replenish a variable amount of movement points,\n\
|
||||
\\ | / \\ | / depending on many factors (press '@' to see the exact\n\
|
||||
\\|/ \\|/ amount). To attempt to hit a monster with your weapon,\n\
|
||||
h--.--l 4--5--6 simply move into it. You may find doors, ('+'); these may\n\
|
||||
/|\\ /|\\ be opened with 'o' or closed with 'c'. Some doors are\n\
|
||||
/ | \\ / | \\ locked. Locked doors, windows, and some other obstacles\n\
|
||||
b j n 1 2 3 can be destroyed by smashing them ('s', then choose a\n\
|
||||
direction). Smashing down obstacles is much easier with a\n\
|
||||
good weapon or a strong character.\n\
|
||||
\n\
|
||||
There may be times when you want to move more quickly by holding down a\n\
|
||||
movement key. However, fast movement in this fashion may lead to the player\n\
|
||||
getting into a dangerous situation or even killed before they have a chance\n\
|
||||
to react. Pressing '!' will toggle \"Run Mode.\" While this is on, any\n\
|
||||
movement will be ignored if new monsters enter the player's view.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
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\
|
||||
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. 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\
|
||||
You may not always fall asleep right away. Sleeping indoors, especially on a\n\
|
||||
bed, will help; or you can always use sleeping pills. While sleeping, you'll\n\
|
||||
slowly replenish lost hit points. You'll also be vulnerable to attack, so\n\
|
||||
try to find a safe place, or set traps for unwary intruders.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
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\
|
||||
slows you down and reduces your stats, and finding a way to manage pain is an\n\
|
||||
early imperative. The most common is drugs; aspirin, codeine, tramadol,\n\
|
||||
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.\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 '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 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\
|
||||
\n\
|
||||
If you are suffering from drug withdrawal, taking more of the drug will cause\n\
|
||||
the effects to cease immediately, but may deepen your dependance.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case 'G':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Your character has a morale level, which affects you in many ways. The\n\
|
||||
depressing post-apocalypse world is tough to deal with, and your mood will\n\
|
||||
naturally decrease very slowly.\n\
|
||||
\n\
|
||||
There are lots of options for increasing morale; reading an entertaining\n\
|
||||
book, eating delicious food, and taking recreational drugs are but a few\n\
|
||||
options. Most morale-boosting activities can only take you to a certain\n\
|
||||
level before they grow boring.\n\
|
||||
\n\
|
||||
There are also lots of ways for your morale to decrease, beyond its natural\n\
|
||||
decay. Eating disgusting food, reading a boring technical book, or going\n\
|
||||
through drug withdrawal are some prominent examples.\n\
|
||||
\n\
|
||||
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.\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 'h':
|
||||
case 'H':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Though it is relatively rare, certain areas of the world may be contamiated\n\
|
||||
with radiation. It will gradually accumulate in your body, weakening you\n\
|
||||
more and more. While in radiation-free areas, your radiation level will\n\
|
||||
slowly decrease. Taking iodine tablets will help speed the process.\n\
|
||||
\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. It is possible to find substances that will remove\n\
|
||||
mutations, though these are extremely rare.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Bionics are biomechanical upgrades to your body. While many are simply\n\
|
||||
'built-in' versions of items you would otherwise have to carry, some bionics\n\
|
||||
have unique effects that are otherwise unobtainable.\n\
|
||||
\n\
|
||||
Most bionics require a source of power, and you will need an internal battery\n\
|
||||
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. 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 '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\
|
||||
money to trade for. Fortunately, it is possible to craft a wide variety of\n\
|
||||
goods with the proper tools, materials, and training.\n\
|
||||
\n\
|
||||
Some recipes require a set of tools. These are not used up when crafting, so\n\
|
||||
you can keep your tool set. All recipes require one or more ingredients.\n\
|
||||
These ARE used up in crafting.\n\
|
||||
\n\
|
||||
To craft items, press '&'. There are five categories; Weapons, Food,\n\
|
||||
Electronics, Armor, and Miscellaneous. While a few items require no skill to\n\
|
||||
create, the majority require you to have some knowledge:\n\
|
||||
\n\
|
||||
->Mechanic skill is used for weapons, traps, and a few tools.\n\
|
||||
->Cooking skill, at low levels, is used for making tasty recipes; at higher\n\
|
||||
levels, you have an understanding of chemistry and can make chemical weapons\n\
|
||||
and beneficial elixirs.\n\
|
||||
->Electronics skill lets you make a wide variety of tools with intricate uses.\n\
|
||||
->Tailoring skill is used to create basic clothing, and later tough armor.\n\
|
||||
\n\
|
||||
In addition to the primary crafting skills, other skills may be necessary to\n\
|
||||
create certain items. Traps skill, Firearms skill, and First Aid skill are\n\
|
||||
all required for certain items.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
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\
|
||||
lying on the ground; if so, simply press ',' or 'g' to pick up items on the\n\
|
||||
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\
|
||||
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\
|
||||
be a good option for travel. When unwielding your weapon, it will go back in\n\
|
||||
your inventory, or will be dropped on the ground if there is no space.\n\
|
||||
\n\
|
||||
To wear a piece of clothing, press 'W' then the proper letter. Armor reduces\n\
|
||||
damage and helps you resist things like smoke. To take off an item, press\n\
|
||||
'T' then the proper letter.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 'M':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
After 30 minutes of warmup time, monsters will begin to appear. They are\n\
|
||||
represented by letters on your screen; a list of monster names, and their\n\
|
||||
positions relative to you, is displayed on the right side of the screen.\n\
|
||||
\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 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.\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\
|
||||
a building. Ducking down into the subways or sewers is often an excellent\n\
|
||||
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 '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\
|
||||
storage is limited, and a backpack, trenchcoat, or other storage medium will\n\
|
||||
let you carry a lot more. Finding a weapon is important; frying pans, butcher\n\
|
||||
knives, and more are common in your home; hardware stores may carry others.\n\
|
||||
Unless you plan on concentrating on melee combat, seek out gun stores as soon\n\
|
||||
as possible and load up on more than one type.\n\
|
||||
\n\
|
||||
It's also important to carry a few medications; painkillers are a must-have,\n\
|
||||
and drugs such as cigarettes will make life easier (but beware addiction).\n\
|
||||
Leave cities as soon as you have a good stockpile of equipment. Their high\n\
|
||||
concentration of zombies makes them a deathtrap--but a necessary resource for\n\
|
||||
food and ammunition.\n\
|
||||
\n\
|
||||
Combat is much easier if you can fight just one monster at once. Use doorways\n\
|
||||
as a choke point, or stand behind a window and strike as the zombies slowly\n\
|
||||
climb through. Never be afraid to just run if you can outpace your enemies.\n\
|
||||
Irregular terrain, like forests, may help you lose monsters.\n\
|
||||
\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, 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': {
|
||||
erase();
|
||||
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\
|
||||
~ Liquid\n\
|
||||
%%%% Food\n\
|
||||
! Medication\n\
|
||||
These are all consumed by using 'E'. They provide a certain amount of\n\
|
||||
nutrition, quench your thirst, may be a stimulant or a depressant, and may\n\
|
||||
provide morale. There may also be more subtle effects.\n\
|
||||
\n\
|
||||
/ Large weapon\n\
|
||||
; Small weapon or tool\n\
|
||||
, Tiny item\n\
|
||||
These are all generic items, useful only to be wielded as a weapon.\n\
|
||||
However, some have special uses; they will show up under the TOOLS section\n\
|
||||
in your inventory. Press 'a' to use these.\n\
|
||||
\n\
|
||||
) Container\n\
|
||||
These items may hold other items. Someare passable weapons. Many will be\n\
|
||||
listed with their contents, e.g. \"plastic bottle of water\". Those containing\n\
|
||||
comestibles may be eaten with 'E'; this may leave you with an empty container.\n\
|
||||
Press any key to continue...");
|
||||
getch();
|
||||
clear();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
ITEM TYPES:\n\
|
||||
[ Clothing\n\
|
||||
This may be worn with the 'W' key or removed with the 'T' key. It may\n\
|
||||
cover one or more body parts; you can wear multiple articles of clothing on\n\
|
||||
any given body part, but this will encumber you severely. Each article of\n\
|
||||
clothing may provide storage space, warmth, an encumberment, and a resistance\n\
|
||||
to bashing and/or cutting attacks. Some may protect against environmental\n\
|
||||
effects.\n\
|
||||
\n\
|
||||
( Firearm\n\
|
||||
This weapon may be loaded with ammunition with 'r', unloaded with 'U', and\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 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\
|
||||
= Ammunition\n\
|
||||
Ammunition is worthless without a gun to load it into. Generally, there\n\
|
||||
are several variants for any particular calibre. Ammunition has a damage\n\
|
||||
rating, an accuracy, a range, and an armor-piercing quality.\n\
|
||||
Press any key to continue...");
|
||||
getch();
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
ITEM TYPES:\n\
|
||||
\n\
|
||||
* Thrown weapon; simple projectile or grenade\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\
|
||||
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 '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.");
|
||||
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, "\
|
||||
|- Bridge - Helps you cross rivers.");
|
||||
mvprintz( 6, 0, c_blue, "\
|
||||
R River - Most creatures can not swim across them, but you may.");
|
||||
mvprintz( 7, 0, c_dkgray, "\
|
||||
O Parking lot - Empty lot, few items. Mostly useless.");
|
||||
mvprintz( 8, 0, c_ltgreen, "\
|
||||
^>v< House - Filled with a variety of items. Good place to sleep.");
|
||||
mvprintz( 9, 0, c_ltblue, "\
|
||||
^>v< Gas station - Good place to collect gasoline. Risk of explosion.");
|
||||
mvprintz(10, 0, c_ltred, "\
|
||||
^>v< Pharmacy - The best source for vital medications.");
|
||||
mvprintz(11, 0, c_green, "\
|
||||
^>v< Grocery store - Good source of canned food and other supplies.");
|
||||
mvprintz(12, 0, c_cyan, "\
|
||||
^>v< Hardware store - Home to tools, melee weapons and crafting goods.");
|
||||
mvprintz(13, 0, c_ltcyan, "\
|
||||
^>v< Sporting Goods store - Several survival tools and melee weapons.");
|
||||
mvprintz(14, 0, c_magenta, "\
|
||||
^>v< Liquor store - Alcohol is good for crafting molotov cocktails.");
|
||||
mvprintz(15, 0, c_red, "\
|
||||
^>v< Gun store - Firearms and ammunition are very valuable.");
|
||||
mvprintz(16, 0, c_blue, "\
|
||||
^>v< Clothing store - High-capacity clothing, some light armor.");
|
||||
mvprintz(17, 0, c_brown, "\
|
||||
^>v< Library - Home to books, both entertaining and informative.");
|
||||
mvprintz(18, 0, c_white, "\
|
||||
^>v< are always man-made buildings. The pointed side indicates the front door."
|
||||
);
|
||||
mvprintw(22, 0, "There are many others out there... search for them!");
|
||||
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);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef RESOURCE_RC_INCLUDED
|
||||
#define RESOURCE_RC_INCLUDED
|
||||
|
||||
MAINICON ICON "data/cataicon.ico"
|
||||
|
||||
#endif // RESOURCE_RC_INCLUDED
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Cataclysm: Dark Days Ahead"
|
||||
---
|
||||
|
||||
Cataclysm: Dark Days Ahead is a turn-based survival game set in a post-apocalyptic world. Struggle to survive in a harsh, persistent, procedurally generated world. Scavenge the remnants of a dead civilization for food, equipment, or, if you are 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...
|
||||
|
||||
<figure>
|
||||
<img src="assets/images/showcase-ultica.png" alt="Showcase image. Tileset: UltiCa">
|
||||
<figcaption>
|
||||
<em>Tileset: UltiCa</em>
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
## Gameplay
|
||||
|
||||
As your game begins, you awaken with hazy memories of violence and terror from when the world suddenly unravelled around you. Now you need to explore your surroundings, and secure food, water and safety. After that, who knows? Long term survival will mean tapping abilities you haven't used before, learning to survive in this new environment, and developing new skills.
|
||||
|
||||
## Project Managed Resources
|
||||
These sites are owned and managed by the project directly.
|
||||
* [GitHub repository](https://github.com/CleverRaven/Cataclysm-DDA)
|
||||
* [Forums](https://discourse.cataclysmdda.org)
|
||||
* [Development-oriented Discord](https://discord.gg/jFEc7Yp)
|
||||
* [Cataclysm_DDA subreddit](https://reddit.com/r/Cataclysm_DDA)
|
||||
* IRC channel: #CataclysmDDA on Libera Chat, [webchat](https://web.libera.chat/#CataclysmDDA)
|
||||
|
||||
## Community Managed Resources
|
||||
These are resources provided by third parties, or managed by *some* members of the development team. The project does not provide support for these directly.
|
||||
* [Hitchhiker's Guide to the Cataclysm](https://cdda-guide.nornagon.net)
|
||||
* [Documentation For Developers](https://docs.cataclysmdda.org/)
|
||||
* [Game Launcher](https://github.com/Fris0uman/CDDA-Game-Launcher)
|
||||
* [Community Discord](https://discord.gg/byxwnAU)
|
||||
* [Steam](https://store.steampowered.com/app/2330750/Cataclysm_Dark_Days_Ahead/)
|
||||
* [Android Play Store](https://play.google.com/store/apps/details?id=com.cleverraven.cataclysmdda)
|
||||
|
||||
|
||||
## System Requirements
|
||||
### Minimum
|
||||
"I played catadda 0.B on Lego EV3 brick through ssh about a year ago. Every simple move took a noticeable fraction of a second (like 0.3-0.5 second), crafting and such was very slow as well. The specs were - 300 MhZ CPU, 64 Mb Ram (+ another 64 Mb swap on microsd flash) running ev3dev (stripped ubuntu basically), ssh over USB CDC connection." -burgerpro
|
||||
|
||||
"I used to test the game on an Asus EEE 700. That's a 900MHz mobile cpu with 500MB of ram." -Kevin Granade
|
||||
|
||||
Tilesets increase the amount of RAM required dramatically. I recommend at least 1GB of ram for tilesets, and there are reports of instability due to RAM exhaustion when certain tilesets are used. (The larger the size of the individual tiles, the more RAM is used)
|
||||
|
||||
### Recommended
|
||||
"I regularly test the game now on a Windows netbook with a sub 2GHz single core CPU, 1GB of ram, and no graphics acceleration." -Kevin Granade
|
||||
|
||||
Graphical builds run much faster with some kind of graphics acceleration. 2GB of RAM pretty much guarantees you will never have trouble with memory shortages.
|
||||
|
||||
## Downloads
|
||||
|
||||
Cataclysm has official builds for Windows, Linux, OSX and Android.
|
||||
The Linux and OSX builds are available in both terminal and graphical flavors.
|
||||
Windows and Android builds are graphical only, though there is a "text rendering" mode in the graphical build.
|
||||
There is a very old and unsupported fork for iOS.
|
||||
|
||||
### Latest Stable
|
||||
The most recent stable release is {{ site.github.latest_release.tag_name }} {{ site.github.latest_release.name }}. We recommend stable for the most bug-free experience available. You can download it from the [Releases Page]({{ site.baseurl }}{% link releases.md %}).
|
||||
|
||||
### Latest Experimental
|
||||
Cataclysm: DDA is under constant development. As such, stable can lag behind with features. If you would like access to the bleeding edge of features and any bugs that may come along with them, you can download the [latest experimental builds]({{ site.baseurl }}{% link pages/experimental.md %}).
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
#### Is there a tutorial?
|
||||
|
||||
Yes, you can find the tutorial in the **Special** menu at the main menu. You can also access documentation in-game via the `?` key.
|
||||
|
||||
#### How can I change the key bindings?
|
||||
|
||||
Press the `?` key, followed by the `1` key to see the full list of key commands. Press the `+` key to add a key binding, select which action with the corresponding letter key `a-w`, and then the key you wish to assign to that action.
|
||||
|
||||
#### How can I start a new world?
|
||||
|
||||
**World** on the main menu will generate a fresh world for you. Select **Create World**.
|
||||
|
||||
#### I've found a bug / I would like to make a suggestion. What should I do?
|
||||
|
||||
Please submit an issue on [our GitHub page](https://github.com/CleverRaven/Cataclysm-DDA/issues/). If you're not able to, send an email to `kevin.granade@gmail.com`. In either case, please consider reading our [issue guidelines]({{ site.baseurl }}{% link pages/issues.md %}) first.
|
||||
|
||||
#### I'd like to contribute financially to Cataclysm: Dark Days Ahead
|
||||
|
||||
Check out [our donations page]({{ site.baseurl }}{% link donations.md %}) for ways to donate.
|
||||
@@ -1,111 +0,0 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#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
@@ -1,483 +0,0 @@
|
||||
#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
@@ -1,79 +0,0 @@
|
||||
#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
|
||||
@@ -1,702 +0,0 @@
|
||||
#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();
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
#ifndef _ITEM_H_
|
||||
#define _ITEM_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "itype.h"
|
||||
#include "mtype.h"
|
||||
//#include "npc.h"
|
||||
|
||||
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:
|
||||
item();
|
||||
item(itype* it, unsigned int turn);
|
||||
item(itype* it, unsigned int turn, char let);
|
||||
void make_corpse(itype* it, mtype* mt, unsigned int turn); // Corpse
|
||||
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);
|
||||
|
||||
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(bool with_ammo = true);
|
||||
int noise();
|
||||
int burst_size();
|
||||
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);
|
||||
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);
|
||||
|
||||
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(); // 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_ammo_container();
|
||||
bool is_drink();
|
||||
bool is_weap();
|
||||
bool is_bashing_weapon();
|
||||
bool is_cutting_weapon();
|
||||
bool is_gun();
|
||||
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();
|
||||
|
||||
int typeId();
|
||||
|
||||
itype* type;
|
||||
mtype* corpse;
|
||||
it_ammo* curammo;
|
||||
|
||||
std::vector<item> contents;
|
||||
|
||||
std::string name;
|
||||
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
|
||||
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
|
||||
-4685
File diff suppressed because it is too large
Load Diff
@@ -1,144 +0,0 @@
|
||||
#ifndef _IUSE_H_
|
||||
#define _IUSE_H_
|
||||
|
||||
class game;
|
||||
class item;
|
||||
class player;
|
||||
|
||||
class iuse
|
||||
{
|
||||
public:
|
||||
void none (game *g, player *p, item *it, bool t) { };
|
||||
|
||||
// FOOD AND DRUGS (ADMINISTRATION)
|
||||
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, 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
|
||||
-220
@@ -1,220 +0,0 @@
|
||||
#include "keypress.h"
|
||||
#include "action.h"
|
||||
#include "game.h"
|
||||
|
||||
long input()
|
||||
{
|
||||
long ch = getch();
|
||||
switch (ch) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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 ACTION_MOVE_NE:
|
||||
x = 1;
|
||||
y = -1;
|
||||
return;
|
||||
case ACTION_MOVE_W:
|
||||
x = -1;
|
||||
return;
|
||||
case ACTION_MOVE_S:
|
||||
y = 1;
|
||||
return;
|
||||
case ACTION_MOVE_N:
|
||||
y = -1;
|
||||
return;
|
||||
case ACTION_MOVE_E:
|
||||
x = 1;
|
||||
return;
|
||||
case ACTION_MOVE_SW:
|
||||
x = -1;
|
||||
y = 1;
|
||||
return;
|
||||
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\
|
||||
";
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#ifndef _KEYPRESS_H_
|
||||
#define _KEYPRESS_H_
|
||||
|
||||
#include <string>
|
||||
#include "cursesdef.h"
|
||||
|
||||
class game;
|
||||
|
||||
// Simple text input--translates numpad to vikeys
|
||||
long input();
|
||||
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
|
||||
#endif
|
||||
-497
@@ -1,497 +0,0 @@
|
||||
#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
@@ -1,73 +0,0 @@
|
||||
#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
|
||||
@@ -1,238 +0,0 @@
|
||||
#include "line.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> ret;
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
int ax = abs(dx)<<1;
|
||||
int ay = abs(dy)<<1;
|
||||
int sx = SGN(dx);
|
||||
int sy = SGN(dy);
|
||||
if (dy == 0) sy = 0;
|
||||
if (dx == 0) sx = 0;
|
||||
point cur;
|
||||
cur.x = x1;
|
||||
cur.y = y1;
|
||||
|
||||
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;
|
||||
t -= ax;
|
||||
}
|
||||
cur.x += sx;
|
||||
t += ay;
|
||||
ret.push_back(cur);
|
||||
} while ((cur.x != x2 || cur.y != y2) &&
|
||||
(cur.x >= xmin && cur.x <= xmax && cur.y >= ymin && cur.y <= ymax));
|
||||
} else {
|
||||
do {
|
||||
if (t > 0) {
|
||||
cur.x += sx;
|
||||
t -= ay;
|
||||
}
|
||||
cur.y += sy;
|
||||
t += ax;
|
||||
ret.push_back(cur);
|
||||
} while ((cur.x != x2 || cur.y != y2) &&
|
||||
(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(double(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0))));
|
||||
}
|
||||
|
||||
int rl_dist(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int dx = abs(x1 - x2), dy = abs(y1 - y2);
|
||||
if (dx > dy)
|
||||
return dx;
|
||||
return dy;
|
||||
}
|
||||
|
||||
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) / 2 > abs(dy) || dy == 0) {
|
||||
return WEST;
|
||||
} else if (abs(dy) / 2 > abs(dx)) {
|
||||
if (dy < 0)
|
||||
return NORTH;
|
||||
else
|
||||
return SOUTH;
|
||||
} else {
|
||||
if (dy < 0)
|
||||
return NORTHWEST;
|
||||
else
|
||||
return SOUTHWEST;
|
||||
}
|
||||
} else {
|
||||
if (dx / 2 > abs(dy) || dy == 0) {
|
||||
return EAST;
|
||||
} else if (abs(dy) / 2 > dx || dx == 0) {
|
||||
if (dy < 0)
|
||||
return NORTH;
|
||||
else
|
||||
return SOUTH;
|
||||
} else {
|
||||
if (dy < 0)
|
||||
return NORTHEAST;
|
||||
else
|
||||
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;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef _LINE_H_
|
||||
#define _LINE_H_
|
||||
|
||||
#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);
|
||||
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
|
||||
@@ -1,114 +0,0 @@
|
||||
/* Main Loop for cataclysm
|
||||
* Linux only I guess
|
||||
* But maybe not
|
||||
* Who knows
|
||||
*/
|
||||
|
||||
#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>
|
||||
|
||||
void exit_handler(int s);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef ENABLE_LOGGING
|
||||
setupDebug();
|
||||
#endif
|
||||
int seed = time(NULL);
|
||||
|
||||
//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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void exit_handler(int s) {
|
||||
bool bExit = false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user