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

Function LoadLevel

Source/loadsave.cpp:1632–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1630}
1631
1632void LoadLevel()
1633{
1634 int i, j;
1635 DWORD dwLen;
1636 char szName[MAX_PATH];
1637 BYTE *LoadBuff;
1638
1639 GetPermLevelNames(szName);
1640 LoadBuff = pfile_read(szName, &dwLen);
1641 tbuff = LoadBuff;
1642
1643 if (leveltype != DTYPE_TOWN) {
1644 for (j = 0; j < MAXDUNY; j++) {
1645 for (i = 0; i < MAXDUNX; i++)
1646 dDead[i][j] = BLoad();
1647 }
1648 SetDead();
1649 }
1650
1651 nummonsters = WLoad();
1652 numitems = WLoad();
1653 nobjects = WLoad();
1654
1655 if (leveltype != DTYPE_TOWN) {
1656 for (i = 0; i < MAXMONSTERS; i++)
1657 monstactive[i] = WLoad();
1658 for (i = 0; i < nummonsters; i++)
1659 LoadMonster(monstactive[i]);
1660 for (i = 0; i < MAXOBJECTS; i++)
1661 objectactive[i] = BLoad();
1662 for (i = 0; i < MAXOBJECTS; i++)
1663 objectavail[i] = BLoad();
1664 for (i = 0; i < nobjects; i++)
1665 LoadObject(objectactive[i]);
1666 for (i = 0; i < nobjects; i++)
1667 SyncObjectAnim(objectactive[i]);
1668 }
1669
1670 for (i = 0; i < MAXITEMS; i++)
1671 itemactive[i] = BLoad();
1672 for (i = 0; i < MAXITEMS; i++)
1673 itemavail[i] = BLoad();
1674 for (i = 0; i < numitems; i++)
1675 LoadItem(itemactive[i]);
1676
1677 for (j = 0; j < MAXDUNY; j++) {
1678 for (i = 0; i < MAXDUNX; i++)
1679 dFlags[i][j] = BLoad();
1680 }
1681 for (j = 0; j < MAXDUNY; j++) {
1682 for (i = 0; i < MAXDUNX; i++)
1683 dItem[i][j] = BLoad();
1684 }
1685
1686 if (leveltype != DTYPE_TOWN) {
1687 for (j = 0; j < MAXDUNY; j++) {
1688 for (i = 0; i < MAXDUNX; i++)
1689 dMonster[i][j] = WLoad();

Callers 1

LoadGameLevelFunction · 0.85

Calls 14

GetPermLevelNamesFunction · 0.85
pfile_readFunction · 0.85
BLoadFunction · 0.85
SetDeadFunction · 0.85
WLoadFunction · 0.85
LoadMonsterFunction · 0.85
LoadObjectFunction · 0.85
SyncObjectAnimFunction · 0.85
LoadItemFunction · 0.85
OLoadFunction · 0.85
AutomapZoomResetFunction · 0.85
ResyncQuestsFunction · 0.85

Tested by

no test coverage detected