Browse Source

Cleanup DRLG Pass3 (#719)

pull/72/head
galaxyhaxz 7 years ago committed by Robin Eklind
parent
commit
b10b206efd
  1. 151
      Source/drlg_l2.cpp
  2. 172
      Source/drlg_l3.cpp
  3. 174
      Source/drlg_l4.cpp

151
Source/drlg_l2.cpp

@ -521,77 +521,86 @@ void __fastcall LoadL2Dungeon(char *sFileName, int vx, int vy)
void __cdecl DRLG_L2Pass3() void __cdecl DRLG_L2Pass3()
{ {
int v0; // eax int i, j, xx, yy;
int *v1; // edx long v1, v2, v3, v4, lv;
int *v2; // eax
signed int v3; // ecx lv = 12-1;
signed int v4; // ebx
int *v5; // ecx #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
unsigned char *v6; // edx __asm {
unsigned short *v7; // esi mov esi, pMegaTiles
unsigned short v8; // ax mov eax, lv
int v9; // eax shl eax, 3
int v10; // ST24_4 add esi, eax
int v11; // ST20_4 xor eax, eax
int v12; // ST1C_4 lodsw
signed int v13; // [esp+Ch] [ebp-1Ch] inc eax
int *v14; // [esp+10h] [ebp-18h] mov v1, eax
int v15; // [esp+14h] [ebp-14h] lodsw
int v16; // [esp+18h] [ebp-10h] inc eax
int v17; // [esp+1Ch] [ebp-Ch] mov v2, eax
int v18; // [esp+20h] [ebp-8h] lodsw
inc eax
v0 = *((unsigned short *)pMegaTiles + 44) + 1; mov v3, eax
v18 = *((unsigned short *)pMegaTiles + 44) + 1; lodsw
_LOWORD(v0) = *((_WORD *)pMegaTiles + 45); inc eax
v17 = ++v0; mov v4, eax
_LOWORD(v0) = *((_WORD *)pMegaTiles + 46); }
v16 = ++v0; #else
_LOWORD(v0) = *((_WORD *)pMegaTiles + 47); v1 = *((WORD *)&pMegaTiles[lv*8])+1;
v15 = v0 + 1; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
v1 = dPiece[1]; v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
do { v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
v2 = v1; #endif
v3 = 56;
do { for(j = 0; j < MAXDUNY; j += 2) {
*(v2 - 112) = v18; for(i = 0; i < MAXDUNX; i += 2) {
*v2 = v17; dPiece[i][j] = v1;
*(v2 - 111) = v16; dPiece[i+1][j] = v2;
v2[1] = v15; dPiece[i][j+1] = v3;
v2 += 224; dPiece[i+1][j+1] = v4;
--v3; }
} while (v3); }
v1 += 2;
} while ((signed int)v1 < (signed int)dPiece[2]); yy = 16;
v4 = 0; for(j = 0; j < DMAXY; j++) {
v14 = &dPiece[17][16]; xx = 16;
do { for(i = 0; i < DMAXX; i++) {
v5 = v14; lv = (unsigned char)dungeon[i][j]-1;
v6 = (unsigned char *)dungeon + v4; #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
v13 = 40; __asm {
do { mov esi, pMegaTiles
v7 = (unsigned short *)((char *)pMegaTiles + 8 * (*v6 - 1)); mov eax, lv
v8 = *v7; shl eax, 3
++v7; add esi, eax
v9 = v8 + 1; xor eax, eax
v10 = v9; lodsw
_LOWORD(v9) = *v7; inc eax
++v7; mov v1, eax
v11 = ++v9; lodsw
_LOWORD(v9) = *v7; inc eax
v12 = ++v9; mov v2, eax
_LOWORD(v9) = v7[1]; lodsw
v6 += 40; inc eax
*(v5 - 112) = v10; mov v3, eax
*v5 = v11; lodsw
*(v5 - 111) = v12; inc eax
v5[1] = v9 + 1; mov v4, eax
v5 += 224; }
--v13; #else
} while (v13); v1 = *((WORD *)&pMegaTiles[lv*8])+1;
v14 += 2; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
++v4; v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
} while (v4 < 40); v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
#endif
dPiece[xx][yy] = v1;
dPiece[xx+1][yy] = v2;
dPiece[xx][yy+1] = v3;
dPiece[xx+1][yy+1] = v4;
xx += 2;
}
yy += 2;
}
} }
void __fastcall LoadPreL2Dungeon(char *sFileName, int vx, int vy) void __fastcall LoadPreL2Dungeon(char *sFileName, int vx, int vy)

172
Source/drlg_l3.cpp

@ -2334,88 +2334,100 @@ BOOLEAN __fastcall WoodHorizR(int x, int j)
void __cdecl DRLG_L3Pass3() void __cdecl DRLG_L3Pass3()
{ {
int v0; // eax int i, j, xx, yy;
int *v1; // esi long v1, v2, v3, v4, lv;
int *v2; // eax
signed int v3; // ecx lv = 8-1;
signed int v4; // ebx
int *v5; // ecx #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
unsigned char *v6; // edi __asm {
unsigned short *v7; // esi mov esi, pMegaTiles
unsigned short v8; // ax mov eax, lv
int v9; // eax shl eax, 3
signed int v10; // [esp+Ch] [ebp-1Ch] add esi, eax
int *v11; // [esp+10h] [ebp-18h] xor eax, eax
int v12; // [esp+14h] [ebp-14h] lodsw
int v13; // [esp+18h] [ebp-10h] inc eax
int v14; // [esp+18h] [ebp-10h] mov v1, eax
int v15; // [esp+1Ch] [ebp-Ch] lodsw
int v16; // [esp+1Ch] [ebp-Ch] inc eax
int v17; // [esp+20h] [ebp-8h] mov v2, eax
int v18; // [esp+20h] [ebp-8h] lodsw
int v19; // [esp+24h] [ebp-4h] inc eax
int v20; // [esp+24h] [ebp-4h] mov v3, eax
lodsw
v0 = *((unsigned short *)pMegaTiles + 28) + 1; inc eax
v19 = *((unsigned short *)pMegaTiles + 28) + 1; mov v4, eax
_LOWORD(v0) = *((_WORD *)pMegaTiles + 29); }
v17 = ++v0; #else
_LOWORD(v0) = *((_WORD *)pMegaTiles + 30); v1 = *((WORD *)&pMegaTiles[lv*8])+1;
v15 = ++v0; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
_LOWORD(v0) = *((_WORD *)pMegaTiles + 31); v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
v13 = v0 + 1; v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
v1 = dPiece[1]; #endif
do {
v2 = v1; for(j = 0; j < MAXDUNY; j += 2) {
v3 = 56; for(i = 0; i < MAXDUNX; i += 2) {
do { dPiece[i][j] = v1;
*(v2 - 112) = v19; dPiece[i+1][j] = v2;
*v2 = v17; dPiece[i][j+1] = v3;
*(v2 - 111) = v15; dPiece[i+1][j+1] = v4;
v2[1] = v13; }
v2 += 224; }
--v3;
} while (v3); yy = 16;
v1 += 2; for(j = 0; j < DMAXY; j++) {
} while ((signed int)v1 < (signed int)dPiece[2]); xx = 16;
v4 = 0; for(i = 0; i < DMAXX; i++) {
v11 = &dPiece[17][16]; lv = (unsigned char)dungeon[i][j]-1;
do { #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
v5 = v11; if(lv >= 0) {
v6 = (unsigned char *)dungeon + v4; __asm {
v10 = 40; mov esi, pMegaTiles
do { mov eax, lv
v12 = *v6 - 1; shl eax, 3
if (v12 < 0) { add esi, eax
v20 = 0; xor eax, eax
v18 = 0; lodsw
v16 = 0; inc eax
v14 = 0; mov v1, eax
lodsw
inc eax
mov v2, eax
lodsw
inc eax
mov v3, eax
lodsw
inc eax
mov v4, eax
}
} else { } else {
v7 = (unsigned short *)((char *)pMegaTiles + 8 * v12); v1 = 0;
v8 = *v7; v2 = 0;
++v7; v3 = 0;
v9 = v8 + 1; v4 = 0;
v20 = v9;
_LOWORD(v9) = *v7;
++v7;
v18 = ++v9;
_LOWORD(v9) = *v7;
v16 = ++v9;
_LOWORD(v9) = v7[1];
v14 = v9 + 1;
} }
v6 += 40; #else
*(v5 - 112) = v20; if(lv >= 0) {
*v5 = v18; v1 = *((WORD *)&pMegaTiles[lv*8])+1;
*(v5 - 111) = v16; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
v5[1] = v14; v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
v5 += 224; v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
--v10; } else {
} while (v10); v1 = 0;
v11 += 2; v2 = 0;
++v4; v3 = 0;
} while (v4 < 40); v4 = 0;
}
#endif
dPiece[xx][yy] = v1;
dPiece[xx+1][yy] = v2;
dPiece[xx][yy+1] = v3;
dPiece[xx+1][yy+1] = v4;
xx += 2;
}
yy += 2;
}
} }
void __fastcall LoadL3Dungeon(char *sFileName, int vx, int vy) void __fastcall LoadL3Dungeon(char *sFileName, int vx, int vy)

174
Source/drlg_l4.cpp

@ -2856,86 +2856,98 @@ void __cdecl DRLG_L4Corners()
void __cdecl DRLG_L4Pass3() void __cdecl DRLG_L4Pass3()
{ {
int v0; // eax int i, j, xx, yy;
int *v1; // esi long v1, v2, v3, v4, lv;
int *v2; // eax
signed int v3; // ecx lv = 30-1;
signed int v4; // ebx
int *v5; // ecx #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
unsigned char *v6; // edi __asm {
unsigned short *v7; // esi mov esi, pMegaTiles
unsigned short v8; // ax mov eax, lv
int v9; // eax shl eax, 3
signed int v10; // [esp+Ch] [ebp-1Ch] add esi, eax
int *v11; // [esp+10h] [ebp-18h] xor eax, eax
int v12; // [esp+14h] [ebp-14h] lodsw
int v13; // [esp+18h] [ebp-10h] inc eax
int v14; // [esp+18h] [ebp-10h] mov v1, eax
int v15; // [esp+1Ch] [ebp-Ch] lodsw
int v16; // [esp+1Ch] [ebp-Ch] inc eax
int v17; // [esp+20h] [ebp-8h] mov v2, eax
int v18; // [esp+20h] [ebp-8h] lodsw
int v19; // [esp+24h] [ebp-4h] inc eax
int v20; // [esp+24h] [ebp-4h] mov v3, eax
lodsw
v0 = *((unsigned short *)pMegaTiles + 116) + 1; inc eax
v19 = *((unsigned short *)pMegaTiles + 116) + 1; mov v4, eax
_LOWORD(v0) = *((_WORD *)pMegaTiles + 117); }
v17 = ++v0; #else
_LOWORD(v0) = *((_WORD *)pMegaTiles + 118); v1 = *((WORD *)&pMegaTiles[lv*8])+1;
v15 = ++v0; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
_LOWORD(v0) = *((_WORD *)pMegaTiles + 119); v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
v13 = v0 + 1; v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
v1 = dPiece[1]; #endif
do {
v2 = v1; for(j = 0; j < MAXDUNY; j += 2) {
v3 = 56; for(i = 0; i < MAXDUNX; i += 2) {
do { dPiece[i][j] = v1;
*(v2 - 112) = v19; dPiece[i+1][j] = v2;
*v2 = v17; dPiece[i][j+1] = v3;
*(v2 - 111) = v15; dPiece[i+1][j+1] = v4;
v2[1] = v13; }
v2 += 224; }
--v3;
} while (v3); yy = 16;
v1 += 2; for(j = 0; j < DMAXY; j++) {
} while ((signed int)v1 < (signed int)dPiece[2]); xx = 16;
v4 = 0; for(i = 0; i < DMAXX; i++) {
v11 = &dPiece[17][16]; lv = (unsigned char)dungeon[i][j]-1;
do { #if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
v5 = v11; if(lv >= 0) {
v6 = (unsigned char *)dungeon + v4; __asm {
v10 = 40; mov esi, pMegaTiles
do { mov eax, lv
v12 = *v6 - 1; shl eax, 3
if (v12 < 0) { add esi, eax
v20 = 0; xor eax, eax
v18 = 0; lodsw
v16 = 0; inc eax
v14 = 0; mov v1, eax
lodsw
inc eax
mov v2, eax
lodsw
inc eax
mov v3, eax
lodsw
inc eax
mov v4, eax
}
} else { } else {
v7 = (unsigned short *)((char *)pMegaTiles + 8 * v12); v1 = 0;
v8 = *v7; v2 = 0;
++v7; v3 = 0;
v9 = v8 + 1; v4 = 0;
v20 = v9; }
_LOWORD(v9) = *v7; #else
++v7; if(lv >= 0) {
v18 = ++v9; v1 = *((WORD *)&pMegaTiles[lv*8])+1;
_LOWORD(v9) = *v7; v2 = *((WORD *)&pMegaTiles[lv*8]+1)+1;
v16 = ++v9; v3 = *((WORD *)&pMegaTiles[lv*8]+2)+1;
_LOWORD(v9) = v7[1]; v4 = *((WORD *)&pMegaTiles[lv*8]+3)+1;
v14 = v9 + 1; } else {
} v1 = 0;
v6 += 40; v2 = 0;
*(v5 - 112) = v20; v3 = 0;
*v5 = v18; v4 = 0;
*(v5 - 111) = v16; }
v5[1] = v14; #endif
v5 += 224; dPiece[xx][yy] = v1;
--v10; dPiece[xx+1][yy] = v2;
} while (v10); dPiece[xx][yy+1] = v3;
v11 += 2; dPiece[xx+1][yy+1] = v4;
++v4; xx += 2;
} while (v4 < 40); }
yy += 2;
}
} }

Loading…
Cancel
Save