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

Function T_FillSector

Source/town.cpp:3–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "all.h"
2
3DEVILUTION_BEGIN_NAMESPACE
4
5/**
6 * @brief Load level data into dPiece
7 * @param P3Tiles Tile set
8 * @param pSector Sector data
9 * @param xi upper left destination
10 * @param yi upper left destination
11 * @param w width of sector
12 * @param h height of sector
13 */
14void T_FillSector(BYTE *P3Tiles, BYTE *pSector, int xi, int yi, int w, int h)
15{
16 int i, j, xx, yy, nMap;
17 long v1, v2, v3, v4, ii;
18 WORD *Sector;
19
20 ii = 4;
21 yy = yi;
22 for (j = 0; j < h; j++) {
23 xx = xi;
24 for (i = 0; i < w; i++) {
25 WORD *Map;
26
27 Map = (WORD *)&pSector[ii];
28 nMap = SDL_SwapLE16(*Map);
29 if (nMap) {
30 Sector = (((WORD *)&P3Tiles[(nMap - 1) * 8]));
31 v1 = SDL_SwapLE16(*(Sector + 0)) + 1;
32 v2 = SDL_SwapLE16(*(Sector + 1)) + 1;
33 v3 = SDL_SwapLE16(*(Sector + 2)) + 1;
34 v4 = SDL_SwapLE16(*(Sector + 3)) + 1;
35
36 } else {
37 v1 = 0;
38 v2 = 0;
39 v3 = 0;
40 v4 = 0;
41 }
42 dPiece[xx][yy] = v1;
43 dPiece[xx + 1][yy] = v2;
44 dPiece[xx][yy + 1] = v3;
45 dPiece[xx + 1][yy + 1] = v4;
46 xx += 2;
47 ii += 2;
48 }
49 yy += 2;
50 }
51}
52
53/**
54 * @brief Load a tile in to dPiece

Callers 1

town.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected