annotate MapInfo.cpp @ 2369:bddcaf5d5db2

removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
author Grumpy7
date Mon, 12 May 2014 01:50:32 +0200
parents ddb803517a48
children f4af3b203f65
rev   line source
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
1 #include "MapInfo.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
2 #include "LOD.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
3 #include "ErrorHandling.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
4 #include "mm7_data.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
5 #include "texts.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
6 #include "ObjectList.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
7 #include "SpriteObject.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
8 #include "Indoor.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
9 #include "mm7_unsorted_subs.h"
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
10
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
11
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
12 //----- (00453F62) --------------------------------------------------------
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
13 void MapStats::Initialize()
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
14 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
15 char work_str[32]; // [sp+Ch] [bp-34h]@3
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
16 int work_str_pos;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
17 int work_str_len;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
18 int i;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
19 char* test_string;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
20 unsigned char c;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
21 bool break_loop;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
22 unsigned int temp_str_len;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
23 char* tmp_pos;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
24 int decode_step;
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2259
diff changeset
25 // int item_counter;
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
26
2369
bddcaf5d5db2 removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents: 2334
diff changeset
27 free(pMapStatsTXT_Raw);
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
28 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
29 strtok(pMapStatsTXT_Raw, "\r");
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
30 strtok(NULL, "\r");
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
31 strtok(NULL, "\r");
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
32
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
33 for (i=1; i<77; ++i)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
34 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
35 test_string = strtok(NULL, "\r") + 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
36 break_loop = false;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
37 decode_step=0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
38 do
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
39 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
40 c = *(unsigned char*)test_string;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
41 temp_str_len = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
42 while((c!='\t')&&(c>0))
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
43 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
44 ++temp_str_len;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
45 c=test_string[temp_str_len];
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
46 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
47 tmp_pos=test_string+temp_str_len;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
48 if (*tmp_pos == 0)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
49 break_loop = true;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
50 *tmp_pos = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
51 if (temp_str_len)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
52 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
53 switch (decode_step)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
54 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
55 case 1:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
56 pInfos[i].pName = RemoveQuotes(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
57 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
58 case 2:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
59 pInfos[i].pFilename = RemoveQuotes(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
60 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
61 case 3:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
62 pInfos[i].uNumResets = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
63 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
64 case 4:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
65 pInfos[i].uFirstVisitedAt = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
66 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
67 case 5:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
68 pInfos[i]._per = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
69 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
70 case 6:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
71 pInfos[i].uRespawnIntervalDays = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
72 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
73 case 7:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
74 pInfos[i]._alert_days = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
75 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
76 case 8:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
77 pInfos[i]._steal_perm = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
78 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
79 case 9:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
80 pInfos[i].LockX5 = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
81 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
82 case 10:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
83 pInfos[i].Trap_D20 = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
84 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
85 case 11:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
86 pInfos[i].Treasure_prob = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
87 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
88 case 12:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
89 pInfos[i].Encounter_percent = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
90 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
91 case 13:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
92 pInfos[i].EncM1percent = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
93 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
94 case 14:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
95 pInfos[i].EncM2percent = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
96 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
97 case 15:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
98 pInfos[i].EncM3percent = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
99 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
100 case 16:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
101 pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
102 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
103 case 18:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
104 pInfos[i].Dif_M1 = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
105 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
106 case 19:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
107 pInfos[i].uEncounterMonster1AtLeast = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
108 pInfos[i].uEncounterMonster1AtMost = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
109 strcpy(work_str, test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
110 work_str_pos = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
111 work_str_len=strlen(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
112 if (work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
113 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
114 while (work_str[work_str_pos] != '-' )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
115 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
116 ++work_str_pos;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
117 if (work_str_pos >= work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
118 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
119 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
120 work_str[work_str_pos] = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
121 pInfos[i].uEncounterMonster1AtLeast = atoi(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
122 if ( work_str_pos < work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
123 pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
124 else
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
125 pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
126 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
127 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
128 case 20:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
129 pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
130 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
131 case 22:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
132 pInfos[i].Dif_M2 = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
133 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
134 case 23:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
135 pInfos[i].uEncounterMonster2AtLeast = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
136 pInfos[i].uEncounterMonster2AtMost = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
137 strcpy(work_str, test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
138 work_str_pos = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
139 work_str_len=strlen(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
140 if (work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
141 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
142 while (work_str[work_str_pos] != '-' )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
143 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
144 ++work_str_pos;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
145 if (work_str_pos >= work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
146 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
147 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
148 work_str[work_str_pos] = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
149 pInfos[i].uEncounterMonster2AtLeast = atoi(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
150 if ( work_str_pos < work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
151 pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
152 else
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
153 pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
154 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
155 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
156 case 24:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
157 pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
158 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
159 case 26:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
160 pInfos[i].Dif_M3 = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
161 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
162 case 27:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
163 pInfos[i].uEncounterMonster3AtLeast = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
164 pInfos[i].uEncounterMonster3AtMost = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
165 strcpy(work_str, test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
166 work_str_pos = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
167 work_str_len=strlen(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
168 if (work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
169 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
170 while (work_str[work_str_pos] != '-' )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
171 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
172 ++work_str_pos;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
173 if (work_str_pos >= work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
174 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
175 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
176 work_str[work_str_pos] = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
177 pInfos[i].uEncounterMonster3AtLeast = atoi(work_str);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
178 if ( work_str_pos < work_str_len )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
179 pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
180 else
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
181 pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
182 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
183 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
184 case 28:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
185 pInfos[i].uRedbookTrackID = atoi(test_string);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
186 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
187 case 29:
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
188 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
189 if ( !strcmp(test_string, "CAVE") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
190 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
191 pInfos[i].uEAXEnv = 8;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
192 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
193 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
194 if ( !strcmp(test_string, "STONEROOM") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
195 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
196 pInfos[i].uEAXEnv = 5;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
197 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
198 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
199 if ( !strcmp(test_string, "MOUNTAINS") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
200 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
201 pInfos[i].uEAXEnv = 17;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
202 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
203 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
204 if ( !strcmp(test_string, "PLAIN") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
205 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
206 pInfos[i].uEAXEnv = 19;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
207 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
208 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
209 if ( !strcmp(test_string, "FOREST") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
210 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
211 pInfos[i].uEAXEnv = 15;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
212 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
213 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
214 if ( !strcmp(test_string, "CITY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
215 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
216 pInfos[i].uEAXEnv = 16;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
217 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
218 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
219 if ( !strcmp(test_string, "UNDERWATER") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
220 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
221 pInfos[i].uEAXEnv = 22;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
222 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
223 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
224 if ( !strcmp(test_string, "ARENA") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
225 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
226 pInfos[i].uEAXEnv = 9;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
227 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
228 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
229 if ( !strcmp(test_string, "GENERIC") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
230 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
231 pInfos[i].uEAXEnv = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
232 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
233 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
234 if ( !strcmp(test_string, "PADDEDCELL") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
235 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
236 pInfos[i].uEAXEnv = 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
237 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
238 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
239 if ( !strcmp(test_string, "ROOM") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
240 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
241 pInfos[i].uEAXEnv = 2;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
242 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
243 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
244 if ( !strcmp(test_string, "BATHROOM") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
245 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
246 pInfos[i].uEAXEnv = 3;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
247 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
248 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
249 if ( !strcmp(test_string, "LIVINGROOM") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
250 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
251 pInfos[i].uEAXEnv = 4;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
252 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
253 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
254 if ( !strcmp(test_string, "AUDITORIUM") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
255 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
256 pInfos[i].uEAXEnv = 6;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
257 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
258 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
259 if ( !strcmp(test_string, "CONCERTHALL") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
260 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
261 pInfos[i].uEAXEnv = 7;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
262 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
263 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
264 if ( !strcmp(test_string, "HANGAR") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
265 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
266 pInfos[i].uEAXEnv = 10;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
267 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
268 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
269 if ( !strcmp(test_string, "CARPETEDHALLWAY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
270 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
271 pInfos[i].uEAXEnv = 11;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
272 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
273 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
274 if ( !strcmp(test_string, "HALLWAY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
275 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
276 pInfos[i].uEAXEnv = 12;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
277 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
278 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
279 if ( !strcmp(test_string, "STONECORRIDOR") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
280 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
281 pInfos[i].uEAXEnv = 13;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
282 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
283 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
284 if ( !strcmp(test_string, "ALLEY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
285 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
286 pInfos[i].uEAXEnv = 14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
287 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
288 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
289 if ( !strcmp(test_string, "QUARRY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
290 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
291 pInfos[i].uEAXEnv = 18;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
292 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
293 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
294 if ( !strcmp(test_string, "PARKINGLOT") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
295 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
296 pInfos[i].uEAXEnv = 20;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
297 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
298 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
299 if ( !strcmp(test_string, "SEWERPIPE") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
300 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
301 pInfos[i].uEAXEnv = 21;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
302 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
303 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
304 if ( !strcmp(test_string, "DRUGGED") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
305 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
306 pInfos[i].uEAXEnv = 23;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
307 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
308 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
309 if ( !strcmp(test_string, "DIZZY") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
310 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
311 pInfos[i].uEAXEnv = 24;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
312 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
313 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
314 if ( !strcmp(test_string, "PSYCHOTIC") )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
315 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
316 pInfos[i].uEAXEnv = 25;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
317 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
318 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
319 pInfos[i].uEAXEnv = 26;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
320
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
321 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
322 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
323 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
324 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
325 else
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
326 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
327 break_loop = true;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
328 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
329 ++decode_step;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
330 test_string=tmp_pos+1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
331 } while ((decode_step<31)&&!break_loop);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
332 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
333
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
334 uNumMaps = 77;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
335 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
336 // 453F62: using guessed type char Str[32];
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
337
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
338 //----- (00410D99) --------------------------------------------------------
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
339 int MapStats::sub_410D99_get_map_index(int a1)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
340 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
341 for (int i = 1; i <= pMapStats->uNumMaps; i++)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
342 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
343 if (_stricmp(pMapStats->pInfos[i].pFilename, pGames_LOD->pSubIndices[a1].pFilename) )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
344 return i;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
345 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
346 Error("Map not found");
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
347 return -1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
348 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
349
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
350 //----- (004547A3) --------------------------------------------------------
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
351 MAP_TYPE MapStats::GetMapInfo(const char *Str2)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
352 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
353 Assert(uNumMaps >= 2);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
354
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
355 for (uint i = 1; i < uNumMaps; ++i)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
356 if (!_stricmp(pInfos[i].pFilename, Str2))
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
357 return (MAP_TYPE)i;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
358
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
359 Error("Map not found!");
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
360 return (MAP_TYPE)-1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
361 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
362
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
363
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
364 //----- (0044FFD8) --------------------------------------------------------
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
365 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2)
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
366 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
367 //MapInfo *v2; // ebx@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
368 //SpawnPointMM7 *v3; // esi@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
369 //int v4; // eax@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
370 int v5; // edx@1
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2259
diff changeset
371 // int v6; // eax@1
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
372 int v7; // ecx@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
373 int v8; // ebx@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
374 int v9; // eax@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
375 signed int v10; // ebx@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
376 signed int result; // eax@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
377 signed __int64 v12; // qtt@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
378 int v13; // ebx@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
379 int v14; // edx@10
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
380 signed int v15; // ebx@20
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
381 unsigned __int16 v16; // dx@20
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2259
diff changeset
382 // ObjectDesc *v17; // ecx@21
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
383 unsigned __int16 v18; // ax@24
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
384 int v19; // ST0C_4@27
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
385 int v20; // ST08_4@27
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
386 int v21; // ST04_4@27
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
387 int v22; // eax@27
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
388 signed int v23; // ebx@29
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
389 unsigned __int16 v24; // dx@29
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2259
diff changeset
390 // ObjectDesc *v25; // ecx@30
2259
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
391 unsigned __int16 v26; // ax@33
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
392 //int v27; // ecx@35
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
393 //int v28; // eax@35
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
394 //int v29; // esi@35
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
395 //__int16 v30; // ax@35
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
396 SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
397 //int v32; // [sp+7Ch] [bp-Ch]@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
398 //int v33; // [sp+80h] [bp-8h]@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
399 int v34; // [sp+84h] [bp-4h]@1
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
400
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
401 //auto a1 = this;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
402 //v2 = a1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
403 //v3 = a2;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
404 //v4 = rand();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
405 v34 = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
406 v5 = rand() % 100;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
407 // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
408 v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob];
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
409 v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1];
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
410 //v32 = v5;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
411 //v33 = v7;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
412 v9 = rand();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
413 v10 = v8 - v7 + 1;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
414 v12 = v9;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
415 result = v9 / v10;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
416 v13 = v7 + (unsigned __int64)(v12 % v10);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
417 if ( v13 < 7 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
418 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
419 if ( v5 < 20 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
420 return result;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
421 if ( v5 >= 60 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
422 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
423 v19 = a2->vPosition.z;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
424 v20 = a2->vPosition.y;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
425 v21 = a2->vPosition.x;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
426 v22 = rand();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
427 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
428 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
429 if ( a2->uIndex == 1 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
430 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
431 v14 = rand() % 51 + 50;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
432 a1a.stru_24.uItemID = 197;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
433 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
434 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
435 else if ( a2->uIndex == 2 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
436 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
437 v14 = rand() % 101 + 100;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
438 a1a.stru_24.uItemID = 197;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
439 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
440 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
441 else if ( a2->uIndex == 3 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
442 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
443 v14 = rand() % 301 + 200;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
444 a1a.stru_24.uItemID = 198;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
445 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
446 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
447 else if ( a2->uIndex == 4 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
448 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
449 v14 = rand() % 501 + 500;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
450 a1a.stru_24.uItemID = 198;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
451 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
452 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
453 else if ( a2->uIndex == 5 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
454 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
455 v14 = rand() % 1001 + 1000;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
456 a1a.stru_24.uItemID = 199;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
457 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
458 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
459 else if ( a2->uIndex == 6 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
460 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
461 v14 = rand() % 3001 + 2000;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
462 a1a.stru_24.uItemID = 199;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
463 v34 = v14;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
464 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
465 v15 = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
466 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
467 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
468 v18 = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
469 for( int i = 0; i < pObjectList->uNumObjects; i++ )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
470 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
471 if ( pObjectList->pObjects[i].uObjectID == v16 )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
472 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
473 v18 = i;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
474 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
475 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
476 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
477 a1a.stru_24.SetIdentified();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
478 a1a.uObjectDescID = v18;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
479 a1a.stru_24.uSpecEnchantmentType = v34;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
480 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
481 else
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
482 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
483 result = a1a.stru_24.GenerateArtifact();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
484 if ( !result )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
485 return result;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
486 v23 = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
487 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
488 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
489 v26 = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
490 for( int i = 0; i < pObjectList->uNumObjects; i++ )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
491 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
492 if( v24 == pObjectList->pObjects[i].uObjectID )
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
493 {
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
494 v26 = i;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
495 break;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
496 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
497 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
498 a1a.uObjectDescID = v26;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
499 a1a.stru_24.Reset();
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
500 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
501 a1a.vPosition.y = a2->vPosition.y;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
502 a1a.uAttributes = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
503 a1a.uSoundID = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
504 a1a.uFacing = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
505 a1a.vPosition.z = a2->vPosition.z;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
506 a1a.vPosition.x = a2->vPosition.x;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
507 a1a.spell_skill = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
508 a1a.spell_level = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
509 a1a.spell_id = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
510 a1a.spell_target_pid = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
511 a1a.spell_caster_pid = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
512 a1a.uSpriteFrameID = 0;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
513 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
514 return a1a.Create(0, 0, 0, 0);
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
515 }
43a508455445 Adding MapInfo.cpp, moving a few functions there
Grumpy7
parents:
diff changeset
516