annotate Engine/Objects/Monsters.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 68cdef6879a0
children
rev   line source
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
6 #include <stdlib.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
7 #include <stdio.h>
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
8 #include <string.h>
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
9
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
10 #include "Engine/Engine.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
11
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
12 #include "Monsters.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
13 #include "../Tables/FrameTableInc.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
14 #include "../LOD.h"
68cdef6879a0 engine folder
Ritor1
parents: 2497
diff changeset
15 #include "../texts.h"
2497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
17
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
18
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
19
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
20
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
21 struct MonsterStats *pMonsterStats;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
22 struct MonsterList *pMonsterList;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
23
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
24 unsigned int ParseSpellType(struct FrameTableTxtLine* tbl, int* next_token);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
25
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
26 int ParseAttackType(const char *damage_type_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
27 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus );
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
28 int ParseMissleAttackType(const char *missle_attack_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
29 int ParseSpecialAttack(const char *spec_att_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
30
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
31 //----- (004548E2) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
32 unsigned int ParseSpellType( struct FrameTableTxtLine * tbl, int* next_token )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
33 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
34
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
35 if (!tbl->pProperties[0] )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
36 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
37 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
38 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
39 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
40 if ( !_stricmp(tbl->pProperties[0], "Dispel") ) //dispel magic
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
41 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
42 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
43 return 80;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
44 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
45 else if ( !_stricmp(tbl->pProperties[0], "Day") ) //day of protection
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
46 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
47 *next_token+=2;;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
48 return 85;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
49 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
50 else if ( !_stricmp(tbl->pProperties[0], "Hour") ) //hour of power
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
51 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
52 *next_token+=2;;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
53 return 86;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
54 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
55 else if ( !_stricmp(tbl->pProperties[0], "Shield") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
56 return 17;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
57 else if ( !_stricmp(tbl->pProperties[0], "Spirit") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
58 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
59 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
60 return 52;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
61 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
62 else if ( !_stricmp(tbl->pProperties[0], "Power") ) //power cure
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
63 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
64 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
65 return 77;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
66 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
67 else if ( !_stricmp(tbl->pProperties[0], "Meteor") ) //meteot shower
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
68 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
69 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
70 return 9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
71 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
72 else if ( !_stricmp(tbl->pProperties[0], "Lightning") ) //Lightning bolt
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
73 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
74 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
75 return 18;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
76 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
77 else if ( !_stricmp(tbl->pProperties[0], "Implosion") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
78 return 20;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
79 else if ( !_stricmp(tbl->pProperties[0], "Stone") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
80 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
81 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
82 return 38;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
83 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
84 else if ( !_stricmp(tbl->pProperties[0], "Haste") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
85 return 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
86 else if ( !_stricmp(tbl->pProperties[0], "Heroism") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
87 return 51;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
88 else if ( !_stricmp(tbl->pProperties[0], "Pain") ) //pain reflection
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
89 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
90 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
91 return 95;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
92 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
93 else if ( !_stricmp(tbl->pProperties[0], "Sparks") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
94 return 15;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
95 else if ( !_stricmp(tbl->pProperties[0], "Light") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
96 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
97 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
98 return 78;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
99 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
100 else if ( !_stricmp(tbl->pProperties[0], "Toxic") ) //toxic cloud
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
101 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
102 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
103 return 90;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
104 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
105 else if ( !_stricmp(tbl->pProperties[0], "ShrapMetal") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
106 return 93;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
107 else if ( !_stricmp(tbl->pProperties[0], "Paralyze") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
108 return 81;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
109 else if ( !_stricmp(tbl->pProperties[0], "Fireball") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
110 return 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
111 else if ( !_stricmp(tbl->pProperties[0], "Incinerate") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
112 return 11;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
113 else if ( !_stricmp(tbl->pProperties[0], "Fire") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
114 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
115 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
116 return 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
117 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
118 else if ( !_stricmp(tbl->pProperties[0], "Rock") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
119 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
120 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
121 return 41;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
122 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
123 else if ( !_stricmp(tbl->pProperties[0], "Mass") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
124 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
125 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
126 return 44;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
127 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
128 else if ( !_stricmp(tbl->pProperties[0], "Ice") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
129 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
130 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
131 return 26;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
132 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
133 else if ( !_stricmp(tbl->pProperties[0], "Acid") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
134 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
135 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
136 return 29;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
137 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
138 else if ( !_stricmp(tbl->pProperties[0], "Bless") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
139 return 46;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
140 else if ( !_stricmp(tbl->pProperties[0], "Dragon") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
141 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
142 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
143 return 97;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
144 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
145 else if ( !_stricmp(tbl->pProperties[0], "Reanimate") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
146 return 89;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
147 else if ( !_stricmp(tbl->pProperties[0], "Summon") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
148 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
149 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
150 return 82;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
151 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
152 else if ( !_stricmp(tbl->pProperties[0], "Fate") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
153 return 47;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
154 else if ( !_stricmp(tbl->pProperties[0], "Harm") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
155 return 70;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
156 else if ( !_stricmp(tbl->pProperties[0], "Mind") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
157 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
158 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
159 return 57;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
160 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
161 else if ( !_stricmp(tbl->pProperties[0], "Blades") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
162 return 39;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
163 else if ( !_stricmp(tbl->pProperties[0], "Psychic") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
164 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
165 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
166 return 65;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
167 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
168 else if ( !_stricmp(tbl->pProperties[0], "Hammerhands") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
169 return 73;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
170 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
171 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
172 sprintf(pTmpBuf.data(), "Unknown monster spell %s", tbl->pProperties[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
173 MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
174 ++*next_token;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
175 return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
176 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
177 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
178
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
179 //----- (00454CB4) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
180 int ParseAttackType( const char *damage_type_str )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
181 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
182
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
183 switch (tolower(*damage_type_str))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
184 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
185 case 'f': return 0; //fire
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
186 case 'a': return 1; //air
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
187 case 'w': return 2; //water
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
188 case 'e': return 3; //earth
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
189
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
190 case 's': return 6; //spirit
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
191 case 'm': return 7; //mind
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
192 //m ?? 8
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
193 case 'l': return 9; //light
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
194 case 'd': return 10; //dark
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
195 // d?? 11
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
196 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
197 return 4; //phis
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
198
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
199 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
200
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
201 //----- (00454D7D) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
202 void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
203 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
204 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
205 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
206 bool dice_flag=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
207
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
208 *dice_rolls = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
209 *dice_sides = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
210 *dmg_bonus = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
211
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
212 str_len = strlen(damage_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
213 if (str_len<=0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
214 return;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
215 for (str_pos=0;str_pos<str_len;++str_pos )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
216 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
217 if (tolower(damage_str[str_pos])=='d')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
218 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
219 damage_str[str_pos]='\0';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
220 *dice_rolls=atoi(damage_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
221 *dice_sides=atoi(&damage_str[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
222 dice_flag=true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
223 damage_str[str_pos]='d';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
224 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
225 else if (tolower(damage_str[str_pos])=='+')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
226 *dmg_bonus=atoi(&damage_str[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
227 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
228 if (!dice_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
229 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
230 if ((*damage_str>='0')&&(*damage_str<='9'))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
231 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
232 *dice_rolls =atoi(damage_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
233 *dice_sides = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
234 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
235 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
236 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
237
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
238 //----- (00454E3A) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
239 int ParseMissleAttackType(const char *missle_attack_str)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
240 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
241 if ( !_stricmp(missle_attack_str, "ARROW") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
242 return 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
243 else if ( !_stricmp(missle_attack_str, "ARROWF") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
244 return 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
245 else if ( !_stricmp(missle_attack_str, "FIRE") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
246 return 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
247 else if ( !_stricmp(missle_attack_str, "AIR") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
248 return 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
249 else if ( !_stricmp(missle_attack_str, "WATER") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
250 return 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
251 else if ( !_stricmp(missle_attack_str, "EARTH") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
252 return 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
253 else if ( !_stricmp(missle_attack_str, "SPIRIT") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
254 return 7;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
255 else if ( !_stricmp(missle_attack_str, "MIND") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
256 return 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
257 else if ( !_stricmp(missle_attack_str, "BODY") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
258 return 9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
259 else if ( !_stricmp(missle_attack_str, "LIGHT") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
260 return 10;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
261 else if ( !_stricmp(missle_attack_str, "DARK") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
262 return 11;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
263 else if ( !_stricmp(missle_attack_str, "ENER") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
264 return 13;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
265 else return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
266 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
267
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
268
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
269 int ParseSpecialAttack(char *spec_att_str)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
270 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
271 _strlwr(spec_att_str);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
272 if ( strstr(spec_att_str, "curse") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
273 return 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
274 else if ( strstr(spec_att_str, "weak") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
275 return 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
276 else if ( strstr(spec_att_str, "asleep") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
277 return 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
278 else if ( strstr(spec_att_str, "afraid") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
279 return 23;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
280 else if ( strstr(spec_att_str, "drunk") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
281 return 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
282 else if ( strstr(spec_att_str, "insane") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
283 return 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
284 else if ( strstr(spec_att_str, "poison weak") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
285 return 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
286 else if ( strstr(spec_att_str, "poison medium") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
287 return 7;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
288 else if ( strstr(spec_att_str, "poison severe") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
289 return 8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
290 else if ( strstr(spec_att_str, "disease weak") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
291 return 9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
292 else if ( strstr(spec_att_str, "disease medium") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
293 return 10;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
294 else if ( strstr(spec_att_str, "disease severe") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
295 return 11;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
296 else if ( strstr(spec_att_str, "paralyze") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
297 return 12;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
298 else if ( strstr(spec_att_str, "uncon") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
299 return 13;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
300 else if ( strstr(spec_att_str, "dead") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
301 return 14;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
302 else if ( strstr(spec_att_str, "stone") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
303 return 15;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
304 else if ( strstr(spec_att_str, "errad") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
305 return 16;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
306 else if ( strstr(spec_att_str, "brkitem") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
307 return 17;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
308 else if ( strstr(spec_att_str, "brkarmor") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
309 return 18;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
310 else if ( strstr(spec_att_str, "brkweapon") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
311 return 19;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
312 else if ( strstr(spec_att_str, "steal") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
313 return 20;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
314 else if ( strstr(spec_att_str, "age") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
315 return 21;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
316 else if ( strstr(spec_att_str, "drainsp") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
317 return 22;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
318 else return 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
319 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
320
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
321 //----- (004598FC) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
322 bool MonsterList::FromFileTxt(const char *Args)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
323 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
324 MonsterList *v2; // ebx@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
325 FILE *v3; // eax@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
326 unsigned int v4; // esi@3
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
327 void *v5; // eax@9
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
328 FILE *v6; // ST14_4@11
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
329 char *i; // eax@11
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
330 signed int v8; // esi@12
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
331 unsigned __int16 v9; // ax@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
332 const char *v10; // ST18_4@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
333 unsigned __int16 v11; // ax@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
334 const char *v12; // ST14_4@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
335 unsigned __int16 v13; // ax@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
336 const char *v14; // ST10_4@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
337 __int16 v15; // ax@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
338 const char *v16; // ST0C_4@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
339 int v17; // esi@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
340 unsigned __int8 v18; // al@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
341 signed int v19; // esi@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
342 unsigned __int16 v20; // ax@17
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
343 int v21; // ecx@17
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
344 char Buf; // [sp+4h] [bp-304h]@3
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
345 FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
346 FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
347 int v26; // [sp+2F0h] [bp-18h]@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
348 char v27; // [sp+2F4h] [bp-14h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
349 char v28; // [sp+2F5h] [bp-13h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
350 char v29; // [sp+2F6h] [bp-12h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
351 char v30; // [sp+2F7h] [bp-11h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
352 char v31; // [sp+2F8h] [bp-10h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
353 char v32; // [sp+2F9h] [bp-Fh]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
354 char v33; // [sp+2FAh] [bp-Eh]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
355 char v34; // [sp+2FBh] [bp-Dh]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
356 char v35; // [sp+2FCh] [bp-Ch]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
357 char v36; // [sp+2FDh] [bp-Bh]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
358 char v37; // [sp+2FEh] [bp-Ah]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
359 char v38; // [sp+2FFh] [bp-9h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
360 char v39; // [sp+300h] [bp-8h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
361 char v40; // [sp+301h] [bp-7h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
362 char v41; // [sp+302h] [bp-6h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
363 char v42; // [sp+303h] [bp-5h]@14
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
364 FILE *File; // [sp+304h] [bp-4h]@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
365 unsigned int Argsa; // [sp+310h] [bp+8h]@3
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
366 int Argsb; // [sp+310h] [bp+8h]@16
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
367
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
368 v2 = this;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
369 v3 = fopen(Args, "r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
370 File = v3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
371 if ( !v3 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
372 Error("MonsterRaceListStruct::load - Unable to open file: %s.");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
373
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
374 v4 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
375 Argsa = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
376 if ( fgets(&Buf, 490, v3) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
377 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
378 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
379 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
380 *strchr(&Buf, 10) = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
381 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
382 if ( v25.uPropCount && *v25.pProperties[0] != 47 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
383 ++Argsa;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
384 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
385 while ( fgets(&Buf, 490, File) );
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
386 v4 = Argsa;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
387 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
388 v2->uNumMonsters = v4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
389 v5 = malloc(152 * v4);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
390 v2->pMonsters = (MonsterDesc *)v5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
391 if ( !v5 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
392 Error("MonsterRaceListStruct::load - Out of Memory!");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
393
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
394 v6 = File;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
395 v2->uNumMonsters = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
396 fseek(v6, 0, 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
397 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
398 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
399 *strchr(&Buf, 10) = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
400 memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
401 v8 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
402 if ( v25.uPropCount && *v25.pProperties[0] != 47 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
403 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
404 strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName, v25.pProperties[0]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
405 v35 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
406 v36 = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
407 v37 = 7;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
408 v38 = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
409 v39 = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
410 v40 = 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
411 v41 = 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
412 v42 = 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
413 v27 = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
414 v28 = 2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
415 v29 = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
416 v30 = 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
417 v31 = 4;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
418 v32 = 5;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
419 v33 = 6;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
420 v34 = 7;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
421 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
422 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
423 strcpy(
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
424 v2->pMonsters[v2->uNumMonsters].pSpriteNames[(unsigned __int8)*(&v35 + v8)],
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
425 v25.pProperties[(unsigned __int8)*(&v27 + v8)]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
426 ++v8;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
427 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
428 while ( v8 < 8 );
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
429 v9 = atoi(v25.pProperties[8]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
430 v10 = v25.pProperties[9];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
431 v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
432 v11 = atoi(v10);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
433 v12 = v25.pProperties[10];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
434 v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
435 v13 = atoi(v12);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
436 v14 = v25.pProperties[11];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
437 v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
438 v15 = atoi(v14);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
439 v16 = v25.pProperties[12];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
440 v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
441 v17 = (unsigned __int8)atoi(v16);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
442 Argsb = atoi(v25.pProperties[13]) & 0xFF;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
443 v26 = atoi(v25.pProperties[14]) & 0xFF;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
444 v18 = atoi(v25.pProperties[15]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
445 v2->pMonsters[v2->uNumMonsters].sTintColor = v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
446 v19 = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
447 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
448 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
449 v20 = atoi(v25.pProperties[v19 + 16]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
450 v21 = v19++ ;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
451 v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
452 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
453 while ( v19 < 4 );
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
454 ++v2->uNumMonsters;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
455 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
456 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
457 fclose(File);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
458 return 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
459 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
460
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
461 //----- (004598AF) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
462 void MonsterList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
463 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
464 uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
465 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
466 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
467
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
468 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
469 Assert(uNumMonsters);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
470 Assert(!num_mm8_monsters);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
471
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
472 pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
473 memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
474 for (uint i = 0; i < num_mm6_monsters; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
475 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
476 auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
477 MonsterDesc* dst = &pMonsters[num_mm7_monsters + i];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
478
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
479 dst->uMonsterHeight = src->uMonsterHeight;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
480 dst->uMonsterRadius = src->uMonsterRadius;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
481 dst->uMovementSpeed = src->uMovementSpeed;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
482 dst->uToHitRadius = src->uToHitRadius;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
483 dst->sTintColor = -1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
484 memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs, sizeof(src->pSoundSampleIDs));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
485 memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
486 memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
487 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
488 memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters, (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
489 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
490
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
491 //----- (00459860) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
492 void MonsterList::ToFile()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
493 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
494 MonsterList *v1; // esi@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
495 FILE *v2; // eax@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
496 FILE *v3; // edi@1
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
497
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
498 v1 = this;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
499 v2 = fopen("data\\dmonlist.bin", "wb");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
500 v3 = v2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
501 if ( !v2 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
502 Error("Unable to save dmonlist.bin!");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
503 fwrite(v1, 4u, 1u, v2);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
504 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
505 fclose(v3);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
506 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
507
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
508
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
509 //----- (004563FF) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
510 signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
511 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
512 for (int i=1; i<uNumMonsters; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
513 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
514 if((pInfos[i].pName )&& (!_stricmp(pInfos[i].pPictureName, monster_textr_name)))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
515 return i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
516 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
517 return -1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
518 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
519
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
520
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
521 //----- (00454F4E) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
522 void MonsterStats::InitializePlacements()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
523 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
524 int i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
525 char* test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
526 unsigned char c;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
527 bool break_loop;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
528 unsigned int temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
529 char* tmp_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
530 int decode_step;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
531 // int item_counter;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
532
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
533 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
534 strtok(pMonsterPlacementTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
535 for (i=1; i<31; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
536 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
537 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
538 break_loop = false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
539 decode_step=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
540 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
541 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
542 c = *(unsigned char*)test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
543 temp_str_len = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
544 while((c!='\t')&&(c>0))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
545 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
546 ++temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
547 c=test_string[temp_str_len];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
548 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
549 tmp_pos=test_string+temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
550 if (*tmp_pos == 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
551 break_loop = true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
552 *tmp_pos = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
553 if (temp_str_len)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
554 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
555 if (decode_step==1)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
556 pPlaceStrings[i]=RemoveQuotes(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
557 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
558 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
559 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
560 break_loop = true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
561 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
562 ++decode_step;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
563 test_string=tmp_pos+1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
564 } while ((decode_step<3)&&!break_loop);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
565 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
566 uNumPlacements = 31;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
567 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
568
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
569 //----- (0045501E) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
570 void MonsterStats::Initialize()
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
571 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
572 int i;//,j;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
573 char* test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
574 unsigned char c;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
575 bool break_loop;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
576 unsigned int temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
577 char* tmp_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
578 int decode_step;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
579 // int item_counter;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
580 int curr_rec_num;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
581 char parse_str[64];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
582 char Src[120];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
583 FrameTableTxtLine parsed_field;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
584
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
585 free(pMonstersTXT_Raw);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
586 pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
587 strtok(pMonstersTXT_Raw, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
588 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
589 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
590 strtok(NULL, "\r");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
591 uNumMonsters = 265;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
592 curr_rec_num=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
593 for (i=0;i<uNumMonsters-1;++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
594 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
595 test_string = strtok(NULL, "\r") + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
596 break_loop = false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
597 decode_step=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
598 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
599 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
600 c = *(unsigned char*)test_string;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
601 temp_str_len = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
602 while((c!='\t')&&(c>0))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
603 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
604 ++temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
605 c=test_string[temp_str_len];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
606 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
607 tmp_pos=test_string+temp_str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
608 if (*tmp_pos == 0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
609 break_loop = true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
610 *tmp_pos = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
611 if (temp_str_len)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
612 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
613 switch (decode_step)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
614 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
615 case 0:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
616 curr_rec_num=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
617 pInfos[curr_rec_num].uID=curr_rec_num;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
618 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
619 case 1:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
620 pInfos[curr_rec_num].pName=RemoveQuotes(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
621 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
622 case 2:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
623 pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
624 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
625 case 3:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
626 pInfos[curr_rec_num].uLevel=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
627 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
628 case 4:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
629 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
630 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
631 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
632 pInfos[curr_rec_num].uHP=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
633 if (test_string[0]=='"')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
634 test_string[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
635 str_len=strlen(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
636 if (str_len==0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
637 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
638 while ((test_string[str_pos]!=',')&&(str_pos<str_len))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
639 ++str_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
640 if (str_len==str_pos)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
641 pInfos[curr_rec_num].uHP=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
642 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
643 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
644 test_string[str_pos]='\0';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
645 pInfos[curr_rec_num].uHP=1000*atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
646 pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
647 test_string[str_pos]=',';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
648 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
649 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
650 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
651 case 5:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
652 pInfos[curr_rec_num].uAC=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
653 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
654 case 6:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
655 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
656 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
657 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
658 pInfos[curr_rec_num].uExp=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
659 if (test_string[0]=='"')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
660 test_string[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
661 str_len=strlen(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
662 if (str_len==0)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
663 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
664 while ((test_string[str_pos]!=',')&&(str_pos<str_len))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
665 ++str_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
666 if (str_len==str_pos)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
667 pInfos[curr_rec_num].uExp=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
668 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
669 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
670 test_string[str_pos]='\0';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
671 pInfos[curr_rec_num].uExp=1000*atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
672 pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
673 test_string[str_pos]=',';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
674 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
675 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
676 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
677 case 7:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
678 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
679 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
680 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
681 bool chance_flag=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
682 bool dice_flag=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
683 bool item_type_flag=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
684 char* item_name;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
685 pInfos[curr_rec_num].uTreasureDropChance=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
686 pInfos[curr_rec_num].uTreasureDiceRolls=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
687 pInfos[curr_rec_num].uTreasureDiceSides=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
688 pInfos[curr_rec_num].uTreasureType=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
689 pInfos[curr_rec_num].uTreasureLevel=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
690 if (test_string[0]=='"')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
691 test_string[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
692 str_len=strlen(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
693 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
694 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
695 switch(tolower(test_string[str_pos]))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
696 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
697 case '%': chance_flag=true; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
698 case 'd': dice_flag=true; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
699 case 'l': item_type_flag=true; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
700 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
701 ++str_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
702 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
703 while(str_pos<str_len);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
704 if (chance_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
705 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
706 pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
707 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
708 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
709 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
710 if ((!dice_flag)&&(!item_type_flag))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
711 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
712 pInfos[curr_rec_num].uTreasureDropChance=100;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
713 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
714 if (dice_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
715 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
716 str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
717 dice_flag=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
718 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
719 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
720 switch(tolower(test_string[str_pos]))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
721 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
722 case '%':
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
723 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
724 dice_flag=true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
725 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
726 case 'd':
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
727 if(!dice_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
728 pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
729 pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
730 str_pos=str_len;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
731 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
732
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
733 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
734 ++str_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
735 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
736 while(str_pos<str_len);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
737 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
738 if (item_type_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
739 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
740 str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
741 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
742 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
743 if (tolower(test_string[str_pos])=='l')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
744 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
745 ++str_pos;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
746 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
747 while(str_pos<str_len);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
748
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
749 pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
750 item_name=&test_string[str_pos+2];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
751 if (*item_name)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
752 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
753 if ( !_stricmp(item_name, "WEAPON"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
754 pInfos[curr_rec_num].uTreasureType= 20;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
755 else if ( !_stricmp(item_name, "ARMOR"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
756 pInfos[curr_rec_num].uTreasureType= 21;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
757 else if ( !_stricmp(item_name, "MISC"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
758 pInfos[curr_rec_num].uTreasureType= 22;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
759 else if ( !_stricmp(item_name, "SWORD"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
760 pInfos[curr_rec_num].uTreasureType= 23;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
761 else if ( !_stricmp(item_name, "DAGGER"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
762 pInfos[curr_rec_num].uTreasureType= 24;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
763 else if ( !_stricmp(item_name, "AXE"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
764 pInfos[curr_rec_num].uTreasureType= 25;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
765 else if ( !_stricmp(item_name, "SPEAR"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
766 pInfos[curr_rec_num].uTreasureType= 26;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
767 else if ( !_stricmp(item_name, "BOW"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
768 pInfos[curr_rec_num].uTreasureType= 27;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
769 else if ( !_stricmp(item_name, "MACE"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
770 pInfos[curr_rec_num].uTreasureType= 28;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
771 else if ( !_stricmp(item_name, "CLUB"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
772 pInfos[curr_rec_num].uTreasureType= 29;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
773 else if ( !_stricmp(item_name, "STAFF"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
774 pInfos[curr_rec_num].uTreasureType= 30;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
775 else if ( !_stricmp(item_name, "LEATHER"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
776 pInfos[curr_rec_num].uTreasureType= 31;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
777 else if ( !_stricmp(item_name, "CHAIN"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
778 pInfos[curr_rec_num].uTreasureType= 32;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
779 else if ( !_stricmp(item_name, "PLATE"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
780 pInfos[curr_rec_num].uTreasureType= 33;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
781 else if ( !_stricmp(item_name, "SHIELD"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
782 pInfos[curr_rec_num].uTreasureType= 34;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
783 else if ( !_stricmp(item_name, "HELM"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
784 pInfos[curr_rec_num].uTreasureType= 35;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
785 else if ( !_stricmp(item_name, "BELT"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
786 pInfos[curr_rec_num].uTreasureType= 36;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
787 else if ( !_stricmp(item_name, "CAPE"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
788 pInfos[curr_rec_num].uTreasureType= 37;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
789 else if ( !_stricmp(item_name, "GAUNTLETS"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
790 pInfos[curr_rec_num].uTreasureType= 38;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
791 else if ( !_stricmp(item_name, "BOOTS"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
792 pInfos[curr_rec_num].uTreasureType= 39;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
793 else if ( !_stricmp(item_name, "RING"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
794 pInfos[curr_rec_num].uTreasureType= 40;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
795 else if ( !_stricmp(item_name, "AMULET"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
796 pInfos[curr_rec_num].uTreasureType= 41;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
797 else if ( !_stricmp(item_name, "WAND"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
798 pInfos[curr_rec_num].uTreasureType= 42;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
799 else if ( !_stricmp(item_name, "SCROLL"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
800 pInfos[curr_rec_num].uTreasureType= 43;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
801 else if ( !_stricmp(item_name, "GEM"))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
802 pInfos[curr_rec_num].uTreasureType= 46;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
803 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
804 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
805
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
806 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
807 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
808 case 8:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
809 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
810 pInfos[curr_rec_num].bQuestMonster=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
811 if (atoi(test_string))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
812 pInfos[curr_rec_num].bQuestMonster=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
813 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
814 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
815 case 9:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
816 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
817 pInfos[curr_rec_num].uFlying=false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
818 if (_strnicmp(test_string, "n",1))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
819 pInfos[curr_rec_num].uFlying=true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
820 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
821 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
822 case 10:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
823 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
824 switch(tolower(test_string[0]))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
825 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
826 case 's': pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_SHORT;// short
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
827 if (tolower(test_string[1])!='h')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
828 pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
829 break; //short
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
830 case 'l': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_LONG; break; //long
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
831 case 'm': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_MEDIUM; break; //med
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
832 case 'g': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_GLOBAL; break; //global?
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
833 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
834 pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_FREE; //free
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
835 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
836 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
837 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
838 case 11:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
839 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
840 switch(tolower(test_string[0]))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
841 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
842 case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
843 case 'w': pInfos[curr_rec_num].uAIType=1; break; //wimp
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
844 case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
845 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
846 pInfos[curr_rec_num].uAIType=3; //Agress
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
847 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
848 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
849 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
850 case 12:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
851 pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
852 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
853 case 13:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
854 pInfos[curr_rec_num].uBaseSpeed=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
855 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
856 case 14:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
857 pInfos[curr_rec_num].uRecoveryTime=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
858 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
859 case 15:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
860 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
861 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
862 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
863 pInfos[curr_rec_num].uAttackPreference=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
864 pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
865 str_len=strlen(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
866 for (str_pos=0;str_pos<str_len;++str_pos )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
867 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
868 switch(tolower(test_string[str_pos]))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
869 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
870 case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
871 case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
872 case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
873 case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
874 case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
875 case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
876 case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
877 case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
878 case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
879 case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
880 case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
881 case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
882 case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
883 case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
884 case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
885 case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
886 case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
887 case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
888 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
889 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
890 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
891 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
892 case 16:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
893 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
894 int str_len=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
895 int str_pos=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
896 pInfos[curr_rec_num].uSpecialAttackLevel=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
897 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
898 str_len=strlen(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
899 if (str_len>1)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
900 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
901 for (str_pos=0;str_pos<str_len;++str_pos )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
902 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
903 if (tolower(test_string[str_pos])=='x')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
904 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
905 test_string[str_pos]='\0';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
906 pInfos[curr_rec_num].uSpecialAttackLevel=atoi(&test_string[str_pos+1]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
907 test_string[str_pos]='x';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
908 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
909 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
910 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
911 pInfos[curr_rec_num].uSpecialAttackType=(SPECIAL_ATTACK_TYPE)ParseSpecialAttack(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
912 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
913 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
914 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
915 case 17:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
916 pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
917 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
918 case 18:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
919 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
920 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
921 &pInfos[curr_rec_num].uAttack1DamageDiceSides,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
922 &pInfos[curr_rec_num].uAttack1DamageBonus);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
923 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
924 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
925 case 19:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
926 pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
927 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
928 case 20:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
929 pInfos[curr_rec_num].uAttack2Chance=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
930 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
931 case 21:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
932 pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
933 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
934 case 22:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
935 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
936 ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
937 &pInfos[curr_rec_num].uAttack2DamageDiceSides,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
938 &pInfos[curr_rec_num].uAttack2DamageBonus);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
939 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
940 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
941 case 23:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
942 pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
943 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
944 case 24:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
945 pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
946 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
947 case 25:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
948 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
949 int param_num;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
950 char type_flag;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
951 strcpy(parse_str,test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
952 parse_str[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
953 parse_str[strlen(parse_str)-1]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
954 frame_table_txt_parser(parse_str,&parsed_field);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
955 if (parsed_field.uPropCount>2)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
956 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
957 param_num=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
958 pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&parsed_field,&param_num);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
959 type_flag=*parsed_field.pProperties[param_num];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
960 pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(parsed_field.pProperties[param_num+1])&0x003F;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
961 switch(type_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
962 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
963 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0040; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
964 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0080; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
965 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0100; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
966 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
967 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
968 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
969 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
970 pInfos[curr_rec_num].uSpell1ID=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
971 pInfos[curr_rec_num].uSpellSkillAndMastery1=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
972 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
973
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
974 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
975 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
976 case 26:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
977 pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
978 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
979 case 27:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
980 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
981 int param_num;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
982 char type_flag;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
983 strcpy(parse_str,test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
984 parse_str[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
985 parse_str[strlen(parse_str)-1]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
986 frame_table_txt_parser(parse_str,&parsed_field);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
987 if (parsed_field.uPropCount>2)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
988 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
989 param_num=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
990 pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&parsed_field,&param_num);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
991 type_flag=*parsed_field.pProperties[param_num];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
992 pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(parsed_field.pProperties[param_num+1])&0x003F;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
993 switch(type_flag)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
994 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
995 case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0040; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
996 case 'M': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0080; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
997 case 'G': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0100; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
998 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
999 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1000 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1001 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1002 pInfos[curr_rec_num].uSpell2ID=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1003 pInfos[curr_rec_num].uSpellSkillAndMastery2=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1004 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1005 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1006 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1007 case 28:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1008 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1009 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1010 pInfos[curr_rec_num].uResFire=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1011 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1012 pInfos[curr_rec_num].uResFire=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1013 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1014 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1015 case 29:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1016 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1017 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1018 pInfos[curr_rec_num].uResAir=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1019 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1020 pInfos[curr_rec_num].uResAir=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1021 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1022 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1023 case 30:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1024 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1025 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1026 pInfos[curr_rec_num].uResWater=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1027 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1028 pInfos[curr_rec_num].uResWater=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1029 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1030 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1031 case 31:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1032 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1033 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1034 pInfos[curr_rec_num].uResEarth=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1035 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1036 pInfos[curr_rec_num].uResEarth=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1037 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1038 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1039 case 32:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1040 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1041 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1042 pInfos[curr_rec_num].uResMind=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1043 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1044 pInfos[curr_rec_num].uResMind=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1045 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1046 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1047 case 33:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1048 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1049 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1050 pInfos[curr_rec_num].uResSpirit=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1051 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1052 pInfos[curr_rec_num].uResSpirit=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1053 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1054 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1055 case 34:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1056 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1057 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1058 pInfos[curr_rec_num].uResBody=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1059 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1060 pInfos[curr_rec_num].uResBody=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1061 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1062 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1063 case 35:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1064 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1065 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1066 pInfos[curr_rec_num].uResLight=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1067 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1068 pInfos[curr_rec_num].uResLight=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1069 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1070 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1071 case 36:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1072 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1073 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1074 pInfos[curr_rec_num].uResDark=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1075 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1076 pInfos[curr_rec_num].uResDark=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1077 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1078 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1079 case 37:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1080 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1081 if (tolower(test_string[0])=='i')
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1082 pInfos[curr_rec_num].uResPhysical=200;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1083 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1084 pInfos[curr_rec_num].uResPhysical=atoi(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1085 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1086 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1087 case 38:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1088 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1089 // int param_num;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1090 // char type_flag;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1091 pInfos[curr_rec_num].uSpecialAbilityType=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1092 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1093 strcpy(parse_str,test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1094 parse_str[0]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1095 parse_str[strlen(parse_str)-1]=' ';
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1096 frame_table_txt_parser(parse_str,&parsed_field);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1097 if ( parsed_field.uPropCount )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1098 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1099 // v74 = v94.field_0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1100 if ( parsed_field.uPropCount < 10 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1101 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1102 if (! _stricmp(parsed_field.pProperties[0], "shot") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1103 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1104 pInfos[curr_rec_num].uSpecialAbilityType=1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1105 pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=atoi((char *)(parsed_field.pProperties[1] + 1));
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1106 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1107 else if (!_stricmp(parsed_field.pProperties[0], "summon") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1108 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1109 pInfos[curr_rec_num].uSpecialAbilityType=2;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1110 if ( parsed_field.uPropCount > 1 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1111 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1112 pTmpBuf[0] = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1113 strcpy(pTmpBuf.data(), parsed_field.pProperties[2]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1114 if ( parsed_field.uPropCount > 2 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1115 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1116 int prop_cnt = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1117 if ( parsed_field.uPropCount > 3 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1118 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1119 do
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1120 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1121 strcat(pTmpBuf.data(), " ");
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1122 char test_char = parsed_field.pProperties[prop_cnt][0];
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1123 strcat(pTmpBuf.data(), parsed_field.pProperties[prop_cnt]);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1124 if ( prop_cnt == (parsed_field.uPropCount - 1) )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1125 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1126 switch (tolower(test_char))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1127 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1128 case 'a': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 1; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1129 case 'b': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 2; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1130 case 'c': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 3; break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1131 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1132 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1133 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1134
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1135 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1136 ++prop_cnt;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1137 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1138 while ( prop_cnt < parsed_field.uPropCount );
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1139 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1140 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1141 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1142 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1143 pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1144 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1145 if ( pMonsterList->uNumMonsters )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1146 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1147 pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf.data()) + 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1148 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1149 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1150 sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf.data());
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1151 MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1152 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1153 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1154 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1155 if ( !_stricmp(parsed_field.pProperties[1], "ground") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1156 pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1157 if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1158 pInfos[curr_rec_num].uSpecialAbilityType = 0;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1159 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1160 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1161 else if (!_stricmp(parsed_field.pProperties[0], "explode") )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1162 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1163 pInfos[curr_rec_num].uSpecialAbilityType = 3;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1164 ParseDamage((char*)parsed_field.pProperties[1], &pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1165 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides,
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1166 &pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1167 pInfos[curr_rec_num].field_3C_some_special_attack = ParseAttackType(test_string);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1168 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1169 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1170 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1171 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1172 break;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1173 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1174 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1175 else
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1176 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1177 break_loop = true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1178 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1179 ++decode_step;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1180 test_string=tmp_pos+1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1181 } while ((decode_step<39)&&!break_loop);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1182 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1183 uNumMonsters = i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1184 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1185
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1186
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1187 //----- (0044FA08) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1188 signed __int16 MonsterList::GetMonsterIDByName( const char *pMonsterName )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1189 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1190 if (!pMonsterName)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1191 return -1;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1192 for (signed __int16 i=1; i<=uNumMonsters; ++i)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1193 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1194 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName)))
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1195 return i;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1196 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1197 Error("Monster not found: %s", pMonsterName);
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1198 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1199 //----- (00438BDF) --------------------------------------------------------
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1200 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1201 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1202 switch ( eSupertype )
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1203 {
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1204 case MONSTER_SUPERTYPE_UNDEAD:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1205 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 //70<=id<=72
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1206 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 //91-93
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1207 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 //199-201
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1208 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 //217-219
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1209 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 //223-225
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1210 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 //229-231
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1211 || (signed int)uMonsterInfoID >= MONSTER_GHOUL_1 && (signed int)uMonsterInfoID <= MONSTER_GHOUL_3) //256-258
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1212 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1213 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1214 case MONSTER_SUPERTYPE_KREEGAN:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1215 if ( (signed int)uMonsterInfoID >= MONSTER_DEVIL_1 && (signed int)uMonsterInfoID <= MONSTER_DEVIL_3 )//22-24
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1216 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1217 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1218 case MONSTER_SUPERTYPE_ELF:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1219 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3//133 - 150
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1220 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3//49-51
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1221 || (signed int)uMonsterInfoID >= MONSTER_ELF_SPEARMAN_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_SPEARMAN_3)//52-54
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1222 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1223 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1224 case MONSTER_SUPERTYPE_DRAGON:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1225 if ( (signed int)uMonsterInfoID >= MONSTER_DRAGON_1 && (signed int)uMonsterInfoID <= MONSTER_DRAGON_3 )//25-27
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1226 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1227 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1228 case MONSTER_SUPERTYPE_WATER_ELEMENTAL:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1229 if ( (signed int)uMonsterInfoID >= MONSTER_ELEMENTAL_WATER_1 && (signed int)uMonsterInfoID <= MONSTER_ELEMENTAL_WATER_3)//46-48
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1230 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1231 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1232 case MONSTER_SUPERTYPE_TREANT:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1233 if ( (signed int)uMonsterInfoID >= MONSTER_TREANT_1 && (signed int)uMonsterInfoID <= MONSTER_TREANT_3 )//253-255
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1234 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1235 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1236 case MONSTER_SUPERTYPE_TITAN:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1237 if ( (signed int)uMonsterInfoID >= MONSTER_TITAN_1 && (signed int)uMonsterInfoID <= MONSTER_TITAN_3 )//211-213
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1238 return true;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1239 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1240 default:
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1241 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1242 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1243 return false;
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1244 }
82d5d92a097c for MVS2012
Ritor1
parents:
diff changeset
1245