Browse Source

Clean up SetMapMonsters.

pull/93/head
Sergey Semushin 7 years ago committed by Anders Jenbo
parent
commit
bd2d3eb931
  1. 74
      Source/monster.cpp
  2. 2
      Source/monster.h

74
Source/monster.cpp

@ -1388,57 +1388,41 @@ void PlaceUniques()
void SetMapMonsters(unsigned char *pMap, int startx, int starty) void SetMapMonsters(unsigned char *pMap, int startx, int starty)
{ {
unsigned char *v3; // esi WORD rw, rh;
unsigned short v4; // cx WORD *lm;
int v5; // edx int i, j;
int v6; // edi int mtype;
int v7; // ecx
unsigned char *v8; // edx
int i; // esi
int v10; // eax
int v11; // ecx
int v12; // [esp+Ch] [ebp-Ch]
int v13; // [esp+10h] [ebp-8h]
unsigned char *v14; // [esp+14h] [ebp-4h]
int startya; // [esp+20h] [ebp+8h]
v12 = startx;
v3 = pMap;
AddMonsterType(MT_GOLEM, 2); AddMonsterType(MT_GOLEM, 2);
AddMonster(1, 0, 0, 0, 0); AddMonster(1, 0, 0, 0, FALSE);
AddMonster(1, 0, 0, 0, 0); AddMonster(1, 0, 0, 0, FALSE);
AddMonster(1, 0, 0, 0, 0); AddMonster(1, 0, 0, 0, FALSE);
AddMonster(1, 0, 0, 0, 0); AddMonster(1, 0, 0, 0, FALSE);
if (setlevel && setlvlnum == SL_VILEBETRAYER) { if (setlevel && setlvlnum == SL_VILEBETRAYER) {
AddMonsterType((char)UniqMonst[4].mtype, 4); AddMonsterType(UniqMonst[4].mtype, 4);
AddMonsterType((char)UniqMonst[5].mtype, 4); AddMonsterType(UniqMonst[5].mtype, 4);
AddMonsterType((char)UniqMonst[6].mtype, 4); AddMonsterType(UniqMonst[6].mtype, 4);
PlaceUniqueMonst(4, 0, 0); PlaceUniqueMonst(4, 0, 0);
PlaceUniqueMonst(5, 0, 0); PlaceUniqueMonst(5, 0, 0);
PlaceUniqueMonst(6, 0, 0); PlaceUniqueMonst(6, 0, 0);
} }
v4 = *((_WORD *)v3 + 1); lm = (WORD*)pMap;
v5 = *(unsigned short *)v3 * v4; rw = *lm;
v6 = (unsigned short)(2 * *(_WORD *)v3); lm++;
v7 = (unsigned short)(2 * v4); rh = *lm;
v8 = &v3[2 * v5 + 4 + 2 * v7 * v6]; lm += (rw * rh + 1);
v14 = v8; rw = rw << 1;
if (v7 > 0) { rh = rh << 1;
v13 = v7; lm += rw * rh;
startya = starty + 16;
do { for (j = 0; j < rh; j++) {
for (i = 0; i < v6; v14 += 2) { for (i = 0; i < rw; i++) {
if (*(_WORD *)v8) { if (*lm) {
v10 = AddMonsterType(MonstConvTbl[*(unsigned short *)v8 - 1], 2); /* fix */ mtype = AddMonsterType(MonstConvTbl[(*lm) - 1], 2);
v11 = nummonsters++; PlaceMonster(nummonsters++, mtype, i + startx + 16, j + starty + 16);
PlaceMonster(v11, v10, i + v12 + 16, startya);
}
v8 = v14 + 2;
++i;
} }
++startya; lm++;
--v13; }
} while (v13);
} }
} }
// 5CF31D: using guessed type char setlevel; // 5CF31D: using guessed type char setlevel;
@ -1453,7 +1437,7 @@ void DeleteMonster(int i)
monstactive[i] = temp; monstactive[i] = temp;
} }
int AddMonster(int x, int y, int dir, int mtype, int InMap) int AddMonster(int x, int y, int dir, int mtype, BOOL InMap)
{ {
if (nummonsters < MAXMONSTERS) { if (nummonsters < MAXMONSTERS) {
int i = monstactive[nummonsters++]; int i = monstactive[nummonsters++];

2
Source/monster.h

@ -32,7 +32,7 @@ void InitMonsters();
void PlaceUniques(); void PlaceUniques();
void SetMapMonsters(unsigned char *pMap, int startx, int starty); void SetMapMonsters(unsigned char *pMap, int startx, int starty);
void DeleteMonster(int i); void DeleteMonster(int i);
int AddMonster(int x, int y, int dir, int mtype, int InMap); int AddMonster(int x, int y, int dir, int mtype, BOOL InMap);
void NewMonsterAnim(int i, AnimStruct *anim, int md); void NewMonsterAnim(int i, AnimStruct *anim, int md);
BOOL M_Ranged(int i); BOOL M_Ranged(int i);
BOOL M_Talker(int i); BOOL M_Talker(int i);

Loading…
Cancel
Save