Compare commits

..

1 Commits
master ... w32x

Author SHA1 Message Date
darkrose ea789f4f97 redo the chat console 2017-10-16 01:05:32 +10:00
36 changed files with 860 additions and 1372 deletions

View File

@ -1,58 +1,41 @@
cmake_minimum_required(VERSION 3.5)
# Set policies up to 3.9 since we want to enable the IPO option
if(${CMAKE_VERSION} VERSION_LESS 3.9)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.9)
endif()
cmake_minimum_required(VERSION 2.6)
if(${CMAKE_VERSION} STREQUAL "2.8.2")
# bug http://vtk.org/Bug/view.php?id=11020
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
endif(${CMAKE_VERSION} STREQUAL "2.8.2")
# This can be read from ${PROJECT_NAME} after project() is called
project(voxelands)
set(PROJECT_NAME_CAPITALIZED "Voxelands")
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
set(VERSION_MAJOR 2404)
set(VERSION_MAJOR 1709)
set(VERSION_MINOR 00)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
# Change to false for releases
set(DEVELOPMENT_BUILD TRUE)
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
if(VERSION_EXTRA)
set(VERSION_STRING "${VERSION_STRING}-${VERSION_EXTRA}")
elseif(DEVELOPMENT_BUILD)
set(VERSION_STRING "${VERSION_STRING}-dev")
endif()
if (CMAKE_BUILD_TYPE STREQUAL Debug)
# Append "-debug" to version string
set(VERSION_STRING "${VERSION_STRING}-debug")
endif()
MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
# Configuration options
set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE)
endif()
set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
"Run directly in source directory structure")
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
# set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
# set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
if(WIN32)
set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
else()
set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
endif()
set(BUILD_CLIENT 1 CACHE BOOL "Build client")
if(WIN32)
set(BUILD_SERVER 0 CACHE BOOL "Build server")
else()
set(BUILD_SERVER 1 CACHE BOOL "Build server")
endif()
# conf options for building fresh voxelands.icns from voxelands.svg if a new icon is made.
set(REBUILD_ICNS FALSE CACHE BOOL "Rebuild icns from voxelands.svg .")
set(REBUILD_ICNS 0 CACHE BOOL "Rebuild icns from voxelands.svg .")
set(CPU_OPTS FALSE CACHE BOOL "Enable CPU optimizations")
set(CPU_OPTS 0 CACHE BOOL "Enable CPU optimizations")
set(CPUTYPE native CACHE STRING "CPU to optimize for")
set(ENABLE_SSP TRUE CACHE BOOL "Enable stack smashing protection")
set(ENABLE_SAFESTACK TRUE CACHE BOOL "Enable SafeStack if supported (LLVM only)")
set(ENABLE_PIE FALSE CACHE BOOL "Produce a Position Independent Executable")
set(ENABLE_SSP 1 CACHE BOOL "Enable stack smashing protection")
set(ENABLE_SAFESTACK 1 CACHE BOOL "Enable SafeStack if supported (LLVM only)")
set(ENABLE_PIE 0 CACHE BOOL "Produce a Position Independent Executable")
if(NOT CMAKE_BUILD_TYPE)
# Default to release
@ -137,48 +120,25 @@ add_subdirectory(src)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Fun-Focused Free Software Voxel World Game")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VENDOR "rudzik8")
set(CPACK_PACKAGE_CONTACT "Mikita Wisniewski <rudzik8@protonmail.com>")
set(CPACK_PACKAGE_VENDOR "darkrose")
set(CPACK_PACKAGE_CONTACT "Lisa 'darkrose' Milne <lisa@ltmnet.com>")
if(WIN32)
# Include all dynamically linked runtime libaries such as MSVCRxxx.dll
include(InstallRequiredSystemLibraries)
# For some reason these aren't copied otherwise
# NOTE: For some reason now it seems to work without these
#if(BUILD_CLIENT)
# install(FILES bin/voxelands.exe DESTINATION bin)
#endif()
#if(BUILD_SERVER)
# install(FILES bin/voxelands-server.exe DESTINATION bin)
#endif()
if(RUN_IN_PLACE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
else()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
endif()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
set(CPACK_GENERATOR ZIP)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR WIX)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ".")
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}")
set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME})
set(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJECT_NAME_CAPITALIZED}")
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/voxelands-icon.ico")
# Supported languages can be found at
# http://wixtoolset.org/documentation/manual/v3/wixui/wixui_localization.html
#set(CPACK_WIX_CULTURES "ar-SA,bg-BG,ca-ES,hr-HR,cs-CZ,da-DK,nl-NL,en-US,et-EE,fi-FI,fr-FR,de-DE")
set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_BANNER.BMP")
set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_DIALOG.BMP")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/gpl-3.0.txt")
# The correct way would be to include both x32 and x64 into one installer
# and install the appropriate one.
# CMake does not support that, so there are two separate GUID's
#if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# set(CPACK_WIX_UPGRADE_GUID "745A0FB3-5552-44CA-A587-A91C397CCC56")
#else()
# set(CPACK_WIX_UPGRADE_GUID "814A2E2D-2779-4BBD-9ACD-FC3BD51FBBA2")
#endif()
endif()
# This might be needed for some installer
#set(CPACK_PACKAGE_EXECUTABLES bin/voxelands.exe "Voxelands" bin/voxelands-server.exe "Voxelands Server")
elseif(APPLE)
# TODO
# see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
@ -196,9 +156,10 @@ else()
set(CPACK_SOURCE_GENERATOR TGZ)
SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" )
SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Mikita Wisniewski <rudzik8@protonmail.com>" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Lisa Milne <lisa@ltmnet.com>" )
SET ( CPACK_GENERATOR "DEB;RPM" )
endif()
include(CPack)

163
README.md
View File

@ -1,163 +0,0 @@
# About
**Voxelands** is a sandbox construction game based on Minetest 0.3, which was inspired by earlier "voxel world" games such as Infiniminer. Gameplay puts players in a fully destructible 3D game world where they can place and dig numerous types of blocks, items and creatures using a variety of tools. Inside the game world players can build structures, artworks and anything else their creativity can think of on multiplayer servers and singleplayer worlds across multiple game modes.
# Chats
Matrix: <https://matrix.to/#/#voxelands-room:matrix.org>
# Dependencies
Voxelands requires:
* the standard C++ library
* irrlicht
* freetype
* openAL
* vorbisfile
* ogg
* zlib
* cmake
* make
* g++ (or other C++ compiler)
* bzip2
* jpeg
* libxml2
# Install
## Download
Install dependencies. Here's an example for Debian/Ubuntu:
sudo apt install build-essential libirrlicht-dev cmake libbz2-dev zlib1g-dev libfreetype6-dev libpng-dev libjpeg-dev libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libxml2-dev
You can install Git for easily keeping your copy up-to-date.
If you dont want Git, read below on how to get the source without Git.
Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
git clone https://git.minetest.land/oerkki/voxelands.git
cd voxelands
Download source, without using Git:
wget https://git.minetest.land/oerkki/voxelands/archive/master.tar.gz
tar xf master.tar.gz
cd voxelands
## Build
Build a version that runs directly from the source directory:
cmake . -DRUN_IN_PLACE=TRUE
make -j$(nproc)
- Use `cmake . -LH` to see all CMake options and their current state.
- If you want to install it system-wide (or are making a distribution package),
you will want to use `-DRUN_IN_PLACE=FALSE`.
- You can build a bare server by specifying `-DBUILD_SERVER=TRUE`.
- You can disable the client build by specifying `-DBUILD_CLIENT=FALSE`.
- You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=<Debug or Release>`.
- Debug build is slower, but gives much more useful output in a debugger.
### Errors
Some buildings errors are currently known. If the building occured an error, it might be one of them:
#### Crash when building with translation.
**Error :**
[ 2%] Linking CXX static library libcguittfont.a
[ 2%] Built target cguittfont
make: *** [Makefile:152 : all] Erreur 2
**Git issue:** [#19](https://git.minetest.land/oerkki/voxelands/issues/19)
**Possible fixes:**
1. Change your default build language to english: (Add the `sudo` keyword for ubuntu-based devices)
apt-get install language-pack-en
dpkg-reconfigure locales
2. Delete translations files by simply deleting the `po` folder.
#### The `-DRUN_IN_PLACE` CMake option doesn't work.
**Git issue:** [#19](https://git.minetest.land/oerkki/voxelands/issues/11)
This error is fixed since the version 2404 of Voxelands. If you get them, check if the dowloaded version is the good one.
# Use
Simply run `./bin/voxelands` from any console/terminal.
# Controls
Controls can be set in the Settings tab of the main menu
| Button | Action |
| ------------------ | --------------------------------------- |
| W, S, A, D | Walk forward, backward, left, and right |
| Mouse | Look / Aim |
| Mouse wheel | Change wielded item |
| 1 through 8 | Change wielded item |
| Right Mouse Button | Place item |
| Left Mouse Button | Dig / Punch / Attack |
| Shift | Sneak |
| Space | Jump |
| R | Move Up (ladders, swimming, flying) |
| F | Move Down (ladders, swimming, flying) |
| E | Run |
| I | Enter inventory |
| Q | Examine pointed block |
| H | Use item in hand |
| T | Talk / commands |
| K | Toggle fly mode |
| F1 | Hide / show hud |
| F2 | Hide / show chat |
| F3 | Disable / enable fog |
| F4 | Disable / enable camera update |
| F5 | Toggle through debug information |
| F6 | Toggle through profiler |
| F12 | Take a screenshot |
# License
**Code:**
Voxelands is licensed under the GPLv3 or later.
Copyright (c) 2022-2022 Mikita Wisniewski <rudzik8@protonmail.com>
Copyright (c) 2013-2016 Lisa 'darkrose' Milne <lisa@ltmnet.com>
Forked from Minetest 0.3.x
Copyright (c) 2010-2011 Perttu Ahola <celeron55@gmail.com>
See commits history for all contributors.
**Textures, Sounds, and Models:**
This does not apply to packs made by others.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
To satisfy the attribution clause, any project using Voxelands' assets must provide a prominent notice as part of each of said project's credits notices (such as in documentation, on a website, and/or any other credits screen associated with the project) showing both the CC-BY-SA licensing, the ownership by Voxelands of the asset, and a link to the Voxelands' project at https://git.minetest.land/oerkki/voxelands/.
**Artists include:**
* sdzen
* darkrose
* sapier
* Tom Peter
* Telaron
* juskiddink
With special thanks to http://www.opengameart.org/
# Development
Voxelands is under active development, the latest updates can be found at https://git.minetest.land/oerkki/voxelands

113
README.txt Normal file
View File

@ -0,0 +1,113 @@
========================================================================
README
========================================================================
ABOUT:
Voxelands is a sandbox construction game based on Minetest, which was
inspired by earlier "voxel world" games such as Infiniminer. Gameplay
puts players in a fully destructible 3D game world where they can place
and dig numerous types of blocks, items and creatures using a variety
of tools. Inside the game world players can build structures, artworks
and anything else their creativity can think of on multiplayer servers
and singleplayer worlds across multiple game modes.
DEPENDENCIES:
Voxelands requires the standard C++ library, irrlicht 1.8 or later,
freetype, openAL, vorbisfile, ogg, zlib. CMake, make, and g++ (or other
C++ compiler) and bzip2 and jpeg are required to build from source.
INSTALL:
If you're reading this then you've already unpacked the tarball, so
just:
1) cd /path/to/voxelands
2) cmake -DRUN_IN_PLACE=1 .
3) make -j3
Other optional cmake parameters:
1) -DBUILD_SERVER=0 (default 1) builds the dedicated server
2) -DBUILD_CLIENT=0 (default 1) builds the rich client
3) -DENABLE_AUDIO=0 (default 1) enables audio support
The option -DRUN_IN_PLACE expects the user to run voxelands from the extracted source directory.
WINDOWS:
Voxelands can be cross compiled with mingw, or built natively with MSVC,
instructions for the latter are available on the forums:
http://forum.voxelands.com
USE:
Simply run bin/voxelands from any console/terminal.
CONTROLS:
Controls can be set in the Settings tab of the main menu
Main controls:
W, S, A, D - Walk forward backward, left, and right.
Mouse - Look / Aim.
Mouse wheel - Change wielded item.
1 through 8 - Change wielded item.
Right Mouse Button - Place item.
Left Mouse Button - Dig / Punch / Attack.
Shift - Sneak.
Space - Jump.
R - Move Up (ladders, swimming, flying)
F - Move Down (ladders, swimming, flying)
E - Run.
Action controls:
I - Enter inventory.
Q - Examine pointed block.
H - Use item in hand.
=======
T - Talk / commands.
K - Toggle fly mode.
F1 - Hide / show hud.
F2 - Hide / show chat.
F3 - Disable / enable fog.
F4 - Disable / enable camera update.
F5 - Toggle through debug information.
F6 - Toggle through profiler (info on FPS, chunk updates, etc.)
F12 - Take a screenshot.
LICENSE:
Code:
Voxelands is licensed under the GPLv3 or later.
Copyright (c) 2013-2016 Lisa 'darkrose' Milne <lisa@ltmnet.com>
Forked from Minetest 0.3.x
Copyright (c) 2010-2011 Perttu Ahola <celeron55@gmail.com>
Textures, Sounds, and Models:
This does not apply to texture packs made by others.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
To satisfy the attribution clause, any project using Voxelands' assets
must provide a prominent notice as part of each of said project's
credits notices (such as in documentation, on a website, and/or any
other credits screen associated with the project) showing both the
CC-BY-SA licensing, the ownership by Voxelands of the asset, and a link
to the Voxelands' project at http://www.voxelands.com/.
Artists include:
sdzen
darkrose
sapier
Tom Peter
Telaron
juskiddink
With special thanks to http://www.opengameart.org/
DEVELOPMENT:
Voxelands is under active development, the latest updates can be found
at:
https://gitlab.com/voxelands/voxelands
or on IRC at:
irc.entropynet.net #voxelands
CHANGES:
See doc/changelog.txt

View File

@ -1,69 +1,28 @@
# Package finder for gettext libs and include files
set(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
CACHE FILEPATH "path to custom gettext")
find_path(GETTEXT_INCLUDE_DIR
NAMES libintl.h
PATHS "${CUSTOM_GETTEXT_PATH}/include"
DOC "GetText include directory")
# by default
SET(GETTEXT_FOUND FALSE)
find_program(GETTEXT_MSGFMT
FIND_PROGRAM(GETTEXT_MSGFMT
NAMES msgfmt
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
DOC "Path to msgfmt")
DOC "path to msgfmt")
set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_MSGFMT)
if(APPLE)
find_library(GETTEXT_LIBRARY
NAMES libintl.a
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
DOC "GetText library")
find_library(ICONV_LIBRARY
NAMES libiconv.dylib
PATHS "/usr/lib"
DOC "IConv library")
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY ICONV_LIBRARY)
endif(APPLE)
# Modern Linux, as well as OSX, does not require special linking because
# GetText is part of glibc.
# TODO: check the requirements on other BSDs and older Linux
if(WIN32)
if(MSVC)
set(GETTEXT_LIB_NAMES
libintl.lib intl.lib libintl3.lib intl3.lib)
else()
set(GETTEXT_LIB_NAMES
libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
endif()
find_library(GETTEXT_LIBRARY
NAMES ${GETTEXT_LIB_NAMES}
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
DOC "GetText library")
endif(WIN32)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GettextLib DEFAULT_MSG ${GETTEXT_REQUIRED_VARS})
if(GETTEXTLIB_FOUND)
# BSD variants require special linkage as they don't use glibc
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD|DragonFly")
set(GETTEXT_LIBRARY "intl")
endif()
set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES timestamp)
macro(SET_MO_PATHS _buildvar _destvar _locale)
string(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
string(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
endmacro()
endif()
IF(GETTEXT_MSGFMT)
SET(GETTEXT_FOUND TRUE)
SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
SET(GETTEXT_MO_BUILD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../data/locale/<locale>)
SET(GETTEXT_MO_DEST_PATH ${SHAREDIR}/locale/<locale>)
FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
LIST(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES voxelands.pot)
MACRO(SET_MO_PATHS _buildvar _destvar _locale)
STRING(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
STRING(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
ENDMACRO(SET_MO_PATHS)
ELSE()
SET(GETTEXT_INCLUDE_DIR "")
SET(GETTEXT_LIBRARY "")
ENDIF()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 148 B

View File

@ -1,36 +0,0 @@
# Voxelands Direction Document
Styling based on [Minetest Direction Document](https://github.com/minetest/minetest/blob/master/doc/direction.md).
## 1. Long-term Roadmap
Currently not much was done to the game and LTR can be changed in
future. But still, our long-term roadmap currently contains 3 things:
1. Use more of Minetest things to add solid backing (less to maintain)
2. Be a complete voxel sandbox game working OOTB (just like MC)
3. Be more voxel than cubic (more meshes and nodeboxes)
## 2. Medium-term Roadmap
The medium-term roadmap currently contains 5 things to add/change:
1. Modding (implement as Game+Mods (MC-alike), not Game=Mods (MT-alike))
2. Packs (texturepacks, soundpacks, modelpacks, resourcepacks) (#14)
3. Graphics (fix weird glitches and switch to IrrlichtMT) (#2)
4. Workflow (add more people to the development, automatize releasing)
5. Site (online page for Voxelands based on the voxelands-www repo)
## 3. Short-term Roadmap
The short-term roadmap is temporary, it's here only while critical bugs
(like crashes) aren't fixed.
We can count these things as a short-term roadmap:
1. Fix everything crashing (#1)
2. Convert most of the docs from plaintext to markdown
3. Do something with changelogs
After these are done, this section won't be here anymore and we'll count
(bug/crash)-labeled issues as short-term by default.

View File

@ -285,7 +285,7 @@ endif()
set(voxelands_SRCS
${common_SRCS}
${audio_SRCS}
tutorial.cpp
ui_console.c
sky.cpp
hud.cpp
content_mapblock.cpp
@ -322,11 +322,11 @@ set(voxelandsserver_SRCS
)
include_directories(
${voxelands_SOURCE_DIR}
${CMAKE_BINARY_DIR}/src/jthread
${PROJECT_BINARY_DIR}
${IRRLICHT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${CMAKE_BUILD_TYPE}
${PNG_INCLUDE_DIR}
${AUDIO_INCLUDE_DIRS}
${JTHREAD_INCLUDE_DIR}

View File

@ -1234,10 +1234,8 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
message += (wchar_t)readU16(buf);
}
/* because I can't remember which random stream prints to stdout */
/* this will print to game console, system console, and log file */
vlprint(CN_CHAT,(char*)wide_to_narrow(message).c_str());
m_chat_queue.push_back(message);
}
break;
case TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD:

View File

@ -275,30 +275,6 @@ public:
u16 getHunger();
float getEnergy();
bool getChatMessage(std::wstring &message)
{
if(m_chat_queue.size() == 0)
return false;
message = m_chat_queue.pop_front();
return true;
}
void addChatMessage(const std::wstring &message)
{
if (message[0] == L'/') {
m_chat_queue.push_back(
(std::wstring)L"issued command: "+message);
return;
}
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
std::wstring name = narrow_to_wide(player->getName());
m_chat_queue.push_back(
(std::wstring)L"<"+name+L"> "+message);
}
uint64_t getMapSeed() {return m_map_seed;}
MapGenType getMapType() {return m_map_type;}
@ -400,8 +376,6 @@ private:
bool m_form_open;
Queue<std::wstring> m_chat_queue;
// The seed returned by the server in TOCLIENT_INIT is stored here
uint64_t m_map_seed;
MapGenType m_map_type;

View File

@ -207,6 +207,13 @@ void world_exit(void);
worldlist_t *world_list_get(void);
void world_list_free(worldlist_t *l);
/* defined in ui_console.c */
void ui_console_addline(uint8_t type, char* txt);
void ui_console_addlinef(uint8_t type, char* fmt, ...);
void ui_console_clear(void);
int ui_console_step(float dtime);
char* ui_console_get(void);
#ifdef __cplusplus
}
#include <string>

View File

@ -43,13 +43,6 @@ typedef struct config_s {
int (*setter)(char* v);
} config_t;
typedef struct sort_s {
struct sort_s *prev;
struct sort_s *next;
char *name;
char *value;
} sort_t;
/* get the value of a config setting */
char* config_get(char* name)
{
@ -400,111 +393,12 @@ void config_save(char* section, char* type, char* file)
n = n->next;
}
}else{
sort_t *copyhead = 0;
sort_t *copytail = 0;
sort_t *copying = 0;
sort_t *copied = 0;
int copy_failed=0;
// get config name/value pairs in new list
n = config.items;
while(n) {
if (!n->name) continue;
copying=malloc(sizeof(sort_t));
if (!copying) {
copy_failed=1;
break;
}
if (!copyhead)
// remember the first entry in the list for sorting
copyhead=copying;
if (copied) {
copied->next = copying;
copying->prev = copied;
}
else {
copying->prev = 0;
}
copying->name = strdup(n->name);
while (n) {
if (n->value)
copying->value = strdup(n->value);
else
copying->value = 0;
copying->next = 0;
copied = copying;
file_writef(f,"set %s %s\n",n->name,n->value);
n = n->next;
}
// remember the last entry in the list for cleaning up
copytail=copied;
// alpha sort name/value pairs by name
sort_t *sprev;
sort_t *scurr;
char *store;
if (!copy_failed && copyhead) {
scurr=copyhead;
while(scurr->next){
if (strcmp(scurr->name,scurr->next->name)>0){
store=scurr->name;
scurr->name = scurr->next->name;
scurr->next->name = store;
store=scurr->value;
scurr->value=scurr->next->value;
scurr->next->value=store;
sprev=scurr;
while(sprev->prev){
if (strcmp(sprev->prev->name,sprev->name) > 0) {
store=sprev->name;
sprev->name = sprev->prev->name;
sprev->prev->name = store;
store=sprev->value;
sprev->value = sprev->prev->value;
sprev->prev->value=store;
sprev=sprev->prev;
}
else break;
}
}
scurr=scurr->next;
}
}
// save one of the lists to file
if (copy_failed) {
while (n) {
if (n->value)
file_writef(f,"set %s %s\n",n->name,n->value);
n = n->next;
}
} else {
scurr=copyhead;
while (scurr) {
if (scurr->value)
file_writef(f,"set %s %s\n",scurr->name,scurr->value);
scurr=scurr->next;
}
}
// free list memory and clean up
while(copytail) {
if (!(copytail->prev)) break;
copytail=copytail->prev;
free(copytail->next);
copytail->next=0;
}
free(copytail);
copyhead=0;
copytail=0;
copying=0;
copied=0;
sprev=0;
scurr=0;
store=0;
/*
events_save(f);
*/

View File

@ -31,7 +31,7 @@ void config_default_init()
config_set_default("log.max_level","info",log_maxlevel_setter);
config_set_default("log.system.min_level","chat",log_sminlevel_setter);
config_set_default("log.system.max_level","info",log_smaxlevel_setter);
config_set_default("log.console.min_level","chat",log_cminlevel_setter);
config_set_default("log.console.min_level","action",log_cminlevel_setter);
config_set_default("log.console.max_level","info",log_cmaxlevel_setter);
config_set_default("path.log",NULL,log_file_setter);
@ -87,7 +87,7 @@ void config_default_init()
config_set_default("client.ui.hud.wieldindex","false",NULL);
config_set_default("client.ui.mouse.invert","false",NULL);
config_set_default("client.ui.mouse.sensitivity","0.2",NULL);
config_set_default("client.ui.font","arimo.ttf",NULL);
config_set_default("client.ui.font","unifont.ttf",NULL);
config_set_default("client.ui.font.size","14",NULL);
config_set_default("client.chunk.timeout","600",NULL);

View File

@ -987,20 +987,19 @@ FoundReverseRecipe getReverseRecipe(InventoryItem *iitem, int index)
}
//how to update an ingredient list given a range of new craft items
void addToIngredientList(contentlist_t *list, uint32_t begin, std::vector<content_t>& ingredient_list)
void addToIngredientList(std::vector<listdata_t> results, uint32_t begin, std::vector<content_t>& ingredient_list)
{
using namespace std;
//make a set to hold the items as the list is compiled
set<content_t> ingredients (ingredient_list.begin(), ingredient_list.end());
listdata_t *d = list->data;
//go through the result list
while (d) {
for (std::vector<listdata_t>::iterator it = results.begin()+begin; it != results.end(); ++it) {
listdata_t d = *it;
//make a temporary inventory item for the result
InventoryItem *result = InventoryItem::create(d->content, 1, 0, d->data);
InventoryItem *result = InventoryItem::create(d.content, 1, 0, d.data);
//go through every recipe for this item
for (int rec_ind = getRecipeCount(result); rec_ind--;) {
@ -1021,8 +1020,6 @@ void addToIngredientList(contentlist_t *list, uint32_t begin, std::vector<conten
//clean up
delete result;
d = d->next;
}
//ignore CONTENT_IGNORE
@ -1053,7 +1050,8 @@ std::vector<content_t>& getCraftGuideIngredientList()
if (list_size > last_craftguide_count) {
//if so, add the new stuff
addToIngredientList(cl, last_craftguide_count, ingredient_list);
/* TODO: basically everything for reverse lookup */
//addToIngredientList(craft_list, last_craftguide_count, ingredient_list);
//and update the craftguide count
last_craftguide_count = list_size;

View File

@ -1128,7 +1128,6 @@ void content_mapnode_plants(bool repeat)
f->ondig_gives_inventory = true;
f->setAllTextures("bush_blueberry.png");
f->setAllMetaTextures("bush_blueberry_berry.png");
f->setInventoryTextureNodeBox(i,"bush_blueberry.png", "bush_blueberry.png", "bush_blueberry.png");
#ifndef SERVER
f->setAllTextureTypes(MATERIAL_ALPHA_SIMPLE);
f->setAllTextureFlags(0);
@ -1159,7 +1158,6 @@ void content_mapnode_plants(bool repeat)
f->ondig_gives_inventory = true;
f->setAllTextures("bush_raspberry.png");
f->setAllMetaTextures("bush_raspberry_berry.png");
f->setInventoryTextureNodeBox(i,"bush_raspberry.png", "bush_raspberry.png", "bush_raspberry.png");
#ifndef SERVER
f->setAllTextureTypes(MATERIAL_ALPHA_SIMPLE);
f->setAllTextureFlags(0);

View File

@ -761,9 +761,8 @@ void content_mapnode_special(bool repeat)
f->dig_time = 1.0;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
//not going to use mithril when you can use sticks
//crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i);
//crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i);
crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i);
crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i);
{
content_t r[9] = {
CONTENT_CRAFTITEM_STICK, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE,

View File

@ -1419,10 +1419,10 @@ void content_nodebox_clock(ContentFeatures *f)
-0.4375*BS,0.1875*BS,-0.125*BS,0.4375*BS,0.25*BS,-0.0625*BS
));
f->addNodeBox(NodeBox(
-0.02*BS,-0.0625*BS,-0.125*BS,0.0225*BS,0.*BS,-0.0625*BS
0.*BS,-0.0625*BS,-0.125*BS,0.0625*BS,0.*BS,-0.0625*BS
));
f->addNodeBox(NodeBox(
-0.02*BS,-0.1875*BS,-0.125*BS,0.0225*BS,-0.125*BS,-0.0625*BS
0.*BS,-0.1875*BS,-0.125*BS,0.0625*BS,-0.125*BS,-0.0625*BS
));
}

View File

@ -287,9 +287,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_pick_stone.png^tool_binding_pick.png";
f->description = gettext("Stone Pick");
f->type = TT_PICK;
f->diginfo.uses = STONE_USES;
f->diginfo.time = STONE_TIME;
f->diginfo.level = STONE_LEVEL;
f->diginfo.uses = 32;
f->diginfo.time = 3.0;
f->diginfo.level = 1;
{
content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK,
@ -303,41 +303,41 @@ void content_toolitem_init()
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINTPICK;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_pick_flint.png^tool_binding_pick.png";
f->description = gettext("Flint Pick");
f->type = TT_PICK;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = FLINT_LEVEL;
crafting::setPickRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTPICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_COPPER_PICK;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_pick_copper.png^tool_binding_pick.png";
f->description = gettext("Copper Pick");
f->type = TT_PICK;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.level = COPPER_LEVEL;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 2;
crafting::setPickRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_PICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINTPICK;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_pick_flint.png^tool_binding_pick.png";
f->description = gettext("Flint Pick");
f->type = TT_PICK;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 2;
crafting::setPickRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTPICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_PICK;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_pick_bronze.png^tool_binding_pick.png";
f->description = gettext("Bronze Pick");
f->type = TT_PICK;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.level = BRONZE_LEVEL;
f->diginfo.uses = 128;
f->diginfo.time = 1.25;
f->diginfo.level = 3;
crafting::setPickRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_PICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -348,9 +348,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_pick_iron.png^tool_binding_pick.png";
f->description = gettext("Iron Pick");
f->type = TT_PICK;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = IRON_LEVEL;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 4;
crafting::setPickRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_PICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -361,9 +361,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_pick_mithril.png^tool_binding_pick.png";
f->description = gettext("Unbound Mithril Pick");
f->type = TT_PICK;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = U_MITHRIL_LEVEL;
f->diginfo.uses = 1024;
f->diginfo.time = 0.6;
f->diginfo.level = 5;
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -375,9 +375,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Pick");
f->type = TT_PICK;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = E_MITHRIL_LEVEL;
f->diginfo.uses = 2048;
f->diginfo.time = 0.4;
f->diginfo.level = 6;
f->has_punch_effect = false;
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_PICK);
content_list_add("craftguide",i,1,0);
@ -403,49 +403,36 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_shovel_stone.png^tool_binding_shovel.png";
f->description = gettext("Stone Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = STONE_USES;
f->diginfo.time = STONE_TIME;
f->diginfo.level = STONE_LEVEL;
f->diginfo.uses = 32;
f->diginfo.time = 3.0;
f->diginfo.level = 1;
crafting::set1over1Recipe(CONTENT_ROCK,CONTENT_CRAFTITEM_STICK,i);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINTSHOVEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_flint.png^tool_binding_shovel.png";
f->description = gettext("Flint Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = FLINT_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_COPPER_SHOVEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_copper.png^tool_binding_shovel.png";
f->description = gettext("Copper Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.level = COPPER_LEVEL;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_SHOVEL;
i = CONTENT_TOOLITEM_FLINTSHOVEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_bronze.png^tool_binding_shovel.png";
f->description = gettext("Bronze Shovel");
f->texture = "tool_handle.png^tool_head_shovel_flint.png^tool_binding_shovel.png";
f->description = gettext("Flint Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.level = BRONZE_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SHOVEL);
f->diginfo.uses = 128;
f->diginfo.time = 1.75;
f->diginfo.level = 2;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -455,22 +442,35 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_shovel_iron.png^tool_binding_shovel.png";
f->description = gettext("Iron Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = IRON_LEVEL;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 3;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_SHOVEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_bronze.png^tool_binding_shovel.png";
f->description = gettext("Bronze Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = 512;
f->diginfo.time = 0.75;
f->diginfo.level = 4;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_mithril.png^tool_binding_shovel.png";
f->description = gettext("Unbound Mithril Shovel");
f->type = TT_SHOVEL;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = U_MITHRIL_LEVEL;
f->diginfo.uses = 1024;
f->diginfo.time = 0.6;
f->diginfo.level = 5;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -482,9 +482,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Shovel");
f->type = TT_SHOVEL;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = E_MITHRIL_LEVEL;
f->diginfo.uses = 2048;
f->diginfo.time = 0.4;
f->diginfo.level = 5;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SHOVEL);
content_list_add("craftguide",i,1,0);
@ -496,9 +496,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_axe_stone.png^tool_binding_axe.png";
f->description = gettext("Stone Axe");
f->type = TT_AXE;
f->diginfo.uses = STONE_USES;
f->diginfo.time = STONE_TIME;
f->diginfo.level = STONE_LEVEL;
f->diginfo.uses = 32;
f->diginfo.time = 3.0;
f->diginfo.level = 1;
{
content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_IGNORE,
@ -513,42 +513,29 @@ void content_toolitem_init()
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINTAXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_axe_flint.png^tool_binding_axe.png";
f->description = gettext("Flint Axe");
f->type = TT_AXE;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = FLINT_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTAXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_COPPER_AXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_axe_copper.png^tool_binding_axe.png";
f->description = gettext("Copper Axe");
f->type = TT_AXE;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.level = COPPER_LEVEL;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_AXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_AXE;
i = CONTENT_TOOLITEM_FLINTAXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_axe_bronze.png^tool_binding_axe.png";
f->description = gettext("Bronze Axe");
f->texture = "tool_handle.png^tool_head_axe_flint.png^tool_binding_axe.png";
f->description = gettext("Flint Axe");
f->type = TT_AXE;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.level = BRONZE_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_AXE);
f->diginfo.uses = 128;
f->diginfo.time = 1.75;
f->diginfo.level = 2;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTAXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -558,22 +545,35 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_axe_iron.png^tool_binding_axe.png";
f->description = gettext("Iron Axe");
f->type = TT_AXE;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = IRON_LEVEL;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 3;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_AXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_AXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_axe_bronze.png^tool_binding_axe.png";
f->description = gettext("Bronze Axe");
f->type = TT_AXE;
f->diginfo.uses = 512;
f->diginfo.time = 0.75;
f->diginfo.level = 4;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_AXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle.png^tool_head_axe_mithril.png^tool_binding_axe.png";
f->description = gettext("Unbound Mithril Axe");
f->type = TT_AXE;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = U_MITHRIL_LEVEL;
f->diginfo.uses = 1024;
f->diginfo.time = 0.6;
f->diginfo.level = 5;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -585,9 +585,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Axe");
f->type = TT_AXE;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = E_MITHRIL_LEVEL;
f->diginfo.uses = 2048;
f->diginfo.time = 0.4;
f->diginfo.level = 5;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_AXE);
content_list_add("craftguide",i,1,0);
@ -613,9 +613,9 @@ void content_toolitem_init()
f->texture = "tool_bow.png";
f->description = gettext("Bow");
f->type = TT_SPECIAL;
f->diginfo.uses = BOW_USES;
f->diginfo.time = BOW_TIME;
f->diginfo.level = BOW_LEVEL;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 2;
f->thrown_item = CONTENT_CRAFTITEM_ARROW;
{
content_t r[9] = {
@ -636,49 +636,36 @@ void content_toolitem_init()
f->texture = "tool_handle_long.png^tool_head_spear_stone.png^tool_binding_spear.png";
f->description = gettext("Stone Spear");
f->type = TT_SPEAR;
f->diginfo.uses = STONE_USES;
f->diginfo.time = STONE_TIME;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_SPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINTSPEAR;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_flint.png^tool_binding_spear.png";
f->description = gettext("Flint Spear");
f->type = TT_SPEAR;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_COPPER_SPEAR;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_copper.png^tool_binding_spear.png";
f->description = gettext("Copper Spear");
f->type = TT_SPEAR;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_SPEAR;
i = CONTENT_TOOLITEM_FLINTSPEAR;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_bronze.png^tool_binding_spear.png";
f->description = gettext("Bronze Spear");
f->texture = "tool_handle_long.png^tool_head_spear_flint.png^tool_binding_spear.png";
f->description = gettext("Flint Spear");
f->type = TT_SPEAR;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SPEAR);
f->diginfo.uses = 128;
f->diginfo.time = 1.75;
f->diginfo.level = 2;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -688,22 +675,35 @@ void content_toolitem_init()
f->texture = "tool_handle_long.png^tool_head_spear_iron.png^tool_binding_spear.png";
f->description = gettext("Iron Spear");
f->type = TT_SPEAR;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 3;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_SPEAR;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_bronze.png^tool_binding_spear.png";
f->description = gettext("Bronze Spear");
f->type = TT_SPEAR;
f->diginfo.uses = 512;
f->diginfo.time = 0.75;
f->diginfo.level = 4;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_mithril.png^tool_binding_spear.png";
f->description = gettext("Unbound Mithril Spear");
f->type = TT_SPEAR;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 1024;
f->diginfo.time = 0.6;
f->diginfo.level = 5;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -715,9 +715,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Spear");
f->type = TT_SPEAR;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 2048;
f->diginfo.time = 0.4;
f->diginfo.level = 5;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SPEAR);
content_list_add("craftguide",i,1,0);
@ -729,8 +729,8 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_sword_copper.png^tool_binding_sword.png";
f->description = gettext("Copper Sword");
f->type = TT_SWORD;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SWORD);
content_list_add("craftguide",i,1,0);
@ -742,9 +742,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_sword_bronze.png^tool_binding_sword.png";
f->description = gettext("Bronze Sword");
f->type = TT_SWORD;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 128;
f->diginfo.time = 1.5;
f->diginfo.level = 4;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SWORD);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -755,9 +755,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_sword_iron.png^tool_binding_sword.png";
f->description = gettext("Iron Sword");
f->type = TT_SWORD;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 3;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SWORD);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -768,9 +768,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_sword_mithril.png^tool_binding_sword.png";
f->description = gettext("Unbound Mithril Sword");
f->type = TT_SWORD;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 1024;
f->diginfo.time = 0.6;
f->diginfo.level = 5;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -782,9 +782,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Sword");
f->type = TT_SWORD;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 2048;
f->diginfo.time = 0.4;
f->diginfo.level = 5;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SWORD);
content_list_add("craftguide",i,1,0);
@ -796,9 +796,9 @@ void content_toolitem_init()
f->texture = "tool_flintshears.png";
f->description = gettext("Flint Shears");
f->type = TT_SHEAR;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 128;
f->diginfo.time = 1.5;
f->diginfo.level = 2;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHEARS);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -809,9 +809,9 @@ void content_toolitem_init()
f->texture = "tool_copper_shears.png";
f->description = gettext("Copper Shears");
f->type = TT_SHEAR;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 128;
f->diginfo.time = 1.5;
f->diginfo.level = 2;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHEARS);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -822,9 +822,9 @@ void content_toolitem_init()
f->texture = "tool_ironshears.png";
f->description = gettext("Iron Shears");
f->type = TT_SHEAR;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 2;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHEARS);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -839,8 +839,8 @@ void content_toolitem_init()
f->liquids_pointable = true;
f->type = TT_BUCKET;
f->param_type = CPT_CONTENT;
f->diginfo.uses = WOOD_BUCKET_USES;
f->diginfo.time = WOOD_BUCKET_TIME;
f->diginfo.uses = 64;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,CONTENT_TOOLITEM_WBUCKET);
@ -857,9 +857,9 @@ void content_toolitem_init()
f->liquids_pointable = true;
f->type = TT_BUCKET;
f->param_type = CPT_CONTENT;
f->diginfo.uses = TIN_BUCKET_USES;
f->diginfo.time = TIN_BUCKET_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 128;
f->diginfo.time = 1.75;
f->diginfo.level = 2;
f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_TIN_INGOT,CONTENT_TOOLITEM_TINBUCKET);
content_list_add("craftguide",i,1,0);
@ -874,9 +874,9 @@ void content_toolitem_init()
f->liquids_pointable = true;
f->type = TT_BUCKET;
f->param_type = CPT_CONTENT;
f->diginfo.uses = IRON_BUCKET_USES;
f->diginfo.time = IRON_BUCKET_TIME;
f->diginfo.level = 1;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 3;
crafting::setURecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_BUCKET);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
@ -891,47 +891,47 @@ void content_toolitem_init()
f->texture = "tool_handle_short.png^tool_head_knife_stone.png";
f->description = gettext("Stone Knife");
f->type = TT_KNIFE;
f->diginfo.uses = STONE_USES;
f->diginfo.time = STONE_TIME;
f->diginfo.uses = 32;
f->diginfo.time = 3.0;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_KNIFE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINT_KNIFE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_flint.png";
f->description = gettext("Flint Knife");
f->type = TT_KNIFE;
f->diginfo.uses = FLINT_USES;
f->diginfo.time = FLINT_TIME;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINT_KNIFE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_COPPER_KNIFE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_copper.png";
f->description = gettext("Copper Knife");
f->type = TT_KNIFE;
f->diginfo.uses = COPPER_USES;
f->diginfo.time = COPPER_TIME;
f->diginfo.uses = 64;
f->diginfo.time = 2.0;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_KNIFE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_FLINT_KNIFE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_flint.png";
f->description = gettext("Flint Knife");
f->type = TT_KNIFE;
f->diginfo.uses = 64;
f->diginfo.time = 2.0;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINT_KNIFE);
content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0);
i = CONTENT_TOOLITEM_BRONZE_KNIFE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_bronze.png";
f->description = gettext("Bronze Knife");
f->type = TT_KNIFE;
f->diginfo.uses = BRONZE_USES;
f->diginfo.time = BRONZE_TIME;
f->diginfo.uses = 128;
f->diginfo.time = 1.5;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_KNIFE);
content_list_add("craftguide",i,1,0);
@ -943,8 +943,8 @@ void content_toolitem_init()
f->texture = "tool_handle_short.png^tool_head_knife_iron.png";
f->description = gettext("Iron Knife");
f->type = TT_KNIFE;
f->diginfo.uses = IRON_USES;
f->diginfo.time = IRON_TIME;
f->diginfo.uses = 256;
f->diginfo.time = 1.0;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_KNIFE);
content_list_add("craftguide",i,1,0);
@ -956,8 +956,8 @@ void content_toolitem_init()
f->texture = "tool_handle_short.png^tool_head_knife_mithril.png";
f->description = gettext("Unbound Mithril Knife");
f->type = TT_KNIFE;
f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.uses = 1024;
f->diginfo.time = 0.5;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_KNIFE);
content_list_add("craftguide",i,1,0);
@ -970,8 +970,8 @@ void content_toolitem_init()
f->description = gettext("Mithril Knife");
f->type = TT_KNIFE;
f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.uses = 2048;
f->diginfo.time = 0.5;
f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_KNIFE);
content_list_add("craftguide",i,1,0);
@ -986,7 +986,7 @@ void content_toolitem_init()
f->description = gettext("Fire Starter");
f->liquids_pointable = true;
f->type = TT_SPECIAL;
f->diginfo.level = 1;
f->diginfo.level = 3;
f->has_fire_effect = true;
crafting::set1Any2Recipe(CONTENT_CRAFTITEM_FLINT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_FIRESTARTER);
content_list_add("craftguide",i,1,0);
@ -998,7 +998,7 @@ void content_toolitem_init()
f->texture = "tool_crowbar.png";
f->description = gettext("Crowbar");
f->type = TT_SPECIAL;
f->diginfo.level = 1;
f->diginfo.level = 3;
f->has_rotate_effect = true;
crafting::set1over1Recipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_CROWBAR);
content_list_add("craftguide",i,1,0);
@ -1010,7 +1010,7 @@ void content_toolitem_init()
f->texture = "tool_key.png";
f->description = gettext("Key");
f->type = TT_SPECIAL;
f->diginfo.level = 1;
f->diginfo.level = 4;
f->has_unlock_effect = true;
crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY);
content_list_add("craftguide",i,1,0);
@ -1022,7 +1022,7 @@ void content_toolitem_init()
f->texture = "tool_mithril_key.png";
f->description = gettext("Mithril Key");
f->type = TT_SPECIAL;
f->diginfo.level = 1;
f->diginfo.level = 5;
f->has_unlock_effect = true;
f->has_super_unlock_effect = true;
/* this can only be crafted by server admin */
@ -1041,7 +1041,7 @@ void content_toolitem_init()
f->texture = "tool_mob_spawner.png";
f->description = gettext("Mob Spawner");
f->type = TT_SPECIAL;
f->diginfo.level = 1;
f->diginfo.level = 4;
f->param_type = CPT_DROP;
{
content_t r[9] = {

View File

@ -177,56 +177,4 @@ ToolItemFeatures & content_toolitem_features(std::string subname);
#define CONTENT_TOOLITEM_COPPER_SPEAR (CONTENT_TOOLITEM_MASK | 0x39)
#define CONTENT_TOOLITEM_COPPER_SHEARS (CONTENT_TOOLITEM_MASK | 0x3A)
// times are calculated as :
// Stone : 3.0
// Flint : 3.0 - 1.0 = 2.0
// Copper : 2.0 - 0.5 = 1.5
// Bronze : 1.5 - 0.4 = 1.1
// Iron : 1.1 - 0.3 = 0.8
// Mithril : 0.8 - 0.2 = 0.6 Unbound
// Mithril : 0.6 - 0.2 = 0.4 Enchanted
#define STONE_USES 32
#define STONE_TIME 3.0
#define STONE_LEVEL 1
#define FLINT_USES 64
#define FLINT_TIME 2.0
#define FLINT_LEVEL 2
#define COPPER_USES 128
#define COPPER_TIME 1.5
#define COPPER_LEVEL 2
#define BRONZE_USES 256
#define BRONZE_TIME 1.1
#define BRONZE_LEVEL 3
#define IRON_USES 512
#define IRON_TIME 0.8
#define IRON_LEVEL 4
// Unbound Mithril
#define U_MITHRIL_USES 1024
#define U_MITHRIL_TIME 0.6
#define U_MITHRIL_LEVEL 5
// Enchanted Mithril
#define E_MITHRIL_USES 2048
#define E_MITHRIL_TIME 0.4
#define E_MITHRIL_LEVEL 5
#define BOW_USES 256
#define BOW_TIME 1.0
#define BOW_LEVEL 1
#define WOOD_BUCKET_USES 64
#define WOOD_BUCKET_TIME 1.5
#define TIN_BUCKET_USES 128
#define TIN_BUCKET_TIME 1.75
#define IRON_BUCKET_USES 256
#define IRON_BUCKET_TIME 1.0
#endif

View File

@ -53,7 +53,6 @@
#include "main.h"
#endif
#include "hud.h"
#include "tutorial.h"
#include "sky.h"
#include "selection_mesh.h"
@ -69,17 +68,6 @@
#define swprintf _snwprintf
#endif
/*
Setting this to 1 enables a special camera mode that forces
the renderers to think that the camera statically points from
the starting place to a static direction.
This allows one to move around with the player and see what
is actually drawn behind solid things and behind the player.
*/
#define FIELD_OF_VIEW_TEST 0
// Chat data
struct ChatLine
{
@ -137,7 +125,7 @@ public:
// Send to others
m_client->sendChatMessage(fields["text"]);
// Show locally
m_client->addChatMessage(fields["text"]);
ui_console_addline(CN_CHAT,(char*)wide_to_narrow(fields["text"]).c_str());
}
}
@ -662,16 +650,6 @@ void update_profiler_gui(gui::IGUIStaticText *guitext_profiler,
}
}
void chatline_add(ref_t **chat_lines, std::wstring txt, float time)
{
ref_t *ref = (ref_t*)malloc(sizeof(ref_t));
if (!ref)
return;
ref->ref = new ChatLine(txt,time);
*chat_lines = (ref_t*)list_push(chat_lines,ref);
}
void the_game(
bool &kill,
InputHandler *input,
@ -694,7 +672,6 @@ void the_game(
gui::IGUIStaticText *guitext_info;
gui::IGUIStaticText *guitext_chat;
gui::IGUIStaticText *guitext_profiler;
ref_t *chat_lines = NULL;
u32 drawtime = 0;
core::list<float> frametime_log;
float action_delay_counter = 0.0;
@ -746,6 +723,8 @@ void the_game(
*/
drawLoadingScreen(device,narrow_to_wide(gettext("Loading...")));
ui_console_clear();
/*
Create server.
SharedPtr will delete it when it goes out of scope.
@ -1172,10 +1151,10 @@ void the_game(
}else if(input->wasKeyDown(getKeySetting(VLKC_FREEMOVE))) {
if (free_move) {
free_move = false;
chatline_add(&chat_lines,narrow_to_wide(gettext("free_move disabled")),-103.00);
vlprint(CN_ACTION,gettext("free_move disabled"));
}else{
free_move = true;
chatline_add(&chat_lines,narrow_to_wide(gettext("free_move enabled")),-103.00);
vlprint(CN_ACTION,gettext("free_move enabled"));
}
}else if(input->wasKeyDown(getKeySetting(VLKC_SCREENSHOT))) {
irr::video::IImage* const image = driver->createScreenShot();
@ -1187,10 +1166,7 @@ void the_game(
}else{
if (path_get((char*)"screenshot",fn,0,path,1024)) {
if (driver->writeImageToFile(image, io::path(path))) {
char buff[512];
snprintf(buff, 512, gettext("Saved screenshot to '%s'"), path);
infostream << "Saved screenshot to '" << fn << "'" << std::endl;
chatline_add(&chat_lines,narrow_to_wide(buff),-103.00);
vlprintf(CN_ACTION,gettext("Saved screenshot to '%s'"), path);
}else{
infostream << "Failed to save screenshot '" << fn << "'"<<std::endl;
}
@ -1201,30 +1177,30 @@ void the_game(
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_HUD))) {
show_hud = !show_hud;
if (show_hud) {
chatline_add(&chat_lines,narrow_to_wide(gettext("HUD shown")),-103.00);
vlprint(CN_ACTION,gettext("HUD shown"));
}else{
chatline_add(&chat_lines,narrow_to_wide(gettext("HUD hidden")),-103.00);
vlprint(CN_ACTION,gettext("HUD hidden"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_CHAT))) {
show_chat = !show_chat;
if (show_chat) {
chatline_add(&chat_lines,narrow_to_wide(gettext("Chat shown")),-103.00);
vlprint(CN_ACTION,gettext("Chat shown"));
}else{
chatline_add(&chat_lines,narrow_to_wide(gettext("Chat hidden")),-103.00);
vlprint(CN_ACTION,gettext("Chat hidden"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_FOG))) {
force_fog_off = !force_fog_off;
if (force_fog_off) {
chatline_add(&chat_lines,narrow_to_wide(gettext("Fog disabled")),-103.00);
vlprint(CN_ACTION,gettext("Fog disabled"));
}else{
chatline_add(&chat_lines,narrow_to_wide(gettext("Fog enabled")),-103.00);
vlprint(CN_ACTION,gettext("Fog enabled"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_CAMERA))) {
disable_camera_update = !disable_camera_update;
if (disable_camera_update) {
chatline_add(&chat_lines,narrow_to_wide(gettext("Camera update disabled")),-103.00);
vlprint(CN_ACTION,gettext("Camera update disabled"));
}else{
chatline_add(&chat_lines,narrow_to_wide(gettext("Camera update enabled")),-103.00);
vlprint(CN_ACTION,gettext("Camera update enabled"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_DEBUG))) {
// Initial / 3x toggle: Chat only
@ -1233,14 +1209,14 @@ void the_game(
if (!show_debug) {
show_debug = true;
show_debug_frametime = false;
chatline_add(&chat_lines,narrow_to_wide(gettext("Debug info shown")),-103.00);
vlprint(CN_ACTION,gettext("Debug info shown"));
}else if (show_debug_frametime) {
show_debug = false;
show_debug_frametime = false;
chatline_add(&chat_lines,narrow_to_wide(gettext("Debug info and frametime graph hidden")),-103.00);
vlprint(CN_ACTION,gettext("Debug info and frametime graph hidden"));
}else{
show_debug_frametime = true;
chatline_add(&chat_lines,narrow_to_wide(gettext("Frametime graph shown")),-103.00);
vlprint(CN_ACTION,gettext("Frametime graph shown"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_TOGGLE_PROFILER))) {
show_profiler = (show_profiler + 1) % (show_profiler_max + 1);
@ -1250,28 +1226,22 @@ void the_game(
show_profiler, show_profiler_max);
if (show_profiler != 0) {
char buff[512];
snprintf(buff,512,gettext("Profiler shown (page %d of %d)"),show_profiler,show_profiler_max);
chatline_add(&chat_lines,narrow_to_wide(buff),-103.00);
vlprintf(CN_ACTION,gettext("Profiler shown (page %d of %d)"),show_profiler,show_profiler_max);
}else{
chatline_add(&chat_lines,narrow_to_wide(gettext("Profiler hidden")),-103.00);
vlprint(CN_ACTION,gettext("Profiler hidden"));
}
}else if (input->wasKeyDown(getKeySetting(VLKC_RANGE_PLUS))) {
char buff[512];
int range = config_get_int("client.graphics.range.min");
range += 10;
config_set_int("client.graphics.range.min",range);
snprintf(buff,512,gettext("Minimum viewing range changed to %d"),range);
chatline_add(&chat_lines,narrow_to_wide(buff),-103.00);
vlprintf(CN_ACTION,gettext("Minimum viewing range changed to %d"),range);
}else if (input->wasKeyDown(getKeySetting(VLKC_RANGE_MINUS))) {
char buff[512];
int range = config_get_int("client.graphics.range.min");
range -= 10;
if (range < 10)
range = 10;
config_set_int("client.graphics.range.min",range);
snprintf(buff,512,gettext("Minimum viewing range changed to %d"),range);
chatline_add(&chat_lines,narrow_to_wide(buff),-103.00);
vlprintf(CN_ACTION,gettext("Minimum viewing range changed to %d"),range);
}
// Item selection with mouse wheel
@ -1337,10 +1307,10 @@ void the_game(
draw_control.range_all = !draw_control.range_all;
if (draw_control.range_all) {
infostream<<"Enabled full viewing range"<<std::endl;
chatline_add(&chat_lines,narrow_to_wide(gettext("Enabled full viewing range")),-103.00);
vlprint(CN_ACTION,gettext("Enabled full viewing range"));
}else{
infostream<<"Disabled full viewing range"<<std::endl;
chatline_add(&chat_lines,narrow_to_wide(gettext("Disabled full viewing range")),-103.00);
vlprint(CN_ACTION,gettext("Disabled full viewing range"));
}
}
@ -2011,68 +1981,9 @@ void the_game(
guitext_info->setVisible(false);
}
/*
Get chat messages from client
*/
{
std::wstring message;
/* get new messages */
while (client.getChatMessage(message)) {
chatline_add(&chat_lines,message,0.0);
}
}
if (chat_lines) {
ref_t *ref;
ref_t *refn;
ChatLine *line;
std::wstring whole;
s16 line_number = 0;
/* first, remove old status messages */
ref = chat_lines;
while (ref) {
line = (ChatLine*)ref->ref;
if (line->age < -50) {
line->age += dtime;
if (line->age > -100.0) {
refn = ref;
ref = ref->next;
chat_lines = (ref_t*)list_remove(&chat_lines,refn);
delete line;
free(refn);
continue;
}
}else{
line_number++;
}
ref = ref->next;
}
/* second, remove old and excess chat messages */
ref = chat_lines;
while (ref) {
line = (ChatLine*)ref->ref;
if (line->age > -50) {
line_number--;
line->age += dtime;
float allowed_age = (6-line_number) * 60.0;
if (line->age > allowed_age) {
refn = ref;
ref = ref->next;
chat_lines = (ref_t*)list_remove(&chat_lines,refn);
delete line;
free(refn);
continue;
}
}
whole += line->text + L'\n';
ref = ref->next;
}
guitext_chat->setText(whole.c_str());
// Update gui element size and position
if (ui_console_step(dtime)) {
std::wstring chattext = narrow_to_wide(ui_console_get());
guitext_chat->setText(chattext.c_str());
s32 chat_y = 5+(2*text_height);
core::rect<s32> rect(
10,
@ -2080,13 +1991,19 @@ void the_game(
screensize.X - 10,
chat_y + guitext_chat->getTextHeight()
);
guitext_chat->setRelativePosition(rect);
// Don't show chat if empty or profiler or debug is enabled
guitext_chat->setVisible(chat_lines != NULL && show_chat && show_profiler == 0);
guitext_chat->setVisible(show_chat && show_profiler == 0);
}else{
guitext_chat->setVisible(false);
s32 chat_y = 5+(2*text_height);
core::rect<s32> rect(
10,
chat_y,
screensize.X - 10,
chat_y + guitext_chat->getTextHeight()
);
guitext_chat->setRelativePosition(rect);
}
/*
@ -2301,24 +2218,6 @@ void the_game(
client.getEnv().getTime()
);
}
// FIXME
{
core::dimension2d<u32> screensize = driver->getScreenSize();
s32 x = (screensize.Width/2);
s32 y = (screensize.Height/2);
LocalPlayer* player = client.getLocalPlayer();
Tutorial *tuto = player->tutorial;
if (input->isKeyDown(getKeySetting(tuto->getCurrentTutorialCompletionValue())))
tuto->setCurrentTutorialToNext();
std::string tutotext = tuto->getCurrentTutorialText();
std::wstring text = narrow_to_wide(tutotext);
core::dimension2d<u32> textsize = guienv->getSkin()->getFont()->getDimension(text.c_str());
core::rect<s32> rect((x-412)-(textsize.Width/2), y+10, (x-412)+(textsize.Width/2), y+10+textsize.Height);
guienv->addStaticText(text.c_str(),rect);
}
}
/*
@ -2372,6 +2271,7 @@ void the_game(
clouds->drop();
clear_particles();
ui_console_clear();
bridge_register_client(NULL);

View File

@ -530,13 +530,11 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
rect += topleft_content + v2s32(80, 210);
Environment->addCheckBox(anisotropic, rect, this, GUI_ID_ANISOTROPIC_CB, narrow_to_wide(gettext("Anisotropic Filtering")).c_str());
}
/* TODO: make this not crash the game
{
core::rect<s32> rect(0, 0, 200, 30);
rect += topleft_content + v2s32(80, 240);
Environment->addCheckBox(texture_animation, rect, this, GUI_ID_TEXTUREANIM_CB, narrow_to_wide(gettext("Enable Texture Animation")).c_str());
}
*/
if (m_is_ingame) {
core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 280);
@ -715,13 +713,11 @@ bool GUISettingsMenu::acceptInput()
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
m_data.anisotropic_filter = ((gui::IGUICheckBox*)e)->isChecked();
}
/*
{
gui::IGUIElement *e = getElementFromId(GUI_ID_TEXTUREANIM_CB);
if (e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
m_data.texture_animation = ((gui::IGUICheckBox*)e)->isChecked();
}
*/
{
gui::IGUIElement *e = getElementFromId(GUI_ID_HOTBAR_CB);
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)

View File

@ -127,27 +127,29 @@ void vlprint(uint8_t type, char* str)
return;
switch (type) {
case 1:
case CN_ERROR:
strcpy(buff,"ERROR: ");
b += 7;
s -= 7;
break;
case 2:
case CN_WARN:
strcpy(buff,"WARNING: ");
b += 9;
s -= 9;
break;
case 3:
case CN_ACTION:
strcpy(buff,"ACTION: ");
b += 8;
s -= 8;
break;
case 4:
case CN_CHAT:
strcpy(buff,"CHAT: ");
b += 6;
s -= 6;
break;
case 6:
case CN_INFO:
break;
case CN_DEBUG:
strcpy(buff,"DEBUG: ");
b += 7;
s -= 7;
@ -162,9 +164,10 @@ void vlprint(uint8_t type, char* str)
if (type >= logdata.system_min_level && type <= logdata.system_max_level)
printf("%s\n",buff);
/*sys_console_print(buff,1);*/
/* TODO: log to game console */
/*if (type >= logdata.console_min_level && type <= logdata.console_max_level)
console_put(buff);*/
#ifndef SERVER
if (type >= logdata.console_min_level && type <= logdata.console_max_level)
ui_console_addline(type,str);
#endif
if (type < logdata.min_level || type > logdata.max_level)
return;

View File

@ -902,7 +902,7 @@ int main(int argc, char *argv[])
uint16_t font_size = config_get_int("client.ui.font.size");
char* v = config_get("client.ui.font");
if (!v)
v = "arimo.ttf";
v = "unifont.ttf";
if (path_get("font",v,1,buff,1024))
font = gui::CGUITTFont::createTTFont(guienv, buff, font_size, true, true, 1, 128);
#else

View File

@ -31,168 +31,164 @@ struct MineralFeatures g_mineral_features[MINERAL_MAX+1];
MineralFeatures & mineral_features(u8 i)
{
return g_mineral_features[i];
return g_mineral_features[i];
}
CraftItem *getDiggedMineralItem(u8 mineral, Player *player, InventoryItem *tool)
{
MineralFeatures m = mineral_features(mineral);
if (m.dug_item == CONTENT_IGNORE)
return NULL;
MineralFeatures m = mineral_features(mineral);
if (m.dug_item == CONTENT_IGNORE)
return NULL;
if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE)
return NULL;
if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE)
return NULL;
if (!tool && m.min_level > 0)
return NULL;
if (!tool && m.min_level > 0)
return NULL;
ToolItemFeatures *t = &content_toolitem_features(tool->getContent());
if (t->content == CONTENT_IGNORE && m.min_level > 0)
return NULL;
ToolItemFeatures *t = &content_toolitem_features(tool->getContent());
if (t->content == CONTENT_IGNORE && m.min_level > 0)
return NULL;
if (t->diginfo.level < m.min_level)
return NULL;
if (t->diginfo.level < m.min_level)
return NULL;
u16 count = m.dug_count_min;
u16 count_max = t->diginfo.level;
u16 data = tool->getData();
u16 count = m.dug_count_min;
u16 count_max = t->diginfo.level;
u16 data = tool->getData();
if (data != 0) {
EnchantmentInfo info;
while (enchantment_get(&data,&info)) {
switch (info.type) {
case ENCHANTMENT_MORE: // amplius increases the amount given
count += (info.level+1)/2;
count_max += info.level;
break;
case ENCHANTMENT_DONTBREAK: // gives no mineral
return NULL;
break;
default:;
}
}
}
if (data != 0) {
EnchantmentInfo info;
while (enchantment_get(&data,&info)) {
switch (info.type) {
case ENCHANTMENT_MORE: // amplius increases the amount given
count += (info.level+1)/2;
count_max += info.level;
break;
case ENCHANTMENT_DONTBREAK: // gives no mineral
return NULL;
break;
default:;
}
}
}
if (count_max > count) {
count = myrand_range(m.dug_count_min,count_max);
}
if (count_max > count) {
count = myrand_range(m.dug_count_min,count_max);
}
if (count > m.dug_count_max)
count = m.dug_count_max;
if (count > m.dug_count_max)
count = m.dug_count_max;
return new CraftItem(m.dug_item, count, 0);
return new CraftItem(m.dug_item, count, 0);
}
void init_mineral()
{
u8 i;
MineralFeatures *f = NULL;
u8 i;
MineralFeatures *f = NULL;
i = MINERAL_COAL;
f = &mineral_features(i);
f->description = gettext("Coal");
f->texture = "mineral_coal.png";
f->dug_item = CONTENT_CRAFTITEM_COAL;
i = MINERAL_COAL;
f = &mineral_features(i);
f->description = gettext("Coal");
f->texture = "mineral_coal.png";
f->dug_item = CONTENT_CRAFTITEM_COAL;
// Flint from gravel for level 2 tools
i = MINERAL_IRON;
f = &mineral_features(i);
f->description = gettext("Iron");
f->texture = "mineral_iron.png";
f->dug_item = CONTENT_CRAFTITEM_IRON;
f->min_level = 2;
i = MINERAL_COPPER;
f = &mineral_features(i);
f->description = gettext("Copper");
f->texture = "mineral_copper.png";
f->dug_item = CONTENT_CRAFTITEM_COPPER;
f->dug_count_max = 4;
f->min_level = 2;
i = MINERAL_TIN;
f = &mineral_features(i);
f->description = gettext("Tin");
f->texture = "mineral_tin.png";
f->dug_item = CONTENT_CRAFTITEM_TIN;
f->min_level = 2;
i = MINERAL_TIN;
f = &mineral_features(i);
f->description = gettext("Tin");
f->texture = "mineral_tin.png";
f->dug_item = CONTENT_CRAFTITEM_TIN;
f->min_level = 2;
i = MINERAL_COPPER;
f = &mineral_features(i);
f->description = gettext("Copper");
f->texture = "mineral_copper.png";
f->dug_item = CONTENT_CRAFTITEM_COPPER;
f->dug_count_max = 4;
f->min_level = 2;
// bronze for level 3 tools
i = MINERAL_SILVER;
f = &mineral_features(i);
f->description = gettext("Silver");
f->texture = "mineral_silver.png";
f->dug_item = CONTENT_CRAFTITEM_SILVER;
f->min_level = 3;
i = MINERAL_IRON;
f = &mineral_features(i);
f->description = gettext("Iron");
f->texture = "mineral_iron.png";
f->dug_item = CONTENT_CRAFTITEM_IRON;
f->min_level = 3;
i = MINERAL_GOLD;
f = &mineral_features(i);
f->description = gettext("Gold");
f->texture = "mineral_gold.png";
f->dug_item = CONTENT_CRAFTITEM_GOLD;
f->min_level = 3;
i = MINERAL_MITHRIL;
f = &mineral_features(i);
f->description = gettext("Mithril");
f->texture = "mineral_mithril.png";
f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW;
f->min_level = 4;
i = MINERAL_QUARTZ;
f = &mineral_features(i);
f->description = gettext("Quartz");
f->texture = "mineral_quartz.png";
f->dug_item = CONTENT_CRAFTITEM_QUARTZ;
f->min_level = 3;
i = MINERAL_SALT;
f = &mineral_features(i);
f->description = gettext("Salt");
f->texture = "mineral_salt.png";
f->dug_item = CONTENT_CRAFTITEM_SALT;
f->min_level = 1;
f->dug_count_max = 2;
i = MINERAL_MITHRIL;
f = &mineral_features(i);
f->description = gettext("Mithril");
f->texture = "mineral_mithril.png";
f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW;
f->min_level = 3;
i = MINERAL_SILVER;
f = &mineral_features(i);
f->description = gettext("Silver");
f->texture = "mineral_silver.png";
f->dug_item = CONTENT_CRAFTITEM_SILVER;
f->min_level = 3;
i = MINERAL_RUBY;
f = &mineral_features(i);
f->description = gettext("Ruby");
f->texture = "mineral_ruby.png";
f->dug_item = CONTENT_CRAFTITEM_RUBY;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_GOLD;
f = &mineral_features(i);
f->description = gettext("Gold");
f->texture = "mineral_gold.png";
f->dug_item = CONTENT_CRAFTITEM_GOLD;
f->min_level = 3;
i = MINERAL_TURQUOISE;
f = &mineral_features(i);
f->description = gettext("Turquoise");
f->texture = "mineral_turquoise.png";
f->dug_item = CONTENT_CRAFTITEM_TURQUOISE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_QUARTZ;
f = &mineral_features(i);
f->description = gettext("Quartz");
f->texture = "mineral_quartz.png";
f->dug_item = CONTENT_CRAFTITEM_QUARTZ;
f->min_level = 3;
i = MINERAL_AMETHYST;
f = &mineral_features(i);
f->description = gettext("Amethyst");
f->texture = "mineral_amethyst.png";
f->dug_item = CONTENT_CRAFTITEM_AMETHYST;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_RUBY;
f = &mineral_features(i);
f->description = gettext("Ruby");
f->texture = "mineral_ruby.png";
f->dug_item = CONTENT_CRAFTITEM_RUBY;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SAPPHIRE;
f = &mineral_features(i);
f->description = gettext("Sapphire");
f->texture = "mineral_sapphire.png";
f->dug_item = CONTENT_CRAFTITEM_SAPPHIRE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_TURQUOISE;
f = &mineral_features(i);
f->description = gettext("Turquoise");
f->texture = "mineral_turquoise.png";
f->dug_item = CONTENT_CRAFTITEM_TURQUOISE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SUNSTONE;
f = &mineral_features(i);
f->description = gettext("Sunstone");
f->texture = "mineral_sunstone.png";
f->dug_item = CONTENT_CRAFTITEM_SUNSTONE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_AMETHYST;
f = &mineral_features(i);
f->description = gettext("Amethyst");
f->texture = "mineral_amethyst.png";
f->dug_item = CONTENT_CRAFTITEM_AMETHYST;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SAPPHIRE;
f = &mineral_features(i);
f->description = gettext("Sapphire");
f->texture = "mineral_sapphire.png";
f->dug_item = CONTENT_CRAFTITEM_SAPPHIRE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SUNSTONE;
f = &mineral_features(i);
f->description = gettext("Sunstone");
f->texture = "mineral_sunstone.png";
f->dug_item = CONTENT_CRAFTITEM_SUNSTONE;
f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SALT;
f = &mineral_features(i);
f->description = gettext("Salt");
f->texture = "mineral_salt.png";
f->dug_item = CONTENT_CRAFTITEM_SALT;
f->min_level = 1;
f->dug_count_max = 2;
}

View File

@ -76,39 +76,28 @@ std::vector<NodeBox> ClockNodeMetadata::getNodeBoxes(MapNode &n) {
v[2] = m/10;
v[3] = m%10;
f32 x[4] = {-0.180,0.0225,0.2925,0.5};
f32 x[4] = {-0.125,0.0625,0.3125,0.5};
u8 b[10] = {0xFC,0x0C,0xB6,0x9E,0x4E,0xDA,0xFA,0x8C,0xFE,0xDE};
float z1 = -0.125;
float z2 = -0.0625;
for (int i=0; i<4; i++) {
// clock numbers are built from 7 segments
// top
if ((b[v[i]]&0x80))
boxes.push_back(NodeBox((-0.25+x[i])*BS,0.0625*BS,z1*BS,(-0.0625+x[i])*BS,0.125*BS,z2*BS));
// top right
boxes.push_back(NodeBox((-0.25+x[i])*BS,0.0625*BS,-0.125*BS,(-0.0625+x[i])*BS,0.125*BS,-0.0625*BS));
if ((b[v[i]]&0x04))
boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.125*BS,z1*BS,(-0.0625+x[i])*BS,0.125*BS,z2*BS));
// bottom right
boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.0625*BS,-0.125*BS,(-0.0625+x[i])*BS,0.0625*BS,-0.0625*BS));
if ((b[v[i]]&0x08))
boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.3125*BS,z1*BS,(-0.0625+x[i])*BS,-0.0625*BS,z2*BS));
// bottom
boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.25*BS,-0.125*BS,(-0.0625+x[i])*BS,-0.125*BS,-0.0625*BS));
if ((b[v[i]]&0x10))
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,z1*BS,(-0.0625+x[i])*BS,-0.25*BS,z2*BS));
// bottom left
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,-0.125*BS,(-0.0625+x[i])*BS,-0.25*BS,-0.0625*BS));
if ((b[v[i]]&0x20))
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,z1*BS,(-0.1875+x[i])*BS,-0.0625*BS,z2*BS));
// top left
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.25*BS,-0.125*BS,(-0.1875+x[i])*BS,-0.125*BS,-0.0625*BS));
if ((b[v[i]]&0x40))
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.125*BS,z1*BS,(-0.1875+x[i])*BS,0.125*BS,z2*BS));
// middle
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.0625*BS,-0.125*BS,(-0.1875+x[i])*BS,0.0625*BS,-0.0625*BS));
if ((b[v[i]]&0x02))
boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.125*BS,z1*BS,(-0.0625+x[i])*BS,-0.0625*BS,z2*BS));
boxes.push_back(NodeBox((-0.1875+x[i])*BS,-0.125*BS,-0.125*BS,(-0.125+x[i])*BS,-0.0625*BS,-0.0625*BS));
}
return boxes;
return transformNodeBox(n,boxes);
}
bool ClockNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{

View File

@ -136,17 +136,8 @@ bool CraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env
{
InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0);
if (!t || t->getContent() == CONTENT_IGNORE){
// nothing in result box so clear recipe list
InventoryList *rec_list = m_inventory->getList("recipe");
if (rec_list) {
//clear out the recipe grid if the item slot is empty
rec_list->clearItems();
return true;
}
if (!t || t->getContent() == CONTENT_IGNORE)
return false;
}
content_t *r = crafting::getRecipe(t,m_recipe);
if (!r) {
if (m_recipe == 0)
@ -477,24 +468,12 @@ void ReverseCraftGuideNodeMetadata::inventoryModified()
}
bool ReverseCraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{
//make sure there's a valid item list
InventoryList *item_list = m_inventory->getList("item");
if (!item_list) return false;
//get the item in the item box
InventoryItem *item = item_list->getItem(0);
InventoryItem *item = m_inventory->getList("item")->getItem(0);
//if there's no item in the item box, do nothing
if (!item || item->getContent() == CONTENT_IGNORE) {
// nothing in item box so clear recipe and result lists
InventoryList *rec_list = m_inventory->getList("recipe");
if (rec_list)
rec_list->clearItems();
InventoryList *res_list = m_inventory->getList("result");
if (res_list)
res_list->clearItems();
return true;
}
if (!item || item->getContent() == CONTENT_IGNORE)
return false;
//attempt to look up the recipe
crafting::FoundReverseRecipe recipe = crafting::getReverseRecipe(item, m_recipe);
@ -752,17 +731,8 @@ bool CookBookNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{
InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0);
if (!t || t->getContent() == CONTENT_IGNORE){
// nothing in result box so clear recipe list
InventoryList *rec_list = m_inventory->getList("recipe");
if (rec_list) {
//clear out the recipe grid if the item slot is empty
rec_list->clearItems();
return true;
}
if (!t || t->getContent() == CONTENT_IGNORE)
return false;
}
InventoryItem *cookresult = t->createCookResult();
if (!cookresult || cookresult->getContent() == CONTENT_IGNORE)
return false;
@ -1022,29 +992,16 @@ bool DeCraftNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{
InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0);
int leave = 0;
if (!t || t->getContent() == CONTENT_IGNORE)
leave=1;
else if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK)
leave=1;
else if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK)
leave=1;
else if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK)
leave=1;
else if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "")
leave=1;
if (leave) {
// nothing in item box so clear recipe and result lists
InventoryList *rec_list = m_inventory->getList("recipe");
if (rec_list)
rec_list->clearItems();
InventoryList *ran_list = m_inventory->getList("random");
if (ran_list)
ran_list->clearItems();
return true;
}
return false;
if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK)
return false;
if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK)
return false;
if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK)
return false;
if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "")
return false;
l = m_inventory->getList("recipe");
l->clearItems();
if (content_features(t->getContent()).dug_item != "") {

View File

@ -127,7 +127,7 @@ std::vector<NodeBox> BookShelfNodeMetadata::getNodeBoxes(MapNode &n)
));
}
return boxes;
return transformNodeBox(n,boxes);
}
/*

View File

@ -40,15 +40,15 @@
#include <stdlib.h>
static struct {
char* cwd; // current working directory
char* data_custom; // set by config data_path
char* data_user; // ~/.local/share/voxelands
char* data_global; // /usr/share/voxelands
char* data; // ./data if it exists
char* world; // data_user + /worlds/ + world name
char* home; // ~/.
char* config; // ~/.config/voxelands
char* screenshot; // set by config screenshot_path
char* cwd; /* current working directory */
char* data_custom; /* set by config data_path */
char* data_user; /* ~/.local/share/voxelands */
char* data_global; /* /usr/share/voxelands */
char* data; /* ./data if it exists */
char* world; /* data_user + /worlds/ + world name */
char* home; /* ~/. */
char* config; /* ~/.config/voxelands */
char* screenshot; /* set by config screenshot_path */
} path = {
NULL,
NULL,

View File

@ -72,8 +72,7 @@ Player::Player():
m_home(0,0,0),
m_hashome(false),
m_character(PLAYER_DEFAULT_CHARDEF),
m_given_clothes(false),
tutorial(new Tutorial())
m_given_clothes(false)
{
updateName("<not set>");
for (u8 i=0; i<PLAYERFLAG_COUNT; i++) {
@ -1308,4 +1307,5 @@ video::ITexture* LocalPlayer::getTexture()
return g_texturesource->getTextureRaw(tex);
}
#endif
#endif

View File

@ -32,19 +32,18 @@
#endif
#include "inventory.h"
#include "collision.h"
#include "tutorial.h"
#define PLAYERNAME_SIZE 20
#define PLAYERNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
#define PLAYER_DEFAULT_CHARDEF "M:10:10:fair:blue:brown:medium:human:green:blue:leather"
#define PLAYERANIM_STAND 0
#define PLAYERANIM_WALK 1
#define PLAYERANIM_DIG 2
#define PLAYERANIM_STAND 0
#define PLAYERANIM_WALK 1
#define PLAYERANIM_DIG 2
#define PLAYERANIM_WALKDIG 3
#define PLAYERANIM_DIE 4
#define PLAYERANIM_SIT 5
#define PLAYERANIM_DIE 4
#define PLAYERANIM_SIT 5
/*
Animation Indices
@ -56,44 +55,44 @@
Dig/Walk 200-219
*/
#define PLAYERFLAG_HOME -1
#define PLAYERFLAG_WHITE 0
#define PLAYERFLAG_BLUE 1
#define PLAYERFLAG_GREEN 2
#define PLAYERFLAG_HOME -1
#define PLAYERFLAG_WHITE 0
#define PLAYERFLAG_BLUE 1
#define PLAYERFLAG_GREEN 2
#define PLAYERFLAG_ORANGE 3
#define PLAYERFLAG_PURPLE 4
#define PLAYERFLAG_RED 5
#define PLAYERFLAG_RED 5
#define PLAYERFLAG_YELLOW 6
#define PLAYERFLAG_BLACK 7
#define PLAYERFLAG_COUNT 8
#define PLAYERFLAG_JUMP PLAYERFLAG_COUNT
#define PLAYERFLAG_BLACK 7
#define PLAYERFLAG_COUNT 8
#define PLAYERFLAG_JUMP PLAYERFLAG_COUNT
#define PLAYER_FEET 0x01
#define PLAYER_LLEG 0x02
#define PLAYER_RLEG 0x04
#define PLAYER_TORSO 0x08
#define PLAYER_HANDS 0x10
#define PLAYER_LARM 0x20
#define PLAYER_RARM 0x40
#define PLAYER_HEAD 0x80
#define PLAYER_ALL 0xFF
#define PLAYER_FEET 0x01
#define PLAYER_LLEG 0x02
#define PLAYER_RLEG 0x04
#define PLAYER_TORSO 0x08
#define PLAYER_HANDS 0x10
#define PLAYER_LARM 0x20
#define PLAYER_RARM 0x40
#define PLAYER_HEAD 0x80
#define PLAYER_ALL 0xFF
#define DAMAGE_NONE 0x00
#define DAMAGE_UNKNOWN 0x01
#define DAMAGE_FALL 0x02
#define DAMAGE_EXPOSURE 0x03
#define DAMAGE_COLD 0x04
#define DAMAGE_ATTACK 0x05
#define DAMAGE_SPACE 0x06
#define DAMAGE_HUNGER 0x07
#define DAMAGE_AIR 0x08
#define DAMAGE_LAVA 0x09
#define DAMAGE_CACTUS 0x0A
#define DAMAGE_FIRE 0x0B
#define DAMAGE_TNT 0x0C
#define DAMAGE_STEAM 0x0D
#define DAMAGE_POISON 0x0E
#define DAMAGE_SHADOW 0x0F
#define DAMAGE_NONE 0x00
#define DAMAGE_UNKNOWN 0x01
#define DAMAGE_FALL 0x02
#define DAMAGE_EXPOSURE 0x03
#define DAMAGE_COLD 0x04
#define DAMAGE_ATTACK 0x05
#define DAMAGE_SPACE 0x06
#define DAMAGE_HUNGER 0x07
#define DAMAGE_AIR 0x08
#define DAMAGE_LAVA 0x09
#define DAMAGE_CACTUS 0x0A
#define DAMAGE_FIRE 0x0B
#define DAMAGE_TNT 0x0C
#define DAMAGE_STEAM 0x0D
#define DAMAGE_POISON 0x0E
#define DAMAGE_SHADOW 0x0F
class Map;
@ -392,8 +391,6 @@ public:
// the unclothed player skin parts
void getSkin(std::vector<std::string> &parts);
Tutorial *tutorial;
protected:
char m_name[PLAYERNAME_SIZE];
u16 m_selected_item;
@ -686,3 +683,4 @@ private:
#endif // !SERVER
#endif

View File

@ -1793,7 +1793,7 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
gui::IGUIFont *std_font = skin->getFont();
static gui::IGUIFont *tex_font = NULL;
#if USE_FREETYPE
if (path_get("font","arimo.ttf",1,buff,1024)) {
if (path_get("font","unifont.ttf",1,buff,1024)) {
int sz = 10*((dim.Width/16)+1);
if (sz < 10)
sz = 12;

View File

@ -1,121 +0,0 @@
/************************************************************************
* Minetest-c55
* Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
*
* tutorial.h
* voxelands - 3d voxel world sandbox game
* Copyright (C) Lisa 'darkrose' Milne 2013-2014 <lisa@ltmnet.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne
* for Voxelands.
*
* Created by Futuray
************************************************************************/
#include "tutorial.h"
Tutorial::Tutorial():
currentTutorial(0)
{
};
Tutorial::Tutorial(int current):
currentTutorial(current)
{
};
Tutorial::~Tutorial()
{
};
std::string Tutorial::getText(int num)
{
switch(num) // TODO : translations
{
case TUTORIAL_WALK :
return (std::string)"Press the [W] button to walk forward.";
case TUTORIAL_JUMP :
return (std::string)"Press the spacebar to jump.";
/* case TUTORIAL_LOOK :
return (std::string)"Move the mouse to look around you."; */
case TUTORIAL_INVENTORY :
return (std::string)"Press the [I] button to open your inventory\nand the [Q] button to interact with nodes.";
/*case TUTORIAL_DIG_PLACE :
return (std::string)"Use the left click to dig nodes and the right click to place them.";*/
case TUTORIAL_EAT :
return (std::string)"Use the [H] button to eat any food.";
default :
return (std::string)"Tutorial is done!";
};
}
void Tutorial::setCurrentTutorialToNext()
{
this->currentTutorial++;
}
void Tutorial::setCurrentTutorialToNumber(int number)
{
this->currentTutorial = number;
}
int Tutorial::getCurrentTutorialNumber()
{
return this->currentTutorial;
}
int Tutorial::getCurrentTutorialCompletionValue()
{
switch(this->currentTutorial)
{
case TUTORIAL_WALK :
return TUTORIAL_KEY_WALK;
case TUTORIAL_JUMP :
return TUTORIAL_KEY_JUMP;
/* case TUTORIAL_LOOK :
return (std::string)"Move the mouse to look around you."; */
case TUTORIAL_INVENTORY :
return TUTORIAL_KEY_INVENTORY;
/*case TUTORIAL_DIG_PLACE :
return (std::string)"Use the left click to dig nodes and the right click to place them.";*/
case TUTORIAL_EAT :
return TUTORIAL_KEY_EAT;
default :
return 0;
};
}
std::string Tutorial::getCurrentTutorialText()
{
return this->getText(this->currentTutorial);
}
std::string Tutorial::getNumberText(int number)
{
return this->getText(number);
}

View File

@ -1,93 +0,0 @@
/************************************************************************
* Minetest-c55
* Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
*
* tutorial.h
* voxelands - 3d voxel world sandbox game
* Copyright (C) Lisa 'darkrose' Milne 2013-2014 <lisa@ltmnet.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne
* for Voxelands.
*
* Created by Futuray
************************************************************************/
/* 2304
{
vlprintf(CN_INFO,"Tuto Begin");
core::dimension2d<u32> screensize = driver->getScreenSize();
s32 x = (screensize.Width/2);
s32 y = (screensize.Height/2);
LocalPlayer* player = client.getLocalPlayer();
Tutorial *tuto = player->tutorial;
std::string tutotext = tuto->getCurrentTutorialText();
std::wstring text = narrow_to_wide(tutotext);
core::dimension2d<u32> textsize = guienv->getSkin()->getFont()->getDimension(text.c_str());
core::rect<s32> rect((x-412)-(textsize.Width/2), y+10, (x-412)+(textsize.Width/2), y+10+textsize.Height);
guienv->addStaticText(text.c_str(),rect);
vlprintf(CN_INFO,"Tuto OK"); //chatline_add(&chat_lines,narrow_to_wide(gettext("HUD shown")),-103.00);
}
*/
// 395 [player.h]
// #include "tutorial.h"
// Tutorial *tutorial;
// 76 [player.cpp]
// tutorial(new Tutorial())
#ifndef TUTORIAL_HEADER
#define TUTORIAL_HEADER
#include "log.h"
#include "common.h"
#include "keycode.h"
#include <string>
#define TUTORIAL_WALK 0
#define TUTORIAL_JUMP 1
// #define TUTORIAL_LOOK 2 # FIXME : find a way to check if the player look around
#define TUTORIAL_INVENTORY 2
// #define TUTORIAL_DIG_PLACE 3 # FIXME : find a way to check if the player push Leftclick
#define TUTORIAL_EAT 3
#define TUTORIAL_KEY_WALK VLKC_FORWARD
#define TUTORIAL_KEY_JUMP VLKC_JUMP
// #define TUTORIAL_KEY_LOOK ???
#define TUTORIAL_KEY_INVENTORY VLKC_INVENTORY
// #define TUTORIAL_KEY_DIG_PLACE VLKC_FORWARD
#define TUTORIAL_KEY_EAT VLKC_USE
class Tutorial
{
public:
Tutorial();
Tutorial(int current);
virtual ~Tutorial();
std::string getText(int num);
void setCurrentTutorialToNext();
void setCurrentTutorialToNumber(int number);
int getCurrentTutorialNumber();
int getCurrentTutorialCompletionValue();
std::string getCurrentTutorialText();
std::string getNumberText(int number);
int currentTutorial;
};
#endif

213
src/ui_console.c Normal file
View File

@ -0,0 +1,213 @@
/************************************************************************
* ui_console.c
* voxelands - 3d voxel world sandbox game
* Copyright (C) Lisa 'darkrose' Milne 2017 <lisa@ltmnet.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
************************************************************************/
#include "common.h"
#include "list.h"
#include "thread.h"
#include <stdarg.h>
#include <string.h>
typedef struct chatline_s {
struct chatline_s *prev;
struct chatline_s *next;
uint8_t type;
float age;
char buff[1024];
} chatline_t;
static struct {
chatline_t *lines;
mutex_t *mutex;
int count;
int changed;
char buff[10240];
} ui_console_data = {
NULL,
NULL,
0,
1
};
void ui_console_addline(uint8_t type, char* txt)
{
chatline_t *l;
chatline_t *p;
char* b;
int s = 1024;
if (!txt || !txt[0])
return;
l = malloc(sizeof(chatline_t));
if (!l)
return;
l->type = type;
b = l->buff;
l->age = 0.0;
switch (type) {
case CN_ERROR:
strcpy(l->buff,"ERROR: ");
b += 7;
s -= 7;
break;
case CN_WARN:
strcpy(l->buff,"WARNING: ");
b += 9;
s -= 9;
break;
case CN_ACTION:
strcpy(l->buff,"ACTION: ");
b += 8;
s -= 8;
break;
case CN_CHAT:
case CN_INFO:
break;
case CN_DEBUG:
strcpy(l->buff,"DEBUG: ");
b += 7;
s -= 7;
break;
default:;
}
if (snprintf(b,s,"%s",txt) >= s)
return;
if (!ui_console_data.mutex)
ui_console_data.mutex = mutex_create();
mutex_lock(ui_console_data.mutex);
printf("CHATLINE: '%s'\n",l->buff);
p = list_last(&ui_console_data.lines);
if (p && p->type == l->type && !strcmp(p->buff,l->buff)) {
p->age = 0.0;
free(l);
}else{
ui_console_data.lines = list_push(&ui_console_data.lines,l);
ui_console_data.changed = 1;
}
mutex_unlock(ui_console_data.mutex);
}
void ui_console_addlinef(uint8_t type, char* fmt, ...)
{
char buff[1024];
va_list ap;
if (!fmt || !fmt[0])
return;
va_start(ap, fmt);
if (vsnprintf(buff, 1024, fmt, ap) >= 1024) {
va_end(ap);
return;
}
va_end(ap);
}
void ui_console_clear()
{
chatline_t *l;
if (!ui_console_data.mutex)
return;
mutex_lock(ui_console_data.mutex);
while ((l = list_pop(&ui_console_data.lines)) != NULL) {
free(l);
}
mutex_unlock(ui_console_data.mutex);
mutex_free(ui_console_data.mutex);
ui_console_data.mutex = NULL;
ui_console_data.count = 0;
ui_console_data.changed = 1;
ui_console_data.buff[0] = 0;
}
int ui_console_step(float dtime)
{
chatline_t *line;
chatline_t *rem;
int changed = ui_console_data.changed;
int count = 0;
if (!ui_console_data.mutex)
return 0;
mutex_lock(ui_console_data.mutex);
line = ui_console_data.lines;
while (line) {
if (line->age > 60.0) {
changed = 1;
rem = line;
line = line->next;
ui_console_data.lines = list_remove(&ui_console_data.lines,rem);
free(rem);
continue;
}
count++;
line = line->next;
}
while (count > 5 && ui_console_data.lines) {
changed = 1;
rem = list_pull(&ui_console_data.lines);
free(rem);
}
if (changed) {
int s = 10239;
int l;
char* b = ui_console_data.buff;
line = ui_console_data.lines;
while (line && s > 0) {
l = strlen(line->buff);
if (snprintf(b,s,"%s\n",line->buff) < s) {
l++;
b += l;
s -= l;
}
line = line->next;
}
*b = 0;
}
ui_console_data.changed = 0;
mutex_unlock(ui_console_data.mutex);
return changed;
}
/* TODO: this, but it's a C++ bridge, so not really */
char* ui_console_get()
{
if (!ui_console_data.mutex)
return "";
mutex_lock(ui_console_data.mutex);
return ui_console_data.buff;
mutex_unlock(ui_console_data.mutex);
}