annotate StorylineTextTable.cpp @ 235:0d9d30a1efc9

debugbreak removed
author zipi
date Sun, 17 Feb 2013 16:55:44 +0100
parents 0df4136b6aac
children 2799737f8a74
rev   line source
233
0df4136b6aac store_line
Gloval
parents:
diff changeset
1 #include <stdlib.h>
0df4136b6aac store_line
Gloval
parents:
diff changeset
2 #include <string.h>
0df4136b6aac store_line
Gloval
parents:
diff changeset
3
0df4136b6aac store_line
Gloval
parents:
diff changeset
4 #include "LOD.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
5 #include "allocator.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
6 #include "texts.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
7 #include "StorylineTextTable.h"
0df4136b6aac store_line
Gloval
parents:
diff changeset
8
0df4136b6aac store_line
Gloval
parents:
diff changeset
9 char *pHistoryTXT_Raw;
0df4136b6aac store_line
Gloval
parents:
diff changeset
10 struct StorylineText *pStorylineText;
0df4136b6aac store_line
Gloval
parents:
diff changeset
11
0df4136b6aac store_line
Gloval
parents:
diff changeset
12 //----- (00453E6D) --------------------------------------------------------
0df4136b6aac store_line
Gloval
parents:
diff changeset
13 void StorylineText::Initialize()
0df4136b6aac store_line
Gloval
parents:
diff changeset
14 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
15 char *v1; // ebx@1
0df4136b6aac store_line
Gloval
parents:
diff changeset
16 StorylineText *v2; // esi@1
0df4136b6aac store_line
Gloval
parents:
diff changeset
17 char *v3; // ecx@4
0df4136b6aac store_line
Gloval
parents:
diff changeset
18 char v4; // dl@5
0df4136b6aac store_line
Gloval
parents:
diff changeset
19 char *v5; // eax@5
0df4136b6aac store_line
Gloval
parents:
diff changeset
20 int v6; // esi@9
0df4136b6aac store_line
Gloval
parents:
diff changeset
21 int v7; // [sp+Ch] [bp-10h]@3
0df4136b6aac store_line
Gloval
parents:
diff changeset
22 int v8; // [sp+10h] [bp-Ch]@4
0df4136b6aac store_line
Gloval
parents:
diff changeset
23 char *v9; // [sp+14h] [bp-8h]@4
0df4136b6aac store_line
Gloval
parents:
diff changeset
24 int Str; // [sp+18h] [bp-4h]@3
0df4136b6aac store_line
Gloval
parents:
diff changeset
25 int i,j;
0df4136b6aac store_line
Gloval
parents:
diff changeset
26 char* test_string;
0df4136b6aac store_line
Gloval
parents:
diff changeset
27 unsigned char c;
0df4136b6aac store_line
Gloval
parents:
diff changeset
28 bool break_loop;
0df4136b6aac store_line
Gloval
parents:
diff changeset
29 unsigned int temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
30 char* tmp_pos;
0df4136b6aac store_line
Gloval
parents:
diff changeset
31 int decode_step;
0df4136b6aac store_line
Gloval
parents:
diff changeset
32 v1 = 0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
33 v2 = this;
0df4136b6aac store_line
Gloval
parents:
diff changeset
34 if ( pHistoryTXT_Raw )
0df4136b6aac store_line
Gloval
parents:
diff changeset
35 pAllocator->FreeChunk(pHistoryTXT_Raw);
0df4136b6aac store_line
Gloval
parents:
diff changeset
36 pHistoryTXT_Raw = NULL;
0df4136b6aac store_line
Gloval
parents:
diff changeset
37 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
0df4136b6aac store_line
Gloval
parents:
diff changeset
38 strtok(pHistoryTXT_Raw, "\r");
0df4136b6aac store_line
Gloval
parents:
diff changeset
39
0df4136b6aac store_line
Gloval
parents:
diff changeset
40 for (i=0;i<29;++i)
0df4136b6aac store_line
Gloval
parents:
diff changeset
41 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
42 test_string = strtok(NULL, "\r") + 1;
0df4136b6aac store_line
Gloval
parents:
diff changeset
43 break_loop = false;
0df4136b6aac store_line
Gloval
parents:
diff changeset
44 decode_step=0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
45 do
0df4136b6aac store_line
Gloval
parents:
diff changeset
46 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
47 c = *(unsigned char*)test_string;
0df4136b6aac store_line
Gloval
parents:
diff changeset
48 temp_str_len = 0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
49 while((c!='\t')&&(c>0))
0df4136b6aac store_line
Gloval
parents:
diff changeset
50 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
51 ++temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
52 c=test_string[temp_str_len];
0df4136b6aac store_line
Gloval
parents:
diff changeset
53 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
54 tmp_pos=test_string+temp_str_len;
0df4136b6aac store_line
Gloval
parents:
diff changeset
55 if (*tmp_pos == 0)
0df4136b6aac store_line
Gloval
parents:
diff changeset
56 break_loop = true;
0df4136b6aac store_line
Gloval
parents:
diff changeset
57 *tmp_pos = 0;
0df4136b6aac store_line
Gloval
parents:
diff changeset
58 if (temp_str_len)
0df4136b6aac store_line
Gloval
parents:
diff changeset
59 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
60 switch (decode_step)
0df4136b6aac store_line
Gloval
parents:
diff changeset
61 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
62 case 1:
0df4136b6aac store_line
Gloval
parents:
diff changeset
63 StoreLine[i+1].pText=RemoveQuotes(test_string);
0df4136b6aac store_line
Gloval
parents:
diff changeset
64 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
65 case 2:
0df4136b6aac store_line
Gloval
parents:
diff changeset
66 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit
0df4136b6aac store_line
Gloval
parents:
diff changeset
67 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
68 case 3:
0df4136b6aac store_line
Gloval
parents:
diff changeset
69 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string);
0df4136b6aac store_line
Gloval
parents:
diff changeset
70 break;
0df4136b6aac store_line
Gloval
parents:
diff changeset
71 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
72 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
73 else
0df4136b6aac store_line
Gloval
parents:
diff changeset
74 {
0df4136b6aac store_line
Gloval
parents:
diff changeset
75 break_loop = true;
0df4136b6aac store_line
Gloval
parents:
diff changeset
76 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
77 ++decode_step;
0df4136b6aac store_line
Gloval
parents:
diff changeset
78 test_string=tmp_pos+1;
0df4136b6aac store_line
Gloval
parents:
diff changeset
79 } while ((decode_step<4)&&!break_loop);
0df4136b6aac store_line
Gloval
parents:
diff changeset
80 }
0df4136b6aac store_line
Gloval
parents:
diff changeset
81 }