Compare commits
13 Commits
list
..
0.9-branch
| Author | SHA1 | Date | |
|---|---|---|---|
| ebd2393682 | |||
| ad36ed99bc | |||
| 52de32f389 | |||
| 6f1e06c346 | |||
| df9771bc72 | |||
| a09a6a73a3 | |||
| a002748ce3 | |||
| a1d54dd4bb | |||
| 1dabedc650 | |||
| c9b6fe0543 | |||
| c0d0e01fd5 | |||
| da6f01f693 | |||
| 1d2420c24f |
@@ -1,35 +0,0 @@
|
||||
# These files are text and should be normalized (convert crlf => lf)
|
||||
*.c text
|
||||
*.cbp text
|
||||
*.cpp text
|
||||
*.h text
|
||||
*.json text
|
||||
*.lua text
|
||||
*.md text
|
||||
*.py text
|
||||
*.rc text
|
||||
*.sh text
|
||||
*.txt text
|
||||
*.yml text
|
||||
|
||||
# Visual Studio project files, leave them alone.
|
||||
*.cmd -text
|
||||
*.filters -text
|
||||
*.sln -text
|
||||
*.user -text
|
||||
*.vcxproj -text
|
||||
|
||||
# Generated translation text, don't mess with them.
|
||||
*.mo -text
|
||||
*.po -text
|
||||
*.pot -text
|
||||
|
||||
# Treat images, archives, and font files as binary.
|
||||
# (binary is a macro for -text -diff)
|
||||
*.db binary
|
||||
*.fon binary
|
||||
*.gz binary
|
||||
*.ico binary
|
||||
*.png binary
|
||||
*.ttf binary
|
||||
|
||||
+1
-48
@@ -1,9 +1,6 @@
|
||||
cataclysm
|
||||
cataclysm-tiles
|
||||
chkjson*
|
||||
!src/chkjson
|
||||
data/*.template
|
||||
templates/
|
||||
save/
|
||||
graveyard/
|
||||
memorial/
|
||||
@@ -13,24 +10,12 @@ logg.txt
|
||||
bindist/
|
||||
cataclysmdda-*
|
||||
objwin/
|
||||
src/version.h
|
||||
src/lua/catabindings.cpp
|
||||
version.h
|
||||
CataclysmWin.cscope_file_list
|
||||
CataclysmWin.depend
|
||||
CataclysmWin.layout
|
||||
*.exe
|
||||
*.dll
|
||||
WinDepend/
|
||||
*.7z
|
||||
*.zip
|
||||
|
||||
data/font/
|
||||
config/
|
||||
|
||||
doxygen_doc/html/*
|
||||
doxygen_doc/latex/*
|
||||
|
||||
data/mods/user-default-mods.json
|
||||
|
||||
# Visual Studio files
|
||||
*.suo
|
||||
@@ -40,8 +25,6 @@ data/mods/user-default-mods.json
|
||||
Release*/
|
||||
Debug*/
|
||||
*.opensdf
|
||||
*.user
|
||||
*.vcxproj.filters
|
||||
|
||||
# Temporary and backup files
|
||||
*~
|
||||
@@ -57,33 +40,3 @@ Thumbs.db
|
||||
core
|
||||
tags
|
||||
cscope.*
|
||||
|
||||
# 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
|
||||
|
||||
# taskwarrior files
|
||||
*.task*
|
||||
|
||||
# GitEye files
|
||||
*.project
|
||||
|
||||
# vimdiff backup
|
||||
*.orig
|
||||
|
||||
# OSX
|
||||
Cataclysm.app
|
||||
data/osx/AppIcon.icns
|
||||
|
||||
+30
-64
@@ -22,31 +22,26 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
|
||||
PROJECT(CataclysmDDA)
|
||||
|
||||
OPTION(LOCALIZE "Toggle gettext localization/translation." ON)
|
||||
OPTION(SDL "Use SDL curses emulation instead of terminal support. Also enables tiles support." OFF)
|
||||
OPTION(SOUND "Use SDL mixer to play music and sounds." ON)
|
||||
OPTION(LUA "Enable lua scripting support." ON)
|
||||
OPTION(LUA_BINARY "Select the lua binary to execute lua scripts with." "lua")
|
||||
OPTION(SDL "Use SDL curses emulation instead of terminal support." OFF)
|
||||
OPTION(TILES "Enable tileset support." OFF)
|
||||
|
||||
# Note: The CMake documentation says it's better to list the actual source
|
||||
# files here, as otherwise cmake won't know to rerun when a new file
|
||||
# is added. However, currently the Makefile also just scans for source
|
||||
# files, so this approach should be "good enough".
|
||||
FILE(GLOB CataclysmDDA_SRCS src/*.cpp)
|
||||
FILE(GLOB CataclysmDDA_HDRS src/*.h)
|
||||
FILE(GLOB CataclysmDDA_SRCS *.cpp)
|
||||
FILE(GLOB CataclysmDDA_HDRS *.h)
|
||||
|
||||
ADD_EXECUTABLE(cataclysm ${CataclysmDDA_SRCS} ${CataclysmDDA_HDRS})
|
||||
|
||||
# Custom command that will be executed whenever the "cataclysm" target is built.
|
||||
# Copy all the relevant game data into the build directory.
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET cataclysm PRE_BUILD
|
||||
TARGET cataclysm PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data $<TARGET_FILE_DIR:cataclysm>/data
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/LICENSE.txt $<TARGET_FILE_DIR:cataclysm> # Don't forget the license :)
|
||||
)
|
||||
|
||||
# We're using c++11 now
|
||||
add_definitions("-std=c++11")
|
||||
|
||||
IF(MINGW)
|
||||
add_definitions("-D_WINDOWS -D_MINGW -D_WIN32 -DWIN32 -D__MINGW__")
|
||||
ENDIF()
|
||||
@@ -60,64 +55,35 @@ ENDIF()
|
||||
|
||||
# TODO: windows rc stuff
|
||||
|
||||
IF(MSVC OR MINGW)
|
||||
add_definitions(-Wl,-stack,12000000,-subsystem,windows)
|
||||
ENDIF()
|
||||
|
||||
Include(FindPkgConfig)
|
||||
IF(LUA)
|
||||
# Generate lua bindings
|
||||
#ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/lua/catabindings.cpp
|
||||
#WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lua
|
||||
#COMMAND ${LUA_BINARY} generate_bindings.lua ${CMAKE_BINARY_DIR}/lua/catabindings.cpp
|
||||
#DEPENDS ${CMAKE_SOURCE_DIR}/lua/generate_bindings.lua
|
||||
#DEPENDS ${CMAKE_SOURCE_DIR}/lua/class_definitions.lua
|
||||
#)
|
||||
|
||||
ADD_DEFINITIONS(-DLUA)
|
||||
# The CMake Lua51 package on linux is BROKEN, it yields lua52
|
||||
# Use pkg_config first, and only if that fails, use find_package
|
||||
PKG_SEARCH_MODULE(Lua51 REQUIRED lua5.1)
|
||||
if(NOT LUA51_FOUND)
|
||||
find_package(Lua51 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(LUA51_FOUND)
|
||||
ADD_DEFINITIONS(-I${LUA51_INCLUDE_DIRS})
|
||||
target_link_libraries(cataclysm ${LUA51_LIBRARIES})
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
IF(SDL)
|
||||
# Look for SDL2 using pkgconfig
|
||||
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
|
||||
|
||||
# Hardcode these for now since they don't seem to be included in pkg-config
|
||||
# CMake is bound to get SDL2 finders eventually.
|
||||
#PKG_SEARCH_MODULE(SDL2_TTF REQUIRED sdl2_ttf)
|
||||
#PKG_SEARCH_MODULE(SDL2_IMAGE REQUIRED sdl2_image)
|
||||
SET(SDL2_TTF_LIBRARIES -lSDL2_ttf)
|
||||
SET(SDL2_IMAGE_LIBRARIES -lSDL2_image)
|
||||
|
||||
TARGET_LINK_LIBRARIES(cataclysm ${SDL2_LIBRARIES} ${SDL2_TTF_LIBRARIES} ${SDL2_IMAGE_LIBRARIES})
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
# Install GFX directory
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET cataclysm PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/gfx $<TARGET_FILE_DIR:cataclysm>/gfx
|
||||
)
|
||||
|
||||
ADD_DEFINITIONS(-DSDLTILES -DTILES)
|
||||
|
||||
IF(SOUND)
|
||||
SET(SDL2_MIXER_LIBRARIES -lSDL2_mixer)
|
||||
TARGET_LINK_LIBRARIES(cataclysm ${SDL2_MIXER_LIBRARIES})
|
||||
ADD_DEFINITIONS(-DSDL_SOUND)
|
||||
IF(SDL OR TILES)
|
||||
# CMake ships with a few helpful include's to find common libraries
|
||||
# like SDL
|
||||
Include(FindSDL)
|
||||
Include(FindSDL_ttf)
|
||||
|
||||
Find_Package(SDL REQUIRED)
|
||||
Find_Package(SDL_ttf REQUIRED)
|
||||
|
||||
TARGET_LINK_LIBRARIES(cataclysm ${SDL_LIBRARY} ${SDLTTF_LIBRARY})
|
||||
|
||||
IF(TILES)
|
||||
# Install GFX directory
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET cataclysm PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/gfx $<TARGET_FILE_DIR:cataclysm>/gfx
|
||||
)
|
||||
|
||||
Include(FindSDL_image)
|
||||
TARGET_LINK_LIBRARIES(cataclysm ${SDLIMAGE_LIBRARY})
|
||||
ADD_DEFINITIONS(-DSDLTILES -DTILES)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DTILES)
|
||||
ENDIF()
|
||||
|
||||
ELSEIF(MSVC OR MINGW)
|
||||
# On windows our default isn't curses, but rather GDI
|
||||
TARGET_LINK_LIBRARIES(cataclysm gdi32 intl iconv winmm)
|
||||
add_definitions(-Wl,-stack,12000000,-subsystem,windows)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(cataclysm curses)
|
||||
ENDIF()
|
||||
|
||||
+1
-2
@@ -54,11 +54,10 @@ make CROSS=i686-pc-mingw32-
|
||||
Dependencies:
|
||||
* SDL
|
||||
* SDL_ttf
|
||||
* freetype
|
||||
* build essentials
|
||||
|
||||
```
|
||||
sudo apt-get install libsdl1.2-dev libsdl-ttf2.0-dev libfreetype6-dev build-essential
|
||||
sudo apt-get install libsdl1.2-dev libsdl-ttf2.0-dev build-essential
|
||||
```
|
||||
|
||||
### Building ###
|
||||
|
||||
+39
-132
@@ -1,115 +1,64 @@
|
||||
# Building Cataclysm-DDA on Mac OS X
|
||||
|
||||
To build Cataclysm on Mac you'll have to get XCode with command line tools (or just download them separately from https://developer.apple.com/downloads/) and Homebrew package manager.
|
||||
Tested with OS X 10.8.4, Xcode 4.6.2.
|
||||
I haven't played it extensively but it builds and runs.
|
||||
|
||||
Not sure if it compiles with older OS/XCode versions.
|
||||
This worked for me, your mileage may vary.
|
||||
|
||||
### SDL
|
||||
|
||||
## Step 1: Install SDL2
|
||||
SDL, SDL\_image, and SDL\_ttf are needed for the tiles build.
|
||||
|
||||
SDL2, SDL2\_image, and SDL2\_ttf are needed for the tiles build.
|
||||
[**SDL framework**](http://www.libsdl.org/download-1.2.php)
|
||||
http://www.libsdl.org/release/SDL-1.2.15.dmg
|
||||
|
||||
### Option 1: manual download and install
|
||||
[**SDL\_image framework**](http://www.libsdl.org/projects/SDL_image/)
|
||||
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.dmg
|
||||
|
||||
* [**SDL2 framework**](http://www.libsdl.org/download-1.2.php)
|
||||
* Direct download: http://www.libsdl.org/release/SDL2-2.0.3.dmg
|
||||
[**SDL\_ttf framework**](http://www.libsdl.org/projects/SDL_ttf/)
|
||||
http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.dmg
|
||||
|
||||
* [**SDL2\_image framework**](http://www.libsdl.org/projects/SDL_image/)
|
||||
* Direct download: http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.dmg
|
||||
|
||||
* [**SDL2\_ttf framework**](http://www.libsdl.org/projects/SDL_ttf/)
|
||||
* Direct download: http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.12.dmg
|
||||
|
||||
Copy `SDL2.framework`, `SDL2_image.framework`, and `SDL2_ttf.framework`
|
||||
Copy `SDL.framework`, `SDL_image.framework`, and `SDL_ttf.framework`
|
||||
to `/Library/Frameworks` or `/Users/name/Library/Frameworks`.
|
||||
|
||||
### Option 2: Using package manager
|
||||
|
||||
Alternately, shared libraries (libSDL2, libSDL2\_image, libSDL2\_ttf) can be used
|
||||
Alternately, shared libraries (libsdl, libsdl\_image, libsdl\_ttf) can be used
|
||||
instead of frameworks. Install with a package manager (Fink, MacPorts,
|
||||
Homebrew, pkgsrc) or build and install from source.
|
||||
|
||||
For Homebrew (can also install lua):
|
||||
|
||||
brew install sdl2 sdl2_image sdl2_ttf
|
||||
|
||||
For Macports:
|
||||
|
||||
sudo port install libsdl2 libsdl2_image libsdl2_ttf
|
||||
|
||||
|
||||
|
||||
## Step 2: Install ncurses and gettext
|
||||
### ncurses, gettext
|
||||
|
||||
ncurses and gettext are needed for localization.
|
||||
Install with a package manager, or build from source and install.
|
||||
**NOTE: ncurses needs wide character support enabled.**
|
||||
|
||||
For Homebrew:
|
||||
* ncurses needs wide character support enabled.
|
||||
|
||||
brew tap homebrew/dupes
|
||||
brew install gettext ncurses
|
||||
brew link --force gettext ncurses
|
||||
## Build
|
||||
|
||||
**After you build Cataclysm** you might want to to unlink gettext and ncurses with:
|
||||
From the Cataclysm-DDA source folder:
|
||||
|
||||
brew unlink gettext ncurses
|
||||
The easiest way to try it out is the console version without localization:
|
||||
|
||||
Reason: if you build other software, these versions might conflict with what the other software expects.
|
||||
$ make NATIVE=osx LOCALIZED=0 OSX_MIN=10.6
|
||||
|
||||
For localization support and/or to use libsdl (not frameworks):
|
||||
|
||||
For Macports:
|
||||
$ export CXXFLAGS="-I/path/to/include" LDFLAGS="-L/path/to/lib"
|
||||
|
||||
This adds paths to find shared libraries outside of /usr and /usr/local.
|
||||
Multiple `-I/...` or `-L/...` paths can be specified.
|
||||
|
||||
# gettext depends on ncurses, so you don't need to specify ncurses explicitly
|
||||
# gettext also includes libintl
|
||||
sudo port install gettext ncurses
|
||||
hash -r
|
||||
### Example builds:
|
||||
|
||||
Build a release version with SDL graphical tiles:
|
||||
|
||||
## Step 3: Compile
|
||||
$ make FRAMEWORK=1 NATIVE=osx OSX_MIN=10.6 RELEASE=1 TILES=1 LOCALIZE=0
|
||||
|
||||
### Sample compilation commands for current versions of OS X
|
||||
Build a debug version with SDL ASCII:
|
||||
|
||||
One of the following commands will likely work for you. Tweak flags to suit your needs.
|
||||
$ make FRAMEWORK=1 NATIVE=osx OSX_MIN=10.6 SDL=1 LOCALIZE=0
|
||||
|
||||
build a release version, use `SDL` + graphical tiles, don't use `gettext`, and use `Clang` for compilation:
|
||||
|
||||
$ make NATIVE=osx OSX_MIN=10.7 RELEASE=1 TILES=1 LOCALIZE=0 CLANG=1
|
||||
|
||||
build a release version, use `SDL` + graphical tiles, link to libraries in the OS X `Frameworks` folders, don't use `gettext`, and use `Clang` for compilation:
|
||||
|
||||
$ make NATIVE=osx OSX_MIN=10.7 RELEASE=1 TILES=1 FRAMEWORK=1 LOCALIZE=0 CLANG=1
|
||||
|
||||
build a release version, use curses and gettext supplied by Macports:
|
||||
|
||||
$ make NATIVE=osx OSX_MIN=10.7 RELEASE=1 LOCALIZE=1 MACPORTS=1
|
||||
|
||||
### Compile localization files for specified languages
|
||||
|
||||
If you just want to compile localization files for specified languages, you can add `LANGUAGES="<lang_id_1>[ lang_id_2][ ...]"` option to make command, e.g.
|
||||
|
||||
$ make LANGUAGES="zh_CN zh_TW"
|
||||
|
||||
You can get the language ID from the filenames of `*.po` in `lang/po` directory.
|
||||
|
||||
Note: Setting `LOCALIZE=1` may not tell `make` to compile those localization files for you.
|
||||
|
||||
### Make Options
|
||||
|
||||
Description of the options used above. Tweak until things work. More notes are in the `Makefile`.
|
||||
|
||||
* `FRAMEWORK=1` attempt to link to libraries under the OS X `Frameworks` folders; omit to use the usual libsdl, libsdl\_image, libsdl\_ttf (e.g. leave out when you `brew install` the packages).
|
||||
* `LOCALIZE=0` disable localization (to get around possible `gettext` errors if it is not setup correctly); omit to use `gettext`.
|
||||
* `LANGUAGES="<lang_id_1>[ lang_id_2][ ...]"` compile localization files for specified languages. e.g. `LANGUAGES="zh_CN zh_TW"`
|
||||
* `NATIVE=osx` build for OS X.
|
||||
* `OSX_MIN=version` sets `-mmacosx-version-min=` (for OS X > 10.5 set it to 10.6 or higher); omit for 10.5.
|
||||
* `RELEASE=1` build an optimized 'release' version; omit for debug build.
|
||||
* `TILES=1` build the SDL version with graphical tiles (and graphical ASCII); omit to build with `ncurses`.
|
||||
* `CLANG=1` build with [Clang](http://clang.llvm.org/) to get the necessary support for c++11 without needing to reinstall gcc/g++ (which seems like it might cause havoc with certain compilations of things).
|
||||
* `TILES=1` build the SDL version with graphical tiles (and graphical ASCII); omit to build with `ncurses`.
|
||||
* `MACPORTS` build against dependencies installed via Macports, currently only `gettext` and `ncurses`.
|
||||
|
||||
|
||||
## Step 4: Run
|
||||
## Run
|
||||
|
||||
$ ./cataclysm
|
||||
|
||||
@@ -117,60 +66,18 @@ or
|
||||
|
||||
$ ./cataclysm-tiles
|
||||
|
||||
### Make Options
|
||||
|
||||
`FRAMEWORK=1` use frameworks; omit to use libsdl, libsdl\_image, libsdl\_ttf.
|
||||
|
||||
## Step 5 (optional): Application packaging
|
||||
`LOCALIZED=0` disable localization; enabled by default (requires gettext and ncurses with wide character support).
|
||||
|
||||
If you just want to build from source and run the game, this step is not for you.
|
||||
`NATIVE=osx` build for OS X.
|
||||
|
||||
*The `app` build rule will attempt to automate the instructions listed below.*
|
||||
`OSX_MIN=version` set `-mmacosx-version-min=` (for OS X > 10.5 set it to 10.6 or higher); omit for 10.5.
|
||||
|
||||
Create new folder and name it `Cataclysm.app`.
|
||||
`RELEASE=1` build an optimized 'release' version.
|
||||
|
||||
Put compiled binaries (`./cataclysm-tiles` and/or `./cataclysm`) with `./gfx/` and `./data/` folders inside `/Cataclysm.app/Contents/Resources/`.
|
||||
|
||||
To bundle SDL libs copy `SDL2.framework`, `SDL2_image.framework`, and `SDL2_ttf.framework` to `/Cataclysm.app/Contents/Resources/libs/` or shared libs homebrew installed from `/usr/local/Cellar/sdl2*/version/lib/lib*`.
|
||||
|
||||
Create folder `/Cataclysm.app/Contents/MacOS` and file ./Cataclysm within it with this content:
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
PWD=`dirname "${0}"`
|
||||
OSREV=`uname -r | cut -d. -f1`
|
||||
if [ "$OSREV" -ge 11 ] ; then
|
||||
export DYLD_LIBRARY_PATH=${PWD}/../Resources/libs
|
||||
export DYLD_FRAMEWORK_PATH=${PWD}/../Resources/libs
|
||||
else
|
||||
export DYLD_FALLBACK_LIBRARY_PATH=${PWD}/../Resources/libs
|
||||
export DYLD_FALLBACK_FRAMEWORK_PATH=${PWD}/../Resources/libs
|
||||
fi
|
||||
cd "${PWD}/../Resources/"; ./cataclysm-tiles
|
||||
```
|
||||
|
||||
### Creating a DMG
|
||||
|
||||
* Create an new folder named Cataclysm
|
||||
* Move your Cataclysm.app into it
|
||||
* Start Disk Utility
|
||||
* File / New -> Disk Image From Folder
|
||||
* Select the Cataclysm folder you created above.
|
||||
|
||||
Done!
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### ISSUE: crash on startup due to libint.8.dylib aborting
|
||||
|
||||
Basically if you're compiling on Mountain Lion or above, it won't be possible to run successfully on older OS X versions due to libint.8 / pthreads version issue.
|
||||
|
||||
See below (quoted form https://wiki.gnome.org/GTK+/OSX/Building)
|
||||
|
||||
"There's another issue with building on Lion or Mountain Lion using either "native" or the 10.7 SDK: Apple has updated the pthreads implementation to provide recursive locking. This would be good except that Gettext's libintl uses this and if the pthreads implementation doesn't provide it it fabricates its own. Since the Lion pthreads does provide it, libintl links the provided function and then crashes when you try to run it against an older version of the library. The simplest solution is to specify the 10.6 SDK when building on Lion, but that won't work on Mountain Lion, which doesn't include it. See below for how to install and use XCode 3 on Lion and later for building applications compatible with earlier versions of OSX."
|
||||
|
||||
Workaround: install XCode 3 like that article describes, or disable localization support in Cataclysm so gettext/libint are not dependencies. Or else simply don't support OS X versions below 10.7.
|
||||
|
||||
### ISSUE: Colours don't show up correctly.
|
||||
|
||||
Open Terminal's preferences, turn on "Use bright colors for bold text" in "Preferences -> Settings -> Text"
|
||||
`SDL=1` build the SDL version with ASCII characters.
|
||||
|
||||
`TILES=1` build the SDL version with graphical tiles.
|
||||
|
||||
+2
-25
@@ -2,9 +2,6 @@
|
||||
|
||||
Contributing to Cataclysm: Dark Days Ahead is easy - simply fork the repository here on GitHub, 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 http://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:
|
||||
@@ -16,14 +13,14 @@ There are a couple of guidelines we suggest sticking to:
|
||||
|
||||
## Code Style
|
||||
|
||||
Current policy is to only update code to the standard style when changing a substantial portion of it, but **please** do this in a separate commit. Blocks of code can be passed through astyle
|
||||
Current policy is to only update code to the standard style when changing a substantial portion of it, but **please** do this in a seperate commit. Blocks of code can be passed through astyle
|
||||
to ensure that their formatting is correct:
|
||||
|
||||
astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
|
||||
|
||||
For example, from vi, set marks a and b around the block, then:
|
||||
|
||||
:'a,'b ! astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
|
||||
:'a,'b ! astyle --style=1tbs --indent-spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
|
||||
|
||||
|
||||
## Doxygen Comments
|
||||
@@ -132,7 +129,6 @@ http://www.stack.nl/~dimitri/doxygen/manual/faq.html
|
||||
* Mark pull requests that are still being worked on with [WIP] at the end of the title
|
||||
* When a pull request is ready to be reviewed remove the [WIP]
|
||||
* Mark pull requests that need commenting/testing by others with [CR]
|
||||
* If the pull request fixes a issue listed on github, include "fixes #???" into the text, where ??? is the number of the issue. This automatically closes the issue when the PR is pulled in, and allows mergers to work slightly faster. For further details see issue #2419.
|
||||
|
||||
## Advanced Techniques
|
||||
|
||||
@@ -177,26 +173,7 @@ You can also set the tracking information at the same time as creating the branc
|
||||
To https://github.com/YOUR_USERNAME/Cataclysm-DDA.git
|
||||
xxxx..xxxx new_feature -> new_feature
|
||||
|
||||
#### PR Tags
|
||||
If you file a PR but you're still working on it, please add a [WIP] at the end of the title text. This will tell the reviewers that you still intend to add more to the PR and we don't need to review it yet. When it's ready to be reviewed by a merger just edit the title text to remove the [WIP].
|
||||
|
||||
If you are also looking for suggestions then mark it with [CR] - (comments requested).
|
||||
|
||||
This can help speed up our review process by allowing us to only review the things that are ready for it, and will prevent anything that isn't completely ready from being merged in.
|
||||
|
||||
One more thing: when marking your PR as closing, fixing, or resolving issues, please include "XXXX #???" somewhere in the description, where XXX is on this list:
|
||||
close
|
||||
closes
|
||||
closed
|
||||
fix
|
||||
fixes
|
||||
fixed
|
||||
resolve
|
||||
resolves
|
||||
resolved
|
||||
And ??? is the number. This automatically closes the issue when the PR is pulled in, and allows mergers to work slightly faster. To close multiple issues format it as "XXXX #???, XXXX#???".
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
####Why does `git pull --ff-only` result in an error?
|
||||
|
||||
+247
-296
@@ -8,7 +8,7 @@
|
||||
<Build>
|
||||
<Target title="Release">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -19,7 +19,7 @@
|
||||
</Target>
|
||||
<Target title="Release - Localized">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -35,7 +35,7 @@
|
||||
</Target>
|
||||
<Target title="Release -SDL">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -43,9 +43,9 @@
|
||||
<Add option="-O2" />
|
||||
<Add option="-DTILES" />
|
||||
<Add option="-DRELEASE=1" />
|
||||
<Add directory="WinDepend/SDLttf/SDL_ttf-2.0.11/include" />
|
||||
<Add directory="WinDepend/SDL-1.2.15/include/SDL" />
|
||||
<Add directory="WinDepend/SDLImg_binVC/SDL_image-1.2.12/include" />
|
||||
<Add directory="WinDepend\SDLttf\SDL_ttf-2.0.11\include" />
|
||||
<Add directory="WinDepend\SDL-1.2.15\include\SDL" />
|
||||
<Add directory="WinDepend\SDLImg_binVC\SDL_image-1.2.12\include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="libSDL.dll" />
|
||||
@@ -54,15 +54,15 @@
|
||||
<Add library="WinDepend\SDL-1.2.15\lib\libSDL.dll.a" />
|
||||
<Add library="WinDepend\SDL-1.2.15\lib\libSDLmain.a" />
|
||||
<Add library="WinDepend\SDLImg_binVC\SDL_image-1.2.12\lib\x86\SDL_image.lib" />
|
||||
<Add directory="WinDepend/SDL-1.2.15/lib" />
|
||||
<Add directory="WinDepend/SDLttf/SDL_ttf-2.0.11/lib/x86" />
|
||||
<Add directory="WinDepend/libiconv/lib" />
|
||||
<Add directory="WinDepend/SDLImg_binVC/SDL_image-1.2.12/lib/x86" />
|
||||
<Add directory="WinDepend\SDL-1.2.15\lib" />
|
||||
<Add directory="WinDepend\SDLttf\SDL_ttf-2.0.11\lib\x86" />
|
||||
<Add directory="WinDepend\libiconv\lib" />
|
||||
<Add directory="WinDepend\SDLImg_binVC\SDL_image-1.2.12\lib\x86" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Release -SDL -Localized">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option object_output="obj\Release\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -72,9 +72,9 @@
|
||||
<Add option="-DTILES" />
|
||||
<Add option="-DSDLTILES" />
|
||||
<Add option="-DRELEASE=1" />
|
||||
<Add directory="WinDepend/SDLttf/SDL_ttf-2.0.11/include" />
|
||||
<Add directory="WinDepend/SDL-1.2.15/include/SDL" />
|
||||
<Add directory="WinDepend/SDLImg_binVC/SDL_image-1.2.12/include" />
|
||||
<Add directory="WinDepend\SDLttf\SDL_ttf-2.0.11\include" />
|
||||
<Add directory="WinDepend\SDL-1.2.15\include\SDL" />
|
||||
<Add directory="WinDepend\SDLImg_binVC\SDL_image-1.2.12\include" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add library="intl" />
|
||||
@@ -83,15 +83,15 @@
|
||||
<Add library="WinDepend\SDL-1.2.15\lib\libSDL.dll.a" />
|
||||
<Add library="WinDepend\SDL-1.2.15\lib\libSDLmain.a" />
|
||||
<Add library="WinDepend\SDLImg_binVC\SDL_image-1.2.12\lib\x86\SDL_image.lib" />
|
||||
<Add directory="WinDepend/SDL-1.2.15/lib" />
|
||||
<Add directory="WinDepend/SDLttf/SDL_ttf-2.0.11/lib/x86" />
|
||||
<Add directory="WinDepend/libiconv/lib" />
|
||||
<Add directory="WinDepend/SDLImg_binVC/SDL_image-1.2.12/lib/x86" />
|
||||
<Add directory="WinDepend\SDL-1.2.15\lib" />
|
||||
<Add directory="WinDepend\SDLttf\SDL_ttf-2.0.11\lib\x86" />
|
||||
<Add directory="WinDepend\libiconv\lib" />
|
||||
<Add directory="WinDepend\SDLImg_binVC\SDL_image-1.2.12\lib\x86" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Debug">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -104,7 +104,7 @@
|
||||
</Target>
|
||||
<Target title="Debug - Localized">
|
||||
<Option output="Cataclysm" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option object_output="obj\Debug\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -120,7 +120,7 @@
|
||||
</Target>
|
||||
<Target title="Release - Tile Support">
|
||||
<Option output="Cataclysm-Tiles" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/TilesRelease/" />
|
||||
<Option object_output="obj\TilesRelease\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -137,13 +137,13 @@
|
||||
<Add library="3rdparty\lib\libSDLmain.a" />
|
||||
<Add library="3rdparty\lib\x86\SDL_image.lib" />
|
||||
<Add library="3rdparty\lib\x86\SDL_ttf.lib" />
|
||||
<Add directory="3rdparty/lib" />
|
||||
<Add directory="3rdparty/lib/x86" />
|
||||
<Add directory="3rdparty\lib" />
|
||||
<Add directory="3rdparty\lib\x86" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Target title="Debug - Tile Support">
|
||||
<Option output="Cataclysm-Tiles" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/TilesRelease/" />
|
||||
<Option object_output="obj\TilesRelease\" />
|
||||
<Option type="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
@@ -161,8 +161,8 @@
|
||||
<Add library="3rdparty\lib\libSDLmain.a" />
|
||||
<Add library="3rdparty\lib\x86\SDL_image.lib" />
|
||||
<Add library="3rdparty\lib\x86\SDL_ttf.lib" />
|
||||
<Add directory="3rdparty/lib" />
|
||||
<Add directory="3rdparty/lib/x86" />
|
||||
<Add directory="3rdparty\lib" />
|
||||
<Add directory="3rdparty\lib\x86" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
@@ -170,7 +170,6 @@
|
||||
<Add option="-Wextra" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter" />
|
||||
<Add option="-std=c++11" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-Wl,-stack,12000000,-subsystem,windows" />
|
||||
@@ -178,277 +177,229 @@
|
||||
<Add library="gdi32" />
|
||||
<Add library="winmm" />
|
||||
</Linker>
|
||||
<Unit filename="src/action.cpp" />
|
||||
<Unit filename="src/action.h" />
|
||||
<Unit filename="src/active_item_cache.cpp" />
|
||||
<Unit filename="src/active_item_cache.h" />
|
||||
<Unit filename="src/activity_handlers.cpp" />
|
||||
<Unit filename="src/activity_handlers.h" />
|
||||
<Unit filename="src/activity_item_handling.cpp" />
|
||||
<Unit filename="src/addiction.cpp" />
|
||||
<Unit filename="src/addiction.h" />
|
||||
<Unit filename="src/advanced_inv.cpp" />
|
||||
<Unit filename="src/advanced_inv.h" />
|
||||
<Unit filename="src/ammo.cpp" />
|
||||
<Unit filename="src/ammo.h" />
|
||||
<Unit filename="src/animation_curses.cpp" />
|
||||
<Unit filename="src/animation_tiles.cpp" />
|
||||
<Unit filename="src/armor_layers.cpp" />
|
||||
<Unit filename="src/armor_layers.h" />
|
||||
<Unit filename="src/artifact.cpp" />
|
||||
<Unit filename="src/artifact.h" />
|
||||
<Unit filename="src/auto_pickup.cpp" />
|
||||
<Unit filename="src/auto_pickup.h" />
|
||||
<Unit filename="src/basecamp.cpp" />
|
||||
<Unit filename="src/basecamp.h" />
|
||||
<Unit filename="src/bionics.cpp" />
|
||||
<Unit filename="src/bionics.h" />
|
||||
<Unit filename="src/bodypart.cpp" />
|
||||
<Unit filename="src/bodypart.h" />
|
||||
<Unit filename="src/calendar.cpp" />
|
||||
<Unit filename="src/calendar.h" />
|
||||
<Unit filename="src/cata_tiles.cpp" />
|
||||
<Unit filename="src/cata_tiles.h" />
|
||||
<Unit filename="src/catacharset.cpp" />
|
||||
<Unit filename="src/catacharset.h" />
|
||||
<Unit filename="src/catacurse.h" />
|
||||
<Unit filename="src/catalua.cpp" />
|
||||
<Unit filename="src/catalua.h" />
|
||||
<Unit filename="src/char_validity_check.cpp" />
|
||||
<Unit filename="src/char_validity_check.h" />
|
||||
<Unit filename="src/character.cpp" />
|
||||
<Unit filename="src/character.h" />
|
||||
<Unit filename="src/clzones.cpp" />
|
||||
<Unit filename="src/clzones.h" />
|
||||
<Unit filename="src/color.cpp" />
|
||||
<Unit filename="src/color.h" />
|
||||
<Unit filename="src/compatibility.h" />
|
||||
<Unit filename="src/computer.cpp" />
|
||||
<Unit filename="src/computer.h" />
|
||||
<Unit filename="src/construction.cpp" />
|
||||
<Unit filename="src/construction.h" />
|
||||
<Unit filename="src/coordinates.h" />
|
||||
<Unit filename="src/crafting.cpp" />
|
||||
<Unit filename="src/crafting.h" />
|
||||
<Unit filename="src/creature.cpp" />
|
||||
<Unit filename="src/creature.h" />
|
||||
<Unit filename="src/creature_tracker.cpp" />
|
||||
<Unit filename="src/creature_tracker.h" />
|
||||
<Unit filename="src/cursesdef.h" />
|
||||
<Unit filename="src/cursesport.cpp" />
|
||||
<Unit filename="src/damage.cpp" />
|
||||
<Unit filename="src/damage.h" />
|
||||
<Unit filename="src/debug.cpp" />
|
||||
<Unit filename="src/debug.h" />
|
||||
<Unit filename="src/defense.cpp" />
|
||||
<Unit filename="src/dependency_tree.cpp" />
|
||||
<Unit filename="src/dependency_tree.h" />
|
||||
<Unit filename="src/dialogue.h" />
|
||||
<Unit filename="src/disease.cpp" />
|
||||
<Unit filename="src/disease.h" />
|
||||
<Unit filename="src/editmap.cpp" />
|
||||
<Unit filename="src/editmap.h" />
|
||||
<Unit filename="src/effect.cpp" />
|
||||
<Unit filename="src/effect.h" />
|
||||
<Unit filename="src/enums.h" />
|
||||
<Unit filename="src/event.cpp" />
|
||||
<Unit filename="src/event.h" />
|
||||
<Unit filename="src/faction.cpp" />
|
||||
<Unit filename="src/faction.h" />
|
||||
<Unit filename="src/field.cpp" />
|
||||
<Unit filename="src/field.h" />
|
||||
<Unit filename="src/filesystem.cpp" />
|
||||
<Unit filename="src/filesystem.h" />
|
||||
<Unit filename="src/game.cpp" />
|
||||
<Unit filename="src/game.h" />
|
||||
<Unit filename="src/game_constants.h" />
|
||||
<Unit filename="src/gamemode.cpp" />
|
||||
<Unit filename="src/gamemode.h" />
|
||||
<Unit filename="src/get_version.h" />
|
||||
<Unit filename="src/help.cpp" />
|
||||
<Unit filename="src/help.h" />
|
||||
<Unit filename="src/iexamine.cpp" />
|
||||
<Unit filename="src/iexamine.h" />
|
||||
<Unit filename="src/init.cpp" />
|
||||
<Unit filename="src/init.h" />
|
||||
<Unit filename="src/input.cpp" />
|
||||
<Unit filename="src/input.h" />
|
||||
<Unit filename="src/inventory.cpp" />
|
||||
<Unit filename="src/inventory.h" />
|
||||
<Unit filename="src/inventory_ui.cpp" />
|
||||
<Unit filename="src/item.cpp" />
|
||||
<Unit filename="src/item.h" />
|
||||
<Unit filename="src/item_action.cpp" />
|
||||
<Unit filename="src/item_action.h" />
|
||||
<Unit filename="src/item_factory.cpp" />
|
||||
<Unit filename="src/item_factory.h" />
|
||||
<Unit filename="src/item_group.cpp" />
|
||||
<Unit filename="src/item_group.h" />
|
||||
<Unit filename="src/item_stack.h" />
|
||||
<Unit filename="src/itype.h" />
|
||||
<Unit filename="src/itypedef.cpp" />
|
||||
<Unit filename="src/iuse.cpp" />
|
||||
<Unit filename="src/iuse.h" />
|
||||
<Unit filename="src/iuse_actor.cpp" />
|
||||
<Unit filename="src/iuse_actor.h" />
|
||||
<Unit filename="src/iuse_software.cpp" />
|
||||
<Unit filename="src/iuse_software.h" />
|
||||
<Unit filename="src/iuse_software_kitten.cpp" />
|
||||
<Unit filename="src/iuse_software_kitten.h" />
|
||||
<Unit filename="src/iuse_software_snake.cpp" />
|
||||
<Unit filename="src/iuse_software_snake.h" />
|
||||
<Unit filename="src/iuse_software_sokoban.cpp" />
|
||||
<Unit filename="src/iuse_software_sokoban.h" />
|
||||
<Unit filename="src/json.cpp" />
|
||||
<Unit filename="src/json.h" />
|
||||
<Unit filename="src/lightmap.cpp" />
|
||||
<Unit filename="src/lightmap.h" />
|
||||
<Unit filename="src/line.cpp" />
|
||||
<Unit filename="src/line.h" />
|
||||
<Unit filename="src/live_view.cpp" />
|
||||
<Unit filename="src/live_view.h" />
|
||||
<Unit filename="src/main.cpp" />
|
||||
<Unit filename="src/main_menu.cpp" />
|
||||
<Unit filename="src/map.cpp" />
|
||||
<Unit filename="src/map.h" />
|
||||
<Unit filename="src/mapbuffer.cpp" />
|
||||
<Unit filename="src/mapbuffer.h" />
|
||||
<Unit filename="src/mapdata.cpp" />
|
||||
<Unit filename="src/mapdata.h" />
|
||||
<Unit filename="src/mapgen.cpp" />
|
||||
<Unit filename="src/mapgen.h" />
|
||||
<Unit filename="src/mapgen_functions.cpp" />
|
||||
<Unit filename="src/mapgen_functions.h" />
|
||||
<Unit filename="src/mapgenformat.cpp" />
|
||||
<Unit filename="src/mapgenformat.h" />
|
||||
<Unit filename="src/mapsharing.cpp" />
|
||||
<Unit filename="src/mapsharing.h" />
|
||||
<Unit filename="src/martialarts.cpp" />
|
||||
<Unit filename="src/martialarts.h" />
|
||||
<Unit filename="src/material.cpp" />
|
||||
<Unit filename="src/material.h" />
|
||||
<Unit filename="src/melee.cpp" />
|
||||
<Unit filename="src/messages.cpp" />
|
||||
<Unit filename="src/messages.h" />
|
||||
<Unit filename="src/mission.cpp" />
|
||||
<Unit filename="src/mission.h" />
|
||||
<Unit filename="src/mission_end.cpp" />
|
||||
<Unit filename="src/mission_fail.cpp" />
|
||||
<Unit filename="src/mission_place.cpp" />
|
||||
<Unit filename="src/mission_start.cpp" />
|
||||
<Unit filename="src/missiondef.cpp" />
|
||||
<Unit filename="src/mod_manager.cpp" />
|
||||
<Unit filename="src/mod_manager.h" />
|
||||
<Unit filename="src/mod_manager_ui.cpp" />
|
||||
<Unit filename="src/monattack.cpp" />
|
||||
<Unit filename="src/monattack.h" />
|
||||
<Unit filename="src/mondeath.cpp" />
|
||||
<Unit filename="src/mondeath.h" />
|
||||
<Unit filename="src/mondefense.cpp" />
|
||||
<Unit filename="src/mondefense.h" />
|
||||
<Unit filename="src/mongroup.h" />
|
||||
<Unit filename="src/mongroupdef.cpp" />
|
||||
<Unit filename="src/monmove.cpp" />
|
||||
<Unit filename="src/monster.cpp" />
|
||||
<Unit filename="src/monster.h" />
|
||||
<Unit filename="src/monstergenerator.cpp" />
|
||||
<Unit filename="src/monstergenerator.h" />
|
||||
<Unit filename="src/morale.h" />
|
||||
<Unit filename="src/moraledata.h" />
|
||||
<Unit filename="src/mtype.h" />
|
||||
<Unit filename="src/mtypedef.cpp" />
|
||||
<Unit filename="src/mutation.cpp" />
|
||||
<Unit filename="src/mutation.h" />
|
||||
<Unit filename="src/mutation_data.cpp" />
|
||||
<Unit filename="src/name.cpp" />
|
||||
<Unit filename="src/name.h" />
|
||||
<Unit filename="src/newcharacter.cpp" />
|
||||
<Unit filename="src/nonplayer.cpp" />
|
||||
<Unit filename="src/nonplayer.h" />
|
||||
<Unit filename="src/npc.cpp" />
|
||||
<Unit filename="src/npc.h" />
|
||||
<Unit filename="src/npcmove.cpp" />
|
||||
<Unit filename="src/npctalk.cpp" />
|
||||
<Unit filename="src/omdata.h" />
|
||||
<Unit filename="src/options.cpp" />
|
||||
<Unit filename="src/options.h" />
|
||||
<Unit filename="src/output.cpp" />
|
||||
<Unit filename="src/output.h" />
|
||||
<Unit filename="src/overmap.cpp" />
|
||||
<Unit filename="src/overmap.h" />
|
||||
<Unit filename="src/overmapbuffer.cpp" />
|
||||
<Unit filename="src/overmapbuffer.h" />
|
||||
<Unit filename="src/path_info.cpp" />
|
||||
<Unit filename="src/path_info.h" />
|
||||
<Unit filename="src/pickup.cpp" />
|
||||
<Unit filename="src/pickup.h" />
|
||||
<Unit filename="src/platform_win.h" />
|
||||
<Unit filename="src/player.cpp" />
|
||||
<Unit filename="src/player.h" />
|
||||
<Unit filename="src/player_activity.cpp" />
|
||||
<Unit filename="src/player_activity.h" />
|
||||
<Unit filename="src/pldata.h" />
|
||||
<Unit filename="src/posix_time.cpp" />
|
||||
<Unit filename="src/posix_time.h" />
|
||||
<Unit filename="src/profession.cpp" />
|
||||
<Unit filename="src/profession.h" />
|
||||
<Unit filename="src/ranged.cpp" />
|
||||
<Unit filename="src/requirements.cpp" />
|
||||
<Unit filename="src/requirements.h" />
|
||||
<Unit filename="src/resource.rc">
|
||||
<Unit filename="SDLMain.h" />
|
||||
<Unit filename="action.cpp" />
|
||||
<Unit filename="action.h" />
|
||||
<Unit filename="addiction.cpp" />
|
||||
<Unit filename="addiction.h" />
|
||||
<Unit filename="advanced_inv.cpp" />
|
||||
<Unit filename="advanced_inv.h" />
|
||||
<Unit filename="animation_curses.cpp" />
|
||||
<Unit filename="animation_tiles.cpp" />
|
||||
<Unit filename="artifact.cpp" />
|
||||
<Unit filename="artifact.h" />
|
||||
<Unit filename="artifactdata.h" />
|
||||
<Unit filename="auto_pickup.cpp" />
|
||||
<Unit filename="auto_pickup.h" />
|
||||
<Unit filename="basecamp.cpp" />
|
||||
<Unit filename="basecamp.h" />
|
||||
<Unit filename="bionics.cpp" />
|
||||
<Unit filename="bionics.h" />
|
||||
<Unit filename="bodypart.cpp" />
|
||||
<Unit filename="bodypart.h" />
|
||||
<Unit filename="building_generation.cpp" />
|
||||
<Unit filename="building_generation.h" />
|
||||
<Unit filename="calendar.cpp" />
|
||||
<Unit filename="calendar.h" />
|
||||
<Unit filename="cata_tiles.cpp" />
|
||||
<Unit filename="cata_tiles.h" />
|
||||
<Unit filename="catacharset.cpp" />
|
||||
<Unit filename="catacharset.h" />
|
||||
<Unit filename="catacurse.h" />
|
||||
<Unit filename="char_validity_check.cpp" />
|
||||
<Unit filename="char_validity_check.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="coordinates.h" />
|
||||
<Unit filename="crafting.cpp" />
|
||||
<Unit filename="crafting.h" />
|
||||
<Unit filename="cursesdef.h" />
|
||||
<Unit filename="cursesport.cpp" />
|
||||
<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="editmap.cpp" />
|
||||
<Unit filename="editmap.h" />
|
||||
<Unit filename="enums.h" />
|
||||
<Unit filename="event.cpp" />
|
||||
<Unit filename="event.h" />
|
||||
<Unit filename="faction.cpp" />
|
||||
<Unit filename="faction.h" />
|
||||
<Unit filename="field.cpp" />
|
||||
<Unit filename="field.h" />
|
||||
<Unit filename="file_finder.cpp" />
|
||||
<Unit filename="file_finder.h" />
|
||||
<Unit filename="game.cpp" />
|
||||
<Unit filename="game.h" />
|
||||
<Unit filename="gamemode.cpp" />
|
||||
<Unit filename="gamemode.h" />
|
||||
<Unit filename="gamesave.cpp" />
|
||||
<Unit filename="get_version.h" />
|
||||
<Unit filename="graffiti.cpp" />
|
||||
<Unit filename="graffiti.h" />
|
||||
<Unit filename="help.cpp" />
|
||||
<Unit filename="helper.cpp" />
|
||||
<Unit filename="helper.h" />
|
||||
<Unit filename="iexamine.cpp" />
|
||||
<Unit filename="iexamine.h" />
|
||||
<Unit filename="init.cpp" />
|
||||
<Unit filename="init.h" />
|
||||
<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="item_factory.cpp" />
|
||||
<Unit filename="item_factory.h" />
|
||||
<Unit filename="item_group.cpp" />
|
||||
<Unit filename="item_group.h" />
|
||||
<Unit filename="itype.h" />
|
||||
<Unit filename="itypedef.cpp" />
|
||||
<Unit filename="iuse.cpp" />
|
||||
<Unit filename="iuse.h" />
|
||||
<Unit filename="iuse_software.cpp" />
|
||||
<Unit filename="iuse_software.h" />
|
||||
<Unit filename="iuse_software_kitten.cpp" />
|
||||
<Unit filename="iuse_software_kitten.h" />
|
||||
<Unit filename="iuse_software_snake.cpp" />
|
||||
<Unit filename="iuse_software_snake.h" />
|
||||
<Unit filename="iuse_software_sokoban.cpp" />
|
||||
<Unit filename="iuse_software_sokoban.h" />
|
||||
<Unit filename="json.cpp" />
|
||||
<Unit filename="json.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="main_menu.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="mapgenformat.cpp" />
|
||||
<Unit filename="mapgenformat.h" />
|
||||
<Unit filename="mapitems.h" />
|
||||
<Unit filename="martialarts.cpp" />
|
||||
<Unit filename="martialarts.h" />
|
||||
<Unit filename="material.cpp" />
|
||||
<Unit filename="material.h" />
|
||||
<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="mod_factory.h" />
|
||||
<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="monstergenerator.cpp" />
|
||||
<Unit filename="monstergenerator.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="overmapbuffer.cpp" />
|
||||
<Unit filename="overmapbuffer.h" />
|
||||
<Unit filename="picofunc.cpp" />
|
||||
<Unit filename="picofunc.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="profession.cpp" />
|
||||
<Unit filename="profession.h" />
|
||||
<Unit filename="ranged.cpp" />
|
||||
<Unit filename="resource.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="src/rng.cpp" />
|
||||
<Unit filename="src/rng.h" />
|
||||
<Unit filename="src/savegame.cpp" />
|
||||
<Unit filename="src/savegame.h" />
|
||||
<Unit filename="src/savegame_json.cpp" />
|
||||
<Unit filename="src/savegame_legacy.cpp" />
|
||||
<Unit filename="src/scenario.cpp" />
|
||||
<Unit filename="src/scenario.h" />
|
||||
<Unit filename="src/sdltiles.cpp" />
|
||||
<Unit filename="src/simplexnoise.cpp" />
|
||||
<Unit filename="src/simplexnoise.h" />
|
||||
<Unit filename="src/skill.cpp" />
|
||||
<Unit filename="src/skill.h" />
|
||||
<Unit filename="src/sounds.cpp" />
|
||||
<Unit filename="src/sounds.h" />
|
||||
<Unit filename="src/speech.cpp" />
|
||||
<Unit filename="src/speech.h" />
|
||||
<Unit filename="src/start_location.cpp" />
|
||||
<Unit filename="src/start_location.h" />
|
||||
<Unit filename="src/text_snippets.cpp" />
|
||||
<Unit filename="src/text_snippets.h" />
|
||||
<Unit filename="src/tile_id_data.h" />
|
||||
<Unit filename="src/tileray.cpp" />
|
||||
<Unit filename="src/tileray.h" />
|
||||
<Unit filename="src/translations.cpp" />
|
||||
<Unit filename="src/translations.h" />
|
||||
<Unit filename="src/trap.h" />
|
||||
<Unit filename="src/trapdef.cpp" />
|
||||
<Unit filename="src/trapfunc.cpp" />
|
||||
<Unit filename="src/tutorial.cpp" />
|
||||
<Unit filename="src/tutorial.h" />
|
||||
<Unit filename="src/ui.cpp" />
|
||||
<Unit filename="src/ui.h" />
|
||||
<Unit filename="src/uistate.h" />
|
||||
<Unit filename="src/veh_interact.cpp" />
|
||||
<Unit filename="src/veh_interact.h" />
|
||||
<Unit filename="src/veh_type.h" />
|
||||
<Unit filename="src/veh_typedef.cpp" />
|
||||
<Unit filename="src/vehicle.cpp" />
|
||||
<Unit filename="src/vehicle.h" />
|
||||
<Unit filename="src/version.cpp" />
|
||||
<Unit filename="src/wdirent.h" />
|
||||
<Unit filename="src/weather.cpp" />
|
||||
<Unit filename="src/weather.h" />
|
||||
<Unit filename="src/weather_data.cpp" />
|
||||
<Unit filename="src/weather_gen.cpp" />
|
||||
<Unit filename="src/weather_gen.h" />
|
||||
<Unit filename="src/wincurse.cpp" />
|
||||
<Unit filename="src/wish.cpp" />
|
||||
<Unit filename="src/worldfactory.cpp" />
|
||||
<Unit filename="src/worldfactory.h" />
|
||||
<Unit filename="rng.cpp" />
|
||||
<Unit filename="rng.h" />
|
||||
<Unit filename="savegame_json.cpp" />
|
||||
<Unit filename="savegame_legacy.cpp" />
|
||||
<Unit filename="sdltiles.cpp" />
|
||||
<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="text_snippets.cpp" />
|
||||
<Unit filename="text_snippets.h" />
|
||||
<Unit filename="tile_id_data.h" />
|
||||
<Unit filename="tileray.cpp" />
|
||||
<Unit filename="tileray.h" />
|
||||
<Unit filename="translations.cpp" />
|
||||
<Unit filename="translations.h" />
|
||||
<Unit filename="trap.h" />
|
||||
<Unit filename="trapdef.cpp" />
|
||||
<Unit filename="trapfunc.cpp" />
|
||||
<Unit filename="tutorial.cpp" />
|
||||
<Unit filename="tutorial.h" />
|
||||
<Unit filename="ui.cpp" />
|
||||
<Unit filename="ui.h" />
|
||||
<Unit filename="uistate.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="version.cpp" />
|
||||
<Unit filename="wcwidth.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="wdirent.h" />
|
||||
<Unit filename="weather.cpp" />
|
||||
<Unit filename="weather.h" />
|
||||
<Unit filename="weather_data.cpp" />
|
||||
<Unit filename="wincurse.cpp" />
|
||||
<Unit filename="wish.cpp" />
|
||||
<Unit filename="worldfactory.cpp" />
|
||||
<Unit filename="worldfactory.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<debugger />
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
Cataclysm is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
|
||||
|
||||
The Square font (data/font/square.ttf) is copyright Wouter van Oortmerssen, licensed under Creative Commons Attribution 3.0 Unported License. See http://strlen.com/square for more information.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Platforms:
|
||||
# Linux/Cygwin native
|
||||
# Linux native
|
||||
# (don't need to do anything)
|
||||
# Linux 64-bit
|
||||
# make NATIVE=linux64
|
||||
@@ -10,7 +10,7 @@
|
||||
# or make CROSS=i586-mingw32msvc-
|
||||
# or whichever prefix your crosscompiler uses
|
||||
# as long as its name contains mingw32
|
||||
# Win32 (non-Cygwin)
|
||||
# Win32
|
||||
# Run: make NATIVE=win32
|
||||
# OS X
|
||||
# Run: make NATIVE=osx
|
||||
@@ -18,46 +18,23 @@
|
||||
# Build types:
|
||||
# Debug (no optimizations)
|
||||
# Default
|
||||
# ccache (use compilation caches)
|
||||
# make CCACHE=1
|
||||
# Release (turn on optimizations)
|
||||
# make RELEASE=1
|
||||
# Tiles (uses SDL rather than ncurses)
|
||||
# make TILES=1
|
||||
# Sound (requires SDL, so TILES must be enabled)
|
||||
# make TILES=1 SOUND=1
|
||||
# Disable gettext, on some platforms the dependencies are hard to wrangle.
|
||||
# make LOCALIZE=0
|
||||
# Compile localization files for specified languages
|
||||
# make LANGUAGES="<lang_id_1>[ lang_id_2][ ...]"
|
||||
# (for example: make LANGUAGES="zh_CN zh_TW" for Chinese)
|
||||
# Enable experimental z-levels
|
||||
# make ZLEVELS=1
|
||||
# Install to system directories.
|
||||
# make install
|
||||
# Enable lua debug support
|
||||
# make LUA=1
|
||||
# Use user's home directory for save files.
|
||||
# make USE_HOME_DIR=1
|
||||
# Use dynamic linking (requires system libraries).
|
||||
# make DYNAMIC_LINKING=1
|
||||
|
||||
# comment these to toggle them as one sees fit.
|
||||
# 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
|
||||
# RELEASE is flags for release builds, we want to error on everything to make sure
|
||||
# we don't check in code with new warnings, but we also have to disable some classes of warnings
|
||||
# for now as we get rid of them. In non-release builds we want to show all the warnings,
|
||||
# even the ones we're allowing in release builds so they're visible to developers.
|
||||
RELEASE_FLAGS = -Werror
|
||||
WARNINGS = -Wall -Wextra
|
||||
WARNINGS = -Werror -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-narrowing -Wno-maybe-uninitialized
|
||||
# Uncomment below to disable warnings
|
||||
#WARNINGS = -w
|
||||
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
|
||||
DEBUG = -g
|
||||
else
|
||||
DEBUG = -g -D_GLIBCXX_DEBUG
|
||||
endif
|
||||
DEBUG = -g
|
||||
#PROFILE = -pg
|
||||
#OTHERS = -O3
|
||||
#DEFINES = -DNDEBUG
|
||||
@@ -77,23 +54,17 @@ endif
|
||||
#DEFINES += -DDEBUG_ENABLE_MAP_GEN
|
||||
#DEFINES += -DDEBUG_ENABLE_GAME
|
||||
|
||||
VERSION = 0.C
|
||||
VERSION = 0.9
|
||||
|
||||
|
||||
TARGET = cataclysm
|
||||
TILESTARGET = cataclysm-tiles
|
||||
W32TILESTARGET = cataclysm-tiles.exe
|
||||
W32TARGET = cataclysm.exe
|
||||
CHKJSON_BIN = chkjson
|
||||
BINDIST_DIR = bindist
|
||||
BUILD_DIR = $(CURDIR)
|
||||
SRC_DIR = src
|
||||
LUA_DIR = lua
|
||||
LUASRC_DIR = src/lua
|
||||
# if you have LUAJIT installed, try make LUA_BINARY=luajit for extra speed
|
||||
LUA_BINARY = lua
|
||||
LOCALIZE = 1
|
||||
|
||||
|
||||
# tiles object directories are because gcc gets confused
|
||||
# when preprocessor defines change, but the source doesn't
|
||||
ODIR = obj
|
||||
@@ -102,69 +73,44 @@ W32ODIR = objwin
|
||||
W32ODIRTILES = objwin/tiles
|
||||
DDIR = .deps
|
||||
|
||||
OS = $(shell uname -s)
|
||||
ifdef CCACHE
|
||||
CXX = ccache $(CROSS)g++
|
||||
LD = ccache $(CROSS)g++
|
||||
else
|
||||
CXX = $(CROSS)g++
|
||||
LD = $(CROSS)g++
|
||||
endif
|
||||
OS = $(shell uname -o)
|
||||
CXX = $(CROSS)g++
|
||||
LD = $(CROSS)g++
|
||||
RC = $(CROSS)windres
|
||||
|
||||
# enable optimizations. slow to build
|
||||
ifdef RELEASE
|
||||
ifeq ($(NATIVE), osx)
|
||||
CXXFLAGS += -O3
|
||||
else
|
||||
CXXFLAGS += -Os
|
||||
LDFLAGS += -s
|
||||
endif
|
||||
# OTHERS += -mmmx -m3dnow -msse -msse2 -msse3 -mfpmath=sse -mtune=native
|
||||
# Strip symbols, generates smaller executable.
|
||||
OTHERS += $(RELEASE_FLAGS)
|
||||
OTHERS += -O3
|
||||
DEBUG =
|
||||
DEFINES += -DRELEASE
|
||||
endif
|
||||
|
||||
ifdef CLANG
|
||||
ifeq ($(NATIVE), osx)
|
||||
OTHERS += -stdlib=libc++
|
||||
endif
|
||||
ifdef CCACHE
|
||||
CXX = CCACHE_CPP2=1 ccache $(CROSS)clang++
|
||||
LD = CCACHE_CPP2=1 ccache $(CROSS)clang++
|
||||
else
|
||||
CXX = $(CROSS)clang++
|
||||
LD = $(CROSS)clang++
|
||||
endif
|
||||
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-type-limits -Wno-narrowing
|
||||
CXX = $(CROSS)clang++
|
||||
LD = $(CROSS)clang++
|
||||
OTHERS = --std=c++98 --analyze -fixit
|
||||
WARNINGS = -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter -Wno-type-limits -Wno-narrowing
|
||||
endif
|
||||
|
||||
ifdef ZLEVELS
|
||||
DEFINES += -DZLEVELS
|
||||
endif
|
||||
|
||||
OTHERS += --std=c++11
|
||||
|
||||
CXXFLAGS += $(WARNINGS) $(DEBUG) $(PROFILE) $(OTHERS) -MMD
|
||||
|
||||
BINDIST_EXTRAS += README.md data
|
||||
BINDIST_EXTRAS = README.md data
|
||||
BINDIST = cataclysmdda-$(VERSION).tar.gz
|
||||
W32BINDIST = cataclysmdda-$(VERSION).zip
|
||||
BINDIST_CMD = tar --transform=s@^$(BINDIST_DIR)@cataclysmdda-$(VERSION)@ -czvf $(BINDIST) $(BINDIST_DIR)
|
||||
W32BINDIST_CMD = cd $(BINDIST_DIR) && zip -r ../$(W32BINDIST) * && cd $(BUILD_DIR)
|
||||
|
||||
# is this section even being used anymore?
|
||||
# SOMEBODY PLEASE CHECK
|
||||
#ifeq ($(OS), Msys)
|
||||
# LDFLAGS = -static -lpdcurses
|
||||
#else
|
||||
# LDFLAGS += -lncurses
|
||||
#endif
|
||||
|
||||
# Check if called without a special build target
|
||||
ifeq ($(NATIVE),)
|
||||
ifeq ($(CROSS),)
|
||||
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
|
||||
DEFINES += -DCATA_NO_CPP11_STRING_CONVERSIONS
|
||||
TARGETSYSTEM=CYGWIN
|
||||
else
|
||||
TARGETSYSTEM=LINUX
|
||||
endif
|
||||
TARGETSYSTEM=LINUX
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -187,35 +133,19 @@ ifeq ($(NATIVE), osx)
|
||||
OSX_MIN = 10.5
|
||||
DEFINES += -DMACOSX
|
||||
CXXFLAGS += -mmacosx-version-min=$(OSX_MIN)
|
||||
WARNINGS = -Werror -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces
|
||||
WARNINGS = -Werror -Wall -Wextra -Wno-switch -Wno-sign-compare -Wno-missing-braces -Wno-unused-parameter
|
||||
ifeq ($(LOCALIZE), 1)
|
||||
LDFLAGS += -lintl
|
||||
ifeq ($(MACPORTS), 1)
|
||||
LDFLAGS += -L$(shell ncursesw5-config --libdir)
|
||||
endif
|
||||
endif
|
||||
TARGETSYSTEM=LINUX
|
||||
ifneq ($(OS), Linux)
|
||||
ifneq ($(OS), GNU/Linux)
|
||||
BINDIST_CMD = tar -s"@^$(BINDIST_DIR)@cataclysmdda-$(VERSION)@" -czvf $(BINDIST) $(BINDIST_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Win32 (MinGW32 or MinGW-w64(32bit)?)
|
||||
# Win32 (mingw32?)
|
||||
ifeq ($(NATIVE), win32)
|
||||
# Any reason not to use -m32 on MinGW32?
|
||||
TARGETSYSTEM=WINDOWS
|
||||
else
|
||||
# Win64 (MinGW-w64? 64bit isn't currently working.)
|
||||
ifeq ($(NATIVE), win64)
|
||||
CXXFLAGS += -m64
|
||||
LDFLAGS += -m64
|
||||
TARGETSYSTEM=WINDOWS
|
||||
endif
|
||||
endif
|
||||
|
||||
# Cygwin
|
||||
ifeq ($(NATIVE), cygwin)
|
||||
TARGETSYSTEM=CYGWIN
|
||||
endif
|
||||
|
||||
# MXE cross-compile to win32
|
||||
@@ -226,92 +156,53 @@ endif
|
||||
|
||||
# Global settings for Windows targets
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
CHKJSON_BIN = chkjson.exe
|
||||
TARGET = $(W32TARGET)
|
||||
BINDIST = $(W32BINDIST)
|
||||
BINDIST_CMD = $(W32BINDIST_CMD)
|
||||
ODIR = $(W32ODIR)
|
||||
ifdef DYNAMIC_LINKING
|
||||
# Windows isn't sold with programming support, these are static to remove MinGW dependency.
|
||||
LDFLAGS += -static-libgcc -static-libstdc++
|
||||
else
|
||||
LDFLAGS += -static
|
||||
endif
|
||||
LDFLAGS += -static -lgdi32 -lwinmm
|
||||
ifeq ($(LOCALIZE), 1)
|
||||
LDFLAGS += -lintl -liconv
|
||||
endif
|
||||
W32FLAGS += -Wl,-stack,12000000,-subsystem,windows
|
||||
RFLAGS = -J rc -O coff
|
||||
ifeq ($(NATIVE), win64)
|
||||
RFLAGS += -F pe-x86-64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SOUND
|
||||
ifndef TILES
|
||||
$(error "SOUND=1 only works with TILES=1")
|
||||
endif
|
||||
CXXFLAGS += $(shell pkg-config --cflags SDL2_mixer)
|
||||
CXXFLAGS += -DSDL_SOUND
|
||||
LDFLAGS += $(shell pkg-config --libs SDL2_mixer)
|
||||
LDFLAGS += -lvorbisfile -lvorbis -logg
|
||||
endif
|
||||
|
||||
ifdef LUA
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
# Windows expects to have lua unpacked at a specific location
|
||||
LDFLAGS += -llua
|
||||
else
|
||||
# On unix-like systems, use pkg-config to find lua
|
||||
LDFLAGS += $(shell pkg-config --silence-errors --libs lua5.2)
|
||||
CXXFLAGS += $(shell pkg-config --silence-errors --cflags lua5.2)
|
||||
LDFLAGS += $(shell pkg-config --silence-errors --libs lua-5.2)
|
||||
CXXFLAGS += $(shell pkg-config --silence-errors --cflags lua-5.2)
|
||||
LDFLAGS += $(shell pkg-config --silence-errors --libs lua)
|
||||
CXXFLAGS += $(shell pkg-config --silence-errors --cflags lua)
|
||||
endif
|
||||
|
||||
CXXFLAGS += -DLUA
|
||||
LUA_DEPENDENCIES = $(LUASRC_DIR)/catabindings.cpp
|
||||
BINDIST_EXTRAS += $(LUA_DIR)
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
TILES = 1
|
||||
endif
|
||||
|
||||
ifdef TILES
|
||||
SDL = 1
|
||||
BINDIST_EXTRAS += gfx
|
||||
endif
|
||||
|
||||
ifdef SDL
|
||||
ifeq ($(NATIVE),osx)
|
||||
ifdef FRAMEWORK
|
||||
DEFINES += -DOSX_SDL_FW
|
||||
OSX_INC = -F/Library/Frameworks \
|
||||
-F$(HOME)/Library/Frameworks \
|
||||
-I/Library/Frameworks/SDL2.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL2.framework/Headers \
|
||||
-I/Library/Frameworks/SDL2_image.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL2_image.framework/Headers \
|
||||
-I/Library/Frameworks/SDL2_ttf.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL2_ttf.framework/Headers
|
||||
-I/Library/Frameworks/SDL.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL.framework/Headers \
|
||||
-I/Library/Frameworks/SDL_image.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL_image.framework/Headers \
|
||||
-I/Library/Frameworks/SDL_ttf.framework/Headers \
|
||||
-I$(HOME)/Library/Frameworks/SDL_ttf.framework/Headers
|
||||
LDFLAGS += -F/Library/Frameworks \
|
||||
-F$(HOME)/Library/Frameworks \
|
||||
-framework SDL2 -framework SDL2_image -framework SDL2_ttf -framework Cocoa
|
||||
-framework SDL -framework SDL_image -framework SDL_ttf -framework Cocoa
|
||||
CXXFLAGS += $(OSX_INC)
|
||||
else # libsdl build
|
||||
DEFINES += -DOSX_SDL2_LIBS
|
||||
# handle #include "SDL2/SDL.h" and "SDL.h"
|
||||
CXXFLAGS += $(shell sdl2-config --cflags) \
|
||||
-I$(shell dirname $(shell sdl2-config --cflags | sed 's/-I\(.[^ ]*\) .*/\1/'))
|
||||
LDFLAGS += -framework Cocoa $(shell sdl2-config --libs) -lSDL2_ttf
|
||||
DEFINES += -DOSX_SDL_LIBS
|
||||
# handle #include "SDL/SDL.h" and "SDL.h"
|
||||
CXXFLAGS += $(shell sdl-config --cflags) \
|
||||
-I$(shell dirname $(shell sdl-config --cflags | sed 's/-I\(.[^ ]*\) .*/\1/'))
|
||||
LDFLAGS += $(shell sdl-config --libs) -lSDL_ttf
|
||||
ifdef TILES
|
||||
LDFLAGS += -lSDL2_image
|
||||
LDFLAGS += -lSDL_image
|
||||
endif
|
||||
endif
|
||||
else # not osx
|
||||
LDFLAGS += -lSDL2 -lSDL2_ttf
|
||||
LDFLAGS += -lSDL -lSDL_ttf -lfreetype -lz
|
||||
ifdef TILES
|
||||
LDFLAGS += -lSDL2_image
|
||||
LDFLAGS += -lSDL_image
|
||||
endif
|
||||
endif
|
||||
ifdef TILES
|
||||
@@ -319,14 +210,7 @@ ifdef TILES
|
||||
endif
|
||||
DEFINES += -DTILES
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
ifndef DYNAMIC_LINKING
|
||||
# These differ depending on what SDL2 is configured to use.
|
||||
LDFLAGS += -lfreetype -lpng -lz -ljpeg -lbz2
|
||||
else
|
||||
# Currently none needed by the game itself (only used by SDL2 layer).
|
||||
# Placeholder for future use (savegame compression, etc).
|
||||
LDFLAGS +=
|
||||
endif
|
||||
LDFLAGS += -lgdi32 -ldxguid -lwinmm -ljpeg -lpng
|
||||
TARGET = $(W32TILESTARGET)
|
||||
ODIR = $(W32ODIRTILES)
|
||||
else
|
||||
@@ -337,35 +221,23 @@ else
|
||||
# Link to ncurses if we're using a non-tiles, Linux build
|
||||
ifeq ($(TARGETSYSTEM),LINUX)
|
||||
ifeq ($(LOCALIZE),1)
|
||||
ifeq ($(OS), Darwin)
|
||||
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Darwin)
|
||||
LDFLAGS += -lncurses
|
||||
else
|
||||
ifeq ($(NATIVE), osx)
|
||||
LDFLAGS += -lncurses
|
||||
else
|
||||
LDFLAGS += $(shell ncursesw5-config --libs)
|
||||
CXXFLAGS += $(shell ncursesw5-config --cflags)
|
||||
LDFLAGS += -lncursesw
|
||||
endif
|
||||
endif
|
||||
# Work around Cygwin not including gettext support in glibc
|
||||
ifeq ($(shell sh -c 'uname -o 2>/dev/null || echo not'),Cygwin)
|
||||
LDFLAGS += -lintl -liconv
|
||||
endif
|
||||
else
|
||||
LDFLAGS += -lncurses
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETSYSTEM),CYGWIN)
|
||||
ifeq ($(LOCALIZE),1)
|
||||
LDFLAGS += $(shell ncursesw5-config --libs)
|
||||
CXXFLAGS += $(shell ncursesw5-config --cflags)
|
||||
|
||||
# Work around Cygwin not including gettext support in glibc
|
||||
LDFLAGS += -lintl -liconv
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Global settings for Windows targets (at end)
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
LDFLAGS += -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion
|
||||
endif
|
||||
|
||||
ifeq ($(LOCALIZE),1)
|
||||
@@ -376,55 +248,40 @@ ifeq ($(TARGETSYSTEM),LINUX)
|
||||
BINDIST_EXTRAS += cataclysm-launcher
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETSYSTEM),CYGWIN)
|
||||
BINDIST_EXTRAS += cataclysm-launcher
|
||||
endif
|
||||
|
||||
SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
|
||||
HEADERS = $(wildcard $(SRC_DIR)/*.h)
|
||||
_OBJS = $(SOURCES:$(SRC_DIR)/%.cpp=%.o)
|
||||
SOURCES = $(wildcard *.cpp)
|
||||
HEADERS = $(wildcard *.h)
|
||||
_OBJS = $(SOURCES:.cpp=.o)
|
||||
ifeq ($(TARGETSYSTEM),WINDOWS)
|
||||
RSRC = $(wildcard $(SRC_DIR)/*.rc)
|
||||
_OBJS += $(RSRC:$(SRC_DIR)/%.rc=%.o)
|
||||
RSRC = $(wildcard *.rc)
|
||||
_OBJS += $(RSRC:.rc=.o)
|
||||
endif
|
||||
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
|
||||
|
||||
ifdef SDL
|
||||
ifeq ($(NATIVE),osx)
|
||||
OBJS += $(ODIR)/SDLMain.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef LANGUAGES
|
||||
L10N = localization
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETSYSTEM), LINUX)
|
||||
ifneq ($(PREFIX),)
|
||||
DEFINES += -DPREFIX="$(PREFIX)"
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETSYSTEM), CYGWIN)
|
||||
ifneq ($(PREFIX),)
|
||||
DEFINES += -DPREFIX="$(PREFIX)"
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_HOME_DIR),1)
|
||||
DEFINES += -DUSE_HOME_DIR
|
||||
BINDIST_EXTRAS += lang/mo
|
||||
endif
|
||||
|
||||
all: version $(TARGET) $(L10N)
|
||||
@
|
||||
|
||||
$(TARGET): $(ODIR) $(DDIR) $(OBJS)
|
||||
$(LD) $(W32FLAGS) -o $(TARGET) $(DEFINES) \
|
||||
$(LD) $(W32FLAGS) -o $(TARGET) $(DEFINES) $(CXXFLAGS) \
|
||||
$(OBJS) $(LDFLAGS)
|
||||
|
||||
.PHONY: version json-verify
|
||||
.PHONY: version
|
||||
version:
|
||||
@( VERSION_STRING=$(VERSION) ; \
|
||||
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --dirty --match "[0-9A-Z]*.[0-9A-Z]*" ) && VERSION_STRING=$$GITVERSION ; \
|
||||
[ -e "$(SRC_DIR)/version.h" ] && OLDVERSION=$$(grep VERSION $(SRC_DIR)/version.h|cut -d '"' -f2) ; \
|
||||
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then echo "#define VERSION \"$$VERSION_STRING\"" | tee $(SRC_DIR)/version.h ; fi \
|
||||
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --dirty --match "[0-9]*.[0-9]*" ) && VERSION_STRING=$$GITVERSION ; \
|
||||
[ -e "version.h" ] && OLDVERSION=$$(grep VERSION version.h|cut -d '"' -f2) ; \
|
||||
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then echo "#define VERSION \"$$VERSION_STRING\"" | tee version.h ; fi \
|
||||
)
|
||||
json-verify:
|
||||
$(LUA_BINARY) lua/json_verifier.lua
|
||||
|
||||
$(ODIR):
|
||||
mkdir -p $(ODIR)
|
||||
@@ -432,34 +289,25 @@ $(ODIR):
|
||||
$(DDIR):
|
||||
@mkdir $(DDIR)
|
||||
|
||||
$(ODIR)/%.o: $(SRC_DIR)/%.cpp
|
||||
$(ODIR)/%.o: %.cpp
|
||||
$(CXX) $(DEFINES) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
$(ODIR)/%.o: $(SRC_DIR)/%.rc
|
||||
$(ODIR)/%.o: %.rc
|
||||
$(RC) $(RFLAGS) $< -o $@
|
||||
|
||||
$(ODIR)/SDLMain.o: SDLMain.m
|
||||
$(CC) -c $(OSX_INC) $< -o $@
|
||||
|
||||
version.cpp: version
|
||||
|
||||
$(LUASRC_DIR)/catabindings.cpp: $(LUA_DIR)/class_definitions.lua $(LUASRC_DIR)/generate_bindings.lua
|
||||
cd $(LUASRC_DIR) && $(LUA_BINARY) generate_bindings.lua
|
||||
|
||||
$(SRC_DIR)/catalua.cpp: $(LUA_DEPENDENCIES)
|
||||
|
||||
localization:
|
||||
lang/compile_mo.sh $(LANGUAGES)
|
||||
|
||||
$(CHKJSON_BIN): src/chkjson/chkjson.cpp src/json.cpp
|
||||
$(CXX) $(CXXFLAGS) -Isrc/chkjson -Isrc src/chkjson/chkjson.cpp src/json.cpp -o $(CHKJSON_BIN)
|
||||
|
||||
json-check: $(CHKJSON_BIN)
|
||||
./$(CHKJSON_BIN)
|
||||
|
||||
clean: clean-tests
|
||||
rm -rf $(TARGET) $(TILESTARGET) $(W32TILESTARGET) $(W32TARGET)
|
||||
rm -rf $(ODIR) $(W32ODIR) $(W32ODIRTILES)
|
||||
rm -rf $(BINDIST) $(W32BINDIST) $(BINDIST_DIR)
|
||||
rm -f $(SRC_DIR)/version.h $(LUASRC_DIR)/catabindings.cpp
|
||||
rm -f $(CHKJSON_BIN)
|
||||
rm -f version.h
|
||||
|
||||
distclean:
|
||||
rm -rf $(BINDIST_DIR)
|
||||
@@ -472,125 +320,9 @@ distclean:
|
||||
|
||||
bindist: $(BINDIST)
|
||||
|
||||
ifeq ($(TARGETSYSTEM), LINUX)
|
||||
DATA_PREFIX=$(PREFIX)/share/cataclysm-dda/
|
||||
BIN_PREFIX=$(PREFIX)/bin
|
||||
LOCALE_DIR=$(PREFIX)/share/locale
|
||||
install: version $(TARGET)
|
||||
mkdir -p $(DATA_PREFIX)
|
||||
mkdir -p $(BIN_PREFIX)
|
||||
install --mode=755 $(TARGET) $(BIN_PREFIX)
|
||||
cp -R --no-preserve=ownership data/font $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/json $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/mods $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/names $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/raw $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/recycling $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/motd $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/credits $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/title $(DATA_PREFIX)
|
||||
ifdef TILES
|
||||
cp -R --no-preserve=ownership gfx $(DATA_PREFIX)
|
||||
endif
|
||||
ifdef LUA
|
||||
mkdir -p $(DATA_PREFIX)/lua
|
||||
install --mode=644 lua/autoexec.lua $(DATA_PREFIX)/lua
|
||||
install --mode=644 lua/class_definitions.lua $(DATA_PREFIX)/lua
|
||||
endif
|
||||
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
|
||||
README.txt LICENSE.txt -t $(DATA_PREFIX)
|
||||
mkdir -p $(LOCALE_DIR)
|
||||
LOCALE_DIR=$(LOCALE_DIR) lang/compile_mo.sh
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETSYSTEM), CYGWIN)
|
||||
DATA_PREFIX=$(PREFIX)/share/cataclysm-dda/
|
||||
BIN_PREFIX=$(PREFIX)/bin
|
||||
LOCALE_DIR=$(PREFIX)/share/locale
|
||||
install: version $(TARGET)
|
||||
mkdir -p $(DATA_PREFIX)
|
||||
mkdir -p $(BIN_PREFIX)
|
||||
install --mode=755 $(TARGET) $(BIN_PREFIX)
|
||||
cp -R --no-preserve=ownership data/font $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/json $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/mods $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/names $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/raw $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/recycling $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/motd $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/credits $(DATA_PREFIX)
|
||||
cp -R --no-preserve=ownership data/title $(DATA_PREFIX)
|
||||
ifdef TILES
|
||||
cp -R --no-preserve=ownership gfx $(DATA_PREFIX)
|
||||
endif
|
||||
ifdef LUA
|
||||
mkdir -p $(DATA_PREFIX)/lua
|
||||
install --mode=644 lua/autoexec.lua $(DATA_PREFIX)/lua
|
||||
install --mode=644 lua/class_definitions.lua $(DATA_PREFIX)/lua
|
||||
endif
|
||||
install --mode=644 data/changelog.txt data/cataicon.ico data/fontdata.json \
|
||||
README.txt LICENSE.txt -t $(DATA_PREFIX)
|
||||
mkdir -p $(LOCALE_DIR)
|
||||
LOCALE_DIR=$(LOCALE_DIR) lang/compile_mo.sh
|
||||
endif
|
||||
|
||||
ifdef TILES
|
||||
ifeq ($(NATIVE), osx)
|
||||
APPTARGETDIR=Cataclysm.app
|
||||
APPRESOURCESDIR=$(APPTARGETDIR)/Contents/Resources
|
||||
APPDATADIR=$(APPRESOURCESDIR)/data
|
||||
ifndef FRAMEWORK
|
||||
SDLLIBSDIR=$(shell sdl2-config --libs | sed -n 's/.*-L\([^ ]*\) .*/\1/p')
|
||||
endif # ifndef FRAMEWORK
|
||||
|
||||
appclean:
|
||||
rm -rf $(APPTARGETDIR)
|
||||
|
||||
data/osx/AppIcon.icns: data/osx/AppIcon.iconset
|
||||
iconutil -c icns $<
|
||||
|
||||
app: appclean version data/osx/AppIcon.icns $(TILESTARGET)
|
||||
mkdir -p $(APPTARGETDIR)/Contents
|
||||
cp data/osx/Info.plist $(APPTARGETDIR)/Contents/
|
||||
mkdir -p $(APPTARGETDIR)/Contents/MacOS
|
||||
cp data/osx/Cataclysm.sh $(APPTARGETDIR)/Contents/MacOS/
|
||||
mkdir -p $(APPRESOURCESDIR)
|
||||
cp $(TILESTARGET) $(APPRESOURCESDIR)/
|
||||
cp data/osx/AppIcon.icns $(APPRESOURCESDIR)/
|
||||
mkdir -p $(APPDATADIR)
|
||||
cp data/fontdata.json $(APPDATADIR)
|
||||
cp -R data/font $(APPDATADIR)
|
||||
cp -R data/json $(APPDATADIR)
|
||||
cp -R data/mods $(APPDATADIR)
|
||||
cp -R data/names $(APPDATADIR)
|
||||
cp -R data/raw $(APPDATADIR)
|
||||
cp -R data/recycling $(APPDATADIR)
|
||||
cp -R data/motd $(APPDATADIR)
|
||||
cp -R data/credits $(APPDATADIR)
|
||||
cp -R data/title $(APPDATADIR)
|
||||
ifdef SOUND
|
||||
cp -R data/sound $(APPDATADIR)
|
||||
endif # ifdef SOUND
|
||||
cp -R gfx $(APPRESOURCESDIR)/
|
||||
ifdef FRAMEWORK
|
||||
cp -R /Library/Frameworks/SDL2.framework $(APPRESOURCESDIR)/
|
||||
cp -R /Library/Frameworks/SDL2_image.framework $(APPRESOURCESDIR)/
|
||||
cp -R /Library/Frameworks/SDL2_ttf.framework $(APPRESOURCESDIR)/
|
||||
else # libsdl build
|
||||
cp $(SDLLIBSDIR)/libSDL2.dylib $(APPRESOURCESDIR)/
|
||||
cp $(SDLLIBSDIR)/libSDL2_image.dylib $(APPRESOURCESDIR)/
|
||||
cp $(SDLLIBSDIR)/libSDL2_ttf.dylib $(APPRESOURCESDIR)/
|
||||
endif # ifdef FRAMEWORK
|
||||
|
||||
endif # ifeq ($(NATIVE), osx)
|
||||
endif # ifdef TILES
|
||||
|
||||
$(BINDIST): distclean version $(TARGET) $(L10N) $(BINDIST_EXTRAS) $(BINDIST_LOCALE)
|
||||
$(BINDIST): distclean $(TARGET) $(L10N) $(BINDIST_EXTRAS)
|
||||
mkdir -p $(BINDIST_DIR)
|
||||
cp -R $(TARGET) $(BINDIST_EXTRAS) $(BINDIST_DIR)
|
||||
ifdef LANGUAGES
|
||||
cp -R --parents lang/mo $(BINDIST_DIR)
|
||||
endif
|
||||
cp -R --parents $(TARGET) $(BINDIST_EXTRAS) $(BINDIST_DIR)
|
||||
$(BINDIST_CMD)
|
||||
|
||||
export ODIR _OBJS LDFLAGS CXX W32FLAGS DEFINES CXXFLAGS
|
||||
@@ -600,7 +332,6 @@ ctags: $(SOURCES) $(HEADERS)
|
||||
|
||||
etags: $(SOURCES) $(HEADERS)
|
||||
etags $(SOURCES) $(HEADERS)
|
||||
find data -name "*.json" -print0 | xargs -0 -L 50 etags --append
|
||||
|
||||
tests: $(ODIR) $(DDIR) $(OBJS)
|
||||
$(MAKE) -C tests
|
||||
@@ -611,7 +342,7 @@ check: tests
|
||||
clean-tests:
|
||||
$(MAKE) -C tests clean
|
||||
|
||||
.PHONY: tests check ctags etags clean-tests install
|
||||
.PHONY: tests check ctags etags clean-tests
|
||||
|
||||
-include $(SOURCES:$(SRC_DIR)/%.cpp=$(DEPDIR)/%.P)
|
||||
-include $(SOURCES:%.cpp=$(DEPDIR)/%.P)
|
||||
-include ${OBJS:.o=.d}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Cataclysm: Dark 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 is far more to Cataclysm than that. 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...
|
||||
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, persistent, 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...
|
||||
|
||||
|
||||
## Download
|
||||
@@ -12,33 +12,13 @@ The source can either be downloaded as [an archive](https://github.com/CleverRav
|
||||
|
||||
## Compile
|
||||
|
||||
The latest instructions on how to compile can be found on [our wiki](http://www.wiki.cataclysmdda.com/index.php?title=How_to_compile). See doc/COMPILER_SUPPORT.md for details on which compilers we support.
|
||||
The latest instructions on how to compile can be found on [our wiki](http://www.wiki.cataclysmdda.com/index.php?title=How_to_compile).
|
||||
|
||||
|
||||
## Contribute
|
||||
|
||||
Cataclysm:Dark Days Ahead is the result of contributions from over 300 volunteers 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 http://creativecommons.org/licenses/by-sa/3.0/ for details.
|
||||
Some code distributed with the project is not part of the project and is released under different software licenses, the files covered by different software licenses have their own license notices.
|
||||
|
||||
[](https://www.bountysource.com/trackers/146201-clever-raven-cataclysm-dda?utm_source=146201&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
||||
|
||||
Please see [CONTRIBUTING.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/CONTRIBUTING.md) for details.
|
||||
|
||||
## Community
|
||||
|
||||
Cataclysm: Dark Days Ahead main site, includes links to forum, wiki, and GitHub repo:
|
||||
http://www.cataclysmdda.com/
|
||||
|
||||
Forums:
|
||||
http://smf.cataclysmdda.com
|
||||
Wiki:
|
||||
http://wiki.cataclysmdda.com/
|
||||
GitHub repo:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA
|
||||
|
||||
IRC:
|
||||
irc.freenode.net ; #CataclysmDDA
|
||||
http://webchat.freenode.net/?channels=#CataclysmDDA
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
|
||||
@@ -33,6 +33,3 @@ Frequently Asked Questions
|
||||
4)I've found a bug / I would like to make a suggestion. What should I do?
|
||||
Please submit an issue on our GitHub page at https://github.com/CleverRaven/Cataclysm-DDA/issues/.
|
||||
If you're not able to, send an email to `kevin.granade@gmail.com`.
|
||||
|
||||
5)I'm running Cataclysm on OSX, and some colours aren't showing up correctly.
|
||||
Open the Terminal Preferences, go to the Settings, then the Text section, and enable "Use bright colors for bold text".
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#ifndef _SDLMain_h_
|
||||
#define _SDLMain_h_
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
||||
#endif /* _SDLMain_h_ */
|
||||
@@ -0,0 +1,385 @@
|
||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
|
||||
#if (defined OSX_SDL_FW)
|
||||
#include "SDL.h"
|
||||
#else
|
||||
#include "SDL/SDL.h"
|
||||
#endif
|
||||
#include "SDLMain.h"
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#include <unistd.h>
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
but the method still is there and works. To avoid warnings, we declare
|
||||
it ourselves here. */
|
||||
@interface NSApplication(SDL_Missing_Methods)
|
||||
- (void)setAppleMenu:(NSMenu *)menu;
|
||||
@end
|
||||
|
||||
/* Use this flag to determine whether we use SDLMain.nib or not */
|
||||
#define SDL_USE_NIB_FILE 0
|
||||
|
||||
/* Use this flag to determine whether we use CPS (docking) or not */
|
||||
#define SDL_USE_CPS 1
|
||||
#ifdef SDL_USE_CPS
|
||||
/* Portions of CPS.h */
|
||||
typedef struct CPSProcessSerNum
|
||||
{
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
} CPSProcessSerNum;
|
||||
|
||||
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
||||
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
|
||||
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
||||
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
static BOOL gCalledAppMainline = FALSE;
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
const NSDictionary *dict;
|
||||
NSString *appName = 0;
|
||||
|
||||
/* Determine the application name */
|
||||
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
||||
if (dict)
|
||||
appName = [dict objectForKey: @"CFBundleName"];
|
||||
|
||||
if (![appName length])
|
||||
appName = [[NSProcessInfo processInfo] processName];
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface NSApplication (SDLApplication)
|
||||
@end
|
||||
|
||||
@implementation NSApplication (SDLApplication)
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
if (shouldChdir)
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
|
||||
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
|
||||
chdir(parentdir); /* chdir to the binary app's parent */
|
||||
}
|
||||
CFRelease(url);
|
||||
CFRelease(url2);
|
||||
}
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void setApplicationMenu(void)
|
||||
{
|
||||
/* warning: this code is very odd */
|
||||
NSMenu *appleMenu;
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
appName = getApplicationName();
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Hide " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
|
||||
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
[[NSApp mainMenu] addItem:menuItem];
|
||||
|
||||
/* Tell the application object that this is now the application menu */
|
||||
[NSApp setAppleMenu:appleMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[appleMenu release];
|
||||
[menuItem release];
|
||||
}
|
||||
|
||||
/* Create a window menu */
|
||||
static void setupWindowMenu(void)
|
||||
{
|
||||
NSMenu *windowMenu;
|
||||
NSMenuItem *windowMenuItem;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
/* Finally give up our references to the objects */
|
||||
[windowMenu release];
|
||||
[windowMenuItem release];
|
||||
}
|
||||
|
||||
/* Replacement for NSApplicationMain */
|
||||
static void CustomApplicationMain (int argc, char **argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SDLMain *sdlMain;
|
||||
|
||||
/* Ensure the application object is initialised */
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
#ifdef SDL_USE_CPS
|
||||
{
|
||||
CPSProcessSerNum PSN;
|
||||
/* Tell the dock about us */
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[NSApplication sharedApplication];
|
||||
}
|
||||
#endif /* SDL_USE_CPS */
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
setupWindowMenu();
|
||||
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
sdlMain = [[SDLMain alloc] init];
|
||||
[NSApp setDelegate:sdlMain];
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
[sdlMain release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Catch document open requests...this lets us notice files when the app
|
||||
* was launched by double-clicking a document, or when a document was
|
||||
* dragged/dropped on the app's icon. You need to have a
|
||||
* CFBundleDocumentsType section in your Info.plist to get this message,
|
||||
* apparently.
|
||||
*
|
||||
* Files are added to gArgv, so to the app, they'll look like command line
|
||||
* arguments. Previously, apps launched from the finder had nothing but
|
||||
* an argv[0].
|
||||
*
|
||||
* This message may be received multiple times to open several docs on launch.
|
||||
*
|
||||
* This message is ignored once the app's mainline has been called.
|
||||
*/
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
const char *temparg;
|
||||
size_t arglen;
|
||||
char *arg;
|
||||
char **newargv;
|
||||
|
||||
if (!gFinderLaunch) /* MacOS is passing command line args. */
|
||||
return FALSE;
|
||||
|
||||
if (gCalledAppMainline) /* app has started, ignore this document. */
|
||||
return FALSE;
|
||||
|
||||
temparg = [filename UTF8String];
|
||||
arglen = SDL_strlen(temparg) + 1;
|
||||
arg = (char *) SDL_malloc(arglen);
|
||||
if (arg == NULL)
|
||||
return FALSE;
|
||||
|
||||
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
|
||||
if (newargv == NULL)
|
||||
{
|
||||
SDL_free(arg);
|
||||
return FALSE;
|
||||
}
|
||||
gArgv = newargv;
|
||||
|
||||
SDL_strlcpy(arg, temparg, arglen);
|
||||
gArgv[gArgc++] = arg;
|
||||
gArgv[gArgc] = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
int status;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
/* Hand off to main application code */
|
||||
gCalledAppMainline = TRUE;
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
unsigned int bufferSize;
|
||||
unsigned int selfLen = [self length];
|
||||
unsigned int aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* Copy the arguments into a global variable */
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
|
||||
gArgv[0] = argv[0];
|
||||
gArgv[1] = NULL;
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
int i;
|
||||
gArgc = argc;
|
||||
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
|
||||
for (i = 0; i <= argc; i++)
|
||||
gArgv[i] = argv[i];
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
NSApplicationMain (argc, argv);
|
||||
#else
|
||||
CustomApplicationMain (argc, argv);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,15 +34,3 @@ Ian Strachan <ian_e_strachan@hotmail.com>
|
||||
Greg McNew <gmcnew@gmail.com>
|
||||
NaturesWitness <natureswitness@gmail.com>
|
||||
CodeHero <codehero@nerdpol.ch>
|
||||
tasetase "Tase" <tase on irc.freenode.net>
|
||||
Barry Peddycord III <ishara@isharacomix.org>
|
||||
Vidar Engh Skaugen <vidarsk@gmail.com>
|
||||
Brandon Bergren (Bdragon) <bdragon@rtk0.net> / <git@bdragon.rtk0.net>
|
||||
Henrik "Tivec" Bergvin <henrik@bergvin.com>
|
||||
FryCarson <frycarson@gmail.com>
|
||||
TranquilMarmot (Nate Moore) <nate272@gmail.com>
|
||||
Stéphane Travostino <stephane.travostino@gmail.com>
|
||||
Jeremy Osborne <jeremywosborne@gmail.com>
|
||||
David "Davek" Keaton <keaton.david@gmail.com>
|
||||
Piotr S. Staszewski (drbig) <p.staszewski@gmail.com>
|
||||
Donnie "Desrik" McNabb <koderkore@gmail.com>
|
||||
|
||||
+760
@@ -0,0 +1,760 @@
|
||||
#include "action.h"
|
||||
#include "keypress.h"
|
||||
#include "output.h"
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
std::map<char, action_id> keymap;
|
||||
std::map<char, action_id> default_keymap;
|
||||
|
||||
void parse_keymap(std::istream &keymap_txt, std::map<char, action_id> &kmap);
|
||||
|
||||
void load_keyboard_settings()
|
||||
{
|
||||
// Load the default keymap
|
||||
std::istringstream sin;
|
||||
sin.str(default_keymap_txt());
|
||||
parse_keymap(sin, default_keymap);
|
||||
|
||||
// Load the player's actual keymap
|
||||
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.");
|
||||
keymap = default_keymap;
|
||||
return;
|
||||
} else {
|
||||
parse_keymap(fin, keymap);
|
||||
}
|
||||
|
||||
// Check for new defaults, and automatically bind them if possible
|
||||
std::map<char, action_id>::iterator d_it;
|
||||
for (d_it = default_keymap.begin(); d_it != default_keymap.end(); ++d_it) {
|
||||
bool found = false;
|
||||
std::map<char, action_id>::iterator k_it;
|
||||
for (k_it = keymap.begin(); k_it != keymap.end(); ++k_it) {
|
||||
if (d_it->second == k_it->second) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && !keymap.count(d_it->first)) {
|
||||
keymap[d_it->first] = d_it->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parse_keymap(std::istream &keymap_txt, std::map<char, action_id> &kmap)
|
||||
{
|
||||
while (!keymap_txt.eof()) {
|
||||
std::string id;
|
||||
keymap_txt >> id;
|
||||
if (id == "")
|
||||
getline(keymap_txt, 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 (!keymap_txt.eof()) {
|
||||
char ch;
|
||||
keymap_txt >> std::noskipws >> ch >> std::skipws;
|
||||
if (ch == '\n') {
|
||||
break;
|
||||
} else if (ch != ' ' || keymap_txt.peek() == '\n') {
|
||||
if (kmap.find(ch) != kmap.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 {
|
||||
kmap[ ch ] = act;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getline(keymap_txt, id); // Clear the whole line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void 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> 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 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_ADVANCEDINV:
|
||||
return "advinv";
|
||||
case ACTION_PICKUP:
|
||||
return "pickup";
|
||||
case ACTION_GRAB:
|
||||
return "grab";
|
||||
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_SORT_ARMOR:
|
||||
return "sort_armor";
|
||||
case ACTION_WAIT:
|
||||
return "wait";
|
||||
case ACTION_CRAFT:
|
||||
return "craft";
|
||||
case ACTION_RECRAFT:
|
||||
return "recraft";
|
||||
case ACTION_LONGCRAFT:
|
||||
return "long_craft";
|
||||
case ACTION_CONSTRUCT:
|
||||
return "construct";
|
||||
case ACTION_DISASSEMBLE:
|
||||
return "disassemble";
|
||||
case ACTION_SLEEP:
|
||||
return "sleep";
|
||||
case ACTION_CONTROL_VEHICLE:
|
||||
return "control_vehicle";
|
||||
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_QUICKSAVE:
|
||||
return "quicksave";
|
||||
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_KILLS:
|
||||
return "kills";
|
||||
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";
|
||||
default:
|
||||
return "unkown";
|
||||
}
|
||||
}
|
||||
|
||||
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_GRAB:
|
||||
return _("Grab a nearby vehicle");
|
||||
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_ADVANCEDINV:
|
||||
return _("Advanced Inventory management");
|
||||
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_SORT_ARMOR:
|
||||
return _("Re-layer armour/clothing");
|
||||
case ACTION_WAIT:
|
||||
return _("Wait for Several Minutes");
|
||||
case ACTION_CRAFT:
|
||||
return _("Craft Items");
|
||||
case ACTION_RECRAFT:
|
||||
return _("Recraft last recipe");
|
||||
case ACTION_LONGCRAFT:
|
||||
return _("Craft as long as possible");
|
||||
case ACTION_CONSTRUCT:
|
||||
return _("Construct Terrain");
|
||||
case ACTION_DISASSEMBLE:
|
||||
return _("Disassemble items");
|
||||
case ACTION_SLEEP:
|
||||
return _("Sleep");
|
||||
case ACTION_CONTROL_VEHICLE:
|
||||
return _("Control Vehicle");
|
||||
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_QUICKSAVE:
|
||||
return _("Quicksave");
|
||||
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_KILLS:
|
||||
return _("View Kills");
|
||||
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");
|
||||
default:
|
||||
return "Someone forgot to name an action.";
|
||||
}
|
||||
}
|
||||
|
||||
void get_direction(int &x, int &y, char ch)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
action_id act;
|
||||
if (keymap.find(ch) == keymap.end()) {
|
||||
act = ACTION_NULL;
|
||||
} else {
|
||||
act = 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 :\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\
|
||||
advinv /\n\
|
||||
pickup , g\n\
|
||||
grab 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\
|
||||
sort_armor +\n\
|
||||
\n\
|
||||
# LONG TERM & SPECIAL ACTIONS\n\
|
||||
wait |\n\
|
||||
craft &\n\
|
||||
recraft -\n\
|
||||
construct *\n\
|
||||
disassemble (\n\
|
||||
sleep $\n\
|
||||
control_vehicle ^\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\
|
||||
kills )\n\
|
||||
morale v\n\
|
||||
messages P\n\
|
||||
help ?\n\
|
||||
\n\
|
||||
# DEBUG FUNCTIONS\n\
|
||||
debug_mode ~\n\
|
||||
# debug Z\n\
|
||||
# debug_scent -\n\
|
||||
";
|
||||
}
|
||||
|
||||
// (Press X (or Y)|Try) to Z
|
||||
std::string press_x(action_id act)
|
||||
{
|
||||
return press_x(act,_("Press "),"",_("Try"));
|
||||
}
|
||||
std::string press_x(action_id act, std::string key_bound, std::string key_unbound)
|
||||
{
|
||||
return press_x(act,key_bound,"",key_unbound);
|
||||
}
|
||||
std::string press_x(action_id act, std::string key_bound_pre, std::string key_bound_suf, std::string key_unbound)
|
||||
{
|
||||
std::vector<char> keys = keys_bound_to( action_id(act) );
|
||||
if (keys.empty()) {
|
||||
return key_unbound;
|
||||
} else {
|
||||
std::string keyed = key_bound_pre.append("");
|
||||
for (int j = 0; j < keys.size(); j++) {
|
||||
if (keys[j] == '\'' || keys[j] == '"'){
|
||||
if (j < keys.size() - 1) {
|
||||
keyed += keys[j]; keyed += _(" or ");
|
||||
} else {
|
||||
keyed += keys[j];
|
||||
}
|
||||
} else {
|
||||
if (j < keys.size() - 1) {
|
||||
keyed += "'"; keyed += keys[j]; keyed += _("' or ");
|
||||
} else {
|
||||
if (keys[j] == '_') {
|
||||
keyed += _("'_' (underscore)");
|
||||
} else {
|
||||
keyed += "'"; keyed += keys[j]; keyed += "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return keyed.append(key_bound_suf.c_str());
|
||||
}
|
||||
}
|
||||
// ('Z'ing|zing) (\(X( or Y))\))
|
||||
std::string press_x(action_id act, std::string act_desc)
|
||||
{
|
||||
bool key_after=false;
|
||||
bool z_ing=false;
|
||||
char zing = tolower(act_desc.at(0));
|
||||
std::vector<char> keys = keys_bound_to( action_id(act) );
|
||||
if (keys.empty()) {
|
||||
return act_desc;
|
||||
} else {
|
||||
std::string keyed = ("");
|
||||
for (int j = 0; j < keys.size(); j++) {
|
||||
if (tolower(keys[j])==zing) {
|
||||
if (z_ing) {
|
||||
keyed.replace(1,1,1,act_desc.at(0));
|
||||
if (key_after) {
|
||||
keyed += _(" or '");
|
||||
keyed += (islower(act_desc.at(0)) ? toupper(act_desc.at(0))
|
||||
: tolower(act_desc.at(0)));
|
||||
keyed += "'";
|
||||
} else {
|
||||
keyed +=" ('";
|
||||
keyed += (islower(act_desc.at(0)) ? toupper(act_desc.at(0))
|
||||
: tolower(act_desc.at(0)));
|
||||
keyed += "'";
|
||||
key_after=true;
|
||||
}
|
||||
} else {
|
||||
std::string uhh="";
|
||||
if (keys[j] == '\'' || keys[j] == '"'){
|
||||
uhh+="("; uhh+=keys[j]; uhh+=")";
|
||||
} else {
|
||||
uhh+="'"; uhh+=keys[j]; uhh+="'";
|
||||
}
|
||||
if(act_desc.length()>1) {
|
||||
uhh+=act_desc.substr(1);
|
||||
}
|
||||
if (keys[j] == '_') {
|
||||
uhh += _(" (underscore)");
|
||||
}
|
||||
keyed.insert(0,uhh);
|
||||
z_ing=true;
|
||||
}
|
||||
} else {
|
||||
if (key_after) {
|
||||
if (keys[j] == '\'' || keys[j] == '"'){
|
||||
keyed += _(" or "); keyed += keys[j];
|
||||
} else if (keys[j] == '_') {
|
||||
keyed += _("or '_' (underscore)");
|
||||
} else {
|
||||
keyed+=_(" or '"); keyed+=keys[j]; keyed+="'";
|
||||
}
|
||||
} else {
|
||||
if (keys[j] == '\'' || keys[j] == '"'){
|
||||
keyed += " ("; keyed += keys[j];
|
||||
} else if (keys[j] == '_') {
|
||||
keyed += _(" ('_' (underscore)");
|
||||
} else {
|
||||
keyed += " ('"; keyed+=keys[j]; keyed+="'";
|
||||
}
|
||||
key_after=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!z_ing) {
|
||||
keyed.insert(0,act_desc);
|
||||
}
|
||||
if (key_after) {
|
||||
keyed+=")";
|
||||
}
|
||||
return keyed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
#ifndef _ACTION_H_
|
||||
#define _ACTION_H_
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
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_GRAB,
|
||||
ACTION_BUTCHER,
|
||||
ACTION_CHAT,
|
||||
ACTION_LOOK,
|
||||
ACTION_PEEK,
|
||||
ACTION_LIST_ITEMS,
|
||||
// Inventory Interaction (including quasi-inventories like bionics)
|
||||
ACTION_INVENTORY,
|
||||
ACTION_ADVANCEDINV,
|
||||
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,
|
||||
ACTION_SORT_ARMOR,
|
||||
// Long-term / special actions
|
||||
ACTION_WAIT,
|
||||
ACTION_CRAFT,
|
||||
ACTION_RECRAFT,
|
||||
ACTION_LONGCRAFT,
|
||||
ACTION_CONSTRUCT,
|
||||
ACTION_DISASSEMBLE,
|
||||
ACTION_SLEEP,
|
||||
ACTION_CONTROL_VEHICLE,
|
||||
ACTION_TOGGLE_SAFEMODE,
|
||||
ACTION_TOGGLE_AUTOSAFE,
|
||||
ACTION_IGNORE_ENEMY,
|
||||
ACTION_SAVE,
|
||||
ACTION_QUICKSAVE,
|
||||
ACTION_QUIT,
|
||||
// Info Screens
|
||||
ACTION_PL_INFO,
|
||||
ACTION_MAP,
|
||||
ACTION_MISSIONS,
|
||||
ACTION_KILLS,
|
||||
ACTION_FACTIONS,
|
||||
ACTION_MORALE,
|
||||
ACTION_MESSAGES,
|
||||
ACTION_HELP,
|
||||
// Debug Functions
|
||||
ACTION_DEBUG,
|
||||
ACTION_DISPLAY_SCENT,
|
||||
ACTION_TOGGLE_DEBUGMON,
|
||||
NUM_ACTIONS
|
||||
};
|
||||
|
||||
extern std::map<char, action_id> keymap;
|
||||
|
||||
// Load keybindings from disk
|
||||
void load_keyboard_settings();
|
||||
std::string default_keymap_txt();
|
||||
// Save keybindings to disk
|
||||
void save_keymap();
|
||||
// All keys bound to act
|
||||
std::vector<char> keys_bound_to(action_id act);
|
||||
// Delete all keys bound to act
|
||||
void clear_bindings(action_id act);
|
||||
action_id look_up_action(std::string ident);
|
||||
std::string action_ident(action_id);
|
||||
std::string action_name(action_id);
|
||||
// Use the keymap to figure out direction properly
|
||||
void get_direction(int &x, int &y, char ch);
|
||||
// (Press X (or Y)|Try) to Z
|
||||
std::string press_x(action_id act);
|
||||
std::string press_x(action_id act, std::string key_bound,
|
||||
std::string key_unbound);
|
||||
std::string press_x(action_id act, std::string key_bound_pre,
|
||||
std::string key_bound_suf, std::string key_unbound);
|
||||
// ('Z'ing|zing) (X( or Y)))
|
||||
std::string press_x(action_id act, std::string act_desc);
|
||||
|
||||
|
||||
#endif
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
#include "addiction.h"
|
||||
|
||||
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(rng(0, 6) < in ? _("You need a cigarette.") : _("You could use a cigarette."));
|
||||
g->u.add_morale(MORALE_CRAVING_NICOTINE, -15, -50);
|
||||
if (one_in(800 - 50 * in)) {
|
||||
g->u.fatigue++;
|
||||
}
|
||||
if (g->u.stim > -50 && 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->u.add_morale(MORALE_CRAVING_CAFFEINE, -5, -30);
|
||||
if (g->u.stim > -150 && 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("shakes", 20);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_ALCOHOL:
|
||||
g->u.per_cur--;
|
||||
g->u.int_cur--;
|
||||
if (rng(40, 1200) <= in * 10 && g->u.health > -100) {
|
||||
g->u.health--;
|
||||
}
|
||||
if (one_in(20) && rng(0, 20) < in) {
|
||||
g->add_msg(_("You could use a drink."));
|
||||
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->u.add_morale(MORALE_CRAVING_ALCOHOL, -35, -120);
|
||||
g->u.add_disease("shakes", 50);
|
||||
} else if (!g->u.has_disease("hallu") && rng(10, 1600) < in) {
|
||||
g->u.add_disease("hallu", 3600);
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_SLEEP:
|
||||
// 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 > -100) {
|
||||
g->u.health--;
|
||||
}
|
||||
if (one_in(20) && dice(2, 20) < in) {
|
||||
g->add_msg(_("Your hands start shaking... you need some painkillers."));
|
||||
g->u.add_morale(MORALE_CRAVING_OPIATE, -40, -200);
|
||||
g->u.add_disease("shakes", 20 + in * 5);
|
||||
} else if (one_in(20) && dice(2, 30) < in) {
|
||||
g->add_msg(_("You feel anxious. You need your painkillers!"));
|
||||
g->u.add_morale(MORALE_CRAVING_OPIATE, -30, -200);
|
||||
} 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 > -100) {
|
||||
g->u.health--;
|
||||
}
|
||||
if (dice(2, 100) < in) {
|
||||
g->add_msg(_("You feel depressed. Speed would help."));
|
||||
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->u.add_morale(MORALE_CRAVING_SPEED, -25, -200);
|
||||
g->u.add_disease("shakes", in * 20);
|
||||
} else if (one_in(50) && dice(2, 100) < in) {
|
||||
g->add_msg(_("You stop suddenly, feeling bewildered."));
|
||||
g->cancel_activity();
|
||||
g->u.moves -= 300;
|
||||
} else if (!g->u.has_disease("hallu") && one_in(20) && 8 + dice(2, 80) < in)
|
||||
g->u.add_disease("hallu", 3600);
|
||||
}
|
||||
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->u.add_morale(MORALE_CRAVING_COCAINE, -20, -250);
|
||||
}
|
||||
if (dice(2, 80) <= in) {
|
||||
g->add_msg(_("You feel like you need a bump."));
|
||||
g->u.add_morale(MORALE_CRAVING_COCAINE, -20, -250);
|
||||
if (g->u.stim > -150) {
|
||||
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->u.add_morale(MORALE_CRAVING_CRACK, -80, -250);
|
||||
}
|
||||
if (dice(2, 80) <= in) {
|
||||
g->add_msg(_("You're shivering, you need some crack."));
|
||||
g->u.add_morale(MORALE_CRAVING_CRACK, -80, -250);
|
||||
if (g->u.stim > -150) {
|
||||
g->u.stim -= 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of an addiction. It should be able to finish the sentence
|
||||
* "Became addicted to ______".
|
||||
*/
|
||||
std::string addiction_type_name(add_type cur)
|
||||
{
|
||||
switch(cur) {
|
||||
case ADD_CIG: return _("nicotine");
|
||||
case ADD_CAFFEINE: return _("caffeine");
|
||||
case ADD_ALCOHOL: return _("alcohol");
|
||||
case ADD_SLEEP: return _("sleeping pills");
|
||||
case ADD_PKILLER: return _("opiates");
|
||||
case ADD_SPEED: return _("amphetamine");
|
||||
case ADD_COKE: return _("cocaine");
|
||||
case ADD_CRACK: return _("crack cocaine");
|
||||
default: return "bugs in addiction.cpp";
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
morale_type addiction_craving(add_type cur)
|
||||
{
|
||||
switch (cur) {
|
||||
case ADD_CIG: return MORALE_CRAVING_NICOTINE;
|
||||
case ADD_CAFFEINE: return MORALE_CRAVING_CAFFEINE;
|
||||
case ADD_ALCOHOL: return MORALE_CRAVING_ALCOHOL;
|
||||
case ADD_PKILLER: return MORALE_CRAVING_OPIATE;
|
||||
case ADD_SPEED: return MORALE_CRAVING_SPEED;
|
||||
case ADD_COKE: return MORALE_CRAVING_COCAINE;
|
||||
case ADD_CRACK: return MORALE_CRAVING_CRACK;
|
||||
default: return MORALE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
add_type addiction_type(std::string name)
|
||||
{
|
||||
if (name == "nicotine")
|
||||
return ADD_CIG;
|
||||
else if (name == "caffeine")
|
||||
return ADD_CAFFEINE;
|
||||
else if (name == "alcohol")
|
||||
return ADD_ALCOHOL;
|
||||
else if (name == "sleeping pill")
|
||||
return ADD_SLEEP;
|
||||
else if (name == "opiate")
|
||||
return ADD_PKILLER;
|
||||
else if (name == "amphetamine")
|
||||
return ADD_SPEED;
|
||||
else if (name == "cocaine")
|
||||
return ADD_COKE;
|
||||
else if (name == "crack")
|
||||
return ADD_CRACK;
|
||||
else
|
||||
return ADD_NULL;
|
||||
}
|
||||
|
||||
std::string addiction_text(addiction cur)
|
||||
{
|
||||
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:
|
||||
{
|
||||
return string_format(_(
|
||||
"Strength - %d; Perception - 1; Dexterity - 1;\n"
|
||||
"Depression and physical pain to some degree. Frequent cravings. Vomiting."), strpen);
|
||||
}
|
||||
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#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);
|
||||
|
||||
std::string addiction_type_name(add_type cur);
|
||||
|
||||
std::string addiction_name(addiction cur);
|
||||
|
||||
morale_type addiction_craving(add_type cur);
|
||||
|
||||
add_type addiction_type(std::string name);
|
||||
|
||||
std::string addiction_text(addiction cur);
|
||||
|
||||
#endif
|
||||
+1307
File diff suppressed because it is too large
Load Diff
+124
@@ -0,0 +1,124 @@
|
||||
#ifndef _ADVANCED_INV_H_
|
||||
#define _ADVANCED_INV_H_
|
||||
#include "output.h"
|
||||
#include "game.h"
|
||||
#include <string>
|
||||
struct advanced_inv_area {
|
||||
int id;
|
||||
int hscreenx;
|
||||
int hscreeny;
|
||||
int offx;
|
||||
int offy;
|
||||
int x;
|
||||
int y;
|
||||
std::string name;
|
||||
std::string shortname;
|
||||
bool canputitems;
|
||||
vehicle *veh;
|
||||
int vstor;
|
||||
int size;
|
||||
std::string desc;
|
||||
int volume, weight;
|
||||
int max_size, max_volume;
|
||||
};
|
||||
|
||||
// for printing items in environment
|
||||
struct advanced_inv_listitem {
|
||||
int idx;
|
||||
int area;
|
||||
item *it;
|
||||
std::string name;
|
||||
bool autopickup;
|
||||
int stacks;
|
||||
int volume;
|
||||
int weight;
|
||||
int cat;
|
||||
};
|
||||
|
||||
class advanced_inventory_pane {
|
||||
public:
|
||||
int pos;
|
||||
int area, offx, offy, size, vstor; // quick lookup later
|
||||
int index, max_page, max_index, page;
|
||||
std::string area_string;
|
||||
int sortby;
|
||||
int issrc;
|
||||
vehicle *veh;
|
||||
WINDOW *window;
|
||||
std::vector<advanced_inv_listitem> items;
|
||||
int numcats;
|
||||
std::string filter;
|
||||
bool recalc;
|
||||
bool redraw;
|
||||
std::map<std::string, bool> filtercache;
|
||||
advanced_inventory_pane() {
|
||||
offx = 0; offy = 0; size = 0; vstor = -1;
|
||||
index = 0; max_page = 0; max_index = 0; page = 0;
|
||||
area_string = _("Initializing...");
|
||||
sortby = 1; issrc = 0; veh = NULL; window = NULL;
|
||||
items.clear();
|
||||
numcats = 0; filter="";
|
||||
filtercache.clear();
|
||||
}
|
||||
};
|
||||
|
||||
class advanced_inventory
|
||||
{
|
||||
public:
|
||||
game * g;
|
||||
player * p;
|
||||
|
||||
const int head_height;
|
||||
const int min_w_height;
|
||||
const int min_w_width;
|
||||
const int max_w_width;
|
||||
const int left;
|
||||
const int right;
|
||||
const int isinventory;
|
||||
const int isall;
|
||||
|
||||
bool checkshowmsg;
|
||||
bool showmsg;
|
||||
|
||||
int itemsPerPage;
|
||||
int w_height;
|
||||
int w_width;
|
||||
|
||||
int headstart;
|
||||
int colstart;
|
||||
|
||||
// itemsPerPage=getmaxy(left_window)-ADVINVOFS;
|
||||
// todo: awaiting ui::menu // last_tmpdest=-1;
|
||||
bool exit;// = false;
|
||||
bool redraw;// = true;
|
||||
bool recalc;// = true;
|
||||
int lastCh;// = 0;
|
||||
|
||||
int src;// = left; // the active screen , 0 for left , 1 for right.
|
||||
int dest;// = right;
|
||||
int max_inv;// = inv_chars.size() - u.worn.size() - ( u.is_armed() ? 1 : 0 );
|
||||
bool examineScroll;// = false;
|
||||
bool filter_edit;
|
||||
|
||||
advanced_inventory_pane panes[2];
|
||||
advanced_inv_area squares[11];
|
||||
|
||||
advanced_inventory() :
|
||||
head_height(5),
|
||||
min_w_height(10),
|
||||
min_w_width(FULL_SCREEN_WIDTH),
|
||||
max_w_width(120),
|
||||
left(0),
|
||||
right(1),
|
||||
isinventory(0),
|
||||
isall(10) {
|
||||
}
|
||||
void display(game *gp, player *pp);
|
||||
void print_items(advanced_inventory_pane &pane, bool active);
|
||||
void recalc_pane(int i);
|
||||
void redraw_pane(int i);
|
||||
void init(game *gp, player *pp);
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,142 @@
|
||||
#if (!defined SDLTILES)
|
||||
|
||||
#include "game.h"
|
||||
/* Explosion Animation */
|
||||
void game::draw_explosion(int x, int y, int radius, nc_color col)
|
||||
{
|
||||
timespec ts; // Timespec for the animation of the explosion
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = EXPLOSION_SPEED;
|
||||
const int ypos = POSY + (y - (u.posy + u.view_offset_y));
|
||||
const int xpos = POSX + (x - (u.posx + u.view_offset_x));
|
||||
for (int i = 1; i <= radius; i++) {
|
||||
mvwputch(w_terrain, ypos - i, xpos - i, col, '/');
|
||||
mvwputch(w_terrain, ypos - i, xpos + i, col,'\\');
|
||||
mvwputch(w_terrain, ypos + i, xpos - i, col,'\\');
|
||||
mvwputch(w_terrain, ypos + i, xpos + i, col, '/');
|
||||
for (int j = 1 - i; j < 0 + i; j++) {
|
||||
mvwputch(w_terrain, ypos - i, xpos + j, col,'-');
|
||||
mvwputch(w_terrain, ypos + i, xpos + j, col,'-');
|
||||
mvwputch(w_terrain, ypos + j, xpos - i, col,'|');
|
||||
mvwputch(w_terrain, ypos + j, xpos + i, col,'|');
|
||||
}
|
||||
wrefresh(w_terrain);
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
}
|
||||
/* Bullet Animation */
|
||||
void game::draw_bullet(player &p, int tx, int ty, int i, std::vector<point> trajectory, char bullet, timespec &ts)
|
||||
{
|
||||
if (u_see(tx, ty)) {
|
||||
if (i > 0)
|
||||
{
|
||||
m.drawsq(w_terrain, u, trajectory[i-1].x, trajectory[i-1].y, false,
|
||||
true, u.posx + u.view_offset_x, u.posy + u.view_offset_y);
|
||||
}
|
||||
/*
|
||||
char bullet = '*';
|
||||
if (is_aflame)
|
||||
bullet = '#';
|
||||
*/
|
||||
mvwputch(w_terrain, POSY + (ty - (u.posy + u.view_offset_y)),
|
||||
POSX + (tx - (u.posx + u.view_offset_x)), c_red, bullet);
|
||||
wrefresh(w_terrain);
|
||||
if (&p == &u)
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
}
|
||||
/* Monster hit animation */
|
||||
void game::draw_hit_mon(int x, int y, monster m, bool dead)
|
||||
{
|
||||
nc_color cMonColor = m.type->color;
|
||||
char sMonSym = m.symbol();
|
||||
|
||||
hit_animation(POSX + (x - (u.posx + u.view_offset_x)),
|
||||
POSY + (y - (u.posy + u.view_offset_y)),
|
||||
red_background(cMonColor), dead?'%':sMonSym);
|
||||
}
|
||||
/* Player hit animation */
|
||||
void game::draw_hit_player(player *p, bool dead)
|
||||
{
|
||||
hit_animation(POSX + (p->posx - (u.posx + u.view_offset_x)),
|
||||
POSY + (p->posy - (u.posy + u.view_offset_y)),
|
||||
red_background(p->color()), '@');
|
||||
}
|
||||
/* Line drawing code, not really an animation but should be separated anyway */
|
||||
|
||||
void game::draw_line(const int x, const int y, const point center_point, std::vector<point> ret)
|
||||
{
|
||||
if (u_see( x, y))
|
||||
{
|
||||
for (int i = 0; i < ret.size(); i++)
|
||||
{
|
||||
int mondex = mon_at(ret[i].x, ret[i].y),
|
||||
npcdex = npc_at(ret[i].x, ret[i].y);
|
||||
|
||||
// NPCs and monsters get drawn with inverted colors
|
||||
if (mondex != -1 && u_see(&(_active_monsters[mondex])))
|
||||
{
|
||||
_active_monsters[mondex].draw(w_terrain, center_point.x, center_point.y, true);
|
||||
}
|
||||
else if (npcdex != -1)
|
||||
{
|
||||
active_npc[npcdex]->draw(w_terrain, center_point.x, center_point.y, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.drawsq(w_terrain, u, ret[i].x, ret[i].y, true,true,center_point.x, center_point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void game::draw_line(const int x, const int y, std::vector<point> vPoint)
|
||||
{
|
||||
for (int i = 1; i < vPoint.size(); i++)
|
||||
{
|
||||
m.drawsq(w_terrain, u, vPoint[i-1].x, vPoint[i-1].y, true, true);
|
||||
}
|
||||
|
||||
mvwputch(w_terrain, POSY + (vPoint[vPoint.size()-1].y - (u.posy + u.view_offset_y)),
|
||||
POSX + (vPoint[vPoint.size()-1].x - (u.posx + u.view_offset_x)), c_white, 'X');
|
||||
}
|
||||
//*/
|
||||
void game::draw_weather(weather_printable wPrint)
|
||||
{
|
||||
for (std::vector<std::pair<int, int> >::iterator weather_iterator = wPrint.vdrops.begin();
|
||||
weather_iterator != wPrint.vdrops.end();
|
||||
++weather_iterator)
|
||||
{
|
||||
mvwputch(w_terrain, weather_iterator->second, weather_iterator->first, wPrint.colGlyph, wPrint.cGlyph);
|
||||
}
|
||||
}
|
||||
|
||||
// draws footsteps that have been created by monsters moving about
|
||||
void game::draw_footsteps()
|
||||
{
|
||||
for (int i = 0; i < footsteps.size(); i++) {
|
||||
if (!u_see(footsteps_source[i]->posx(),footsteps_source[i]->posy())) {
|
||||
std::vector<point> unseen_points;
|
||||
for (int j = 0; j < footsteps[i].size(); j++) {
|
||||
if (!u_see(footsteps[i][j].x,footsteps[i][j].y)) {
|
||||
unseen_points.push_back(point(footsteps[i][j].x,
|
||||
footsteps[i][j].y));
|
||||
}
|
||||
}
|
||||
|
||||
if (unseen_points.size() > 0) {
|
||||
point selected = unseen_points[ rng(0, unseen_points.size() - 1) ];
|
||||
|
||||
mvwputch(w_terrain,
|
||||
POSY + (selected.y - (u.posy + u.view_offset_y)),
|
||||
POSX + (selected.x - (u.posx + u.view_offset_x)),
|
||||
c_yellow, '?');
|
||||
}
|
||||
}
|
||||
}
|
||||
footsteps.clear();
|
||||
footsteps_source.clear();
|
||||
wrefresh(w_terrain);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,254 @@
|
||||
#if (defined SDLTILES)
|
||||
|
||||
#include "game.h"
|
||||
#include "debug.h"
|
||||
#include "cata_tiles.h" // all animation functions will be pushed out to a cata_tiles function in some manner
|
||||
|
||||
extern cata_tiles *tilecontext; // obtained from sdltiles.cpp
|
||||
extern int fontheight;
|
||||
extern int fontwidth;
|
||||
|
||||
/* Tiles version of Explosion Animation */
|
||||
void game::draw_explosion(int x, int y, int radius, nc_color col)
|
||||
{
|
||||
timespec ts; // Timespec for the animation of the explosion
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = EXPLOSION_SPEED;
|
||||
// added offset values to keep from calculating the same value over and over again.
|
||||
const int ypos = POSY + (y - (u.posy + u.view_offset_y));
|
||||
const int xpos = POSX + (x - (u.posx + u.view_offset_x));
|
||||
|
||||
for (int i = 1; i <= radius; i++) {
|
||||
mvwputch(w_terrain, ypos - i, xpos - i, col, '/');
|
||||
mvwputch(w_terrain, ypos - i, xpos + i, col,'\\');
|
||||
mvwputch(w_terrain, ypos + i, xpos - i, col,'\\');
|
||||
mvwputch(w_terrain, ypos + i, xpos + i, col, '/');
|
||||
for (int j = 1 - i; j < 0 + i; j++) {
|
||||
mvwputch(w_terrain, ypos - i, xpos + j, col,'-');
|
||||
mvwputch(w_terrain, ypos + i, xpos + j, col,'-');
|
||||
mvwputch(w_terrain, ypos + j, xpos - i, col,'|');
|
||||
mvwputch(w_terrain, ypos + j, xpos + i, col,'|');
|
||||
}
|
||||
tilecontext->init_explosion(x, y, i);
|
||||
//tilecontext->draw_explosion_frame(x, y, radius, offset_x, offset_y);
|
||||
|
||||
wrefresh(w_terrain);
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
tilecontext->void_explosion();
|
||||
}
|
||||
/* Bullet Animation -- Maybe change this to animate the ammo itself flying through the air?*/
|
||||
// need to have a version where there is no player defined, possibly. That way shrapnel works as intended
|
||||
void game::draw_bullet(player &p, int tx, int ty, int i, std::vector<point> trajectory, char bullet_char, timespec &ts)
|
||||
{
|
||||
if (u_see(tx, ty)) {
|
||||
std::string bullet;// = "animation_bullet_normal";
|
||||
switch(bullet_char)
|
||||
{
|
||||
case '*': bullet = "animation_bullet_normal"; break;
|
||||
case '#': bullet = "animation_bullet_flame"; break;
|
||||
case '`': bullet = "animation_bullet_shrapnel"; break;
|
||||
}
|
||||
|
||||
mvwputch(w_terrain, POSY + (ty - (u.posy + u.view_offset_y)),
|
||||
POSX + (tx - (u.posx + u.view_offset_x)), c_red, bullet_char);
|
||||
// pass to tilecontext
|
||||
tilecontext->init_draw_bullet(tx, ty, bullet);
|
||||
wrefresh(w_terrain);
|
||||
if (&p == &u)
|
||||
nanosleep(&ts, NULL);
|
||||
tilecontext->void_bullet();
|
||||
}
|
||||
}
|
||||
/* Monster hit animation */
|
||||
void game::draw_hit_mon(int x, int y, monster m, bool dead)
|
||||
{
|
||||
if (use_tiles)
|
||||
{
|
||||
//int iTimeout = 0;
|
||||
tilecontext->init_draw_hit(x, y, m.type->id);
|
||||
wrefresh(w_terrain);
|
||||
|
||||
timespec tspec;
|
||||
tspec.tv_sec = 0;
|
||||
tspec.tv_nsec = BULLET_SPEED;
|
||||
|
||||
nanosleep(&tspec, NULL);
|
||||
|
||||
mvwputch(w_terrain,
|
||||
POSX + (x - (u.posx + u.view_offset_x)),
|
||||
POSY + (y - (u.posy + u.view_offset_y)),
|
||||
c_white, ' ');
|
||||
wrefresh(w_terrain);
|
||||
}
|
||||
else
|
||||
{
|
||||
nc_color cMonColor = m.type->color;
|
||||
char sMonSym = m.symbol();
|
||||
|
||||
hit_animation(POSX + (x - (u.posx + u.view_offset_x)),
|
||||
POSY + (y - (u.posy + u.view_offset_y)),
|
||||
red_background(cMonColor), dead ? '%' : sMonSym);
|
||||
}
|
||||
}
|
||||
/* Player hit animation */
|
||||
void game::draw_hit_player(player *p, bool dead)
|
||||
{
|
||||
if (use_tiles)
|
||||
{
|
||||
// get base name of player id
|
||||
std::string pname = (p->is_npc()?"npc_":"player_");
|
||||
// get sex of player
|
||||
pname += (p->male?"male":"female");
|
||||
|
||||
tilecontext->init_draw_hit(p->posx, p->posy, pname);
|
||||
wrefresh(w_terrain);
|
||||
|
||||
timespec tspec;
|
||||
tspec.tv_sec = 0;
|
||||
tspec.tv_nsec = BULLET_SPEED;
|
||||
|
||||
nanosleep(&tspec, NULL);
|
||||
|
||||
mvwputch(w_terrain,
|
||||
POSX + (p->posx - (u.posx + u.view_offset_x)),
|
||||
POSY + (p->posy - (u.posy + u.view_offset_y)),
|
||||
c_white, ' ');
|
||||
wrefresh(w_terrain);
|
||||
}
|
||||
else
|
||||
{
|
||||
hit_animation(POSX + (p->posx - (u.posx + u.view_offset_x)),
|
||||
POSY + (p->posy - (u.posy + u.view_offset_y)),
|
||||
red_background(p->color()), '@');
|
||||
}
|
||||
}
|
||||
|
||||
/* Line drawing code, not really an animation but should be separated anyway */
|
||||
|
||||
void game::draw_line(const int x, const int y, const point center_point, std::vector<point> ret)
|
||||
{
|
||||
if (u_see( x, y))
|
||||
{
|
||||
for (int i = 0; i < ret.size(); i++)
|
||||
{
|
||||
int mondex = mon_at(ret[i].x, ret[i].y),
|
||||
npcdex = npc_at(ret[i].x, ret[i].y);
|
||||
|
||||
// NPCs and monsters get drawn with inverted colors
|
||||
if (mondex != -1 && u_see(&(_active_monsters[mondex])))
|
||||
{
|
||||
_active_monsters[mondex].draw(w_terrain, center_point.x, center_point.y, true);
|
||||
}
|
||||
else if (npcdex != -1)
|
||||
{
|
||||
active_npc[npcdex]->draw(w_terrain, center_point.x, center_point.y, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.drawsq(w_terrain, u, ret[i].x, ret[i].y, true,true,center_point.x, center_point.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
tilecontext->init_draw_line(x,y,ret,"line_target", true);
|
||||
}
|
||||
|
||||
void game::draw_line(const int x, const int y, std::vector<point> vPoint)
|
||||
{
|
||||
for (int i = 1; i < vPoint.size(); i++)
|
||||
{
|
||||
m.drawsq(w_terrain, u, vPoint[i-1].x, vPoint[i-1].y, true, true);
|
||||
}
|
||||
|
||||
mvwputch(w_terrain, POSY + (vPoint[vPoint.size()-1].y - (u.posy + u.view_offset_y)),
|
||||
POSX + (vPoint[vPoint.size()-1].x - (u.posx + u.view_offset_x)), c_white, 'X');
|
||||
|
||||
tilecontext->init_draw_line(x,y,vPoint,"line_trail", false);
|
||||
}
|
||||
//*/
|
||||
void game::draw_weather(weather_printable wPrint)
|
||||
{
|
||||
if (use_tiles)
|
||||
{
|
||||
std::string weather_name;
|
||||
/*
|
||||
WEATHER_ACID_DRIZZLE | WEATHER_ACID_RAIN = "weather_acid_drop"
|
||||
WEATHER_DRIZZLE | WEATHER_RAINY | WEATHER_THUNDER | WEATHER_LIGHTNING = "weather_rain_drop"
|
||||
WEATHER_SNOW | WEATHER_SNOWSTORM = "weather_snowflake"
|
||||
*/
|
||||
switch(wPrint.wtype)
|
||||
{
|
||||
// Acid weathers, uses acid droplet tile, fallthrough intended
|
||||
case WEATHER_ACID_DRIZZLE:
|
||||
case WEATHER_ACID_RAIN: weather_name = "weather_acid_drop"; break;
|
||||
// Normal rainy weathers, uses normal raindrop tile, fallthrough intended
|
||||
case WEATHER_DRIZZLE:
|
||||
case WEATHER_RAINY:
|
||||
case WEATHER_THUNDER:
|
||||
case WEATHER_LIGHTNING: weather_name = "weather_rain_drop"; break;
|
||||
// Snowy weathers, uses snowflake tile, fallthrough intended
|
||||
case WEATHER_SNOW:
|
||||
case WEATHER_SNOWSTORM: weather_name = "weather_snowflake"; break;
|
||||
}
|
||||
/*
|
||||
// may have been the culprit of slowdown. Seems to be the same speed now for both weathered and non-weathered display
|
||||
for (std::vector<std::pair<int, int> >::iterator weather_iterator = wPrint.vdrops.begin();
|
||||
weather_iterator != wPrint.vdrops.end();
|
||||
++weather_iterator)
|
||||
{
|
||||
mvwputch(w_terrain, weather_iterator->second, weather_iterator->first, wPrint.colGlyph, wPrint.cGlyph);
|
||||
|
||||
}
|
||||
*/
|
||||
tilecontext->init_draw_weather(wPrint, weather_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::vector<std::pair<int, int> >::iterator weather_iterator = wPrint.vdrops.begin();
|
||||
weather_iterator != wPrint.vdrops.end();
|
||||
++weather_iterator)
|
||||
{
|
||||
mvwputch(w_terrain, weather_iterator->second, weather_iterator->first, wPrint.colGlyph, wPrint.cGlyph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draws footsteps that have been created by monsters moving about
|
||||
void game::draw_footsteps()
|
||||
{
|
||||
std::queue<point> step_tiles;
|
||||
for (int i = 0; i < footsteps.size(); i++) {
|
||||
if (!u_see(footsteps_source[i]->posx(),footsteps_source[i]->posy())){
|
||||
std::vector<point> unseen_points;
|
||||
for (int j = 0; j < footsteps[i].size(); j++){
|
||||
if (!u_see(footsteps[i][j].x,footsteps[i][j].y)){
|
||||
unseen_points.push_back(point(footsteps[i][j].x,
|
||||
footsteps[i][j].y));
|
||||
}
|
||||
}
|
||||
|
||||
if (use_tiles){
|
||||
if (unseen_points.size() > 0){
|
||||
step_tiles.push(unseen_points[rng(0, unseen_points.size()-1)]);
|
||||
}
|
||||
}else{
|
||||
if (unseen_points.size() > 0){
|
||||
point selected = unseen_points[rng(0,unseen_points.size() - 1)];
|
||||
|
||||
mvwputch(w_terrain,
|
||||
POSY + (selected.y - (u.posy + u.view_offset_y)),
|
||||
POSX + (selected.x - (u.posx + u.view_offset_x)),
|
||||
c_yellow, '?');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (use_tiles){
|
||||
tilecontext->init_draw_footsteps(step_tiles);
|
||||
}
|
||||
footsteps.clear();
|
||||
footsteps_source.clear();
|
||||
wrefresh(w_terrain);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
+1043
File diff suppressed because it is too large
Load Diff
+148
@@ -0,0 +1,148 @@
|
||||
#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_SUPER_CLAIRVOYANCE, // See through walls to a great distance
|
||||
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
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
#ifndef _ARTIFACTDATA_H_
|
||||
#define _ARTIFACTDATA_H_
|
||||
|
||||
#include <vector>
|
||||
#include "artifact.h"
|
||||
#include "itype.h"
|
||||
|
||||
extern int passive_effect_cost[NUM_AEPS];
|
||||
|
||||
extern int active_effect_cost[NUM_AEAS];
|
||||
|
||||
|
||||
struct artifact_shape_datum
|
||||
{
|
||||
std::string name;
|
||||
std::string desc;
|
||||
int volume_min, volume_max;
|
||||
int weight_min, weight_max;
|
||||
};
|
||||
|
||||
extern artifact_shape_datum artifact_shape_data[ARTSHAPE_MAX];
|
||||
|
||||
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];
|
||||
};
|
||||
|
||||
extern artifact_property_datum artifact_property_data[ARTPROP_MAX];
|
||||
|
||||
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;
|
||||
std::string m1;
|
||||
std::string m2;
|
||||
int volume_min, volume_max;
|
||||
int weight_min, weight_max;
|
||||
artifact_weapon_type base_weapon;
|
||||
artifact_weapon_type extra_weapons[3];
|
||||
};
|
||||
|
||||
enum artifact_tool_form
|
||||
{
|
||||
ARTTOOLFORM_NULL,
|
||||
ARTTOOLFORM_HARP,
|
||||
ARTTOOLFORM_STAFF,
|
||||
ARTTOOLFORM_SWORD,
|
||||
ARTTOOLFORM_KNIFE,
|
||||
ARTTOOLFORM_CUBE,
|
||||
NUM_ARTTOOLFORMS
|
||||
};
|
||||
|
||||
extern artifact_tool_form_datum artifact_tool_form_data[NUM_ARTTOOLFORMS];
|
||||
|
||||
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;
|
||||
std::string tag;
|
||||
};
|
||||
|
||||
extern artifact_weapon_datum artifact_weapon_data[NUM_ARTWEAPS];
|
||||
|
||||
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;
|
||||
std::string m1;
|
||||
std::string m2;
|
||||
int volume, weight;
|
||||
int encumb;
|
||||
int coverage;
|
||||
int thickness;
|
||||
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];
|
||||
};
|
||||
|
||||
enum artifact_armor_form
|
||||
{
|
||||
ARTARMFORM_NULL,
|
||||
ARTARMFORM_ROBE,
|
||||
ARTARMFORM_COAT,
|
||||
ARTARMFORM_MASK,
|
||||
ARTARMFORM_HELM,
|
||||
ARTARMFORM_GLOVES,
|
||||
ARTARMFORM_BOOTS,
|
||||
ARTARMFORM_RING,
|
||||
NUM_ARTARMFORMS
|
||||
};
|
||||
|
||||
extern artifact_armor_form_datum artifact_armor_form_data[NUM_ARTARMFORMS];
|
||||
|
||||
/* Armor mods alter the normal values of armor.
|
||||
* If the basic armor type has "null" as its second material, and the mod has a
|
||||
* material attached, the second material will be changed.
|
||||
*/
|
||||
extern artifact_armor_form_datum artifact_armor_mod_data[NUM_ARMORMODS];
|
||||
|
||||
#define NUM_ART_ADJS 20
|
||||
extern std::string artifact_adj[NUM_ART_ADJS];
|
||||
|
||||
#define NUM_ART_NOUNS 20
|
||||
extern std::string artifact_noun[NUM_ART_NOUNS];
|
||||
|
||||
#endif
|
||||
+788
@@ -0,0 +1,788 @@
|
||||
#include "game.h"
|
||||
#include "auto_pickup.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
#include "keypress.h"
|
||||
#include "item_factory.h"
|
||||
#include "catacharset.h"
|
||||
#include "translations.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <locale>
|
||||
|
||||
std::map<std::string, std::string> mapAutoPickupItems;
|
||||
std::vector<cPickupRules> vAutoPickupRules[5];
|
||||
|
||||
void show_auto_pickup()
|
||||
{
|
||||
save_reset_changes(false);
|
||||
|
||||
const int iHeaderHeight = 4;
|
||||
const int iContentHeight = FULL_SCREEN_HEIGHT-2-iHeaderHeight;
|
||||
|
||||
const int iOffsetX = (TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0;
|
||||
const int iOffsetY = (TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0;
|
||||
|
||||
std::map<int, bool> mapLines;
|
||||
mapLines[3] = true;
|
||||
mapLines[50] = true;
|
||||
mapLines[54] = true;
|
||||
|
||||
const int iTotalCols = mapLines.size()-1;
|
||||
|
||||
WINDOW* w_auto_pickup_options = newwin(FULL_SCREEN_HEIGHT/2, FULL_SCREEN_WIDTH/2, iOffsetY + (FULL_SCREEN_HEIGHT/2)/2, iOffsetX + (FULL_SCREEN_WIDTH/2)/2);
|
||||
WINDOW* w_auto_pickup_help = newwin((FULL_SCREEN_HEIGHT/2)-2, FULL_SCREEN_WIDTH * 3/4, 8 + iOffsetY + (FULL_SCREEN_HEIGHT/2)/2, iOffsetX + 19/2);
|
||||
|
||||
WINDOW* w_auto_pickup_border = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH, iOffsetY, iOffsetX);
|
||||
WINDOW* w_auto_pickup_header = newwin(iHeaderHeight, FULL_SCREEN_WIDTH - 2, 1 + iOffsetY, 1 + iOffsetX);
|
||||
WINDOW* w_auto_pickup = newwin(iContentHeight, FULL_SCREEN_WIDTH - 2, iHeaderHeight + 1 + iOffsetY, 1 + iOffsetX);
|
||||
|
||||
wborder(w_auto_pickup_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
|
||||
mvwputch(w_auto_pickup_border, 3, 0, c_ltgray, LINE_XXXO); // |-
|
||||
mvwputch(w_auto_pickup_border, 3, 79, c_ltgray, LINE_XOXX); // -|
|
||||
|
||||
for (std::map<int, bool>::iterator iter = mapLines.begin(); iter != mapLines.end(); ++iter) {
|
||||
mvwputch(w_auto_pickup_border, FULL_SCREEN_HEIGHT-1, iter->first + 1, c_ltgray, LINE_XXOX); // _|_
|
||||
}
|
||||
|
||||
mvwprintz(w_auto_pickup_border, 0, 29, c_ltred, _(" AUTO PICKUP MANAGER "));
|
||||
wrefresh(w_auto_pickup_border);
|
||||
|
||||
int tmpx = 0;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<A>dd"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<R>emove"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<C>opy"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<M>ove"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<E>nable"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<D>isable"))+2;
|
||||
shortcut_print(w_auto_pickup_header, 0, tmpx, c_white, c_ltgreen, _("<T>est"));
|
||||
tmpx = 0;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 1, tmpx, c_white, c_ltgreen, _("<+-> Move up/down"))+2;
|
||||
tmpx += shortcut_print(w_auto_pickup_header, 1, tmpx, c_white, c_ltgreen, _("<Enter>-Edit"))+2;
|
||||
shortcut_print(w_auto_pickup_header, 1, tmpx, c_white, c_ltgreen, _("<Tab>-Switch Page"));
|
||||
|
||||
for (int i = 0; i < 78; i++) {
|
||||
if (mapLines[i]) {
|
||||
mvwputch(w_auto_pickup_header, 2, i, c_ltgray, LINE_OXXX);
|
||||
mvwputch(w_auto_pickup_header, 3, i, c_ltgray, LINE_XOXO);
|
||||
} else {
|
||||
mvwputch(w_auto_pickup_header, 2, i, c_ltgray, LINE_OXOX); // Draw line under header
|
||||
}
|
||||
}
|
||||
|
||||
mvwprintz(w_auto_pickup_header, 3, 0, c_white, "#");
|
||||
mvwprintz(w_auto_pickup_header, 3, 7, c_white, _("Rules"));
|
||||
mvwprintz(w_auto_pickup_header, 3, 51, c_white, _("I/E"));
|
||||
|
||||
wrefresh(w_auto_pickup_header);
|
||||
|
||||
int iCurrentPage = 1;
|
||||
int iCurrentLine = 0;
|
||||
int iCurrentCol = 1;
|
||||
int iStartPos = 0;
|
||||
bool bStuffChanged = false;
|
||||
char ch = ' ';
|
||||
|
||||
std::stringstream sTemp;
|
||||
|
||||
do {
|
||||
int locx = 17;
|
||||
locx += shortcut_print(w_auto_pickup_header, 2, locx, c_white, (iCurrentPage == 1) ? hilite(c_white) : c_white, _("[<Global>]"))+1;
|
||||
shortcut_print(w_auto_pickup_header, 2, locx, c_white, (iCurrentPage == 2) ? hilite(c_white) : c_white, _("[<Character>]"));
|
||||
|
||||
wrefresh(w_auto_pickup_header);
|
||||
|
||||
// Clear the lines
|
||||
for (int i = 0; i < iContentHeight; i++) {
|
||||
for (int j = 0; j < 79; j++) {
|
||||
if (mapLines[j]) {
|
||||
mvwputch(w_auto_pickup, i, j, c_ltgray, LINE_XOXO);
|
||||
} else {
|
||||
mvwputch(w_auto_pickup, i, j, c_black, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iCurrentPage == 1 || iCurrentPage == 2) {
|
||||
if (iCurrentPage == 2 && g->u.name == "") {
|
||||
vAutoPickupRules[2].clear();
|
||||
mvwprintz(w_auto_pickup, 8, 15, c_white, _("Please load a character first to use this page!"));
|
||||
}
|
||||
|
||||
//Draw Scrollbar
|
||||
draw_scrollbar(w_auto_pickup_border, iCurrentLine, iContentHeight, vAutoPickupRules[iCurrentPage].size(), 5);
|
||||
|
||||
calcStartPos(iStartPos, iCurrentLine, iContentHeight, vAutoPickupRules[iCurrentPage].size());
|
||||
|
||||
// display auto pickup
|
||||
for (int i = iStartPos; i < vAutoPickupRules[iCurrentPage].size(); i++) {
|
||||
if (i >= iStartPos && i < iStartPos + ((iContentHeight > vAutoPickupRules[iCurrentPage].size()) ? vAutoPickupRules[iCurrentPage].size() : iContentHeight)) {
|
||||
nc_color cLineColor = (vAutoPickupRules[iCurrentPage][i].bActive) ? c_white : c_ltgray;
|
||||
|
||||
sTemp.str("");
|
||||
sTemp << i + 1;
|
||||
mvwprintz(w_auto_pickup, i - iStartPos, 0, cLineColor, sTemp.str().c_str());
|
||||
mvwprintz(w_auto_pickup, i - iStartPos, 4, cLineColor, "");
|
||||
|
||||
if (iCurrentLine == i) {
|
||||
wprintz(w_auto_pickup, c_yellow, ">> ");
|
||||
} else {
|
||||
wprintz(w_auto_pickup, c_yellow, " ");
|
||||
}
|
||||
|
||||
wprintz(w_auto_pickup, (iCurrentLine == i && iCurrentCol == 1) ? hilite(cLineColor) : cLineColor, "%s", ((vAutoPickupRules[iCurrentPage][i].sRule == "") ? _("<empty rule>") : vAutoPickupRules[iCurrentPage][i].sRule).c_str());
|
||||
|
||||
mvwprintz(w_auto_pickup, i - iStartPos, 52, (iCurrentLine == i && iCurrentCol == 2) ? hilite(cLineColor) : cLineColor, "%s", ((vAutoPickupRules[iCurrentPage][i].bExclude) ? rm_prefix(_("<Exclude>E")).c_str() : rm_prefix(_("<Include>I")).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
wrefresh(w_auto_pickup);
|
||||
|
||||
} else if (iCurrentPage == 3) {
|
||||
wborder(w_auto_pickup_options, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
|
||||
|
||||
mvwprintz(w_auto_pickup_options, 5, 10, c_white, _("Under construction!"));
|
||||
|
||||
wrefresh(w_auto_pickup);
|
||||
wrefresh(w_auto_pickup_options);
|
||||
}
|
||||
|
||||
ch = (char)input();
|
||||
|
||||
if (iCurrentPage == 3) {
|
||||
switch(ch) {
|
||||
case '\t': //Switch to next Page
|
||||
iCurrentPage++;
|
||||
if (iCurrentPage > 3) {
|
||||
iCurrentPage = 1;
|
||||
iCurrentLine = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (iCurrentPage == 1 || iCurrentPage == 2) {
|
||||
if (iCurrentPage == 2 && g->u.name == "" && ch != '\t') {
|
||||
//Only allow loaded games to use the char sheet
|
||||
} else if (vAutoPickupRules[iCurrentPage].size() > 0 || ch == 'a' || ch == '\t') {
|
||||
switch(ch) {
|
||||
case 'j': //move down
|
||||
iCurrentLine++;
|
||||
iCurrentCol = 1;
|
||||
if (iCurrentLine >= vAutoPickupRules[iCurrentPage].size()) {
|
||||
iCurrentLine = 0;
|
||||
}
|
||||
break;
|
||||
case 'k': //move up
|
||||
iCurrentLine--;
|
||||
iCurrentCol = 1;
|
||||
if (iCurrentLine < 0) {
|
||||
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
|
||||
}
|
||||
break;
|
||||
case 'a': //add new rule
|
||||
case 'A':
|
||||
bStuffChanged = true;
|
||||
vAutoPickupRules[iCurrentPage].push_back(cPickupRules("", true, false));
|
||||
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
|
||||
break;
|
||||
case 'r': //remove rule
|
||||
case 'R':
|
||||
bStuffChanged = true;
|
||||
vAutoPickupRules[iCurrentPage].erase(vAutoPickupRules[iCurrentPage].begin() + iCurrentLine);
|
||||
if (iCurrentLine > vAutoPickupRules[iCurrentPage].size()-1) {
|
||||
iCurrentLine--;
|
||||
}
|
||||
break;
|
||||
case 'c': //copy rule
|
||||
case 'C':
|
||||
bStuffChanged = true;
|
||||
vAutoPickupRules[iCurrentPage].push_back(cPickupRules(vAutoPickupRules[iCurrentPage][iCurrentLine].sRule, vAutoPickupRules[iCurrentPage][iCurrentLine].bActive, vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude));
|
||||
iCurrentLine = vAutoPickupRules[iCurrentPage].size()-1;
|
||||
break;
|
||||
case 'm': //move rule global <-> character
|
||||
case 'M':
|
||||
if ((iCurrentPage == 1 && g->u.name != "") || iCurrentPage == 2) {
|
||||
bStuffChanged = true;
|
||||
//copy over
|
||||
vAutoPickupRules[(iCurrentPage == 1) ? 2 : 1].push_back(cPickupRules(vAutoPickupRules[iCurrentPage][iCurrentLine].sRule, vAutoPickupRules[iCurrentPage][iCurrentLine].bActive, vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude));
|
||||
|
||||
//remove old
|
||||
vAutoPickupRules[iCurrentPage].erase(vAutoPickupRules[iCurrentPage].begin() + iCurrentLine);
|
||||
iCurrentLine = vAutoPickupRules[(iCurrentPage == 1) ? 2 : 1].size()-1;
|
||||
iCurrentPage = (iCurrentPage == 1) ? 2 : 1;
|
||||
}
|
||||
break;
|
||||
case '\t': //Switch to next Page
|
||||
iCurrentPage++;
|
||||
if (iCurrentPage > 2) {
|
||||
iCurrentPage = 1;
|
||||
iCurrentLine = 0;
|
||||
}
|
||||
break;
|
||||
case '\n': //Edit Col in current line
|
||||
bStuffChanged = true;
|
||||
if (iCurrentCol == 1) {
|
||||
fold_and_print(w_auto_pickup_help, 1, 1, 999, c_white,
|
||||
_(
|
||||
"* is used as a Wildcard. A few Examples:\n"
|
||||
"\n"
|
||||
"wood arrow matches the itemname exactly\n"
|
||||
"wood ar* matches items beginning with wood ar\n"
|
||||
"*rrow matches items ending with rrow\n"
|
||||
"*avy fle*fi*arrow multible * are allowed\n"
|
||||
"heAVY*woOD*arrOW case insesitive search\n"
|
||||
"")
|
||||
);
|
||||
|
||||
wborder(w_auto_pickup_help, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
|
||||
wrefresh(w_auto_pickup_help);
|
||||
vAutoPickupRules[iCurrentPage][iCurrentLine].sRule = trim_rule(string_input_popup(_("Pickup Rule:"), 30, vAutoPickupRules[iCurrentPage][iCurrentLine].sRule));
|
||||
} else if (iCurrentCol == 2) {
|
||||
vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude = !vAutoPickupRules[iCurrentPage][iCurrentLine].bExclude;
|
||||
}
|
||||
break;
|
||||
case 'e': //enable rule
|
||||
case 'E':
|
||||
bStuffChanged = true;
|
||||
vAutoPickupRules[iCurrentPage][iCurrentLine].bActive = true;
|
||||
break;
|
||||
case 'd': //disable rule
|
||||
case 'D':
|
||||
bStuffChanged = true;
|
||||
vAutoPickupRules[iCurrentPage][iCurrentLine].bActive = false;
|
||||
break;
|
||||
case 'h': //move left
|
||||
iCurrentCol--;
|
||||
if (iCurrentCol < 1) {
|
||||
iCurrentCol = iTotalCols;
|
||||
}
|
||||
break;
|
||||
case 'l': //move right
|
||||
iCurrentCol++;
|
||||
if (iCurrentCol > iTotalCols) {
|
||||
iCurrentCol = 1;
|
||||
}
|
||||
break;
|
||||
case '+': //move rule up
|
||||
bStuffChanged = true;
|
||||
if (iCurrentLine < vAutoPickupRules[iCurrentPage].size()-1) {
|
||||
std::swap(vAutoPickupRules[iCurrentPage][iCurrentLine], vAutoPickupRules[iCurrentPage][iCurrentLine+1]);
|
||||
iCurrentLine++;
|
||||
iCurrentCol = 1;
|
||||
}
|
||||
break;
|
||||
case '-': //move rule down
|
||||
bStuffChanged = true;
|
||||
if (iCurrentLine > 0) {
|
||||
std::swap(vAutoPickupRules[iCurrentPage][iCurrentLine], vAutoPickupRules[iCurrentPage][iCurrentLine-1]);
|
||||
iCurrentLine--;
|
||||
iCurrentCol = 1;
|
||||
}
|
||||
break;
|
||||
case 't': //test rule
|
||||
case 'T':
|
||||
test_pattern(iCurrentPage, iCurrentLine);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE);
|
||||
|
||||
if (bStuffChanged) {
|
||||
if(query_yn(_("Save changes?"))) {
|
||||
save_auto_pickup(false);
|
||||
|
||||
if (g->u.name != "") {
|
||||
save_auto_pickup(true);
|
||||
}
|
||||
} else {
|
||||
save_reset_changes(true);
|
||||
}
|
||||
}
|
||||
|
||||
werase(w_auto_pickup);
|
||||
werase(w_auto_pickup_border);
|
||||
werase(w_auto_pickup_header);
|
||||
werase(w_auto_pickup_options);
|
||||
werase(w_auto_pickup_help);
|
||||
}
|
||||
|
||||
void test_pattern(int iCurrentPage, int iCurrentLine)
|
||||
{
|
||||
std::vector<std::string> vMatchingItems;
|
||||
std::string sItemName = "";
|
||||
|
||||
if (vAutoPickupRules[iCurrentPage][iCurrentLine].sRule == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
//Loop through all itemfactory items
|
||||
//TODO: somehow generate damaged, fitting or container items
|
||||
for (int i = 0; i < standard_itype_ids.size(); i++) {
|
||||
sItemName = item_controller->find_template(standard_itype_ids[i])->name;
|
||||
if (vAutoPickupRules[iCurrentPage][iCurrentLine].bActive && auto_pickup_match(sItemName, vAutoPickupRules[iCurrentPage][iCurrentLine].sRule)) {
|
||||
vMatchingItems.push_back(sItemName);
|
||||
}
|
||||
}
|
||||
|
||||
const int iOffsetX = 15 + ((TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);
|
||||
const int iOffsetY = 5 + ((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0);
|
||||
|
||||
int iStartPos = 0;
|
||||
const int iContentHeight = FULL_SCREEN_HEIGHT - 8;
|
||||
const int iContentWidth = FULL_SCREEN_WIDTH - 30;
|
||||
char ch;
|
||||
std::stringstream sTemp;
|
||||
|
||||
WINDOW* w_test_rule_border = newwin(iContentHeight + 2, iContentWidth, iOffsetY, iOffsetX);
|
||||
WINDOW* w_test_rule_content = newwin(iContentHeight, iContentWidth - 2, 1 + iOffsetY, 1 + iOffsetX);
|
||||
|
||||
wborder(w_test_rule_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX, LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
|
||||
|
||||
int nmatch = vMatchingItems.size();
|
||||
std::string buf = string_format(ngettext("%1$d item matches: %2$s", "%1$d items match: %2$s", nmatch), nmatch, vAutoPickupRules[iCurrentPage][iCurrentLine].sRule.c_str());
|
||||
mvwprintz(w_test_rule_border, 0, iContentWidth/2 - utf8_width(buf.c_str())/2, hilite(c_white), buf.c_str());
|
||||
|
||||
mvwprintz(w_test_rule_border, iContentHeight + 1, 1, red_background(c_white), _("Won't display damaged, fits and can/bottle items"));
|
||||
|
||||
wrefresh(w_test_rule_border);
|
||||
|
||||
iCurrentLine = 0;
|
||||
|
||||
do {
|
||||
// Clear the lines
|
||||
for (int i = 0; i < iContentHeight; i++) {
|
||||
for (int j = 0; j < 79; j++) {
|
||||
mvwputch(w_test_rule_content, i, j, c_black, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
calcStartPos(iStartPos, iCurrentLine, iContentHeight, vMatchingItems.size());
|
||||
|
||||
// display auto pickup
|
||||
for (int i = iStartPos; i < vMatchingItems.size(); i++) {
|
||||
if (i >= iStartPos && i < iStartPos + ((iContentHeight > vMatchingItems.size()) ? vMatchingItems.size() : iContentHeight)) {
|
||||
nc_color cLineColor = c_white;
|
||||
|
||||
sTemp.str("");
|
||||
sTemp << i + 1;
|
||||
mvwprintz(w_test_rule_content, i - iStartPos, 0, cLineColor, sTemp.str().c_str());
|
||||
mvwprintz(w_test_rule_content, i - iStartPos, 4, cLineColor, "");
|
||||
|
||||
if (iCurrentLine == i) {
|
||||
wprintz(w_test_rule_content, c_yellow, ">> ");
|
||||
} else {
|
||||
wprintz(w_test_rule_content, c_yellow, " ");
|
||||
}
|
||||
|
||||
wprintz(w_test_rule_content, (iCurrentLine == i) ? hilite(cLineColor) : cLineColor, vMatchingItems[i].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
wrefresh(w_test_rule_content);
|
||||
|
||||
ch = (char)input();
|
||||
|
||||
switch(ch) {
|
||||
case 'j': //move down
|
||||
iCurrentLine++;
|
||||
if (iCurrentLine >= vMatchingItems.size()) {
|
||||
iCurrentLine = 0;
|
||||
}
|
||||
break;
|
||||
case 'k': //move up
|
||||
iCurrentLine--;
|
||||
if (iCurrentLine < 0) {
|
||||
iCurrentLine = vMatchingItems.size()-1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while(ch == 'j' || ch == 'k');
|
||||
|
||||
werase(w_test_rule_border);
|
||||
werase(w_test_rule_content);
|
||||
}
|
||||
|
||||
void load_auto_pickup(bool bCharacter)
|
||||
{
|
||||
std::ifstream fin;
|
||||
std::string sFile = "data/auto_pickup.txt";
|
||||
|
||||
if (bCharacter) {
|
||||
sFile = world_generator->active_world->world_path + "/" + base64_encode(g->u.name) + ".apu.txt";
|
||||
}
|
||||
|
||||
fin.open(sFile.c_str());
|
||||
if(!fin.is_open()) {
|
||||
fin.close();
|
||||
|
||||
create_default_auto_pickup(bCharacter);
|
||||
|
||||
fin.open(sFile.c_str());
|
||||
if(!fin.is_open()) {
|
||||
DebugLog() << "Could neither read nor create " << sFile << "\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
vAutoPickupRules[(bCharacter) ? 2 : 1].clear();
|
||||
|
||||
std::string sLine;
|
||||
while(!fin.eof()) {
|
||||
getline(fin, sLine);
|
||||
|
||||
if(sLine != "" && sLine[0] != '#') {
|
||||
int iNum = std::count(sLine.begin(), sLine.end(), ';');
|
||||
|
||||
if(iNum != 2) {
|
||||
/*int iNum = std::count(sLine.begin(), sLine.end(), ' ');
|
||||
|
||||
if(iNum == 1) { //its an option! hurray
|
||||
|
||||
} else {*/
|
||||
DebugLog() << "Bad Rule: " << sLine << "\n";
|
||||
//}
|
||||
|
||||
} else {
|
||||
std::string sRule = "";
|
||||
bool bActive = true;
|
||||
bool bExclude = false;
|
||||
|
||||
size_t iPos = 0;
|
||||
int iCol = 1;
|
||||
do {
|
||||
iPos = sLine.find(";");
|
||||
|
||||
std::string sTemp = (iPos == std::string::npos) ? sLine : sLine.substr(0, iPos);
|
||||
|
||||
if (iCol == 1) {
|
||||
sRule = sTemp;
|
||||
|
||||
} else if (iCol == 2) {
|
||||
bActive = (sTemp == "T" || sTemp == "True") ? true : false;
|
||||
|
||||
} else if (iCol == 3) {
|
||||
bExclude = (sTemp == "T" || sTemp == "True") ? true : false;
|
||||
}
|
||||
|
||||
iCol++;
|
||||
|
||||
if (iPos != std::string::npos) {
|
||||
sLine = sLine.substr(iPos+1, sLine.size());
|
||||
}
|
||||
|
||||
} while(iPos != std::string::npos);
|
||||
|
||||
vAutoPickupRules[(bCharacter) ? 2 : 1].push_back(cPickupRules(sRule, bActive, bExclude));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fin.close();
|
||||
|
||||
merge_vector();
|
||||
createPickupRules();
|
||||
}
|
||||
|
||||
void merge_vector()
|
||||
{
|
||||
vAutoPickupRules[0].clear();
|
||||
|
||||
for (int i=1; i <= 2; i++) { //Loop through global 1 and character 2
|
||||
for (int j=0; j < vAutoPickupRules[i].size(); j++) {
|
||||
if (vAutoPickupRules[i][j].sRule != "") {
|
||||
vAutoPickupRules[0].push_back(cPickupRules(vAutoPickupRules[i][j].sRule, vAutoPickupRules[i][j].bActive, vAutoPickupRules[i][j].bExclude));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool hasPickupRule(std::string sRule)
|
||||
{
|
||||
for (int i = 0; i < vAutoPickupRules[2].size(); i++) {
|
||||
if (sRule.length() == (vAutoPickupRules[2][i].sRule).length() && ci_find_substr(sRule, vAutoPickupRules[2][i].sRule) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void addPickupRule(std::string sRule)
|
||||
{
|
||||
vAutoPickupRules[2].push_back(cPickupRules(sRule, true, false));
|
||||
merge_vector();
|
||||
createPickupRules();
|
||||
}
|
||||
|
||||
void removePickupRule(std::string sRule)
|
||||
{
|
||||
for (int i = 0; i < vAutoPickupRules[2].size(); i++) {
|
||||
if (sRule.length() == (vAutoPickupRules[2][i].sRule).length() && ci_find_substr(sRule, vAutoPickupRules[2][i].sRule) != -1) {
|
||||
vAutoPickupRules[2].erase(vAutoPickupRules[2].begin() + i);
|
||||
merge_vector();
|
||||
createPickupRules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void createPickupRules(const std::string sItemNameIn)
|
||||
{
|
||||
if (sItemNameIn == "") {
|
||||
mapAutoPickupItems.clear();
|
||||
}
|
||||
|
||||
std::string sItemName = "";
|
||||
|
||||
for (int iPattern = 0; iPattern < vAutoPickupRules[0].size(); iPattern++) { //Includes only
|
||||
if (!vAutoPickupRules[0][iPattern].bExclude) {
|
||||
if (sItemNameIn != "") {
|
||||
if (vAutoPickupRules[0][iPattern].bActive && auto_pickup_match(sItemNameIn, vAutoPickupRules[0][iPattern].sRule)) {
|
||||
mapAutoPickupItems[sItemNameIn] = "true";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//Check include paterns against all itemfactory items
|
||||
for (int i = 0; i < standard_itype_ids.size(); i++) {
|
||||
sItemName = item_controller->find_template(standard_itype_ids[i])->name;
|
||||
if (vAutoPickupRules[0][iPattern].bActive && auto_pickup_match(sItemName, vAutoPickupRules[0][iPattern].sRule)) {
|
||||
mapAutoPickupItems[sItemName] = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int iPattern = 0; iPattern < vAutoPickupRules[0].size(); iPattern++) { //Excludes only
|
||||
if (vAutoPickupRules[0][iPattern].bExclude) {
|
||||
if (sItemNameIn != "") {
|
||||
if (vAutoPickupRules[0][iPattern].bActive && auto_pickup_match(sItemNameIn, vAutoPickupRules[0][iPattern].sRule)) {
|
||||
mapAutoPickupItems[sItemNameIn] = "false";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//Check exclude paterns against all included items
|
||||
for (std::map<std::string, std::string>::iterator iter = mapAutoPickupItems.begin(); iter != mapAutoPickupItems.end(); ++iter) {
|
||||
if (vAutoPickupRules[0][iPattern].bActive && auto_pickup_match(iter->first, vAutoPickupRules[0][iPattern].sRule)) {
|
||||
mapAutoPickupItems[iter->first] = "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void save_reset_changes(bool bReset)
|
||||
{
|
||||
for (int i=1; i <= 2; i++) { //Loop through global 1 and character 2
|
||||
vAutoPickupRules[i + ((bReset) ? 0: 2)].clear();
|
||||
for (int j=0; j < vAutoPickupRules[i + ((bReset) ? 2: 0)].size(); j++) {
|
||||
if (vAutoPickupRules[i + ((bReset) ? 2: 0)][j].sRule != "") {
|
||||
vAutoPickupRules[i + ((bReset) ? 0: 2)].push_back(cPickupRules(vAutoPickupRules[i + ((bReset) ? 2: 0)][j].sRule, vAutoPickupRules[i + ((bReset) ? 2: 0)][j].bActive, vAutoPickupRules[i + ((bReset) ? 2: 0)][j].bExclude));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
merge_vector();
|
||||
}
|
||||
|
||||
std::string auto_pickup_header(bool bCharacter)
|
||||
{
|
||||
std::string sTemp = (bCharacter) ? "character": "global";
|
||||
return "# This is the " + sTemp + " auto pickup rules file. The format is\n\
|
||||
# <pickup rule>;<dis/enabled>;<in/exclude>\n\n\
|
||||
# <pickup rule> Simple text. No other special characters except spaces and *\n\
|
||||
# <dis/enabled> Can be T(rue) of F(alse)\n\
|
||||
# <in/exclude> Can be T(rue) of F(alse)\n\
|
||||
#\n\
|
||||
# If # is at the start of a line, it is considered a comment and is ignored.\n\
|
||||
# In-line commenting is not allowed. I think.\n\
|
||||
#\n\
|
||||
# If you want to restore the default auto pickup rules file, simply delete this file.\n\
|
||||
# A new auto_pickup.txt will be created next time you play.\
|
||||
\n\n";
|
||||
}
|
||||
|
||||
void save_auto_pickup(bool bCharacter)
|
||||
{
|
||||
std::ofstream fout;
|
||||
std::string sFile = "data/auto_pickup.txt";
|
||||
|
||||
if (bCharacter) {
|
||||
sFile = world_generator->active_world->world_path + "/" + base64_encode(g->u.name) + ".apu.txt";
|
||||
std::ifstream fin;
|
||||
|
||||
fin.open((world_generator->active_world->world_path + "/" + base64_encode(g->u.name) + ".sav").c_str());
|
||||
if(!fin.is_open()) {
|
||||
return;
|
||||
}
|
||||
fin.close();
|
||||
}
|
||||
|
||||
fout.open(sFile.c_str());
|
||||
|
||||
if(!fout.is_open()) {
|
||||
return;
|
||||
}
|
||||
|
||||
fout << auto_pickup_header(bCharacter) << std::endl;
|
||||
for(int i = 0; i < vAutoPickupRules[(bCharacter) ? 2 : 1].size(); i++) {
|
||||
fout << vAutoPickupRules[(bCharacter) ? 2 : 1][i].sRule << ";";
|
||||
fout << (vAutoPickupRules[(bCharacter) ? 2 : 1][i].bActive ? "T" : "F") << ";";
|
||||
fout << (vAutoPickupRules[(bCharacter) ? 2 : 1][i].bExclude ? "T" : "F");
|
||||
fout << "\n";
|
||||
}
|
||||
|
||||
if (!bCharacter) {
|
||||
merge_vector();
|
||||
createPickupRules();
|
||||
}
|
||||
}
|
||||
|
||||
void create_default_auto_pickup(bool bCharacter)
|
||||
{
|
||||
std::ofstream fout;
|
||||
std::string sFile = "data/auto_pickup.txt";
|
||||
|
||||
if (bCharacter) {
|
||||
sFile = world_generator->active_world->world_path + "/" + base64_encode(g->u.name) + ".apu.txt";
|
||||
}
|
||||
|
||||
fout.open(sFile.c_str());
|
||||
if(!fout.is_open()) {
|
||||
return;
|
||||
}
|
||||
|
||||
fout << auto_pickup_header(bCharacter);
|
||||
fout.close();
|
||||
}
|
||||
|
||||
std::string trim_rule(std::string sPattern)
|
||||
{
|
||||
size_t iPos = 0;
|
||||
|
||||
//Remove all double ** in pattern
|
||||
while((iPos = sPattern.find("**")) != std::string::npos) {
|
||||
sPattern = sPattern.substr(0, iPos) + sPattern.substr(iPos+1, sPattern.length()-iPos-1);
|
||||
}
|
||||
|
||||
return sPattern;
|
||||
}
|
||||
|
||||
bool auto_pickup_match(std::string sText, std::string sPattern)
|
||||
{
|
||||
//case insenitive search
|
||||
|
||||
/* Possible patterns
|
||||
*
|
||||
wooD
|
||||
wood*
|
||||
*wood
|
||||
Wood*aRrOW
|
||||
wood*arrow*
|
||||
*wood*arrow
|
||||
*wood*hard* *x*y*z*arrow*
|
||||
*/
|
||||
|
||||
if (sText == "") {
|
||||
return false;
|
||||
} else if (sText == "*") {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t iPos;
|
||||
std::vector<std::string> vPattern;
|
||||
|
||||
sPattern = trim_rule(sPattern);
|
||||
|
||||
split(sPattern, '*', vPattern);
|
||||
size_t iNum = vPattern.size();
|
||||
|
||||
if (iNum == 0) { //should never happen
|
||||
return false;
|
||||
} else if (iNum == 1) { // no * found
|
||||
if (sText.length() == vPattern[0].length() && ci_find_substr(sText, vPattern[0]) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i=0; i < vPattern.size(); i++) {
|
||||
if (i==0 && vPattern[i] != "") { //beginning: ^vPat[i]
|
||||
if (sText.length() < vPattern[i].length() || ci_find_substr(sText.substr(0, vPattern[i].length()), vPattern[i]) == -1) {
|
||||
//debugmsg(("1: sText: " + sText + " | sPattern: ^" + vPattern[i] + " | no match").c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
sText = sText.substr(vPattern[i].length(), sText.length()-vPattern[i].length());
|
||||
} else if (i==vPattern.size()-1 && vPattern[i] != "") { //linenend: vPat[i]$
|
||||
if (sText.length() < vPattern[i].length() || ci_find_substr(sText.substr(sText.length()-vPattern[i].length(), vPattern[i].length()), vPattern[i]) == -1) {
|
||||
//debugmsg(("2: sText: " + sText + " | sPattern: " + vPattern[i] + "$ | no match").c_str());
|
||||
return false;
|
||||
}
|
||||
} else { //inbetween: vPat[i]
|
||||
if (vPattern[i] != "") {
|
||||
if ((iPos = ci_find_substr(sText, vPattern[i])) == -1) {
|
||||
//debugmsg(("3: sText: " + sText + " | sPattern: " + vPattern[i] + " | no match").c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
sText = sText.substr(iPos+vPattern[i].length(), sText.length()-iPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
elems.clear();
|
||||
while (std::getline(ss, item, delim)) {
|
||||
elems.push_back(item);
|
||||
}
|
||||
|
||||
if ( s.substr(s.length()-1, 1) == "*") {
|
||||
elems.push_back("");
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
|
||||
/*
|
||||
// string test
|
||||
std::string str1 = "FIRST HELLO";
|
||||
std::string str2 = "hello";
|
||||
int f1 = ci_find_substr( str1, str2 );
|
||||
|
||||
// wstring test
|
||||
std::wstring wstr1 = L"ОПЯТЬ ПРИВЕТ";
|
||||
std::wstring wstr2 = L"привет";
|
||||
int f2 = ci_find_substr( wstr1, wstr2 );
|
||||
*/
|
||||
|
||||
// templated version of my_equal so it could work with both char and wchar_t
|
||||
template<typename charT>
|
||||
struct my_equal {
|
||||
public:
|
||||
my_equal( const std::locale& loc ) : loc_(loc) {}
|
||||
|
||||
bool operator()(charT ch1, charT ch2) {
|
||||
return std::toupper(ch1, loc_) == std::toupper(ch2, loc_);
|
||||
}
|
||||
private:
|
||||
const std::locale& loc_;
|
||||
};
|
||||
|
||||
// find substring (case insensitive)
|
||||
template<typename charT>
|
||||
int ci_find_substr( const charT& str1, const charT& str2, const std::locale& loc )
|
||||
{
|
||||
typename charT::const_iterator it = std::search( str1.begin(), str1.end(), str2.begin(), str2.end(), my_equal<typename charT::value_type>(loc) );
|
||||
if ( it != str1.end() ) return it - str1.begin();
|
||||
else return -1; // not found
|
||||
}
|
||||
@@ -1,34 +1,24 @@
|
||||
#ifndef AUTO_PICKUP_H
|
||||
#define AUTO_PICKUP_H
|
||||
#ifndef _AUTO_PICKUP_H_
|
||||
#define _AUTO_PICKUP_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <locale>
|
||||
#include <algorithm>
|
||||
|
||||
enum apu_type {
|
||||
APU_MERGED = 0,
|
||||
APU_GLOBAL,
|
||||
APU_CHARACTER
|
||||
};
|
||||
|
||||
class cPickupRules
|
||||
{
|
||||
class cPickupRules {
|
||||
public:
|
||||
std::string sRule;
|
||||
bool bActive;
|
||||
bool bExclude;
|
||||
|
||||
cPickupRules()
|
||||
{
|
||||
cPickupRules() {
|
||||
this->sRule = "";
|
||||
this->bActive = false;
|
||||
this->bExclude = false;
|
||||
}
|
||||
|
||||
cPickupRules(std::string sRuleIn, bool bActiveIn, bool bExcludeIn)
|
||||
{
|
||||
cPickupRules(std::string sRuleIn, bool bActiveIn, bool bExcludeIn) {
|
||||
this->sRule = sRuleIn;
|
||||
this->bActive = bActiveIn;
|
||||
this->bExclude = bExcludeIn;
|
||||
@@ -47,17 +37,16 @@ bool hasPickupRule(std::string sRule);
|
||||
void addPickupRule(std::string sRule);
|
||||
void removePickupRule(std::string sRule);
|
||||
void createPickupRules(const std::string sItemNameIn = "");
|
||||
bool checkExcludeRules(const std::string sItemNameIn);
|
||||
void save_reset_changes(bool bReset);
|
||||
void show_auto_pickup();
|
||||
void load_auto_pickup(bool bCharacter);
|
||||
bool save_auto_pickup(bool bCharacter);
|
||||
void save_auto_pickup(bool bCharacter);
|
||||
void show_auto_pickup();
|
||||
std::string auto_pickup_header(bool bCharacter);
|
||||
void create_default_auto_pickup(bool bCharacter);
|
||||
bool auto_pickup_match(std::string sText, std::string sPattern);
|
||||
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||
template<typename charT>
|
||||
int ci_find_substr( const charT &str1, const charT &str2, const std::locale &loc = std::locale() );
|
||||
int ci_find_substr( const charT& str1, const charT& str2, const std::locale& loc = std::locale() );
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@ basecamp::basecamp()
|
||||
{
|
||||
}
|
||||
|
||||
basecamp::basecamp(std::string const &name_, int const posx_, int const posy_)
|
||||
basecamp::basecamp(std::string const& name_, int const posx_, int const posy_)
|
||||
: name(name_), posx(posx_), posy(posy_)
|
||||
{
|
||||
}
|
||||
@@ -31,7 +31,7 @@ std::string basecamp::save_data() const
|
||||
return data.str();
|
||||
}
|
||||
|
||||
void basecamp::load_data(std::string const &data)
|
||||
void basecamp::load_data(std::string const& data)
|
||||
{
|
||||
std::stringstream stream(data);
|
||||
stream >> name >> posx >> posy;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#ifndef _BASECAMP_H_
|
||||
#define _BASECAMP_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class basecamp
|
||||
{
|
||||
public:
|
||||
basecamp();
|
||||
basecamp(std::string const& name_, int const posx_, int const posy_);
|
||||
|
||||
inline bool is_valid() const { return !name.empty(); }
|
||||
inline int board_x() const { return posx; }
|
||||
inline int board_y() const { return posy; }
|
||||
inline std::string const& camp_name() const { return name; }
|
||||
|
||||
std::string board_name() const;
|
||||
|
||||
// Save/load
|
||||
std::string save_data() const;
|
||||
void load_data(std::string const& data);
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
int posx, posy; // location of associated bulletin board
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
+675
@@ -0,0 +1,675 @@
|
||||
#include "player.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
#include "input.h"
|
||||
#include "keypress.h"
|
||||
#include "item.h"
|
||||
#include "bionics.h"
|
||||
#include "line.h"
|
||||
#include "json.h"
|
||||
#include <math.h> //sqrt
|
||||
#include <algorithm> //std::min
|
||||
|
||||
#define BATTERY_AMOUNT 4 // How much batteries increase your power
|
||||
|
||||
std::map<bionic_id, bionic_data*> bionics;
|
||||
std::vector<bionic_id> faulty_bionics;
|
||||
std::vector<bionic_id> power_source_bionics;
|
||||
std::vector<bionic_id> unpowered_bionics;
|
||||
|
||||
void bionics_install_failure(game *g, player *u, it_bionic* type, int success);
|
||||
|
||||
bionic_data::bionic_data(std::string new_name, bool new_power_source, bool new_activated,
|
||||
int new_power_cost, int new_charge_time, std::string new_description, bool new_faulty) : description(new_description){
|
||||
name = new_name;
|
||||
power_source = new_power_source;
|
||||
activated = new_activated;
|
||||
power_cost = new_power_cost;
|
||||
charge_time = new_charge_time;
|
||||
faulty = new_faulty;
|
||||
}
|
||||
|
||||
bionic_id game::random_good_bionic() const
|
||||
{
|
||||
std::map<std::string,bionic_data*>::const_iterator random_bionic;
|
||||
do
|
||||
{
|
||||
random_bionic = bionics.begin();
|
||||
std::advance(random_bionic,rng(0,bionics.size()-1));
|
||||
} while (random_bionic->first == "bio_null" || random_bionic->second->faulty);
|
||||
// TODO: remove bio_null
|
||||
return random_bionic->first;
|
||||
}
|
||||
|
||||
// helper function for power_bionics
|
||||
void show_power_level_in_titlebar(WINDOW* window, player* p)
|
||||
{
|
||||
mvwprintz(window, 1, 62, c_white, _("Power: %d/%d"), p->power_level, p->max_power_level);
|
||||
}
|
||||
|
||||
void player::power_bionics(game *g)
|
||||
{
|
||||
int HEIGHT = TERMY;
|
||||
int WIDTH = FULL_SCREEN_WIDTH;
|
||||
int START_X = (TERMX - WIDTH)/2;
|
||||
int START_Y = (TERMY - HEIGHT)/2;
|
||||
WINDOW* wBio = newwin(HEIGHT, WIDTH, START_Y, START_X);
|
||||
int DESCRIPTION_WIDTH = WIDTH - 2; // Same width as bionics window minus 2 for the borders
|
||||
int DESCRIPTION_HEIGHT = 3;
|
||||
int DESCRIPTION_START_X = getbegx(wBio) + 1; // +1 to avoid border
|
||||
int DESCRIPTION_START_Y = getmaxy(wBio) - DESCRIPTION_HEIGHT - 1; // At the bottom of the bio window, -1 to avoid border
|
||||
WINDOW* w_description = newwin(DESCRIPTION_HEIGHT, DESCRIPTION_WIDTH, DESCRIPTION_START_Y, DESCRIPTION_START_X);
|
||||
|
||||
werase(wBio);
|
||||
wborder(wBio, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
|
||||
std::vector <bionic> passive;
|
||||
std::vector <bionic> active;
|
||||
int HEADER_TEXT_Y = START_Y + 1;
|
||||
mvwprintz(wBio, HEADER_TEXT_Y, 1, c_blue, _("BIONICS -"));
|
||||
mvwprintz(wBio, HEADER_TEXT_Y, 11, c_white, _("Activating. Press '!' to examine your implants."));
|
||||
show_power_level_in_titlebar(wBio, this);
|
||||
|
||||
int HEADER_LINE_Y = START_Y + 2;
|
||||
int DESCRIPTION_LINE_Y = DESCRIPTION_START_Y - 1;
|
||||
for (int i = 1; i < 79; i++) {
|
||||
mvwputch(wBio, HEADER_LINE_Y, i, c_ltgray, LINE_OXOX); // Draw line under title
|
||||
mvwputch(wBio, DESCRIPTION_LINE_Y, i, c_ltgray, LINE_OXOX); // Draw line above description
|
||||
}
|
||||
|
||||
// Draw symbols to connect additional lines to border
|
||||
mvwputch(wBio, HEADER_LINE_Y, 0, c_ltgray, LINE_XXXO); // |-
|
||||
mvwputch(wBio, HEADER_LINE_Y, 79, c_ltgray, LINE_XOXX); // -|
|
||||
|
||||
mvwputch(wBio, DESCRIPTION_LINE_Y, 0, c_ltgray, LINE_XXXO); // |-
|
||||
mvwputch(wBio, DESCRIPTION_LINE_Y, 79, c_ltgray, LINE_XOXX); // -|
|
||||
|
||||
for (int i = 0; i < my_bionics.size(); i++) {
|
||||
if (!bionics[my_bionics[i].id]->activated)
|
||||
passive.push_back(my_bionics[i]);
|
||||
else
|
||||
active.push_back(my_bionics[i]);
|
||||
}
|
||||
nc_color type;
|
||||
if (!passive.empty()) {
|
||||
mvwprintz(wBio, 3, 1, c_ltblue, _("Passive:"));
|
||||
for (int i = 0; i < passive.size(); i++) {
|
||||
if (bionics[passive[i].id]->power_source)
|
||||
type = c_ltcyan;
|
||||
else
|
||||
type = c_cyan;
|
||||
mvwputch(wBio, 4 + i, 1, type, passive[i].invlet);
|
||||
mvwprintz(wBio, 4 + i, 3, type, bionics[passive[i].id]->name.c_str());
|
||||
}
|
||||
}
|
||||
if (!active.empty()) {
|
||||
mvwprintz(wBio, 3, 33, c_ltblue, _("Active:"));
|
||||
for (int i = 0; i < active.size(); i++) {
|
||||
if (active[i].powered && !bionics[active[i].id]->power_source)
|
||||
type = c_red;
|
||||
else if (bionics[active[i].id]->power_source && !active[i].powered)
|
||||
type = c_ltcyan;
|
||||
else if (bionics[active[i].id]->power_source && active[i].powered)
|
||||
type = c_ltgreen;
|
||||
else
|
||||
type = c_ltred;
|
||||
|
||||
mvwputch(wBio, 4 + i, 33, type, active[i].invlet);
|
||||
mvwprintz(wBio, 4 + i, 35, type,
|
||||
(active[i].powered ? _("%s - ON") : _("%s - %d PU / %d trns")),
|
||||
bionics[active[i].id]->name.c_str(),
|
||||
bionics[active[i].id]->power_cost,
|
||||
bionics[active[i].id]->charge_time);
|
||||
}
|
||||
}
|
||||
wrefresh(wBio);
|
||||
char ch;
|
||||
bool activating = true;
|
||||
bionic *tmp = NULL;
|
||||
int b = 0;
|
||||
do {
|
||||
ch = getch();
|
||||
if (ch == '!') {
|
||||
activating = !activating;
|
||||
if (activating)
|
||||
mvwprintz(wBio, 1, 11, c_white, _("Activating. Press '!' to examine your implants."));
|
||||
else
|
||||
mvwprintz(wBio, 1, 11, c_white, _("Examining. Press '!' to activate your implants."));
|
||||
} else if (ch == ' ')
|
||||
ch = KEY_ESCAPE;
|
||||
else if (ch != KEY_ESCAPE) {
|
||||
for (int i = 0; i < my_bionics.size(); i++) {
|
||||
if (ch == my_bionics[i].invlet) {
|
||||
tmp = &my_bionics[i];
|
||||
b = i;
|
||||
ch = KEY_ESCAPE;
|
||||
}
|
||||
}
|
||||
if (ch == KEY_ESCAPE) {
|
||||
if (activating) {
|
||||
if (bionics[tmp->id]->activated) {
|
||||
show_power_level_in_titlebar(wBio, this);
|
||||
itype_id weapon_id = weapon.type->id;
|
||||
if (tmp->powered) {
|
||||
tmp->powered = false;
|
||||
g->add_msg(_("%s powered off."), bionics[tmp->id]->name.c_str());
|
||||
} else if (power_level >= bionics[tmp->id]->power_cost ||
|
||||
(weapon_id == "bio_claws_weapon" && tmp->id == "bio_claws_weapon"))
|
||||
activate_bionic(b, g);
|
||||
} else
|
||||
mvwprintz(wBio, 21, 1, c_ltred, _("\
|
||||
You can not activate %s! To read a description of \
|
||||
%s, press '!', then '%c'."), bionics[tmp->id]->name.c_str(),
|
||||
bionics[tmp->id]->name.c_str(), tmp->invlet);
|
||||
} else { // Describing bionics, not activating them!
|
||||
// Clear the lines first
|
||||
ch = 0;
|
||||
werase(w_description);
|
||||
fold_and_print(w_description, 0, 0, 78, c_ltblue, bionics[tmp->id]->description.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
wrefresh(w_description);
|
||||
wrefresh(wBio);
|
||||
} while (ch != KEY_ESCAPE);
|
||||
werase(wBio);
|
||||
wrefresh(wBio);
|
||||
delwin(wBio);
|
||||
erase();
|
||||
}
|
||||
|
||||
// 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 == "bio_claws_weapon" && bio.id == "bio_claws_weapon")
|
||||
power_cost = 0;
|
||||
if (power_level < power_cost) {
|
||||
if (my_bionics[b].powered) {
|
||||
g->add_msg(_("Your %s powers down."), bionics[bio.id]->name.c_str());
|
||||
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 - 1;
|
||||
}
|
||||
power_level -= power_cost;
|
||||
}
|
||||
|
||||
std::string junk;
|
||||
std::vector<point> traj;
|
||||
std::vector<std::string> good;
|
||||
std::vector<std::string> bad;
|
||||
int dirx, diry;
|
||||
item tmp_item;
|
||||
|
||||
if(bio.id == "bio_painkiller"){
|
||||
pkill += 6;
|
||||
pain -= 2;
|
||||
if (pkill > pain)
|
||||
pkill = pain;
|
||||
} else if (bio.id == "bio_nanobots"){
|
||||
rem_disease("bleed");
|
||||
healall(4);
|
||||
} else if (bio.id == "bio_night"){
|
||||
if (g->turn % 5)
|
||||
g->add_msg(_("Artificial night generator active!"));
|
||||
} else if (bio.id == "bio_resonator"){
|
||||
g->sound(posx, posy, 30, _("VRRRRMP!"));
|
||||
for (int i = posx - 1; i <= posx + 1; i++) {
|
||||
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_set(i, j, t_rubble);
|
||||
}
|
||||
}
|
||||
} else if (bio.id == "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, -1, rng(5, 15));
|
||||
}
|
||||
if (one_in(5))
|
||||
add_disease("teleglow", rng(50, 400));
|
||||
} else if (bio.id == "bio_teleport"){
|
||||
g->teleport();
|
||||
add_disease("teleglow", 300);
|
||||
}
|
||||
// TODO: More stuff here (and bio_blood_filter)
|
||||
else if(bio.id == "bio_blood_anal"){
|
||||
WINDOW* w = newwin(20, 40, 3 + ((TERMY > 25) ? (TERMY-25)/2 : 0), 10+((TERMX > 80) ? (TERMX-80)/2 : 0));
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
if (has_disease("fungus"))
|
||||
bad.push_back(_("Fungal Parasite"));
|
||||
if (has_disease("dermatik"))
|
||||
bad.push_back(_("Insect Parasite"));
|
||||
if (has_disease("poison"))
|
||||
bad.push_back(_("Poison"));
|
||||
if (radiation > 0)
|
||||
bad.push_back(_("Irradiated"));
|
||||
if (has_disease("pkill1"))
|
||||
good.push_back(_("Minor Painkiller"));
|
||||
if (has_disease("pkill2"))
|
||||
good.push_back(_("Moderate Painkiller"));
|
||||
if (has_disease("pkill3"))
|
||||
good.push_back(_("Heavy Painkiller"));
|
||||
if (has_disease("pkill_l"))
|
||||
good.push_back(_("Slow-Release Painkiller"));
|
||||
if (has_disease("drunk"))
|
||||
good.push_back(_("Alcohol"));
|
||||
if (has_disease("cig"))
|
||||
good.push_back(_("Nicotine"));
|
||||
if (has_disease("meth"))
|
||||
good.push_back(_("Methamphetamines"));
|
||||
if (has_disease("high"))
|
||||
good.push_back(_("Intoxicant: Other"));
|
||||
if (has_disease("weed_high"))
|
||||
good.push_back(_("THC Intoxication"));
|
||||
if (has_disease("hallu") || has_disease("visuals"))
|
||||
bad.push_back(_("Magic Mushroom"));
|
||||
if (has_disease("iodine"))
|
||||
good.push_back(_("Iodine"));
|
||||
if (has_disease("took_xanax"))
|
||||
good.push_back(_("Xanax"));
|
||||
if (has_disease("took_prozac"))
|
||||
good.push_back(_("Prozac"));
|
||||
if (has_disease("took_flumed"))
|
||||
good.push_back(_("Antihistamines"));
|
||||
if (has_disease("adrenaline"))
|
||||
good.push_back(_("Adrenaline Spike"));
|
||||
if (good.empty() && bad.empty())
|
||||
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);
|
||||
} else if(bio.id == "bio_blood_filter"){
|
||||
rem_disease("fungus");
|
||||
rem_disease("poison");
|
||||
rem_disease("pkill1");
|
||||
rem_disease("pkill2");
|
||||
rem_disease("pkill3");
|
||||
rem_disease("pkill_l");
|
||||
rem_disease("drunk");
|
||||
rem_disease("cig");
|
||||
rem_disease("high");
|
||||
rem_disease("hallu");
|
||||
rem_disease("visuals");
|
||||
rem_disease("iodine");
|
||||
rem_disease("took_xanax");
|
||||
rem_disease("took_prozac");
|
||||
rem_disease("took_flumed");
|
||||
rem_disease("adrenaline");
|
||||
rem_disease("meth");
|
||||
pkill = 0;
|
||||
stim = 0;
|
||||
} else if(bio.id == "bio_evap"){
|
||||
item water = item(g->itypes["water_clean"], 0);
|
||||
if (g->handle_liquid(water, true, true))
|
||||
{
|
||||
moves -= 100;
|
||||
}
|
||||
else if (query_yn(_("Drink from your hands?")))
|
||||
{
|
||||
inv.push_back(water);
|
||||
water = inv.item_by_type(water.typeId());
|
||||
consume(g, water.invlet);
|
||||
moves -= 350;
|
||||
}
|
||||
else
|
||||
{
|
||||
power_level += bionics["bio_evap"]->power_cost;
|
||||
}
|
||||
} else if(bio.id == "bio_lighter"){
|
||||
if(!g->choose_adjacent(_("Start a fire where?"), dirx, diry) ||
|
||||
(!g->m.add_field(g, dirx, diry, fd_fire, 1))){
|
||||
g->add_msg_if_player(this,_("You can't light a fire there."));
|
||||
power_level += bionics["bio_lighter"]->power_cost;
|
||||
}
|
||||
|
||||
} else if(bio.id == "bio_claws"){
|
||||
if (weapon.type->id == "bio_claws_weapon") {
|
||||
g->add_msg(_("You withdraw your claws."));
|
||||
weapon = ret_null;
|
||||
} else if(weapon.type->id != "null"){
|
||||
g->add_msg(_("Your claws extend, forcing you to drop your %s."),
|
||||
weapon.tname().c_str());
|
||||
g->m.add_item_or_charges(posx, posy, weapon);
|
||||
weapon = item(g->itypes["bio_claws_weapon"], 0);
|
||||
weapon.invlet = '#';
|
||||
} else {
|
||||
g->add_msg(_("Your claws extend!"));
|
||||
weapon = item(g->itypes["bio_claws_weapon"], 0);
|
||||
weapon.invlet = '#';
|
||||
}
|
||||
} else if(bio.id == "bio_blaster"){
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes["bio_blaster_gun"], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
} else if (bio.id == "bio_laser"){
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes["bio_laser_gun"], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
} else if (bio.id == "bio_emp"){
|
||||
if(g->choose_adjacent(_("Create an EMP where?"), dirx, diry))
|
||||
g->emp_blast(dirx, diry);
|
||||
else{
|
||||
power_level += bionics["bio_emp"]->power_cost;
|
||||
}
|
||||
|
||||
} else if (bio.id == "bio_hydraulics"){
|
||||
g->add_msg(_("Your muscles hiss as hydraulic strength fills them!"));
|
||||
} else if (bio.id == "bio_water_extractor"){
|
||||
bool extracted = false;
|
||||
for (int i = 0; i < g->m.i_at(posx, posy).size(); i++) {
|
||||
item & tmp = g->m.i_at(posx, posy)[i];
|
||||
if (tmp.type->id == "corpse" ) {
|
||||
int avail=0;
|
||||
if ( tmp.item_vars.find("remaining_water") != tmp.item_vars.end() ) {
|
||||
avail = atoi ( tmp.item_vars["remaining_water"].c_str() );
|
||||
} else {
|
||||
avail = tmp.volume() / 2;
|
||||
}
|
||||
if(avail > 0 && query_yn(_("Extract water from the %s"), tmp.tname().c_str())) {
|
||||
item water = item(g->itypes["water_clean"], 0);
|
||||
if (g->handle_liquid(water, true, true)) {
|
||||
moves -= 100;
|
||||
} else if (query_yn(_("Drink directly from the condensor?"))) {
|
||||
inv.push_back(water);
|
||||
water = inv.item_by_type(water.typeId());
|
||||
consume(g, water.invlet);
|
||||
moves -= 350;
|
||||
}
|
||||
extracted = true;
|
||||
avail--;
|
||||
tmp.item_vars["remaining_water"] = string_format("%d",avail);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!extracted)
|
||||
power_level += bionics["bio_water_extractor"]->power_cost;
|
||||
} else if(bio.id == "bio_magnet"){
|
||||
for (int i = posx - 10; i <= posx + 10; i++) {
|
||||
for (int j = posy - 10; j <= posy + 10; j++) {
|
||||
if (g->m.i_at(i, j).size() > 0) {
|
||||
int t; //not sure why map:sees really needs this, but w/e
|
||||
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")){
|
||||
int l = 0;
|
||||
tmp_item = g->m.i_at(i, j)[k];
|
||||
g->m.i_rem(i, j, k);
|
||||
for (l = 0; l < traj.size(); l++) {
|
||||
int index = g->mon_at(traj[l].x, traj[l].y);
|
||||
if (index != -1) {
|
||||
if (g->zombie(index).hurt(tmp_item.weight() / 225))
|
||||
g->kill_mon(index, true);
|
||||
g->m.add_item_or_charges(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() / 225, 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_or_charges(traj[l - 1].x, traj[l - 1].y, tmp_item);
|
||||
l = traj.size() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l == traj.size())
|
||||
g->m.add_item_or_charges(posx, posy, tmp_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(bio.id == "bio_lockpick"){
|
||||
if(!g->choose_adjacent(_("Activate your bio lockpick where?"), dirx, diry)){
|
||||
power_level += bionics["bio_lockpick"]->power_cost;
|
||||
return;
|
||||
}
|
||||
if (g->m.ter(dirx, diry) == t_door_locked) {
|
||||
moves -= 40;
|
||||
g->add_msg_if_player(this,_("You unlock the door."));
|
||||
g->m.ter_set(dirx, diry, t_door_c);
|
||||
} else
|
||||
g->add_msg_if_player(this,_("You can't unlock that %s."), g->m.tername(dirx, diry).c_str());
|
||||
} else if(bio.id == "bio_flashbang") {
|
||||
g->add_msg_if_player(this,_("You activate your integrated flashbang generator!"));
|
||||
g->flashbang(posx, posy, true);
|
||||
} else if(bio.id == "bio_shockwave") {
|
||||
g->shockwave(posx, posy, 3, 4, 2, 8, true);
|
||||
g->add_msg_if_player(this,_("You unleash a powerful shockwave!"));
|
||||
} else if(bio.id == "bio_chain_lightning"){
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes["bio_lightning"], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
}
|
||||
}
|
||||
|
||||
bool player::install_bionics(game *g, it_bionic* type)
|
||||
{
|
||||
|
||||
if (type == NULL) {
|
||||
debugmsg("Tried to install NULL bionic");
|
||||
return false;
|
||||
}
|
||||
if (has_bionic(type->id)){
|
||||
if (!(type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII")){
|
||||
popup(_("You have already installed this bionic."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int pl_skill = int_cur * 4 +
|
||||
skillLevel("electronics") * 4 +
|
||||
skillLevel("firstaid") * 3 +
|
||||
skillLevel("mechanics") * 1;
|
||||
|
||||
// for chance_of_success calculation, shift skill down to a float between ~0.4 - 30
|
||||
float adjusted_skill = float (pl_skill) - std::min( float (40), float (pl_skill) - float (pl_skill) / float (10.0));
|
||||
|
||||
// we will base chance_of_success on a ratio of skill and difficulty
|
||||
// when skill=difficulty, this gives us 1. skill < difficulty gives a fraction.
|
||||
float skill_difficulty_parameter = float(adjusted_skill / (4.0 * type->difficulty));
|
||||
|
||||
// when skill == difficulty, chance_of_success is 50%. Chance of success drops quickly below that
|
||||
// to reserve bionics for characters with the appropriate skill. For more difficult bionics, the
|
||||
// curve flattens out just above 80%
|
||||
int chance_of_success = int((100 * skill_difficulty_parameter) /
|
||||
(skill_difficulty_parameter + sqrt( 1 / skill_difficulty_parameter)));
|
||||
|
||||
if (!query_yn(_("WARNING: %i percent chance of genetic damage, blood loss, or damage to existing bionics! Install anyway?"), 100 - chance_of_success))
|
||||
return false;
|
||||
int pow_up = 0;
|
||||
if (type->id == "bio_power_storage" || type->id == "bio_power_storage_mkII") {
|
||||
pow_up = BATTERY_AMOUNT;
|
||||
if (type->id == "bio_power_storage_mkII") {
|
||||
pow_up = 10;
|
||||
}
|
||||
}
|
||||
|
||||
practice(g->turn, "electronics", int((100 - chance_of_success) * 1.5));
|
||||
practice(g->turn, "firstaid", int((100 - chance_of_success) * 1.0));
|
||||
practice(g->turn, "mechanics", int((100 - chance_of_success) * 0.5));
|
||||
int success = chance_of_success - rng(1, 100);
|
||||
if (success > 0) {
|
||||
g->u.add_memorial_log(_("Installed bionic: %s."), bionics[type->id]->name.c_str());
|
||||
if (pow_up) {
|
||||
max_power_level += pow_up;
|
||||
g->add_msg_if_player(this, _("Increased storage capacity by %i"), pow_up);
|
||||
} else{
|
||||
g->add_msg(_("Successfully installed %s."), bionics[type->id]->name.c_str());
|
||||
add_bionic(type->id);
|
||||
}
|
||||
} else {
|
||||
g->u.add_memorial_log(_("Failed to install bionic: %s."), bionics[type->id]->name.c_str());
|
||||
bionics_install_failure(g, this, type, success);
|
||||
}
|
||||
g->refresh_all();
|
||||
return true;
|
||||
}
|
||||
|
||||
void bionics_install_failure(game *g, player *u, it_bionic* type, int success)
|
||||
{
|
||||
|
||||
// "success" should be passed in as a negative integer representing how far off we
|
||||
// were for a successful install. We use this to determine consequences for failing.
|
||||
success = abs(success);
|
||||
|
||||
// it would be better for code reuse just to pass in skill as an argument from install_bionic
|
||||
// pl_skill should be calculated the same as in install_bionics
|
||||
int pl_skill = u->int_cur * 4 +
|
||||
u->skillLevel("electronics") * 4 +
|
||||
u->skillLevel("firstaid") * 3 +
|
||||
u->skillLevel("mechanics") * 1;
|
||||
|
||||
// for failure_level calculation, shift skill down to a float between ~0.4 - 30
|
||||
float adjusted_skill = float (pl_skill) - std::min( float (40), float (pl_skill) - float (pl_skill) / float (10.0));
|
||||
|
||||
// failure level is decided by how far off the character was from a successful install, and
|
||||
// this is scaled up or down by the ratio of difficulty/skill. At high skill levels (or low
|
||||
// difficulties), only minor consequences occur. At low skill levels, severe consequences
|
||||
// are more likely.
|
||||
int failure_level = int(sqrt(success * 4.0 * type->difficulty / float (adjusted_skill)));
|
||||
int fail_type = (failure_level > 5 ? 5 : failure_level);
|
||||
|
||||
if (fail_type <= 0) {
|
||||
g->add_msg(_("The installation fails without incident."));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (rng(1, 5)) {
|
||||
case 1: g->add_msg(_("You flub the installation.")); break;
|
||||
case 2: g->add_msg(_("You mess up the installation.")); break;
|
||||
case 3: g->add_msg(_("The installation fails.")); break;
|
||||
case 4: g->add_msg(_("The installation is a failure.")); break;
|
||||
case 5: g->add_msg(_("You screw up the installation.")); break;
|
||||
}
|
||||
|
||||
if (fail_type == 3 && u->num_bionics() == 0)
|
||||
fail_type = 2; // If we have no bionics, take damage instead of losing some
|
||||
|
||||
switch (fail_type) {
|
||||
|
||||
case 1:
|
||||
g->add_msg(_("It really hurts!"));
|
||||
u->pain += rng(failure_level * 3, failure_level * 6);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
g->add_msg(_("Your body is damaged!"));
|
||||
u->hurtall(rng(failure_level, failure_level * 2));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (u->num_bionics() <= failure_level) {
|
||||
g->add_msg(_("All of your existing bionics are lost!"));
|
||||
} else {
|
||||
g->add_msg(_("Some of your existing bionics are lost!"));
|
||||
}
|
||||
for (int i = 0; i < failure_level && u->remove_random_bionic(); i++) ;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
g->add_msg(_("You do damage to your genetics, causing mutation!"));
|
||||
while (failure_level > 0) {
|
||||
u->mutate(g);
|
||||
failure_level -= rng(1, failure_level + 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
{
|
||||
g->add_msg(_("The installation is faulty!"));
|
||||
std::vector<bionic_id> valid;
|
||||
for (std::vector<std::string>::iterator it = faulty_bionics.begin() ; it != faulty_bionics.end(); ++it){
|
||||
if (!u->has_bionic(*it)){
|
||||
valid.push_back(*it);
|
||||
}
|
||||
}
|
||||
if (valid.empty()) { // We've got all the bad bionics!
|
||||
if (u->max_power_level > 0) {
|
||||
int old_power = u->max_power_level;
|
||||
g->add_msg(_("You lose power capacity!"));
|
||||
u->max_power_level = rng(0, u->max_power_level - 1);
|
||||
g->u.add_memorial_log(_("Lost %d units of power capacity."), old_power - u->max_power_level);
|
||||
}
|
||||
// TODO: What if we can't lose power capacity? No penalty?
|
||||
} else {
|
||||
int index = rng(0, valid.size() - 1);
|
||||
u->add_bionic(valid[index]);
|
||||
g->u.add_memorial_log(_("Installed bad bionic: %s."), bionics[valid[index]]->name.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void load_bionic(JsonObject &jsobj)
|
||||
{
|
||||
std::string id = jsobj.get_string("id");
|
||||
std::string name = _(jsobj.get_string("name").c_str());
|
||||
std::string description = _(jsobj.get_string("description").c_str());
|
||||
int cost = jsobj.get_int("cost", 0);
|
||||
int time = jsobj.get_int("time", 0);
|
||||
bool faulty = jsobj.get_bool("faulty", false);
|
||||
bool power_source = jsobj.get_bool("power_source", false);
|
||||
bool active = jsobj.get_bool("active", false);
|
||||
|
||||
if (faulty) { faulty_bionics.push_back(id); }
|
||||
if (power_source) { power_source_bionics.push_back(id); }
|
||||
if (!active && id != "bio_null") { unpowered_bionics.push_back(id); }
|
||||
|
||||
bionics[id] = new bionic_data(name, power_source, active, cost, time, description, faulty);
|
||||
//dout(D_INFO) << "Loaded bionic: " << name << "\n";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef _BIONICS_H_
|
||||
#define _BIONICS_H_
|
||||
#include "json.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
/* Thought: Perhaps a HUD bionic that changes the display of the game?
|
||||
* Showing more information or something. */
|
||||
|
||||
typedef std::string bionic_id;
|
||||
|
||||
class bionic_data {
|
||||
public:
|
||||
bionic_data(std::string new_name, bool new_power_source, bool new_activated,
|
||||
int new_power_cost, int new_charge_time, std::string new_description, bool new_faulty = false);
|
||||
|
||||
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;
|
||||
bool faulty; // Whether or not the bionic is faulty
|
||||
};
|
||||
|
||||
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) {
|
||||
id = pid;
|
||||
invlet = pinvlet;
|
||||
powered = false;
|
||||
charge = 0;
|
||||
};
|
||||
};
|
||||
|
||||
extern std::map<bionic_id, bionic_data*> bionics;
|
||||
extern std::vector<bionic_id> faulty_bionics;
|
||||
extern std::vector<bionic_id> power_source_bionics;
|
||||
extern std::vector<bionic_id> unpowered_bionics;
|
||||
|
||||
void load_bionic(JsonObject &jsobj); // load a bionic from JSON
|
||||
|
||||
#endif
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#include "bodypart.h"
|
||||
#include "translations.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(bool main_parts_only)
|
||||
{
|
||||
int rn = rng(0, 100);
|
||||
if (!main_parts_only) {
|
||||
if (rn == 0)
|
||||
return bp_eyes;
|
||||
if (rn <= 1)
|
||||
return bp_mouth;
|
||||
if (rn <= 7)
|
||||
return bp_head;
|
||||
if (rn <= 24)
|
||||
return bp_legs;
|
||||
if (rn <= 30)
|
||||
return bp_feet;
|
||||
if (rn <= 47)
|
||||
return bp_arms;
|
||||
if (rn <= 53)
|
||||
return bp_hands;
|
||||
return bp_torso;
|
||||
} else {
|
||||
if (rn <= 7)
|
||||
return bp_head;
|
||||
if (rn <= 30)
|
||||
return bp_legs;
|
||||
if (rn <= 53)
|
||||
return bp_arms;
|
||||
return bp_torso;
|
||||
}
|
||||
}
|
||||
|
||||
int random_side(body_part bp)
|
||||
{
|
||||
switch (bp) {
|
||||
case bp_torso:
|
||||
case bp_head:
|
||||
case bp_eyes:
|
||||
case bp_mouth:
|
||||
return -1;
|
||||
case bp_arms:
|
||||
case bp_hands:
|
||||
case bp_legs:
|
||||
case bp_feet:
|
||||
return rng(0, 1);
|
||||
default:
|
||||
return rng(0, 1);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#ifndef _BODYPART_H_
|
||||
#define _BODYPART_H_
|
||||
|
||||
#include <string>
|
||||
// The order is important ; pldata.h has to be in the same order
|
||||
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(bool main_parts_only = false);
|
||||
int random_side(body_part);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
||||
#ifndef _BUILDING_GENERATION_H_
|
||||
#define _BUILDING_GENERATION_H_
|
||||
|
||||
#include "omdata.h"
|
||||
#include "map.h"
|
||||
|
||||
struct mapgendata
|
||||
{
|
||||
public:
|
||||
oter_id t_nesw[8];
|
||||
int n_fac; // dir == 0
|
||||
int e_fac; // dir == 1
|
||||
int s_fac; // dir == 2
|
||||
int w_fac; // dir == 3
|
||||
int ne_fac; // dir == 4
|
||||
int se_fac; // dir == 5
|
||||
int nw_fac; // dir == 6
|
||||
int sw_fac; // dir == 7
|
||||
|
||||
mapgendata(oter_id t_north, oter_id t_east, oter_id t_south, oter_id t_west, oter_id t_neast,
|
||||
oter_id t_seast, oter_id t_nwest, oter_id t_swest);
|
||||
void set_dir(int dir_in, int val);
|
||||
void fill(int val);
|
||||
int& dir(int dir_in);
|
||||
};
|
||||
|
||||
ter_id grass_or_dirt();
|
||||
ter_id dirt_or_pile();
|
||||
|
||||
// helper functions for mapgen.cpp, so that we can avoid having a massive switch statement (sorta)
|
||||
void mapgen_null(map *m);
|
||||
void mapgen_crater(map *m, mapgendata dat);
|
||||
void mapgen_field(map *m, int turn);
|
||||
void mapgen_dirtlot(map *m);
|
||||
void mapgen_forest_general(map *m, oter_id terrain_type, mapgendata dat, int turn);
|
||||
void mapgen_hive(map *m, mapgendata dat, int turn);
|
||||
void mapgen_spider_pit(map *m, mapgendata dat, int turn);
|
||||
void mapgen_fungal_bloom(map *m);
|
||||
void mapgen_road_straight(map *m, oter_id terrain_type, mapgendata dat, int turn, float density);
|
||||
void mapgen_road_curved(map *m, oter_id terrain_type, mapgendata dat, int turn, float density);
|
||||
void mapgen_road_tee(map *m, oter_id terrain_type, mapgendata dat, int turn, float density);
|
||||
void mapgen_road_four_way(map *m, oter_id terrain_type, mapgendata dat, int turn, float density);
|
||||
void mapgen_field(map *m, int turn);
|
||||
void mapgen_bridge(map *m, oter_id terrain_type, int turn);
|
||||
void mapgen_highway(map *m, oter_id terrain_type, int turn);
|
||||
void mapgen_river_curved_not(map *m, oter_id terrain_type);
|
||||
void mapgen_river_straight(map *m, oter_id terrain_type);
|
||||
void mapgen_river_curved(map *m, oter_id terrain_type);
|
||||
void mapgen_parking_lot(map *m, oter_id terrain_type, mapgendata dat, int turn);
|
||||
void mapgen_pool(map *m);
|
||||
void mapgen_park(map *m);
|
||||
void mapgen_gas_station(map *m, oter_id terrain_type, int turn, float density);
|
||||
|
||||
#endif
|
||||
+487
@@ -0,0 +1,487 @@
|
||||
#include <sstream>
|
||||
#include "calendar.h"
|
||||
#include "output.h"
|
||||
#include "options.h"
|
||||
#include "translations.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 minute_param = int(turn / 10);
|
||||
int hour_param = minute_param / 60;
|
||||
int day_param = hour_param / 24;
|
||||
int season_param = int(day_param / OPTIONS["SEASON_LENGTH"]);
|
||||
second = 6 * (turn % 10);
|
||||
minute = minute_param % 60;
|
||||
hour = hour_param % 24;
|
||||
day = 1 + day_param % (int)OPTIONS["SEASON_LENGTH"];
|
||||
season = season_type(season_param % 4);
|
||||
year = season_param / 4;
|
||||
}
|
||||
|
||||
int calendar::get_turn() const
|
||||
{
|
||||
int ret = second / 6;
|
||||
ret += minute * 10;
|
||||
ret += hour * 600;
|
||||
ret += day * 14400;
|
||||
ret += int(season) * 14400 * (int)OPTIONS["SEASON_LENGTH"];
|
||||
ret += year * 14400 * 4 * (int)OPTIONS["SEASON_LENGTH"];
|
||||
return ret;
|
||||
}
|
||||
|
||||
calendar::operator int() const
|
||||
{
|
||||
int ret = second / 6;
|
||||
ret += minute * 10;
|
||||
ret += hour * 600;
|
||||
ret += day * 14400;
|
||||
ret += int(season) * 14400 * (int)OPTIONS["SEASON_LENGTH"];
|
||||
ret += year * 14400 * 4 * (int)OPTIONS["SEASON_LENGTH"];
|
||||
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 minute_param = int(rhs / 10);
|
||||
int hour_param = minute_param / 60;
|
||||
int day_param = hour_param / 24;
|
||||
int season_param = int(day_param / OPTIONS["SEASON_LENGTH"]);
|
||||
second = 6 * (rhs % 10);
|
||||
minute = minute_param % 60;
|
||||
hour = hour_param % 24;
|
||||
day = day_param % (int)OPTIONS["SEASON_LENGTH"];
|
||||
season = season_type(season_param % 4);
|
||||
year = season_param / 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) const
|
||||
{
|
||||
return int(*this) == rhs;
|
||||
}
|
||||
bool calendar::operator ==(calendar &rhs) const
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
int calendar::getHour()
|
||||
{
|
||||
return hour;
|
||||
}
|
||||
|
||||
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 >= OPTIONS["SEASON_LENGTH"]) {
|
||||
tmpseason += int(day / OPTIONS["SEASON_LENGTH"]);
|
||||
day %= (int)OPTIONS["SEASON_LENGTH"];
|
||||
}
|
||||
if (tmpseason >= 4) {
|
||||
year += tmpseason / 4;
|
||||
tmpseason %= 4;
|
||||
}
|
||||
season = season_type(tmpseason);
|
||||
}
|
||||
|
||||
int calendar::minutes_past_midnight() const
|
||||
{
|
||||
//debugmsg("minute: %d hour: %d");
|
||||
int ret = minute + hour * 60;
|
||||
return ret;
|
||||
}
|
||||
|
||||
moon_phase calendar::moon() const
|
||||
{
|
||||
int phase = int(day / (OPTIONS["SEASON_LENGTH"] / 4));
|
||||
//phase %= 4; Redundant?
|
||||
if (phase == 3)
|
||||
return MOON_HALF;
|
||||
else
|
||||
return moon_phase(phase);
|
||||
}
|
||||
|
||||
calendar calendar::sunrise() const
|
||||
{
|
||||
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) / OPTIONS["SEASON_LENGTH"]);
|
||||
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() const
|
||||
{
|
||||
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) / OPTIONS["SEASON_LENGTH"]);
|
||||
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() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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 just_hour) const
|
||||
{
|
||||
std::stringstream time_string;
|
||||
int hour_param;
|
||||
|
||||
if (OPTIONS["24_HOUR"] == "military") {
|
||||
hour_param = hour % 24;
|
||||
time_string << string_format("%02d%02d", hour_param, minute);
|
||||
} else if (OPTIONS["24_HOUR"] == "24h") {
|
||||
hour_param = hour % 24;
|
||||
if (just_hour) {
|
||||
time_string << hour_param;
|
||||
} else {
|
||||
//~ hour:minute (24hr time display)
|
||||
time_string << string_format(_("%02d:%02d"), hour_param, minute);
|
||||
}
|
||||
} else {
|
||||
hour_param = hour % 12;
|
||||
if (hour_param == 0) {
|
||||
hour_param = 12;
|
||||
}
|
||||
if (just_hour && hour < 12) {
|
||||
time_string << string_format(_("%d AM"), hour_param);
|
||||
} else if (just_hour) {
|
||||
time_string << string_format(_("%d PM"), hour_param);
|
||||
} else if (hour < 12) {
|
||||
time_string << string_format(_("%d:%02d AM"), hour_param, minute);
|
||||
} else {
|
||||
time_string << string_format(_("%d:%02d PM"), hour_param, minute);
|
||||
}
|
||||
}
|
||||
|
||||
return time_string.str();
|
||||
}
|
||||
|
||||
std::string calendar::textify_period()
|
||||
{
|
||||
standardize();
|
||||
int am;
|
||||
const char* tx;
|
||||
// Describe the biggest time period, as "<am> <tx>s", am = amount, tx = name
|
||||
if (year > 0) {
|
||||
am = year;
|
||||
tx = ngettext("%d year", "%d years", am);
|
||||
} else if (season > 0) {
|
||||
am = season;
|
||||
tx = ngettext("%d season", "%d seasons", am);
|
||||
} else if (day > 0) {
|
||||
am = day;
|
||||
tx = ngettext("%d day", "%d days", am);
|
||||
} else if (hour > 0) {
|
||||
am = hour;
|
||||
tx = ngettext("%d hour", "%d hours", am);
|
||||
} else if (minute >= 5) {
|
||||
am = minute;
|
||||
tx = ngettext("%d minute", "%d minutes", am);
|
||||
} else {
|
||||
am = second / 6 + minute * 10;
|
||||
tx = ngettext("%d turn", "%d turns", am);
|
||||
}
|
||||
|
||||
return string_format(tx, am);
|
||||
}
|
||||
|
||||
std::string calendar::day_of_week() const
|
||||
{
|
||||
// Design rationale
|
||||
// <kevingranade> here's a question
|
||||
// <kevingranade> what day of the week is day 0?
|
||||
// <wito> Sunday
|
||||
// <GlyphGryph> Why does it matter?
|
||||
// <GlyphGryph> For like where people are and stuff?
|
||||
// <wito> 7 is also Sunday
|
||||
// <kevingranade> NOAA weather forecasts include day of week
|
||||
// <GlyphGryph> Also by day0 do you mean the day people start day 0
|
||||
// <GlyphGryph> Or actual day 0
|
||||
// <kevingranade> good point, turn 0
|
||||
// <GlyphGryph> So day 5
|
||||
// <wito> Oh, I thought we were talking about week day numbering in general.
|
||||
// <wito> Day 5 is a thursday, I think.
|
||||
// <wito> Nah, Day 5 feels like a thursday. :P
|
||||
// <wito> Which would put the apocalpyse on a saturday?
|
||||
// <Starfyre> must be a thursday. I was never able to get the hang of those.
|
||||
// <ZChris13> wito: seems about right to me
|
||||
// <wito> kevingranade: add four for thursday. ;)
|
||||
// <kevingranade> sounds like consensus to me
|
||||
// <kevingranade> Thursday it is
|
||||
|
||||
enum weekday
|
||||
{
|
||||
THURSDAY = 0,
|
||||
FRIDAY = 1,
|
||||
SATURDAY = 2,
|
||||
SUNDAY = 3,
|
||||
MONDAY = 4,
|
||||
TUESDAY = 5,
|
||||
WEDNESDAY = 6
|
||||
};
|
||||
|
||||
// calendar::day gets mangled by season transitions, so reclaculate days since start.
|
||||
int current_day = day % 7;
|
||||
|
||||
std::string day_string;
|
||||
|
||||
switch (current_day)
|
||||
{
|
||||
case SUNDAY:
|
||||
day_string = _("Sunday");
|
||||
break;
|
||||
case MONDAY:
|
||||
day_string = _("Monday");
|
||||
break;
|
||||
case TUESDAY:
|
||||
day_string = _("Tuesday");
|
||||
break;
|
||||
case WEDNESDAY:
|
||||
day_string = _("Wendsday");
|
||||
break;
|
||||
case THURSDAY:
|
||||
day_string = _("Thursday");
|
||||
break;
|
||||
case FRIDAY:
|
||||
day_string = _("Friday");
|
||||
break;
|
||||
case SATURDAY:
|
||||
day_string = _("Saturday");
|
||||
break;
|
||||
}
|
||||
|
||||
return day_string;
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#ifndef _CALENDAR_H_
|
||||
#define _CALENDAR_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
// 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 season_type {
|
||||
SPRING = 0,
|
||||
SUMMER = 1,
|
||||
AUTUMN = 2,
|
||||
WINTER = 3
|
||||
#define FALL AUTUMN
|
||||
};
|
||||
|
||||
enum moon_phase {
|
||||
MOON_NEW = 0,
|
||||
MOON_HALF,
|
||||
MOON_FULL
|
||||
};
|
||||
|
||||
class calendar
|
||||
{
|
||||
private:
|
||||
// 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
|
||||
|
||||
public:
|
||||
calendar();
|
||||
calendar(const calendar ©);
|
||||
calendar(int Minute, int Hour, int Day, season_type Season, int Year);
|
||||
calendar(int turn);
|
||||
int get_turn() const;
|
||||
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) const;
|
||||
bool operator ==(calendar &rhs) const;
|
||||
|
||||
void increment(); // Add one turn / 6 seconds
|
||||
|
||||
void standardize(); // Ensure minutes <= 59, hour <= 23, etc.
|
||||
|
||||
int getHour(); // return hour
|
||||
|
||||
// Sunlight and day/night calcuations
|
||||
int minutes_past_midnight() const; // Useful for sunrise/set calculations
|
||||
moon_phase moon() const; // Find phase of moon
|
||||
calendar sunrise() const; // Current time of sunrise
|
||||
calendar sunset() const; // Current time of sunset
|
||||
bool is_night() const; // After sunset + TWILIGHT_MINUTES, before sunrise
|
||||
int sunlight() const; // Current amount of sun/moonlight; uses preceding funcs
|
||||
|
||||
// Basic accessors
|
||||
int seconds() const {return second;}
|
||||
int minutes() const {return minute;}
|
||||
int hours() const {return hour;}
|
||||
int days() const {return day;}
|
||||
season_type get_season() const {return season;}
|
||||
int years() const {return year;}
|
||||
|
||||
void set_season(season_type new_season) {season = new_season;}
|
||||
|
||||
|
||||
// Print-friendly stuff
|
||||
std::string print_time(bool just_hour = false) const;
|
||||
std::string textify_period(); // "1 second" "2 hours" "two days"
|
||||
std::string day_of_week() const;
|
||||
};
|
||||
#endif // _CALENDAR_H_
|
||||
+1450
File diff suppressed because it is too large
Load Diff
+78
-137
@@ -2,24 +2,29 @@
|
||||
#define CATA_TILES_H
|
||||
|
||||
// make sure that SDL systems are included: Until testing is available for other systems, keep Windows specific
|
||||
#if !(defined _WIN32 || defined WINDOWS)
|
||||
#if (defined _WIN32 || defined WINDOWS)
|
||||
//#include <windows.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_ttf.h"
|
||||
#else
|
||||
#include <wordexp.h>
|
||||
#if (defined OSX_SDL_FW)
|
||||
#include "SDL.h"
|
||||
#include "SDL_ttf/SDL_ttf.h"
|
||||
#else
|
||||
#include "SDL/SDL.h"
|
||||
#include "SDL/SDL_ttf.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
#include "SDL2/SDL_ttf.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "options.h"
|
||||
#include "mapdata.h"
|
||||
#include "tile_id_data.h"
|
||||
#include "enums.h"
|
||||
#include "file_finder.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class JsonObject;
|
||||
|
||||
/** Structures */
|
||||
struct tile_type
|
||||
@@ -79,26 +84,10 @@ enum MULTITILE_TYPE
|
||||
broken,
|
||||
num_multitile_types
|
||||
};
|
||||
// Make sure to change TILE_CATEGORY_IDS if this changes!
|
||||
enum TILE_CATEGORY
|
||||
{
|
||||
C_NONE,
|
||||
C_VEHICLE_PART,
|
||||
C_TERRAIN,
|
||||
C_ITEM,
|
||||
C_FURNITURE,
|
||||
C_TRAP,
|
||||
C_FIELD,
|
||||
C_LIGHTING,
|
||||
C_MONSTER,
|
||||
C_BULLET,
|
||||
C_HIT_ENTITY,
|
||||
C_WEATHER,
|
||||
};
|
||||
|
||||
/** Typedefs */
|
||||
typedef std::vector<SDL_Texture *> tile_map;
|
||||
typedef std::unordered_map<std::string, tile_type *> tile_id_map;
|
||||
typedef std::map<int, SDL_Rect*> tile_map;
|
||||
typedef std::map<std::string, tile_type*> tile_id_map;
|
||||
|
||||
typedef tile_map::iterator tile_iterator;
|
||||
typedef tile_id_map::iterator tile_id_iterator;
|
||||
@@ -110,14 +99,14 @@ struct tile_drawing_cache {
|
||||
|
||||
// Sprite indices drawn on this tile.
|
||||
// The same indices in a different order need to be drawn differently!
|
||||
std::vector<tile_type *> sprites;
|
||||
std::vector<tile_type*> sprites;
|
||||
std::vector<int> rotations;
|
||||
|
||||
bool operator==(const tile_drawing_cache &other) const {
|
||||
bool operator==(const tile_drawing_cache& other) const {
|
||||
if(sprites.size() != other.sprites.size()) {
|
||||
return false;
|
||||
} else {
|
||||
for( size_t i = 0; i < sprites.size(); ++i ) {
|
||||
for(int i=0; i<sprites.size(); i++) {
|
||||
if(sprites[i] != other.sprites[i] || rotations[i] != other.rotations[i]) {
|
||||
return false;
|
||||
}
|
||||
@@ -127,11 +116,11 @@ struct tile_drawing_cache {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator!=(const tile_drawing_cache &other) const {
|
||||
bool operator!=(const tile_drawing_cache& other) const {
|
||||
return !(this->operator==(other));
|
||||
}
|
||||
|
||||
void operator=(const tile_drawing_cache &other) {
|
||||
void operator=(const tile_drawing_cache& other) {
|
||||
this->sprites = other.sprites;
|
||||
this->rotations = other.rotations;
|
||||
}
|
||||
@@ -141,86 +130,42 @@ class cata_tiles
|
||||
{
|
||||
public:
|
||||
/** Default constructor */
|
||||
cata_tiles(SDL_Renderer *render);
|
||||
cata_tiles();
|
||||
/** Default destructor */
|
||||
~cata_tiles();
|
||||
protected:
|
||||
void clear();
|
||||
public:
|
||||
/** Reload tileset, with the given scale. Scale is divided by 16 to allow for scales < 1 without risking
|
||||
* float inaccuracies. */
|
||||
void set_draw_scale(int scale);
|
||||
protected:
|
||||
/** Load tileset, R,G,B, are the color components of the transparent color
|
||||
* throws std::string on errors. Returns the number of tiles that have
|
||||
* been loaded from this tileset image
|
||||
*/
|
||||
int load_tileset(std::string path, int R, int G, int B);
|
||||
|
||||
/**
|
||||
* Load tileset config file (json format).
|
||||
* If the tileset uses the old system (one image per tileset) the image
|
||||
* path <B>imagepath</B> is used to load the tileset image.
|
||||
* Otherwise (the tileset uses the new system) the image pathes
|
||||
* are loaded from the json entries.
|
||||
* throws std::string on errors.
|
||||
*/
|
||||
void load_tilejson(std::string path, const std::string &imagepath);
|
||||
|
||||
/**
|
||||
* throws std::string on errors.
|
||||
*/
|
||||
void load_tilejson_from_file(std::ifstream &f, const std::string &imagepath);
|
||||
|
||||
/**
|
||||
* Load tiles from json data.This expects a "tiles" array in
|
||||
* <B>config</B>. That array should contain all the tile definition that
|
||||
* should be taken from an tileset image.
|
||||
* Because the function only loads tile definitions for a single tileset
|
||||
* image, only tile inidizes (tile_type::fg tile_type::bg) in the interval
|
||||
* [0,size].
|
||||
* The <B>offset</B> is automatically added to the tile index.
|
||||
* throws std::string on errors.
|
||||
*/
|
||||
void load_tilejson_from_file(JsonObject &config, int offset, int size);
|
||||
|
||||
/**
|
||||
* Create a new tile_type, add it to tile_ids (using <B>id</B>).
|
||||
* Set the fg and bg properties of it (loaded from the json object).
|
||||
* Makes sure each is either -1, or in the interval [0,size).
|
||||
* If it's in that interval, adds offset to it, if it's not in the
|
||||
* interval (and not -1), throw an std::string error.
|
||||
*/
|
||||
tile_type *load_tile(JsonObject &entry, const std::string &id, int offset, int size);
|
||||
|
||||
void load_ascii_tilejson_from_file(JsonObject &config, int offset, int size);
|
||||
void load_ascii_set(JsonObject &entry, int offset, int size);
|
||||
void add_ascii_subtile(tile_type *curr_tile, const std::string &t_id, int fg, const std::string &s_id);
|
||||
public:
|
||||
/** Load tileset */
|
||||
void load_tileset(std::string path);
|
||||
/** Load tileset config file */
|
||||
void load_tilejson(std::string path);
|
||||
void load_tilejson_from_file(std::ifstream *f);
|
||||
/* After loading tileset, create additional cache for rotating each tile assuming it is used for rotations */
|
||||
void create_rotation_cache();
|
||||
/** Draw to screen */
|
||||
void draw(); /* Deprecated */
|
||||
void draw(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
protected:
|
||||
|
||||
/** How many rows and columns of tiles fit into given dimensions **/
|
||||
void get_window_tile_counts(const int width, const int height, int &columns, int &rows) const;
|
||||
int get_tile_width() const;
|
||||
|
||||
bool draw_from_id_string(std::string id, int x, int y, int subtile, int rota);
|
||||
bool draw_from_id_string(std::string id, TILE_CATEGORY category,
|
||||
const std::string &subcategory, int x, int y, int subtile, int rota);
|
||||
bool draw_from_id_string(std::string id, int x, int y, int subtile, int rota, bool is_at_screen_position = false);
|
||||
bool draw_tile_at(tile_type *tile, int x, int y, int rota);
|
||||
|
||||
/**
|
||||
* Redraws all the tiles that have changed since the last frame.
|
||||
*/
|
||||
void clear_buffer();
|
||||
void apply_changes();
|
||||
|
||||
/** Surface/Sprite rotation specifics */
|
||||
SDL_Surface *create_tile_surface();
|
||||
|
||||
SDL_Surface *rotate_tile(SDL_Surface *src, SDL_Rect *rect, int rota);
|
||||
void put_pixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
|
||||
Uint32 get_pixel(SDL_Surface *surface, int x, int y);
|
||||
/* Tile Picking */
|
||||
void get_tile_values(const int t, const int *tn, int &subtile, int &rotation);
|
||||
void get_wall_values(const int x, const int y, const long vertical_wall_symbol,
|
||||
const long horizontal_wall_symbol, int &subtile, int &rotation);
|
||||
|
||||
void get_wall_values(const int x, const int y, const long vertical_wall_symbol, const long horizontal_wall_symbol, int &subtile, int &rotation);
|
||||
void get_terrain_orientation(int x, int y, int &rota, int &subtype);
|
||||
|
||||
void get_rotation_and_subtile(const char val, const int num_connects, int &rota, int &subtype);
|
||||
|
||||
/** Drawing Layers */
|
||||
@@ -229,75 +174,75 @@ class cata_tiles
|
||||
bool draw_furniture(int x, int y);
|
||||
bool draw_trap(int x, int y);
|
||||
bool draw_field_or_item(int x, int y);
|
||||
bool draw_item(int x, int y);
|
||||
bool draw_vpart(int x, int y);
|
||||
bool draw_entity( const Creature &critter, int x, int y );
|
||||
void draw_entity_with_overlays( const player &p, int x, int y );
|
||||
bool draw_entity(int x, int y);
|
||||
|
||||
bool draw_item_highlight(int x, int y);
|
||||
|
||||
public:
|
||||
// Animation layers
|
||||
bool draw_hit(int x, int y);
|
||||
|
||||
void init_explosion(int x, int y, int radius);
|
||||
void draw_explosion_frame();
|
||||
void draw_explosion_frame(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_explosion();
|
||||
|
||||
void init_draw_bullet(int x, int y, std::string name);
|
||||
void draw_bullet_frame();
|
||||
void draw_bullet_frame(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_bullet();
|
||||
|
||||
void init_draw_hit(int x, int y, std::string name);
|
||||
void draw_hit_frame();
|
||||
void draw_hit_frame(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_hit();
|
||||
|
||||
void draw_footsteps_frame();
|
||||
void init_draw_footsteps(std::queue<point> steps);
|
||||
void draw_footsteps_frame(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_footsteps();
|
||||
|
||||
// pseudo-animated layer, not really though.
|
||||
void init_draw_line(int x, int y, std::vector<point> trajectory, std::string line_end_name, bool target_line);
|
||||
void draw_line();
|
||||
void draw_line(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_line();
|
||||
|
||||
void init_draw_weather(weather_printable weather, std::string name);
|
||||
void draw_weather_frame();
|
||||
void draw_weather_frame(int destx, int desty, int centerx, int centery, int width, int height);
|
||||
void void_weather();
|
||||
|
||||
void init_draw_sct();
|
||||
void draw_sct_frame();
|
||||
void void_sct();
|
||||
|
||||
void init_draw_zones(const point &p_pointStart, const point &p_pointEnd, const point &p_pointOffset);
|
||||
void draw_zones_frame();
|
||||
void void_zones();
|
||||
|
||||
/** Overmap Layer : Not used for now, do later*/
|
||||
bool draw_omap();
|
||||
|
||||
public:
|
||||
/* initialize from an outside file, throws std::string on errors. */
|
||||
void init(std::string load_file_path);
|
||||
/* Reinitializes the tile context using the original screen information, throws std::string on errors */
|
||||
/**
|
||||
* Scroll the map widget by (x, y)
|
||||
*
|
||||
* scroll(1, 1) would move the view one to the right and one down.
|
||||
*
|
||||
* Useful for keeping part of the previous "frame" and redrawing
|
||||
* only what changed.
|
||||
*/
|
||||
void scroll(int x, int y);
|
||||
|
||||
/** Used to properly initialize everything for display */
|
||||
void init(SDL_Surface *screen, std::string json_path, std::string tileset_path);
|
||||
/* initialize from an outside file */
|
||||
void init(SDL_Surface *screen, std::string load_file_path);
|
||||
/* Reinitializes the tile context using the original screen information */
|
||||
void reinit(std::string load_file_path);
|
||||
int get_tile_height() const { return tile_height; }
|
||||
int get_tile_width() const { return tile_width; }
|
||||
float get_tile_ratiox() const { return tile_ratiox; }
|
||||
float get_tile_ratioy() const { return tile_ratioy; }
|
||||
protected:
|
||||
void get_tile_information(std::string dir_path, std::string &json_path, std::string &tileset_path);
|
||||
/** Lighting */
|
||||
void init_light();
|
||||
LIGHTING light_at(int x, int y);
|
||||
|
||||
/** Variables */
|
||||
SDL_Renderer *renderer;
|
||||
tile_map tile_values;
|
||||
tile_id_map tile_ids;
|
||||
SDL_Surface *buffer, *tile_atlas, *display_screen;
|
||||
tile_map *tile_values;
|
||||
tile_id_map *tile_ids;
|
||||
|
||||
int tile_height, tile_width, default_tile_width, default_tile_height;
|
||||
// The width and height of the area we can draw in,
|
||||
// measured in map coordinates, *not* in pixels.
|
||||
std::map<int, std::vector<SDL_Surface*> > rotation_cache;
|
||||
|
||||
int tile_height, tile_width;
|
||||
int screentile_width, screentile_height;
|
||||
float tile_ratiox, tile_ratioy;
|
||||
tile *screen_tiles;
|
||||
int num_tiles;
|
||||
|
||||
bool in_animation;
|
||||
|
||||
@@ -306,8 +251,7 @@ class cata_tiles
|
||||
bool do_draw_hit;
|
||||
bool do_draw_line;
|
||||
bool do_draw_weather;
|
||||
bool do_draw_sct;
|
||||
bool do_draw_zones;
|
||||
bool do_draw_footsteps;
|
||||
|
||||
int exp_pos_x, exp_pos_y, exp_rad;
|
||||
|
||||
@@ -325,18 +269,15 @@ class cata_tiles
|
||||
weather_printable anim_weather;
|
||||
std::string weather_name;
|
||||
|
||||
point pStartZone;
|
||||
point pEndZone;
|
||||
point pZoneOffset;
|
||||
std::queue<point> footsteps;
|
||||
std::map<point, tile_drawing_cache> cache;
|
||||
std::map<point, tile_drawing_cache> tiles_to_draw_this_frame;
|
||||
|
||||
// offset values, in tile coordinates, not pixels
|
||||
// offset values
|
||||
int o_x, o_y;
|
||||
// offset for drawing, in pixels.
|
||||
int op_x, op_y;
|
||||
|
||||
protected:
|
||||
private:
|
||||
void create_default_item_highlight();
|
||||
int
|
||||
sightrange_natural,
|
||||
sightrange_light,
|
||||
@@ -353,4 +294,4 @@ class cata_tiles
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CATA_TILES_H
|
||||
+359
@@ -0,0 +1,359 @@
|
||||
#include "catacharset.h"
|
||||
#include <string.h>
|
||||
#include "debug.h"
|
||||
#include "wcwidth.c"
|
||||
|
||||
//copied from SDL2_ttf code
|
||||
unsigned UTF8_getch(const char **src, int *srclen)
|
||||
{
|
||||
const unsigned char *p = *(const unsigned char**)src;
|
||||
int left = 0;
|
||||
bool overlong = false;
|
||||
bool underflow = false;
|
||||
unsigned ch = UNKNOWN_UNICODE;
|
||||
|
||||
if (*srclen == 0) {
|
||||
return UNKNOWN_UNICODE;
|
||||
}
|
||||
if (p[0] >= 0xFC) {
|
||||
if ((p[0] & 0xFE) == 0xFC) {
|
||||
if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) {
|
||||
overlong = true;
|
||||
}
|
||||
ch = (unsigned) (p[0] & 0x01);
|
||||
left = 5;
|
||||
}
|
||||
} else if (p[0] >= 0xF8) {
|
||||
if ((p[0] & 0xFC) == 0xF8) {
|
||||
if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) {
|
||||
overlong = true;
|
||||
}
|
||||
ch = (unsigned) (p[0] & 0x03);
|
||||
left = 4;
|
||||
}
|
||||
} else if (p[0] >= 0xF0) {
|
||||
if ((p[0] & 0xF8) == 0xF0) {
|
||||
if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) {
|
||||
overlong = true;
|
||||
}
|
||||
ch = (unsigned) (p[0] & 0x07);
|
||||
left = 3;
|
||||
}
|
||||
} else if (p[0] >= 0xE0) {
|
||||
if ((p[0] & 0xF0) == 0xE0) {
|
||||
if (p[0] == 0xE0 && (p[1] & 0xE0) == 0x80) {
|
||||
overlong = true;
|
||||
}
|
||||
ch = (unsigned) (p[0] & 0x0F);
|
||||
left = 2;
|
||||
}
|
||||
} else if (p[0] >= 0xC0) {
|
||||
if ((p[0] & 0xE0) == 0xC0) {
|
||||
if ((p[0] & 0xDE) == 0xC0) {
|
||||
overlong = true;
|
||||
}
|
||||
ch = (unsigned) (p[0] & 0x1F);
|
||||
left = 1;
|
||||
}
|
||||
} else {
|
||||
if ((p[0] & 0x80) == 0x00) {
|
||||
ch = (unsigned) p[0];
|
||||
}
|
||||
}
|
||||
++*src;
|
||||
--*srclen;
|
||||
while (left > 0 && *srclen > 0) {
|
||||
++p;
|
||||
if ((p[0] & 0xC0) != 0x80) {
|
||||
ch = UNKNOWN_UNICODE;
|
||||
break;
|
||||
}
|
||||
ch <<= 6;
|
||||
ch |= (p[0] & 0x3F);
|
||||
++*src;
|
||||
--*srclen;
|
||||
--left;
|
||||
}
|
||||
if (left > 0) {
|
||||
underflow = true;
|
||||
}
|
||||
if (overlong || underflow ||
|
||||
(ch >= 0xD800 && ch <= 0xDFFF) ||
|
||||
(ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
|
||||
ch = UNKNOWN_UNICODE;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
std::string utf32_to_utf8(unsigned ch) {
|
||||
char out[5];
|
||||
char* buf = out;
|
||||
static const unsigned char utf8FirstByte[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
int utf8Bytes;
|
||||
if (ch < 0x80) {
|
||||
utf8Bytes = 1;
|
||||
} else if (ch < 0x800) {
|
||||
utf8Bytes = 2;
|
||||
} else if (ch < 0x10000) {
|
||||
utf8Bytes = 3;
|
||||
} else if (ch <= 0x10FFFF) {
|
||||
utf8Bytes = 4;
|
||||
} else {
|
||||
utf8Bytes = 3;
|
||||
ch = UNKNOWN_UNICODE;
|
||||
}
|
||||
|
||||
buf += utf8Bytes;
|
||||
switch (utf8Bytes) {
|
||||
case 4:
|
||||
*--buf = (ch|0x80)&0xBF;
|
||||
ch >>= 6;
|
||||
case 3:
|
||||
*--buf = (ch|0x80)&0xBF;
|
||||
ch >>= 6;
|
||||
case 2:
|
||||
*--buf = (ch|0x80)&0xBF;
|
||||
ch >>= 6;
|
||||
case 1:
|
||||
*--buf = ch|utf8FirstByte[utf8Bytes];
|
||||
}
|
||||
out[utf8Bytes] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
//Calculate width of a unicode string
|
||||
//Latin characters have a width of 1
|
||||
//CJK characters have a width of 2, etc
|
||||
int utf8_width(const char* s)
|
||||
{
|
||||
int len = strlen(s);
|
||||
const char* ptr = s;
|
||||
int w = 0;
|
||||
while(len>0)
|
||||
{
|
||||
unsigned ch = UTF8_getch(&ptr, &len);
|
||||
if(ch!=UNKNOWN_UNICODE) {
|
||||
w += mk_wcwidth(ch);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
//Convert cursor position to byte offset
|
||||
//returns the first character position in bytes behind the cursor position.
|
||||
//If the cursor is not on the first half of the character,
|
||||
//prevpos (which points to the first byte of the cursor located char)
|
||||
// should be a different value.
|
||||
int cursorx_to_position(const char* line, int cursorx, int* prevpos)
|
||||
{
|
||||
int dummy;
|
||||
int i=0, c=0, *p=prevpos?prevpos:&dummy;
|
||||
*p = 0;
|
||||
while(c<cursorx)
|
||||
{
|
||||
const char* utf8str = line+i;
|
||||
int len = ANY_LENGTH;
|
||||
unsigned ch = UTF8_getch(&utf8str, &len);
|
||||
int cw = mk_wcwidth(ch);
|
||||
len = ANY_LENGTH-len;
|
||||
|
||||
if(len<=0) len=1;
|
||||
i+=len;
|
||||
if(cw<=0) cw=1;
|
||||
c+=cw;
|
||||
if(c<=cursorx) *p = i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
//Erase character by unicode char width.
|
||||
//Fill the characters with spaces.
|
||||
//returns length modified
|
||||
int erease_utf8_by_cw( char* t, int cw, int clen, int maxlen)
|
||||
{
|
||||
static char buf[8000]; //LOL
|
||||
int c=0,i=0;
|
||||
while(c<cw)
|
||||
{
|
||||
const char* utf8str = t+i;
|
||||
int len = ANY_LENGTH;
|
||||
unsigned ch = UTF8_getch(&utf8str, &len);
|
||||
int cw = mk_wcwidth(ch);
|
||||
len = ANY_LENGTH-len;
|
||||
|
||||
if(len<=0) len=1;
|
||||
i+=len;
|
||||
if(cw<=0) cw=1;
|
||||
c+=cw;
|
||||
}
|
||||
if(cw==c && clen==i)
|
||||
{
|
||||
memset(t, ' ', clen);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int filled = clen+c-cw;
|
||||
memcpy(buf, t+i, maxlen-i);
|
||||
memset(t, ' ', filled);
|
||||
memcpy(t+filled, buf, maxlen-filled);
|
||||
return filled-i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//cut ut8 string by character size
|
||||
//utf8_substr("正正正正", 1, 4) returns
|
||||
// " 正 "
|
||||
// Broken characters will be filled with space
|
||||
std::string utf8_substr(std::string s, int start, int size)
|
||||
{
|
||||
static char buf[8000];
|
||||
int len = strlen(s.c_str());
|
||||
int pos;
|
||||
strcpy(buf, s.c_str());
|
||||
int begin = cursorx_to_position(buf, start, &pos);
|
||||
if(begin!=pos)
|
||||
{
|
||||
const char* ts = buf+pos;
|
||||
int l = ANY_LENGTH;
|
||||
unsigned tc = UTF8_getch(&ts, &l);
|
||||
int tw = mk_wcwidth(tc);
|
||||
erease_utf8_by_cw(buf+pos, tw, tw, len-pos-1);
|
||||
}
|
||||
|
||||
if(size>0)
|
||||
{
|
||||
int end = cursorx_to_position(buf, start+size-1, &pos);
|
||||
if(end!=pos)
|
||||
{
|
||||
const char* ts = buf+pos;
|
||||
int l = ANY_LENGTH;
|
||||
unsigned tc = UTF8_getch(&ts, &l);
|
||||
int tw = mk_wcwidth(tc);
|
||||
erease_utf8_by_cw(buf+pos, tw, tw, len-pos-1);
|
||||
end = pos+tw-1;
|
||||
}
|
||||
buf[end+1] = '\0';
|
||||
}
|
||||
|
||||
return std::string(buf+start);
|
||||
}
|
||||
|
||||
static const char base64_encoding_table[] =
|
||||
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9', '+', '-'};
|
||||
|
||||
static char base64_decoding_table[256];
|
||||
static const int mod_table[] = {0, 2, 1};
|
||||
|
||||
static void build_base64_decoding_table() {
|
||||
static bool built = false;
|
||||
if(!built) {
|
||||
for (int i = 0; i < 64; i++) {
|
||||
base64_decoding_table[(unsigned char) base64_encoding_table[i]] = i;
|
||||
}
|
||||
built = true;
|
||||
}
|
||||
}
|
||||
|
||||
std::string base64_encode(std::string str) {
|
||||
//assume it is already encoded
|
||||
if(str.length()>0 && str[0]=='#') {
|
||||
return str;
|
||||
}
|
||||
|
||||
int input_length = str.length();
|
||||
int output_length = 4 * ((input_length + 2) / 3);
|
||||
|
||||
char *encoded_data = new char[output_length+1];
|
||||
const unsigned char* data = (const unsigned char*)str.c_str();
|
||||
|
||||
for (int i = 0, j = 0; i < input_length;) {
|
||||
|
||||
unsigned octet_a = i < input_length ? data[i++] : 0;
|
||||
unsigned octet_b = i < input_length ? data[i++] : 0;
|
||||
unsigned octet_c = i < input_length ? data[i++] : 0;
|
||||
|
||||
unsigned triple = (octet_a << 0x10) + (octet_b << 0x08) + octet_c;
|
||||
|
||||
encoded_data[j++] = base64_encoding_table[(triple >> 3 * 6) & 0x3F];
|
||||
encoded_data[j++] = base64_encoding_table[(triple >> 2 * 6) & 0x3F];
|
||||
encoded_data[j++] = base64_encoding_table[(triple >> 1 * 6) & 0x3F];
|
||||
encoded_data[j++] = base64_encoding_table[(triple >> 0 * 6) & 0x3F];
|
||||
}
|
||||
|
||||
for (int i = 0; i < mod_table[input_length % 3]; i++)
|
||||
encoded_data[output_length - 1 - i] = '=';
|
||||
|
||||
encoded_data[output_length] = '\0';
|
||||
std::string ret = "#";
|
||||
ret += encoded_data;
|
||||
delete[] encoded_data;
|
||||
|
||||
//DebugLog()<<"base64 encoded: \n"<<str<<"\n"<<ret<<"\n";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
std::string base64_decode(std::string str) {
|
||||
// do not decode if it is not base64
|
||||
if(str.length()==0 || str[0]!='#') {
|
||||
return str;
|
||||
}
|
||||
|
||||
build_base64_decoding_table();
|
||||
|
||||
std::string instr = str.substr(1);
|
||||
|
||||
int input_length = instr.length();
|
||||
|
||||
if (input_length % 4 != 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
int output_length = input_length / 4 * 3;
|
||||
const char* data = (const char*)instr.c_str();
|
||||
|
||||
if (data[input_length - 1] == '=') output_length--;
|
||||
if (data[input_length - 2] == '=') output_length--;
|
||||
|
||||
unsigned char *decoded_data = new unsigned char[output_length+1];
|
||||
|
||||
for (int i = 0, j = 0; i < input_length;) {
|
||||
|
||||
unsigned sextet_a = data[i] == '=' ? 0 & i++ : base64_decoding_table[(unsigned char)data[i++]];
|
||||
unsigned sextet_b = data[i] == '=' ? 0 & i++ : base64_decoding_table[(unsigned char)data[i++]];
|
||||
unsigned sextet_c = data[i] == '=' ? 0 & i++ : base64_decoding_table[(unsigned char)data[i++]];
|
||||
unsigned sextet_d = data[i] == '=' ? 0 & i++ : base64_decoding_table[(unsigned char)data[i++]];
|
||||
|
||||
unsigned triple = (sextet_a << 3 * 6)
|
||||
+ (sextet_b << 2 * 6)
|
||||
+ (sextet_c << 1 * 6)
|
||||
+ (sextet_d << 0 * 6);
|
||||
|
||||
if (j < output_length) decoded_data[j++] = (triple >> 2 * 8) & 0xFF;
|
||||
if (j < output_length) decoded_data[j++] = (triple >> 1 * 8) & 0xFF;
|
||||
if (j < output_length) decoded_data[j++] = (triple >> 0 * 8) & 0xFF;
|
||||
}
|
||||
|
||||
decoded_data[output_length] = 0;
|
||||
|
||||
std::string ret = (char*)decoded_data;
|
||||
delete[] decoded_data;
|
||||
|
||||
//DebugLog()<<"base64 decoded: \n"<<str<<"\n"<<ret<<"\n";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef CATACHARSET_H
|
||||
#define CATACHARSET_H
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#define ANY_LENGTH 5
|
||||
#define UNKNOWN_UNICODE 0xFFFD
|
||||
|
||||
// get a unicode character from a utf8 string
|
||||
unsigned UTF8_getch(const char **src, int *srclen);
|
||||
// from wcwidth.c, return "cell" width of a unicode char
|
||||
int mk_wcwidth(uint32_t ucs);
|
||||
// convert cursorx value to byte position
|
||||
int cursorx_to_position(const char* line, int cursorx, int* prevppos=NULL);
|
||||
//erease for characters insertion
|
||||
int erease_utf8_by_cw( char* t, int cw, int len, int maxlen);
|
||||
int utf8_width(const char* s);
|
||||
std::string utf8_substr(std::string s, int start, int size=-1);
|
||||
std::string utf32_to_utf8(unsigned ch);
|
||||
|
||||
std::string base64_encode(std::string str);
|
||||
std::string base64_decode(std::string str);
|
||||
#endif
|
||||
+2
-36
@@ -1,37 +1,3 @@
|
||||
#!/bin/sh
|
||||
TARGET_FILE=$0
|
||||
|
||||
cd `dirname $TARGET_FILE`
|
||||
TARGET_FILE=`basename $TARGET_FILE`
|
||||
|
||||
# Iterate down a (possible) chain of symlinks
|
||||
while [ -L $TARGET_FILE ]
|
||||
do
|
||||
TARGET_FILE=`readlink $TARGET_FILE`
|
||||
cd `dirname $TARGET_FILE`
|
||||
TARGET_FILE=`basename $TARGET_FILE`
|
||||
done
|
||||
|
||||
# Find the physical path and name of target file.
|
||||
DIR=`pwd -P`
|
||||
BIN=$(basename $0)
|
||||
|
||||
cd $DIR || exit $?
|
||||
|
||||
# If name does not match a binary or is this same script, find the right one
|
||||
if [ ! -f $BIN ] || [ $BIN = "cataclysm-launcher" ]
|
||||
then
|
||||
BIN=
|
||||
for bin in cataclysm-tiles cataclysm
|
||||
do
|
||||
[ -f $bin ] && BIN=$bin && break
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $BIN ]
|
||||
then
|
||||
exec ./$BIN
|
||||
else
|
||||
echo "Couldn't find cataclysm game binary in $DIR/"
|
||||
exit 1
|
||||
fi
|
||||
DIR=`dirname "$0"`
|
||||
cd $DIR && ./cataclysm
|
||||
|
||||
@@ -1,22 +1,46 @@
|
||||
#ifndef CATACURSE_H
|
||||
#define CATACURSE_H
|
||||
|
||||
#ifndef __CATACURSE__
|
||||
#define __CATACURSE__
|
||||
#if (defined _WIN32 || defined WINDOWS)
|
||||
# include "platform_win.h"
|
||||
# include "mmsystem.h"
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
//#define VC_EXTRALEAN
|
||||
#include "windows.h"
|
||||
#include "mmsystem.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include "json.h"
|
||||
|
||||
#include "input_defs.h"
|
||||
|
||||
typedef int chtype;
|
||||
typedef unsigned short attr_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
|
||||
// TODO: remove unused stuff
|
||||
|
||||
#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 {
|
||||
typedef struct
|
||||
{
|
||||
int FG;//foreground index in colors[]
|
||||
int BG;//foreground index in colors[]
|
||||
} pairs;
|
||||
@@ -30,57 +54,43 @@ typedef struct {
|
||||
//} cursechar;
|
||||
|
||||
//Individual lines, so that we can track changed lines
|
||||
struct cursecell {
|
||||
std::string ch;
|
||||
char FG;
|
||||
char BG;
|
||||
cursecell(std::string ch) : ch(ch), FG(0), BG(0) { }
|
||||
cursecell() : cursecell(" ") { }
|
||||
|
||||
bool operator==(const cursecell &b) const {
|
||||
return ch == b.ch && FG == b.FG && BG == b.BG;
|
||||
}
|
||||
|
||||
cursecell& operator=(const cursecell &b) {
|
||||
ch = b.ch;
|
||||
FG = b.FG;
|
||||
BG = b.BG;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
struct curseline {
|
||||
bool touched;
|
||||
std::vector<cursecell> chars;
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
bool touched;
|
||||
char *chars;
|
||||
int width_in_bytes;
|
||||
char *FG;
|
||||
char *BG;
|
||||
//cursechar chars [80];
|
||||
} curseline;
|
||||
//The curses window struct
|
||||
struct WINDOW {
|
||||
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
|
||||
std::vector<curseline> line;
|
||||
};
|
||||
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;
|
||||
|
||||
#define A_NORMAL 0x00000000 /* Added characters are normal. <---------not used */
|
||||
#define A_STANDOUT 0x00000100 /* Added characters are standout. <---------not used */
|
||||
#define A_UNDERLINE 0x00000200 /* Added characters are underscored. <---------not used */
|
||||
#define A_REVERSE 0x00000400 /* Added characters are reverse <---------not used */
|
||||
#define A_BLINK 0x00000800 /* Added characters are blinking. */
|
||||
#define A_DIM 0x00001000 /* Added characters are dim. <---------not used */
|
||||
#define A_BOLD 0x00002000 /* Added characters are bold. */
|
||||
#define A_BLANK 0x00004000 /* Added characters are blanked. <---------not used */
|
||||
#define A_PROTECT 0x00008000 /* Added characters are protected. <---------not used */
|
||||
#define A_ALTCHARSET 0x00010000 /* Added characters are ACS <---------not used */
|
||||
#define A_ATTRIBUTES 0x03ffff00 /* All 8-bit attribute bits <---------not used */
|
||||
#define A_CHARTEXT 0x000000ff /* bits for 8-bit characters <---------not used */
|
||||
#define A_COLOR 0x03fe0000 /* Color bits */
|
||||
} 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}
|
||||
@@ -91,7 +101,7 @@ struct WINDOW {
|
||||
#define COLOR_CYAN 0x06 //RGB{0, 170, 200}
|
||||
#define COLOR_WHITE 0x07 //RGB{196, 196, 196}
|
||||
|
||||
#define COLOR_PAIR(n) ((static_cast<std::uint32_t>(n) << 17) & A_COLOR)
|
||||
#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
|
||||
@@ -102,16 +112,10 @@ struct WINDOW {
|
||||
#define KEY_RIGHT 0x105 /* right arrow*/
|
||||
#define KEY_HOME 0x106 /* home key */ //<---------not used
|
||||
#define KEY_BACKSPACE 0x107 /* Backspace */ //<---------not used
|
||||
#define KEY_DC 0x151 /* Delete Character */
|
||||
#define KEY_F(n) (0x108+n) /* F1, F2, etc*/
|
||||
#define KEY_NPAGE 0x152 /* page down */
|
||||
#define KEY_PPAGE 0x153 /* page up */
|
||||
#define KEY_ENTER 0x157 /* enter */
|
||||
#define KEY_BTAB 0x161 /* back-tab = shift + tab */
|
||||
#define KEY_END 0x168 /* End */
|
||||
|
||||
#define ERR (-1) // Error return.
|
||||
#define OK (0) // Success return.
|
||||
|
||||
/* Curses external declarations. */
|
||||
|
||||
@@ -120,10 +124,11 @@ extern WINDOW *stdscr;
|
||||
#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 wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br);
|
||||
|
||||
int hline(chtype ch, int n);
|
||||
int vline(chtype ch, int n);
|
||||
@@ -137,9 +142,9 @@ int mvwvline(WINDOW *win, int y, int x, chtype ch, int n);
|
||||
int wrefresh(WINDOW *win);
|
||||
int refresh(void);
|
||||
int getch(void);
|
||||
int wgetch(WINDOW *win);
|
||||
int wgetch(WINDOW* win);
|
||||
int mvgetch(int y, int x);
|
||||
int mvwgetch(WINDOW *win, int y, int x);
|
||||
int mvwgetch(WINDOW* win, int y, int x);
|
||||
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
|
||||
int mvprintw(int y, int x, const char *fmt, ...);
|
||||
int werase(WINDOW *win);
|
||||
@@ -164,7 +169,7 @@ 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 printw(const char *fmt,...);
|
||||
int getmaxx(WINDOW *win);
|
||||
int getmaxy(WINDOW *win);
|
||||
int getbegx(WINDOW *win);
|
||||
@@ -177,26 +182,18 @@ void set_escdelay(int delay);//PORTABILITY, DUMMY FUNCTION
|
||||
int echo(void);
|
||||
int noecho(void);
|
||||
//non-curses functions, Do not call these in the main game code
|
||||
extern WINDOW *mainwin;
|
||||
extern WINDOW* mainwin;
|
||||
extern pairs *colorpairs;
|
||||
// key is a color name from main_color_names,
|
||||
// value is a color in *BGR*. each vector has exactly 3 values.
|
||||
// see load_colors(Json...)
|
||||
extern std::map< std::string, std::vector<int> > consolecolors;
|
||||
// color names as read from the json file
|
||||
extern std::array<std::string, 16> main_color_names;
|
||||
WINDOW *curses_init();
|
||||
extern std::map< std::string,std::vector<int> > consolecolors;
|
||||
WINDOW* curses_init();
|
||||
int curses_destroy();
|
||||
void curses_drawwindow(WINDOW *win);
|
||||
void curses_drawwindow(WINDOW* win);
|
||||
void curses_delay(int delay);
|
||||
void curses_timeout(int t);
|
||||
int curses_getch(WINDOW *win);
|
||||
int curses_getch(WINDOW* win);
|
||||
input_event getch_kyb_mouse(WINDOW* capture_win = NULL);
|
||||
int curses_start_color();
|
||||
|
||||
// Add interface specific (SDL/ncurses/wincurses) initializations here
|
||||
void init_interface();
|
||||
|
||||
int projected_window_width(int column_count);
|
||||
int projected_window_height(int row_count);
|
||||
|
||||
#ifdef SDLTILES
|
||||
void init_tiles();
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "char_validity_check.h"
|
||||
|
||||
/**
|
||||
* Returns whether or not the given (ASCII) character is usable.
|
||||
* Called to check player name validity and world name validity.
|
||||
* Only printable symbols not reserved by the filesystem are
|
||||
* permitted.
|
||||
* @param ch The char to check.
|
||||
* @return true if the char is allowed in a name, false if not.
|
||||
*/
|
||||
bool is_char_allowed(char ch) {
|
||||
|
||||
//Allow everything EXCEPT the following reserved characters:
|
||||
return (ch > 31 //0-31 are control characters
|
||||
&& ch < 127 //DEL character
|
||||
&& ch != '/' && ch != '\\' //Path separators
|
||||
&& ch != '?' && ch != '*' && ch != '%' //Wildcards
|
||||
&& ch != ':' //Mount point/drive marker
|
||||
&& ch != '|' //Output pipe
|
||||
&& ch != '"' //Filename (with spaces) marker
|
||||
&& ch != '>' && ch != '<'); //Input/output redirection
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef _CHAR_VALIDITY_CHECK_H
|
||||
#define _CHAR_VALIDITY_CHECK_H
|
||||
|
||||
bool is_char_allowed(char ch);
|
||||
|
||||
#endif // _CHAR_VALIDITY_CHECK_H
|
||||
@@ -0,0 +1,8 @@
|
||||
Current policy is to update code to the standard style when changing a
|
||||
substantial portion of it. Blocks of code can be passed through astyle
|
||||
to ensure that their formatting is correct:
|
||||
|
||||
astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
|
||||
|
||||
For example, from vi, set marks a and b around the block, then:
|
||||
:'a,'b ! astyle --style=1tbs --indent-spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
|
||||
@@ -1,29 +1,27 @@
|
||||
#ADDING STUFF
|
||||
##Adding a monster
|
||||
1. Edit data/json/monsters.json or create a new json file and insert the
|
||||
definition of your new monster there (probably copy an existing entry).
|
||||
2. Make sure the id value is unique among all other monster types.
|
||||
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 monstergroups.json. Find the appropriate
|
||||
array, and insert the identifier for your monster (e.g, mon_zombie).
|
||||
Cost_multiplier, makes it more expensive to spawn. The higher the cost, the
|
||||
more 'slots' it takes up, and freq is how frequent they spawn.
|
||||
See mongroupdef.cpp
|
||||
4. If you want your monster to drop items, edit monster_drops.json. Make a new
|
||||
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; edit
|
||||
monstergenerator.cpp and add the translation, 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.
|
||||
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.
|
||||
6. Just like attacks, some monsters may have a special function called when
|
||||
they die. This works the same as attacks, but the relevant files are
|
||||
they die. This works the same as attacks, but the relevent files are
|
||||
mondeath.h and mondeath.cpp.
|
||||
7. If you add flags, document them in JSON_FLAGS.md, and mtype.h. Please. Or
|
||||
we will replace your blood with acid in the night.
|
||||
|
||||
##Adding structures to the map
|
||||
Most "regular" buildings are spawned in cities (large clusters of buildings which are located rather close to each other).
|
||||
@@ -53,11 +51,10 @@ These structures are also commented in source code. Add new identifier in enum o
|
||||
The comments given in source code to `structure struct overmap_special` explain the meaning of these constants in the example above.
|
||||
|
||||
##Adding a bionic
|
||||
1. Edit data/json/bionics.json and add your bionic near similar types. See JSON_INFO for a more in-depth review of the individual fields.
|
||||
2. If you want the bionic to be available in the gameworld as an item, add it to item_groups.json, and add a bionic item to data/json/items/bionics.json
|
||||
3. Manually code in effects into the appropriate files, for activated bionics edit the player::activate_bionic function in bionics.cpp.
|
||||
4. For bionic ranged weapons add the bionic weapon counterparts to ranged.json, give them the NO_AMMO and BIO_WEAPON flags.
|
||||
5. For bionic close combat weapons add the bionic weapon to data/json/items/melee.json give them NON_STUCK", "NO_UNWIELD" at least.
|
||||
1. Edit data/raw/bionics.json and add your bionic near similar types. See JSON_INFO for a more in-depth review of the individual fields.
|
||||
2. If you want the bionic to be available in the gameworld as an item, add it to item_groups.json
|
||||
3. Manually code in effects into the appropriate files
|
||||
|
||||
|
||||
##How armour protection is calculated
|
||||
1. When the player is hit at a specific body part, armour coverage determines whether the armour is hit, or an uncovered part of the player is hit (roll 1d100 against coverage)
|
||||
@@ -68,11 +65,6 @@ These structures are also commented in source code. Add new identifier in enum o
|
||||
6. If the armour is made from 2 materials types, then it takes a weighted average of the primary material (66%) and secondary material (33%).
|
||||
7. Materials resistance factors are given relative to PAPER as a material (this probably needs some fine-tuning for balance).
|
||||
|
||||
##Adding an iuse function.
|
||||
1. Add the new item use code to iuse.cpp and iuse.h
|
||||
2. Add the new json_flag to your item. And link it to the iuse function in item_factory.cpp
|
||||
3. Document the new flag in JSON_FLAGS.md
|
||||
|
||||
##Acid resistance
|
||||
This determines how items react to acid fields. Item acid resistances are a weighted
|
||||
average of the materials acid resistance (see item::acid_resist).
|
||||
@@ -86,12 +78,8 @@ Acid resistance values are in materials.json, and defined as such:
|
||||
2 - very resistant to acid
|
||||
3 - complete acid resistance
|
||||
|
||||
|
||||
#FAQ
|
||||
|
||||
**Q: How do I prevent an item from showing up in NPC inventory?
|
||||
|
||||
A: Add the ID of the item to the trader_avoid list in item_groups.json.
|
||||
|
||||
**Q: What the heck is up with the map objects?**
|
||||
|
||||
A: The pertinent map objects are submap, mapbuffer, map, and overmap.
|
||||
@@ -23,7 +23,6 @@ Format: File with definition : Name of enum
|
||||
* debug.h : DebugClass
|
||||
* dialogue.h : talk_trial
|
||||
* disease.cpp : dis_type_enum
|
||||
* effect.h : effect_rating
|
||||
* enums.h : phase_id
|
||||
* enums.h : damage_type
|
||||
* event.h : event_type
|
||||
@@ -45,7 +44,6 @@ Format: File with definition : Name of enum
|
||||
* gamemode.h : caravan_category
|
||||
* input.h : InputEvent
|
||||
* item.h : hint_rating
|
||||
* item.h : layer_level
|
||||
* itype.h : item_cat
|
||||
* itype.h : software_type
|
||||
* itype.h : technique_id
|
||||
@@ -57,7 +55,6 @@ Format: File with definition : Name of enum
|
||||
* mapdata.h : furn_id
|
||||
* mapdata.h : map_extra
|
||||
* mapgen.cpp : room_type
|
||||
* messages.h : game_message_type
|
||||
* mission.h : talk_topic
|
||||
* mission.h : mission_id
|
||||
* mission.h : mission_origin
|
||||
@@ -65,9 +62,12 @@ Format: File with definition : Name of enum
|
||||
* monster.h : monster_effect_type
|
||||
* monster.h : monster_attitude
|
||||
* morale.h : morale_type
|
||||
* mtype.h : monster_species
|
||||
* mtype.h : mon_id
|
||||
* mtype.h : m_size
|
||||
* mtype.h : monster_trigger
|
||||
* mtype.h : m_flag
|
||||
* mtype.h : m_category
|
||||
* npc.h : npc_attitude
|
||||
* npc.h : npc_mission
|
||||
* npc.h : npc_class
|
||||
@@ -77,6 +77,9 @@ Format: File with definition : Name of enum
|
||||
* npc.h : npc_favor_type
|
||||
* npc.h : combat_engagement
|
||||
* npc.h : talk_topic
|
||||
* omdata.h : oter_id
|
||||
* omdata.h : omspec_flag
|
||||
* omdata.h : omspec_id
|
||||
* omdata.h : overmap_zone
|
||||
* overmpa.h : radio_type
|
||||
* pldata.h : character_type
|
||||
@@ -84,6 +87,7 @@ Format: File with definition : Name of enum
|
||||
* pldata.h : activity_type
|
||||
* pldata.h : pl_flag
|
||||
* pldata.h : hp_part
|
||||
* trap.h : trap_id
|
||||
* veh_interact.h : sel_types
|
||||
* vehicle.cpp : vehicle_controls
|
||||
* vehicle.h : veh_coll_type
|
||||
@@ -0,0 +1,34 @@
|
||||
Stat system scaling:
|
||||
Minimum stat: 0 (should only happen due to penalties, instant failure in most scenarios)
|
||||
Nominal stat: 8 ("average" person)
|
||||
Very high stat: ? (realistic world class human)
|
||||
Maximal stat: 20 (higher may be achievable, but we're not worried about balancing at that point.)
|
||||
|
||||
Skill system scaling:
|
||||
Minimum skill: 0 (no training)
|
||||
Maximum skill: 10 (requires regular training to maintain, "professional" level)
|
||||
|
||||
Monster melee skill scaling:
|
||||
Minimum skill: 0 (no combat potential)
|
||||
Nominal skill: 8 (average Zed)
|
||||
Very high stat: 16 (skilled in combat)
|
||||
Maximal stat: 20 (highest for balance purposes)
|
||||
|
||||
Dodge System assumptions:
|
||||
Dodge chance is based on attacker's melee skill and target's dex stat and dodge skill.
|
||||
Successful dodges negate the attack and impose a cumulative penalty on dodges within the same turn.
|
||||
|
||||
Dodge Use Cases:
|
||||
An individual with no skill and nominal stats in ideal circumstances against a basic opponent should occasionally be able to dodge.
|
||||
|
||||
An individual with no skill and nominal stats in ideal circumstances against a skilled opponent should rarely if ever be able to dodge.
|
||||
|
||||
An individual with world-class dodging ability, in ideal circumstances against a basic opponent should have a negligible chance of failure.
|
||||
|
||||
An individual with world-class dodging ability, in ideal circumstances against a skilled opponent should have a moderate chance of failure.
|
||||
|
||||
The effect of increasing dodge skill has a growth rate with diminishing returns that accelerates sharply at the point where you move beyond the dodge a "regular" character is likely to achieve (7 and above)
|
||||
|
||||
The balance of melee versus dodge should favour dodge which, after all, isn't effective against a wide variety of other types of attacks.
|
||||
|
||||
Even a world class dodger should not be able to dodge continuously when attacked many times a turn.
|
||||
@@ -6,7 +6,6 @@
|
||||
* item_groups.json - item spawn groups
|
||||
* materials.json - material types
|
||||
* monstergroups.json - monster spawn groups
|
||||
* monster_factions.json - monster factions
|
||||
* names.json - names used for NPC/player name generation
|
||||
* professions.json - profession definitions
|
||||
* recipes.json - crafting/disassembly recipes
|
||||
@@ -60,8 +59,6 @@
|
||||
3 = 50+
|
||||
```
|
||||
###ITEM GROUPS
|
||||
Item groups have been expanded, look at doc/ITEM_SPAWN.md to their new description.
|
||||
The syntax listed here is still valid.
|
||||
```C++
|
||||
"id":"forest", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"items":[ // List of potential item ID's. Chance of an item spawning is x/T, where
|
||||
@@ -99,58 +96,10 @@ The syntax listed here is still valid.
|
||||
{ "monster" : "mon_thing", // Monsters id
|
||||
"freq" : 100, // Chance of occurence, out of a thousand
|
||||
"multiplier" : 0, // How many monsters each monster in this definition should count as, if spawning a limited number of monsters
|
||||
// The minimum and maximum number of monsters in this group that should spawn together. Optional, defaults [1,1]
|
||||
"pack_size" : [3,5],
|
||||
// Conditions limiting when monsters spawn. Valid options: SUMMER, WINTER, AUTUMN, SPRING, DAY, NIGHT, DUSK, DAWN
|
||||
// Multiple Time-of-day conditions (DAY, NIGHT, DUSK, DAWN) will be combined together so that any of those conditions makes the spawn valid
|
||||
// Multiple Season conditions (SUMMER, WINTER, AUTUMN, SPRING) will be combined together so that any of those conditions makes the spawn valid
|
||||
"conditions" : ["DUSK","DAWN","SUMMER"]
|
||||
"pack_size" : [3,5], // The minimum and maximum number of monsters in this group that should spawn together. Optional, defaults [1,1]
|
||||
"conditions" : ["TWILIGHT","SUMMER"] // Conditions limiting when monsters spawn. Valid options: SUMMER, WINTER, AUTUMN, SPRING, DAY, NIGHT, DUSK, DAWN, TWILIGHT
|
||||
}
|
||||
```
|
||||
###MONSTER FACTIONS
|
||||
```C++
|
||||
"name" : "cult", // Unique ID. Must be one continuous word, use underscores when necessary
|
||||
"base_faction" : "zombie", // Optional base faction. Relations to other factions are inherited from it and relations of other factions to this one check this
|
||||
"by_mood" : ["vermin"], // Be hostile towards this faction when angry, neutral otherwise. Default attitude to all other factions
|
||||
"neutral" : ["nether"], // Always be neutral towards this faction
|
||||
"friendly" : ["blob"], // Always be friendly towards this faction. By default a faction is friendly towards itself
|
||||
###MONSTERS
|
||||
```C++
|
||||
"type" : "MONSTER", // Should always be "MONSTER"
|
||||
"id" : "mon_bat", // Unique ID. Must be one continuous word, use underscores when necessary. Standard is to preface the ID with "mon"
|
||||
"name" : "bat", // Name displayed in-game
|
||||
"species" : "MAMMAL", // Monster species
|
||||
"symbol" : "r", // Symbol representing monster in-game
|
||||
"color" : "brown", // Color of symbol in-game
|
||||
"size" : "TINY", // Size flag, can be TINY, SMALL, MEDIUM, LARGE, or HUGE. See JSON_FLAGS.md for reference
|
||||
"material" : "flesh", // The material the monster is primarily composed of
|
||||
"diff" : 4, // Monster difficulty. Impacts the shade used to label the monster, and if it is above 30 a kill will be recorded in the memorial log. Some example values: (Zombie, 3) (Mi-go, 26) (Zombie Hulk, 50)
|
||||
"aggression" : -25, // Defines how aggressive the monster is. Ranges from -99 (totally passive) to 100 (guaranteed hostility on detection)
|
||||
"morale" : 5, // Monster morale
|
||||
"speed" : 230, // Monster speed. 100 is the normal speed for a human being - higher values are faster and lower values are slower.
|
||||
"melee_skill" : 4, // Monster melee skill, ranges from 0 - 10, with 4 being an average mob. See GAME_BALANCE.txt for more examples
|
||||
"melee_dice" : 1, // Number of dice rolled on monster melee attack
|
||||
"melee_dice_sides" : 1, // Number of faces of dice rolled on monster melee attack
|
||||
"melee_cut" : 1, // Amount of cutting damage added to die roll on monster melee attack
|
||||
"dodge" : 8, // Monster dodge skill. See GAME_BALANCE.txt for an explanation of dodge mechanics
|
||||
"armor_bash" : 0, // Monster protection from bashing damage
|
||||
"armor_cut" : 0, // Monster protection from cutting damage
|
||||
"vision_day" : 10, // Vision range in full daylight
|
||||
"vision_night" : 1, // Vision range in total darkness
|
||||
"luminance" : 0, // Amount of light passively output by monster. Ranges from 0 to 10.
|
||||
"hp" : 10, // Monster hit points
|
||||
"special_freq" : 0, // Number of turns required to "charge" a monster's special attack
|
||||
"death_function" : "NORMAL", // How the monster behaves on death. See JSON_FLAGS.md for a list of possible functions. Supports multiple death functions
|
||||
"special_attack" : "BITE", // Monster's special attack. See JSON_FLAGS.md for a list of possible special attacks. A monster can have only one special attack
|
||||
"description": "One of the vesper bats, a family of winged insect-eating mammals. It roosts in caves and other hollows, and uses a form of echolocation to aerially navigate through tricky terrain at rapid speeds.",
|
||||
// In-game description for the monster
|
||||
"flags" : ["SEES", "HEARS", etc], // Monster flags. See JSON_FLAGS.md for a full list
|
||||
"fear_triggers" : ["SOUND", etc], // What makes the monster afraid. See JSON_FLAGS.md for a full list
|
||||
"anger_triggers" : ["PLAYER_CLOSE"],// What makes the monster angry. See JSON_FLAGS.md for a full list
|
||||
"placate_triggers" : ["MEAT"], // What calms the monster. See JSON_FLAGS.md for a full list
|
||||
"revert_to_itype": "bot_turret", // (optional) if not empty and a valid item id, the monster (usually a robot) can be converted into this item by the player (only when it's already friendly).
|
||||
"categories" : ["WILDLIFE"] // Monster categories. Can be NULL, CLASSIC (only mobs found in classic zombie movies) or WILDLIFE (natural animals). If they are not CLASSIC or WILDLIFE, they will not spawn in classic mode
|
||||
```
|
||||
###NAMES
|
||||
```C++
|
||||
{ "name" : "Aaliyah", "gender" : "female", "usage" : "given" }, // Name, gender, "given"/"family"/"city" (first/last/city name).
|
||||
@@ -163,10 +112,6 @@ The syntax listed here is still valid.
|
||||
"items":[ // ID's of items player starts with when selecting this profession
|
||||
"army_top",
|
||||
"boots_steel",
|
||||
["survnote", "snippet-id"],
|
||||
// Entries can also be an array containing the item id and a snippet id.
|
||||
// The id must match a snippet id from the snippet category that is
|
||||
// used by that item type.
|
||||
"jeans"
|
||||
],
|
||||
"name":"Bow Hunter", // In-game name displayed
|
||||
@@ -191,15 +136,12 @@ The syntax listed here is still valid.
|
||||
```C++
|
||||
"result": "javelin", // ID of resulting item
|
||||
"category": "CC_WEAPON", // Category of crafting recipe. CC_NONCRAFT used for disassembly recipes
|
||||
"id_suffix": "", // Optional (default: empty string). Some suffix to make the ident of the recipe unique. The ident of the recipe is "<id-of-result><id_suffix>".
|
||||
"override": false, // Optional (default: false). If false and the ident of the recipe is already used by another recipe, loading of recipes fails. If true and a recipe with the ident is already defined, the existing recipe is replaced by the new recipe.
|
||||
"skill_used": "fabrication", // Skill trained and used for success checks
|
||||
"requires_skills": [["survival", 1], ["throw", 2]], // Skills required to unlock recipe
|
||||
"difficulty": 3, // Difficulty of success check
|
||||
"time": 5000, // Time to perform recipe (where 1000 ~= 10 turns ~= 1 minute game time)
|
||||
"time": 5000, // Time to perform recipe
|
||||
"reversible": false, // Can be disassembled.
|
||||
"autolearn": true, // Automatically learned upon gaining required skills
|
||||
"batch_time_factors": [25, 15], // Optional factors for batch crafting time reduction. First number specifies maximum crafting time reduction as percentage, and the second number the minimal batch size to reach that number. In this example given batch size of 20 the last 6 crafts will take only 3750 time units.
|
||||
"tools": [ // Tools needed to craft
|
||||
[ // Equivalent tools are surrounded by a single set of brackets []
|
||||
[ "hatchet", -1 ], // Charges consumed when tool is used, -1 means no charges are consumed
|
||||
@@ -226,10 +168,10 @@ The syntax listed here is still valid.
|
||||
[ "fur", 1 ]
|
||||
],
|
||||
[
|
||||
[ "plant_fibre", 20, false ], // Optional flag for recoverability, default is true.
|
||||
[ "sinew", 20, false ],
|
||||
[ "thread", 20, false ],
|
||||
[ "duct_tape", 20 ] // Certain items are flagged as unrecoverable at the item definition level.
|
||||
[ "plant_fibre", 20 ],
|
||||
[ "sinew", 20 ],
|
||||
[ "thread", 20 ],
|
||||
[ "duct_tape", 20 ]
|
||||
]
|
||||
]
|
||||
```
|
||||
@@ -240,6 +182,11 @@ The syntax listed here is still valid.
|
||||
"description" : "Your skill with submachine guns and machine pistols. Halfway between a pistol and an assault rifle, these weapons fire and reload quickly, and may fire in bursts, but they are not very accurate.", // In-game description
|
||||
"tags" : ["gun_type"] // Special flags (default: none)
|
||||
```
|
||||
###SNIPPETS
|
||||
```C++
|
||||
"category": "flier", // Category used
|
||||
"text": "This is an advertisement for the Diet Devil brand Metabolic Exchange CBM. It shows a picture of a tiny obese devil sitting on a woman's shoulder. The woman stares intently at a gigantic wedding cake covered with bacon and candybars. The caption reads: \"Burn calories! Burn!\"" // In-game description
|
||||
```
|
||||
###TRAITS/MUTATIONS
|
||||
```C++
|
||||
"id": "LIGHTEATER", // Unique ID
|
||||
@@ -247,8 +194,6 @@ The syntax listed here is still valid.
|
||||
"points": 2, // Point cost of the trait. Positive values cost points and negative values give points
|
||||
"visibility": 0, // Visibility of the trait for purposes of NPC interaction (default: 0)
|
||||
"ugliness": 0, // Ugliness of the trait for purposes of NPC interaction (default: 0)
|
||||
"initial_ma_styles": [ "style_crane" ], // (optional) A list of ids of martial art styles of which the player can choose one when starting a game.
|
||||
"mixed_effect": false, // Wheather the trait has both positive and negative effects. This is purely declarative and is only used for the user interface. (default: false)
|
||||
"description": "Nothing gets you down!" // In-game description
|
||||
"starting_trait": true, // Can be selected at character creation (default: false)
|
||||
"valid": false, // Can be mutated ingame (default: true)
|
||||
@@ -280,9 +225,6 @@ The syntax listed here is still valid.
|
||||
"fuel_type": "NULL", // (Optional, default = "NULL") Type of fuel/ammo the part consumes, as an item id
|
||||
"item": "wheel", // The item used to install this part, and the item obtained when removing this part
|
||||
"difficulty": 4, // Your mechanics skill must be at least this level to install this part
|
||||
"breaks_into" : [ // When the vehicle part is destroyed, items from this list will be spawned around the part on the ground.
|
||||
{"item": "scrap", "min": 0, "max": 5} // item is the item id, min/max is the amount of items to spawn, if item is counted by charges (like nails), it will create that many charges.
|
||||
],
|
||||
"flags": [ // Flags associated with the part
|
||||
"EXTERNAL", "MOUNT_OVER", "WHEEL", "MOUNT_POINT", "VARIABLE_SIZE"
|
||||
]
|
||||
@@ -328,99 +270,53 @@ The syntax listed here is still valid.
|
||||
"stack_size" : 50, // (Optional) How many rounds are in the above-defined volume. If omitted, is the same as 'count'
|
||||
"effects" : ["COOKOFF", "SHOT"] // Special effects
|
||||
```
|
||||
###GENERIC ITEMS
|
||||
```C++
|
||||
"type" : "GENERIC", // Defines this as some generic item
|
||||
"id" : "socks", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"name" : "socks", // The name appearing in the examine box. Can be more than one word separated by spaces
|
||||
"weight" : 350, // Weight of the item in grams
|
||||
"color" : "blue", // ASCII character colour
|
||||
"to_hit" : 0, // To-hit bonus if using it as a melee weapon (whatever for?)
|
||||
"symbol" : "[", // ASCII character used in-game
|
||||
"description" : "Socks. Put 'em on your feet.", // Description of the item
|
||||
"price" : 100, // Used when bartering with NPCs
|
||||
"material" : ["COTTON"], // Material types, can abe as many as you want. See materials.json for possible options
|
||||
"volume" : 1, // Volume, measured in 1/4 liters
|
||||
"cutting" : 0, // Cutting damage caused by using it as a melee weapon
|
||||
"phase" : "solid", // What phase it is
|
||||
"bashing" : -5, // Bashing damage caused by using it as a melee weapon
|
||||
"flags" : ["VARSIZE"] // Indicates special effects, see JSON_FLAGS.md
|
||||
```
|
||||
###ARMOR
|
||||
Armor can be define like this:
|
||||
```C++
|
||||
"type" : "ARMOR", // Defines this as armor
|
||||
... // same entries as above for the generic item.
|
||||
// additional some armor specific entries:
|
||||
"id" : "socks", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"name" : "socks", // The name appearing in the examine box. Can be more than one word separated by spaces
|
||||
"weight" : 350, // Weight of armour in grams
|
||||
"color" : "blue", // ASCII character colour
|
||||
"covers" : ["FEET"], // Where it covers. Possible options are TORSO, HEAD, EYES, MOUTH, ARMS, HANDS, LEGS, FEET
|
||||
"to_hit" : 0, // To-hit bonus if using it as a melee weapon (whatever for?)
|
||||
"storage" : 0, // How many volume storage slots it adds
|
||||
"symbol" : "[", // ASCII character used in-game
|
||||
"description" : "Socks. Put 'em on your feet.", // Description of armour
|
||||
"price" : 100, // Used when bartering with NPCs
|
||||
"material" : ["COTTON", "NULL"], // Material types. See materials.json for possible options
|
||||
"volume" : 1, // Volume, measured in 1/4 liters
|
||||
"cutting" : 0, // Cutting damage caused by using it as a melee weapon
|
||||
"warmth" : 10, // How much warmth clothing provides
|
||||
"environmental_protection" : 0, // How much environmental protection it affords
|
||||
"phase" : "solid", // What phase it is
|
||||
"enviromental_protection" : 0, // How much environmental protection it affords
|
||||
"encumberance" : 0, // Base encumbrance (unfitted value)
|
||||
"bashing" : -5, // Bashing damage caused by using it as a melee weapon
|
||||
"flags" : ["VARSIZE"] // Indicates special effects
|
||||
"coverage" : 80, // What percentage of body part
|
||||
"material_thickness" : 1 // Thickness of material, in millimetre units (approximately). Generally ranges between 1 - 5, more unusual armour types go up to 10 or more
|
||||
"power_armor" : false, // If this is a power armor item (those are special).
|
||||
```
|
||||
Alternately, every item (book, tool, gun, even food) can be used as armor if it has armor_data:
|
||||
```C++
|
||||
"type" : "TOOL", // Or any other item type
|
||||
... // same entries as for the type (e.g. same entries as for any tool),
|
||||
"armor_data" : { // additionally the same armor data like above
|
||||
"covers" : ["FEET"],
|
||||
"storage" : 0,
|
||||
"warmth" : 10,
|
||||
"environmental_protection" : 0,
|
||||
"encumberance" : 0,
|
||||
"coverage" : 80,
|
||||
"material_thickness" : 1
|
||||
"power_armor" : false
|
||||
}
|
||||
```
|
||||
###BOOKS
|
||||
Books can be define like this:
|
||||
```C++
|
||||
"type" : "BOOK", // Defines this as a BOOK
|
||||
... // same entries as above for the generic item.
|
||||
// additional some book specific entries:
|
||||
"id" : "textbook_computers", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"name" : "Computer Science 301", // In-game name displayed
|
||||
"max_level" : 5, // Maximum skill level this book will train to
|
||||
"description" : "A college textbook on computer science.", // In-game description
|
||||
"weight" : 1587, // Weight, measured in grams
|
||||
"to_hit" : 1, // To-hit bonus if using it as a melee weapon
|
||||
"color" : "blue", // ASCII character colour
|
||||
"intelligence" : 11, // Intelligence required to read this book without penalty
|
||||
"symbol" : "?", // ASCII character used in-game
|
||||
"material" : ["paper", "null"], // Material types. See materials.json for possible options
|
||||
"volume" : 7, // Volume, measured in 1/4 liters
|
||||
"bashing" : 5, // Bashing damage caused by using it as a melee weapon
|
||||
"cutting" : 0, // Cutting damage caused by using it as a melee weapon
|
||||
"time" : 35, // Time (in minutes) a single read session takes
|
||||
"fun" : -2, // Morale bonus/penalty for reading
|
||||
"skill" : "computer", // Skill raised
|
||||
"chapters" : 4, // Number of chapters (for fun only books), each reading "consumes" a chapter. Books with no chapters left are less fun (because the content is already known to the character).
|
||||
"price" : 500, // Used when bartering with NPCs
|
||||
"required_level" : 2 // Minimum skill level required to learn
|
||||
```
|
||||
Alternately, every item (tool, gun, even food) can be used as book if it has book_data:
|
||||
```C++
|
||||
"type" : "TOOL", // Or any other item type
|
||||
... // same entries as for the type (e.g. same entries as for any tool),
|
||||
"book_data" : { // additionally the same book data like above
|
||||
"max_level" : 5,
|
||||
"intelligence" : 11,
|
||||
"time" : 35,
|
||||
"fun" : -2,
|
||||
"skill" : "computer",
|
||||
"chapters" : 4,
|
||||
"use_action" : "MA_MANUAL", // The book_data can have use functions (see USE ACTIONS) that are triggered when the books has been read. These functions are not triggered by simply activating the item (like tools would).
|
||||
"required_level" : 2
|
||||
}
|
||||
```
|
||||
|
||||
####Color key
|
||||
When adding a new book, please use this color key:
|
||||
|
||||
* Magazines: `pink`
|
||||
* “Paperbacks” Short enjoyment books (including novels): `light_cyan`
|
||||
* “Hardbacks” Long enjoyment books (including novels): `light_blue`
|
||||
* “Small textbook” Beginner level textbooks, guides and martial arts books: `dark_green`
|
||||
* “Large textbook” Advanced level textbooks and advanced guides: `dark_blue`
|
||||
* Religious books: `dark_gray`
|
||||
* “Printouts” (including spiral-bound and similar) Technical documents, (technical?) protocols, (lab) journals: `light_green`
|
||||
* Other reading material/non-books (use only if every other category does not apply): `light_gray`
|
||||
|
||||
A few exceptions to this color key may apply, for example for books that don’t are what they seem to be.
|
||||
Never use `yellow` and `red`, those colors are reserved for sounds and infrared vision.
|
||||
|
||||
###COMESTIBLES
|
||||
```C++
|
||||
"type" : "COMESTIBLE", // Defines this as a COMESTIBLE
|
||||
@@ -430,7 +326,7 @@ Never use `yellow` and `red`, those colors are reserved for sounds and infrared
|
||||
"color" : "white", // ASCII character colour
|
||||
"addiction_type" : "crack", // Addiction type
|
||||
"spoils_in" : 0, // How long a comestible is good for. 0 = no spoilage
|
||||
"use_action" : "CRACK", // What effects a comestible has when used, see special definitions below
|
||||
"use_action" : "CRACK", // What effects a comestible has when used
|
||||
"stim" : 40, // Stimulant effect
|
||||
"container" : "null", // What container stores this
|
||||
"to_hit" : 0, // To-hit bonus if using it as a melee weapon
|
||||
@@ -450,30 +346,26 @@ Never use `yellow` and `red`, those colors are reserved for sounds and infrared
|
||||
"charges" : 4, // Number of uses when spawned
|
||||
"stack_size" : 8, // (Optional) How many uses are in the above-defined volume. If omitted, is the same as 'charges'
|
||||
"bashing" : 0, // Bashing damage caused by using it as a melee weapon
|
||||
"fun" : 50, // Morale effects when used
|
||||
"grow" : 91 // Time it takes for a plant to fully mature. Based around a 91 day season length (roughly a real world season) to give better accuracy for longer season lengths
|
||||
// Note that growing time is later converted based upon the season_length option, basing it around 91 is just for accuracy purposes
|
||||
"fun" : 50 // Morale effects when used
|
||||
```
|
||||
###CONTAINERS
|
||||
```C++
|
||||
"type": "CONTAINER", // Defines this as a container
|
||||
... // same data as for the generic item (see above).
|
||||
"id": "keg", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"type": "CONTAINER", // Defines this as a CONTAINER
|
||||
"symbol": ")", // ASCII character used in-game
|
||||
"color": "light_cyan", // ASCII character colour
|
||||
"name": "aluminum keg", // In-game name displayed
|
||||
"description": "A reusable aluminum keg, used for shipping beer.\nIt has a capacity of 50 liters.", // In-game description
|
||||
"price": 6000, // Used when bartering with NPCs
|
||||
"weight": 13500, // Weight, measured in grams
|
||||
"volume": 200, // Volume, measured in 1/4 liters
|
||||
"bashing": -4, // Bashing damage caused by using it as a melee weapon
|
||||
"cutting": 0, // Cutting damage caused by using it as a melee weapon
|
||||
"to_hit": -4, // To-hit bonus if using it as a melee weapon
|
||||
"material": "steel", // Material types. See materials.json for possible options
|
||||
"contains": 200, // How much volume this container can hold
|
||||
"seals": false, // Can be resealed, this is a required for it to be used for liquids. (optional, default: false)
|
||||
"watertight": false, // Can hold liquids, this is a required for it to be used for liquids. (optional, default: false)
|
||||
"rigid": false, // Volume of the item does not include volume of the content. Without that flag the volume of the contents are added to the volume of the container. (optional, default: false)
|
||||
"preserves": false, // Contents do not spoil. (optional, default: false)
|
||||
"flags": ["RIGID", "SEALS", "WATERTIGHT"] // Indicates special effects
|
||||
```
|
||||
Alternately, every item can be used as container:
|
||||
```C++
|
||||
"type": "ARMOR", // Any type is allowed here
|
||||
... // same data as for the type
|
||||
"container_data" : { // The container specific data goes here.
|
||||
"contains": 200,
|
||||
}
|
||||
```
|
||||
This defines a armor (you need to add all the armor specific entries), but makes it usable as container.
|
||||
It could also be written as a generic item ("tpye": "GENERIC") with "armor_data" and "container_data" entries.
|
||||
###MELEE
|
||||
```C++
|
||||
"id": "hatchet", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
@@ -491,38 +383,32 @@ It could also be written as a generic item ("tpye": "GENERIC") with "armor_data"
|
||||
"to_hit": 1 // To-hit bonus if using it as a melee weapon
|
||||
```
|
||||
###GUN
|
||||
Guns can be define like this:
|
||||
```C++
|
||||
"id": "nailgun", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
"type": "GUN", // Defines this as a GUN
|
||||
... // same entries as above for the generic item.
|
||||
// additional some gun specific entries:
|
||||
"symbol": "(", // ASCII character used in-game
|
||||
"color": "light_blue", // ASCII character colour
|
||||
"name": "nail gun", // In-game name displayed
|
||||
"description": "A tool used to drive nails into wood or other material. It could also be used as a ad-hoc weapon, or to practice your handgun skill up to level 1.", // In-game description
|
||||
"price": 100, // Used when bartering with NPCs
|
||||
"material": "iron", // Material types. See materials.json for possible options
|
||||
"flags": "MODE_BURST", // Indicates special effects
|
||||
"skill": "pistol", // Skill used for firing
|
||||
"ammo": "nail", // Ammo type accepted for reloading
|
||||
"weight": 2404, // Weight, measured in grams
|
||||
"volume": 4, // Volume, measured in 1/4 liters
|
||||
"bashing": 12, // Bashing damage caused by using it as a melee weapon
|
||||
"cutting": 0, // Cutting damage caused by using it as a melee weapon
|
||||
"to_hit": 1, // To-hit bonus if using it as a melee weapon
|
||||
"ranged_damage": 0, // Ranged damage when fired
|
||||
"range": 0, // Range when fired
|
||||
"dispersion": 32, // Inaccuracy of gun, measured in quarter-degrees
|
||||
// When sight_dispersion and aim_speed are present in a gun mod, the aiming system picks the "best"
|
||||
// sight to use for each aim action, which is the fastest sight with a dispersion under the current
|
||||
// aim threshold.
|
||||
"sight_dispersion": 10, // Inaccuracy of gun derived from the sight mechanism, also in quarter-degrees
|
||||
"aim_speed": 3, // A measure of how quickly the player can aim, in moves per point of dispersion.
|
||||
"recoil": 0, // Recoil caused when firing, in quarter-degrees of dispersion.
|
||||
"recoil": 0, // Recoil caused when firing
|
||||
"durability": 8, // Resistance to damage/rusting, also determines misfire chance
|
||||
"burst": 5, // Number of shots fired in burst mode
|
||||
"clip_size": 100, // Maximum amount of ammo that can be loaded
|
||||
"ups_charges": 0, // Additionally to the normal ammo (if any), a gun can require some charges from an UPS.
|
||||
"reload": 450 // Amount of time to reload, 100 = 6 seconds = 1 "turn"
|
||||
```
|
||||
Alternately, every item (book, tool, armor, even food) can be used as gun if it has gun_data:
|
||||
```C++
|
||||
"type" : "TOOL", // Or any other item type
|
||||
... // same entries as for the type (e.g. same entries as for any tool),
|
||||
"gun_data" : { // additionally the same gun data like above
|
||||
"skill": ...,
|
||||
"recoil": ...,
|
||||
...
|
||||
}
|
||||
```
|
||||
###TOOLS
|
||||
```C++
|
||||
"id": "torch_lit", // Unique ID. Must be one continuous word, use underscores if necessary
|
||||
@@ -546,139 +432,8 @@ Alternately, every item (book, tool, armor, even food) can be used as gun if it
|
||||
"turns_per_charge": 20, // Charges consumed over time
|
||||
"ammo": "NULL", // Ammo type used for reloading
|
||||
"revert_to": "torch_done", // Transforms into item when charges are expended
|
||||
"use_action": "TORCH_LIT" // Action performed when tool is used, see special definition below
|
||||
"use_action": "TORCH_LIT" // Action performed when tool is used
|
||||
```
|
||||
###SPAWN DATA
|
||||
Every item type can have optional spawn data:
|
||||
```
|
||||
"spawn_data" : {
|
||||
"container": "can" // The id of a container item, new item will be put into that container (optional, default: no container)
|
||||
}
|
||||
```
|
||||
###USE ACTIONS
|
||||
The contents of use_action fields can either be a string indicating a built-in function to call when the item is activated (defined in iuse.cpp), or one of several special definitions that invoke a more structured function.
|
||||
```C++
|
||||
"use_action": {
|
||||
"type": "transform", // The type of method, in this case one that transforms the item.
|
||||
"target": "gasoline_lantern_on", // The item to transform to.
|
||||
"active": true, // Whether the item is active once transformed.
|
||||
"msg": "You turn the lamp on.", // Message to display when activated.
|
||||
"need_fire": 1, // Whether fire is needed to activate.
|
||||
"need_fire_msg": "You need a lighter!", // Message to display if there is no fire.
|
||||
"need_charges": 1, // Number of charges the item needs to transform.
|
||||
"need_charges_msg": "The lamp is empty." // Message to display if there aren't enough charges.
|
||||
"target_charges" : 3, // Number of charges the transformed item has.
|
||||
"container" : "jar", // Container holding the target item.
|
||||
"moves" : 500 // Moves required to transform the item in excess of a normal action.
|
||||
},
|
||||
"use_action": {
|
||||
"type: : "auto_transform", // Like transform, but it transforms automatically when a condition is met.
|
||||
"when_underwater" : "The candle is extinguished.", // Message to display if the item goes underwater, also cause the item to transform when it goes underwater.
|
||||
"non_interactive_message" " "You can not deactivate the lightstrip.", // Message to display if the player tries to activate the item, also prevents activation by player from working.
|
||||
},
|
||||
"use_action": {
|
||||
"type": "explosion", // An item that explodes when it runs out of charges.
|
||||
"sound_volume": 0, // Volume of a sound the item makes every turn.
|
||||
"sound_msg": "Tick.", // Message describing sound the item makes every turn.
|
||||
"no_deactivate_msg": "You've already pulled the %s's pin, try throwing it instead.", // Message to display if the player tries to activate the item, prevents activation from succeeding if defined.
|
||||
"explosion_power": 12, // Power of the resulting explosion.
|
||||
"explosion_shrapnel": 28, // Power of shrapnel produced by explosion.
|
||||
"explosion_fire" : 33, // Power of flames produced by explosion.
|
||||
"explosion_blast" : 22, // Power of blast from explosion.
|
||||
"draw_explosion_radius" : 5, // How large to draw the radius of the explosion.
|
||||
"draw_explosion_color" : "ltblue", // The color to use when drawing the explosion.
|
||||
"do_flashbang" : true, // Whether to do the flashbang effect.
|
||||
"flashbang_player_immune" : true, // Whether the player is immune to the flashbang effect.
|
||||
"fields_radius": 3, // The radius of spread for fields produced.
|
||||
"fields_type": "fd_tear_gas", // The type of fields produced.
|
||||
"fields_min_density": 3,
|
||||
"fields_max_density": 3,
|
||||
"emp_blast_radius": 4,
|
||||
"scrambler_blast_radius": 4
|
||||
},
|
||||
"use_action": {
|
||||
"type": "unfold_vehicle", // Transforms the item into a vehicle.
|
||||
"vehicle_name": "bicycle", // Vehicle name to create.
|
||||
"unfold_msg": "You painstakingly unfold the bicycle and make it ready to ride.", // Message to display when transforming.
|
||||
"moves": 500 // Number of moves required in the process.
|
||||
},
|
||||
"use_action" : {
|
||||
"type" : "consume_drug", // A drug the player can consume.
|
||||
"activation_message" : "You smoke your crack rocks. Mother would be proud.", // Message, ayup.
|
||||
"diseases" : { "high": 15 }, // A disease to inflict and its duration.
|
||||
"stat_adjustments": {"hunger" : -10}, // Adjustment to make to player stats.
|
||||
"fields_produced" : {"cracksmoke" : 2}, // Fields to produce, mostly used for smoke.
|
||||
"charges_needed" : { "fire" : 1 }, // Charges to use in the process of consuming the drug.
|
||||
"tools_needed" : { "apparatus" : -1 } // Tool needed to use the drug.
|
||||
},
|
||||
"use_action": {
|
||||
"type": "place_monster", // place a turrent / manhack / whatever monster on the map
|
||||
"monster_id": "mon_manhack", // monster id, see monsters.json
|
||||
"difficulty": 4, // difficulty for programming it (manhacks have 4, turrets 6, ...)
|
||||
"hostile_msg": "It's hostile!", // (optional) message when programming the monster failed and it's hostile.
|
||||
"friendly_msg": "Good!", // (optional) message when the monster is programmed properly and it's friendly.
|
||||
"place_randomly": true, // if true: places the monser randomly around the player, if false: let the player decide where to put it (default: false)
|
||||
"moves": 60 // how many move points the action takes.
|
||||
},
|
||||
"use_action": {
|
||||
"type": "ups_based_armor", // Armor that can be activated and uses power from an UPS, needs additional C++ code to work
|
||||
"activate_msg": "You activate your foo.", // Message when the player activates the item.
|
||||
"deactive_msg": "You deactivate your foo.", // Message when the player deactivates the item.
|
||||
"out_of_power_msg": "Your foo runs out of power and deactivates itself." // Message when the UPS runs out of power and the item is deactivated automatically.
|
||||
}
|
||||
"use_action" : {
|
||||
"type" : "delayed_transform", // Like transform, but it will only transform when the item has a certain age
|
||||
"transform_age" : 600, // The minimal age of the item. Items that are younger wont transform. In turns (10 turn = 1 minute)
|
||||
"not_ready_msg" : "The yeast has not been done The yeast isn't done culturing yet." // A message, shown when the item is not old enough
|
||||
},
|
||||
"use_action": {
|
||||
"type": "picklock", // picking a lock on a door
|
||||
"pick_quality": 3 // "quality" of the tool, higher values mean higher success chance, and using it takes less moves.
|
||||
},
|
||||
"use_action": {
|
||||
"type": "reveal_map", // reveal specific terrains on the overmap
|
||||
"radius": 180, // radius around the player where things are revealed. A single overmap is 180x180 tiles.
|
||||
"terrain": ["hiway", "road"], // ids of overmap terrain types that should be revealed (as many as you want).
|
||||
"message": "You add roads and tourist attractions to your map." // Displayed after the revelation.
|
||||
}
|
||||
```
|
||||
###Random descriptions
|
||||
Any item with a "snippet_category" entry will have random descriptions, based on that snippet category:
|
||||
```
|
||||
"snippet_category": "newspaper",
|
||||
```
|
||||
The item descriptions are taken from snippets, which can be specified like this (the value of category must match the snippet_category in the item definition):
|
||||
```
|
||||
{
|
||||
"type" : "snippet",
|
||||
"category" : "newspaper",
|
||||
"id" : "snippet-id", // id is optional, it's used when the snippet is referenced in the item list of professions
|
||||
"text": "your flavor text"
|
||||
}
|
||||
```
|
||||
or several snippets at once:
|
||||
```
|
||||
{
|
||||
"type" : "snippet",
|
||||
"category" : "newspaper",
|
||||
"text": [
|
||||
"your flavor text",
|
||||
"more flavor",
|
||||
// entries can also bo of this form to have a id to reference that specific snippet.
|
||||
{ "id" : "snippet-id", "text" : "another flavor text" }
|
||||
]
|
||||
"text": [ "your flavor text", "another flavor text", "more flavor" ]
|
||||
}
|
||||
```
|
||||
Multiple snippets for the same category are possible and actually recommended. The game will select a random one for each item of that type.
|
||||
|
||||
One can also put the snippets directly in the item definition:
|
||||
```
|
||||
"snippet_category": [ "text 1", "text 2", "text 3" ],
|
||||
```
|
||||
This will automatically create a snippet category specific to that item and populate that category with the given snippets.
|
||||
The format also support snippet ids like above.
|
||||
|
||||
#json jsons
|
||||
|
||||
###FURNITURE
|
||||
@@ -691,7 +446,6 @@ The format also support snippet ids like above.
|
||||
"move_cost_mod": 2, //Movement cost modifier (-10 = impassable, 0 = no change)
|
||||
"required_str": 18, //Strength required to move past the terrain easily
|
||||
"flags": ["TRANSPARENT", "BASHABLE", "FLAMMABLE_HARD"], //Furniture flags
|
||||
"crafting_pseudo_item": "anvil", // id of an item (tool) that will be available for crafting when this furniture is range
|
||||
"examine_action": "toilet" //(OPTIONAL) Function called when examined, see iexamine.cpp.
|
||||
//If omitted, defaults to iexamine::none.
|
||||
```
|
||||
@@ -4,30 +4,14 @@ Info on translating Cataclysm-DDA into another language.
|
||||
TRANSLATORS
|
||||
===========
|
||||
|
||||
The current official locations for translating Cataclysm-DDA is at
|
||||
[Launchpad Translations](https://translations.launchpad.net/cdda) and [Transifex Translations](https://www.transifex.com/projects/p/cataclysm-dda).
|
||||
The current official location for translating Cataclysm-DDA is at
|
||||
[Launchpad Translations](https://translations.launchpad.net/cdda).
|
||||
|
||||
You can join to your language translation project:
|
||||
For the moment, there are separate locations for translating
|
||||
[Chinese](https://translations.launchpad.net/cataclysm)
|
||||
and [Russian](https://translations.launchpad.net/cataclysm-dda).
|
||||
We will be merging these once translations have stabalized.
|
||||
|
||||
On [Transifex](https://www.transifex.com/projects/p/cataclysm-dda/):
|
||||
* Russian
|
||||
* German
|
||||
|
||||
On [Launchpad](https://translations.launchpad.net/cdda):
|
||||
* Brazilian
|
||||
* Portuguese
|
||||
* Chinese (Simplified)
|
||||
* Chinese (Traditional)
|
||||
* Czech
|
||||
* French
|
||||
* Italian
|
||||
* Japanese
|
||||
* Korean
|
||||
* Polish
|
||||
* Serbian
|
||||
* Vietnamese
|
||||
|
||||
If your language is not translated you can add it into any translation project on launchpad.net or transifex.com(prefered).
|
||||
Using Launchpad Translations anyone can help translate.
|
||||
All you need to do is set up a Launchpad account,
|
||||
and tell it your preferred language.
|
||||
@@ -52,7 +36,7 @@ General notes for all translators are in
|
||||
and notes specific to a language may be stored as `<lang_id>.txt`,
|
||||
for example `lang/notes/de.txt` for German.
|
||||
|
||||
Cataclysm-DDA has more than 14,000 translatable strings,
|
||||
Cataclysm-DDA has more than 10,000 translatable strings,
|
||||
but don't be discouraged.
|
||||
The more translators there are,
|
||||
the easier it becomes :).
|
||||
@@ -67,7 +51,7 @@ to correctly merge and maintain the translation files.
|
||||
There are scripts available for these,
|
||||
so usually the process will be as follows:
|
||||
|
||||
1. Download the translations in .po format.
|
||||
1. Download the translations in .po format from Launchpad.
|
||||
2. Put them in `lang/incoming/`,
|
||||
ensuring they are named consistently with the files in `lang/po/`.
|
||||
3. Run `lang/update_pot.sh` to update `lang/po/cataclysm-dda.pot`.
|
||||
@@ -99,3 +83,5 @@ and you want to test the Russian (ru) translation,
|
||||
the steps would be `lang/compile_mo.sh ru`,
|
||||
`mv lang/mo/ru lang/mo/en_NZ`,
|
||||
`./cataclysm`.
|
||||
|
||||
|
||||
+70
-374
@@ -2,8 +2,6 @@
|
||||
#include "cursesdef.h"
|
||||
#include "options.h"
|
||||
#include "rng.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define HILIGHT COLOR_BLUE
|
||||
void init_colors()
|
||||
@@ -341,7 +339,7 @@ nc_color int_to_color(int key)
|
||||
case 77: return c_pink_white;
|
||||
case 78: return c_cyan_white;
|
||||
case 79: return c_ltcyan_white;
|
||||
|
||||
|
||||
case 80: return c_black_green;
|
||||
case 81: return c_dkgray_green;
|
||||
case 82: return c_ltgray_green;
|
||||
@@ -358,7 +356,7 @@ nc_color int_to_color(int key)
|
||||
case 93: return c_pink_green;
|
||||
case 94: return c_cyan_green;
|
||||
case 95: return c_ltcyan_green;
|
||||
|
||||
|
||||
case 96: return c_black_yellow;
|
||||
case 97: return c_dkgray_yellow;
|
||||
case 98: return c_ltgray_yellow;
|
||||
@@ -375,7 +373,7 @@ nc_color int_to_color(int key)
|
||||
case 109: return c_pink_yellow;
|
||||
case 110: return c_cyan_yellow;
|
||||
case 111: return c_ltcyan_yellow;
|
||||
|
||||
|
||||
case 112: return c_black_magenta;
|
||||
case 113: return c_dkgray_magenta;
|
||||
case 114: return c_ltgray_magenta;
|
||||
@@ -392,7 +390,7 @@ nc_color int_to_color(int key)
|
||||
case 125: return c_pink_magenta;
|
||||
case 126: return c_cyan_magenta;
|
||||
case 127: return c_ltcyan_magenta;
|
||||
|
||||
|
||||
case 128: return c_black_cyan;
|
||||
case 129: return c_dkgray_cyan;
|
||||
case 130: return c_ltgray_cyan;
|
||||
@@ -432,7 +430,6 @@ nc_color hilite(nc_color c)
|
||||
case c_ltcyan: return h_ltcyan;
|
||||
case c_pink: return h_pink;
|
||||
case c_yellow: return h_yellow;
|
||||
default: break;
|
||||
}
|
||||
return h_white;
|
||||
}
|
||||
@@ -456,15 +453,6 @@ nc_color invert_color(nc_color c)
|
||||
case c_pink: return i_magenta;
|
||||
case c_brown:
|
||||
case c_yellow: return i_brown;
|
||||
// the reverse of the above
|
||||
case i_ltgray: return c_white;
|
||||
case i_red: return c_red;
|
||||
case i_green: return c_green;
|
||||
case i_blue: return c_blue;
|
||||
case i_cyan: return c_cyan;
|
||||
case i_magenta: return c_magenta;
|
||||
case i_brown: return c_brown;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,136 +472,6 @@ nc_color invert_color(nc_color c)
|
||||
case c_ltblue: return i_ltblue;
|
||||
case c_ltcyan: return i_ltcyan;
|
||||
case c_pink: return i_pink;
|
||||
// the reverse of the above
|
||||
case i_white: return c_white;
|
||||
case i_ltgray: return c_ltgray;
|
||||
case i_dkgray: return c_dkgray;
|
||||
case i_red: return c_red;
|
||||
case i_green: return c_green;
|
||||
case i_blue: return c_blue;
|
||||
case i_cyan: return c_cyan;
|
||||
case i_magenta: return c_magenta;
|
||||
case i_brown: return c_brown;
|
||||
case i_yellow: return c_yellow;
|
||||
case i_ltred: return c_ltred;
|
||||
case i_ltgreen: return c_ltgreen;
|
||||
case i_ltblue: return c_ltblue;
|
||||
case i_ltcyan: return c_ltcyan;
|
||||
case i_pink: return c_pink;
|
||||
|
||||
// and some color pairs with foreground and background
|
||||
case c_white_red: return c_red_white;
|
||||
case c_ltgray_red: return c_ltred_white;
|
||||
case c_green_red: return c_red_green;
|
||||
case c_cyan_red: return c_red_cyan;
|
||||
case c_magenta_red: return c_red_magenta;
|
||||
case c_ltred_red: return c_red_red;
|
||||
case c_ltgreen_red: return c_ltred_green;
|
||||
case c_ltcyan_red: return c_ltred_cyan;
|
||||
case c_yellow_red: return c_red_yellow;
|
||||
// the reverse of the above
|
||||
case c_red_white: return c_white_red;
|
||||
case c_ltred_white: return c_ltgray_red;
|
||||
case c_red_green: return c_green_red;
|
||||
case c_red_cyan: return c_cyan_red;
|
||||
case c_red_magenta: return c_magenta_red;
|
||||
case c_ltred_green: return c_ltgreen_red;
|
||||
case c_ltred_cyan: return c_ltcyan_red;
|
||||
case c_red_yellow: return c_yellow_red;
|
||||
|
||||
case c_black: return c_black;
|
||||
case c_black_cyan: return c_cyan;
|
||||
case c_black_green: return c_green;
|
||||
case c_black_magenta: return c_magenta;
|
||||
case c_black_white: return c_ltgray;
|
||||
case c_black_yellow: return c_brown;
|
||||
case c_blue_cyan: return h_cyan;
|
||||
case c_blue_green: return h_green;
|
||||
case c_blue_magenta: return h_magenta;
|
||||
case c_blue_red: return h_red;
|
||||
case c_blue_white: return h_ltgray;
|
||||
case c_blue_yellow: return h_brown;
|
||||
case c_brown_cyan: return c_cyan_yellow;
|
||||
case c_brown_green: return c_green_yellow;
|
||||
case c_brown_magenta: return c_magenta_yellow;
|
||||
case c_brown_red: return c_red_yellow;
|
||||
case c_brown_white: return c_ltgray_yellow;
|
||||
case c_brown_yellow: return c_brown_yellow;
|
||||
case c_cyan_cyan: return c_cyan_cyan;
|
||||
case c_cyan_green: return c_green_cyan;
|
||||
case c_cyan_magenta: return c_magenta_cyan;
|
||||
case c_cyan_white: return c_ltgray_cyan;
|
||||
case c_cyan_yellow: return c_brown_cyan;
|
||||
case c_dkgray_cyan: return c_ltcyan;
|
||||
case c_dkgray_green: return c_ltgreen;
|
||||
case c_dkgray_magenta: return c_pink;
|
||||
case c_dkgray_white: return c_white;
|
||||
case c_dkgray_yellow: return c_yellow;
|
||||
case c_green_cyan: return c_cyan_green;
|
||||
case c_green_green: return c_green_green;
|
||||
case c_green_magenta: return c_magenta_green;
|
||||
case c_green_white: return c_ltgray_green;
|
||||
case c_green_yellow: return c_brown_green;
|
||||
case c_ltblue_cyan: return h_ltcyan;
|
||||
case c_ltblue_green: return h_ltgreen;
|
||||
case c_ltblue_magenta: return h_pink;
|
||||
case c_ltblue_red: return h_ltred;
|
||||
case c_ltblue_white: return h_white;
|
||||
case c_ltblue_yellow: return h_yellow;
|
||||
case c_ltcyan_cyan: return c_ltcyan_cyan;
|
||||
case c_ltcyan_green: return c_ltgreen_cyan;
|
||||
case c_ltcyan_magenta: return c_pink_cyan;
|
||||
case c_ltcyan_white: return c_white_cyan;
|
||||
case c_ltcyan_yellow: return c_yellow_cyan;
|
||||
case c_ltgray_cyan: return c_cyan_white;
|
||||
case c_ltgray_green: return c_green_white;
|
||||
case c_ltgray_magenta: return c_magenta_white;
|
||||
case c_ltgray_white: return c_ltgray_white;
|
||||
case c_ltgray_yellow: return c_brown_white;
|
||||
case c_ltgreen_cyan: return c_ltcyan_green;
|
||||
case c_ltgreen_green: return c_ltgreen_green;
|
||||
case c_ltgreen_magenta: return c_pink_green;
|
||||
case c_ltgreen_white: return c_white_green;
|
||||
case c_ltgreen_yellow: return c_yellow_green;
|
||||
case c_ltred_magenta: return c_pink_red;
|
||||
case c_ltred_yellow: return c_yellow_red;
|
||||
case c_magenta_cyan: return c_cyan_magenta;
|
||||
case c_magenta_green: return c_green_magenta;
|
||||
case c_magenta_magenta: return c_magenta_magenta;
|
||||
case c_magenta_white: return c_ltgray_magenta;
|
||||
case c_magenta_yellow: return c_brown_magenta;
|
||||
case c_pink_cyan: return c_ltcyan_magenta;
|
||||
case c_pink_green: return c_ltgreen_magenta;
|
||||
case c_pink_magenta: return c_pink_magenta;
|
||||
case c_pink_red: return c_ltred_magenta;
|
||||
case c_pink_white: return c_white_magenta;
|
||||
case c_pink_yellow: return c_yellow_magenta;
|
||||
case c_white_cyan: return c_ltcyan_white;
|
||||
case c_white_green: return c_ltgreen_white;
|
||||
case c_white_magenta: return c_pink_white;
|
||||
case c_white_white: return c_white_white;
|
||||
case c_white_yellow: return c_yellow_white;
|
||||
case c_yellow_cyan: return c_ltcyan_yellow;
|
||||
case c_yellow_green: return c_ltgreen_yellow;
|
||||
case c_yellow_magenta: return c_pink_yellow;
|
||||
case c_yellow_white: return c_white_yellow;
|
||||
case c_yellow_yellow: return c_yellow_yellow;
|
||||
case h_black: return c_blue;
|
||||
case h_brown: return c_blue_yellow;
|
||||
case h_cyan: return c_blue_cyan;
|
||||
case h_dkgray: return c_ltblue;
|
||||
case h_green: return c_blue_green;
|
||||
case h_ltblue: return h_ltblue;
|
||||
case h_ltcyan: return c_ltblue_cyan;
|
||||
case h_ltgray: return c_blue_white;
|
||||
case h_ltgreen: return c_ltblue_green;
|
||||
case h_ltred: return c_ltblue_red;
|
||||
case h_magenta: return c_blue_magenta;
|
||||
case h_pink: return c_ltblue_magenta;
|
||||
case h_red: return c_blue_red;
|
||||
case h_white: return c_ltblue_white;
|
||||
case h_yellow: return c_ltblue_yellow;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return c_pink;
|
||||
@@ -637,7 +495,6 @@ nc_color red_background(nc_color c)
|
||||
case c_ltcyan: return c_ltcyan_red;
|
||||
case c_pink: return c_pink_red;
|
||||
case c_yellow: return c_yellow_red;
|
||||
default: break;
|
||||
}
|
||||
return c_white_red;
|
||||
}
|
||||
@@ -775,204 +632,78 @@ nc_color rand_color()
|
||||
return c_dkgray;
|
||||
}
|
||||
|
||||
std::map<std::string, nc_color> const colormap {
|
||||
{"black" , c_black},
|
||||
{"white" , c_white},
|
||||
{"ltgray" , c_ltgray},
|
||||
{"light_gray" , c_ltgray},
|
||||
{"dkgray" , c_dkgray},
|
||||
{"dark_gray" , c_dkgray},
|
||||
{"red" , c_red},
|
||||
{"green" , c_green},
|
||||
{"blue" , c_blue},
|
||||
{"cyan" , c_cyan},
|
||||
{"magenta" , c_magenta},
|
||||
{"brown" , c_brown},
|
||||
{"ltred" , c_ltred},
|
||||
{"light_red" , c_ltred},
|
||||
{"ltgreen" , c_ltgreen},
|
||||
{"light_green" , c_ltgreen},
|
||||
{"ltblue" , c_ltblue},
|
||||
{"light_blue" , c_ltblue},
|
||||
{"ltcyan" , c_ltcyan},
|
||||
{"light_cyan" , c_ltcyan},
|
||||
{"pink" , c_pink},
|
||||
{"yellow" , c_yellow},
|
||||
|
||||
{"h_black" , h_black},
|
||||
{"h_white" , h_white},
|
||||
{"h_ltgray" , h_ltgray},
|
||||
{"h_dkgray" , h_dkgray},
|
||||
{"h_red" , h_red},
|
||||
{"h_green" , h_green},
|
||||
{"h_blue" , h_blue},
|
||||
{"h_cyan" , h_cyan},
|
||||
{"h_magenta" , h_magenta},
|
||||
{"h_brown" , h_brown},
|
||||
{"h_ltred" , h_ltred},
|
||||
{"h_ltgreen" , h_ltgreen},
|
||||
{"h_ltblue" , h_ltblue},
|
||||
{"h_ltcyan" , h_ltcyan},
|
||||
{"h_pink" , h_pink},
|
||||
{"h_yellow" , h_yellow},
|
||||
|
||||
{"i_black" , i_black},
|
||||
{"i_white" , i_white},
|
||||
{"i_ltgray" , i_ltgray},
|
||||
{"i_dkgray" , i_dkgray},
|
||||
{"i_red" , i_red},
|
||||
{"i_green" , i_green},
|
||||
{"i_blue" , i_blue},
|
||||
{"i_cyan" , i_cyan},
|
||||
{"i_magenta" , i_magenta},
|
||||
{"i_brown" , i_brown},
|
||||
{"i_ltred" , i_ltred},
|
||||
{"i_ltgreen" , i_ltgreen},
|
||||
{"i_ltblue" , i_ltblue},
|
||||
{"i_ltcyan" , i_ltcyan},
|
||||
{"i_pink" , i_pink},
|
||||
{"i_yellow" , i_yellow},
|
||||
|
||||
{"white_red" , c_white_red},
|
||||
{"ltgray_red" , c_ltgray_red},
|
||||
{"light_gray_red" , c_ltgray_red},
|
||||
{"dkgray_red" , c_dkgray_red},
|
||||
{"dark_gray_red" , c_dkgray_red},
|
||||
{"red_red" , c_red_red},
|
||||
{"green_red" , c_green_red},
|
||||
{"blue_red" , c_blue_red},
|
||||
{"cyan_red" , c_cyan_red},
|
||||
{"magenta_red" , c_magenta_red},
|
||||
{"brown_red" , c_brown_red},
|
||||
{"ltred_red" , c_ltred_red},
|
||||
{"light_red_red" , c_ltred_red},
|
||||
{"ltgreen_red" , c_ltgreen_red},
|
||||
{"light_green_red" , c_ltgreen_red},
|
||||
{"ltblue_red" , c_ltblue_red},
|
||||
{"light_blue_red" , c_ltblue_red},
|
||||
{"ltcyan_red" , c_ltcyan_red},
|
||||
{"light_cyan_red" , c_ltcyan_red},
|
||||
{"pink_red" , c_pink_red},
|
||||
{"yellow_red" , c_yellow_red},
|
||||
|
||||
{"unset" , c_unset},
|
||||
|
||||
{"black_white" , c_black_white},
|
||||
{"dkgray_white" , c_dkgray_white},
|
||||
{"ltgray_white" , c_ltgray_white},
|
||||
{"white_white" , c_white_white},
|
||||
{"red_white" , c_red_white},
|
||||
{"ltred_white" , c_ltred_white},
|
||||
{"green_white" , c_green_white},
|
||||
{"ltgreen_white" , c_ltgreen_white},
|
||||
{"brown_white" , c_brown_white},
|
||||
{"yellow_white" , c_yellow_white},
|
||||
{"blue_white" , c_blue_white},
|
||||
{"ltblue_white" , c_ltblue_white},
|
||||
{"magenta_white" , c_magenta_white},
|
||||
{"pink_white" , c_pink_white},
|
||||
{"cyan_white" , c_cyan_white},
|
||||
{"ltcyan_white" , c_ltcyan_white},
|
||||
|
||||
{"black_green" , c_black_green},
|
||||
{"dkgray_green" , c_dkgray_green},
|
||||
{"ltgray_green" , c_ltgray_green},
|
||||
{"white_green" , c_white_green},
|
||||
{"red_green" , c_red_green},
|
||||
{"ltred_green" , c_ltred_green},
|
||||
{"green_green" , c_green_green},
|
||||
{"ltgreen_green" , c_ltgreen_green},
|
||||
{"brown_green" , c_brown_green},
|
||||
{"yellow_green" , c_yellow_green},
|
||||
{"blue_green" , c_blue_green},
|
||||
{"ltblue_green" , c_ltblue_green},
|
||||
{"magenta_green" , c_magenta_green},
|
||||
{"pink_green" , c_pink_green},
|
||||
{"cyan_green" , c_cyan_green},
|
||||
{"ltcyan_green" , c_ltcyan_green},
|
||||
{"black_yellow" , c_black_yellow},
|
||||
{"dkgray_yellow" , c_dkgray_yellow},
|
||||
{"ltgray_yellow" , c_ltgray_yellow},
|
||||
{"white_yellow" , c_white_yellow},
|
||||
{"red_yellow" , c_red_yellow},
|
||||
{"ltred_yellow" , c_ltred_yellow},
|
||||
{"green_yellow" , c_green_yellow},
|
||||
{"ltgreen_yellow" , c_ltgreen_yellow},
|
||||
{"brown_yellow" , c_brown_yellow},
|
||||
{"yellow_yellow" , c_yellow_yellow},
|
||||
{"blue_yellow" , c_blue_yellow},
|
||||
{"ltblue_yellow" , c_ltblue_yellow},
|
||||
{"magenta_yellow" , c_magenta_yellow},
|
||||
{"pink_yellow" , c_pink_yellow},
|
||||
{"cyan_yellow" , c_cyan_yellow},
|
||||
{"ltcyan_yellow" , c_ltcyan_yellow},
|
||||
{"black_magenta" , c_black_magenta},
|
||||
{"dkgray_magenta" , c_dkgray_magenta},
|
||||
{"ltgray_magenta" , c_ltgray_magenta},
|
||||
{"white_magenta" , c_white_magenta},
|
||||
{"red_magenta" , c_red_magenta},
|
||||
{"ltred_magenta" , c_ltred_magenta},
|
||||
{"green_magenta" , c_green_magenta},
|
||||
{"ltgreen_magenta" , c_ltgreen_magenta},
|
||||
{"brown_magenta" , c_brown_magenta},
|
||||
{"yellow_magenta" , c_yellow_magenta},
|
||||
{"blue_magenta" , c_blue_magenta},
|
||||
{"ltblue_magenta" , c_ltblue_magenta},
|
||||
{"magenta_magenta" , c_magenta_magenta},
|
||||
{"pink_magenta" , c_pink_magenta},
|
||||
{"cyan_magenta" , c_cyan_magenta},
|
||||
{"ltcyan_magenta" , c_ltcyan_magenta},
|
||||
{"black_cyan" , c_black_cyan},
|
||||
{"dkgray_cyan" , c_dkgray_cyan},
|
||||
{"ltgray_cyan" , c_ltgray_cyan},
|
||||
{"white_cyan" , c_white_cyan},
|
||||
{"red_cyan" , c_red_cyan},
|
||||
{"ltred_cyan" , c_ltred_cyan},
|
||||
{"green_cyan" , c_green_cyan},
|
||||
{"ltgreen_cyan" , c_ltgreen_cyan},
|
||||
{"brown_cyan" , c_brown_cyan},
|
||||
{"yellow_cyan" , c_yellow_cyan},
|
||||
{"blue_cyan" , c_blue_cyan},
|
||||
{"ltblue_cyan" , c_ltblue_cyan},
|
||||
{"magenta_cyan" , c_magenta_cyan},
|
||||
{"pink_cyan" , c_pink_cyan},
|
||||
{"cyan_cyan" , c_cyan_cyan},
|
||||
{"ltcyan_cyan" , c_ltcyan_cyan}
|
||||
};
|
||||
|
||||
/**
|
||||
* Given the name of a color, returns the nc_color constant that matches. If
|
||||
* no match is found, c_white is returned.
|
||||
* @param new_color The color to get, as a std::string.
|
||||
* @return The nc_color constant that matches the input.
|
||||
*/
|
||||
nc_color color_from_string(std::string const &new_color)
|
||||
{
|
||||
auto const it = colormap.find(new_color);
|
||||
if (it != std::end(colormap)) {
|
||||
return it->second;
|
||||
nc_color color_from_string(std::string new_color){
|
||||
if("red"==new_color){
|
||||
return c_red;
|
||||
} else if("blue"==new_color){
|
||||
return c_blue;
|
||||
} else if("green"==new_color){
|
||||
return c_green;
|
||||
} else if("light_cyan"==new_color || "ltcyan"==new_color){
|
||||
return c_ltcyan;
|
||||
} else if("brown"==new_color){
|
||||
return c_brown;
|
||||
} else if("light_red"==new_color || "ltred"==new_color){
|
||||
return c_ltred;
|
||||
} else if("white"==new_color){
|
||||
return c_white;
|
||||
} else if("black"==new_color){
|
||||
return c_black;
|
||||
} else if("light_blue"==new_color || "ltblue"==new_color){
|
||||
return c_ltblue;
|
||||
} else if("yellow"==new_color){
|
||||
return c_yellow;
|
||||
} else if("magenta"==new_color){
|
||||
return c_magenta;
|
||||
} else if("cyan"==new_color){
|
||||
return c_cyan;
|
||||
} else if("light_gray"==new_color || "ltgray"==new_color){
|
||||
return c_ltgray;
|
||||
} else if("dark_gray"==new_color || "dkgray"==new_color){
|
||||
return c_dkgray;
|
||||
} else if("light_green"==new_color || "ltgreen"==new_color){
|
||||
return c_ltgreen;
|
||||
} else if("pink"==new_color){
|
||||
return c_pink;
|
||||
} else if("white_red"==new_color){
|
||||
return c_white_red;
|
||||
} else if("ltgray_red"==new_color || "light_gray_red"==new_color){
|
||||
return c_ltgray_red;
|
||||
} else if("dkgray_red"==new_color || "dark_gray_red"==new_color){
|
||||
return c_dkgray_red;
|
||||
} else if("red_red"==new_color){
|
||||
return c_red_red;
|
||||
} else if("green_red"==new_color){
|
||||
return c_green_red;
|
||||
} else if("blue_red"==new_color){
|
||||
return c_blue_red;
|
||||
} else if("cyan_red"==new_color){
|
||||
return c_cyan_red;
|
||||
} else if("magenta_red"==new_color){
|
||||
return c_magenta_red;
|
||||
} else if("brown_red"==new_color){
|
||||
return c_brown_red;
|
||||
} else if("ltred_red"==new_color || "light_red_red"==new_color){
|
||||
return c_ltred_red;
|
||||
} else if("ltgreen_red"==new_color || "light_green_red"==new_color){
|
||||
return c_ltgreen_red;
|
||||
} else if("ltblue_red"==new_color || "light_blue_red"==new_color){
|
||||
return c_ltblue_red;
|
||||
} else if("ltcyan_red"==new_color || "light_cyan_red"==new_color){
|
||||
return c_ltcyan_red;
|
||||
} else if("pink_red"==new_color){
|
||||
return c_pink_red;
|
||||
} else if("yellow_red"==new_color){
|
||||
return c_yellow_red;
|
||||
} else {
|
||||
return c_white;
|
||||
}
|
||||
|
||||
debugmsg("couldn't parse color: %s", new_color.c_str());
|
||||
return c_unset;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reverse of color_from_string.
|
||||
*/
|
||||
std::string const& string_from_color(nc_color const color)
|
||||
{
|
||||
using pair_t = decltype(colormap)::value_type;
|
||||
auto const it = std::find_if(begin(colormap), end(colormap), [color](pair_t const &p) {
|
||||
return p.second == color;
|
||||
});
|
||||
|
||||
if (it != std::end(colormap)) {
|
||||
return it->first;
|
||||
}
|
||||
|
||||
static std::string const fallback {"white"};
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -982,8 +713,7 @@ std::string const& string_from_color(nc_color const color)
|
||||
* @param new_color The color to get, as a std::string.
|
||||
* @return The nc_color constant that matches the input.
|
||||
*/
|
||||
nc_color bgcolor_from_string(std::string const &new_color)
|
||||
{
|
||||
nc_color bgcolor_from_string(std::string new_color) {
|
||||
if("black" == new_color) {
|
||||
return i_black;
|
||||
} else if("white" == new_color) {
|
||||
@@ -1035,37 +765,3 @@ nc_color get_color_from_tag(const std::string &s, const nc_color base_color)
|
||||
return color_from_string(color_name);
|
||||
}
|
||||
|
||||
struct note_color {
|
||||
nc_color color;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
// The color codes are intentionally untranslatable.
|
||||
const std::map<std::string, note_color> color_shortcuts {
|
||||
{"br", {c_brown, _("brown")}}, {"lg", {c_ltgray, _("lt gray")}},
|
||||
{"dg", {c_dkgray, _("dk gray")}}, {"r", {c_ltred, _("lt red")}},
|
||||
{"R", {c_red, _("red")}}, {"g", {c_ltgreen, _("lt green")}},
|
||||
{"G", {c_green, _("green")}}, {"b", {c_ltblue, _("lt blue")}},
|
||||
{"B", {c_blue, _("blue")}}, {"W", {c_white, _("white")}},
|
||||
{"C", {c_cyan, _("cyan")}}, {"c", {c_ltcyan, _("lt cyan")}},
|
||||
{"P", {c_pink, _("pink")}}, {"m", {c_magenta, _("magenta")}}
|
||||
};
|
||||
|
||||
nc_color get_note_color(std::string const ¬e_id)
|
||||
{
|
||||
auto const candidate_color = color_shortcuts.find( note_id );
|
||||
if( candidate_color != std::end( color_shortcuts ) ) {
|
||||
return candidate_color->second.color;
|
||||
}
|
||||
// The default note color.
|
||||
return c_yellow;
|
||||
}
|
||||
|
||||
std::list<std::pair<std::string, std::string>> get_note_color_names()
|
||||
{
|
||||
std::list<std::pair<std::string, std::string>> color_list;
|
||||
for( auto const &color_pair : color_shortcuts ) {
|
||||
color_list.emplace_back( color_pair.first, color_pair.second.name );
|
||||
}
|
||||
return color_list;
|
||||
}
|
||||
+13
-14
@@ -1,11 +1,12 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
#ifndef _COLOR_H_
|
||||
#define _COLOR_H_
|
||||
|
||||
#ifndef _COLOR_LIST_
|
||||
#define _COLOR_LIST_
|
||||
|
||||
#include "json.h"
|
||||
#include "cursesdef.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
class JsonObject;
|
||||
|
||||
void init_colors();
|
||||
|
||||
@@ -15,7 +16,7 @@ HI = 1,
|
||||
INV = 2
|
||||
};
|
||||
|
||||
enum nc_color : int {
|
||||
enum nc_color {
|
||||
c_black = COLOR_PAIR(30),
|
||||
c_white = COLOR_PAIR(1) | A_BOLD,
|
||||
c_ltgray = COLOR_PAIR(1),
|
||||
@@ -50,10 +51,10 @@ h_ltcyan = COLOR_PAIR(19) | A_BOLD,
|
||||
h_pink = COLOR_PAIR(21) | A_BOLD,
|
||||
h_yellow = COLOR_PAIR(22) | A_BOLD,
|
||||
|
||||
i_black = COLOR_PAIR(32),
|
||||
i_black = COLOR_PAIR(30),
|
||||
i_white = COLOR_PAIR(8) | A_BLINK,
|
||||
i_ltgray = COLOR_PAIR(8),
|
||||
i_dkgray = COLOR_PAIR(32) | A_BLINK,
|
||||
i_dkgray = COLOR_PAIR(30) | A_BLINK,
|
||||
i_red = COLOR_PAIR(9),
|
||||
i_green = COLOR_PAIR(10),
|
||||
i_blue = COLOR_PAIR(11),
|
||||
@@ -181,15 +182,13 @@ nc_color magenta_background(nc_color c);
|
||||
nc_color cyan_background(nc_color c);
|
||||
nc_color rand_color();
|
||||
|
||||
nc_color color_from_string(std::string const &color);
|
||||
std::string const& string_from_color(nc_color color);
|
||||
nc_color bgcolor_from_string(std::string const &color);
|
||||
nc_color get_color_from_tag(const std::string &s, nc_color base_color);
|
||||
nc_color color_from_string(std::string color);
|
||||
nc_color bgcolor_from_string(std::string color);
|
||||
nc_color get_color_from_tag(const std::string &s, const nc_color base_color);
|
||||
|
||||
void setattr(nc_color &col, col_attribute attr);
|
||||
void load_colors(JsonObject &jo);
|
||||
|
||||
nc_color get_note_color(std::string const ¬e_id);
|
||||
std::list<std::pair<std::string, std::string>> get_note_color_names();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+673
-473
File diff suppressed because it is too large
Load Diff
+153
@@ -0,0 +1,153 @@
|
||||
#ifndef _COMPUTER_H_
|
||||
#define _COMPUTER_H_
|
||||
|
||||
#include "output.h"
|
||||
#include "json.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define DEFAULT_COMPUTER_NAME ""
|
||||
|
||||
class game;
|
||||
class player;
|
||||
|
||||
enum computer_action
|
||||
{
|
||||
COMPACT_NULL = 0,
|
||||
COMPACT_OPEN,
|
||||
COMPACT_LOCK,
|
||||
COMPACT_UNLOCK,
|
||||
COMPACT_TOLL,
|
||||
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_DATA_ANAL,
|
||||
COMPACT_DISCONNECT,
|
||||
COMPACT_STEMCELL_TREATMENT,
|
||||
COMPACT_EMERG_MESS,
|
||||
COMPACT_TOWER_UNRESPONSIVE,
|
||||
COMPACT_SR1_MESS, //Security Reminders for Hazardous Waste Sarcophagus (SRCF)
|
||||
COMPACT_SR2_MESS,
|
||||
COMPACT_SR3_MESS,
|
||||
COMPACT_SR4_MESS,
|
||||
COMPACT_SRCF_1_MESS,
|
||||
COMPACT_SRCF_2_MESS,
|
||||
COMPACT_SRCF_3_MESS,
|
||||
COMPACT_SRCF_SEAL_ORDER,
|
||||
COMPACT_SRCF_SEAL,
|
||||
COMPACT_SRCF_ELEVATOR,
|
||||
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,
|
||||
COMPFAIL_DESTROY_DATA,
|
||||
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(game *g, 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?
|
||||
|
||||
static void load_lab_note(JsonObject &jsobj);
|
||||
|
||||
private:
|
||||
// Difficulty of simply logging in
|
||||
int security;
|
||||
// Things we can do
|
||||
std::vector<computer_option> options;
|
||||
// Things that happen if we fail a hack
|
||||
std::vector<computer_failure> failures;
|
||||
// Output window
|
||||
WINDOW *w_terminal;
|
||||
// Pretty border
|
||||
WINDOW *w_border;
|
||||
// Misc research notes from json
|
||||
static std::vector<std::string> lab_notes;
|
||||
|
||||
// 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, ...);
|
||||
// Wraps and prints a block of text with a 1-space indent
|
||||
void print_text(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, ...);
|
||||
// Simply wait for any key, returns True
|
||||
bool query_any(const char *text, ...);
|
||||
// Move the cursor to the beginning of the next line
|
||||
void print_newline();
|
||||
};
|
||||
|
||||
#endif
|
||||
+1210
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
bool able_window(game *, point); // Any window tile#include <vector>
|
||||
#include <string>
|
||||
#include "crafting.h"
|
||||
struct construct;
|
||||
|
||||
struct construction_stage
|
||||
{
|
||||
ter_id terrain;
|
||||
furn_id furniture;
|
||||
int time; // In minutes, i.e. 10 turns
|
||||
std::vector<component> tools[10];
|
||||
std::vector<component> components[10];
|
||||
|
||||
construction_stage(ter_id Terrain, int Time) :
|
||||
terrain (Terrain), furniture(f_null), time (Time) { };
|
||||
construction_stage(furn_t Furniture, int Time) :
|
||||
terrain (t_null), furniture (Furniture.loadid), time (Time) { };
|
||||
construction_stage(int Time) :
|
||||
terrain (t_null), furniture (f_null), time (Time) { };
|
||||
};
|
||||
|
||||
struct constructable
|
||||
{
|
||||
int id;
|
||||
std::string name; // Name as displayed
|
||||
int difficulty; // Carpentry skill level required
|
||||
bool loopstages;
|
||||
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),
|
||||
bool LoopStages = false) :
|
||||
id (Id), name (Name), difficulty (Diff), loopstages (LoopStages), 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_make_window(game *, point); // Any window tile or empty
|
||||
bool able_empty_window(game *, point); // Empty window tiles
|
||||
bool able_window_pane(game *, point); // Only intact windows
|
||||
bool able_broken_window(game *, point); // Able if tile is broken window
|
||||
|
||||
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_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_trunk(game *, point); // Able on tree trunks
|
||||
|
||||
bool able_move(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_cart(game *, point);
|
||||
void done_tree(game *, point);
|
||||
void done_trunk_log(game *, point);
|
||||
void done_trunk_plank(game *, point);
|
||||
void done_move(game *, point);
|
||||
void done_tape(game *, point);
|
||||
void done_deconstruct(game *, point);
|
||||
|
||||
};
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
#ifndef _COORDINATES_H_
|
||||
#define _COORDINATES_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "mapdata.h"
|
||||
#include "overmap.h"
|
||||
|
||||
/* find appropriate subdivided coordinates for absolute tile coordinate.
|
||||
* This is less obvious than one might think, for negative coordinates, so this
|
||||
* was created to give a definitive answer.
|
||||
*
|
||||
* 'absolute' is defined as the -actual- submap x,y * 12 + position in submap, and
|
||||
* can be obtained from map.getabs(x, y);
|
||||
* usage:
|
||||
* real_coords rc( g->m.getabs(g->u.posx, g->u.posy ) );
|
||||
*/
|
||||
struct real_coords {
|
||||
static const int tiles_in_sub = SEEX;
|
||||
static const int tiles_in_sub_n = tiles_in_sub - 1;
|
||||
static const int subs_in_om = OMAPX * 2;
|
||||
static const int subs_in_om_n = subs_in_om - 1;
|
||||
|
||||
point abs_pos; // 1 per tile, starting from tile 0,0 of submap 0,0 of overmap 0,0
|
||||
point abs_sub; // submap: 12 tiles.
|
||||
point abs_om; // overmap: 360 submaps.
|
||||
|
||||
point sub_pos; // coordinate (0-11) in submap / abs_pos constrained to % 12.
|
||||
|
||||
point om_pos; // overmap tile: 2x2 submaps.
|
||||
point om_sub; // submap (0-359) in overmap / abs_sub constrained to % 360. equivalent to g->levx
|
||||
|
||||
real_coords() {
|
||||
}
|
||||
|
||||
real_coords(point ap) {
|
||||
fromabs( ap.x, ap.y );
|
||||
}
|
||||
|
||||
void fromabs(const int absx, const int absy) {
|
||||
const int normx = abs(absx);
|
||||
const int normy = abs(absy);
|
||||
abs_pos = point(absx, absy);
|
||||
|
||||
if ( absx < 0 ) {
|
||||
abs_sub.x = (absx-11)/12;
|
||||
sub_pos.x = 11-((normx-1) % 12);
|
||||
abs_om.x = (abs_sub.x-subs_in_om_n)/subs_in_om;
|
||||
om_sub.x = subs_in_om_n-(((normx-1)/12) % subs_in_om);
|
||||
} else {
|
||||
abs_sub.x = normx/12;
|
||||
sub_pos.x = absx % 12;
|
||||
abs_om.x = abs_sub.x/subs_in_om;
|
||||
om_sub.x = abs_sub.x % subs_in_om;
|
||||
}
|
||||
om_pos.x = om_sub.x / 2;
|
||||
|
||||
if ( absy < 0 ) {
|
||||
abs_sub.y = (absy-11)/12;
|
||||
sub_pos.y = 11-((normy-1) % 12);
|
||||
abs_om.y = (abs_sub.y-subs_in_om_n)/subs_in_om;
|
||||
om_sub.y = subs_in_om_n-(((normy-1)/12) % subs_in_om);
|
||||
} else {
|
||||
abs_sub.y = normy/12;
|
||||
sub_pos.y = absy % 12;
|
||||
abs_om.y = abs_sub.y/subs_in_om;
|
||||
om_sub.y = abs_sub.y % subs_in_om;
|
||||
}
|
||||
om_pos.y = om_sub.y / 2;
|
||||
}
|
||||
|
||||
void fromabs(point absolute) {
|
||||
fromabs(absolute.x, absolute.y);
|
||||
}
|
||||
|
||||
// specifically for the subjective position returned by overmap::draw
|
||||
void fromomap( int rel_omx, int rel_omy, int rel_om_posx, int rel_om_posy ) {
|
||||
int ax=(rel_omx*OMAPX) + rel_om_posx;
|
||||
int ay=(rel_omy*OMAPY) + rel_om_posy;
|
||||
fromabs(ax*24, ay*24);
|
||||
}
|
||||
|
||||
// helper functions to return abs_pos of submap/overmap tile/overmap's start
|
||||
|
||||
point begin_sub() {
|
||||
return point( abs_sub.x * tiles_in_sub, abs_sub.y * tiles_in_sub );
|
||||
}
|
||||
point begin_om_pos() {
|
||||
return point( (abs_om.x * subs_in_om * tiles_in_sub) + ( om_pos.x * 2 * tiles_in_sub ),
|
||||
(abs_om.y * subs_in_om * tiles_in_sub) + ( om_pos.y * 2 * tiles_in_sub ) );
|
||||
}
|
||||
point begin_om() {
|
||||
return point( abs_om.x * subs_in_om * tiles_in_sub, abs_om.y * subs_in_om * tiles_in_sub);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
+1693
File diff suppressed because it is too large
Load Diff
+122
@@ -0,0 +1,122 @@
|
||||
#ifndef _CRAFTING_H_
|
||||
#define _CRAFTING_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "itype.h"
|
||||
#include "skill.h"
|
||||
#include "rng.h"
|
||||
#include "json.h"
|
||||
|
||||
#define MAX_DISPLAYED_RECIPES 18
|
||||
|
||||
typedef std::string craft_cat;
|
||||
|
||||
struct component
|
||||
{
|
||||
itype_id type;
|
||||
int count;
|
||||
int available; // -1 means the player doesn't have the item, 1 means they do,
|
||||
// 0 means they have item but not enough for both tool and component
|
||||
component() { type = "null"; count = 0; available = -1;}
|
||||
component(itype_id TYPE, int COUNT) : type (TYPE), count (COUNT), available(-1) {}
|
||||
};
|
||||
|
||||
struct quality_requirement
|
||||
{
|
||||
std::string id;
|
||||
int count;
|
||||
bool available;
|
||||
int level;
|
||||
|
||||
quality_requirement() { id = "UNKNOWN"; count = 0; available = false; level = 0;}
|
||||
quality_requirement(std::string new_id, int new_count, int new_level){
|
||||
id = new_id;
|
||||
count = new_count;
|
||||
level = new_level;
|
||||
available = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct quality
|
||||
{
|
||||
std::string id;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct recipe {
|
||||
std::string ident;
|
||||
int id;
|
||||
itype_id result;
|
||||
craft_cat cat;
|
||||
Skill *skill_used;
|
||||
std::map<Skill*,int> required_skills;
|
||||
int difficulty;
|
||||
int time;
|
||||
bool reversible; // can the item be disassembled?
|
||||
bool autolearn; // do we learn it just by leveling skills?
|
||||
int learn_by_disassembly; // what level (if any) do we learn it by disassembly?
|
||||
|
||||
std::vector<std::vector<component> > tools;
|
||||
std::vector<quality_requirement> qualities;
|
||||
std::vector<std::vector<component> > components;
|
||||
|
||||
//Create a string list to describe the skill requirements fir this recipe
|
||||
// Format: skill_name(amount), skill_name(amount)
|
||||
std::string required_skills_string(){
|
||||
std::ostringstream skills_as_stream;
|
||||
if(!required_skills.empty()){
|
||||
for(std::map<Skill*,int>::iterator iter=required_skills.begin(); iter!=required_skills.end();){
|
||||
skills_as_stream << iter->first->name() << "(" << iter->second << ")";
|
||||
++iter;
|
||||
if(iter != required_skills.end()){
|
||||
skills_as_stream << ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
skills_as_stream << "N/A";
|
||||
}
|
||||
return skills_as_stream.str();
|
||||
}
|
||||
|
||||
recipe() {
|
||||
id = 0;
|
||||
result = "null";
|
||||
skill_used = NULL;
|
||||
difficulty = 0;
|
||||
time = 0;
|
||||
reversible = false;
|
||||
autolearn = false;
|
||||
learn_by_disassembly = -1;
|
||||
}
|
||||
|
||||
recipe(std::string pident, int pid, itype_id pres, craft_cat pcat, std::string &to_use,
|
||||
std::map<std::string,int> &to_require, int pdiff, int ptime, bool preversible, bool pautolearn,
|
||||
int plearn_dis) :
|
||||
ident (pident), id (pid), result (pres), cat(pcat), difficulty (pdiff), time (ptime),
|
||||
reversible (preversible), autolearn (pautolearn), learn_by_disassembly (plearn_dis) {
|
||||
skill_used = to_use.size()?Skill::skill(to_use):NULL;
|
||||
if(!to_require.empty()){
|
||||
for(std::map<std::string,int>::iterator iter=to_require.begin(); iter!=to_require.end(); ++iter){
|
||||
required_skills[Skill::skill(iter->first)] = iter->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<recipe*> recipe_list;
|
||||
typedef std::map<craft_cat, recipe_list> recipe_map;
|
||||
|
||||
void load_recipe_category(JsonObject &jsobj);
|
||||
void load_recipe(JsonObject &jsobj);
|
||||
recipe* recipe_by_name(std::string name);
|
||||
void finalize_recipes();
|
||||
|
||||
extern recipe_map recipes; // The list of valid recipes
|
||||
|
||||
void load_quality(JsonObject &jo);
|
||||
extern std::map<std::string,quality> qualities;
|
||||
|
||||
#endif
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#ifndef _CURSES_DEF_H_
|
||||
#define _CURSES_DEF_H_
|
||||
|
||||
#if (defined TILES || defined SDLTILES || defined _WIN32 || defined WINDOWS)
|
||||
#include "catacurse.h"
|
||||
#elif (defined __CYGWIN__)
|
||||
#include "input_defs.h"
|
||||
#include "ncurses/curses.h"
|
||||
#else
|
||||
#include "input_defs.h"
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#endif // CURSES_DEF_H
|
||||
+162
-200
@@ -4,26 +4,6 @@
|
||||
#include "color.h"
|
||||
#include "catacharset.h"
|
||||
|
||||
#include <cstring> // strlen
|
||||
|
||||
/**
|
||||
* Whoever cares, btw. not my base design, but this is how it works:
|
||||
* In absent of a native curses library, this is a simple implementation to
|
||||
* store the data that would be given to the curses system.
|
||||
* It is later displayed using code in sdltiles.cpp. This file only contains
|
||||
* the curses interface.
|
||||
*
|
||||
* The struct WINDOW is the base. It acts as the normal curses window, having
|
||||
* width/height, current cursor location, current coloring (background/foreground)
|
||||
* and the actual text.
|
||||
* The text is split into lines (curseline), which contains cells (cursecell).
|
||||
* Each cell has individual foreground and background, and a character. The
|
||||
* character is an UTF-8 encoded string. It should be one or two console cells
|
||||
* width. If it's two cells width, the next cell in the line must be completely
|
||||
* empty (the string must not contain anything). Also the last cell of a line
|
||||
* must not contain a two cell width string.
|
||||
*/
|
||||
|
||||
//***********************************
|
||||
//Globals *
|
||||
//***********************************
|
||||
@@ -58,6 +38,7 @@ WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
|
||||
nlines = TERMY - begin_y;
|
||||
}
|
||||
|
||||
int i, j;
|
||||
WINDOW *newwindow = new WINDOW;
|
||||
newwindow->x = begin_x;
|
||||
newwindow->y = begin_y;
|
||||
@@ -69,11 +50,22 @@ WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
|
||||
newwindow->FG = 8;
|
||||
newwindow->cursorx = 0;
|
||||
newwindow->cursory = 0;
|
||||
newwindow->line.resize(nlines);
|
||||
newwindow->line = new curseline[nlines];
|
||||
|
||||
for (int j = 0; j < nlines; j++) {
|
||||
newwindow->line[j].chars.resize(ncols);
|
||||
for (j = 0; j < nlines; j++) {
|
||||
newwindow->line[j].chars = new char[ncols * 4];
|
||||
newwindow->line[j].FG = new char[ncols];
|
||||
newwindow->line[j].BG = new char[ncols];
|
||||
newwindow->line[j].touched = true; //Touch them all !?
|
||||
newwindow->line[j].width_in_bytes = ncols;
|
||||
for (i = 0; i < ncols; i++) {
|
||||
newwindow->line[j].chars[i] = 0;
|
||||
newwindow->line[j].chars[i + 1] = 0;
|
||||
newwindow->line[j].chars[i + 2] = 0;
|
||||
newwindow->line[j].chars[i + 3] = 0;
|
||||
newwindow->line[j].FG[i] = 0;
|
||||
newwindow->line[j].BG[i] = 0;
|
||||
}
|
||||
}
|
||||
return newwindow;
|
||||
}
|
||||
@@ -81,9 +73,15 @@ WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
|
||||
//Deletes the window and marks it as free. Clears it just in case.
|
||||
int delwin(WINDOW *win)
|
||||
{
|
||||
if (win == NULL) {
|
||||
return 1;
|
||||
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;
|
||||
}
|
||||
@@ -98,13 +96,11 @@ inline int newline(WINDOW *win)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// move the cursor a single cell, jumps to the next line if the
|
||||
// end of a line has been reached, also sets the touched flag.
|
||||
inline void addedchar(WINDOW *win)
|
||||
{
|
||||
win->cursorx++;
|
||||
win->line[win->cursory].touched = true;
|
||||
if (win->cursorx >= win->width) {
|
||||
if (win->cursorx > win->width) {
|
||||
newline(win);
|
||||
}
|
||||
}
|
||||
@@ -114,6 +110,10 @@ inline void addedchar(WINDOW *win)
|
||||
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr,
|
||||
chtype bl, chtype br)
|
||||
{
|
||||
/*
|
||||
ncurses does not do this, and this prevents: wattron(win, c_customBordercolor); wborder(win, ...); wattroff(win, c_customBorderColor);
|
||||
wattron(win, c_white);
|
||||
*/
|
||||
int i, j;
|
||||
int oldx = win->cursorx; //methods below move the cursor, save the value!
|
||||
int oldy = win->cursory; //methods below move the cursor, save the value!
|
||||
@@ -220,7 +220,6 @@ int mvvline(int y, int x, chtype ch, int n)
|
||||
|
||||
int mvwhline(WINDOW *win, int y, int x, chtype ch, int n)
|
||||
{
|
||||
wattron(win, BORDER_COLOR);
|
||||
if (ch) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
mvwaddch(win, y, x + i, ch);
|
||||
@@ -230,13 +229,12 @@ int mvwhline(WINDOW *win, int y, int x, chtype ch, int n)
|
||||
mvwaddch(win, y, x + i, LINE_OXOX);
|
||||
}
|
||||
}
|
||||
wattroff(win, BORDER_COLOR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mvwvline(WINDOW *win, int y, int x, chtype ch, int n)
|
||||
{
|
||||
wattron(win, BORDER_COLOR);
|
||||
if (ch) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
mvwaddch(win, y + j, x, ch);
|
||||
@@ -246,7 +244,7 @@ int mvwvline(WINDOW *win, int y, int x, chtype ch, int n)
|
||||
mvwaddch(win, y + j, x, LINE_XOXO);
|
||||
}
|
||||
}
|
||||
wattroff(win, BORDER_COLOR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -325,135 +323,64 @@ int getnstr(char *str, int size)
|
||||
return count;
|
||||
}
|
||||
|
||||
// Get a sequence of Unicode code points, store them in target
|
||||
// return the display width of the extracted string.
|
||||
inline int fill(char *&fmt, int &len, std::string &target)
|
||||
{
|
||||
char *const start = fmt;
|
||||
int dlen = 0; // display width
|
||||
const char *tmpptr = fmt; // pointer for UTF8_getch, which increments it
|
||||
int tmplen = len;
|
||||
while( tmplen > 0 ) {
|
||||
const unsigned ch = UTF8_getch(&tmpptr, &tmplen);
|
||||
// UNKNOWN_UNICODE is most likely a (vertical/horizontal) line or similar
|
||||
const int cw = (ch == UNKNOWN_UNICODE) ? 1 : mk_wcwidth(ch);
|
||||
if( cw > 0 && dlen > 0 ) {
|
||||
// Stop at the *second* non-zero-width character
|
||||
break;
|
||||
} else if( cw == -1 && start == fmt ) {
|
||||
// First char is a control character: they only disturb the screen,
|
||||
// so replace it with a single space (e.g. instead of a '\t').
|
||||
// Newlines at the begin of a sequence are handled in printstring
|
||||
target.assign( " ", 1 );
|
||||
len = tmplen;
|
||||
fmt = const_cast<char *>(tmpptr);
|
||||
return 1; // the space
|
||||
} else if( cw == -1 ) {
|
||||
// Control character but behind some other characters, finish the sequence.
|
||||
// The character will either by handled by printstring (if it's a newline),
|
||||
// or by the next call to this function (replaced with a space).
|
||||
break;
|
||||
}
|
||||
fmt = const_cast<char *>(tmpptr);
|
||||
dlen += cw;
|
||||
}
|
||||
target.assign(start, fmt - start);
|
||||
len -= target.length();
|
||||
return dlen;
|
||||
}
|
||||
|
||||
// The current cell of the window, pointed to by the cursor. The next character
|
||||
// written to that window should go in this cell.
|
||||
// Returns nullptr if the cursor is invalid (outside the window).
|
||||
inline cursecell *cur_cell(WINDOW *win)
|
||||
{
|
||||
if( win->cursory >= win->height || win->cursorx >= win->width ) {
|
||||
return nullptr;
|
||||
}
|
||||
return &(win->line[win->cursory].chars[win->cursorx]);
|
||||
}
|
||||
|
||||
//The core printing function, prints characters to the array, and sets colors
|
||||
inline int printstring(WINDOW *win, char *fmt)
|
||||
{
|
||||
win->draw = true;
|
||||
int len = strlen(fmt);
|
||||
if( len == 0 ) {
|
||||
return 1;
|
||||
}
|
||||
// avoid having an invalid cursorx, so that cur_cell will only return nullptr
|
||||
// when the bottom of the window has been reached.
|
||||
if( win->cursorx >= win->width ) {
|
||||
if( newline( win ) == 0 ) {
|
||||
return 0;
|
||||
int size = strlen(fmt);
|
||||
if(size > 0) {
|
||||
int j, i, p = win->cursorx;
|
||||
int x = (win->line[win->cursory].width_in_bytes == win->width) ? win->cursorx : cursorx_to_position(
|
||||
win->line[win->cursory].chars, win->cursorx, &p);
|
||||
|
||||
if(p != x) { //so we start inside a wide character, erase it for good
|
||||
const char *ts = win->line[win->cursory].chars + p;
|
||||
int len = ANY_LENGTH;
|
||||
unsigned tc = UTF8_getch(&ts, &len);
|
||||
int tw = mk_wcwidth(tc);
|
||||
erease_utf8_by_cw(win->line[win->cursory].chars + p, tw, tw, win->width * 4 - p - 1);
|
||||
x = p + tw - 1;
|
||||
}
|
||||
}
|
||||
if( win->cursory >= win->height || win->cursorx >= win->width ) {
|
||||
return 0;
|
||||
}
|
||||
if( win->cursorx > 0 && win->line[win->cursory].chars[win->cursorx].ch.empty() ) {
|
||||
// start inside a wide character, erase it for good
|
||||
win->line[win->cursory].chars[win->cursorx - 1].ch.assign(" ");
|
||||
}
|
||||
while( len > 0 ) {
|
||||
if( *fmt == '\n' ) {
|
||||
if( newline(win) == 0 ) {
|
||||
return 0;
|
||||
}
|
||||
fmt++;
|
||||
len--;
|
||||
continue;
|
||||
}
|
||||
cursecell *curcell = cur_cell( win );
|
||||
if( curcell == nullptr ) {
|
||||
return 0;
|
||||
}
|
||||
const int dlen = fill(fmt, len, curcell->ch);
|
||||
if( dlen >= 1 ) {
|
||||
curcell->FG = win->FG;
|
||||
curcell->BG = win->BG;
|
||||
addedchar( win );
|
||||
}
|
||||
if( dlen == 1 ) {
|
||||
// a wide character was converted to a narrow character leaving a null in the
|
||||
// following cell ~> clear it
|
||||
cursecell *seccell = cur_cell( win );
|
||||
if (seccell && seccell->ch.empty()) {
|
||||
seccell->ch.assign(' ', 1);
|
||||
}
|
||||
} else if( dlen == 2 ) {
|
||||
// the second cell, per definition must be empty
|
||||
cursecell *seccell = cur_cell( win );
|
||||
if( seccell == nullptr ) {
|
||||
// the previous cell was valid, this one is outside of the window
|
||||
// --> the previous was the last cell of the last line
|
||||
// --> there should not be a two-cell width character in the last cell
|
||||
curcell->ch.assign(' ', 1);
|
||||
return 0;
|
||||
}
|
||||
seccell->FG = win->FG;
|
||||
seccell->BG = win->BG;
|
||||
seccell->ch.erase();
|
||||
addedchar( win );
|
||||
// Have just written a wide-character into the last cell, it would not
|
||||
// display correctly if it was the last *cell* of a line
|
||||
if( win->cursorx == 1 ) {
|
||||
// So make that last cell a space, move the width
|
||||
// character in the first cell of the line
|
||||
seccell->ch = curcell->ch;
|
||||
curcell->ch.assign(1, ' ');
|
||||
// and make the second cell on the new line empty.
|
||||
addedchar( win );
|
||||
cursecell *thicell = cur_cell( win );
|
||||
if( thicell != nullptr ) {
|
||||
thicell->ch.erase();
|
||||
for (j = 0; j < size; j++) {
|
||||
if (!(fmt[j] == 10)) { //check that this isnt a newline char
|
||||
const char *utf8str = fmt + j;
|
||||
int len = ANY_LENGTH;
|
||||
unsigned ch = UTF8_getch(&utf8str, &len);
|
||||
int cw = mk_wcwidth(ch);
|
||||
len = ANY_LENGTH - len;
|
||||
if(cw < 1) {
|
||||
cw = 1;
|
||||
}
|
||||
if(len < 1) {
|
||||
len = 1;
|
||||
}
|
||||
if (win->cursorx + cw <= win->width && win->cursory <= win->height - 1) {
|
||||
win->line[win->cursory].width_in_bytes += erease_utf8_by_cw(win->line[win->cursory].chars + x, cw,
|
||||
len, win->width * 4 - x - 1);
|
||||
for(i = 0; i < len; i++) {
|
||||
win->line[win->cursory].chars[x + i] = fmt[j + i];
|
||||
}
|
||||
for(i = 0; i < cw; i++) {
|
||||
win->line[win->cursory].FG[win->cursorx] = win->FG;
|
||||
win->line[win->cursory].BG[win->cursorx] = win->BG;
|
||||
addedchar(win);
|
||||
}
|
||||
win->line[win->cursory].touched = true;
|
||||
j += len - 1;
|
||||
x += len;
|
||||
} else if (win->cursory <= win->height - 1) {
|
||||
// don't write outside the window, but don't abort if there are still lines to write.
|
||||
} else {
|
||||
return 0; //if we try and write anything outside the window, abort completely
|
||||
}
|
||||
} else {// if the character is a newline, make sure to move down a line
|
||||
if (newline(win) == 0) {
|
||||
return 0;
|
||||
}
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
if( win->cursory >= win->height ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
win->draw = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -510,9 +437,18 @@ int printw(const char *fmt, ...)
|
||||
//erases a window of all text and attributes
|
||||
int werase(WINDOW *win)
|
||||
{
|
||||
for (int j = 0; j < win->height; j++) {
|
||||
win->line[j].chars.assign(win->width, cursecell());
|
||||
int j, i;
|
||||
for (j = 0; j < win->height; j++) {
|
||||
for (i = 0; i < win->width; i++) {
|
||||
win->line[j].chars[i] = 0;
|
||||
win->line[j].chars[i + 1] = 0;
|
||||
win->line[j].chars[i + 2] = 0;
|
||||
win->line[j].chars[i + 3] = 0;
|
||||
win->line[j].FG[i] = 0;
|
||||
win->line[j].BG[i] = 0;
|
||||
}
|
||||
win->line[j].touched = true;
|
||||
win->line[j].width_in_bytes = win->width;
|
||||
}
|
||||
win->draw = true;
|
||||
wmove(win, 0, 0);
|
||||
@@ -585,8 +521,8 @@ int wclear(WINDOW *win)
|
||||
|
||||
int clearok(WINDOW *win)
|
||||
{
|
||||
for (int i = 0; i < win->y && i < stdscr->height; i++) {
|
||||
stdscr->line[i].touched = true;
|
||||
for (int i = 0; i < win->y; i++) {
|
||||
win->line[i].touched = true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -632,7 +568,7 @@ int start_color(void)
|
||||
return curses_start_color();
|
||||
}
|
||||
|
||||
int keypad(WINDOW *, bool)
|
||||
int keypad(WINDOW *faux, bool bf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -641,11 +577,11 @@ int cbreak(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int keypad(int, bool)
|
||||
int keypad(int faux, bool bf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int curs_set(int)
|
||||
int curs_set(int visibility)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -670,7 +606,7 @@ int wattron(WINDOW *win, int attrs)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int wattroff(WINDOW *win, int)
|
||||
int wattroff(WINDOW *win, int attrs)
|
||||
{
|
||||
win->FG = 8; //reset to white
|
||||
win->BG = 0; //reset to black
|
||||
@@ -690,45 +626,71 @@ int waddch(WINDOW *win, const chtype ch)
|
||||
charcode = ch;
|
||||
|
||||
switch (ch) { //LINE_NESW - X for on, O for off
|
||||
case LINE_XOXO:
|
||||
charcode = LINE_XOXO_C;
|
||||
break;
|
||||
case LINE_OXOX:
|
||||
charcode = LINE_OXOX_C;
|
||||
break;
|
||||
case LINE_XXOO:
|
||||
charcode = LINE_XXOO_C;
|
||||
break;
|
||||
case LINE_OXXO:
|
||||
charcode = LINE_OXXO_C;
|
||||
break;
|
||||
case LINE_OOXX:
|
||||
charcode = LINE_OOXX_C;
|
||||
break;
|
||||
case LINE_XOOX:
|
||||
charcode = LINE_XOOX_C;
|
||||
break;
|
||||
case LINE_XXOX:
|
||||
charcode = LINE_XXOX_C;
|
||||
break;
|
||||
case LINE_XXXO:
|
||||
charcode = LINE_XXXO_C;
|
||||
break;
|
||||
case LINE_XOXX:
|
||||
charcode = LINE_XOXX_C;
|
||||
break;
|
||||
case LINE_OXXX:
|
||||
charcode = LINE_OXXX_C;
|
||||
break;
|
||||
case LINE_XXXX:
|
||||
charcode = LINE_XXXX_C;
|
||||
break;
|
||||
default:
|
||||
charcode = (char)ch;
|
||||
break;
|
||||
case LINE_XOXO: //#define LINE_XOXO 4194424
|
||||
charcode = LINE_XOXO_C;
|
||||
break;
|
||||
case LINE_OXOX: //#define LINE_OXOX 4194417
|
||||
charcode = LINE_OXOX_C;
|
||||
break;
|
||||
case LINE_XXOO: //#define LINE_XXOO 4194413
|
||||
charcode = LINE_XXOO_C;
|
||||
break;
|
||||
case LINE_OXXO: //#define LINE_OXXO 4194412
|
||||
charcode = LINE_OXXO_C;
|
||||
break;
|
||||
case LINE_OOXX: //#define LINE_OOXX 4194411
|
||||
charcode = LINE_OOXX_C;
|
||||
break;
|
||||
case LINE_XOOX: //#define LINE_XOOX 4194410
|
||||
charcode = LINE_XOOX_C;
|
||||
break;
|
||||
case LINE_XXOX: //#define LINE_XXOX 4194422
|
||||
charcode = LINE_XXOX_C;
|
||||
break;
|
||||
case LINE_XXXO: //#define LINE_XXXO 4194420
|
||||
charcode = LINE_XXXO_C;
|
||||
break;
|
||||
case LINE_XOXX: //#define LINE_XOXX 4194421
|
||||
charcode = LINE_XOXX_C;
|
||||
break;
|
||||
case LINE_OXXX: //#define LINE_OXXX 4194423
|
||||
charcode = LINE_OXXX_C;
|
||||
break;
|
||||
case LINE_XXXX: //#define LINE_XXXX 4194414
|
||||
charcode = LINE_XXXX_C;
|
||||
break;
|
||||
default:
|
||||
charcode = (char)ch;
|
||||
break;
|
||||
}
|
||||
char buffer[2] = { charcode, '\0' };
|
||||
return printstring( win, buffer );
|
||||
|
||||
|
||||
int cury = win->cursory;
|
||||
int p = win->cursorx;
|
||||
int curx = (win->line[cury].width_in_bytes == win->width) ? win->cursorx : cursorx_to_position(
|
||||
win->line[cury].chars, win->cursorx, &p);
|
||||
|
||||
if(curx != p) {
|
||||
const char *ts = win->line[cury].chars + p;
|
||||
int len = ANY_LENGTH;
|
||||
unsigned tc = UTF8_getch(&ts, &len);
|
||||
int tw = mk_wcwidth(tc);
|
||||
win->line[cury].width_in_bytes += erease_utf8_by_cw(win->line[cury].chars + p, tw, tw,
|
||||
win->width * 4 - p - 1);
|
||||
curx = p + tw - 1;
|
||||
} else if(win->line[cury].width_in_bytes != win->width) {
|
||||
win->line[cury].width_in_bytes += erease_utf8_by_cw(win->line[cury].chars + p, 1, 1,
|
||||
win->width * 4 - p - 1);
|
||||
}
|
||||
|
||||
win->line[cury].chars[curx] = charcode;
|
||||
win->line[cury].FG[win->cursorx] = win->FG;
|
||||
win->line[cury].BG[win->cursorx] = win->BG;
|
||||
|
||||
|
||||
win->draw = true;
|
||||
addedchar(win);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Move the cursor of the main window
|
||||
@@ -742,7 +704,7 @@ void timeout(int delay)
|
||||
{
|
||||
curses_timeout(delay);
|
||||
}
|
||||
void set_escdelay(int) { } //PORTABILITY, DUMMY FUNCTION
|
||||
void set_escdelay(int delay) { } //PORTABILITY, DUMMY FUNCTION
|
||||
|
||||
|
||||
int echo()
|
||||
@@ -0,0 +1,5 @@
|
||||
# These are all generated if missing at program startup
|
||||
keymap.txt
|
||||
options.txt
|
||||
auto_pickup.txt
|
||||
fontlist.txt
|
||||
@@ -0,0 +1,3 @@
|
||||
Terminus
|
||||
8
|
||||
16
|
||||
+698
-1208
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
# This message may be 16 lines long at maximum.
|
||||
# Max length of a line is 68 characters; the following line is for reference
|
||||
####################################################################
|
||||
Original author: Project Manager: Website/Forum:
|
||||
Whales (retired) KevinGranade GlyphGryph
|
||||
|
||||
Current Main Developers/Github Managers:
|
||||
KevinGranade, GalenEvil, i2amroy, AtomicDryad, Ianestrachan
|
||||
|
||||
Special thanks to:
|
||||
TheDarklingWolf - For creating Cataclysm:DDA as we know it
|
||||
Narc - For setting up the automatic Jenkins build-bot
|
||||
yobbobanana - For working as liason between translators and github
|
||||
Angela 'Rivet' Graves, Constant Creator of Cataclysmic Content
|
||||
|
||||
For a full list of contributors please see:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
@@ -1,18 +0,0 @@
|
||||
# This message may be 16 lines long at maximum.
|
||||
# Max length of a line is 72 characters; the following line is for reference
|
||||
########################################################################
|
||||
Ur-Autor: Projekt-Manager: Webpräsenz/Forum:
|
||||
Whales (ausgestiegen) KevinGranade GlyphGryph
|
||||
|
||||
Aktuelle Hauptentwickler/GitHub-Manager:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin, Coolthulhu, i2amroy
|
||||
|
||||
Besonderes Dankeschön an:
|
||||
Narc – Für das Aufsetzen des automatischen Jenkins-Build-Bots.
|
||||
Acidia – Für wunderschöne NPC-, Missions- und Ortsbeiträge.
|
||||
Wuzzy und VlasovVitaly – Für übermenschliche Übersetzungsarbeiten.
|
||||
HuXTUS – Für eine Riesenmenge an großartigen Inhalten.
|
||||
|
||||
Für eine vollständige Liste an Mitwirkenden (auf English), siehe:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
Cataclysm: Dark Days Ahead wird unter der CC-BY-SA 3.0 veröffentlicht.
|
||||
@@ -1,18 +0,0 @@
|
||||
# This message may be 21 lines long at maximum, but ideally will be less.
|
||||
# Max length of a line is 72 characters; the following line is for reference
|
||||
########################################################################
|
||||
Original author: Project Manager: Website/Forum:
|
||||
Whales (retired) KevinGranade GlyphGryph
|
||||
|
||||
Current Main Developers/Github Managers:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin, Coolthulu, i2amroy
|
||||
|
||||
Special thanks to:
|
||||
Narc - For setting up the automatic Jenkins build-bot.
|
||||
Acidia - For wonderful NPC, Quest and Location contributions.
|
||||
Wuzzy and VlasovVitaly - For herculean translation efforts.
|
||||
HuXTUS - For a huge amount of amazing content.
|
||||
|
||||
For a full list of contributors please see:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
Cataclysm: Dark Days Ahead is released under CC-BY-SA 3.0.
|
||||
@@ -1,19 +0,0 @@
|
||||
# Este mensaje puede ser de hasta 21 líneas de largo, pero lo ideal es que sea de menos.
|
||||
# El largo máximo de una línea es de 72 caracteres; la siguiente línea es para usar de referencia
|
||||
########################################################################
|
||||
Autor original: Director del Proyecto: Sitio Web/Foro:
|
||||
Whales (retirado) KevinGranade GlyphGryph
|
||||
|
||||
Desarrolladores actuales principales/Encargados de Github:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin
|
||||
|
||||
Agradecimientos especiales:
|
||||
Narc - Por configurar el bot de construcción Jenkins automático.
|
||||
Acidia - Por sus maravillosos PNJ, Misiones y Locaciones.
|
||||
Wuzzy y VlasovVitaly - Por sus esfuerzos hercúleos de traducción.
|
||||
i2amroy - Por sus varias reparaciones de infraestructura.
|
||||
HuXTUS - Por una cantidad enorme de contenido espectacular.
|
||||
|
||||
Para ver la lista completa de colaboradores, por favor, visita:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
Cataclysm: Dark Days Ahead ha sido liberado bajo licencia CC-BY-SA 3.0.
|
||||
@@ -1,19 +0,0 @@
|
||||
# This message may be 21 lines long at maximum, but ideally will be less.
|
||||
# Max length of a line is 72 characters; the following line is for reference
|
||||
########################################################################
|
||||
Autor original: Gestor de proyecto: Web/Foro:
|
||||
Whales (retired) KevinGranade GlyphGryph
|
||||
|
||||
Current Main Developers/Github Managers:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin
|
||||
|
||||
Agradecimientos a:
|
||||
Narc - For setting up the automatic Jenkins build-bot.
|
||||
Acidia - For wonderful NPC, Quest and Location contributions.
|
||||
Wuzzy and VlasovVitaly - For herculean translation efforts.
|
||||
i2amroy - For several large infrastructural overhauls.
|
||||
HuXTUS - For a huge amount of amazing content.
|
||||
|
||||
Para ver la lista completa de contribudores, por favor visita:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
Cataclysm: Dark Days Ahead se lanzó como CC-BY-SA 3.0.
|
||||
@@ -1,19 +0,0 @@
|
||||
# Questo messaggio può avere massimo 21 righe, anche se meno sarebbero meglio.
|
||||
# Una riga può avere fino a 72 caratteri, riferirsi alla riga successiva
|
||||
########################################################################
|
||||
Autore originale: Manager del progetto: Sito web/Forum:
|
||||
Whales (ritirato) KevinGranade GlyphGryph
|
||||
|
||||
Sviluppatori/manager di GitHub principali:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin
|
||||
|
||||
Ringraziamenti speciali a:
|
||||
Narc - Per aver impostato Jenkins build-bot.
|
||||
Acidia - Per i suoi meravigliosi contributi in NPC, quest e zone.
|
||||
Wuzzy e VlasovVitaly - Per le loro incredibili traduzioni.
|
||||
iam2roy - Per le numerose revisioni effettuate.
|
||||
HuXTUS - Per aver aggiunto tantissimi contentuti.
|
||||
|
||||
Per una lista completa dei contributori si prega di vedere:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
Cataclysm: Dark Days Ahead è rilasciato sotto licenza CC-BY-SA 3.0.
|
||||
@@ -1,19 +0,0 @@
|
||||
# This message may be 16 lines long at maximum.
|
||||
# Max length of a line is 72 characters; the following line is for reference
|
||||
########################################################################
|
||||
Оригинальный автор: Менеджер проекта: Вебсайт/Форум:
|
||||
Whales (не активен) KevinGranade GlyphGryph
|
||||
|
||||
Текущие основные разработчики и менеджеры проекта на Github:
|
||||
KevinGranade, Rivet-the-Zombie, KA101, BevapDin
|
||||
|
||||
Особая благодарность:
|
||||
Narc - за настройку Jenkins, автоматической системы сборки.
|
||||
Acidia - за замечательный вклад в NPC, квесты и локации.
|
||||
Wuzzy и VlasovVitaly - за титанический труд по переводу.
|
||||
i2amroy - за несколько крупных инфраструктурных усовершенствований.
|
||||
HuXTUS - за огромное количество потрясающего контента.
|
||||
|
||||
Полный список участников находится здесь:
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/contributors
|
||||
«Катаклизм: Темные дни впереди» выпущен под лицензией CC-BY-SA 3.0.
|
||||
Binary file not shown.
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"fontblending": false,
|
||||
"fontwidth": 8,
|
||||
"fontheight": 16,
|
||||
"fontsize": 16,
|
||||
"typeface": "Terminus",
|
||||
"map_fontwidth": 8,
|
||||
"map_fontheight": 16,
|
||||
"map_fontsize": 16,
|
||||
"map_typeface": "Terminus"
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
# JSON Loading Order #
|
||||
|
||||
All files here in data/json are read eventually, but the order in which they're
|
||||
read can be important for objects with dependencies on other kinds of objects
|
||||
(e.g. recipes depend on skills). Ensuring the proper loading order will prevent
|
||||
surprises that, most often, manifest as crash-to-desktop with segfault (a very
|
||||
bad thing).
|
||||
|
||||
The way Cataclysm finds and loads json files is by running a breadth-first
|
||||
search in the tree data/json/. This means `data/json/whatever.json` will
|
||||
**always** be read before `data/json/subdir/whatever.json`. This tells us how to
|
||||
ensure dependency loading order.
|
||||
|
||||
For instance, if you have scenarios that depend on professions that depend on
|
||||
skills, you'll want a directory structure such as the following:
|
||||
|
||||
```
|
||||
data/json/
|
||||
skills.json
|
||||
professions/
|
||||
professions.json
|
||||
scenarios/
|
||||
scenarios.json
|
||||
```
|
||||
|
||||
Which results in a loading order of: `skills.json` then `professions.json` and
|
||||
then `scenarios.json`.
|
||||
|
||||
## Same-depth loading order ##
|
||||
|
||||
Note that, when files (or directories) are at the same depth
|
||||
(i.e. all in `data/json/`), they will be read in lexical order, which is
|
||||
more or less equivalent to alphabetical order for file names that use only
|
||||
ascii characters. For UTF-8 or otherwise non-ascii file names, the names will be
|
||||
ordered by codepoint.
|
||||
+586
-656
File diff suppressed because it is too large
Load Diff
@@ -1,448 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "shot_bird",
|
||||
"items": [
|
||||
["lead", 16],
|
||||
["shot_hull", 1],
|
||||
["shotgun_primer", 1],
|
||||
["gunpowder", 12]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "shot_slug",
|
||||
"items": [
|
||||
["lead", 16],
|
||||
["shot_hull", 1],
|
||||
["shotgun_primer", 1],
|
||||
["gunpowder", 20]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "shot_00",
|
||||
"items": [
|
||||
["lead", 16],
|
||||
["shot_hull", 1],
|
||||
["shotgun_primer", 1],
|
||||
["gunpowder", 20]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "shot_beanbag",
|
||||
"items": [
|
||||
["rubber_slug", 1],
|
||||
["shot_hull", 1],
|
||||
["shotgun_primer", 1],
|
||||
["gunpowder", 16]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "shot_flechette",
|
||||
"items": [
|
||||
["combatnail", 8],
|
||||
["shot_hull", 1],
|
||||
["shotgun_primer", 1],
|
||||
["gunpowder", 20]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "22_lr",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["22_casing", 1],
|
||||
["gunpowder", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "22_ratshot",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["22_casing", 1],
|
||||
["gunpowder", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "22_cb",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["22_casing", 1],
|
||||
["gunpowder", 1]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "22_fmj",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["22_casing", 1],
|
||||
["gunpowder", 1],
|
||||
["copper", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "9mm",
|
||||
"items": [
|
||||
["lead", 4],
|
||||
["9mm_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 4]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "9mmP",
|
||||
"items": [
|
||||
["lead", 4],
|
||||
["9mm_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "9mmP2",
|
||||
"items": [
|
||||
["lead", 4],
|
||||
["9mm_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "9mmfmj",
|
||||
"items": [
|
||||
["lead", 4],
|
||||
["9mm_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 6],
|
||||
["copper", 4]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "32_acp",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["38_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 4]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "38_special",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["38_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "38_super",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["38_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 7]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "38_fmj",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["38_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 5],
|
||||
["copper", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "10mm",
|
||||
"items": [
|
||||
["lead", 8],
|
||||
["40_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 8]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "40sw",
|
||||
"items": [
|
||||
["lead", 6],
|
||||
["40_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "40fmj",
|
||||
"items": [
|
||||
["lead", 6],
|
||||
["40_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 6],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "44magnum",
|
||||
"items": [
|
||||
["lead", 10],
|
||||
["44_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 10]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "44fmj",
|
||||
"items": [
|
||||
["lead", 7],
|
||||
["44_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 7]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "45_acp",
|
||||
"items": [
|
||||
["lead", 8],
|
||||
["45_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 10]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "45_jhp",
|
||||
"items": [
|
||||
["lead", 7],
|
||||
["45_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 7]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "45_super",
|
||||
"items": [
|
||||
["lead", 10],
|
||||
["45_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 12]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "454_Casull",
|
||||
"items": [
|
||||
["lead", 20],
|
||||
["454_casing", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 20],
|
||||
["copper", 20]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "500_Magnum",
|
||||
"items": [
|
||||
["lead", 24],
|
||||
["500_casing", 1],
|
||||
["lgpistol_primer", 1],
|
||||
["gunpowder", 24],
|
||||
["copper", 24]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "57mm",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["57mm_casing", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 4]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "46mm",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["46mm_casing", 1],
|
||||
["smpistol_primer", 1],
|
||||
["gunpowder", 4]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "762_m43",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["762_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 7],
|
||||
["copper", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "762_m87",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["762_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 8],
|
||||
["copper", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "223",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["223_casing", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 4],
|
||||
["copper", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "556",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["223_casing", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 6],
|
||||
["copper", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "556_incendiary",
|
||||
"items": [
|
||||
["incendiary", 2],
|
||||
["223_casing", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 6],
|
||||
["copper", 2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "270",
|
||||
"items": [
|
||||
["lead", 5],
|
||||
["3006_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "3006",
|
||||
"items": [
|
||||
["lead", 6],
|
||||
["3006_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 8],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "3006_incendiary",
|
||||
"items": [
|
||||
["incendiary", 6],
|
||||
["3006_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 8],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "308",
|
||||
"items": [
|
||||
["lead", 6],
|
||||
["308_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "762_51",
|
||||
"items": [
|
||||
["lead", 6],
|
||||
["308_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "762_51_incendiary",
|
||||
"items": [
|
||||
["incendiary", 6],
|
||||
["308_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 10],
|
||||
["copper", 6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "5x50",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["5x50_hull", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 3]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "5x50dart",
|
||||
"items": [
|
||||
["lead", 2],
|
||||
["5x50_hull", 1],
|
||||
["smrifle_primer", 1],
|
||||
["gunpowder", 3]
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BULLET_PULLING",
|
||||
"bullet": "50",
|
||||
"items": [
|
||||
["lead", 21],
|
||||
["50_casing", 1],
|
||||
["lgrifle_primer", 1],
|
||||
["gunpowder", 45],
|
||||
["copper", 21]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -14,7 +14,7 @@
|
||||
"LGREEN" : [0,255,0],
|
||||
"YELLOW" : [255,255,0],
|
||||
"LBLUE" : [100,100,255],
|
||||
"LMAGENTA" : [254,0,254],
|
||||
"LMAGENTA" : [255,0,255],
|
||||
"LCYAN" : [0,240,255],
|
||||
"WHITE" : [255,255,255]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,163 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Wanna play with me?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Sing with me!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "I love you!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Please take me with you!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "May I have a cookie?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Let's play together!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Time to play!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Om nom nom! Delicious!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Are you my mommy?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Oh, how fun!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "You're my best friend!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Heehee!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Let's have fun!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "Let's have a tea party!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "doll",
|
||||
"sound" : "You're the best!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "You shouldn't have done that.",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Let's play... Russian roulette.",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "I hate you.",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Go kill yourself!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Big Brother is watching you...",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Die for me!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Why won't you die?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Blood... Delicious.",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "See you... IN HELL!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "AAAIEEEEEEE!!!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "FUCK YOU!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "What did you do with my Mommy?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Stay with me... forever!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Hey kids. Want some candy?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Down here, they ALL float!",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "Do you really need that much honey?",
|
||||
"volume" : 10
|
||||
},{
|
||||
"type" : "speech",
|
||||
"speaker" : "creepy_doll",
|
||||
"sound" : "My previous owner squealed like a pig when I gutted her!",
|
||||
"volume" : 10
|
||||
}
|
||||
]
|
||||
+4
-307
@@ -39,30 +39,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_BEAST",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a strange dream about bears.",
|
||||
"Your dreams give you a rough furry feeling."
|
||||
],
|
||||
"category" : "MUTCAT_URSINE",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a strange dream about cats.",
|
||||
"Your dreams give you a sleek furry feeling."
|
||||
],
|
||||
"category" : "MUTCAT_FELINE",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a strange dream about wolves.",
|
||||
"Your dreams give you a thick furry feeling."
|
||||
],
|
||||
"category" : "MUTCAT_LUPINE",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -101,7 +77,7 @@
|
||||
"You have a strange dream about living in a cave.",
|
||||
"Your dreams give a strange reclusive feeling."
|
||||
],
|
||||
"category" : "MUTCAT_TROGLOBITE",
|
||||
"category" : "MUTCAT_TROGLO",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
@@ -135,14 +111,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_ALPHA",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a strange dream.",
|
||||
"You feel a yearning..."
|
||||
],
|
||||
"category" : "MUTCAT_ELFA",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -151,24 +119,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_CHIMERA",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of the tropics.",
|
||||
"You feel warm."
|
||||
],
|
||||
"category" : "MUTCAT_RAPTOR",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of a strange quest for a bush that grows grey apples.",
|
||||
"You feel like you're cracking a combination lock.",
|
||||
"Red, blue, and yellow cancel each other out, don't they?",
|
||||
"Red, blue, and yellow add together, don't they?"
|
||||
],
|
||||
"category" : "MUTCAT_MARLOSS",
|
||||
"strength" : 1
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -209,30 +159,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_BEAST",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of foraging in the woods...mouth-first?",
|
||||
"Your dream-reflection is rather bearish."
|
||||
],
|
||||
"category" : "MUTCAT_URSINE",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You easily bound from the street to a roof..oh, only a dream.",
|
||||
"As you dream, your reflection looks rather catlike."
|
||||
],
|
||||
"category" : "MUTCAT_FELINE",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a disturbing dream of someone invading your territory.",
|
||||
"Your dream-self's muzzle looks...wait, muzzle?"
|
||||
],
|
||||
"category" : "MUTCAT_LUPINE",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -271,7 +197,7 @@
|
||||
"You dream of living deep inside a dark cave.",
|
||||
"You dream of being a primitive cave dweller."
|
||||
],
|
||||
"category" : "MUTCAT_TROGLOBITE",
|
||||
"category" : "MUTCAT_TROGLO",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
@@ -305,14 +231,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_ALPHA",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of a home in the forests.",
|
||||
"You feel beautiful, and yet riven with worry..."
|
||||
],
|
||||
"category" : "MUTCAT_ELFA",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -321,14 +239,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_CHIMERA",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of stalking some sort of lizard...no, that can't be right, can it?",
|
||||
"For some reason you dream of your shoes. They don't fit, and nothing seems to help..."
|
||||
],
|
||||
"category" : "MUTCAT_RAPTOR",
|
||||
"strength" : 2
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -369,30 +279,6 @@
|
||||
],
|
||||
"category" : "MUTCAT_BEAST",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Your dream of raiding a giant beehive has you licking your...muzzle in anticipation.",
|
||||
"In your dream, you stalk and kill a young wolf, using only your teeth and claws."
|
||||
],
|
||||
"category" : "MUTCAT_URSINE",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"A warm, sunny spot high up where you can watch your prey. What a great dream!",
|
||||
"You dream of pursuing and killing a rat, for some reason."
|
||||
],
|
||||
"category" : "MUTCAT_FELINE",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of tearing into a fresh kill.",
|
||||
"You dream of finally finding the perfect place to make your den."
|
||||
],
|
||||
"category" : "MUTCAT_LUPINE",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
@@ -431,7 +317,7 @@
|
||||
"Your dream of living in the dark for years is almost real.",
|
||||
"You are frightened of the outside after your vivid dream of cave life."
|
||||
],
|
||||
"category" : "MUTCAT_TROGLOBITE",
|
||||
"category" : "MUTCAT_TROGLO",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
@@ -465,202 +351,13 @@
|
||||
],
|
||||
"category" : "MUTCAT_ALPHA",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"NO! You will not allow this corruption to prevail!",
|
||||
"You see yourself reflected in the beauty of the forest."
|
||||
],
|
||||
"category" : "MUTCAT_ELFA",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You are many animals, and yet one.",
|
||||
"Hoof. Talon. Tooth. Fight. Feed. Forward."
|
||||
"Hoof. Talon. Tooth. Fight. Feed. Forward."
|
||||
],
|
||||
"category" : "MUTCAT_CHIMERA",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You've never felt so lithe and powerful.",
|
||||
"After an exciting and tasty hunt, you retire to your nest. Mmm, yes, nest."
|
||||
],
|
||||
"category" : "MUTCAT_RAPTOR",
|
||||
"strength" : 3
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You are terrified by a dream of becoming an ape hybrid.",
|
||||
"You blissfully recall days spent lounging in the sun."
|
||||
],
|
||||
"category" : "MUTCAT_LIZARD",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of your legions of undead admirers, their attentions, and the wonderful pain.",
|
||||
"You have a vivid dream of being a medical anomaly, as your heartbeat syncs with the steady drip of an IV line."
|
||||
],
|
||||
"category" : "MUTCAT_MEDICAL",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You wonder if your nest will be good enough.",
|
||||
"Your dream of soaring over the landscape becomes a nightmare when you find yourself with arms and a glider!"
|
||||
],
|
||||
"category" : "MUTCAT_BIRD",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You have a comforting dream of swimming with a school of fish.",
|
||||
"The thought of being out of water, forced to crawl unsupported, terrifies you."
|
||||
],
|
||||
"category" : "MUTCAT_FISH",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You vividly dream of sharing a kill with your pack.",
|
||||
"A fond memory of throating some prey animal bubbles up."
|
||||
],
|
||||
"category" : "MUTCAT_BEAST",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You wonder if you could find one of those 'salmon runs', or if they were just a legend...",
|
||||
"Ah, the wolf-slaying dream again. That's a good one..."
|
||||
],
|
||||
"category" : "MUTCAT_URSINE",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Boing! and you've pounced another yummy critter.",
|
||||
"Your nightmare of sentient rats turns successful, as you grab their King and shake it apart!"
|
||||
],
|
||||
"category" : "MUTCAT_FELINE",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of the hunt, the feed, and your pack.",
|
||||
"Oh, you should really patrol your territory again, maybe expand."
|
||||
],
|
||||
"category" : "MUTCAT_LUPINE",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of jumping the gate and leading your herd to freedom.",
|
||||
"The herd moves along and you with them, finding greener pastures."
|
||||
],
|
||||
"category" : "MUTCAT_CATTLE",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You feel smug, knowing that the Queen is dependent on you.",
|
||||
"You dream of a weirdly shaped plant, whose nectar surpassed your every wish..."
|
||||
],
|
||||
"category" : "MUTCAT_INSECT",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of bees fighting over your sweet nectar. Mmm.",
|
||||
"A rather attractive triffid offers you a bouquet of ape heads. How thoughtful!"
|
||||
],
|
||||
"category" : "MUTCAT_PLANT",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Your vivid dream of your pseudopods calcifying into rigid structures terrifies you.",
|
||||
"Ah, the painting-the-planet dream again. Maybe if you assimilated more..."
|
||||
],
|
||||
"category" : "MUTCAT_SLIME",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"The years seem to fly past as you dream of carving great underground fastnesses.",
|
||||
"You have a horrible nightmare of being caught out in the sunlight."
|
||||
],
|
||||
"category" : "MUTCAT_TROGLOBITE",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Mmm. The shellfish dream again. Yum!",
|
||||
"You dream of recruiting a cult of fishfolk to serve your needs."
|
||||
],
|
||||
"category" : "MUTCAT_CEPHALOPOD",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You excitedly web up an interloper and prepare to feast...nope, dream.",
|
||||
"Your dreams of having to live without a web frighten you."
|
||||
],
|
||||
"category" : "MUTCAT_SPIDER",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"The Fury is so big! it's GONNA GET YOAAAAAH! *pant* only a dream.",
|
||||
"You find your paws twitching. There's a cave. You should go."
|
||||
],
|
||||
"category" : "MUTCAT_RAT",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You dream of the peaceful world you'll give humankind. Because no one else can.",
|
||||
"There are underground Faults in the world. Faults you should remedy."
|
||||
],
|
||||
"category" : "MUTCAT_ALPHA",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"You pant, terrified at the thought of that FUNGUS destroying your home!",
|
||||
"You wish others could understand, and join your struggle..."
|
||||
],
|
||||
"category" : "MUTCAT_ELFA",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Your body flows slightly faster than you expected... oh, just a dream.",
|
||||
"FIGHT. FEED. FORWARD."
|
||||
],
|
||||
"category" : "MUTCAT_CHIMERA",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"messages" : [
|
||||
"Oh. No, that 'rex' thing was only a myth.",
|
||||
"You stir, saddened that your beautiful hatchlings were only a dream."
|
||||
],
|
||||
"category" : "MUTCAT_RAPTOR",
|
||||
"strength" : 4
|
||||
},{
|
||||
"type" : "dream",
|
||||
"//" : "The Mycus is ONLY post-thresh, so many more here.",
|
||||
"messages" : [
|
||||
"We have been waiting a long time for a place such as this.",
|
||||
"We will raise bountiful orchards and beautiful gardens.",
|
||||
"The walking plants seek to harness us as a food source. We will not allow that.",
|
||||
"Our colonists are limitless. We shall adapt to this world, as we adapt to all.",
|
||||
"Non-Mycus sometimes reject the Marloss. Our colonial efforts flourish with broad-minded guidance.",
|
||||
"The seething masses attempt to wall non-Mycus away from the Marloss. We will adapt and defeat them."
|
||||
],
|
||||
"category" : "MUTCAT_MYCUS",
|
||||
"strength" : 4
|
||||
}
|
||||
]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,609 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_blinky",
|
||||
"name" : "Blinky",
|
||||
"name_plural" : "Blinkies",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -60,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 5,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A strange three-eyed fish.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_eel",
|
||||
"name" : "freshwater eel",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "An eel.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_bowfin",
|
||||
"name" : "bowfin",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A bowfin.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_bullhead",
|
||||
"name" : "bullhead",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A bullhead.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_trout",
|
||||
"name" : "trout",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -20,
|
||||
"morale" : 40,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A trout.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES", "FAT"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_carp",
|
||||
"name" : "carp",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -20,
|
||||
"morale" : 40,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 40,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A golden-yellow common carp.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC","VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_pike",
|
||||
"name" : "pike",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -20,
|
||||
"morale" : 40,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 30,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A pike.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES", "FAT"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_bluegill",
|
||||
"name" : "bluegill",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A bluegill.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_sbass",
|
||||
"name" : "smallmouth bass",
|
||||
"name_plural" : "smallmouth bass",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A smallmouth bass.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_lbass",
|
||||
"name" : "largemouth bass",
|
||||
"name_plural" : "largemouth bass",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A largemouth bass.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_pbass",
|
||||
"name" : "striped bass",
|
||||
"name_plural" : "striped bass",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A striped bass.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_perch",
|
||||
"name" : "perch",
|
||||
"name_plural" : "perches",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A small spritely perch.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES", "FAT"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_salmon",
|
||||
"name" : "salmon",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -20,
|
||||
"morale" : 40,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 40,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A salmon.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES", "FAT"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_sunfish",
|
||||
"name" : "sunfish",
|
||||
"name_plural" : "sunfish",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A sunfish.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_whitefish",
|
||||
"name" : "whitefish",
|
||||
"name_plural" : "whitefish",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -50,
|
||||
"morale" : 5,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 20,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A whitefish.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_fish_pickerel",
|
||||
"name" : "pickerel",
|
||||
"name_plural" : "pickerel",
|
||||
"species" : "FISH",
|
||||
"default_faction" : "fish",
|
||||
"symbol" : "f",
|
||||
"color" : "white",
|
||||
"size" : "SMALL",
|
||||
"material" : "flesh",
|
||||
"diff" : 1,
|
||||
"aggression" : -20,
|
||||
"morale" : 40,
|
||||
"speed" : 150,
|
||||
"melee_skill" : 0,
|
||||
"melee_dice" : 1,
|
||||
"melee_dice_sides": 4,
|
||||
"melee_cut" : 1,
|
||||
"dodge" : 0,
|
||||
"armor_bash" : 0,
|
||||
"armor_cut" : 0,
|
||||
"item_chance" : 0,
|
||||
"luminance" : 0,
|
||||
"hp" : 40,
|
||||
"special_freq" : [0],
|
||||
"death_function" : "NORMAL",
|
||||
"special_attack" : ["NONE"],
|
||||
"description" : "A pickerel.",
|
||||
"flags" : ["FISHABLE", "SEES", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS30", "BONES"],
|
||||
"fear_triggers":["PLAYER_CLOSE", "SOUND"],
|
||||
"categories":["WILDLIFE"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_zhark",
|
||||
"name": "jawed terror",
|
||||
"species":"ZOMBIE",
|
||||
"default_faction":"zombie",
|
||||
"symbol":"^",
|
||||
"color":"white_magenta",
|
||||
"size":"MEDIUM",
|
||||
"material":"flesh",
|
||||
"diff":35,
|
||||
"aggression":100,
|
||||
"morale":105,
|
||||
"speed":150,
|
||||
"melee_skill":7,
|
||||
"melee_dice":3,
|
||||
"melee_dice_sides":6,
|
||||
"melee_cut":8,
|
||||
"dodge":5,
|
||||
"armor_bsh":6,
|
||||
"armor_cut":2,
|
||||
"luminance":0,
|
||||
"hp":250,
|
||||
"special_freq":[0],
|
||||
"death_function":"NORMAL",
|
||||
"special_attack":["BITE"],
|
||||
"description":"A once aggressive and hungry bull shark, this jawed terror is now even more aggressive, possibly thanks to its lack of a functioning brain.",
|
||||
"flags":["SEES", "HEARS", "SMELLS", "WARM", "SWIMS", "AQUATIC", "POISON", "NO_BREATHE", "VIS40", "REVIVES", "BONES"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_mutant_carp",
|
||||
"name": "giant carp",
|
||||
"species":"FISH",
|
||||
"default_faction":"carp",
|
||||
"symbol":"C",
|
||||
"color":"white_magenta",
|
||||
"size":"MEDIUM",
|
||||
"material":"flesh",
|
||||
"diff":20,
|
||||
"aggression":100,
|
||||
"morale":105,
|
||||
"speed":150,
|
||||
"melee_skill":4,
|
||||
"melee_dice":2,
|
||||
"melee_dice_sides":6,
|
||||
"melee_cut":2,
|
||||
"dodge":5,
|
||||
"armor_bsh":0,
|
||||
"armor_cut":0,
|
||||
"luminance":0,
|
||||
"hp":180,
|
||||
"special_freq":[0],
|
||||
"death_function":"NORMAL",
|
||||
"special_attack":["BITE"],
|
||||
"description":"This thing seems like a carp, only swollen and very very angry. Death is the gift of the carp god.",
|
||||
"flags":["SEES", "HEARS", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS40", "BONES","FAT"]
|
||||
},
|
||||
{
|
||||
"type" : "MONSTER",
|
||||
"id" : "mon_mutant_salmon",
|
||||
"name": "giant salmon",
|
||||
"species":"FISH",
|
||||
"default_faction":"salmon",
|
||||
"symbol":"S",
|
||||
"color":"white_magenta",
|
||||
"size":"MEDIUM",
|
||||
"material":"flesh",
|
||||
"diff":20,
|
||||
"aggression":100,
|
||||
"morale":105,
|
||||
"speed":150,
|
||||
"melee_skill":4,
|
||||
"melee_dice":2,
|
||||
"melee_dice_sides":6,
|
||||
"melee_cut":2,
|
||||
"dodge":5,
|
||||
"armor_bsh":0,
|
||||
"armor_cut":0,
|
||||
"luminance":0,
|
||||
"hp":180,
|
||||
"special_freq":[0],
|
||||
"death_function":"NORMAL",
|
||||
"special_attack":["BITE"],
|
||||
"description":"A mutated salmon, the same size as a large dog and quite dangerous to the inexperienced angler.",
|
||||
"flags":["SEES", "HEARS", "SMELLS", "WARM", "SWIMS", "AQUATIC", "VIS40", "BONES","FAT"]
|
||||
}
|
||||
]
|
||||
+333
-1731
File diff suppressed because it is too large
Load Diff
@@ -1,43 +0,0 @@
|
||||
[
|
||||
|
||||
{
|
||||
"type" : "furniture",
|
||||
"id" : "f_aut_gas_console",
|
||||
"name": "automated gas console",
|
||||
"symbol": "9",
|
||||
"color": "blue",
|
||||
"move_cost_mod": -1,
|
||||
"required_str": 25,
|
||||
"flags": ["SEALED", "ALARMED", "BLOCKSDOOR"],
|
||||
"examine_action": "pay_gas",
|
||||
"bash": {
|
||||
"str_min": 7, "str_max": 30,
|
||||
"sound": "glass breaking!",
|
||||
"sound_fail": "whack!",
|
||||
"furn_set": "f_aut_gas_console_o"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type" : "furniture",
|
||||
"id" : "f_aut_gas_console_o",
|
||||
"name": "broken automated gas console",
|
||||
"symbol": "9",
|
||||
"color": "dkgray",
|
||||
"move_cost_mod": -1,
|
||||
"required_str": 20,
|
||||
"flags": ["BLOCKSDOOR"],
|
||||
"bash": {
|
||||
"str_min": 5, "str_max": 45,
|
||||
"sound": "metal screeching!",
|
||||
"sound_fail": "clang!",
|
||||
"items": [
|
||||
{ "item": "scrap", "amount": 8, "minamount": 2},
|
||||
{ "item": "steel_chunk", "amount": 3, "minamount": 0},
|
||||
{ "item": "hose", "amount": 1},
|
||||
{ "item": "cu_pipe", "amount": 5, "minamount": 2 }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
@@ -160,7 +160,7 @@
|
||||
"cutting" : 0,
|
||||
"warmth" : 30,
|
||||
"phase" : "solid",
|
||||
"environmental_protection" : 2,
|
||||
"enviromental_protection" : 2,
|
||||
"encumbrance" : 1,
|
||||
"bashing" : -2,
|
||||
"flags" : ["VARSIZE"],
|
||||
@@ -184,7 +184,7 @@
|
||||
"cutting" : 0,
|
||||
"warmth" : 25,
|
||||
"phase" : "solid",
|
||||
"environmental_protection" : 0,
|
||||
"enviromental_protection" : 0,
|
||||
"encumbrance" : 1,
|
||||
"bashing" : -2,
|
||||
"flags" : ["VARSIZE"],
|
||||
@@ -208,7 +208,7 @@
|
||||
"cutting" : 0,
|
||||
"warmth" : 25,
|
||||
"phase" : "solid",
|
||||
"environmental_protection" : 1,
|
||||
"enviromental_protection" : 1,
|
||||
"encumbrance" : 1,
|
||||
"bashing" : -5,
|
||||
"flags" : ["VARSIZE", "FANCY", "POCKETS"],
|
||||
@@ -232,7 +232,7 @@
|
||||
"cutting" : 0,
|
||||
"warmth" : 25,
|
||||
"phase" : "solid",
|
||||
"environmental_protection" : 0,
|
||||
"enviromental_protection" : 0,
|
||||
"encumbrance" : 2,
|
||||
"bashing" : -5,
|
||||
"coverage" : 100,
|
||||
+10
-10
@@ -67,7 +67,7 @@
|
||||
"text" : "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..."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Oh man, have you gone down into the old subway systems? I'd be careful... there's these things down there that are like zombies, but tougher."
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "There's snakes down in most of the old sewer systems. They're slow on land, but boy, those suckers can swim fast!"
|
||||
@@ -154,7 +154,7 @@
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "There's basically no reason not to wear safety glasses... nothing is worse than taking a hit to the eyes and getting blinded for a few seconds."
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Ski goggles are a great choice if you're worried about getting stuff in your eyes. Perfect for dealing with boomers!"
|
||||
@@ -175,13 +175,13 @@
|
||||
"text" : "It's a good idea to carry around a couple of empty bottles. You can fill them up with water, gasoline, or whatever!"
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "If you need a bunch of rags for making Molotov cocktails, take a pair of scissors to an old t-shirt or something."
|
||||
"text" : "If you need a bunch of rags for making molotov cocktails, take a pair of scissors to an old t-shirt or something."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Carrying a lighter is something all veterans do. It takes up almost no space, and can easily save your life."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "If you can spare the space, you might want to carry a fire extinguisher along. Nothing is worse than being trapped in a burning building!"
|
||||
"text" : "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!"
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Crowbars not only make a pretty good weapon, they're also useful for opening locked doors and lifting manhole covers."
|
||||
@@ -196,25 +196,25 @@
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Bear traps 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!"
|
||||
"text" : "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!"
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "Don't use Molotovs indoors. Especially in a liquor store."
|
||||
"text" : "Don't use molotovs indoors. Especially in a liquor store."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
"text" : "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."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "If you're wandering in the wilderness, or following a road, keep an eye out for wild strawberries or blueberries."
|
||||
@@ -235,7 +235,7 @@
|
||||
"text" : "Houses can be a surprisingly good resource for all kinds of stuff; clothing, medication, food, books, and more."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "While there's not much to loot, gas stations are a good source for gasoline, to power tools or to make Molotov cocktails."
|
||||
"text" : "While there's not much to loot, gas stations are a good source for gasoline, to power tools or to make molotov cocktails."
|
||||
},{
|
||||
"type" : "hint",
|
||||
"text" : "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."
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "item_action",
|
||||
"id" : "SEW",
|
||||
"name" : "Sew"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "SEW_ADVANCED",
|
||||
"name" : "Modify Clothing"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "KNIFE",
|
||||
"name" : "Use as knife"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "firestarter",
|
||||
"name" : "Start a fire quickly"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "HAMMER",
|
||||
"name" : "Pull out nails"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "SOLDER_WELD",
|
||||
"name" : "Repair metal/plastic/kevlar"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "picklock",
|
||||
"name" : "Pick a lock"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "CROWBAR",
|
||||
"name" : "Pry crate, window or door"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "MAKEMOUND",
|
||||
"name" : "Upturn earth"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "PICKAXE",
|
||||
"name" : "Dig through rock"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "GEIGER",
|
||||
"name" : "Use geiger counter"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "HACKSAW",
|
||||
"name" : "Cut metal"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "BOLTCUTTERS",
|
||||
"name" : "Cut bolts or wires"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "HOTPLATE",
|
||||
"name" : "Heat up food"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "MISC_REPAIR",
|
||||
"name" : "Repair wood/bone/chitin"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "GUN_REPAIR",
|
||||
"name" : "Repair a gun"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "ROBOTCONTROL",
|
||||
"name" : "Hack a robot"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "VITAMINS",
|
||||
"name" : "Take vitamins"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "METH",
|
||||
"name" : "Smoke/snort meth"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "ANTICONVULSANT",
|
||||
"name" : "Take anticonvulsant"
|
||||
},{
|
||||
"type" : "item_action",
|
||||
"id" : "extended_firestarter",
|
||||
"name" : "Start a fire slowly"
|
||||
}
|
||||
]
|
||||
+577
-5160
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
[
|
||||
|
||||
{
|
||||
"id": "gasdiscount_silver",
|
||||
"type": "TOOL",
|
||||
"symbol": ",",
|
||||
"color": "yellow",
|
||||
"name": "silver gas discount card",
|
||||
"description": "This card gives you a little discount on the purchase of gasoline.",
|
||||
"price": 500,
|
||||
"material": "plastic",
|
||||
"flags": ["GAS_DISCOUNT", "DISCOUNT_VALUE_1"],
|
||||
"weight": 6,
|
||||
"volume": 0,
|
||||
"bashing": -8,
|
||||
"cutting": 0,
|
||||
"to_hit": -3,
|
||||
"max_charges": 0,
|
||||
"initial_charges": 0,
|
||||
"charges_per_use": 0,
|
||||
"turns_per_charge": 0,
|
||||
"ammo": "NULL",
|
||||
"revert_to": "null"
|
||||
},
|
||||
{
|
||||
"id": "gasdiscount_gold",
|
||||
"type": "TOOL",
|
||||
"symbol": ",",
|
||||
"color": "yellow",
|
||||
"name": "gold gas discount card",
|
||||
"description": "This card gives you a good discount on the purchase of gasoline.",
|
||||
"price": 500,
|
||||
"material": "plastic",
|
||||
"flags": ["GAS_DISCOUNT", "DISCOUNT_VALUE_2"],
|
||||
"weight": 6,
|
||||
"volume": 0,
|
||||
"bashing": -8,
|
||||
"cutting": 0,
|
||||
"to_hit": -3,
|
||||
"max_charges": 0,
|
||||
"initial_charges": 0,
|
||||
"charges_per_use": 0,
|
||||
"turns_per_charge": 0,
|
||||
"ammo": "NULL",
|
||||
"revert_to": "null"
|
||||
},
|
||||
{
|
||||
"id": "gasdiscount_platinum",
|
||||
"type": "TOOL",
|
||||
"symbol": ",",
|
||||
"color": "yellow",
|
||||
"name": "platinum gas discount card",
|
||||
"description": "This card gives you a splendid discount on the purchase of gasoline.",
|
||||
"price": 500,
|
||||
"material": "plastic",
|
||||
"flags": ["GAS_DISCOUNT", "DISCOUNT_VALUE_3"],
|
||||
"weight": 6,
|
||||
"volume": 0,
|
||||
"bashing": -8,
|
||||
"cutting": 0,
|
||||
"to_hit": -3,
|
||||
"max_charges": 0,
|
||||
"initial_charges": 0,
|
||||
"charges_per_use": 0,
|
||||
"turns_per_charge": 0,
|
||||
"ammo": "NULL",
|
||||
"revert_to": "null"
|
||||
}
|
||||
|
||||
]
|
||||
+429
-1868
File diff suppressed because it is too large
Load Diff
@@ -1,417 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "NULL",
|
||||
"name" : "none",
|
||||
"default" : ""
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "generic_no_ammo",
|
||||
"name" : "none",
|
||||
"default" : ""
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "700nx",
|
||||
"name" : ".700 Nitro Express",
|
||||
"default" : "700nx"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "50",
|
||||
"name" : ".50 BMG",
|
||||
"default" : "50bmg"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "nail",
|
||||
"name" : "nails",
|
||||
"default" : "nail"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "BB",
|
||||
"name" : "BBs",
|
||||
"default" : "bb"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "bolt",
|
||||
"name" : "bolts",
|
||||
"default" : "bolt_wood"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "arrow",
|
||||
"name" : "arrows",
|
||||
"default" : "arrow_wood"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "pebble",
|
||||
"name" : "pebbles",
|
||||
"default" : "pebble"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "shot",
|
||||
"name" : "shot",
|
||||
"default" : "shot_00"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "blunderbuss",
|
||||
"name" : "blunderbuss",
|
||||
"default" : "blun_shot"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "22",
|
||||
"name" : ".22",
|
||||
"default" : "22_lr"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "9mm",
|
||||
"name" : "9mm",
|
||||
"default" : "9mm"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "38",
|
||||
"name" : ".38",
|
||||
"default" : "38_special"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "40",
|
||||
"name" : ".40",
|
||||
"default" : "10mm"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "44",
|
||||
"name" : ".44",
|
||||
"default" : "44magnum"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "45",
|
||||
"name" : ".45",
|
||||
"default" : "45_acp"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "454",
|
||||
"name" : ".454",
|
||||
"default" : "454_Casull"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "500",
|
||||
"name" : ".500",
|
||||
"default" : "500_Magnum"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "57",
|
||||
"name" : "5.7mm",
|
||||
"default" : "57mm"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "46",
|
||||
"name" : "4.6mm",
|
||||
"default" : "46mm"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "762",
|
||||
"name" : "7.62x39mm",
|
||||
"default" : "762_m43"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "223",
|
||||
"name" : ".223",
|
||||
"default" : "223"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "3006",
|
||||
"name" : ".30-06",
|
||||
"default" : "270"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "308",
|
||||
"name" : ".308",
|
||||
"default" : "308"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "40mm",
|
||||
"name" : "40mm grenade",
|
||||
"default" : "40mm_concussive"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "66mm",
|
||||
"name" : "High Explosive Anti Tank warhead",
|
||||
"default" : "66mm_HEAT"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "120mm",
|
||||
"name" : "High Explosive Anti Tank warhead",
|
||||
"default" : "120mm_HEAT"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "84x246mm",
|
||||
"name" : "84mm recoilless projectile",
|
||||
"default" : "84x246mm_he"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "m235",
|
||||
"name" : "M235 Incendiary TPA",
|
||||
"default" : "m235tpa"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "gasoline",
|
||||
"name" : "gasoline",
|
||||
"default" : "gasoline"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "diesel",
|
||||
"name" : "diesel",
|
||||
"default" : "diesel"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "lamp_oil",
|
||||
"name" : "lamp oil",
|
||||
"default" : "lamp_oil"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "thread",
|
||||
"name" : "thread",
|
||||
"default" : "thread"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "tape",
|
||||
"name" : "duct tape",
|
||||
"default" : "duct_tape"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "battery",
|
||||
"name" : "batteries",
|
||||
"default" : "battery"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "money",
|
||||
"name" : "cents",
|
||||
"default" : "money"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "laser_capacitor",
|
||||
"name" : "charge",
|
||||
"default" : "laser_pack"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "plutonium",
|
||||
"name" : "plutonium",
|
||||
"default" : "plut_cell"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "muscle",
|
||||
"name" : "muscle",
|
||||
"default" : ""
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "fusion",
|
||||
"name" : "fusion cell",
|
||||
"default" : "laser_pack"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "12mm",
|
||||
"name" : "12mm slugs",
|
||||
"default" : "12mm"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "plasma",
|
||||
"name" : "hydrogen",
|
||||
"default" : "plasma"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "water",
|
||||
"name" : "clean water",
|
||||
"default" : "water_clean"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "8x40mm",
|
||||
"name" : "8x40mm caseless",
|
||||
"default" : "8mm_caseless"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "20x66mm",
|
||||
"name" : "20x66mm caseless shotgun",
|
||||
"default" : "20x66_shot"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "5x50",
|
||||
"name" : "5x50mm flechette",
|
||||
"default" : "5x50dart"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "signal_flare",
|
||||
"name" : "signal flare",
|
||||
"default" : "signal_flare"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "mininuke_mod",
|
||||
"name" : "modified mininuke",
|
||||
"default" : "mininuke_mod"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "charcoal",
|
||||
"name" : "charcoal",
|
||||
"default" : "charcoal"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "metal_rail",
|
||||
"name" : "ferrous rail projectile",
|
||||
"default" : "rebar_rail"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "UPS",
|
||||
"name" : "UPS",
|
||||
"default" : "UPS"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "thrown",
|
||||
"name" : "throwing weapon",
|
||||
"default" : "thrown"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "ampoule",
|
||||
"name" : "chemical ampoule",
|
||||
"default" : "ampoule"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "components",
|
||||
"name" : "components",
|
||||
"default" : "components"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "RPG-7",
|
||||
"name" : "RPG-7",
|
||||
"default" : "RPG-7_ammo"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "dart",
|
||||
"name" : "dart",
|
||||
"default" : "dart"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "rebreather_filter",
|
||||
"name" : "rebreather filter",
|
||||
"default" : "rebreather_filter"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "300",
|
||||
"name" : ".300",
|
||||
"default" : "300_winmag"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "32",
|
||||
"name" : ".32",
|
||||
"default" : "32_acp"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "762x25",
|
||||
"name" : "7.62x25mm",
|
||||
"default" : "762_25"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "ammo_flintlock",
|
||||
"name" : "paper cartridge",
|
||||
"default" : "flintlock_ammo"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "36paper",
|
||||
"name" : ".36 cap & ball",
|
||||
"default" : "36navy"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "44paper",
|
||||
"name" : ".44 cap & ball",
|
||||
"default" : "44army"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "762R",
|
||||
"name": "7.62x54mm",
|
||||
"default": "762_54R"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "fishspear",
|
||||
"name" : "speargun spear",
|
||||
"default" : "fishspear"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "fish_bait",
|
||||
"name" : "fish bait",
|
||||
"default" : "fish_bait_meat"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "homebrew_rocket",
|
||||
"name" : "homebrew rocket",
|
||||
"default" : "spiked_rocket"
|
||||
},
|
||||
{
|
||||
"type" : "ammunition_type",
|
||||
"id" : "unfinished_char",
|
||||
"name" : "semi-charred fuel",
|
||||
"default" : "unfinished_charcoal"
|
||||
}
|
||||
|
||||
]
|
||||
+216
-536
File diff suppressed because it is too large
Load Diff
+1196
-7498
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user