Compare commits

...

10 Commits

Author SHA1 Message Date
Futuray-pgm 625f2d250a Update tutorial system - Part 5 (end) : Game.cpp
Update tutorial system to made it works (I hope).
2024-07-04 21:51:02 +02:00
Futuray-pgm cc6ef1b7c4 Update tutorial system - Part 4 : Tutorial.h
Update tutorial system to made it works (I hope).
2024-07-04 21:43:18 +02:00
Futuray-pgm 811956a449 Update tutorial system - Part 3 : Tutorial.cpp
Update tutorial system to made it works (I hope).
2024-07-04 21:42:06 +02:00
Futuray-pgm 10509e4f00 Update tutorial system - Part 2 : Player.h
Update tutorial system to made it works (I hope).
2024-07-04 21:40:25 +02:00
Futuray-pgm 8bc17bdba1 (realy) Update tutorial system - Part 1 : Player.cpp
Update tutorial system to made it works (I hope).
2024-07-04 21:35:39 +02:00
Futuray-pgm cf8ca7ed2f Update tutorial system - Part 1 : Player.cpp
Update tutorial system to made it works (I hope).
2024-07-04 21:34:13 +02:00
Futuray-pgm bc7fef25b0 Change error tiiles syle 2024-04-28 12:21:10 +02:00
Futuray-pgm 5ef5235593 Adding libxml2 to the needed libraries and upgrade the error section 2024-04-28 12:18:02 +02:00
Futuray-pgm 7ca1afdbd0 Second commit for tests. 2024-04-13 10:33:52 +02:00
Futuray-pgm a0f70edc60 Add bugged tutorial to make tests. 2024-04-13 10:28:59 +02:00
6 changed files with 228 additions and 6 deletions

View File

@ -21,6 +21,7 @@ Voxelands requires:
* g++ (or other C++ compiler)
* bzip2
* jpeg
* libxml2
# Install
@ -28,7 +29,7 @@ Voxelands requires:
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
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.
@ -59,6 +60,34 @@ Build a version that runs directly from the source directory:
- 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.

View File

@ -53,6 +53,7 @@
#include "main.h"
#endif
#include "hud.h"
#include "tutorial.h"
#include "sky.h"
#include "selection_mesh.h"
@ -2300,6 +2301,22 @@ void the_game(
client.getEnv().getTime()
);
}
// FIXME
{
vlprintf(CN_INFO,"Tutorial 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,"Tutorial works");
}
}
/*

View File

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

View File

@ -32,6 +32,7 @@
#endif
#include "inventory.h"
#include "collision.h"
#include "tutorial.h"
#define PLAYERNAME_SIZE 20
@ -391,6 +392,8 @@ 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;
@ -682,5 +685,4 @@ private:
};
#endif // !SERVER
#endif
#endif

86
src/tutorial.cpp Normal file
View File

@ -0,0 +1,86 @@
/************************************************************************
* 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 and the spacebar to jump.";
case TUTORIAL_LOOK :
return (std::string)"Move the mouse to look around you.";
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.";
case TUTORIAL_INVENTORY :
return (std::string)"Press the [I] button to open your inventory and the [Q] button to interact with nodes.";
default :
return (std::string)"Tutorial is done!";
};
}
void Tutorial::setCurrentTutorialToNext()
{
this->currentTutorial++;
}
void Tutorial::setCurrentTutorialToNumber(int number)
{
this->currentTutorial = number;
}
std::string Tutorial::getCurrentTutorialText()
{
return this->getText(this->currentTutorial);
}
std::string Tutorial::getNumberText(int number)
{
return this->getText(number);
}

88
src/tutorial.h Normal file
View File

@ -0,0 +1,88 @@
/************************************************************************
* 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 <string>
#define TUTORIAL_WALK 0
#define TUTORIAL_LOOK 1
#define TUTORIAL_DIG_PLACE 2
#define TUTORIAL_EAT 3
#define TUTORIAL_INVENTORY 4
class Tutorial
{
public:
Tutorial();
Tutorial(int current);
virtual ~Tutorial();
std::string getText(int num);
void setCurrentTutorialToNext();
void setCurrentTutorialToNumber(int number);
int getCurrentTutorialNumber();
std::string getCurrentTutorialText();
std::string getNumberText(int number);
int currentTutorial;
};
#endif