annotate StorylineTextTable.cpp @ 1528:270627b54ed4

Fix Vec3<T>::Normalize_float().
author yoctozepto
date Fri, 06 Sep 2013 09:29:17 +0200
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
0df4136b6aac store_line
Gloval
parents:
diff changeset
5 #include <stdlib.h>
0df4136b6aac store_line
Gloval
parents:
diff changeset
6 #include <string.h>
0df4136b6aac store_line
Gloval
parents:
diff changeset
7
0df4136b6aac store_line
Gloval
parents:
diff changeset
8 #include "LOD.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
9 #include "allocator.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
10 #include "texts.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
11 #include "StorylineTextTable.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
12
0df4136b6aac store_line
Gloval
parents:
diff changeset
13 char *pHistoryTXT_Raw;
0df4136b6aac store_line
Gloval
parents:
diff changeset
14 struct StorylineText *pStorylineText;
0df4136b6aac store_line
Gloval
parents:
diff changeset
15
0df4136b6aac store_line
Gloval
parents:
diff changeset
16 //----- (00453E6D) --------------------------------------------------------
0df4136b6aac store_line
Gloval
parents:
diff changeset
17 void StorylineText::Initialize()
237
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
18 {
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
19
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
20 int i;
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
21 char* test_string;
0df4136b6aac store_line
Gloval
parents:
diff changeset
22 unsigned char c;
0df4136b6aac store_line
Gloval
parents:
diff changeset
23 bool break_loop;
0df4136b6aac store_line
Gloval
parents:
diff changeset
24 unsigned int temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
25 char* tmp_pos;
0df4136b6aac store_line
Gloval
parents:
diff changeset
26 int decode_step;
0df4136b6aac store_line
Gloval
parents:
diff changeset
27
237
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
28 if ( pHistoryTXT_Raw )
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
29 pAllocator->FreeChunk(pHistoryTXT_Raw);
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
30 pHistoryTXT_Raw = NULL;
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
31 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
32 strtok(pHistoryTXT_Raw, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
33
338
1c681ad45653 history changes
zipi
parents: 329
diff changeset
34 StoreLine[0].pText=nullptr;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
35 StoreLine[0].pPageTitle=nullptr;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
36 StoreLine[0].uTime=0;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
37 StoreLine[0].f_9=0;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
38 StoreLine[0].f_A=0;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
39 StoreLine[0].f_B=0;
1c681ad45653 history changes
zipi
parents: 329
diff changeset
40
237
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
41 for (i=0;i<29;++i)
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
42 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
43 test_string = strtok(NULL, "\r") + 1;
0df4136b6aac store_line
Gloval
parents:
diff changeset
44 break_loop = false;
0df4136b6aac store_line
Gloval
parents:
diff changeset
45 decode_step=0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
46 do
0df4136b6aac store_line
Gloval
parents:
diff changeset
47 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
48 c = *(unsigned char*)test_string;
0df4136b6aac store_line
Gloval
parents:
diff changeset
49 temp_str_len = 0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
50 while((c!='\t')&&(c>0))
0df4136b6aac store_line
Gloval
parents:
diff changeset
51 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
52 ++temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
53 c=test_string[temp_str_len];
0df4136b6aac store_line
Gloval
parents:
diff changeset
54 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
55 tmp_pos=test_string+temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
56 if (*tmp_pos == 0)
0df4136b6aac store_line
Gloval
parents:
diff changeset
57 break_loop = true;
0df4136b6aac store_line
Gloval
parents:
diff changeset
58 *tmp_pos = 0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
59 if (temp_str_len)
0df4136b6aac store_line
Gloval
parents:
diff changeset
60 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
61 switch (decode_step)
0df4136b6aac store_line
Gloval
parents:
diff changeset
62 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
63 case 1:
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 313
diff changeset
64 StoreLine[i+1].pText=RemoveQuotes(test_string);
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
65 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
66 case 2:
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 313
diff changeset
67 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
68 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
69 case 3:
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 313
diff changeset
70 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string);
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
71 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
72 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
73 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
74 else
0df4136b6aac store_line
Gloval
parents:
diff changeset
75 {
237
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
76 break_loop = true;
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
77 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
78 ++decode_step;
0df4136b6aac store_line
Gloval
parents:
diff changeset
79 test_string=tmp_pos+1;
0df4136b6aac store_line
Gloval
parents:
diff changeset
80 } while ((decode_step<4)&&!break_loop);
0df4136b6aac store_line
Gloval
parents:
diff changeset
81 }
237
2799737f8a74 more text parsers refactor
Gloval
parents: 233
diff changeset
82 }