World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Структура MonsterList

#include <Monsters.h>

+ Граф связей класса MonsterList:

Открытые члены

 MonsterList ()
 
int16_t GetMonsterIDByName (const char *pMonsterName)
 
void ToFile ()
 
void FromFile (void *data_mm6, void *data_mm7, void *data_mm8)
 
bool FromFileTxt (const char *Args)
 

Открытые атрибуты

signed int uNumMonsters
 
struct MonsterDescpMonsters
 

Подробное описание

См. определение в файле Monsters.h строка 226

Конструктор(ы)

◆ MonsterList()

MonsterList::MonsterList ( )
inline

См. определение в файле Monsters.h строка 227

228  : //----- (00458429)
229  uNumMonsters(0),
230  pMonsters(nullptr) {}

Методы

◆ GetMonsterIDByName()

signed __int16 MonsterList::GetMonsterIDByName ( const char *  pMonsterName)

См. определение в файле Monsters.cpp строка 1192

1192  {
1193  if (!pMonsterName) return -1;
1194  for (signed __int16 i = 0; i <= uNumMonsters; ++i) {
1195  if ((!_stricmp(pMonsters[i].pMonsterName, pMonsterName))) return i;
1196  }
1197  Error("Monster not found: %s", pMonsterName);
1198 }

Перекрестные ссылки pMonsters и uNumMonsters.

Используется в MonsterStats::Initialize(), SpawnEncounter() и sub_44FA4C_spawn_light_elemental().

+ Граф вызова функции:

◆ ToFile()

void MonsterList::ToFile ( )

См. определение в файле Monsters.cpp строка 425

425  {
426  MonsterList *v1; // esi@1
427  FILE *v2; // eax@1
428  FILE *v3; // edi@1
429 
430  v1 = this;
431  v2 = fopen("data\\dmonlist.bin", "wb");
432  v3 = v2;
433  if (!v2) Error("Unable to save dmonlist.bin!");
434  fwrite(v1, 4u, 1u, v2);
435  fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3);
436  fclose(v3);
437 }

◆ FromFile()

void MonsterList::FromFile ( void data_mm6,
void data_mm7,
void data_mm8 
)

См. определение в файле Monsters.cpp строка 394

394  {
395  uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0,
396  num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0,
397  num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0;
398 
399  uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters;
400  Assert(uNumMonsters);
401  Assert(!num_mm8_monsters);
402 
403  pMonsters = (MonsterDesc *)malloc(sizeof(MonsterDesc) * uNumMonsters);
404  memcpy(pMonsters, (char *)data_mm7 + 4,
405  num_mm7_monsters * sizeof(MonsterDesc));
406  for (uint i = 0; i < num_mm6_monsters; ++i) {
407  auto src = (MonsterDesc_mm6 *)((char *)data_mm6 + 4) + i;
408  MonsterDesc *dst = &pMonsters[num_mm7_monsters + i];
409 
410  dst->uMonsterHeight = src->uMonsterHeight;
411  dst->uMonsterRadius = src->uMonsterRadius;
412  dst->uMovementSpeed = src->uMovementSpeed;
413  dst->uToHitRadius = src->uToHitRadius;
414  dst->sTintColor = -1;
415  memcpy(dst->pSoundSampleIDs, src->pSoundSampleIDs,
416  sizeof(src->pSoundSampleIDs));
417  memcpy(dst->pMonsterName, src->pMonsterName, sizeof(src->pMonsterName));
418  memcpy(dst->pSpriteNames, src->pSpriteNames, sizeof(src->pSpriteNames));
419  }
420  memcpy(pMonsters + num_mm6_monsters + num_mm7_monsters,
421  (char *)data_mm8 + 4, num_mm8_monsters * sizeof(MonsterDesc));
422 }

Перекрестные ссылки pMonsters, MonsterDesc::uMonsterHeight и uNumMonsters.

Используется в Engine::MM7_Initialize().

+ Граф вызова функции:

◆ FromFileTxt()

bool MonsterList::FromFileTxt ( const char *  Args)

См. определение в файле Monsters.cpp строка 265

265  {
266  MonsterList *v2; // ebx@1
267  FILE *v3; // eax@1
268  unsigned int v4; // esi@3
269  void *v5; // eax@9
270  FILE *v6; // ST14_4@11
271  char *i; // eax@11
272  signed int v8; // esi@12
273  unsigned __int16 v9; // ax@16
274  const char *v10; // ST18_4@16
275  unsigned __int16 v11; // ax@16
276  const char *v12; // ST14_4@16
277  unsigned __int16 v13; // ax@16
278  const char *v14; // ST10_4@16
279  __int16 v15; // ax@16
280  const char *v16; // ST0C_4@16
281  int v17; // esi@16
282  unsigned __int8 v18; // al@16
283  signed int v19; // esi@16
284  unsigned __int16 v20; // ax@17
285  int v21; // ecx@17
286  char Buf; // [sp+4h] [bp-304h]@3
287  FrameTableTxtLine v24; // [sp+1F8h] [bp-110h]@4
288  FrameTableTxtLine v25; // [sp+274h] [bp-94h]@4
289  int v26; // [sp+2F0h] [bp-18h]@16
290  char v27; // [sp+2F4h] [bp-14h]@14
291  char v28; // [sp+2F5h] [bp-13h]@14
292  char v29; // [sp+2F6h] [bp-12h]@14
293  char v30; // [sp+2F7h] [bp-11h]@14
294  char v31; // [sp+2F8h] [bp-10h]@14
295  char v32; // [sp+2F9h] [bp-Fh]@14
296  char v33; // [sp+2FAh] [bp-Eh]@14
297  char v34; // [sp+2FBh] [bp-Dh]@14
298  char v35; // [sp+2FCh] [bp-Ch]@14
299  char v36; // [sp+2FDh] [bp-Bh]@14
300  char v37; // [sp+2FEh] [bp-Ah]@14
301  char v38; // [sp+2FFh] [bp-9h]@14
302  char v39; // [sp+300h] [bp-8h]@14
303  char v40; // [sp+301h] [bp-7h]@14
304  char v41; // [sp+302h] [bp-6h]@14
305  char v42; // [sp+303h] [bp-5h]@14
306  FILE *File; // [sp+304h] [bp-4h]@1
307  unsigned int Argsa; // [sp+310h] [bp+8h]@3
308  int Argsb; // [sp+310h] [bp+8h]@16
309 
310  v2 = this;
311  v3 = fopen(Args, "r");
312  File = v3;
313  if (!v3) Error("MonsterRaceListStruct::load - Unable to open file: %s.");
314 
315  v4 = 0;
316  Argsa = 0;
317  if (fgets(&Buf, 490, v3)) {
318  do {
319  *strchr(&Buf, 10) = 0;
320  memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
321  if (v25.uPropCount && *v25.pProperties[0] != 47) ++Argsa;
322  } while (fgets(&Buf, 490, File));
323  v4 = Argsa;
324  }
325  v2->uNumMonsters = v4;
326  v5 = malloc(sizeof(MonsterDesc) * v4);
327  v2->pMonsters = (MonsterDesc *)v5;
328  if (!v5) Error("MonsterRaceListStruct::load - Out of Memory!");
329 
330  v6 = File;
331  v2->uNumMonsters = 0;
332  fseek(v6, 0, 0);
333  for (i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File)) {
334  *strchr(&Buf, 10) = 0;
335  memcpy(&v25, frame_table_txt_parser(&Buf, &v24), sizeof(v25));
336  v8 = 0;
337  if (v25.uPropCount && *v25.pProperties[0] != 47) {
338  strcpy(v2->pMonsters[v2->uNumMonsters].pMonsterName,
339  v25.pProperties[0]);
340  v35 = 0;
341  v36 = 1;
342  v37 = 7;
343  v38 = 2;
344  v39 = 3;
345  v40 = 4;
346  v41 = 5;
347  v42 = 6;
348  v27 = 1;
349  v28 = 2;
350  v29 = 3;
351  v30 = 4;
352  v31 = 4;
353  v32 = 5;
354  v33 = 6;
355  v34 = 7;
356  do {
357  strcpy(v2->pMonsters[v2->uNumMonsters]
358  .pSpriteNames[(unsigned __int8)*(&v35 + v8)],
359  v25.pProperties[(unsigned __int8)*(&v27 + v8)]);
360  ++v8;
361  } while (v8 < 8);
362  v9 = atoi(v25.pProperties[8]);
363  v10 = v25.pProperties[9];
364  v2->pMonsters[v2->uNumMonsters].uMonsterHeight = v9;
365  v11 = atoi(v10);
366  v12 = v25.pProperties[10];
367  v2->pMonsters[v2->uNumMonsters].uMovementSpeed = v11;
368  v13 = atoi(v12);
369  v14 = v25.pProperties[11];
370  v2->pMonsters[v2->uNumMonsters].uMonsterRadius = v13;
371  v15 = atoi(v14);
372  v16 = v25.pProperties[12];
373  v2->pMonsters[v2->uNumMonsters].uToHitRadius = v15;
374  v17 = (unsigned __int8)atoi(v16);
375  Argsb = atoi(v25.pProperties[13]) & 0xFF;
376  v26 = atoi(v25.pProperties[14]) & 0xFF;
377  v18 = atoi(v25.pProperties[15]);
378  v2->pMonsters[v2->uNumMonsters].sTintColor =
379  v18 | ((v26 | ((Argsb | (v17 << 8)) << 8)) << 8);
380  v19 = 0;
381  do {
382  v20 = atoi(v25.pProperties[v19 + 16]);
383  v21 = v19++;
384  v2->pMonsters[v2->uNumMonsters].pSoundSampleIDs[v21] = v20;
385  } while (v19 < 4);
386  ++v2->uNumMonsters;
387  }
388  }
389  fclose(File);
390  return 1;
391 }

Перекрестные ссылки frame_table_txt_parser(), FrameTableTxtLine::pProperties и FrameTableTxtLine::uPropCount.

+ Граф вызовов:

Данные класса

◆ uNumMonsters

signed int MonsterList::uNumMonsters

См. определение в файле Monsters.h строка 236

Используется в FromFile(), GetMonsterIDByName(), MonsterStats::Initialize() и SpawnActor().

◆ pMonsters


Объявления и описания членов структур находятся в файлах:
FrameTableTxtLine::uPropCount
int uPropCount
Definition: FrameTableInc.h:12
FrameTableTxtLine::pProperties
const char * pProperties[30]
Definition: FrameTableInc.h:13
MonsterDesc_mm6
Definition: Monsters.h:203
frame_table_txt_parser
FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
Definition: FrameTableInc.cpp:69
src
GLenum src
Definition: SDL_opengl_glext.h:1740
v1
GLfloat GLfloat v1
Definition: SDL_opengl_glext.h:694
MonsterList
Definition: Monsters.h:226
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
MonsterDesc
Definition: Monsters.h:213
MonsterList::pMonsters
struct MonsterDesc * pMonsters
Definition: Monsters.h:237
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
uint
unsigned int uint
Definition: MM7.h:4
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
MonsterList::uNumMonsters
signed int uNumMonsters
Definition: Monsters.h:236
FrameTableTxtLine
Definition: FrameTableInc.h:11
MonsterDesc::uMonsterHeight
uint16_t uMonsterHeight
Definition: Monsters.h:214