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

Function AddChestTraps

Source/objects.cpp:520–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520void AddChestTraps()
521{
522 int i, j;
523 char oi;
524
525 for (j = 0; j < MAXDUNY; j++) {
526 for (i = 0; i < MAXDUNX; i++) {
527 if (dObject[i][j] > 0) {
528 oi = dObject[i][j] - 1;
529 if (object[oi]._otype >= OBJ_CHEST1 && object[oi]._otype <= OBJ_CHEST3 && !object[oi]._oTrapFlag && random_(0, 100) < 10) {
530 object[oi]._otype += OBJ_BOOKCASER;
531 object[oi]._oTrapFlag = TRUE;
532 if (leveltype == DTYPE_CATACOMBS) {
533 object[oi]._oVar4 = random_(0, 2);
534 } else {
535 object[oi]._oVar4 = random_(0, 3);
536 }
537 }
538 }
539 }
540 }
541}
542
543void LoadMapObjects(BYTE *pMap, int startx, int starty, int x1, int y1, int w, int h, int leveridx)
544{

Callers 1

InitObjectsFunction · 0.85

Calls 1

random_Function · 0.85

Tested by

no test coverage detected