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

Function Theme_Barrel

Source/themes.cpp:514–535  ·  view source on GitHub ↗

Theme_Barrel initializes the barrel theme. Parameters: - t: theme number (index into themes array).

Source from the content-addressed store, hash-verified

512// Parameters:
513// - t: theme number (index into themes array).
514void Theme_Barrel(int t)
515{
516 int xp, yp, r;
517 char barrnd[4] = { 2, 6, 4, 8 };
518 char monstrnd[4] = { 5, 7, 3, 9 };
519
520 for (yp = 0; yp < MAXDUNY; yp++) {
521 for (xp = 0; xp < MAXDUNX; xp++) {
522 if (dTransVal[xp][yp] == themes[t].ttval && !nSolidTable[dPiece[xp][yp]]) {
523 if (random_(0, barrnd[leveltype - 1]) == 0) {
524 if (random_(0, barrnd[leveltype - 1]) == 0) {
525 r = OBJ_BARREL;
526 } else {
527 r = OBJ_BARRELEX;
528 }
529 AddObject(r, xp, yp);
530 }
531 }
532 }
533 }
534 PlaceThemeMonsts(t, monstrnd[leveltype - 1]);
535}
536
537// Theme_Shrine initializes the shrine theme.
538//

Callers 1

CreateThemeRoomsFunction · 0.85

Calls 3

random_Function · 0.85
AddObjectFunction · 0.85
PlaceThemeMonstsFunction · 0.85

Tested by

no test coverage detected