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