Mercurial > mm7
annotate StorylineTextTable.cpp @ 2277:b9adf4f414f6
submenu Other
author | Ritor1 |
---|---|
date | Fri, 14 Mar 2014 13:58:51 +0600 |
parents | aff7a7b072b7 |
children | 53d4e8539ca1 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2153
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
233 | 2 #include <stdlib.h> |
3 #include <string.h> | |
4 | |
5 #include "LOD.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 ) |
1583 | 25 free(pHistoryTXT_Raw); |
237 | 26 pHistoryTXT_Raw = NULL; |
27 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); | |
28 strtok(pHistoryTXT_Raw, "\r"); | |
29 | |
338 | 30 StoreLine[0].pText=nullptr; |
31 StoreLine[0].pPageTitle=nullptr; | |
32 StoreLine[0].uTime=0; | |
33 StoreLine[0].f_9=0; | |
34 StoreLine[0].f_A=0; | |
35 StoreLine[0].f_B=0; | |
36 | |
237 | 37 for (i=0;i<29;++i) |
233 | 38 { |
39 test_string = strtok(NULL, "\r") + 1; | |
40 break_loop = false; | |
41 decode_step=0; | |
42 do | |
43 { | |
44 c = *(unsigned char*)test_string; | |
45 temp_str_len = 0; | |
46 while((c!='\t')&&(c>0)) | |
47 { | |
48 ++temp_str_len; | |
49 c=test_string[temp_str_len]; | |
50 } | |
51 tmp_pos=test_string+temp_str_len; | |
52 if (*tmp_pos == 0) | |
53 break_loop = true; | |
54 *tmp_pos = 0; | |
55 if (temp_str_len) | |
56 { | |
57 switch (decode_step) | |
58 { | |
59 case 1: | |
329 | 60 StoreLine[i+1].pText=RemoveQuotes(test_string); |
233 | 61 break; |
62 case 2: | |
329 | 63 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit |
233 | 64 break; |
65 case 3: | |
329 | 66 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); |
233 | 67 break; |
68 } | |
69 } | |
70 else | |
71 { | |
237 | 72 break_loop = true; |
233 | 73 } |
74 ++decode_step; | |
75 test_string=tmp_pos+1; | |
76 } while ((decode_step<4)&&!break_loop); | |
77 } | |
237 | 78 } |