Mercurial > mm7
annotate StorylineTextTable.cpp @ 1187:02e2a5c1ebc0
BspRernderer refactoring continued
author | Ritor1 |
---|---|
date | Fri, 07 Jun 2013 11:30:29 +0600 |
parents | 29a8defbad9e |
children | 75fafd8ced59 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
4 |
233 | 5 #include <stdlib.h> |
6 #include <string.h> | |
7 | |
8 #include "LOD.h" | |
9 #include "allocator.h" | |
10 #include "texts.h" | |
11 #include "StorylineTextTable.h" | |
12 | |
13 char *pHistoryTXT_Raw; | |
14 struct StorylineText *pStorylineText; | |
15 | |
16 //----- (00453E6D) -------------------------------------------------------- | |
17 void StorylineText::Initialize() | |
237 | 18 { |
19 | |
20 int i; | |
233 | 21 char* test_string; |
22 unsigned char c; | |
23 bool break_loop; | |
24 unsigned int temp_str_len; | |
25 char* tmp_pos; | |
26 int decode_step; | |
27 | |
237 | 28 if ( pHistoryTXT_Raw ) |
29 pAllocator->FreeChunk(pHistoryTXT_Raw); | |
30 pHistoryTXT_Raw = NULL; | |
31 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); | |
32 strtok(pHistoryTXT_Raw, "\r"); | |
33 | |
338 | 34 StoreLine[0].pText=nullptr; |
35 StoreLine[0].pPageTitle=nullptr; | |
36 StoreLine[0].uTime=0; | |
37 StoreLine[0].f_9=0; | |
38 StoreLine[0].f_A=0; | |
39 StoreLine[0].f_B=0; | |
40 | |
237 | 41 for (i=0;i<29;++i) |
233 | 42 { |
43 test_string = strtok(NULL, "\r") + 1; | |
44 break_loop = false; | |
45 decode_step=0; | |
46 do | |
47 { | |
48 c = *(unsigned char*)test_string; | |
49 temp_str_len = 0; | |
50 while((c!='\t')&&(c>0)) | |
51 { | |
52 ++temp_str_len; | |
53 c=test_string[temp_str_len]; | |
54 } | |
55 tmp_pos=test_string+temp_str_len; | |
56 if (*tmp_pos == 0) | |
57 break_loop = true; | |
58 *tmp_pos = 0; | |
59 if (temp_str_len) | |
60 { | |
61 switch (decode_step) | |
62 { | |
63 case 1: | |
329 | 64 StoreLine[i+1].pText=RemoveQuotes(test_string); |
233 | 65 break; |
66 case 2: | |
329 | 67 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit |
233 | 68 break; |
69 case 3: | |
329 | 70 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); |
233 | 71 break; |
72 } | |
73 } | |
74 else | |
75 { | |
237 | 76 break_loop = true; |
233 | 77 } |
78 ++decode_step; | |
79 test_string=tmp_pos+1; | |
80 } while ((decode_step<4)&&!break_loop); | |
81 } | |
237 | 82 } |