Merge pull request #2 from MultiCraftProject/multicraft-dev
Multicraft dev
This commit is contained in:
commit
24d943bfa9
@ -197,8 +197,8 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
|
|||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
||||||
set(CPACK_PACKAGE_VENDOR "celeron55")
|
set(CPACK_PACKAGE_VENDOR "MoNTE48")
|
||||||
set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
|
set(CPACK_PACKAGE_CONTACT "MoNTE48@mail.ua")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
@ -19,8 +19,8 @@ GAMES_TO_COPY = minetest_game
|
|||||||
# Android Version code
|
# Android Version code
|
||||||
# Increase for each build!
|
# Increase for each build!
|
||||||
################################################################################
|
################################################################################
|
||||||
# Play Store actual version (16/03/15): 11
|
|
||||||
ANDROID_VERSION_CODE = 12
|
ANDROID_VERSION_CODE = 1
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# toolchain config for arm old processors
|
# toolchain config for arm old processors
|
||||||
|
@ -416,7 +416,7 @@ msgstr "Schöne Bäume"
|
|||||||
|
|
||||||
#: builtin/mainmenu/tab_settings.lua:189
|
#: builtin/mainmenu/tab_settings.lua:189
|
||||||
msgid "Opaque Water"
|
msgid "Opaque Water"
|
||||||
msgstr "Undurchsichtiges Wasser"
|
msgstr "Undurchs. Wasser"
|
||||||
|
|
||||||
#: builtin/mainmenu/tab_settings.lua:191
|
#: builtin/mainmenu/tab_settings.lua:191
|
||||||
msgid "Connected Glass"
|
msgid "Connected Glass"
|
||||||
|
@ -573,7 +573,6 @@ private:
|
|||||||
bool m_inventory_updated;
|
bool m_inventory_updated;
|
||||||
Inventory *m_inventory_from_server;
|
Inventory *m_inventory_from_server;
|
||||||
float m_inventory_from_server_age;
|
float m_inventory_from_server_age;
|
||||||
std::set<v3s16> m_active_blocks;
|
|
||||||
PacketCounter m_packetcounter;
|
PacketCounter m_packetcounter;
|
||||||
bool m_show_highlighted;
|
bool m_show_highlighted;
|
||||||
// Block mesh animation parameters
|
// Block mesh animation parameters
|
||||||
|
@ -183,7 +183,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
|
|||||||
{
|
{
|
||||||
// Set the window caption
|
// Set the window caption
|
||||||
const wchar_t *text = wgettext("Main Menu");
|
const wchar_t *text = wgettext("Main Menu");
|
||||||
device->setWindowCaption((narrow_to_wide(PROJECT_NAME) + L" [" + text + L"]").c_str());
|
device->setWindowCaption((narrow_to_wide("MultiCraft") + L" [" + text + L"]").c_str());
|
||||||
delete[] text;
|
delete[] text;
|
||||||
|
|
||||||
try { // This is used for catching disconnects
|
try { // This is used for catching disconnects
|
||||||
|
@ -1238,7 +1238,7 @@ void ServerEnvironment::step(float dtime)
|
|||||||
// Read messages from object
|
// Read messages from object
|
||||||
while(!obj->m_messages_out.empty())
|
while(!obj->m_messages_out.empty())
|
||||||
{
|
{
|
||||||
m_active_object_messages.push_back(
|
m_active_object_messages.push(
|
||||||
obj->m_messages_out.front());
|
obj->m_messages_out.front());
|
||||||
obj->m_messages_out.pop();
|
obj->m_messages_out.pop();
|
||||||
}
|
}
|
||||||
@ -1462,7 +1462,7 @@ ActiveObjectMessage ServerEnvironment::getActiveObjectMessage()
|
|||||||
return ActiveObjectMessage(0);
|
return ActiveObjectMessage(0);
|
||||||
|
|
||||||
ActiveObjectMessage message = m_active_object_messages.front();
|
ActiveObjectMessage message = m_active_object_messages.front();
|
||||||
m_active_object_messages.pop_front();
|
m_active_object_messages.pop();
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <queue>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
#include "activeobject.h"
|
#include "activeobject.h"
|
||||||
@ -378,7 +379,7 @@ private:
|
|||||||
// Active object list
|
// Active object list
|
||||||
std::map<u16, ServerActiveObject*> m_active_objects;
|
std::map<u16, ServerActiveObject*> m_active_objects;
|
||||||
// Outgoing network message buffer for active objects
|
// Outgoing network message buffer for active objects
|
||||||
std::list<ActiveObjectMessage> m_active_object_messages;
|
std::queue<ActiveObjectMessage> m_active_object_messages;
|
||||||
// Some timers
|
// Some timers
|
||||||
float m_send_recommended_timer;
|
float m_send_recommended_timer;
|
||||||
IntervalLimiter m_object_management_interval;
|
IntervalLimiter m_object_management_interval;
|
||||||
|
74
src/game.cpp
74
src/game.cpp
@ -1029,9 +1029,13 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#define SIZE_TAG "size[11,5.5]"
|
# define SIZE_TAG "size[11,5.5]"
|
||||||
|
# define PAUSE_MENU_SIZE_TAG "size[6,3.5]"
|
||||||
|
# define PAUSE_MENU_BUTTON_LEFT 1.5
|
||||||
#else
|
#else
|
||||||
#define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
|
# define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
|
||||||
|
# define PAUSE_MENU_SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
|
||||||
|
# define PAUSE_MENU_BUTTON_LEFT 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void show_chat_menu(GUIFormSpecMenu **cur_formspec,
|
static void show_chat_menu(GUIFormSpecMenu **cur_formspec,
|
||||||
@ -1083,19 +1087,19 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
|
|||||||
bool singleplayermode)
|
bool singleplayermode)
|
||||||
{
|
{
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
|
// std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
|
||||||
"No menu visible:\n"
|
// "No menu visible:\n"
|
||||||
"- single tap: button activate\n"
|
// "- single tap: button activate\n"
|
||||||
"- double tap: place/use\n"
|
// "- double tap: place/use\n"
|
||||||
"- slide finger: look around\n"
|
// "- slide finger: look around\n"
|
||||||
"Menu/Inventory visible:\n"
|
// "Menu/Inventory visible:\n"
|
||||||
"- double tap (outside):\n"
|
// "- double tap (outside):\n"
|
||||||
" -->close\n"
|
// " -->close\n"
|
||||||
"- touch stack, touch slot:\n"
|
// "- touch stack, touch slot:\n"
|
||||||
" --> move stack\n"
|
// " --> move stack\n"
|
||||||
"- touch&drag, tap 2nd finger\n"
|
// "- touch&drag, tap 2nd finger\n"
|
||||||
" --> place single item to slot\n"
|
// " --> place single item to slot\n"
|
||||||
));
|
// ));
|
||||||
#else
|
#else
|
||||||
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
|
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
|
||||||
"- WASD: move\n"
|
"- WASD: move\n"
|
||||||
@ -1114,29 +1118,31 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
|
|||||||
float ypos = singleplayermode ? 0.5 : 0.1;
|
float ypos = singleplayermode ? 0.5 : 0.1;
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
os << FORMSPEC_VERSION_STRING << SIZE_TAG
|
os << FORMSPEC_VERSION_STRING << PAUSE_MENU_SIZE_TAG
|
||||||
<< "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
|
<< "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_continue;"
|
||||||
<< wide_to_narrow(wstrgettext("Continue")) << "]";
|
<< wide_to_narrow(wstrgettext("Continue")) << "]";
|
||||||
|
|
||||||
if (!singleplayermode) {
|
if (!singleplayermode) {
|
||||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
|
os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_change_password;"
|
||||||
<< wide_to_narrow(wstrgettext("Change Password")) << "]";
|
<< wide_to_narrow(wstrgettext("Change Password")) << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
|
os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_sound;"
|
||||||
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
|
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
|
||||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
|
os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_key_config;"
|
||||||
<< wide_to_narrow(wstrgettext("Change Keys")) << "]";
|
<< wide_to_narrow(wstrgettext("Change Keys")) << "]";
|
||||||
#endif
|
#endif
|
||||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
|
os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_menu;"
|
||||||
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
|
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
|
||||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
|
os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_os;"
|
||||||
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
|
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
|
||||||
|
#ifndef __ANDROID__
|
||||||
<< "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
|
<< "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
|
||||||
<< "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME "\n"
|
<< "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME "\n"
|
||||||
<< g_build_info << "\n"
|
<< g_build_info << "\n"
|
||||||
<< "path_user = " << wrap_rows(porting::path_user, 20)
|
<< "path_user = " << wrap_rows(porting::path_user, 20)
|
||||||
|
#endif
|
||||||
<< "\n;]";
|
<< "\n;]";
|
||||||
|
|
||||||
/* Create menu */
|
/* Create menu */
|
||||||
@ -2029,7 +2035,7 @@ bool Game::createClient(const std::string &playername,
|
|||||||
|
|
||||||
/* Set window caption
|
/* Set window caption
|
||||||
*/
|
*/
|
||||||
std::wstring str = narrow_to_wide(PROJECT_NAME);
|
std::wstring str = narrow_to_wide("MultiCraft");
|
||||||
str += L" [";
|
str += L" [";
|
||||||
str += driver->getName();
|
str += driver->getName();
|
||||||
str += L"]";
|
str += L"]";
|
||||||
@ -2054,7 +2060,7 @@ bool Game::initGui()
|
|||||||
{
|
{
|
||||||
// First line of debug text
|
// First line of debug text
|
||||||
guitext = guienv->addStaticText(
|
guitext = guienv->addStaticText(
|
||||||
narrow_to_wide(PROJECT_NAME).c_str(),
|
narrow_to_wide("MultiCraft").c_str(),
|
||||||
core::rect<s32>(0, 0, 0, 0),
|
core::rect<s32>(0, 0, 0, 0),
|
||||||
false, false, guiroot);
|
false, false, guiroot);
|
||||||
|
|
||||||
@ -3509,14 +3515,24 @@ void Game::handlePointingAtNode(GameRunData *runData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool digging = false;
|
||||||
|
|
||||||
if (runData->nodig_delay_timer <= 0.0 && input->getLeftState()
|
if (runData->nodig_delay_timer <= 0.0 && input->getLeftState()
|
||||||
&& client->checkPrivilege("interact")) {
|
&& client->checkPrivilege("interact")) {
|
||||||
handleDigging(runData, pointed, nodepos, playeritem_toolcap, dtime);
|
handleDigging(runData, pointed, nodepos, playeritem_toolcap, dtime);
|
||||||
|
digging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((input->getRightClicked() ||
|
bool place = (input->getRightClicked() ||
|
||||||
runData->repeat_rightclick_timer >= m_repeat_right_click_time) &&
|
runData->repeat_rightclick_timer >= m_repeat_right_click_time) &&
|
||||||
client->checkPrivilege("interact")) {
|
client->checkPrivilege("interact");
|
||||||
|
|
||||||
|
#ifdef HAVE_TOUCHSCREENGUI
|
||||||
|
place &= !digging;
|
||||||
|
place |= input->getLeftReleased();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (place) {
|
||||||
runData->repeat_rightclick_timer = 0;
|
runData->repeat_rightclick_timer = 0;
|
||||||
infostream << "Ground right-clicked" << std::endl;
|
infostream << "Ground right-clicked" << std::endl;
|
||||||
|
|
||||||
@ -4018,7 +4034,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
|
|||||||
|
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
os << std::fixed
|
os << std::fixed
|
||||||
<< PROJECT_NAME " " << g_version_hash
|
<< "MultiCraft " << g_version_hash
|
||||||
<< " FPS = " << fps
|
<< " FPS = " << fps
|
||||||
<< " (R: range_all=" << draw_control->range_all << ")"
|
<< " (R: range_all=" << draw_control->range_all << ")"
|
||||||
<< std::setprecision(0)
|
<< std::setprecision(0)
|
||||||
@ -4034,7 +4050,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
|
|||||||
guitext->setVisible(true);
|
guitext->setVisible(true);
|
||||||
} else if (flags.show_hud || flags.show_chat) {
|
} else if (flags.show_hud || flags.show_chat) {
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
os << PROJECT_NAME " " << g_version_hash;
|
os << "MultiCraft " << g_version_hash;
|
||||||
guitext->setText(narrow_to_wide(os.str()).c_str());
|
guitext->setText(narrow_to_wide(os.str()).c_str());
|
||||||
guitext->setVisible(true);
|
guitext->setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
@ -4267,7 +4283,7 @@ void the_game(bool *kill,
|
|||||||
} catch (SerializationError &e) {
|
} catch (SerializationError &e) {
|
||||||
error_message = std::string("A serialization error occurred:\n")
|
error_message = std::string("A serialization error occurred:\n")
|
||||||
+ e.what() + "\n\nThe server is probably "
|
+ e.what() + "\n\nThe server is probably "
|
||||||
" running a different version of " PROJECT_NAME ".";
|
" running a different version of MultiCraft.";
|
||||||
errorstream << error_message << std::endl;
|
errorstream << error_message << std::endl;
|
||||||
} catch (ServerError &e) {
|
} catch (ServerError &e) {
|
||||||
error_message = e.what();
|
error_message = e.what();
|
||||||
|
@ -172,7 +172,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
|
|||||||
m_sound_manager = &dummySoundManager;
|
m_sound_manager = &dummySoundManager;
|
||||||
|
|
||||||
//create topleft header
|
//create topleft header
|
||||||
std::wstring t = narrow_to_wide(std::string(PROJECT_NAME " ") +
|
std::wstring t = narrow_to_wide(std::string("MultiCraft ") +
|
||||||
g_version_hash);
|
g_version_hash);
|
||||||
|
|
||||||
core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(t), g_fontengine->getTextHeight());
|
core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(t), g_fontengine->getTextHeight());
|
||||||
|
@ -324,26 +324,23 @@ size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, v3s16 p)
|
|||||||
if (schematic == NULL)
|
if (schematic == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (flags & DECO_PLACE_CENTER_X)
|
|
||||||
p.X -= (schematic->size.X + 1) / 2;
|
|
||||||
if (flags & DECO_PLACE_CENTER_Y)
|
|
||||||
p.Y -= (schematic->size.Y + 1) / 2;
|
|
||||||
if (flags & DECO_PLACE_CENTER_Z)
|
|
||||||
p.Z -= (schematic->size.Z + 1) / 2;
|
|
||||||
|
|
||||||
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
|
|
||||||
|
|
||||||
if (!vm->m_area.contains(p))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
u32 vi = vm->m_area.index(p);
|
u32 vi = vm->m_area.index(p);
|
||||||
content_t c = vm->m_data[vi].getContent();
|
content_t c = vm->m_data[vi].getContent();
|
||||||
if (!CONTAINS(c_place_on, c))
|
if (!CONTAINS(c_place_on, c))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (flags & DECO_PLACE_CENTER_X)
|
||||||
|
p.X -= (schematic->size.X - 1) / 2;
|
||||||
|
if (flags & DECO_PLACE_CENTER_Y)
|
||||||
|
p.Y -= (schematic->size.Y - 1) / 2;
|
||||||
|
if (flags & DECO_PLACE_CENTER_Z)
|
||||||
|
p.Z -= (schematic->size.Z - 1) / 2;
|
||||||
|
|
||||||
Rotation rot = (rotation == ROTATE_RAND) ?
|
Rotation rot = (rotation == ROTATE_RAND) ?
|
||||||
(Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
|
(Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
|
||||||
|
|
||||||
|
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
|
||||||
|
|
||||||
schematic->blitToVManip(p, vm, rot, force_placement, m_ndef);
|
schematic->blitToVManip(p, vm, rot, force_placement, m_ndef);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -149,9 +149,7 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
|
|||||||
u8 denyCode = SERVER_ACCESSDENIED_UNEXPECTED_DATA;
|
u8 denyCode = SERVER_ACCESSDENIED_UNEXPECTED_DATA;
|
||||||
*pkt >> denyCode;
|
*pkt >> denyCode;
|
||||||
if (denyCode == SERVER_ACCESSDENIED_CUSTOM_STRING) {
|
if (denyCode == SERVER_ACCESSDENIED_CUSTOM_STRING) {
|
||||||
std::wstring wide_reason;
|
*pkt >> m_access_denied_reason;
|
||||||
*pkt >> wide_reason;
|
|
||||||
m_access_denied_reason = wide_to_narrow(wide_reason);
|
|
||||||
}
|
}
|
||||||
else if (denyCode < SERVER_ACCESSDENIED_MAX) {
|
else if (denyCode < SERVER_ACCESSDENIED_MAX) {
|
||||||
m_access_denied_reason = accessDeniedStrings[denyCode];
|
m_access_denied_reason = accessDeniedStrings[denyCode];
|
||||||
|
@ -217,7 +217,7 @@ void Server::handleCommand_Auth(NetworkPacket* pkt)
|
|||||||
<< "but it was disallowed for the following reason: "
|
<< "but it was disallowed for the following reason: "
|
||||||
<< reason << std::endl;
|
<< reason << std::endl;
|
||||||
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING,
|
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING,
|
||||||
narrow_to_wide(reason.c_str()));
|
reason.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -894,6 +894,12 @@ int ModApiEnvMod::l_get_us_time(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ModApiEnvMod::l_get_project_name(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushstring(L, PROJECT_NAME);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void ModApiEnvMod::Initialize(lua_State *L, int top)
|
void ModApiEnvMod::Initialize(lua_State *L, int top)
|
||||||
{
|
{
|
||||||
API_FCT(set_node);
|
API_FCT(set_node);
|
||||||
@ -934,4 +940,5 @@ void ModApiEnvMod::Initialize(lua_State *L, int top)
|
|||||||
API_FCT(forceload_block);
|
API_FCT(forceload_block);
|
||||||
API_FCT(forceload_free_block);
|
API_FCT(forceload_free_block);
|
||||||
API_FCT(get_us_time);
|
API_FCT(get_us_time);
|
||||||
|
API_FCT(get_project_name);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,8 @@ private:
|
|||||||
// get us precision time
|
// get us precision time
|
||||||
static int l_get_us_time(lua_State *L);
|
static int l_get_us_time(lua_State *L);
|
||||||
|
|
||||||
|
static int l_get_project_name(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Initialize(lua_State *L, int top);
|
static void Initialize(lua_State *L, int top);
|
||||||
};
|
};
|
||||||
|
@ -1490,7 +1490,7 @@ void Server::SendBreath(u16 peer_id, u16 breath)
|
|||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason)
|
void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
@ -2535,7 +2535,7 @@ void Server::RespawnPlayer(u16 peer_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason)
|
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public:
|
|||||||
void peerAdded(con::Peer *peer);
|
void peerAdded(con::Peer *peer);
|
||||||
void deletingPeer(con::Peer *peer, bool timeout);
|
void deletingPeer(con::Peer *peer, bool timeout);
|
||||||
|
|
||||||
void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason=NULL);
|
void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
|
||||||
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
|
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
|
||||||
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type,float* retval);
|
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type,float* retval);
|
||||||
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
|
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
|
||||||
@ -383,7 +383,7 @@ private:
|
|||||||
void SendMovement(u16 peer_id);
|
void SendMovement(u16 peer_id);
|
||||||
void SendHP(u16 peer_id, u8 hp);
|
void SendHP(u16 peer_id, u8 hp);
|
||||||
void SendBreath(u16 peer_id, u16 breath);
|
void SendBreath(u16 peer_id, u16 breath);
|
||||||
void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason);
|
void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason);
|
||||||
void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason);
|
void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason);
|
||||||
void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target);
|
void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target);
|
||||||
void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version);
|
void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version);
|
||||||
|
@ -39,7 +39,7 @@ using namespace irr::core;
|
|||||||
|
|
||||||
extern Settings *g_settings;
|
extern Settings *g_settings;
|
||||||
|
|
||||||
const char** touchgui_button_imagenames = (const char*[]) {
|
const char *touchgui_button_imagenames[] = {
|
||||||
"up_arrow.png",
|
"up_arrow.png",
|
||||||
"down_arrow.png",
|
"down_arrow.png",
|
||||||
"left_arrow.png",
|
"left_arrow.png",
|
||||||
@ -49,7 +49,9 @@ const char** touchgui_button_imagenames = (const char*[]) {
|
|||||||
"jump_btn.png",
|
"jump_btn.png",
|
||||||
"down.png",
|
"down.png",
|
||||||
"fly_btn.png",
|
"fly_btn.png",
|
||||||
|
#ifdef ENABLE_ANDROID_NOCLIP
|
||||||
"noclip_btn.png",
|
"noclip_btn.png",
|
||||||
|
#endif
|
||||||
"fast_btn.png",
|
"fast_btn.png",
|
||||||
"debug_btn.png",
|
"debug_btn.png",
|
||||||
"chat_btn.png",
|
"chat_btn.png",
|
||||||
@ -88,9 +90,11 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
|
|||||||
case fly_id:
|
case fly_id:
|
||||||
key = "freemove";
|
key = "freemove";
|
||||||
break;
|
break;
|
||||||
|
#ifdef ENABLE_ANDROID_NOCLIP
|
||||||
case noclip_id:
|
case noclip_id:
|
||||||
key = "noclip";
|
key = "noclip";
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case fast_id:
|
case fast_id:
|
||||||
key = "fastmove";
|
key = "fastmove";
|
||||||
break;
|
break;
|
||||||
@ -187,36 +191,49 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
|||||||
3 * button_size, m_screensize.Y);
|
3 * button_size, m_screensize.Y);
|
||||||
/*
|
/*
|
||||||
draw control pad
|
draw control pad
|
||||||
0 1 2
|
0 3 6
|
||||||
3 4 5
|
1 4 7
|
||||||
for now only 0, 1, 2, and 4 are used
|
2 5 8
|
||||||
*/
|
*/
|
||||||
int number = 0;
|
int number = 0;
|
||||||
for (int y = 0; y < 2; ++y)
|
for (int y = 0; y < 3; ++y)
|
||||||
for (int x = 0; x < 3; ++x, ++number) {
|
for (int x = 0; x < 3; ++x, ++number) {
|
||||||
rect<s32> button_rect(
|
rect<s32> button_rect(
|
||||||
x * button_size, m_screensize.Y - button_size * (2 - y),
|
y * button_size, m_screensize.Y - button_size * (3 - x),
|
||||||
(x + 1) * button_size, m_screensize.Y - button_size * (1 - y)
|
(y + 1) * button_size, m_screensize.Y - button_size * (2 - x)
|
||||||
);
|
);
|
||||||
touch_gui_button_id id = after_last_element_id;
|
touch_gui_button_id id = after_last_element_id;
|
||||||
std::wstring caption;
|
std::wstring caption;
|
||||||
switch (number) {
|
switch (number) {
|
||||||
case 0:
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
id = left_id;
|
id = left_id;
|
||||||
caption = L"<";
|
caption = L"<";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 2:
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
id = forward_id;
|
id = forward_id;
|
||||||
caption = L"^";
|
caption = L"^";
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
id = right_id;
|
|
||||||
caption = L">";
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
|
id = jump_id;
|
||||||
|
caption = L"x";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
id = backward_id;
|
id = backward_id;
|
||||||
caption = L"v";
|
caption = L"v";
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
id = right_id;
|
||||||
|
caption = L">";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (id != after_last_element_id) {
|
if (id != after_last_element_id) {
|
||||||
initButton(id, button_rect, caption, false);
|
initButton(id, button_rect, caption, false);
|
||||||
@ -233,20 +250,12 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
|||||||
rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2),
|
rect<s32>(2.5*button_size, m_screensize.Y - (button_size/2),
|
||||||
3*button_size, m_screensize.Y), L"drop", true);
|
3*button_size, m_screensize.Y), L"drop", true);
|
||||||
|
|
||||||
/* init jump button */
|
/* init crunch button */
|
||||||
initButton(jump_id,
|
initButton(crunch_id,
|
||||||
rect<s32>(m_screensize.X-(1.75*button_size),
|
rect<s32>(m_screensize.X-(1.75*button_size),
|
||||||
m_screensize.Y - (0.5*button_size),
|
m_screensize.Y - (0.5*button_size),
|
||||||
m_screensize.X-(0.25*button_size),
|
m_screensize.X-(0.25*button_size),
|
||||||
m_screensize.Y),
|
m_screensize.Y),
|
||||||
L"x",false);
|
|
||||||
|
|
||||||
/* init crunch button */
|
|
||||||
initButton(crunch_id,
|
|
||||||
rect<s32>(m_screensize.X-(3.25*button_size),
|
|
||||||
m_screensize.Y - (0.5*button_size),
|
|
||||||
m_screensize.X-(1.75*button_size),
|
|
||||||
m_screensize.Y),
|
|
||||||
L"H",false);
|
L"H",false);
|
||||||
|
|
||||||
/* init fly button */
|
/* init fly button */
|
||||||
@ -256,11 +265,13 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
|
|||||||
m_screensize.X, m_screensize.Y - (button_size*1.5)),
|
m_screensize.X, m_screensize.Y - (button_size*1.5)),
|
||||||
L"fly", false, SLOW_BUTTON_REPEAT);
|
L"fly", false, SLOW_BUTTON_REPEAT);
|
||||||
|
|
||||||
|
#ifdef ENABLE_ANDROID_NOCLIP
|
||||||
/* init noclip button */
|
/* init noclip button */
|
||||||
initButton(noclip_id,
|
initButton(noclip_id,
|
||||||
rect<s32>(m_screensize.X - (0.75*button_size), 2.25*button_size,
|
rect<s32>(m_screensize.X - (0.75*button_size), 2.25*button_size,
|
||||||
m_screensize.X, 3*button_size),
|
m_screensize.X, 3*button_size),
|
||||||
L"clip", false, SLOW_BUTTON_REPEAT);
|
L"clip", false, SLOW_BUTTON_REPEAT);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* init fast button */
|
/* init fast button */
|
||||||
initButton(fast_id,
|
initButton(fast_id,
|
||||||
@ -497,6 +508,24 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
|
|||||||
translated->MouseInput.Event = EMIE_LMOUSE_LEFT_UP;
|
translated->MouseInput.Event = EMIE_LMOUSE_LEFT_UP;
|
||||||
m_receiver->OnEvent(*translated);
|
m_receiver->OnEvent(*translated);
|
||||||
delete translated;
|
delete translated;
|
||||||
|
} else if (!m_move_has_really_moved) {
|
||||||
|
SEvent* translated = new SEvent;
|
||||||
|
memset(translated,0,sizeof(SEvent));
|
||||||
|
translated->EventType = EET_MOUSE_INPUT_EVENT;
|
||||||
|
translated->MouseInput.X = m_move_downlocation.X;
|
||||||
|
translated->MouseInput.Y = m_move_downlocation.Y;
|
||||||
|
translated->MouseInput.Shift = false;
|
||||||
|
translated->MouseInput.Control = false;
|
||||||
|
translated->MouseInput.ButtonStates = 0;
|
||||||
|
translated->MouseInput.Event = EMIE_LMOUSE_LEFT_UP;
|
||||||
|
m_receiver->OnEvent(*translated);
|
||||||
|
delete translated;
|
||||||
|
|
||||||
|
m_shootline = m_device
|
||||||
|
->getSceneManager()
|
||||||
|
->getSceneCollisionManager()
|
||||||
|
->getRayFromScreenCoordinates(
|
||||||
|
v2s32(event.TouchInput.X,event.TouchInput.Y));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* do double tap detection */
|
/* do double tap detection */
|
||||||
|
@ -43,7 +43,9 @@ typedef enum {
|
|||||||
jump_id,
|
jump_id,
|
||||||
crunch_id,
|
crunch_id,
|
||||||
fly_id,
|
fly_id,
|
||||||
|
#ifdef ENABLE_ANDROID_NOCLIP
|
||||||
noclip_id,
|
noclip_id,
|
||||||
|
#endif
|
||||||
fast_id,
|
fast_id,
|
||||||
debug_id,
|
debug_id,
|
||||||
chat_id,
|
chat_id,
|
||||||
@ -56,7 +58,7 @@ typedef enum {
|
|||||||
#define MAX_TOUCH_COUNT 64
|
#define MAX_TOUCH_COUNT 64
|
||||||
#define BUTTON_REPEAT_DELAY 0.2f
|
#define BUTTON_REPEAT_DELAY 0.2f
|
||||||
|
|
||||||
extern const char** touchgui_button_imagenames;
|
extern const char *touchgui_button_imagenames[];
|
||||||
|
|
||||||
class TouchScreenGUI
|
class TouchScreenGUI
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user