Browse Source

Clean up drlg_l3.cpp

pull/100/head
Anders Jenbo 7 years ago
parent
commit
9504b5cf57
  1. 2
      Source/diablo.cpp
  2. 117
      Source/drlg_l3.cpp
  3. 86
      Source/drlg_l3.h

2
Source/diablo.cpp

@ -1606,7 +1606,7 @@ void LoadAllGFX()
void CreateLevel(int lvldir)
{
switch((unsigned char)leveltype) {
switch(leveltype) {
case DTYPE_TOWN:
CreateTown(lvldir);
InitTownTriggers();

117
Source/drlg_l3.cpp

@ -1,47 +1,47 @@
#include "diablo.h"
char lavapool; // weak
int abyssx; // weak
int lockoutcnt; // weak
BOOLEAN lavapool;
int abyssx;
int lockoutcnt;
BOOLEAN lockout[40][40];
const unsigned char L3ConvTbl[16] = { 8, 11, 3, 10, 1, 9, 12, 12, 6, 13, 4, 13, 2, 14, 5, 7 };
const unsigned char L3UP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 51, 50, 0, 48, 49, 0, 0, 0, 0 };
const unsigned char L3DOWN[20] = { 3, 3, 8, 9, 7, 8, 9, 7, 0, 0, 0, 0, 47, 0, 0, 46, 0, 0, 0, 0 };
const unsigned char L3HOLDWARP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 125, 125, 0, 125, 125, 0, 0, 0, 0 };
const unsigned char L3TITE1[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 57, 58, 0, 0, 56, 55, 0, 0, 0, 0, 0 };
const unsigned char L3TITE2[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 61, 62, 0, 0, 60, 59, 0, 0, 0, 0, 0 };
const unsigned char L3TITE3[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 65, 66, 0, 0, 64, 63, 0, 0, 0, 0, 0 };
const unsigned char L3TITE6[42] = { 5, 4, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 77, 78, 0, 0, 0, 76, 74, 75, 0, 0, 0, 0, 0, 0 };
const unsigned char L3TITE7[42] = { 4, 5, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 83, 0, 0, 0, 82, 80, 0, 0, 81, 79, 0, 0, 0, 0, 0 };
const unsigned char L3TITE8[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 52, 0, 0, 0, 0 };
const unsigned char L3TITE9[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 53, 0, 0, 0, 0 };
const unsigned char L3TITE10[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 54, 0, 0, 0, 0 };
const unsigned char L3TITE11[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 67, 0, 0, 0, 0 };
const unsigned char L3TITE12[6] = { 2u, 1u, 9u, 7u, 68u, 0u };
const unsigned char L3TITE13[6] = { 1u, 2u, 10u, 7u, 69u, 0u };
const unsigned char L3CREV1[6] = { 2u, 1u, 8u, 7u, 84u, 85u };
const unsigned char L3CREV2[6] = { 2u, 1u, 8u, 11u, 86u, 87u };
const unsigned char L3CREV3[6] = { 1u, 2u, 8u, 10u, 89u, 88u };
const unsigned char L3CREV4[6] = { 2u, 1u, 8u, 7u, 90u, 91u };
const unsigned char L3CREV5[6] = { 1u, 2u, 8u, 11u, 92u, 93u };
const unsigned char L3CREV6[6] = { 1u, 2u, 8u, 10u, 95u, 94u };
const unsigned char L3CREV7[6] = { 2u, 1u, 8u, 7u, 96u, 101u };
const unsigned char L3CREV8[6] = { 1u, 2u, 2u, 8u, 102u, 97u };
const unsigned char L3CREV9[6] = { 2u, 1u, 3u, 8u, 103u, 98u };
const unsigned char L3CREV10[6] = { 2u, 1u, 4u, 8u, 104u, 99u };
const unsigned char L3CREV11[6] = { 1u, 2u, 6u, 8u, 105u, 100u };
const unsigned char L3ISLE1[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const unsigned char L3ISLE2[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const unsigned char L3ISLE3[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 29u, 30u, 25u, 28u, 31u, 32u };
const unsigned char L3ISLE4[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 29u, 26u, 30u, 31u, 27u, 32u };
const unsigned char L3ISLE5[10] = { 2u, 2u, 5u, 14u, 13u, 12u, 7u, 7u, 7u, 7u };
const unsigned char L3XTRA1[4] = { 1u, 1u, 7u, 106u };
const unsigned char L3XTRA2[4] = { 1u, 1u, 7u, 107u };
const unsigned char L3XTRA3[4] = { 1u, 1u, 7u, 108u };
const unsigned char L3XTRA4[4] = { 1u, 1u, 9u, 109u };
const unsigned char L3XTRA5[4] = { 1u, 1u, 10u, 110u };
const unsigned char L3ANVIL[244] = {
const BYTE L3ConvTbl[16] = { 8, 11, 3, 10, 1, 9, 12, 12, 6, 13, 4, 13, 2, 14, 5, 7 };
const BYTE L3UP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 51, 50, 0, 48, 49, 0, 0, 0, 0 };
const BYTE L3DOWN[20] = { 3, 3, 8, 9, 7, 8, 9, 7, 0, 0, 0, 0, 47, 0, 0, 46, 0, 0, 0, 0 };
const BYTE L3HOLDWARP[20] = { 3, 3, 8, 8, 0, 10, 10, 0, 7, 7, 0, 125, 125, 0, 125, 125, 0, 0, 0, 0 };
const BYTE L3TITE1[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 57, 58, 0, 0, 56, 55, 0, 0, 0, 0, 0 };
const BYTE L3TITE2[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 61, 62, 0, 0, 60, 59, 0, 0, 0, 0, 0 };
const BYTE L3TITE3[34] = { 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 65, 66, 0, 0, 64, 63, 0, 0, 0, 0, 0 };
const BYTE L3TITE6[42] = { 5, 4, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 77, 78, 0, 0, 0, 76, 74, 75, 0, 0, 0, 0, 0, 0 };
const BYTE L3TITE7[42] = { 4, 5, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 83, 0, 0, 0, 82, 80, 0, 0, 81, 79, 0, 0, 0, 0, 0 };
const BYTE L3TITE8[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 52, 0, 0, 0, 0 };
const BYTE L3TITE9[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 53, 0, 0, 0, 0 };
const BYTE L3TITE10[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 54, 0, 0, 0, 0 };
const BYTE L3TITE11[20] = { 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 67, 0, 0, 0, 0 };
const BYTE L3TITE12[6] = { 2u, 1u, 9u, 7u, 68u, 0u };
const BYTE L3TITE13[6] = { 1u, 2u, 10u, 7u, 69u, 0u };
const BYTE L3CREV1[6] = { 2u, 1u, 8u, 7u, 84u, 85u };
const BYTE L3CREV2[6] = { 2u, 1u, 8u, 11u, 86u, 87u };
const BYTE L3CREV3[6] = { 1u, 2u, 8u, 10u, 89u, 88u };
const BYTE L3CREV4[6] = { 2u, 1u, 8u, 7u, 90u, 91u };
const BYTE L3CREV5[6] = { 1u, 2u, 8u, 11u, 92u, 93u };
const BYTE L3CREV6[6] = { 1u, 2u, 8u, 10u, 95u, 94u };
const BYTE L3CREV7[6] = { 2u, 1u, 8u, 7u, 96u, 101u };
const BYTE L3CREV8[6] = { 1u, 2u, 2u, 8u, 102u, 97u };
const BYTE L3CREV9[6] = { 2u, 1u, 3u, 8u, 103u, 98u };
const BYTE L3CREV10[6] = { 2u, 1u, 4u, 8u, 104u, 99u };
const BYTE L3CREV11[6] = { 1u, 2u, 6u, 8u, 105u, 100u };
const BYTE L3ISLE1[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const BYTE L3ISLE2[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 7u, 7u, 7u, 7u, 7u, 7u };
const BYTE L3ISLE3[14] = { 2u, 3u, 5u, 14u, 4u, 9u, 13u, 12u, 29u, 30u, 25u, 28u, 31u, 32u };
const BYTE L3ISLE4[14] = { 3u, 2u, 5u, 2u, 14u, 13u, 10u, 12u, 29u, 26u, 30u, 31u, 27u, 32u };
const BYTE L3ISLE5[10] = { 2u, 2u, 5u, 14u, 13u, 12u, 7u, 7u, 7u, 7u };
const BYTE L3XTRA1[4] = { 1u, 1u, 7u, 106u };
const BYTE L3XTRA2[4] = { 1u, 1u, 7u, 107u };
const BYTE L3XTRA3[4] = { 1u, 1u, 7u, 108u };
const BYTE L3XTRA4[4] = { 1u, 1u, 9u, 109u };
const BYTE L3XTRA5[4] = { 1u, 1u, 10u, 110u };
const BYTE L3ANVIL[244] = {
11, 11, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
@ -201,8 +201,6 @@ BOOL DRLG_L3Anvil()
return FALSE;
}
// 5CF330: using guessed type int setpc_h;
// 5CF334: using guessed type int setpc_w;
void FixL3Warp()
{
@ -264,7 +262,6 @@ void DRLG_L3LockRec(int x, int y)
DRLG_L3LockRec(x - 1, y);
DRLG_L3LockRec(x + 1, y);
}
// 528380: using guessed type int lockoutcnt;
BOOL DRLG_L3Lockout()
{
@ -289,9 +286,8 @@ BOOL DRLG_L3Lockout()
return t == lockoutcnt;
}
// 528380: using guessed type int lockoutcnt;
void CreateL3Dungeon(unsigned int rseed, int entry)
void CreateL3Dungeon(int rseed, int entry)
{
int i, j;
@ -321,10 +317,6 @@ void CreateL3Dungeon(unsigned int rseed, int entry)
DRLG_SetPC();
}
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void DRLG_L3(int entry)
{
@ -458,7 +450,6 @@ void DRLG_L3(int entry)
DRLG_Init_Globals();
}
// 528378: using guessed type char lavapool;
void InitL3Dungeon()
{
@ -1032,8 +1023,8 @@ void DRLG_L3Pool()
{
int i, j, dunx, duny, totarea, poolchance;
BOOL found;
unsigned char k;
static unsigned char poolsub[15] = { 0, 35, 26, 36, 25, 29, 34, 7, 33, 28, 27, 37, 32, 31, 30 };
BYTE k;
static BYTE poolsub[15] = { 0, 35, 26, 36, 25, 29, 34, 7, 33, 28, 27, 37, 32, 31, 30 };
for(duny = 0; duny < 40; duny++) {
for(dunx = 0; dunx < 40; dunx++) {
@ -1072,7 +1063,7 @@ void DRLG_L3Pool()
if(k != 0 && k <= 37) {
dungeon[i][j] = k;
}
lavapool = 1;
lavapool = TRUE;
}
}
}
@ -1080,12 +1071,11 @@ void DRLG_L3Pool()
}
}
}
// 528378: using guessed type char lavapool;
BOOL DRLG_L3SpawnEdge(int x, int y, int *totarea)
{
unsigned char i;
static unsigned char spawntable[15] = { 0, 10, 3, 5, 12, 6, 9, 0, 0, 12, 3, 6, 9, 10, 5 };
BYTE i;
static BYTE spawntable[15] = { 0, 10, 3, 5, 12, 6, 9, 0, 0, 12, 3, 6, 9, 10, 5 };
if(*totarea > 40) {
return TRUE;
@ -1137,8 +1127,8 @@ BOOL DRLG_L3SpawnEdge(int x, int y, int *totarea)
BOOL DRLG_L3Spawn(int x, int y, int *totarea)
{
unsigned char i;
static unsigned char spawntable[15] = { 0, 10, 67, 5, 44, 6, 9, 0, 0, 28, 131, 6, 9, 10, 5 };
BYTE i;
static BYTE spawntable[15] = { 0, 10, 67, 5, 44, 6, 9, 0, 0, 28, 131, 6, 9, 10, 5 };
if(*totarea > 40) {
return TRUE;
@ -1207,7 +1197,7 @@ void DRLG_L3PoolFix()
}
}
BOOL DRLG_L3PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir)
BOOL DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir)
{
int sx, sy, sw, sh, xx, yy, i, ii, numt, trys;
BOOL found;
@ -1287,10 +1277,8 @@ BOOL DRLG_L3PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int c
return FALSE;
}
// 5CF320: using guessed type int LvlViewY;
// 5CF324: using guessed type int LvlViewX;
void DRLG_L3PlaceRndSet(const unsigned char *miniset, int rndper)
void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper)
{
int sx, sy, sw, sh, xx, yy, ii, kk;
BOOL found;
@ -1790,11 +1778,6 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy)
mem_free_dbg(pLevelMap);
}
// 52837C: using guessed type int abyssx;
// 5CF328: using guessed type int dmaxx;
// 5CF32C: using guessed type int dmaxy;
// 5D2458: using guessed type int dminx;
// 5D245C: using guessed type int dminy;
void LoadPreL3Dungeon(char *sFileName, int vx, int vy)
{

86
Source/drlg_l3.h

@ -2,9 +2,9 @@
#ifndef __DRLG_L3_H__
#define __DRLG_L3_H__
extern char lavapool; // weak
extern int abyssx; // weak
extern int lockoutcnt; // weak
extern BOOLEAN lavapool;
extern int abyssx;
extern int lockoutcnt;
extern BOOLEAN lockout[40][40];
void AddFenceDoors();
@ -14,7 +14,7 @@ void FixL3Warp();
void FixL3HallofHeroes();
void DRLG_L3LockRec(int x, int y);
BOOL DRLG_L3Lockout();
void CreateL3Dungeon(unsigned int rseed, int entry);
void CreateL3Dungeon( int rseed, int entry);
void DRLG_L3(int entry);
void InitL3Dungeon();
BOOL DRLG_L3FillRoom(int x1, int y1, int x2, int y2);
@ -31,8 +31,8 @@ void DRLG_L3Pool();
BOOL DRLG_L3SpawnEdge(int x, int y, int *totarea);
BOOL DRLG_L3Spawn(int x, int y, int *totarea);
void DRLG_L3PoolFix();
BOOL DRLG_L3PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir);
void DRLG_L3PlaceRndSet(const unsigned char *miniset, int rndper);
BOOL DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, BOOL setview, int ldir);
void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper);
void DRLG_L3Wood();
BOOL WoodVertU(int i, int y);
BOOL WoodVertD(int i, int y);
@ -43,42 +43,42 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy);
void LoadPreL3Dungeon(char *sFileName, int vx, int vy);
/* rdata */
extern const unsigned char L3ConvTbl[16];
extern const unsigned char L3UP[20];
extern const unsigned char L3DOWN[20];
extern const unsigned char L3HOLDWARP[20];
extern const unsigned char L3TITE1[34];
extern const unsigned char L3TITE2[34];
extern const unsigned char L3TITE3[34];
extern const unsigned char L3TITE6[42];
extern const unsigned char L3TITE7[42];
extern const unsigned char L3TITE8[20];
extern const unsigned char L3TITE9[20];
extern const unsigned char L3TITE10[20];
extern const unsigned char L3TITE11[20];
extern const unsigned char L3TITE12[6];
extern const unsigned char L3TITE13[6];
extern const unsigned char L3CREV1[6];
extern const unsigned char L3CREV2[6];
extern const unsigned char L3CREV3[6];
extern const unsigned char L3CREV4[6];
extern const unsigned char L3CREV5[6];
extern const unsigned char L3CREV6[6];
extern const unsigned char L3CREV7[6];
extern const unsigned char L3CREV8[6];
extern const unsigned char L3CREV9[6];
extern const unsigned char L3CREV10[6];
extern const unsigned char L3CREV11[6];
extern const unsigned char L3ISLE1[14];
extern const unsigned char L3ISLE2[14];
extern const unsigned char L3ISLE3[14];
extern const unsigned char L3ISLE4[14];
extern const unsigned char L3ISLE5[10];
extern const unsigned char L3XTRA1[4];
extern const unsigned char L3XTRA2[4];
extern const unsigned char L3XTRA3[4];
extern const unsigned char L3XTRA4[4];
extern const unsigned char L3XTRA5[4];
extern const unsigned char L3ANVIL[244];
extern const BYTE L3ConvTbl[16];
extern const BYTE L3UP[20];
extern const BYTE L3DOWN[20];
extern const BYTE L3HOLDWARP[20];
extern const BYTE L3TITE1[34];
extern const BYTE L3TITE2[34];
extern const BYTE L3TITE3[34];
extern const BYTE L3TITE6[42];
extern const BYTE L3TITE7[42];
extern const BYTE L3TITE8[20];
extern const BYTE L3TITE9[20];
extern const BYTE L3TITE10[20];
extern const BYTE L3TITE11[20];
extern const BYTE L3TITE12[6];
extern const BYTE L3TITE13[6];
extern const BYTE L3CREV1[6];
extern const BYTE L3CREV2[6];
extern const BYTE L3CREV3[6];
extern const BYTE L3CREV4[6];
extern const BYTE L3CREV5[6];
extern const BYTE L3CREV6[6];
extern const BYTE L3CREV7[6];
extern const BYTE L3CREV8[6];
extern const BYTE L3CREV9[6];
extern const BYTE L3CREV10[6];
extern const BYTE L3CREV11[6];
extern const BYTE L3ISLE1[14];
extern const BYTE L3ISLE2[14];
extern const BYTE L3ISLE3[14];
extern const BYTE L3ISLE4[14];
extern const BYTE L3ISLE5[10];
extern const BYTE L3XTRA1[4];
extern const BYTE L3XTRA2[4];
extern const BYTE L3XTRA3[4];
extern const BYTE L3XTRA4[4];
extern const BYTE L3XTRA5[4];
extern const BYTE L3ANVIL[244];
#endif /* __DRLG_L3_H__ */

Loading…
Cancel
Save