Skip to content

Commit 9412a61

Browse files
committed
王杨卢骆当时体,轻薄为文哂未休
file改名
1 parent ca661de commit 9412a61

23 files changed

+134
-137
lines changed

abc/abc.cpp

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
//一些辅助的功能
33
//一些常数的设置比较不合理,建议以调试模式手动执行
44

5-
#include "File.h"
5+
#include "GameUtil.h"
66
#include "GrpIdxFile.h"
7-
#include "TypesABC.h"
8-
#include "strfunc.h"
9-
#include "fmt1.h"
10-
#include "Save.h"
117
#include "OpenCCConverter.h"
128
#include "PotConv.h"
13-
#include "GameUtil.h"
9+
#include "Save.h"
10+
#include "TypesABC.h"
11+
#include "filefunc.h"
12+
#include "fmt1.h"
13+
#include "strfunc.h"
1414

1515
//转换二进制文件为文本
1616
void trans_bin_list(std::string in, std::string out)
1717
{
1818
std::vector<int16_t> leave_list;
19-
File::readFileToVector(in, leave_list);
19+
filefunc::readFileToVector(in, leave_list);
2020

2121
std::string s;
2222
for (auto a : leave_list)
@@ -34,9 +34,9 @@ void trans_fight_frame()
3434
std::string path = fmt1::format("C:/Users/sty/Desktop/ff/fight{:03}", i);
3535
std::vector<int16_t> frame;
3636
std::string filename = path + "/fightframe.ka";
37-
if (File::fileExist(filename))
37+
if (filefunc::fileExist(filename))
3838
{
39-
File::readFileToVector(path + "/fightframe.ka", frame);
39+
filefunc::readFileToVector(path + "/fightframe.ka", frame);
4040
std::string content;
4141
fmt1::print("role {}\n", i);
4242
for (int j = 0; j < 5; j++)
@@ -56,7 +56,7 @@ void trans_fight_frame()
5656
//最后一个参数:帧数需从之前存档格式获取
5757
int expandR(std::string idx, std::string grp, bool ranger = true, bool make_fightframe = false)
5858
{
59-
if (!File::fileExist(grp) || !File::fileExist(idx))
59+
if (!filefunc::fileExist(grp) || !filefunc::fileExist(idx))
6060
{
6161
return -1;
6262
}
@@ -91,7 +91,7 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
9191
std::vector<MagicSave1> magics_mem_;
9292
std::vector<ItemSave1> items_mem_;
9393
std::vector<SubMapInfoSave1> submap_infos_mem_;
94-
File::readDataToVector(rgrp1 + offset1[1], length1[1], roles_mem_);
94+
filefunc::readDataToVector(rgrp1 + offset1[1], length1[1], roles_mem_);
9595
if (make_fightframe)
9696
{
9797
for (auto it = roles_mem_.end() - 1; it >= roles_mem_.begin(); it--)
@@ -109,27 +109,27 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
109109
}
110110
if (!content.empty())
111111
{
112-
auto p = File::getFilePath(idx);
113-
p = File::getFilePath(p);
112+
auto p = filefunc::getParentPath(idx);
113+
p = filefunc::getParentPath(p);
114114
auto f = fmt1::format("{}/resource/fight/fight{:03}/fightframe.txt", p, r.HeadID);
115115
strfunc::writeStringToFile(content, f);
116116
}
117117
}
118118
if (!ranger) { return 1; }
119119
}
120120

121-
File::readDataToVector(rgrp1 + offset1[2], length1[2], items_mem_);
122-
File::readDataToVector(rgrp1 + offset1[3], length1[3], submap_infos_mem_);
123-
File::readDataToVector(rgrp1 + offset1[4], length1[4], magics_mem_);
121+
filefunc::readDataToVector(rgrp1 + offset1[2], length1[2], items_mem_);
122+
filefunc::readDataToVector(rgrp1 + offset1[3], length1[3], submap_infos_mem_);
123+
filefunc::readDataToVector(rgrp1 + offset1[4], length1[4], magics_mem_);
124124

125125
std::vector<RoleSave> roles;
126126
std::vector<MagicSave> magics;
127127
std::vector<ItemSave> items;
128128
std::vector<SubMapInfoSave> submap_infos;
129-
File::readDataToVector(rgrp2 + offset2[1], length2[1], roles);
130-
File::readDataToVector(rgrp2 + offset2[2], length2[2], items);
131-
File::readDataToVector(rgrp2 + offset2[3], length2[3], submap_infos);
132-
File::readDataToVector(rgrp2 + offset2[4], length2[4], magics);
129+
filefunc::readDataToVector(rgrp2 + offset2[1], length2[1], roles);
130+
filefunc::readDataToVector(rgrp2 + offset2[2], length2[2], items);
131+
filefunc::readDataToVector(rgrp2 + offset2[3], length2[3], submap_infos);
132+
filefunc::readDataToVector(rgrp2 + offset2[4], length2[4], magics);
133133
for (int i = 0; i < roles.size(); i++)
134134
{
135135
memset(roles[i].Name, 0, sizeof(roles[i].Name));
@@ -154,14 +154,14 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
154154
memset(submap_infos[i].Name, 0, sizeof(submap_infos[i].Name));
155155
memcpy(submap_infos[i].Name, submap_infos_mem_[i].Name, sizeof(submap_infos_mem_[i].Name));
156156
}
157-
File::writeVectorToData(rgrp2 + offset2[1], length2[1], roles, sizeof(RoleSave));
158-
File::writeVectorToData(rgrp2 + offset2[2], length2[2], items, sizeof(ItemSave));
159-
File::writeVectorToData(rgrp2 + offset2[3], length2[3], submap_infos, sizeof(SubMapInfoSave));
160-
File::writeVectorToData(rgrp2 + offset2[4], length2[4], magics, sizeof(MagicSave));
157+
filefunc::writeVectorToData(rgrp2 + offset2[1], length2[1], roles, sizeof(RoleSave));
158+
filefunc::writeVectorToData(rgrp2 + offset2[2], length2[2], items, sizeof(ItemSave));
159+
filefunc::writeVectorToData(rgrp2 + offset2[3], length2[3], submap_infos, sizeof(SubMapInfoSave));
160+
filefunc::writeVectorToData(rgrp2 + offset2[4], length2[4], magics, sizeof(MagicSave));
161161
}
162162
s32[1]--; //submap scene id
163-
File::writeFile(grp + "32", rgrp2, len * 2);
164-
File::writeFile(idx + "32", &offset2[1], 4 * offset2.size() - 4);
163+
filefunc::writeFile(grp + "32", rgrp2, len * 2);
164+
filefunc::writeFile(idx + "32", &offset2[1], 4 * offset2.size() - 4);
165165
//delete rgrp1;
166166
delete rgrp2;
167167

@@ -173,8 +173,8 @@ int expandR(std::string idx, std::string grp, bool ranger = true, bool make_figh
173173
void combine_ka(std::string in, std::string out)
174174
{
175175
std::vector<int16_t> in1, out1;
176-
File::readFileToVector(in, in1);
177-
File::readFileToVector(out, out1);
176+
filefunc::readFileToVector(in, in1);
177+
filefunc::readFileToVector(out, out1);
178178
std::string s;
179179
int i = 0;
180180
for (int i = 0; i < out1.size(); i += 2)
@@ -185,9 +185,8 @@ void combine_ka(std::string in, std::string out)
185185
out1[i + 1] = in1[i + 1];
186186
fmt1::print("{}, ", i / 2);
187187
}
188-
189188
}
190-
File::writeFile(out, out1.data(), out1.size() * 2);
189+
filefunc::writeFile(out, out1.data(), out1.size() * 2);
191190
//convert::writeStringToFile(s, out);
192191
}
193192

@@ -197,9 +196,9 @@ void check_fight_frame(std::string path, int repair = 0)
197196
for (int i = 0; i < 500; i++)
198197
{
199198
auto path1 = fmt1::format("{}/fight{:03}", path, i);
200-
if (File::pathExist(path1))
199+
if (filefunc::pathExist(path1))
201200
{
202-
auto files = File::getFilesInPath(path1, 0);
201+
auto files = filefunc::getFilesInPath(path1, 0);
203202
int count = files.size() - 3;
204203
int sum = 0;
205204
auto filename = path1 + "/fightframe.txt";
@@ -227,7 +226,7 @@ void check_fight_frame(std::string path, int repair = 0)
227226
//检查3号指令的最后3个参数正确性
228227
void check_script(std::string path)
229228
{
230-
auto files = File::getFilesInPath(path, 0);
229+
auto files = filefunc::getFilesInPath(path, 0);
231230
for (auto& f : files)
232231
{
233232
bool repair = false;
@@ -279,7 +278,7 @@ void check_script(std::string path)
279278
//重新产生头像
280279
void make_heads(std::string path)
281280
{
282-
auto h_lib = File::getFilesInPath(path);
281+
auto h_lib = filefunc::getFilesInPath(path);
283282
Save::getInstance()->loadR(0);
284283
for (auto r : Save::getInstance()->getRoles())
285284
{
@@ -300,7 +299,6 @@ void make_heads(std::string path)
300299
}
301300
}
302301
}
303-
304302
}
305303

306304
int main()

abc/abc.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ClCompile Include="..\src\Save.cpp" />
1919
<ClCompile Include="..\src\Types.cpp" />
2020
<ClCompile Include="abc.cpp" />
21-
<ClCompile Include="..\mlcc\File.cpp" />
21+
<ClCompile Include="..\mlcc\filefunc.cpp" />
2222
<ClCompile Include="..\mlcc\strfunc.cpp" />
2323
<ClCompile Include="..\src\GrpIdxFile.cpp" />
2424
</ItemGroup>

abc/abc.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ClCompile Include="..\mlcc\strfunc.cpp">
1111
<Filter>sources</Filter>
1212
</ClCompile>
13-
<ClCompile Include="..\mlcc\File.cpp">
13+
<ClCompile Include="..\mlcc\filefunc.cpp">
1414
<Filter>sources</Filter>
1515
</ClCompile>
1616
<ClCompile Include="..\src\NewSave.cpp">

mlcc

src/Audio.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Audio.h"
2-
#include "File.h"
3-
#include "fmt1.h"
42
#include "GameUtil.h"
3+
#include "filefunc.h"
4+
#include "fmt1.h"
55

66
Audio::Audio()
77
{
@@ -63,7 +63,7 @@ void Audio::init()
6363
for (int i = 0; i < 100; i++)
6464
{
6565
music_path = fmt1::format(GameUtil::PATH() + "music/{}.mid", i);
66-
if (File::fileExist(music_path))
66+
if (filefunc::fileExist(music_path))
6767
{
6868
#ifndef USE_SDL_MIXER_AUDIO
6969
auto m = BASS_MIDI_StreamCreateFile(false, music_path.c_str(), 0, 0, 0, 0);

src/BattleMap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "BattleMap.h"
2-
#include "File.h"
32
#include "GameUtil.h"
43
#include "GrpIdxFile.h"
54
#include "PotConv.h"
5+
#include "filefunc.h"
66

77
BattleMap::BattleMap()
88
{
9-
File::readFileToVector(GameUtil::PATH() + "resource/war.sta", battle_infos_);
9+
filefunc::readFileToVector(GameUtil::PATH() + "resource/war.sta", battle_infos_);
1010

1111
//地图的长度不一致,故换方法读取
1212
std::vector<int> offset, length;

src/BattleNetwork.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#ifdef WITH_NETWORK
44
#include "DrawableOnCall.h"
5-
#include "File.h"
5+
#include "filefunc.h"
66
#include "Font.h"
77
#include "GameUtil.h"
88
#include "Save.h"

src/BattleScene.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "BattleNetwork.h" //必须在Audio之前
44
#include "DrawableOnCall.h"
55
#include "Event.h"
6-
#include "File.h"
76
#include "Font.h"
87
#include "GameUtil.h"
98
#include "MainScene.h"
@@ -623,16 +622,16 @@ void BattleScene::sortRoles()
623622
if (semi_real_ == 0)
624623
{
625624
std::sort(battle_roles_.begin(), battle_roles_.end(), [](Role* r1, Role* r2)
626-
{
627-
return std::make_tuple(r1->Speed, r1->ID, r1->X(), r1->Y()) > std::make_tuple(r2->Speed, r2->ID, r2->X(), r2->Y());
628-
});
625+
{
626+
return std::make_tuple(r1->Speed, r1->ID, r1->X(), r1->Y()) > std::make_tuple(r2->Speed, r2->ID, r2->X(), r2->Y());
627+
});
629628
}
630629
else
631630
{
632631
std::sort(battle_roles_.begin(), battle_roles_.end(), [](Role* r1, Role* r2)
633-
{
634-
return std::make_tuple(r1->Progress, r1->ID, r1->X(), r2->Y()) > std::make_tuple(r2->Progress, r2->ID, r2->X(), r2->Y());
635-
});
632+
{
633+
return std::make_tuple(r1->Progress, r1->ID, r1->X(), r2->Y()) > std::make_tuple(r2->Progress, r2->ID, r2->X(), r2->Y());
634+
});
636635
}
637636
}
638637

@@ -2095,9 +2094,9 @@ void BattleScene::receiveAction(Role* r)
20952094
};
20962095
// 打开后既开始获取数据
20972096
waitThis->setEntrance([this, &action, exit]()
2098-
{
2099-
network_->getOpponentAction(action, exit);
2100-
});
2097+
{
2098+
network_->getOpponentAction(action, exit);
2099+
});
21012100
waitThis->run();
21022101
// 这里返回后,就已经获得action
21032102
action.print();

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ link_directories(. ../lib)
1212
file(GLOB SRC_LIST
1313
./*.cpp
1414
../mlcc/strfunc.cpp
15-
../mlcc/File.cpp
15+
../mlcc/filefunc.cpp
1616
../mlcc/PotConv.cpp
1717
../others/Hanz2Piny.cpp
1818
)

src/Event.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "Audio.h"
33
#include "BattleScene.h"
44
#include "BattleSceneHades.h"
5-
#include "File.h"
65
#include "Font.h"
76
#include "GameUtil.h"
87
#include "GrpIdxFile.h"
@@ -14,6 +13,7 @@
1413
#include "SubScene.h"
1514
#include "Talk.h"
1615
#include "UIShop.h"
16+
#include "filefunc.h"
1717
#include "strfunc.h"
1818

1919
Event::Event()
@@ -122,7 +122,7 @@ bool Event::callEvent(int event_id, RunNode* subscene, int supmap_id, int item_i
122122
if (use_script_)
123123
{
124124
auto script = fmt1::format(GameUtil::PATH() + "script/event/ka{}.lua", event_id);
125-
if (!File::fileExist(script))
125+
if (!filefunc::fileExist(script))
126126
{
127127
script = fmt1::format(GameUtil::PATH() + "script/oldevent/oldevent_{}.lua", event_id);
128128
}
@@ -1014,11 +1014,7 @@ void Event::breakStoneGate()
10141014
//武林大会
10151015
void Event::fightForTop()
10161016
{
1017-
std::vector<int> heads =
1018-
{
1019-
8, 21, 23, 31, 32, 43, 7, 11, 14, 20, 33, 34, 10, 12, 19,
1020-
22, 56, 68, 13, 55, 62, 67, 70, 71, 26, 57, 60, 64, 3, 69
1021-
};
1017+
std::vector<int> heads{ 8, 21, 23, 31, 32, 43, 7, 11, 14, 20, 33, 34, 10, 12, 19, 22, 56, 68, 13, 55, 62, 67, 70, 71, 26, 57, 60, 64, 3, 69 };
10221018

10231019
for (int i = 0; i < 15; i++)
10241020
{
@@ -1157,7 +1153,7 @@ void Event::clearTalkBox()
11571153
void Event::instruct_50e(int code, int e1, int e2, int e3, int e4, int e5, int e6, int* code_ptr, int* code_value)
11581154
{
11591155
int index = 0, len = 0, offset = 0;
1160-
char* char_ptr = nullptr, * char_ptr1 = nullptr;
1156+
char *char_ptr = nullptr, *char_ptr1 = nullptr;
11611157
int* save_int_ptr = nullptr;
11621158
int i1 = 0;
11631159
int i2 = 0;

0 commit comments

Comments
 (0)