World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
StorylineTextTable.cpp
См. документацию.
2 
3 #include <vector>
4 
5 #include "../LOD.h"
6 
9 
10 extern std::vector<char *> Tokenize(char *input, const char separator);
11 
12 //----- (00453E6D) --------------------------------------------------------
14  char *test_string;
15 
16  free(pHistoryTXT_Raw);
17  pHistoryTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("history.txt");
18  strtok(pHistoryTXT_Raw, "\r");
19 
20  StoreLine[0].pText = nullptr;
21  StoreLine[0].pPageTitle = nullptr;
22  StoreLine[0].uTime = 0;
23  StoreLine[0].f_9 = 0;
24  StoreLine[0].f_A = 0;
25  StoreLine[0].f_B = 0;
26 
27  for (int i = 0; i < 28; ++i) {
28  test_string = strtok(NULL, "\r") + 1;
29  auto tokens = Tokenize(test_string, '\t');
30 
31  StoreLine[i + 1].pText = RemoveQuotes(tokens[1]);
32  StoreLine[i + 1].uTime =
33  atoi(tokens[2]); // strange but in text here string not digit
34  StoreLine[i + 1].pPageTitle = RemoveQuotes(tokens[3]);
35  }
36 }
RemoveQuotes
char * RemoveQuotes(char *str)
Definition: Strings.h:17
Tokenize
std::vector< char * > Tokenize(char *input, const char separator)
Definition: Strings.cpp:30
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
StorylineRecord::pText
char * pText
Definition: StorylineTextTable.h:7
input
GLenum GLenum GLenum input
Definition: SDL_opengl_glext.h:9377
StorylineText
Definition: StorylineTextTable.h:18
StorylineRecord::f_A
char f_A
Definition: StorylineTextTable.h:11
StorylineRecord::f_B
char f_B
Definition: StorylineTextTable.h:12
StorylineRecord::pPageTitle
char * pPageTitle
Definition: StorylineTextTable.h:8
StorylineText::Initialize
void Initialize()
Definition: StorylineTextTable.cpp:13
StorylineText::StoreLine
StorylineRecord StoreLine[29]
Definition: StorylineTextTable.h:20
pStorylineText
struct StorylineText * pStorylineText
Definition: StorylineTextTable.cpp:8
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
pHistoryTXT_Raw
char * pHistoryTXT_Raw
Definition: StorylineTextTable.cpp:7
StorylineRecord::f_9
char f_9
Definition: StorylineTextTable.h:10
StorylineRecord::uTime
uint8_t uTime
Definition: StorylineTextTable.h:9
StorylineTextTable.h