233
|
1 #include <stdlib.h>
|
|
2 #include <string.h>
|
|
3
|
|
4 #include "LOD.h"
|
|
5 #include "texts.h"
|
|
6 #include "StorylineTextTable.h"
|
|
7
|
|
8 char *pHistoryTXT_Raw;
|
|
9 struct StorylineText *pStorylineText;
|
|
10
|
|
11 //----- (00453E6D) --------------------------------------------------------
|
|
12 void StorylineText::Initialize()
|
237
|
13 {
|
|
14
|
|
15 int i;
|
233
|
16 char* test_string;
|
|
17 unsigned char c;
|
|
18 bool break_loop;
|
|
19 unsigned int temp_str_len;
|
|
20 char* tmp_pos;
|
|
21 int decode_step;
|
|
22
|
237
|
23 if ( pHistoryTXT_Raw )
|
1583
|
24 free(pHistoryTXT_Raw);
|
237
|
25 pHistoryTXT_Raw = NULL;
|
|
26 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
|
|
27 strtok(pHistoryTXT_Raw, "\r");
|
|
28
|
338
|
29 StoreLine[0].pText=nullptr;
|
|
30 StoreLine[0].pPageTitle=nullptr;
|
|
31 StoreLine[0].uTime=0;
|
|
32 StoreLine[0].f_9=0;
|
|
33 StoreLine[0].f_A=0;
|
|
34 StoreLine[0].f_B=0;
|
|
35
|
237
|
36 for (i=0;i<29;++i)
|
233
|
37 {
|
|
38 test_string = strtok(NULL, "\r") + 1;
|
|
39 break_loop = false;
|
|
40 decode_step=0;
|
|
41 do
|
|
42 {
|
|
43 c = *(unsigned char*)test_string;
|
|
44 temp_str_len = 0;
|
|
45 while((c!='\t')&&(c>0))
|
|
46 {
|
|
47 ++temp_str_len;
|
|
48 c=test_string[temp_str_len];
|
|
49 }
|
|
50 tmp_pos=test_string+temp_str_len;
|
|
51 if (*tmp_pos == 0)
|
|
52 break_loop = true;
|
|
53 *tmp_pos = 0;
|
|
54 if (temp_str_len)
|
|
55 {
|
|
56 switch (decode_step)
|
|
57 {
|
|
58 case 1:
|
329
|
59 StoreLine[i+1].pText=RemoveQuotes(test_string);
|
233
|
60 break;
|
|
61 case 2:
|
329
|
62 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit
|
233
|
63 break;
|
|
64 case 3:
|
329
|
65 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string);
|
233
|
66 break;
|
|
67 }
|
|
68 }
|
|
69 else
|
|
70 {
|
237
|
71 break_loop = true;
|
233
|
72 }
|
|
73 ++decode_step;
|
|
74 test_string=tmp_pos+1;
|
|
75 } while ((decode_step<4)&&!break_loop);
|
|
76 }
|
237
|
77 } |