这是我用Python打了4个半月的代码
希望能火
不求点赞和收藏
/* Copyright(c) 2021 ZiChen Zhang,JiaCheng Pan and all contributors
All right Reserved
Distributed under MIT license
See copy at https://opensource.org/licenses/MIT
*/
/*
wasd移动,不用说了吧(需要一个回车)
/move + wasd也是移动,如果你设定gamerule.standardized_command参数为1则需要这个命令移动
/set + wasd + 距离 + 方块名称 ==> 在指定方向上的指定距离放置方块
/set d 1 stone即为在右侧放一个石头
/break + wasd + 距离 ==> 在指定方向上的特定距离破坏方块
/break d 1 把刚刚那个石头破坏掉
其他的命令与Minecraft基本上相同,坐标为二维的不要搞错了
*/
/**
* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
* ┃ OOOOO / / % % % @ @ ! ! ! # # ~ ~ ~ ~ ┃
┃ O / / % % @ @ ! # # ~ ┃
┃ O / / % % @ @ ! # # ~ ┃
┃ OOOOO / / % % % @ @ ! # # ~ ~ ~ ~ ┃
┃ O / / % % @ @ ! # # ~ ┃
┃ O / / % % @ ! # ~ ┃
┃ OOOOOO / % % @ ! ! ! # ~ ~ ~ ~ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
* 这里是社区最大的C++版沙盒游戏
* 从2020/08/26起,我们共计发布了数十个更新,到现在的1.5.0(至2021/08/26),代码超过2500行,10万字符
* 在社区成员的帮助下,我们有了许多改进,并不断加入玩家所提议的内容。
*
* 成员表:
* 主创:ParseY Pasy(张子辰)
* 提供帮助:
* Rratic(潘嘉诚) 闫雅芮
* 李梓淇 杨墨轩
* 尹怀杰 罗昊洋
* 编译器支持:
* 学而思编程社区(C站)
* 发布平台:
* 学而思编程社区(C站)
* 版本历史:
* pre0.0.1(原初版)
* pre0.0.2
* pre0.1.0
* pre0.2.5(重置版本号)
* 更新内容:初步的地形
* pre1.1.0(保存)
* pre1.2.1(保存)
* 发布时间:2020/10/01 10:50:00
* 更新内容:实体与地形分离
* pre1.2.2
* pre1.2.3(保存)
* 发布时间:2020/10/01 10:50:00
* 更新内容:模组,信息栏
* pre1.2.4(与下面的pre1.2.5.100版本似乎重叠)
* pre1.2.5.100(保存)
* 发布时间:2020/11/22 20:45:00
* 更新内容:成就,语言系统
* pre1.2.5.200(圣诞版)
* 发布时间:2020/12/21 21:00:00
* 更新内容:开始界面
* 1.1.0
*
* 1.2版本未保存
*
* 1.3.1(保存)
* 发布时间:2021/01/03 23:08:00
* 更新内容:方块类
* 1.3.2
* 更新内容:gamerule指令
* 21w1a
* 更新内容:饥饿值,生命值,氧气值
* 1.3.3
* 更新内容:生存元素更新
* 1.3.4(保存)
* 发布时间:2021/01/28 16:30:00
* 更新内容:命令组
* 1.3.5(保存)
* 发布时间:2021/02/08 21:30:00
* 更新内容:区块
* 1.4.1(保存)
* 发布时间:2021/05/02 17:00:00
* 更新内容:真正的地形
* 1.4.2(保存)
* 发布时间:2021/06/18
* 更新内容:无限世界
* 1.4.2.2(保存)
* 发布时间:2021/07/25
* 更新内容:bug消除+存档功能
* 1.4.3(保存)
* 定档时间:2021/07/31
* 更新内容:UI,Unicode
* 1.4.3.1--->1.4.3.3(保存)
* 发布时间:2021/08/04--->2021/08/15
* 更新内容:UI更多操作+维度地形算法
> 1.5.0(保存)
> 发布时间:2021/08/26
> 更新内容:维度世界,更多自然元素
*Survive一周年庆典!
* 现代码量:2713行
**/
#include
#include
#include
#include
//#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define DefaultUpdate Default();
#define FOR_XES true
#if FOR_XES
const bool online_xes = true;
#else
const bool online_xes = false;
#endif
bool CHECK_GNUC_VERSION(){
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
return (GCC_VERSION > 40200);
}//对GNUC的版本号检查
#ifdef __GNUC__
const bool GNUC_COMPILER_VERSION_AVAILABLE = CHECK_GNUC_VERSION();
const bool ENVIRONMENT_GNUC_AVAILABLE = true;
#else
const bool GNUC_COMPILER_VERSION_AVAILABLE = false;
const bool ENVIRONMENT_GNUC_AVAILABLE = false;
#endif
//对于GNUC(必需环境)
#define REQUIRE_CUIL_VERSION L"CUIL v0.0.6"
extern "C" unsigned int sleep (unsigned int __seconds);
extern "C" int usleep (__useconds_t __useconds);
typedef long long ll;
typedef long double ld;
namespace stdcolor_256{
const std::wstring red = L"\033[48;5;1m";//红色
const std::wstring yellow = L"\033[48;5;3m";//黄色
const std::wstring green = L"\033[48;5;2m";//绿色
const std::wstring blue = L"\033[48;5;4m";//蓝色
const std::wstring cyan = L"\033[48;5;5m";//青色
const std::wstring purple = L"\033[48;5;6m";//紫色
const std::wstring white = L"\033[48;5;255m";//白色
const std::wstring gray = L"\033[48;5;8m";//灰色
const std::wstring black = L"\033[48;5;0m";//黑色
const std::wstring light_red = L"\033[48;5;9m";//亮红色
const std::wstring light_yellow = L"\033[48;5;11m";//亮黄色
const std::wstring light_green = L"\033[48;5;10m";//亮绿色
const std::wstring light_blue = L"\033[48;5;12m";//亮蓝色
const std::wstring light_cyan = L"\033[48;5;13m";//亮青色
const std::wstring light_purple = L"\033[48;5;14m";//亮紫色
const std::wstring light_white = L"\033[48;5;15m";//亮白色
const std::wstring dark_black = L"\033[48;5;16m";//纯黑色
};//标准256背景色
namespace stdcolor_RGB{
const std::wstring pure_red = L"\033[48;2;255;0;0m";// 颜色#FF0000
const std::wstring pure_green = L"\033[48;2;0;255;0m";// 颜色#00FF00
const std::wstring pure_blue = L"\033[48;2;0;0;255m";// 颜色#0000FF
const std::wstring pure_black = L"\033[48;2;0;0;0m";// 颜色#000000
const std::wstring pure_white = L"\0333[48;2;255;255;255m";// 颜色#FFFFFF
const std::wstring pure_yellow = L"\033[48;2;255;255;0m";// 颜色#FFFF00
const std::wstring pure_violet = L"\033[48;2;255;0;255m";// 颜色#FF00FF
const std::wstring pure_cyan = L"\033[48;2;255;255;0m";// 颜色#00FFFF
};//RGB标准颜色库
namespace stdtext{
const std::wstring text_red = L"\033[38;5;9m";//文字红色
const std::wstring text_yellow = L"\033[33m";//文字黄色
const std::wstring text_green = L"\033[32m";//文字绿色
const std::wstring text_blue = L"\033[34m";//文字蓝色
const std::wstring text_dark = L"\033[38;5;232m";//文字纯黑
const std::wstring text_gray = L"\033[38;5;242m";//文字灰色
const std::wstring text_darkblue = L"\033[38;5;27m";//文字深蓝
const std::wstring text_lightblue = L"\033[38;5;14m";//文字亮蓝
const std::wstring italic = L"\033[003m";//文字斜体
const std::wstring code_background = L"\033[48;5;7m";//代码背景色
};//文字格式标准库
namespace CUIL_std{
using namespace stdcolor_256;
using namespace stdcolor_RGB;
using namespace stdtext;
#define _EN_UK_DEFAULT_WARNING L"Warning,error occured because of wrong parameter or incorrect use."//默认反馈信息——英语
#define _ZH_CN_DEFAULT_WARNING L"警告:错误的参数或不正当使用导致了一个错误"//默认反馈信息——中文
#ifdef __linux
#define CLEARSCREEN_CMDCOMMMAND "clear"
#else
#define CLEARSCREEN_CMDCOMMMAND "cls"
#endif
int WCHAR_T_INIT(){
try{
std::locale lc("zh_CN.UTF-8");
std::locale::global(lc);
return 1;
}catch(...){
return 0;
}
}
const int SUPPORT_WCHAR_T = WCHAR_T_INIT();//常量——系统是否支持中文宽字符(unicode字符集)
//清除屏幕的system指令
const std::wstring VOID_PARAMETER = L"NONE";//默认空参数
const std::wstring _DEFAULT_LANGUAGE = L"zh-CN";//默认语言
const std::wstring _NOW_DEFAULT_WARNING = _ZH_CN_DEFAULT_WARNING;//现在的默认警告(可随时更改)
const std::wstring _CLEAREFFECT_STR = L"\033[0m";//清除效果
const std::wstring CUIL_VERSIONINFO = L"CUIL v0.0.6";//CUIL的版本
//CUIL基础结构
//衍生功能库
std::wstring warning_color_type[] = {stdcolor_256::yellow,stdcolor_256::light_red,stdcolor_256::red};
//0级警告:黄,1级警告:亮红,2级(最高)警告:暗红
//基础类
struct warning{
int warn_type;
std::wstring content;
};
std::queue warning_queue;//警告队列
inline int warn_if(bool statement,const std::wstring show,int type_warning = 1);//警告
class format{
protected:
bool formatlock;//格式锁
private:
std::wstring text_color;//文字颜色
std::wstring background_color;//背景颜色
bool useitalic;//是否启用斜体
public:
void settextcolor(std::wstring input){
if(warn_if(formatlock,L"此类的格式锁已启用,无法通过set进行修改"))
return ;
else
text_color = input;
}
void setbgcolor(std::wstring input){
if(warn_if(formatlock,L"此类的格式锁已启用,无法通过set进行修改"))
return ;
else
background_color = input;
}
void setitalic(bool input){
if(warn_if(formatlock,L"此类的格式锁已启用,无法通过set进行修改"))
return ;
else
useitalic = input;
}
void lock(){
formatlock=true;
}
void unlock(){
formatlock=false;
}
void clear(){
formatlock = false;
useitalic=false;
text_color=L"";
background_color=L"";
}//清除效果
format(bool a,bool b,std::wstring c,std::wstring d){
formatlock = a;
useitalic = b;
text_color = c;
background_color = d;
}
format(){
}
friend void print(const std::wstring content,const format formatin,bool step,double wait_time,bool end);//输出函数将调用此类
friend void printcode(const std::wstring code,const std::wstring lang);
friend std::wostream& operator<<(std::wostream& wis,const format& c);
}publicformat = {false,false,L"",L""},
default_printformat = {false,false,L"",L""},
default_codeformat = {false,false,L"",code_background};
format printformat = default_printformat;
format codeformat = default_codeformat;
std::wostream& operator<<(std::wostream& wis,const format& c){
std::wstring s = c.text_color+c.background_color+(c.useitalic?italic:L"");
wis<127)
count_t++;
}
return count_t;
}
std::wstring wstrcpy(std::wstring cpystr,int cpynum);
class label_line{
public:
element left;//左元素
element mid;//中元素
element right;//右元素
int line_len;//当前对齐长度
public:
int minshowlen(){
int show_len_left = count_showlen(left),
show_len_mid = count_showlen(mid),
show_len_right = count_showlen(right);
int line_len = show_len_left + show_len_mid + show_len_right + 2;
return line_len;
}
void editleft(const element in){
left = in;
}
void editright(const element in){
right = in;
}
void editmid(const element in){
mid = in;
}
void show(int line_len_min = 20){
int now_len = minshowlen();
if(now_len > line_len_min){
left.show();
std::wcout << L" ";
mid.show();
std::wcout << L" ";
right.show();
line_len = now_len;
}//拓展长度
else{
int space_left = (line_len_min - now_len + 2)/2,
space_right = line_len_min - now_len + 2 - space_left;
left.show();
std::wcout << wstrcpy(L" ",space_left);
mid.show();
std::wcout << wstrcpy(L" ",space_right);
right.show();
line_len = line_len_min;
}
}//展示标签行
label_line(){
left = element();
mid = element();
right = element();
}
label_line(const element l,const element m = voidelement,const element r = voidelement){
left = l;
mid = m;
right = r;
}
};//标签行类
class label{
public:
std::vectorcontent;
public:
void add_line(const label_line in){
content.push_back(in);
}
void delete_line(){
content.pop_back();
}
void show(int show_len = 20){
int max_len = -1;
for(auto&&i:content){
int tmp_len = i.minshowlen();
max_len = tmp_len>max_len?tmp_len:max_len;
}//检索最大长度
show_len = max_len>=show_len?max_len:show_len;//如果最大长度超过定义,则换为最大长度
std::wcout << L"┌"<class martix{
private:
std::vector>content;
public:
void edit(int x,int y,T v){
if(warn_if(!(0<=x&&x(int h = 16,int w = 16){
std::vectortmp;
for(int i = 0;inewh&&(!content.empty()))
content.pop_back();
}else{
std::vectortmp;
while(tmp.size()neww)
i.pop_back();
}
}else{
for(auto&&i:content){
while(i.size()ex){
for(long double i = ex;i<=sx;i+=0.1){
long double nx = i,ny = k*i+b;
if(0<=nx&&nx<=content[0].size()&&0<=ny&&ny<=content.size())
content[int(ny)][nx] = input;
}
}else if(sx255?255:(a<0?0:a);
}
}grey_white(255),grey_black(0);
std::wostream& operator<<(std::wostream& wis,const pixel& c){
std::wstring s = L"["+std::to_wstring(c.red)+L":"+std::to_wstring(c.green)+L":"+std::to_wstring(c.blue)+L"]";
wis<pmap;//像素矩阵
double speed;//速度
public:
image(const int h = 16,const int w = 16,martix mapin = martix(16,16)){
height = h;
width = w;
mapin = martix(h,w);
pmap = mapin;
speed = 100;
}
void setspeed(double a){
speed = a;
}
void show(){
for(int i = 0;ipmap;//像素矩阵
double speed;//输出速度
public:
image_grey(const int h = 16,const int w = 16,martix mapin = martix(16,16)){
height = h;
width = w;
mapin = martix(h,w);
pmap = mapin;
speed = 100;
}
void setspeed(double a){
speed = a;
}
void show(){
for(int i = 0;i',L'/',L'~'
};
const std::wstring key_macro[] = {
L"#include",L"#define",L"#if",L"#else",L"#endif",L"#ifdef",L"#ifndef",L"#pragma"
};
const int key_macro_num = 8;//宏语句数量
const int key_char_num = 12;//关键字符数量
const std::wstring key_word_color[] = {
text_darkblue,text_darkblue,text_gray,text_gray,text_darkblue,text_darkblue,
text_gray,text_gray,text_darkblue,text_darkblue,text_darkblue,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_gray,text_gray,text_darkblue,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_gray,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,
text_blue,text_blue,text_darkblue,text_darkblue,text_darkblue,
text_darkblue,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_darkblue,
text_darkblue,
text_darkblue,text_darkblue,
text_darkblue,text_gray,text_darkblue,text_gray,text_gray,text_blue,text_blue,
text_darkblue,text_gray,text_gray,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,
text_darkblue,
text_darkblue,text_gray,text_darkblue,text_darkblue,
text_darkblue,text_darkblue,text_darkblue,text_darkblue,text_gray,text_darkblue,text_darkblue,text_gray,text_darkblue,text_darkblue,
text_darkblue,text_green,text_darkblue,text_darkblue,text_blue,text_blue,text_darkblue,text_darkblue,text_gray,text_darkblue,
text_darkblue,text_darkblue,text_darkblue,
text_darkblue,text_darkblue,text_darkblue,
text_darkblue,text_darkblue,
text_gray,text_gray,
};//关键词标色
const int key_word_num = 98;
inline int find_keyword(std::wstring input){
for(int i = 0;i< key_word_num;i++){
if(input == key_word[i])
return i;
}
return -1;
}
inline int find_macro(std::wstring input){
for(int i = 0;i< key_word_num;i++){
if(input == key_macro[i])
return i;
}
return -1;
}
inline int find_keychar(wchar_t input){
for(int i = 0;i sep_bykeychar(std::wstring input){
std::vector out;
for(int a = 0;a split(std::wstring input,wchar_t sep = L','){
std::vectorinput_units;
for(long long spliti=0;spliti>>";
system("stty raw");
wscanf(L"%c",&tmp);
system("stty -raw");
std::wcout<int uniselect(const std::vectorchoice_list,std::wstring title=L"",wchar_t last_sign=L'w',wchar_t next_sign=L's',wchar_t end_sign=L'y',int choice_first=1);//一元选择器
void dot_linerary_load(double wait_time,int width = 10,int height = 1,bool has_boarder = true,bool has_progress = true,wchar_t show_char = L'O',wchar_t blank_char = L' ');//点型加载
void shape_linerary_load(double wait_time,int width = 10,int height = 1,bool has_border = true,bool has_progress = true,std::wstring format_pass = _CLEAREFFECT_STR,std::wstring format_border = _CLEAREFFECT_STR,wchar_t pass_char = L'■',wchar_t show_char = L'■',wchar_t blank_char = L' ');//线性加载
void ring_linerary_load();//环形加载动效
void print(const std::wstring content,const format formatin = printformat,bool step = true,double wait_time = 5.0,bool end = true);//打印
void printcode(const std::wstring code,const std::wstring lang = L"cpp");
//复合组件实现
template
int uniselect(const std::vector choice_list,std::wstring title,wchar_t last_sign,wchar_t next_sign,wchar_t end_sign,int choice_first){
wchar_t tmp_listchoice=L' ';
int choice_now = choice_first;
while(tmp_listchoice!=end_sign){
std::wcout< ":L" ")<>>";
tmp_listchoice=datain();
if(tmp_listchoice==last_sign)
choice_now-=(choice_now>1?1:0);
if(tmp_listchoice==next_sign)
choice_now+=(choice_now
void printvec(std::vectorinput){
std::wcout<first_word = sep_bykeychar(code_t);
//printvec(first_word);
for(int i = 0;i info_text;//信息栈,在运行中持续累加再在信息栏中输出
struct chatter{
wstring chatter_name;//聊天者名称
wstring content;//内容
};
chatter create_chat(wstring n,wstring c){
chatter tmp_cc;
tmp_cc.chatter_name = n;
tmp_cc.content = c;
return tmp_cc;
}
queue info_chat;//聊天信息列表
wchar_t screen[34][50] = {
{L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ',L'#'},
{L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#',L'#'},
};
/*
wchar_t TitleScreen[7][31] = {
{L' ',L'O',L'O',L'O',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L'%',L'%',L' ',L' ',L'@',L' ',L'@',L' ',L'!',L'!',L'!',L' ',L'#',L' ',L'#',L' ',L'~',L'~',L'~',L'~'},
{L'O',L' ',L' ',L' ',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L' ',L' ',L'%',L' ',L'@',L' ',L'@',L' ',L' ',L'!',L' ',L' ',L'#',L' ',L'#',L' ',L'~',L' ',L' ',L' '},
{L'O',L' ',L' ',L' ',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L' ',L' ',L'%',L' ',L'@',L' ',L'@',L' ',L' ',L'!',L' ',L' ',L'#',L' ',L'#',L' ',L'~',L' ',L' ',L' '},
{L' ',L'O',L'O',L'O',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L'%',L'%',L' ',L' ',L'@',L' ',L'@',L' ',L' ',L'!',L' ',L' ',L'#',L' ',L'#',L' ',L'~',L'~',L'~',L'~'},
{L' ',L' ',L' ',L' ',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L'%',L' ',L' ',L' ',L'@',L' ',L'@',L' ',L' ',L'!',L' ',L' ',L'#',L' ',L'#',L' ',L'~',L' ',L' ',L' '},
{L' ',L' ',L' ',L'O',L' ',L'/',L' ',L' ',L'/',L' ',L'%',L' ',L'%',L' ',L' ',L' ',L'@',L' ',L' ',L' ',L'!',L' ',L' ',L' ',L'#',L' ',L' ',L'~',L' ',L' ',L' '},
{L'O',L'O',L'O',L' ',L' ',L' ',L'/',L'/',L' ',L' ',L'%',L' ',L' ',L'%',L' ',L' ',L'@',L' ',L' ',L'!',L'!',L'!',L' ',L' ',L'#',L' ',L' ',L'~',L'~',L'~',L'~'}
};
*/
wchar_t TitleScreen[7][31] = {
{L' ',L'■',L'■',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L'■',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L'■',L'■',L' ',L'■',L' ',L'■',L' ',L'■',L'■',L'■',L'■'},
{L'■',L' ',L' ',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L' '},
{L'■',L' ',L' ',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L' '},
{L' ',L'■',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L'■',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L'■',L'■',L'■'},
{L' ',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L'■',L' ',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L' '},
{L' ',L' ',L' ',L'■',L' ',L'■',L' ',L' ',L'■',L' ',L'■',L' ',L'■',L' ',L' ',L' ',L'■',L' ',L' ',L' ',L'■',L' ',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L' '},
{L'■',L'■',L'■',L' ',L' ',L' ',L'■',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L'■',L'■',L' ',L' ',L'■',L' ',L' ',L'■',L'■',L'■',L'■'}
};
//超级资源包
wstring language_achievement[] = {L"成就达成! - ",L"成就達成! -",L"Achievement got! - ",L"移动!",L"移動!",L"Move!",L"放置方块!",L"放置方塊!",L"First block set!",L"破坏方块!",L"破壞方塊!",L"First block break!",L"为什么这么硬!",L"爲什麼這麼硬!",L"Too hard!",L"欢迎来到虚空",L"歡迎來到虛空",L"Welcome to the void",L"卡住了!",L"卡住了!",L"I'm stuck!",L"多变的世界",L"多變的世界",L"Changeable World"};//成就语言包
wstring language_briefinfo[] = {L"坐标",L"坐標",L"Position",L"游戏模式",L"遊戲模式",L"Gamemode",L"输入/help以获取帮助",L"輸入/help以獲取幫助",L"Prll /help for help"};//简略信息语言包
wstring language_celebrate[] = {L"Survive一周年!",L"Survive一周年!",L"Survive One Year Anniversary!"};//节日庆祝语言包
wstring language_clone[] = {L"克隆位置在世界之外,检查(",L"克隆位置在世界之外,檢查(",L"Clone Position out of world,Check at (",L"成功克隆区内方块(",L"成功克隆區內方塊(",L"Successfully clone blocks in area (",L")由(",L")由(",L") to area starts from("};//clone指令语言包
wstring language_Command[] = {L"#命令 -->",L"#命令 -->",L"#Command -->"};//命令行语言包
wstring language_fill[] = {L"成功填充了",L"成功填充了",L"Successfully filled ",L"方块",L"方塊",L"blocks",L"无法填满世界以外的方块(",L"無法填滿世界以外的方塊(",L"Impossible to fill blocks outside theworld at (",L"方块总数太多(",L"方塊總數太多(",L"Total number of blocks is too much("};//fill指令语言包
wstring language_gamerule[] = {L"的值被成功改为",L"的值被成功改爲",L" has successfully been changed to ",L"缺失参数,请检查输入",L"缺失參數,請檢查輸入",L"Missing parameter,please check the input"};
wstring language_initilize[] = {L"输入世界的名称 -->",L"輸入世界的名稱 -->",L"Please print World's name -->",L"输入玩家的名称 -->",L"輸入玩家的名稱 -->",L"Please print player's name",L"您好,",L"您好,",L"Hello,L",L"在这个世界生存下去!",L"在這個世界生存下去!",L"Survive in this world!",L"世界加载中-",L"世界加載中-",L"Loading World-"};//初始化语言包
wstring language_kill[] = {L"失败了",L"失敗了",L" failed",L"饿的眼前一黑",L"餓的眼前一黑",L" died of hunger",L"溺水了",L"溺水了",L" was drowned",L"因为奇妙的特性而卡在方块里无法动弹",L"因為奇妙的特性而卡在方塊裡無法動彈",L" was stuck in the block because of some magic bugs"};
wstring language_player[] = {L"氧气值:",L"氧氣值:",L"Oxygen: "};
wstring language_printinfo[] = {L"系统: ",L"系統: ",L"System: "};//系統提示语言包
wstring language_set[] = {L"未知方块:",L"未知方塊:",L"Unknown block:"};//setblock语言包
wstring language_setblock[] = {L"无法在世界外放置方块",L"無法在世界外放置方塊",L"Unable to set a block outside the world",L"无法找到指定方块",L"無法找到指定方塊",L"Unable to find the specified block"};
wstring language_testblock[] = {L"未知方向:",L"未知方向:",L"Unknown Direction:",L"无法检测世界外的方块",L"無法檢測世界外的方塊",L"Unavailable to check the block outside the world",L"成功探测!方块名称:",L"成功探測!方塊名稱:",L"Successfully detected ! Block name: "};//testblock语言包
wstring language_TitleScreen[] = {L"",L"",L"",L"最后更新时间:",L"最後更新時間:",L"Latest Update Time:",L"现在版本:",L"現在版本:",L"Version Now:",L"制作人员:张子辰",L"製作人員:張子辰",L"Producer List: ParseY Pasy",L"跳过开场?是按1,否按0:",L"跳過開場?是按1,否按0:",L"Skip the begining or not? 1 for yes, 0 for no:",L"快捷模式(0/1) -->",L"快捷模式(0/1) -->",L"Quick Mode(0/1) -->",L"建议窗口宽度",L"建議窗口寬度",L"Recommended window width:"};//标题语言包
wstring language_tp[] = {L"不可能在世界之外传送实体(位置x =",L"不可能在世界之外傳送實體(位置x =",L"Impossible to transport entity outside the world(position x =",L"成功传送玩家到位置x =",L"成功傳送玩家到位置x =",L"Successfully transport player to position x = "};//tp指令语言包
wstring language_UIP[] = {L"#坐标 x:",L"#座標 x:",L"#Position x:",L"#游戏模式:",L"#遊戲模式:",L"#Gamemode: ",L"#游戏版本:",L"#遊戲版本:",L"#Game Veision: ",L"#世界大小:",L"#世界大小:",L"#World Size: ",L"方块",L"方塊",L"blocks",L"#所观察的坐标 开始(",L"#所觀察的座標 開始(",L"#View Position Start(",L"),结束(",L"),結束(",L"),End(",L"#世界名称:",L"#世界名稱:",L"#World Name:",L"#玩家名称:",L"#玩家名稱:",L"#Player Name: ",L"#存档名:",L"#存檔名:",L"#File name:",L"#存档大小:",L"#存檔大小:",L"#File Size:",L"#存档最后保存时间:",L"存檔最後保存時間:",L"#File Latest Save Time:"};//调试信息语言包
wstring language_UIPmods[] = {L"#模组信息:",L"#模組信息:",L"#Mod Information:",L"#模组列表:",L"#模組列表:",L"#Mod List:",L"#模组命令列表:",L"#模組命令列表:",L"#Mod Command List:",L"#模组方块列表:",L"#模組方塊列表:",L"#Mod blocks list:",L"#模组物品列表:",L"#模組物品列表:",L"#Mod Item List:",L"个模组加载",L"個模組加載",L" mods loaded"};//mod调试信息语言包
wstring language_warncommand[] = {L"未定义的游戏模式: ",L"未定義的遊戲模式: ",L"Undecleared Gamemode:",L"未知命令:",L"未知命令:",L"Unknown Command: "};
wstring language_pause[] = {L"输入任意键继续>>>",L"輸入任意鍵繼續>>>",L"Press Any key to continue>>>"};
wstring language_update[] = {L"观看更新公告(0/1)",L"觀看更新公告(0/1)",L"See the updating content(0/1)"};
wstring language_worldspawn[] = {L"世界生成中......",L"世界生成中......",L"World Spawning......",L"玩家生成 >",L"玩家生成 >",L"Player Born >",L"加载区块 >",L"加載區塊 >",L"Loading Chunk >"};
wstring knowledge_list[] = {
L"大陆架————是大陆向海洋的延伸,属于大陆的一部分,是大部分浅海生物的栖息地。",
L"高原————因为地质活动而隆起的地域,现实中最高的高原(青藏高原)平均海拔能有5000米",
L"地球圈层大致分4层:地壳,地幔,外核,内核,其中地壳与地幔交界称为霍曼不连续面,地幔与外核交界称为古登堡不连续面",
L"Survive自1.4.2后的世界有2^71(2,361,183,241,434,822,606,848)个方块哦!",
L"根据世界上最古老的岩石测算,地球的年龄大致为45亿岁",
L"大于格陵兰岛的陆地称为大陆,小于其的只能称为岛",
L"南极洲在超大陆分裂前曾位于赤道位置,后随火山活动移动到了今天的地球南极",
L"你知道吗?Survive的第一版剧情和第二版完全不同!第二版承接于衍生小说《层世界》",
L"有什么疑问的话就上Survive Wiki吧!",
L"Survive的各大主要版本都有在线保存哦!",
L"金刚石与刚玉是自然界中硬度第一第二的物质!",
L"岩浆陆群系其实取自火山岩浆池附近熔融的岩石区域。",
L"世界上最深的地方————马里亚纳海沟的挑战者深渊,深度11034米",
};
const ll knowledge_num = 9;
struct Block;
ll topox(ll x);
ll index(ll x,ll y);
class world;
class Chunk;
struct Block{
short ID;//编号
ll hardness;//硬度
ll explosion_resistance;//爆炸抗性
wchar_t show_char;//显示字符
wstring name;//名称
short type;//类型
vector tag;//标签
bool need_show_char;//是否保持显示字符
}Block_List[block_num];
ll topox(ll x){
return x - (x/16)*16;
}//全局坐标转区块坐标
ll index(ll x,ll y){
return (WorldYSize-y)*16+x;
}//方块在区块内坐标
class Chunk{
public:
ll ID;
short terrain[WorldYSize*16] = {id_block_air},entity[WorldYSize*16];
//把这个entity删掉就能省掉一半的空间,直接降到每区块8kb
bool active;
bool discovered;
public:
ll GetBlockInfo(ll x,ll y){
return terrain[index(topox(x),y)];
}
ll GetEntityInfo(ll x,ll y){
return entity[index(topox(x),y)];
}
Chunk(ll id = 0){
ID = id;
for(ll cbi = 0;cbi world_chunk;//地形数据
}Main,Under,Sky,Dark,Void,*player_world;//世界类
ll gcID(world worldinput,ll iID){
ll wsize = worldinput.world_chunk.size();
for(ll gId = 0;gId < wsize;gId++){
if(worldinput.world_chunk[gId].ID==iID)
return gId;
}
return -1;
}//获取实际ID在世界数组内的位置
ll gcID(world *worldinput,ll iID){
ll wsize = worldinput->world_chunk.size();
for(ll gId = 0;gId < wsize;gId++){
if(worldinput->world_chunk[gId].ID==iID)
return gId;
}
return -1;
}//获取实际ID在世界数组内的位置
bool incvect(world worldinput,ll iID){
if(!worldinput.world_chunk.empty()){
ll icv_size = worldinput.world_chunk.size();
for(ll inv = 0;inv < icv_size;inv++){
if(worldinput.world_chunk[inv].ID==iID)
return 1;
}
}
return 0;
}//判断指定区块ID是否在世界数组内
bool incvect(world *worldinput,ll iID){
if(!worldinput->world_chunk.empty()){
ll icv_size = worldinput->world_chunk.size();
for(ll inv = 0;inv < icv_size;inv++){
if(worldinput->world_chunk[inv].ID==iID)
return 1;
}
}
return 0;
}//判断指定区块ID是否在世界数组内
void editblock(world *worldinput,ll x,ll y,short value,const ll given_ID = -1){
if(value<0||value>block_num)
return ;
if(given_ID != -1){
worldinput->world_chunk[given_ID].terrain[index(topox(x),y)] = value;
}else{
ll tID = gcID(worldinput,x/16);
if(tID == -1)
return ;
worldinput->world_chunk[tID].terrain[index(topox(x),y)] = value;
}
}
short getblock(world *worldinput,ll x,ll y,const ll given_ID = -1){
if(given_ID != -1)
return worldinput->world_chunk[given_ID].terrain[index(topox(x),y)];
else{
ll tID = gcID(worldinput,x/16);
if(tID != -1)
return worldinput->world_chunk[tID].terrain[index(topox(x),y)];
else
return id_block_unknown_block;
}
return id_block_unknown_block;
}
class PerlinNoise{
public:
PerlinNoise(){
ll random_list[512] ={221,93,7,46,28,151,156,223,40,100,185,194,160,199,155,51,
137,155,175,106,24,63,139,175,192,253,219,253,186,112,172,151,
205,179,198,234,74,98,201,115,199,130,53,103,73,208,154,211,
107,73,61,132,136,200,51,72,197,14,70,127,126,242,23,76,
165,221,54,240,63,255,99,6,129,152,109,203,104,7,158,212,
80,219,88,217,163,139,33,105,153,103,232,24,89,255,100,255,
220,154,239,28,153,82,34,26,234,144,229,82,151,131,38,232,
94,126,193,2,9,226,107,163,74,83,187,163,83,31,162,47,
185,145,75,82,227,110,108,205,254,82,32,149,213,70,125,52,
197,62,54,206,33,161,113,107,244,44,14,71,75,177,119,4,
66,194,86,38,48,195,243,46,21,19,196,234,90,65,30,31,
128,84,237,161,245,95,12,234,139,26,49,215,203,168,219,14,
107,50,52,155,245,39,202,10,59,142,244,149,207,19,180,79,
103,161,240,93,0,252,71,140,23,120,99,226,33,62,240,140,
112,36,39,101,76,241,111,135,127,100,28,79,119,208,158,222,
113,143,59,114,139,130,254,162,251,97,133,28,159,117,168,16};
//懒得排了
for (ll i = 0;i<256;i++)
r[256 + i] = r[i] = random_list[i];
}//随机序列表
double noise(double x,double y,double z){
ll X = int(floor(x)) & 255,
Y = int(floor(y)) & 255,
Z = int(floor(z)) & 255;//取整数部分
x-=floor(x);
y-=floor(y);
z-=floor(z);//取小数部分
double u = fade(x),
v = fade(y),
w = fade(z);//获取缓动函数值
ll A = r[X] + Y,
AA = r[A] + Z,
AB = r[A + 1] + Z,
B = r[X + 1] + Y,
BA = r[B] + Z,
BB = r[B + 1] + Z;//调用随机序列
return lineinsert(w,
lineinsert(v,
lineinsert(u,
gradient(r[AA], x, y, z),
gradient(r[BA], x - 1, y, z)
),
lineinsert(u,
gradient(r[AB], x, y - 1, z),
gradient(r[BB], x - 1, y - 1, z)
)
),
lineinsert(v,
lineinsert(u,
gradient(r[AA + 1], x, y, z - 1),
gradient(r[BA + 1], x - 1, y, z - 1)
),
lineinsert(u,
gradient(r[AB + 1], x, y - 1, z - 1),
gradient(r[BB + 1], x - 1, y - 1, z - 1)
)
)
);
}//噪声值
double lineinsert(double t, double a, double b){
return a + t * (b - a);
}//线性插值
double gradient(ll hash, double x, double y, double z){
ll h = hash & 15;
double u = h < 8 ? x : y,
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
}//哈希梯度值
double fade(double t){
return t * t * t * (t * (t * 6 - 15) + 10);
}//缓动函数值————ret = 6t^5 - 15t^4 + 10t^3
ll r[512];//复制的随机序列
}TerrainNoise,BiomeNoise;
//函数CC,EV,ITP,ICS,LC,SCI,PI,BI,MBI,MCI,GI,CRM均为系统处理函数
void Default(){
player_world->world_chunk[gcID(player_world,playerx / 16)].entity[index(topox(playerx),playery)] = 1;
}//默认更新
ll inrange(ll input,ll max,ll min);
ll actualy(ll y){
y = inrange(y,WorldYSize,0);
return reverse_y?WorldYSize-y:y;
}
bool CompareChart(ll a[3][3],ll b[3][3]){
for(ll CCx = 0;CCx<= 2;CCx++){
for(ll CCy = 0;CCy <= 2;CCy++){
if(a[CCy][CCx] != b[CCy][CCx])
return 0;
}
}
return 1;
}//用于比较合成公式
void p(string input){
ll input_length_ITP = input.length() - 1;
for(ll i = 0;i<= input_length_ITP;i++){
wprintf(L"%c",input[i]);
usleep(PRINT_SPEED);//取自潘嘉诚的阅读速度调查,将标准速度定为32134,大约一秒3个字
}
wcout << endl;
}//逐字输出
ld getAverage(vectorinput){
ld ret_getAver = 0,size_getAver=input.size();
for(ll i_getav = 0;i_getavinput){
ld sum_getVariAll = 0,aver_input = getAverage(input);
for(ll igetVari=0;igetVari= L'0' && input[i] <= L'9'){
output_SCI *= 10;
output_SCI += (input[i]- 48);
}
}
for(ll j = 0;j< input_length_SCI;j++){
if(input[j] == L'-'){
output_SCI *= -1;
break;
}
}//无论负号在哪里,都认为是负数
return output_SCI;
}//将字符串转为整型数字
double strtof(wstring input){
int si_stof = 0;
double output_stof = 0.0;
while(input[si_stof]!=L'-'&&!isdigit(input[si_stof])&&si_stofb?a:b;
}
wstring cpystr(wstring input,int rept){
for(int ics = 0;ics= L'A' && input <= L'Z')
input += 32;
return input;
}//将一个字母转成小写
ll ID(wstring a[],wstring input){
long long res = 0;
while(a[res] != L""){
if(a[res] == input)
return res;
res++;
}
return -1;
}//寻找元素于数组内下标,不存在则返回-1
ll ModCommandID(wstring input){
for(ll i = 0;i<= mod_command_total - 1;i++){
ll j = 0;
wstring real_modcommand;
while(mod_command_list[mod_command_total][j] != L'.')
real_modcommand += mod_command_list[mod_command_total][j++];
if(real_modcommand == input)
return i;
}
return -1;
}//寻找模组命令地址
wstring CommandRelatedMod(ll ID){
wstring RelatedMod;
ll i = 0;
while(mod_command_list[ID][i] != L'.')i++;
i++;
for(ll j = i;j<= mod_command_list[ID].length() - 1;j++)
RelatedMod += mod_command_list[ID][j];
return RelatedMod;
}//寻找特定命令所属的模组
bool OutsideWorld(ll x,ll y){
if(x < 0 || x > MAX_INT || y < 0 || y > WorldYSize)//超出范围
return 1;
else
return 0;
}//判断坐标是否超出世界
long long square(ll input){
return input * input;
}//平方
wstring to_wstr(string input){
wstring out_towstr;
ll inlen_tws = input.length();
for(int twi = 0;twi
vector tovect(T input[],ll cpylen){
vectornew_tov;
for(ll itov = 0;itov tovect(wstring input[],ll cpylen){
vectornew_tov;
for(ll itov = 0;itov input){
wstring output_nps;
ll npslen = input.size();
short now_int = input[0];
for(ll npsi = 0;npsi1)
output_nps+=(L"*"+itos(conti_num));
output_nps+=L"/";
now_int = input[npsi];
npsi--;
}
return output_nps;
}//按连续数据压缩数组
vector depress_str(wstring input){
vectorunit_depr = split(input,L'/');
vector out_deprstr;
for(ll depi = 0;depipart_unit_depr = split(unit_depr[depi],L'*');
if(part_unit_depr.size() > 1){
for(ll deppi = 0;deppi chunk_block;
for(ll gcci = 0;gcci < WorldYSize * 16;gcci++)
chunk_block.push_back(input.terrain[gcci]);
output_gCC+=numpress_str(chunk_block);
return output_gCC;
}//获取区块储存码
void PrintInfo(){
while(!info_text.empty()){
wstring combine_printinfo = language_printinfo[lang];
combine_printinfo+=info_text.front();
wcout << L"#" << combine_printinfo << cpystr(L" ",max(16-combine_printinfo.length(),0)) << L"#" << endl;
info_text.pop();
}
}//输出系统提示信息
void PrintChat(){
while(!info_chat.empty()){
wcout << L"#" << info_chat.front().chatter_name << L": " << info_chat.front().content << endl;
info_chat.pop();
}
}//输出系统提示信息
void UpdateBlockInfo(){
for(ll i = 0;i <= block_num - 1;i++){
Block_List[i].ID = i;
Block_List[i].hardness = block_hardness[i];
Block_List[i].explosion_resistance = block_explosion_resistance[i];
Block_List[i].name = block_name[i];
Block_List[i].show_char = block_char[i];
Block_List[i].need_show_char = block_need_char[i];
}
}//初始化方块信息
void AddTag(ll type,wstring block_list){
for(ll i = 0;i<= block_list.length() - 1;i++){
wstring addtag_block;
if(block_list[i] != L','){
while(block_list[i] != L',' && i <= block_list.length() - 1)
addtag_block += block_list[i++];
}
Block_List[ID(block_name,addtag_block)].tag.push_back(tag_type[type]);
}
}//为方块加入标签
wstring to_onestr(vectorinput){
wstring out_tos;
for(ll tosi = 0;tosi block_tag){
for(ll tti = 0;tti< block_tag.size();tti++){
if(block_tag[tti] == target)
return 1;
}
return 0;
}//查找方块是否有特定的标签
void UpdateScreen(){
wstring warning;//警告
try{
ll vision[48][32] = {-1},player_cover_block;
ll startx_vision = playerx - 7,starty_vision = playery - 7,endx_vision = playerx + 8,endy_vision = playery + 8;
if(vision_mode == 2)
startx_vision = playerx - 15,starty_vision = playery - 15,endx_vision = playerx + 16,endy_vision = playery + 16;
else if(vision_mode == 3)
startx_vision = playerx-15,starty_vision=playery-7,endx_vision = playerx+16,endy_vision = playery+8;
for(ll y_upnow = starty_vision;y_upnow <= endy_vision;y_upnow++){
for(ll x_upnow = startx_vision;x_upnow <= endx_vision;x_upnow++){
Chunk detect_chunk_now = player_world->world_chunk[gcID(player_world,x_upnow / 16)];
ll copy_map_ID,distance_player = sqrt(square(abs(playerx - x_upnow)) + square(abs(playery - y_upnow)));
if(y_upnow < 0 || y_upnow >= WorldYSize ||x_upnow > positive_crash_line || x_upnow < negative_crash_line){
copy_map_ID = id_block_barrier;//防范:如果超限则设定为指定的方块显示
//进一步分析:天空区域为空气,地底区域为基岩
//为什么这么傻还在用ID阿喂(
if(y_upnow >= WorldYSize)
copy_map_ID = id_block_bedrock;
if(y_upnow<=0)
copy_map_ID = id_block_air;
//其他区域就是屏障
}else{
short tmp_entity_covblock = detect_chunk_now.terrain[index(topox(x_upnow),y_upnow)];
if(detect_chunk_now.entity[index(topox(x_upnow),y_upnow)] != 0){//优先打印实体
copy_map_ID = -1 - detect_chunk_now.entity[index(topox(x_upnow),y_upnow)];
player_cover_block = tmp_entity_covblock;
}
else if(tmp_entity_covblock != id_block_unknown_block && distance_player <= vision_size)//实体层当前方块无实体且在视距范围内,则打印地形
copy_map_ID = tmp_entity_covblock;
else
copy_map_ID = id_block_unknown_block;
}
vision[y_upnow - starty_vision][x_upnow - startx_vision] = copy_map_ID;
}
}//将方块或实体打印到vision数组
ll actual_vision_scalex = 16,actual_vision_scaley = 16;
if(vision_mode==2)
actual_vision_scalex = 32,actual_vision_scaley = 32;
if(vision_mode==3)
actual_vision_scalex = 32,actual_vision_scaley = 16;
for(ll rectVision = 0;rectVision <= actual_vision_scalex*2+2;rectVision++)
wcout << L'#';
wcout << endl;
short tmp_lastblock_print = -9999;
for(ll y_screen = 1;y_screen < actual_vision_scaley+1;y_screen++){
for(ll x_screen = 0;x_screen < actual_vision_scalex+2;x_screen++){
if(x_screen >= 1 && x_screen < actual_vision_scalex+1 && y_screen >= 1 && y_screen < actual_vision_scaley+1){
if(vision[y_screen - 1][x_screen - 1] >= 0){
if(color_on){//当系统为Linux且开启了颜色后才会显示
#ifdef __linux
if(vision[y_screen - 1][x_screen - 1] != tmp_lastblock_print || x_screen == 1){
wcout << block_color[vision[y_screen - 1][x_screen - 1]];
tmp_lastblock_print = vision[y_screen - 1][x_screen - 1];
}
if(Block_List[vision[y_screen - 1][x_screen-1]].need_show_char)
wcout << Block_List[vision[y_screen - 1][x_screen - 1]].show_char;
else
wcout<< L" ";
#else
wcout << Block_List[vision[y_screen - 1][x_screen - 1]].show_char;
#endif
}
else
wcout << Block_List[vision[y_screen - 1][x_screen - 1]].show_char;
}
else{
wcout < 127)
show_length+=2;
else
show_length+=1;
}
for(ll i = 0;i<= len - show_length;i++)
res_setw+= L" ";
res_setw+=input;
return res_setw;
}
//UI系统开始
class UI;
class item{
public:
UI *related_UI;//所属的UI
ll std_ID;//物品的标准ID
ll num;//物品的数量
ll type_ID;//物品的类别ID
ll damage;//物品耐久
bool can_use;//物品能否被使用
public:
void add_itemnum(ll value){
if(value+num<=item_maxstacknum[type_ID]&&value+num>=0)//在不超出范围的情况下增加
num+=value;
}//增减物品数量
void edit_itemnum(ll value){
if(value<=item_maxstacknum[type_ID])
num=value;
}//修改物品数量
void use_check(){
if(damage < 0 && damage != no_damage){
can_use = 0;
damage = 0;
}
}//检测物品是否能继续使用
};
ll UItype_num[6];
const ll UItype_maxItemNum[] = {32,9,4,3,32,64};
class UI{
public:
ll type;//类别
item item_list[maxItemNum];
wstring stdname;//标准名称
wstring showname;//显示名称
ll std_ID;//标准序号
}backpack,simple_crafting,*nowvisit_UI;
void printItem(item input){
wcout<<(input.related_UI)->stdname<type];gfvi++){
if(find_UI->item_list[gfvi].type_ID == 0)
return gfvi;
}
return -1;
}
item define_item(UI *define_UI,ll tID,ll num){
item ret_defitem;
ret_defitem.related_UI = define_UI;
ret_defitem.std_ID = gamefile_item_num++;
ret_defitem.num = num;
ret_defitem.type_ID = tID;
if(getFirstVoidItem(define_UI)type]-1)
define_UI->item_list[getFirstVoidItem(define_UI)]=ret_defitem;
else
ret_defitem.related_UI = NULL;
return ret_defitem;
}
const ll UI_num = 4;
UI define_UI(ll type){
UI ret_defUI;
ret_defUI.stdname = UIname_list[type]+L":"+itos(UItype_num[type]++);
ret_defUI.showname = UIname_list[type];
ret_defUI.type = type;
ret_defUI.std_ID = gamefile_UI_num++;
return ret_defUI;
}
void giveItem(UI *to_UI,ll type,ll num){
item new_item = define_item(to_UI,type,num);
}
ll inrange(ll input,ll max,ll min = 0){
if(input < min)
return min;
else if(input > max)
return max;
else
return input;
}
bool inrange(double vmin,double input ,double vmax){
return input>vmin && input <= vmax;
}
void exchangeItem(UI *from_UI,UI *to_UI,ll id1,ll id2){
swap(from_UI->item_list[inrange(id1,UItype_maxItemNum[from_UI->type],0)],
to_UI->item_list[inrange(id2,UItype_maxItemNum[to_UI->type],0)]);
}
void clearItem(UI *op_UI,ll id){
item voidItem;
voidItem.related_UI = op_UI;
voidItem.type_ID = 0;
voidItem.num = 0;
op_UI->item_list[inrange(id,UItype_maxItemNum[op_UI->type],0)] = voidItem;
}
//UI系统结束,总计104行
ll nmax(ll a,ll b){
return a>b?a:b;
}
void printBackpack(){
wcout << L"#Player "<"));
if(backpack.item_list[i].type_ID != ID(item_name,L"VOID"))
wcout<< setw_string(13,(item_name[backpack.item_list[i].type_ID] + L" " + itos(backpack.item_list[i].num)));
else
wcout<< L" ";
i++;
wcout << setw_string(7,(itos(i)+L">"));
if(backpack.item_list[i].type_ID != ID(item_name,L"VOID"))
wcout<< setw_string(13,(item_name[backpack.item_list[i].type_ID] + L" " + itos(backpack.item_list[i].num)));
else
wcout<< L" ";
wcout << endl;
}
}
void BriefInformationPrint(){//简明信息
ll printinfo_length = 0;
if(vision_mode == 1)
printinfo_length = 33;
else if(vision_mode == 2)
printinfo_length = 65;
wcout << L"#" << setw_string(printinfo_length,(L"Heart: " + itos(floor(player_heart)) + L" Hunger: " + itos(floor(player_hunger)) + L"#"))<< endl;
wcout << L"#" << setw_string(printinfo_length,(language_briefinfo[lang] + L" x:" + itos(playerx) + L" y:" + itos(actualy(playery)) + L"#")) << endl;//玩家坐标
wcout << L"#" << setw_string(printinfo_length,(language_briefinfo[lang + 3] + L": " + gamemode + L"#")) << endl;//游戏模式
wcout << L"#" << setw_string(printinfo_length,(language_briefinfo[lang + 6] + L"#")) << endl;//帮助提示 if(!info_text.empty())
PrintInfo();//输出提示信息
if(!info_chat.empty())
PrintChat();//输出聊天信息
wcout << language_Command[lang];
}//基本信息显示
wstring getFileSizeUnit(const wstring filein);
void UniversalInformationPrint(){
doclear();
wcout << language_UIP[lang + 21] << worldname << endl;//世界名称
wcout << language_UIP[lang + 24] << playername << endl;//玩家名称
wcout << language_UIP[lang] << playerx << L" y:" << playery << endl;//世界绝对坐标
wcout << language_UIP[lang + 3] << gamemode << endl;//当前游戏模式
wcout << language_UIP[lang + 6] << GameLatestVersion << endl;//游戏版本
wcout << language_UIP[lang + 15] << playerx - 7 << L"," << playery - 7 << language_UIP[lang + 18] << playerx + 8 << L"," << playery + 8 << L")" << endl;//玩家看到的区块坐标
wcout << language_UIP[lang + 27] << (filename==L""?L"VOID":filename)< 在指定方向上的指定距离放置方块\n\
/set d 1 stone即为在右侧放一个石头\n\
/break + wasd + 距离 ==> 在指定方向上的特定距离破坏方块\n\
/break d 1 把刚刚那个石头破坏掉" << endl;
wcout << L"(建议在电脑端进行进一步学习)"< 1024){
file_unitID++;
filelen/=1024.0;
}
return (itos(CUIL_std::half_precision(filelen)) + size_unit[file_unitID]);
}
int getAchievementNum(){
int ret_gan = 0;
for(int igan = 0;igan < achievement_num;igan++){
if(achievement_get[igan])
ret_gan++;
}
return ret_gan;
}
wstring getTrueAchievement(){
wstring ret_gta;
for(int igta = 0;igta < achievement_num;igta++){
if(achievement_get[igta]){
ret_gta+=achievement_name[igta];
if(igta < achievement_num - 1)
ret_gta+=L",";
}
}
return ret_gta;
}
void Achievement(ll ID){
wstring info_achievement;
if(!achievement_get[ID]){
info_achievement = language_achievement[lang] + language_achievement[ID * 3 + 3 + lang];
info_text.push(info_achievement);
achievement_get[ID] = 1;
}
}//成就的输出
void CreateChunk(world *related_world,ll chunk_ID);
void TerrainUpdateChunk(world *operate_world,ll updatex){
chunk_now = updatex/16;
Chunk temp_emptychunk1,temp_emptychunk2,temp_emptychunk3,temp_emptychunk4,temp_emptychunk5;
temp_emptychunk1=temp_emptychunk2=temp_emptychunk3=temp_emptychunk4=temp_emptychunk5=Chunk();
if(!incvect(operate_world,chunk_now-1) && chunk_now > 0){
operate_world->world_chunk.push_back(temp_emptychunk1);
CreateChunk(operate_world,chunk_now - 1);
}
if(!incvect(operate_world,chunk_now)){
operate_world->world_chunk.push_back(temp_emptychunk2);
CreateChunk(operate_world,chunk_now);
}
if(!incvect(operate_world,chunk_now+1) && chunk_now < chunk_total){
operate_world->world_chunk.push_back(temp_emptychunk3);
CreateChunk(operate_world,chunk_now + 1);
}
if(!incvect(operate_world,chunk_now-2)){
operate_world->world_chunk.push_back(temp_emptychunk4);
CreateChunk(operate_world,chunk_now-2);
}
if(!incvect(operate_world,chunk_now+2) && chunk_now < chunk_total){
operate_world->world_chunk.push_back(temp_emptychunk5);
CreateChunk(operate_world,chunk_now + 2);
}
}
short structure_info[2][256] = {
{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,12,12,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,1,5,1,1,5,1,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,9,5,9,9,5,9,5,5,5,5,5,5,5,5,0,0,12,12,0,0,12,12,0,0,5,5,5,5,5,5,5,5,9,5,9,9,5,9,5,5,5,5,5,5,1,1,1,0,1,0,1,1,0,1,0,1,1,1,5,12,0,0,0,0,12,12,12,12,12,12,0,0,0,0,12
},//神殿
};
void SpawnStructure(world *worldspawn,ll x,ll y,ll type){
for(ll z = x - 7;z<= x + 8;z++){
for(ll v = y - 15;v <= y;v++)
worldspawn->world_chunk[gcID(worldspawn,z/16)].terrain[index(topox(z),v)] = structure_info[type][(z - x + 7) + (v - y + 15) * 16];
}//强制覆盖地形
for(ll z = x - 7;z<= x + 8;z++){
ll structsy = y + 1;
ll tmp_spawnstructure_targetblock = gcID(worldspawn,z/16);
while(worldspawn->world_chunk[tmp_spawnstructure_targetblock].GetBlockInfo(z,structsy) == id_block_air && structsy < WorldYSize)
editblock(worldspawn,z,structsy++,id_block_cobblestone,tmp_spawnstructure_targetblock);
}//圆石基座
}
void SurfaceBlock(world *worldspawn,ll x,ll starty,ll biome_type,long long seed){
ll chunkID = x / 16,rcID = gcID(worldspawn,chunkID);
ll incursion_depth = rand()%3+2;
for(ll ny = WorldYSize;ny >= 0;ny--){
if(ny >= starty){
short nbID = id_block_air;
if(ny-starty<=incursion_depth){
if(ny==starty)
nbID = biome_surface_block[biome_type];
else
nbID = biome_nearsurface_block[biome_type];
}else{
int bedrock_incursion_p = 100 + (ny - WorldYSize-1)*20;
if(rand()%100 <= bedrock_incursion_p)//基岩侵入
nbID = id_block_bedrock;
else
nbID = id_block_stone;//石头
}
if(ny == WorldYSize-1)
nbID = id_block_bedrock;//底层强制替换
editblock(worldspawn,x,ny,nbID,rcID);
}//海平面下
else if(ny >= sea_level){
if(biome_type == id_biome_lava_sea || biome_type == id_biome_volcano || biome_type == id_biome_stone_plain)
editblock(worldspawn,x,ny,id_block_lava,rcID);
//岩浆海,火山,石原覆盖岩浆
else if(biome_noisevalue[biome_type]<=0.2)
editblock(worldspawn,x,ny,id_block_water,rcID);
//噪声(可理解为温度)值小于0.2的群系覆盖水
else
editblock(worldspawn,x,ny,id_block_air,rcID);
}//大于生成高度但小于海平面
else//否则为空气
editblock(worldspawn,x,ny,id_block_air,rcID);
}
}//生成每个生物群系的地表方块
void XmasLeave(world *world_spawn,ll size_tree,ll spawnx,ll spawny){
ll start_treex = spawnx - size_tree / 2,end_treex = spawnx + size_tree / 2,now_y = spawny;
while(start_treex <= end_treex){
for(ll x = start_treex;x<= end_treex;x++){
ll tmp_xmasleave_targetblock = gcID(world_spawn,x / 16);
if(getblock(world_spawn,x,now_y,tmp_xmasleave_targetblock) != id_block_wood)
editblock(world_spawn,x,now_y,id_block_leave,tmp_xmasleave_targetblock);
}
start_treex++;
end_treex--;
now_y--;
}
}//生成圣诞树树叶
void SpawnTree(world *world_spawn,ll size_tree,ll spawnx,ll spawny,ll tree_type){
srand(size_tree + seed + spawnx*spawny + tree_type * 8869311);
size_tree++;
ll size_branch = size_tree + (rand()%size_tree / 3),tree_startchunk=gcID(world_spawn,spawnx / 16);
for(ll z = 0;z<= size_branch;z++)
editblock(world_spawn,spawnx,spawny - z,id_block_wood,tree_startchunk);//树干
if(tree_type == 0){
ll midx_tree = spawnx,midy_tree = spawny - size_branch;
for(ll x = spawnx - size_tree;x<= spawnx + size_tree;x++){
TerrainUpdateChunk(world_spawn,x);
for(ll a = midy_tree + size_tree / 1.3;a>= midy_tree - size_tree - size_tree / 1.5;a--){
if(sqrt((x - spawnx)*(x - spawnx) + (a - midy_tree)*(a - midy_tree)) * 0.8 <= size_tree &&world_spawn->world_chunk[gcID(world_spawn,x / 16)].terrain[index(topox(x),a)] != ID(block_name,L"wood") && !OutsideWorld(x,a))//未出世界+在可生成距离内+当前位置不是树干==>树叶(在最底层时会消减一层)
editblock(world_spawn,x,a,id_block_leave);
}
}
}
else if(tree_type == 1){
ll xmas_tree_y = spawny - size_branch,size_leave = rand()%size_tree + 4;
for(ll z = 0;z<= rand()%size_tree;z++){
XmasLeave(world_spawn,size_leave,spawnx,xmas_tree_y);
xmas_tree_y -= (rand()%size_tree / 2 + 2);
size_leave -= (rand()%2 + 1);
}//通过源代码还是可以使用圣诞树的,就当彩蛋吧
}
//新年快乐!
}//生成树木
void SpawnCave(ll startx,ll starty,ll size_cave){
}//生成洞穴
//函数ST,SST,PB,PM,SBlock,BBlock,TP,Fill,Clone,EI,GI,Command,TYC,SSBlock,STree,CBlock,CW,AM,WI为游戏玩法及内容执行函数
ll top_block(world *world_check,ll x,ll ID){
for(ll j = 0;j<= WorldYSize - 1;j++){
if(world_check->world_chunk[gcID(world_check,x / 16)].terrain[index(topox(x),j)] == ID)
return j;
}
return -1;
}
ll top_notblock(world *world_check,ll x,ll ID){
for(ll j = 1;j<= WorldYSize - 1;j++){
if(world_check->world_chunk[gcID(world_check,x / 16)].terrain[index(topox(x),j)] != ID)
return j;
}
return -1;
}
void UpdateBoarder(world *world_spawn,ll xlen,ll ylen){
ll world_sx = MAX_INT / 2 - xlen / 2,world_ex = MAX_INT / 2 + xlen / 2,world_sy = WorldYSize / 2 -ylen / 2,world_ey = WorldYSize / 2 + ylen / 2;
for(ll i = 0;i<= MAX_INT;i++){
for(ll j = 0;j <= WorldYSize;j++){
if(i == world_sx || i == world_ex || j == world_sy || j == world_ey)
world_spawn->world_chunk[gcID(world_spawn,i / 16)].terrain[index(topox(i),j)] = id_block_barrier;
}
}
}
ll rangectrl(ll mini,ll value,ll maxi){
if(value < mini)
return mini;
else if(value > maxi)
return maxi;
else
return value;
}
double getTerrainY(double x,ll seed){
ll seeda = floor(((seed * (seed + int(x * 8869311))) % seed) * x * x * x * x * ((seed % int(x + 1) + 1)));
ll octaves = 10;
double sumY = 0.0,resY = 0.0,freq = 1.0;
for(ll z = 1;z<= octaves;z++){
sumY = TerrainNoise.noise(x * freq * z,seeda * freq * z,seeda);
resY += (sumY + 0.1) * 16.0 / freq;
freq*=2;
}
resY /= octaves;
return resY;
}
double getBiomeValue(double x,double y,double w){
return BiomeNoise.noise(x + seed,y + seed,w + seed);
}
bool connectblock(ll x,ll y){
ll tmp_connect_targetblock_1 = gcID(player_world,(x-1)/16),
tmp_connect_targetblock_2 = gcID(player_world,x/16),
tmp_connect_targetblock_3 = gcID(player_world,(x+1)/16);
if(player_world->world_chunk[tmp_connect_targetblock_1].terrain[index(topox(x-1),y-1)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_2].terrain[index(topox(x),y-1)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_1].terrain[index(topox(x-1),y-1)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_1].terrain[index(topox(x-1),y)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_3].terrain[index(topox(x+1),y)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_1].terrain[index(topox(x-1),y+1)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_2].terrain[index(topox(x),y+1)] == 5 &&
player_world->world_chunk[tmp_connect_targetblock_3].terrain[index(topox(x+1),y+1)] == 5
){
return 0;
}
else
return 1;
}
struct poss_sort_biome{
ll possibility;
ll biome_id;
};
bool biome_cmp(poss_sort_biome a,poss_sort_biome b){
return (a.possibility > b.possibility) ? 0 : 1;
}
ll getNoise_Biome(double value,double x_input){
value *= 1.1;
double getDiffer_Biome[biome_num];
poss_sort_biome biome_matchlist[biome_num];
for(ll gnbi = 0;gnbi=0;ret_biomeID--){
if(rand()%1000 < biome_matchlist[ret_biomeID].possibility){
return biome_matchlist[ret_biomeID].biome_id;//如果小于随机值则返回对应的群系,群系的生成将概率越来越大
}
}
return biome_matchlist[0].biome_id*(biome_matchlist[0].biome_id!=id_biome_extreme_plain);//默认为平原
}
double fade(double t){
return t*t*t*(t*(6*t - 15)+10);
}
ll rand_range(ll seed,ll start,ll end){
srand(seed*seed+114514*(end-start)-2147483647*seed);
if(endworld_chunk[related_world->world_chunk.size() - 1].ID = chunk_ID;
ll create_rcID = gcID(related_world,chunk_ID);
if(related_world == &Main){
ll biome_chunk = GetTransitionBiome(chunk_ID*16);
ll height_chunk[16]={0};
double terrain_level = 0.0;
for(ll i = 0;i< 16;i++)
height_chunk[i] = get_biome_heightInterrupt(getTerrainY((i+chunk_ID*16+ 1) * 0.001,seed),biome_chunk);
for(ll i = 0;i< 16;i++)
SurfaceBlock(related_world,chunk_ID * 16 + i,rangectrl(0,height_chunk[i],WorldYSize),biome_chunk,seed);
for(ll i = 0;i<= rand()%3;i++){
srand(seed + i * i+chunk_ID*8869311);
ll try_spawntreex = rand()%16 + chunk_ID * 16;
ll height_spawntree = top_notblock(related_world,try_spawntreex,id_block_air);
if(TestTag(L"plant",Block_List[related_world->world_chunk[create_rcID].terrain[index(i,height_spawntree)]].tag)){
SpawnTree(related_world,rand()%3+1,try_spawntreex,top_block(related_world,try_spawntreex,id_block_grass)-1,0);
}
}
//对于主世界的特定群系,生成草丛或花
for(ll i = 0;i<16;i++){
srand(seed * (i + 8869311+ chunk_ID) - (seed & 0XFF));
int possibility_spawngrass = rand()%100;
if(possibility_spawngrassworld_chunk[create_rcID].terrain[index(i,height_spawngrass)]].tag)){
related_world->world_chunk[create_rcID].terrain[index(i,height_spawngrass-1)] = rand()%100 > 80 ? id_block_short_grass : id_block_rose;
}
}
}
for(ll i = 0;iworld_chunk[create_rcID].terrain[index(topox(ore_nx),ore_ny)]].tag)){
//related_world->world_chunk[create_rcID].terrain[index(ore_nx,ore_ny)] = id_block_iron_ore;
}
}
}
}
srand(((seed * (chunk_ID*16 + 1)) % seed) * int(sqrt(abs(seed))));
if(rand()%100 <= 10)
SpawnStructure(related_world,chunk_ID + 7,top_notblock(related_world,chunk_ID + 7,id_block_air),0);
}//主世界
else if(related_world == &Under){
short terrain_under_chart[256][16] = {5};
for(double i = 0;i<2.56;i+=0.01){
for(double j = chunk_ID * 0.16;j 0.2)?((rand()%100 > 90)?id_block_cobblestone:id_block_stone):id_block_air;
}
}
for(ll i = 0;i<256;i++){
for(ll j = 0;j<16;j++){
if(!connectblock(chunk_ID*16+j,i) && terrain_under_chart[i][j] != 5)
terrain_under_chart[i][j] = 5;
if(terrain_under_chart[i][j] == 5 && i> sea_level)
terrain_under_chart[i][j] = id_block_lava;
}
}//去除浮空方块
for(ll i = 0;i<256;i++){
for(ll j = 0;j<16;j++)
player_world->world_chunk[create_rcID].terrain[i * 16 + j] = terrain_under_chart[i][j];
}//复制到地形数组
}//底世界
related_world->world_chunk[create_rcID].discovered = 1;
}//生成区块
void UpdateChunk(){
chunk_now = playerx/16;
Chunk temp_emptychunk1,temp_emptychunk2,temp_emptychunk3,temp_emptychunk4,temp_emptychunk5;
temp_emptychunk1=temp_emptychunk2=temp_emptychunk3=temp_emptychunk4=temp_emptychunk5=Chunk();
if(!incvect(player_world,chunk_now-1) && chunk_now > 0){
player_world->world_chunk.push_back(temp_emptychunk1);
CreateChunk(player_world,chunk_now - 1);
}
if(!incvect(player_world,chunk_now)){
player_world->world_chunk.push_back(temp_emptychunk2);
CreateChunk(player_world,chunk_now);
}
if(!incvect(player_world,chunk_now+1) && chunk_now < chunk_total){
player_world->world_chunk.push_back(temp_emptychunk3);
CreateChunk(player_world,chunk_now + 1);
}
if(!incvect(player_world,chunk_now-2)){
player_world->world_chunk.push_back(temp_emptychunk4);
CreateChunk(player_world,chunk_now-2);
}
if(!incvect(player_world,chunk_now+2) && chunk_now < chunk_total){
player_world->world_chunk.push_back(temp_emptychunk5);
CreateChunk(player_world,chunk_now + 2);
}
}//更新区块-pre0.2.6.100加入随玩家移动而更新的区块
bool isthrough(world detect_world,ll x,ll y){
return TestTag(tag_type[4],Block_List[detect_world.world_chunk[gcID(detect_world,x / 16)].GetBlockInfo(x,y)].tag);
}//是否为实体方块
bool isthrough(world *detect_world,ll x,ll y){
return TestTag(tag_type[4],Block_List[detect_world->world_chunk[gcID(detect_world,x / 16)].GetBlockInfo(x,y)].tag);
}//是否为实体方块
bool isthrough(short blockID){
return TestTag(tag_type[4],Block_List[blockID].tag);
}//是否为实体方块
wstring stdpos(ll x,ll y){
return (L"(" + itos(x) + L"," + itos(y) + L")");
}//输出标准坐标
void PlayerBorn(world *spawn_world,ll spawnx_player){
playerx = spawnx_player;
UpdateChunk();
ll counter_t = 0,tmpx = 0;
do{
tmpx = (counter_t/2)*(counter_t%2==0?1:-1);//震荡
counter_t++;
playery = top_notblock(spawn_world,spawnx_player+tmpx,id_block_air);
UpdateChunk();
}while(playery==-1);
playerx = spawnx_player+tmpx;
player_heart = 20.0;
player_hunger = 20.00;
player_full = 5.00;
player_oxygen = 20;
}//会尽可能的靠近给定出生点出生,并避开方块
void PlayerMove(char direction){
Achievement(0);
pchunk_index = gcID(player_world,playerx/16);
if(direction >= 'A' &&direction <= 'Z')
direction += 32;
if(direction == 'w'){
if(isthrough(player_world,playerx,playery - 1) && playery - 1 >= (WorldYSize- boarder_y) / 2){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),--playery)] = 1;
}
}//上移
else if(direction == 's'){
if(isthrough(player_world,playerx,playery + 1) && playery + 1 <= (WorldYSize+ boarder_y) / 2){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),++playery)] = 1;
}
}//下移
else if(direction == 'a'){
if(isthrough(player_world,playerx - 1,playery) && playerx - 1 >= (MAX_INT - boarder_x) / 2){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
playerx--;
pchunk_index = gcID(player_world,playerx/16);
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 1;
}else if(!isthrough(player_world,playerx - 1,playery) && isthrough(player_world,playerx - 1,playery - 1) && isthrough(player_world,playerx,playery - 1) && auto_jump){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
playerx--;
playery--;
pchunk_index = gcID(player_world,playerx/16);
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 1;
}//自动跳跃
else
DefaultUpdate;
}//左移
else if(direction == 'd'){
if(isthrough(player_world,playerx + 1,playery)){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
playerx++;
pchunk_index = gcID(player_world,playerx/16);
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 1;
}else if(!isthrough(player_world,playerx + 1,playery) && isthrough(player_world,playerx + 1,playery - 1) && isthrough(player_world,playerx,playery - 1) && auto_jump){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
playerx++;
playery--;
pchunk_index = gcID(player_world,playerx/16);
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 1;
}//自动跳跃
else
DefaultUpdate;
}//右移
else//原地更新
DefaultUpdate;
//注:玩家移动逻辑为当目标方块带有through标签时就移动,在此情况下,树叶,空气,木头(是的木头也能穿过!),水,岩浆都能穿过
}//玩家的基础移动
void Set(wchar_t direction,ll distance,wstring block_type){
short setblockID;
wstring info_set;
Achievement(1);
if(ID(block_name,block_type) != -1)//自带方块
setblockID = ID(block_name,block_type);
else{
info_set = language_set[lang] + block_type;
info_text.push(info_set);
setblockID = 14;
}
direction = Lower_Char(direction);
if(distance <= 16 && distance > 0){
if(direction == L'w'){
if((TestTag(tag_type[4],Block_List[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery - distance)]].tag) || TestTag(tag_type[7],Block_List[player_world->world_chunk[gcID(player_world,playerx / 16)].terrain[index(topox(playerx),playery - distance)]].tag))&& playery - distance >= 0)
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery - distance)] =setblockID;
else
DefaultUpdate;
}
else if(direction == L's'){
if((TestTag(tag_type[4],Block_List[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery + distance)]].tag) || TestTag(tag_type[7],Block_List[player_world->world_chunk[gcID(player_world,playerx / 16)].terrain[index(topox(playerx),playery + distance)]].tag) || TestTag(tag_type[7],Block_List[player_world->world_chunk[playerx / 16].terrain[index(topox(playerx),playery + distance)]].tag)) && playery + distance <=WorldYSize)
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery + distance)] = setblockID;
else
DefaultUpdate;
}
else if(direction == L'a'){
ll tmp_set_targetblock_left = gcID(player_world,(playerx - distance) / 16);
if((TestTag(tag_type[4],Block_List[player_world->world_chunk[tmp_set_targetblock_left].terrain[index(topox(playerx - distance),playery)]].tag) || TestTag(tag_type[7],Block_List[player_world->world_chunk[tmp_set_targetblock_left].terrain[index(topox(playerx - distance),playery)]].tag)) && playerx - distance >= 0)
player_world->world_chunk[tmp_set_targetblock_left].terrain[index(topox(playerx - distance),playery)] = setblockID;
else
DefaultUpdate;
}
else if(direction == L'd'){
ll tmp_set_targetblock_right = gcID(player_world,(playerx + distance) / 16);
if((TestTag(tag_type[4],Block_List[player_world->world_chunk[gcID(player_world,(playerx + distance) / 16)].terrain[index(topox(playerx + distance),playery)]].tag) || TestTag(tag_type[7],Block_List[player_world->world_chunk[tmp_set_targetblock_right].terrain[index(topox(playerx + distance),playery)]].tag)))
player_world->world_chunk[tmp_set_targetblock_right].terrain[index(topox(playerx + distance),playery)] = setblockID;
else
DefaultUpdate;
}
else
DefaultUpdate;
}
else{
info_text.push(L"Too far(" + itos(distance) + L" > 16) for command /set to execute");
}
}//放置方块
void Break(wchar_t direction,ll distance){
Achievement(2);
if(direction >= L'A' &&direction <= L'Z')
direction += 32;
if(0 < distance && distance <= 16){
if(direction == L'w'){
if(playery - distance > 0 && !TestTag(tag_type[0],Block_List[getblock(player_world,playerx,playery + distance,pchunk_index)].tag))//检测目标方块是否带有unbreakable标签,如果无则破坏
editblock(player_world,playerx,playery - distance,id_block_air,pchunk_index);
else
Achievement(3);
}
else if(direction == L's'){
if(playery + distance <= WorldYSize && !TestTag(tag_type[0],Block_List[getblock(player_world,playerx,playery + distance,pchunk_index)].tag))
editblock(player_world,playerx,playery + distance,id_block_air,pchunk_index);
else
Achievement(3);
}
else if(direction == L'a'){
if(playerx - distance > 0 &&!TestTag(tag_type[0],Block_List[getblock(player_world,playerx-distance,playery)].tag))
editblock(player_world,playerx-distance,playery,id_block_air);
else
Achievement(3);
}
else if(direction == L'd'){
if(playerx + distance <= MAX_INT && !TestTag(tag_type[0],Block_List[getblock(player_world,playerx+distance,playery)].tag))
editblock(player_world,playerx+distance,playery,id_block_air);
else
Achievement(3);
}
else
DefaultUpdate;
}
else
info_text.push(L"Too far("+ itos(distance) + L"> 16 for command /break to execute");
}//破坏方块
void Transportation(wstring command_transport){
ll word_num_transport = 0,destinationx,destinationy,position_transport = 0;
vector words_transport = split(command_transport,L' ');
if(words_transport.size()<2){
info_text.push(L"tp指令的参数不足("+itos(words_transport.size())+L"<2)");
return ;
}
if((words_transport[0])[0] == L'~')
position_transport += playerx;
position_transport +=strtoi(words_transport[0]);
destinationx = position_transport;
position_transport = 0;
if((words_transport[1])[0] == L'~')
position_transport += playery;
position_transport += (position_transport!=0)?strtoi(words_transport[1]):actualy(strtoi(words_transport[1]));
destinationy = position_transport;
//通配符解析
wstring info_tp;
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = 0;
playerx = destinationx;
playery = destinationy;
UpdateChunk();
player_world->world_chunk[gcID(player_world,destinationx / 16)].entity[index(topox(destinationx),destinationy)] = 1;
info_tp = language_tp[lang + 3] + itos(destinationx) + L" y = " + itos(actualy(destinationy)) + L")";
info_text.push(info_tp);
if(playerx < 0 || playerx > MAX_INT || playery < 0 || playery > WorldYSize - 0)
Achievement(4);
}//tp(传送指令),适用通配符,用于将玩家传送至指定位置
void Fill(wstring command_fill){
ll word_num = 0,startx_fill,starty_fill,endx_fill,endy_fill,block_type_fill;
wchar_t fill_block_char;
vector words_fill = split(command_fill,L' ');
ll words_fill_size = words_fill.size();
if(words_fill_size >= 5){
for(int fi = 0;fi " + itos(maxinum_fill) + L")";
info_text.push(info_fill);
}//方块过多
}
else{
info_text.push(L"Too less parameter for survive.command.fill to execute.("+itos(words_fill_size)+L" < 5)");
return;
}
}//fill(填充指令),适用通配符,以特定方块填充某个区域
void Clone(wstring comm_clone){
ll word_num = 0,startx_clone = 0,starty_clone = 0,endx_clone = 0,endy_clone = 0,copy_startx = 0,copy_starty= 0;
vector words_clone = split(comm_clone,L' ');
word_num=words_clone.size();
if(word_num<6)
info_text.push(L"Too less parameter for survive.command.gamerule to execute");
else{
for(ll i = 0;i < word_num;i++){
ll position_clone = 0;
if(words_clone[i][0] == L'~'){
if(i == 0 || i == 2 || i == 4)
position_clone += playerx;
else
position_clone += playery;
}//局部坐标转绝对坐标
position_clone += strtoi(words_clone[i]);
if(i == 0)
startx_clone = position_clone;
else if(i == 1)
starty_clone = position_clone;
else if(i == 2)
endx_clone = position_clone;
else if(i == 3)
endy_clone = position_clone;
else if(i == 4)
copy_startx = position_clone;
else if(i == 5){
copy_starty = position_clone;
break;
}
}
wstring info_clone;
ll clone_startx = min(startx_clone,endx_clone),clone_starty = min(starty_clone,endy_clone);
if(OutsideWorld(clone_startx,clone_starty) || OutsideWorld(max(startx_clone,endx_clone),max(starty_clone,endy_clone)) || OutsideWorld(copy_startx,copy_starty)){//超出世界范围
info_clone = language_clone[lang] + itos(clone_startx) + L"," + itos(clone_startx) + L")(" + itos(max(startx_clone,endx_clone)) + L"," + itos(max(starty_clone,endy_clone)) + L"),(" + itos(copy_startx) + L"," + itos(copy_starty) + L")";
info_text.push(info_clone);
}
else{
for(ll i = 0;i <= max(starty_clone,endy_clone) - clone_starty;i++){
for(ll j = 0;j <= max(startx_clone,endx_clone) - clone_startx;j++)
player_world->world_chunk[gcID(player_world,(copy_startx + j) / 16)].terrain[index(topox(copy_startx + j),copy_starty + i)] = player_world->world_chunk[gcID(player_world,(copy_startx + j) / 16)].terrain[index(topox(clone_startx + j),clone_starty + i)];
}
info_clone = language_clone[lang + 3] + itos(clone_startx) + L"," + itos(clone_startx) + L"),(" + itos(max(startx_clone,endx_clone)) + L"," + itos(max(starty_clone,endy_clone)) + language_clone[lang + 9] + itos(copy_startx) + L"," + itos(copy_starty) + L")";
}
}
}//clone(克隆指令),适用通配符,将一个地区的方块复制到另一个地区
void TestBlock(wchar_t direction_test,ll distance){
direction_test = Lower_Char(direction_test);
wstring test_block_name,warningtext_test;
if(direction_test == L'a' && !OutsideWorld(playerx - distance,playery))
test_block_name = block_name[player_world->world_chunk[gcID(player_world,(playerx - distance) / 16)].terrain[index(topox(playerx - distance),playery)]];
else if(direction_test == L'd' && !OutsideWorld(playerx + distance,playery))
test_block_name = block_name[player_world->world_chunk[gcID(player_world,(playerx + distance) / 16)].terrain[index(topox(playerx + distance),playery)]];
else if(direction_test == L'w' && !OutsideWorld(playerx,playery - distance))
test_block_name = block_name[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery - distance)]];
else if(direction_test == L's' && !OutsideWorld(playerx,playery + distance))
test_block_name = block_name[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery + distance)]];
else if(direction_test != L'a' && direction_test != L'd' && direction_test != L'w' && direction_test != L's'){
warningtext_test = language_testblock[lang];
warningtext_test += direction_test;
}
else
warningtext_test += language_testblock[lang + 3];
if(warningtext_test != L"\n")
info_text.push(warningtext_test);
if(test_block_name != L"\n"){
wstring test_command = language_testblock[lang + 6] + test_block_name;
info_text.push(test_command);
}
}//查询方块名称
/*
b = bool类型参数
i = ll类型参数
s = string类型参数
三种类型皆从字符串转化而来
*/
wstring depress_para(wchar_t para_type){
if(para_type == L'b')
return L"bool";
else if(para_type == L'i')
return L"ll";
else if(para_type == L's')
return L"string";
else
return L"default";
}//生成错误信息-标准形式的参数
wstring depress_paralist(wstring paralist){
wstring res_dp;
for(ll i = 0;i<= paralist.length() - 1;i++){
res_dp += depress_para(paralist[i]);
if(i < paralist.length() - 1)
res_dp += L",";
}
return res_dp;
}
wstring success_gamerule(ll type){
if(type >= 0)
return (L"gamerule." + gamerule_list[type] + language_gamerule[lang]);
else
return L"default";
}
wstring bool_para(bool input){
if(input)
return L"true";
else
return L"false";
}
void Gamerule(wstring gamerule_input){
Achievement(6);
vector words_gamerule = split(gamerule_input,L' ');
ll words_num_gamerule = words_gamerule.size();
ll visit_parameterID = ID(gamerule_list,words_gamerule[0]);//第一个单词用于识别ID
ll parameter_listi[99] = {0},ipara_num = 0,bpara_num = 0,spara_num = 0;
bool parameter_listb[99] = {0};
wstring parameter_lists[99];
if(words_num_gamerule <= 1){
info_text.push(language_gamerule[lang + 3]);
return ;
}
for(ll i = 1;i<= words_num_gamerule;i++){
char parameter_type = gamerule_parameter[visit_parameterID][i - 1];
if(parameter_type == L'b'){
if(words_gamerule[i] == L"false")
parameter_listb[bpara_num++] = false;
else if(words_gamerule[i] == L"true")
parameter_listb[bpara_num++] = true;
else
parameter_listb[bpara_num++] = strtoi(words_gamerule[i]);
}
else if(parameter_type == L'i')
parameter_listi[ipara_num++] = strtoi(words_gamerule[i]);
else if(parameter_type == L's')
parameter_lists[spara_num++] = words_gamerule[i];
}
switch(visit_parameterID){
case 0://color-颜色开启或关闭
if(bpara_num == 1){//正确的数目
color_on = parameter_listb[0];
info_text.push(success_gamerule(0) + bool_para(parameter_listb[0]));
}
else{
if(bpara_num < 1)//无参数
info_text.push(L"Error: Missing parameter(type = " + depress_paralist(gamerule_parameter[0]) + L") for command:/gamerule color");
//翻译:"错误:对于/gamerule color指令缺失了布尔类型参数"
else
info_text.push(L"Error: Too many parameters for command: /gamerule color which required only 1");
//翻译:"错误:/gamerule color指令"
}
break;
case 1://vision_size-能看见的地图大小(最大16*16,标准视野)
if(ipara_num == 1){
vision_size = parameter_listi[0];
info_text.push(success_gamerule(1) + itos(parameter_listi[0]));
}
break;
case 2://boarder_size-边界大小
if(ipara_num == 2){
boarder_x = parameter_listi[0],boarder_y = parameter_listi[1];
UpdateBoarder(player_world,boarder_x,boarder_y);
info_text.push(success_gamerule(2) + itos(parameter_listi[0]) + L"*" + itos(parameter_listi[1]));
}
break;
case 3://maxinum_fill-方块填充的最大数量,调整/fill指令的上限
if(ipara_num == 1){
maxinum_fill = parameter_listi[0];
info_text.push(success_gamerule(3) + itos(parameter_listi[0]));
}
break;
case 4://player_name-玩家的名字
playername = parameter_lists[0];
info_text.push(success_gamerule(4) + parameter_lists[0]);
info_text.push(L"Hello," + playername);
break;
case 5://world_name-世界的名字
worldname = parameter_lists[0];
info_text.push(success_gamerule(5) + parameter_lists[0]);
info_text.push(L"Hello," + worldname + L"!");
break;
case 6://auto_jump-自动跳跃
auto_jump = parameter_listb[0];
info_text.push(success_gamerule(6) + bool_para(parameter_listb[0]));
break;
case 7://respawn_point-重生点
if(parameter_listi[0] > 0 && parameter_listi[1] > 0 && parameter_listi[1] < WorldYSize){
respawnx = parameter_listi[0];
respawny = parameter_listi[1];
info_text.push(success_gamerule(7) + itos(parameter_listi[0]) + L"," + itos(parameter_listi[0]));
}
break;
case 8://texture_loaded-材质加载
texture_loaded = parameter_listb[0];
info_text.push(success_gamerule(8) + bool_para(parameter_listb[0]));
break;
case 9://vision_mode-视野模式
if(ID(vision_modes,parameter_lists[0])!=-1)
vision_mode = ID(vision_modes,parameter_lists[0])+1;
info_text.push(success_gamerule(9) + parameter_lists[0]);
break;
case 10://knowledge-开启提示
knowledge = parameter_listb[0];
info_text.push(success_gamerule(10) + bool_para(parameter_listb[0]));
break;
case 11://reverse_y-反转y轴
reverse_y = parameter_listb[0];
info_text.push(success_gamerule(11) + bool_para(parameter_listb[0]));
break;
default:
info_text.push(L"Unknowing gamerule: " + words_gamerule[0]);
break;
}
}
void Eat(){
player_hunger+= 5;
if(player_hunger > 20){
player_full = player_hunger- 20;
player_hunger = 20;
}
}//过渡命令/eat,用于增加饥饿值
void Setblock(ll x,ll y,wstring type){
if(x < 0 || x > MAX_INT || y < 0 || y > WorldYSize)
info_text.push(language_setblock[lang]);
else{
if(ID(block_name,type) != -1)
player_world->world_chunk[gcID(player_world,x / 16)].terrain[index(topox(x),y)] = ID(block_name,type);
else
info_text.push((language_setblock[lang + 3] + L": " + type));
}
}
void Command(wstring command_all){
wstring command_group[256],warningtext;//最多256条命令
item new_item;
UI *exc_UI1,*exc_UI2;
ll group_size = 0,total_length = command_all.length() - 1;//group_size-命令总数计数,total_length-总长度
for(ll i = 0;i<= total_length;i++){
if(command_all[i] != L';'){
while(command_all[i] != L';' && i <= total_length)
command_group[group_size] += command_all[i++];
wstring command_words[99],spara_command[99],now_command = command_group[group_size];
ll ipara_command[99],spara_cnum = 0,cpara_cnum = 0,ipara_cnum = 0,separated_length = command_group[group_size].length() - 1,word_commnum = 0;
wchar_t cpara_command[99],pause_savefile;//char参数
for(ll j = 0;j <= separated_length;j++){
if(now_command[j] != L' '){
while(now_command[j] != L' ' && j <= separated_length)
command_words[word_commnum] += now_command[j++];
word_commnum++;
}
}
ll command_ID = ID(command_name,command_words[0]);//识别命令
ll ID_langname=0,ID_gamemodename = 0;
ll giveItemID,addItemNum;
ll tID;
if(command_parameter[command_ID] == L"long"){//长参数命令-自动解析单词组的命令
wstring long_type_para;
for(ll j = 0;j< word_commnum;j++){
long_type_para += command_words[j+1];
if(j < word_commnum)
long_type_para += L" ";
}
spara_command[0] = long_type_para;
}
else if(command_parameter[command_ID] != L"n"){//判断是否为无参数命令
for(ll j = 1;j<= word_commnum;j++){
wchar_t paratype_command = command_parameter[command_ID][j - 1];
if(paratype_command == L'c')
cpara_command[cpara_cnum++] = command_words[j][0];
else if(paratype_command == L'i')
ipara_command[ipara_cnum++] = strtoi(command_words[j]);
else
spara_command[spara_cnum++] = command_words[j];
}
}
//不更新任何东西
switch(command_ID){
case 0://w
PlayerMove(command_words[0][0]);
break;
case 1://a
PlayerMove(command_words[0][0]);
break;
case 2://s
PlayerMove(command_words[0][0]);
break;
case 3://d
PlayerMove(command_words[0][0]);
break;
case 4:// /move
PlayerMove(cpara_command[0]);
break;
case 5:// /set
Set(cpara_command[0],ipara_command[0],spara_command[0]);
break;
case 6:// /break
Break(cpara_command[0],ipara_command[0]);
break;
case 7:// /fill
if(gamemode != L"creative"){
info_text.push(L"没有使用/fill指令的权限!");
break;
}
Fill(spara_command[0]);
break;
case 8:// /tp
if(gamemode != L"creative"){
info_text.push(L"没有使用/tp指令的权限!");
break;
}
Transportation(spara_command[0]);
break;
case 9:// /clone
if(gamemode != L"creative"){
info_text.push(L"没有使用/clone指令的权限!");
break;
}
Clone(spara_command[0]);
break;
case 10:// /gamemode
ID_gamemodename = ID(gamemode_name,spara_command[0]);
if(ID_gamemodename != -1)
gamemode = gamemode_name[ID_gamemodename];
else if(spara_command[0].length() == 1 && (spara_command[0][0] == '0' || spara_command[0][0] == '1' || spara_command[0][0] == '2'))
gamemode = gamemode_name[strtoi(spara_command[0])];
else
warningtext = language_warncommand[lang] + spara_command[0];//无符合模式,则显示警告
break;
case 11:// /help
HelpPrint();
break;
case 12:// /open
active_screen = spara_command[0];
break;
case 13:// /gamerule
Gamerule(spara_command[0]);
break;
case 14:// /testblock
if(gamemode != L"creative"){
info_text.push(L"没有使用/testblock指令的权限!");
break;
}
TestBlock(cpara_command[0],ipara_command[0]);
break;
case 15:// /kill
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery)] = ' ';
PlayerBorn(player_world,respawnx);
info_text.push(playername + language_kill[lang]);
break;
case 16:// /eat
Eat();
break;
case 17:// /setblock
if(gamemode != L"creative"){
info_text.push(L"没有使用/setblock指令的权限!");
break;
}
Setblock(ipara_command[0],actualy(ipara_command[1]),spara_command[0]);
break;
case 18:// /seed
info_text.push((worldname + L" - seed: " + itos(seed)));
break;
case 19:// /biome
info_text.push((L"所处生物群系: " + biome_name[getChunkBiome(playerx/16)]));
break;
case 20:// /say
info_chat.push(create_chat(playername,spara_command[0]));
break;
case 21:// /lang
ID_langname = ID(language_name,spara_command[0]);
if(ID_langname != -1)
lang = ID_langname;
else if(spara_command[0][0] == L'0' ||spara_command[0][0] == L'1' || spara_command[0][0] == L'2')
lang = strtoi(spara_command[0]);
else
warningtext = language_warncommand[lang] + spara_command[0];//无符合模式,则显示警告
break;
case 22:// /give
//先找到同类物品
if(gamemode != L"creative"){
info_text.push(L"没有使用/give指令的权限!");
break;
}
giveItemID = ID(item_name,spara_command[0]);
for(ll gi = 0;gitype];gi++){
if(giveItemID == nowvisit_UI->item_list[gi].type_ID){
addItemNum = min(ipara_command[0],64-nowvisit_UI->item_list[gi].num);
nowvisit_UI->item_list[gi].num+=addItemNum;
ipara_command[0] -= addItemNum;
}//找到同类
}
while(ipara_command[0] > 0){
if(ipara_command[0] >= 64){
new_item = define_item(nowvisit_UI,giveItemID,64);
ipara_command[0]-=64;
}else{
new_item = define_item(nowvisit_UI,giveItemID,ipara_command[0]);
ipara_command[0] = 0;
}
}
break;
case 23:// /throw
clearItem(nowvisit_UI,ipara_command[0]);
break;
case 24:// /savefile
wcout << L"Start to print file" << endl;
filename = spara_command[0];
info_text.push(L"Starting to create file "+filename + L" 's code");
printFile();
break;
// case 25:// /cload
// tID = gcID(player_world,ipara_command[0]);
// if(tID==-1){
// info_text.push(L"请求加载的区块超出世界范围");
// break;
// }
// CreateChunk(player_world,ipara_command[0]);
// break;
// case 26:// /cclear
// tID = gcID(player_world,ipara_command[0]);
// if(tID==-1){
// info_text.push(L"请求清空的区块超出世界范围");
// break;
// }
// player_world->world_chunk[tID] = Chunk(player_world->world_chunk[tID].ID);
// break;
default:
if(separated_length > 1)//如果不是空命令才会警告
warningtext = language_warncommand[lang + 3] + command_words[i][0];//未知命令警告
}//分命令的处理
group_size++;//更新
}//分割完毕后处理
}//分割总命令
//if(color_on)//颜色刷新保护
// usleep(750000);//延时防止故意持续刷新导致崩溃
}//用于命令的处理
//1.3.4更新!命令组加入!
void Addmod(wstring mod_name,wstring mod_command,wstring mod_block_add,wstring mod_item_add){
mod_list[mod_total++] = mod_name;//单个的名字
if(mod_command != L"none"){
for(ll i = 0;i < mod_command.length();i++){
if(mod_command[i] == L'<')/*碰到命令标识符*/{
i++;
while(mod_command[i] != L'>')//在碰到右标识符前持续读入命令数据
mod_command_list[mod_command_total] += mod_command[i++];
mod_command_list[mod_command_total] += (L"." + mod_name);
mod_command_total++;
}
}//解析模组新增命令并写入
}
if(mod_block_add != L"none"){
for(ll i = 0;i < mod_block_add.length();i++){
if(mod_block_add[i] == L'<')/*碰到方块标识符*/{
i++;
while(mod_block_add[i] != L',')//在碰到逗号前持续读入方块名称
mod_block_name[mod_block_total] += mod_block_add[i++];
mod_block_name[mod_block_total] += (L"." + mod_name);//添加模组标识
mod_block_char[mod_block_total++] = mod_block_add[i+ 1];
}
}//解析模组新增方块并写入
}
if(mod_item_add != L"none"){
for(ll i = 0;i < mod_item_add.length();i++){
if(mod_item_add[i] == L'<')/*碰到物品标识符*/{
i++;
while(mod_item_add[i] != L',')//在碰到逗号前持续读入物品名称
mod_item_name[mod_item_total] += mod_item_add[i++];
mod_item_name[mod_item_total] += (L"." + mod_name);
mod_item_char[mod_item_total++] = mod_item_add[i+ 1];
}
}//解析模组新增物品并写入
}
}//1.2.3更新--模组的初步兼容!!!
bool readFile(wstring input){
//懒得写函数,直接复制粘贴了
vector unit_file = split(input,L';');
vector funit_file = split(unit_file[0],L',');
vector pwunit_file = split(unit_file[1],L',');
vector wcunit_file = split(unit_file[3],L'#');
wstring std_fillpw[] = {L"16384",L"192",L"10.0",L"10.0",L"5.0",L"10.0",L"Pasli",L"World SU-21903",L"8869311",L"192",L"creative",L"0"};
//解析玩家与世界基本信息
if(unit_file.size()<3){
wcout << red<>>";
wstring file_end1;
wcin >> file_end1;
return 0;
}else{
if(funit_file.size()<2){
wcout << red< asunit_file = split(unit_file[2],L',');
//asunit_file = Achievement & Setting unit of file
if(asunit_file.size() < 5){
wstring std_fillas[] = {cpystr(L"0",achievement_num),L"0",L"0",L"0",L"0"};
while(asunit_file.size()<5)
asunit_file.push_back(std_fillas[asunit_file.size()-1]);
}
for(int iasuf = 0;iasuf single_chunk = split(wcunit_file[iwc],L':');
Chunk newsingle_chunk;
newsingle_chunk.ID = strtoi(single_chunk[0]);
newsingle_chunk.active = strtoi(to_str(single_chunk[1][0]));
newsingle_chunk.discovered = strtoi(to_str(single_chunk[1][1]));
vector getchunkblock = depress_str(single_chunk[2]);
for(int igcc = 0;igccworld_chunk.push_back(newsingle_chunk);
}
//区块信息
wcout <(split(L"生成新世界,加载已有存档",L','));
if(world_init_choice == 2){
doclear();
wcout << L"请进入源代码,将下面定义的file变量赋值为所保存的存档码" << endl;
file = L"a,2021/08/31 13???13???56???;822,193,20,20,5,20,Pasli,World SU-21903,8869311,192,creative,211;100000,0,1,0;63:11:8*20/0/8*5/0/8*2/0/8/0*2/8*3/0*2/8*3/0/8/0*3/8*7/0*2/8/0/8/0/8/0/8*2/0*6/8/0/8/0*4/8/0/8/0*972/2/0*5/2/0*2/2/0/2*2/0*2/2*2/0*2/2*2/0/2/0*3/2/0/2/0/2*2/0/2/0*5/2*2/0/2*7/0/2*3/0/2*19/5*4/9/5*4/17/5/17/2/5/9/5*5/9/5*9/9/5*5/9/5*8/13/9/13/5*2/13*2/9/13*2/5*7/13/5*3/13*2/9/13*2/5*11/13*5/5*12/13*3/5*2870/#62:11:8*30/0/8/0/8/0/8*2/0*2/8*2/0/8*3/0/8*8/0/8/0/8/0*5/8/0*5/8*2/0*4/8/0/8/0/8/0*962/2/0/2/0*11/2/0/2*3/0*7/2/0*4/2*6/0*2/2/0*4/2/0*2/2/0/2*9/0*2/2*18/5*2/17/16/17/5*2/2*9/5*7/17/5*3/16/5/2*3/5*14/17/5*2929/#64:11:8*20/0/8/0/8*5/0/8*3/0/8*3/0*2/8*2/0/8*2/0/8/0/8*4/0/8*2/0*3/8*2/0*2/8*3/0*2/8/0/8/0*5/8*2/0*981/2/0/2/0*14/2/0*5/2*2/0*8/2/0*2/2*2/0/2*2/0*3/2/0/2*4/0/2/0*3/2/0*3/2/0/2/0*2/2*5/0*2/2*4/0/2*4/17/16/17/2*9/17/2*2/5*6/17/5*3/16/5*4/17/5*2929/#61:11:8*31/0*2/8/0/8*2/0*2/8/0/8*4/0*3/8*6/0/8*3/0*4/8/0*6/8*2/0*4/8/0/8/0*964/2/0/2/0*8/2/0*2/2/0/2*3/0*7/2/0*2/2/0/2*6/0/2/0*4/2*2/0*2/2/0/2*5/0/2*3/0/2*19/5*4/9/5*3/2*5/5*2/17/5*2/13*2/9/13*2/5/17/5*3/16/5*5/13*2/9/13*2/5*11/13*5/5*12/13*3/5*2906/#60:11:8*23/0/8*3/0/8*4/0/8/0/8/0/8/0*2/8*3/0/8*2/0*2/8*4/0/8*2/0/8/0/8*3/0/8*2/0*3/8/0*8/8/0*963/2/0/2*2/0*5/2/0*3/2/0*2/2*2/0*2/2*3/0*2/2*2/0*5/2/0*2/2*4/0*2/2*2/0/2/0/2/0/9/2*3/0/2*11/9/5*2/9/2*12/9/5*2/9/5*5/17/2*2/5/16/5*2/9/13*2/9/5*12/9/13*2/9/5*12/13*3/9/13*3/5*9/13*3/9/13*3/5*9/13*3/9/13*3/5*9/13*7/5*9/13*7/5*10/13*5/5*2842/#58:11:8*21/0/8*2/0/8*3/0/8*2/0*2/8*4/0/8*2/0*2/8*8/0/8/0/8/0*2/8*2/0*4/8/0*2/8/0/8/0*971/2/0*13/2*2/0/2/0/2/0*6/2*5/0/2/0/2/0*4/2/0/2/0/2*6/0/2/0*3/2/0/2*11/0/2/0/2*8/5*2/16/2*8/17/5*2/17/5*5/9/5*4/17/16/5*9/9/5*15/9/5*15/9/5*14/13/9/13*3/5*11/13/9/13*3/5*11/13/9/13*3/5*11/13*5/5*11/13*5/5*11/13*4/5*2812/#56:11:8*22/0/8*7/0/8/0/8/0/8/0*3/8*2/0*3/8*2/0/8*5/0*5/8/0*3/8/0*5/8/0*2/8/0*4/8/0*939/2/0*12/2/0/2*3/0*2/2/0*4/2/0/2*2/0/2*2/0/2*3/0*4/2*3/0*2/2*5/0*7/2/0*2/2*6/0/2*4/0/2/5/2*3/5*4/2*8/5/9/5*6/17/16/17/5/2*4/5/9/5*11/17/5*2/13/9/13/5*14/13/5*2942/#55:11:8*24/0*2/8/0/8*4/0/8*3/0/8*8/0/8*4/0/8*2/0*3/8/0/8/0*4/8/0*2/8*3/0*4/8/0*5/8/0*913/2/0/2*3/0*2/2/0*7/2/0*2/2/0/2/0/2/0/2/0*8/2/0/2*3/0/2/0/2/0/2/0/2*8/0*3/2/0*2/2*2/0*2/2*11/0/2*2/0/2/5/17*2/5*3/2*2/5/2*7/5*9/17/16/17/5*2/17/5*2993/#57:11:8*25/0/8*3/0*2/8/0/8*4/0/8*2/0/8/0*2/8/0/8/0/8*2/0/8*2/0*2/8*3/0/8/0/8/0*5/8*2/0*10/8/0*963/2*2/0/2*3/0*7/2/0*7/2*2/0*7/2/0/2*2/0*2/2*3/0/2/0*2/2*2/0/2/0/2*15/0/2*6/0/2*2/0/2*3/17/2*2/5/13*3/9/13*3/2*5/5*4/13*3/9/13*3/5/17/5*7/13*3/9/13*3/5*9/13*7/5*9/13*7/5*10/13*5/5*4/13*2/5*14/13*2/5*14/13*2/5*14/13*2/5*14/13*2/5*15/13/5*2800/#59:11:8*18/0/8*3/0/8/0*3/8*5/0/8*3/0*2/8*2/0*4/8*3/0/8*4/0*8/8/0*10/8*2/0*3/8/0*955/2/0*8/2*6/0*4/2/0/2/0/2*2/0*2/2*3/0/2/0/2*8/0*2/2*2/0*2/2/0/2*21/16/5*6/17/16/17/5*2/17/5/9/5*15/9/5*14/13/9/13*3/5*12/13/5/13*2/5*14/13*2/5*15/13/5*2896/#54:11:8*29/0*2/8/0/8*3/0/8*2/0/8/0/8/0*3/8*4/0/8*2/0*5/8/0*3/8*2/0*2/8*3/0*2/8/0*3/8/0*917/2/0/2*4/0*8/2*2/0*2/2/0/2/0/2/0/2/0*8/2/0/2*2/0/2/0*2/2/0/2*3/0/2*6/0*2/2/0/2*2/0/2*15/0/2*3/9/5*2/17/5*6/17/16/2*3/17/9/13*2/5*9/17/5*3/9/13*2/5*13/13*3/5*13/13*2/5*2958/#52:11:8*19/0/8*4/0*2/8*2/0/8*2/0*6/8/0*4/8*2/0*2/8*6/0/8*2/0/8*3/0*2/8/0*6/8/0*2/8/0*3/8/0*852/12*2/0*14/12/0*2/12*2/0*11/12*4/0*9/2/0*2/12*4/0*2/12/0/12*4/0*2/2/0/12*10/0/12/2*3/0/6*4/12*8/2/0/2/0/6*12/2*3/0/5*12/17/16/17/2/5*3040/#53:11:8*17/0/8*2/0/8*4/0/8/0/8/0/8*2/0/8*4/0*2/8*2/0*2/8/0*2/8/0/8/0/8/0*3/8*3/0*2/8*5/0/8*2/0*6/8/0*2/8/0*916/2*2/0*13/2*4/0*3/2*4/0/2/0*2/2*3/0/2*2/0/2*3/0/2*2/0*3/2*17/13*3/9/13*3/2*9/13*3/9/13*3/5*4/17/16/17/5*2/13*3/9/13*3/5*7/13*9/5*7/13*9/5*7/13*2/5/13*5/5*9/13/5*2944/#51:11:8*26/0/8*5/0*2/8*8/0/8/0/8/0*2/8*2/0*2/8/0*2/8/0*6/8/0*7/8/0*8/8/0*848/12*2/0*5/12/0/12/0/12*2/0*3/12*8/0*3/12*2/0*3/12*3/0/12*2/0*4/12/0/12/0*3/12*9/0/12*4/0/12*2/6*7/12*8/6*14/12*2/6*16/5*3056/#65:11:8*21/0/8*4/0/8*3/0/8/0/8*4/0/8*2/0*2/8/0*5/8*2/0/8/0/8*2/0*2/8/0/8/0*5/8/0/8/0*8/8*2/0*961/2/0*6/2/0*4/2/0/2/0*2/2/0/2/0*4/2*2/0/2*2/0*2/2*2/0/2/0*3/2*3/0/2*2/0/2*2/0*3/2/0*3/2*13/0/2/0/2*7/5/17/5*2/2*5/5*4/9/5/17/5*4/16/5/9/5/17/5*4/9/5*8/9/5*5/13/9/13/5*6/13/9/13/5*5/13/5*8/13/5*2909/#66:11:8*18/0/8*3/0/8/0*3/8*4/0*2/8*3/0*2/8*2/0*4/8*8/0*8/8/0*10/8*2/0*3/8/0*955/2/0*8/2*6/0*4/2/0/2/0/2*2/0*2/2*3/0/2/0/2*8/0*2/2*2/0*2/2/0/2*23/5*2/9/5*4/16/5*2/17/5/17/5/9/5*3/9/5*11/9/5*3/9/5*10/13/9/13*3/9/13*2/5*9/13*4/9/13*2/5*10/13*6/5*10/13/5/13*3/5*2892/#67:11:8*18/0/8*3/0/8*9/0/8*3/0*3/8*3/0*3/8/0*2/8*4/0*10/8*2/0*6/8/0*4/8/0*936/2/0*2/2/0*12/2/0/2*4/0*3/2/0*3/2*3/0/2*2/0/2/0*2/2/0/2/0/2*2/0*2/2*8/0/2*5/0*2/2*11/17/5/2*4/5*2/16/5*2/17/5/17/5*5/9/5*15/9/5*15/9/5*14/13/9/13*2/5*12/13/9/13*2/5*12/13*4/5*12/13*3/5*2893/#68:11:8*25/0/8/0/8/0/8*2/0/8*3/0/8*4/0*2/8/0*2/8/0/8*2/0/8*2/0*2/8/0*3/8*5/0*2/8*3/0*4/8/0*2/8/0*905/2/0*10/2/0/2*6/0*7/2/0*2/2/0/2*2/0/2*3/0/2/0*2/2/0*2/2/0/2*2/0/2*2/0/2*2/0*3/2*23/5*3/2*7/5/17/5*3/16/5*5/9/5*15/9/5*15/9/5*15/9/5*12/13*3/9/13*3/5*9/13*3/9/13*3/5*9/13*3/9/13*3/5*9/13*7/5*9/13*7/5*10/13*5/5*2866/#69:11:8*30/0/8/0/8/0/8*4/0/8/0/8/0*3/8*7/0*5/8/0*8/8/0*3/8/0*3/8/0*917/2/0*3/2*2/0*7/2/0/2/0/2*2/0/2/0/2/0/2/0*3/2*2/0*2/2/0/2*3/0/2/0*2/2/0/2*2/0/2*4/0/2*2/0*2/2/0/2*7/5/2*10/5/9/5*2/17/5*3/16/5*2/17/5/17/5/13*2/9/13*2/5*11/13*2/9/13*2/5*11/13*5/5*12/13*3/5*2961/#70:11:8*17/0/8*7/0*2/8*3/0/8/0/8*3/0/8*2/0/8/0/8/0/8*2/0*2/8/0/8/0/8/0/8/0/8*2/0/8/0*2/8/0*2/8*2/0*3/8/0*4/8/0*2/8/0*884/2/0*15/2*3/0/2*2/0*2/2*2/0/2/0*2/2*2/0/2*4/0*2/2*3/0/2*20/0/2*16/5*3/17/5/17/5*2/17/5*2/9/5*3/9/5*9/13*2/9/13/5*2/9/5*9/13*2/9/13/5/13/9/13/5*8/13*4/5*2/13/5*10/13*3/5*2976/#71:11:8*19/0/8*2/0/8*2/0*4/8*3/0*3/8*3/0/8*2/0/8/0*2/8/0/8*3/0*6/8*3/0/8*4/0/8*2/0/8/0*6/8/0*884/2/0*16/2*2/0*2/2/0*2/2/0*7/2/0/2*5/0*2/2/0/2/0*4/2*2/0/2*7/0/2/0*2/2*10/0/2/0*4/2*2/5/2*8/0/2*4/0/2/13/5/16/5*2/17/5/17/5/2*7/13/5*9/17/5*2/17/5/17/13/5*3007/#72:11:8*21/0*2/8*4/0/8*4/0/8*3/0/8/0*2/8*5/0/8*4/0/8/0*4/8*2/0*2/8/0*2/8/0*2/8*2/0*11/8/0*913/2/0*2/2*2/0*10/2/0*6/2*2/0/2/0/2*2/0*4/2*2/0/2*3/0*4/2/0/2*4/0/2/0/2*3/0*3/2*3/0*2/2*14/0/2/5/16/2/5/17/5/17/5*2/2*7/5*9/17/5*2/17/5/17/16/5*2992/#73:11:8*22/0/8*9/0/8*3/0*4/8*5/0*3/8*2/0*3/8/0/8*3/0*2/8/0*2/8/0*3/8/0*3/8/0/8/0*935/2/0*16/2/0/2/0*11/2/0/2/0/2*5/0*7/2*2/0/2/0/2*2/0*2/2/0*6/2*11/0*5/16/5*2/17/2*5/0*2/2/0/2/0/2/5*5/17/5/2*3/0/2/0/2/0*2/5*8/17/2*7/5*11/17/5/2*3/5*13/17/16/17/5*2928/#50:11:8*17/0*3/8*3/0/8/0*2/8*5/0/8/0/8/0/8/0*2/8/0/8*2/0/8*2/0/8/0/8/0*2/8/0/8*3/0*2/8/0/8/0*2/8/0*5/8*2/0*2/8/0*878/12/0*7/2/0*7/12/0*2/12/0*3/2*2/0/2/0/2*2/0*3/12/0/12*2/0*4/2/0/2/0/2/0*2/12*2/0/12*3/2*10/12*3/6*3/2*10/6*6/2/5/9/5*3/9/5*11/9/5/13*2/9/13*2/5*9/9/5/13*2/9/13*2/5*9/9/5/13*5/5*7/13*2/9/13*5/5*8/13*2/9/13*3/5*10/13*2/9/13*3/5*10/13*6/5*10/13*6/5*10/13*5/5*2907/#49:11:8*18/0*2/8*2/0/8*2/0*2/8/0/8/0/8/0*2/8*2/0*2/8*3/0/8*8/0*3/8/0*2/8*2/0/8*2/0*4/8/0*3/8/0*5/8/0/8/0*882/2/0*3/2/0*12/2*4/0*3/2/0*4/2/0*2/2*4/0*3/2/0*2/2/0*5/2*13/0*3/2*6/0/2*9/5*3/17/5/2*3/17/5/2*6/5*7/17/5*7/17/5*47/13/5*15/13/5*15/13/5*15/13/5*15/13/5*2912/#48:11:8*21/0/8/0*3/8*2/0/8*2/0*2/8/0/8*2/0/8/0/8/0/8*2/0/8*4/0/8/0/8*2/0/8/0*2/8/0*8/8/0*3/8*3/0/8/0*868/12*2/0/12/0/12*2/0*11/12*4/0*3/12/0*7/12/0/12*9/0*2/2/0/12*2/0/12*7/0/12*2/2*2/0/12*3/6*3/12*7/0/2/0/6*13/2*3/5*3056/#47:11:8*18/0/8*2/0/8*5/0*2/8*3/0*2/8/0*4/8*3/0/8/0/8/0*2/8*3/0*2/8*3/0/8/0/8/0*8/8/0*3/8/0*855/12/0*15/12/0/12/0*2/12/0*2/12/0*7/12*2/0*3/12*2/0/12*2/0/12/0/12/0/12*4/0/12/0*2/12*3/0/12/0/12*2/0/12*15/0/6/12*15/6*16/5*3056/#";
//在这里输入存档码
wcout << L"已经复制好了(按任意键继续)>>>";
PAUSE();
wcout << L"正在解析存档信息......" << endl;
if(readFile(file)){
//输出解析信息
wcout << L"存档包含以下信息:" << endl;
wcout << L"1.存档基本信息" << endl;
wcout << L" 存档名称:" << filename << endl;
wcout << L" 存档保存时间:"<< file_savetime << endl;
wcout << L" 存档大小:"<< getFileSizeUnit(file) << endl;
wcout << L"2.玩家与世界基本信息" << endl;
wcout << L" 玩家坐标:"<< stdpos(playerx,playery) << endl;
wcout << L" 玩家名称:"<< playername << endl;
wcout << L" 世界名称:" << worldname << endl;
wcout << L" 世界种子:"<< seed << endl;
wcout << L" 世界生成海平面:"<< sea_level << endl;
wcout << L"3.成就与设置信息" << endl;
wcout << L" 已获得成就数量:"<< getAchievementNum() << L"/"<world_chunk.size() << endl;
wcout << L"获取更详细信息请输入more,否则输入其他字符>>";
wstring input_filechoose;
wcin >> input_filechoose;
if(input_filechoose == L"more")
MoreFile();
wcout << L"请确认存档信息是否正确,是输入1,否输入0>>>";
bool input_filechoose2 = digitin();
if(input_filechoose2 == 0){
wcout << L"请按照Wiki相关文章检查存档信息,已自动停止运行游戏" << endl;
return 0;
}else{
wcout << L"存档读入完毕,即将开始游戏" << endl;
for(int i = 0;i<6;i++){
wcout << L".";
usleep(500000);
}
wcout << endl;
usleep(500000);
doclear();
return 1;
}
}else{
wcout << L"存档无效,重新生成新世界" << endl;
if(!skip){
wcout << language_initilize[lang];
wcin.ignore(1);
getline(wcin,worldname);
wcout << language_initilize[lang +3];
getline(wcin,playername);
doclear();
wcout << language_initilize[lang + 6] << playername << endl;
sleep(1);
wcout<> content;
if(content != 0)
seed = content;
wcout << L"海平面(输入default代表默认):";
content = 0;
wstring content1;
wcin >> content1;
if(content1 == L"default"){
sea_level = WorldYSize - WorldYSize/4;
doclear();
return 1;
}
content = strtoi(content1);
if(0 < content && content < WorldYSize)
sea_level = content;
else{
sea_level = WorldYSize - WorldYSize/4;
wcout << L"不合法的输入,设定为默认值" << WorldYSize - WorldYSize/4 << endl;
}
doclear();
return 1;
}
doclear();
return 1;
}else{
if(!skip){
wcout << language_initilize[lang];
wcin.ignore(1);
getline(wcin,worldname);
wcout << language_initilize[lang +3];
getline(wcin,playername);
doclear();
wcout << language_initilize[lang + 6] << playername << endl;
sleep(1);
wcout <> content;
if(content != 0)
seed = content;
wcout << L"海平面(输入default代表默认):";
content = 0;
wstring content1;
wcin >> content1;
if(content1 == L"default"){
sea_level = WorldYSize - WorldYSize/4;
doclear();
return 1;
}
content = strtoi(content1);
if(0 < content && content < WorldYSize)
sea_level = content;
else{
sea_level = WorldYSize - WorldYSize/4;
wcout << L"不合法的输入,设定为默认值" << WorldYSize - WorldYSize/4 << endl;
}
doclear();
return 1;
}
doclear();
return 1;
}
bool CheckSurvive(){
if(player_heart > 0)
return 1;
else
return 0;
}//检测玩家是否存活
void FallTest(){
if(gamemode != L"creative" && isthrough(player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery + 1)])){
player_world->world_chunk[pchunk_index].entity[index(topox(playerx),playery++)] = 0;
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)] = 1;
}
}//摔落检测
void UpdatePlayer(){
if(gamemode != L"creative"){
if(TestTag(tag_type[6],Block_List[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)]].tag)){
info_text.push(language_player[lang] + itos(player_oxygen));
player_oxygen--;
}
else{
if(player_oxygen < 20)
player_oxygen += 2;//缓慢恢复,杜绝持续呼吸
}
//氧气消耗
if(player_full > 0)
player_full -= 0.5;//优先消耗饱食度
else
player_hunger -= 0.5;//自然消耗饥饿值
if(player_hunger <= 0){
player_hunger = 0;
player_heart--;
if(!CheckSurvive()){
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)] = 0;
PlayerBorn(player_world,respawnx);
info_text.push(playername + language_kill[lang + 3]);
}//检测是否被饿死
}//饥饿值降到零时开始减少生命
if(player_oxygen < 0){
player_oxygen = 0;
player_heart -= 2;
if(!CheckSurvive()){
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)] = 0;
PlayerBorn(player_world,respawnx);
info_text.push(playername + language_kill[lang + 6]);
}//检测是否溺水
}//氧气值降到零时开始以每回合2点减少生命
if(!TestTag(L"through",Block_List[player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)]].tag)){
player_heart -= 20;
if(!CheckSurvive()){
player_world->world_chunk[pchunk_index].terrain[index(topox(playerx),playery)] = 0;
PlayerBorn(player_world,respawnx);
info_text.push(playername + L"因为奇妙的特性而卡在方块里无法动弹");
}
}
}
}
void UpdateUI(){
if(active_screen == L"main"){
UpdateScreen();
BriefInformationPrint();
}else if(active_screen == L"backpack"){
printBackpack();
BriefInformationPrint();
}
else if(active_screen == L"info")//调试信息
UniversalInformationPrint();
else{
active_screen = L"main";
UpdateScreen();
BriefInformationPrint();
}//其他界面
}
void surviveMod_init(){
}
//主函数
//如何切换至32位系统:
//将#define ll long long这句宏的定义改为#define ll int
//将const ll MAX_INT 的值设为2147483647
//将const ll positive_crash_line的值设为 2147483637
void p(wstring input,int interval = PRINT_SPEED,bool end = 1){
for(int i=0;i<=input.length()-1;i++){wcout< >tmp_getInput;
system("stty -raw");
if(end)
wcout << endl;
return tmp_getInput;
}
void printLOGO(){
wcout << text_yellow;
for(ll i = 0;i<7;i++){
for(ll j = 0;j<31;j++){
if(TitleScreen[i][j] != L' ')
wcout << L'█';
else
wcout << L" ";
if(TitleScreen[i][j] != L' ')
wcout << L'█';
else
wcout << L" ";
}
wcout << endl;
}
wcout << _CLEAREFFECT_STR;
}
int main(){
image logo(17,17);
logo.line(11,0,4,4,pixel{232,232,0});
logo.line(6,16,13,12,pixel{232,232,0});
logo.line(13,12,4,4,pixel{232,232,0});
logo.circle(8,8,4,pixel{192,255,255});
logo.circle(8,8,3,pixel{128,255,255});
pixel left_green{0,240,0},right_blue{0,120,240};
logo.line(1,4,1,9,left_green);
logo.line(2,7,2,10,left_green);
logo.edit(2,10,left_green);
logo.edit(3,10,left_green);
logo.line(3,11,5,11,left_green);
logo.line(4,12,7,12,left_green);
logo.line(10,4,13,4,right_blue);
logo.line(12,5,14,5,right_blue);
logo.line(13,6,15,6,right_blue);
logo.line(15,7,15,12,right_blue);
logo.line(14,6,14,9,right_blue);
logo.circle(8,8,2,pixel_cyan);
logo.show();
sleep(1);
doclear();
printLOGO();
print(L"系统检查:",printformat,false);
print(L"| -- CUIL库自检:",printformat,false);
print(L"| | -- std::locale支持UTF-8: "+ make_shapebool(SUPPORT_WCHAR_T),printformat,false);
print(L"| O -- CUIL版本符合要求: "+make_shapebool(CUIL_VERSIONINFO>=REQUIRE_CUIL_VERSION),printformat,false);
print(L"| -- Survive运行自检:",printformat,false);
print(L"| | -- 游戏版本:"+ GameLatestVersion,printformat,false);
print(L"| | -- 适用于在线版: "+ make_shapebool(online_xes),printformat,false);
print(L"| O -- CUIL已向上兼容",printformat,false);
print(L"| -- 运行环境自检:",printformat,false);
print(L"| | -- GNU编译器支持: "+ make_shapebool(ENVIRONMENT_GNUC_AVAILABLE),printformat,false);
print(L"| | -- GNU GCC版本符合要求: "+ make_shapebool(GNUC_COMPILER_VERSION_AVAILABLE),printformat,false);
print(L"| | -- 支持64位数据: "+ make_shapebool(MAX_INT ==LONG_LONG_MAX),printformat,false);
print(L"O O",printformat,false);
print(L"如果你认为这会影响你的游戏,请询问作者",printformat,false);
print(L"注:不接受非正式版本的询问",printformat,false);
print(L"我准备好开始游戏了! (0/1)>>> ",printformat,false,5,false);
if(!digitin()){
print(L"游戏退出");
exit(0);
}
shape_linerary_load(2.0,30,2,true,true,text_green+green);
print(L"欢迎来到Survive游戏!"+text_green+italic);
usleep(500000);
doclear();
seed = 8869311;
starttime = time(0);
bool skip_title = 0;
player_world = &Main;
nowvisit_UI = &backpack;
BiomeNoise = TerrainNoise = PerlinNoise();
item item_list[128];
gamemode = L"creative";
printLOGO();
wcout << L"版本:"<(split(L"中文,中文繁體,English"),L"语言")-1;
doclear();
printLOGO();
wcout << language_TitleScreen[lang + 3] << GameUpdateTime << endl;
wcout << language_TitleScreen[lang + 6] << GameLatestVersion << endl;
wcout << language_TitleScreen[lang + 9] << endl;
//wcout << language_TitleScreen[lang + 12] << endl;
//skip = digitin();
#if 0
if(!skip){
doclear();
sleep(2);
p(L"(附赠小说)");
p(L"“欢迎来到这个世界!”");
p(L"这是......哪?");
p(L"为什么?我明明在肝程序啊......");
p(L"等等,这不就是......我自己的游戏世界吗?");
p(L"不对,我自己编的游戏,为什么会有我面前这个跟个应急食品一样的人啊!");
p(L"“嗨!你醒了啊?前面弄醒你花了不少功夫呢!”");
p(L"“你是?”");
p(L"“哦对了,我叫Pasy,这个世界的管理员!”");
p(L"我赶忙回忆,才想起来自己确实将这东西上传到服务器去运行过。");
p(L"但这也解释不通啊......我一个作者到这还能理解,这个我压根见都没见过的“管理员”又是谁啊?!");
p(L"“还是比较陌生吧?”");
p(L"于是在她的带领下,我被迫听了她对“这个世界”的介绍。");
p(L"“我刚刚对这个世界做了调整,原先这个世界只有549,755,813,888个方块,现在有了2,361,183,241,434,822,606,848个方块啦!”");
p(L"“停停停停,多少?”");
p(L"“二十三垓六千一百一十八京三千二百四十一兆四千三百四十八亿两千两百六十万六千八百四十八个方块啊!”Pasy说道。");
p(L"“这可是地球表面积的4,734,114倍,Minecraft总方块数量的2562倍呢!”她还说道。(作者注:Survive可探索世界的大小为2^71个方块,不计负坐标可探索方块)");
p(L"天,我自己算都没算过,当初改用64位数据还觉得挺麻烦的......");
p(L"“这里64刻为一天,刚刚我们就过去了1刻哦!”");
p(L"“刻?我记得自己编的时候一刻等于一个更新回合啊?为什么会有恒定的时间单位?”");
p(L"“这里一刻大概多长?”");
p(L"“一——二——三——四!这是十六分之一刻啦!”");
p(L"一刻等于64个间,一个间是16秒,那么......一天是65536秒......还行。");
p(L"(作者注:Survive以64个回合为1天,玩家输入一句指令并使其运行即为一回合,命令组统一算作一回合)");
p(L"接着,Pasy“教”了我如何放置破坏方块。");
p(L"这个过程里,我见到了此生最难忘的事情——");
p(L"她手一指,空中就出现了一个窗口,她在输入了/set d 1 stone后,我面前就出现了一个石头方块。");
p(L"然后,输入/break d 1,那个石头就消失了。");
p(L"“你也来一下”Pasy手一挥,窗口就移到了我面前。");
p(L"作为这个游戏的作者,我决定和她坦白了。");
p(L"/gamerule color 1;/gamemode creative;/fill ~-10 ~-10 ~10 ~10 air;/set a 1 barrier;/say I'm the author of the game");
p(L"开启颜色,世界便为彩色的;我则变为了创造模式,周围441个方块瞬间被清空,在我左边,出现了一个泛着淡紫色荧光的屏障,那是世界的最后边界;然后,Pasy前面出现了一个小窗口,上面写着“我是游戏创作者”......");
p(L"“等等,你是?”Pasy显然十分惊讶。");
p(L"“游戏创作者ParseY Pasli.”");
p(L"“我也不知道怎么就到了这里,不过,感谢你让我看到了这世界的奇妙,谢谢,不知道从哪来的应急食品。”");
p(L"“等等等等”,Pasy突然想起了什么,“我是Pasy,你的......”");
p(L"“妹妹啊!哥!”");
p(L"此刻又是我觉得不可思议了。");
p(L"“我妹妹,不是,一年前,就,失踪了吗?”");
p(L"“你是......什么时候......来到这的......”");
p(L"“在这个世界481天了......”");
p(L"“是你?为什么......”");
p(L"“当初不知怎么看到了你的游戏,运行了下,然后就,突然,到了这里。”");
p(L"“我用了很长时间才搞懂这个世界的底层,然后,你,就来了......”");
p(L"“你找过出去的方法吗?总不可能永远在这个游戏世界里待着吧!”");
p(L"“翻了源码,已知唯一可行的方法是使世界崩溃,但我还不知道怎么做......”");
p(L"“只要到世界边界就好了!我们现在的坐标是多少?”");
p(L"“x = 4611686018427387904, y = 192”");
p(L"“当时我做64位改革时设定的坐标,现在看来......”");
p(L"“没事,哥哥,我们一起,传送到世界尽头!”");
p(L"“我们只要输入/tp ~4611686018427387904 ~就可以了!但......”我突然想起来,“这指令只作用于1个人......");
p(L"“我也不知道出去了一个人后会有什么后果......”");
p(L"“所以,妹妹,你先出去吧!”");
p(L"“不等等,哥!我们说好一起的......一起......”她哭了。");
p(L"“走!指令我帮你打好了!”冲上前去,我点了执行。");
p(L"“哥!!!”");
p(L"“再见了!”我目送着她在虚空中一点点消失,程序在将这个我设定的“意识”传送时,花了不少时间。");
p(L"“哥......”");
p(L"“其实我当初设定意识实体时,只定义了一个,就是玩家本身,你先来的,所以,我的到来,本身就是违反了世界规则的存在。”");
p(L"“那————”");
p(L"“结果很显然易见是我被抹除,永远消失,但,妹妹,在你出去后,记住你还有个哥哥......”");
p(L"“不要啊......”");
p(L"当最后一声呻吟消逝后,Pasy此刻就应该到达了世界边界的超限区域,当她的坐标因为溢出变为-1,192时,程序就会崩溃。");
p(L"再见了,我看着显示屏的地形图,世界开始从边界崩塌。");
p(L"世界长度慢慢下降到2^48,2^32,2^24......最后,我看向两边无垠的虚空,走向了世界的中央,静候世界完全崩塌的终焉。");
p(L"我感受着身体在一阵扰动后,慢慢消失。");
p(L"再见了,这个世界。我的意识于是陷入永久的静默。");
p(L"房间里,一群人正在讨论。");
p(L"“组长,你说过意识实体只能有一个,为什么在他加入时还要临时更改?”");
p(L"“在他进入前就已经申请上传意识了,毕竟是游戏的作者,还是得满足他。”");
p(L"“还有,能再说说为什么Pasy要进入这个游戏吗?她现在为何又退出了?”");
p(L"“一年前当Pasy攻读宇宙学时,她,作为震惊世界的虚无理论的发现者,第一个了解到了世界的本质,一个世界终归会趋于热寂,这样的未来她不肯接受,于是她放弃了现实生活,申请上传自己的意识,来到这个‘永不消失’的数字世界。”");
p(L"“但是你也知道,这个游戏是不会开到宇宙尽头的。”");
p(L"“她哥哥骗了她,否则她迟早会了结自己的生命,活着已经没有任何意义了,对她来说,如果改变不了宇宙的未来。”");
p(L"“她哥哥立马做了失忆手术,忘却这段痛苦的记忆。但是后来学界又修改了虚无理论,宇宙不会热寂,它因为不连续性永远会在稳定与不稳定间徘徊,熵值趋于0,但始终不等于0。”");
p(L"“我们立即通知了游戏世界里的她,但是她也出不来了,游戏规则只能从内部打破,当初我们为了世界的稳定设下了层层外部保护,现在却自己解不开那些东西。”");
p(L"“她于是与我们一起,寻找游戏世界的漏洞,直到现在,她发现了边界的不稳定性。”");
p(L"“我们一直对外宣称她已经失踪了,她本人之前也不想因此被外界所知,于是就连她的家人也不知道,直到最近,她的哥哥,信息学顶峰人物,也发现了信息本身趋于混乱,他也对世界不抱任何希望了”");
p(L"“作为游戏作者,他也希望进入这个世界看看,之前因为研究甚至没有亲自看过一眼这个虚拟世界,当那群头号玩家们搞出世界模拟器的时候。”");
p(L"“那群玩家对于这个游戏也是挺热爱的,当年在整个社会上引起了轰动呢,毕竟在没有任何外部支持的情况下,他们硬是做出了到现在都无法理解的意识算法!这一个成果就让他们每个人得了无数的奖项。”");
p(L"“人们也才认识到原来平日深居简出的肥宅们都能有改变世界的能力。”");
p(L"“这么看来,这个世界的创造者也是挺强大的。”");
p(L"“岂止是强大!你知道那人干了什么吗?他一个人,重做了量子计算机,效率是现行量子设备的至少2兆倍!这就是当年量子计算与登月设备的差别.....”");
p(L"“天才果然是孤独的,当他们已经了解透彻了这个世界后。”");
p(L"“她哥哥在进去前又做了一次失忆手术,说是忘却痛苦,游戏世界里发生了什么,我们还不清楚,只不过现在,Pasy的意识已经重新下载到她的躯体里,现在她再睡一会就能醒过来了,至于Pasli,我们还得再启动一次意识转移,那玩意的电费够我们喝一年西北风了......”");
p(L"欸?这是......哪?为什么,我不是早已随游戏崩溃了吗......");
p(L"“欢迎回来,Pasli!”一个声音说道。");
p(L"当我从妹妹口中得知真相的时候,又是震惊。");
p(L"“在游戏里时,为什么,要骗我......”");
p(L"“他们跟我说了你也要进来,我得装作不知道你,否则你迟早会知道以前的事,到时候你也会承受不住的。”");
p(L"“我不能没有你,哥哥。”");
sleep(1);
PAUSE();
doclear();
}
#endif
PAUSE();
doclear();
worldname = L"World SU-21903";
playername = L"Pasli";
if(WorldInit(1) == 0)
exit(0);
wcout << language_worldspawn[lang]<