MCPcopy Create free account
hub / github.com/diasurgical/devilution / LoadPreL2Dungeon

Function LoadPreL2Dungeon

Source/drlg_l2.cpp:2033–2080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2031}
2032
2033void LoadPreL2Dungeon(char *sFileName, int vx, int vy)
2034{
2035 int i, j, rw, rh;
2036 BYTE *pLevelMap, *lm;
2037
2038 InitDungeon();
2039 DRLG_InitTrans();
2040 pLevelMap = LoadFileInMem(sFileName, NULL);
2041
2042 for (j = 0; j < DMAXY; j++) {
2043 for (i = 0; i < DMAXX; i++) {
2044 dungeon[i][j] = 12;
2045 dflags[i][j] = 0;
2046 }
2047 }
2048
2049 lm = pLevelMap;
2050 rw = *lm;
2051 lm += 2;
2052 rh = *lm;
2053 lm += 2;
2054
2055 for (j = 0; j < rh; j++) {
2056 for (i = 0; i < rw; i++) {
2057 if (*lm != 0) {
2058 dungeon[i][j] = *lm;
2059 dflags[i][j] |= DLRG_PROTECTED;
2060 } else {
2061 dungeon[i][j] = 3;
2062 }
2063 lm += 2;
2064 }
2065 }
2066 for (j = 0; j < DMAXY; j++) {
2067 for (i = 0; i < DMAXX; i++) {
2068 if (dungeon[i][j] == 0) {
2069 dungeon[i][j] = 12;
2070 }
2071 }
2072 }
2073 for (j = 0; j < DMAXY; j++) {
2074 for (i = 0; i < DMAXX; i++) {
2075 pdungeon[i][j] = dungeon[i][j];
2076 }
2077 }
2078
2079 mem_free_dbg(pLevelMap);
2080}
2081
2082void CreateL2Dungeon(DWORD rseed, int entry)
2083{

Callers 1

LoadSetMapFunction · 0.85

Calls 4

InitDungeonFunction · 0.85
DRLG_InitTransFunction · 0.85
LoadFileInMemFunction · 0.85
mem_free_dbgFunction · 0.85

Tested by

no test coverage detected