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

Function AddInitItems

Source/items.cpp:219–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void AddInitItems()
220{
221 int x, y, i, j, rnd;
222
223 rnd = random_(11, 3) + 3;
224 for (j = 0; j < rnd; j++) {
225 i = itemavail[0];
226 itemavail[0] = itemavail[MAXITEMS - numitems - 1];
227 itemactive[numitems] = i;
228 x = random_(12, 80) + 16;
229 y = random_(12, 80) + 16;
230 while (!ItemPlace(x, y)) {
231 x = random_(12, 80) + 16;
232 y = random_(12, 80) + 16;
233 }
234 item[i]._ix = x;
235 item[i]._iy = y;
236 dItem[x][y] = i + 1;
237 item[i]._iSeed = GetRndSeed();
238 SetRndSeed(item[i]._iSeed);
239 if (random_(12, 2))
240 GetItemAttrs(i, IDI_HEAL, currlevel);
241 else
242 GetItemAttrs(i, IDI_MANA, currlevel);
243 item[i]._iCreateInfo = currlevel - 0x8000;
244 SetupItem(i);
245 item[i]._iAnimFrame = item[i]._iAnimLen;
246 item[i]._iAnimFlag = FALSE;
247 item[i]._iSelFlag = 1;
248 DeltaAddItem(i);
249 numitems++;
250 }
251}
252
253void InitItems()
254{

Callers 1

InitItemsFunction · 0.85

Calls 7

random_Function · 0.85
ItemPlaceFunction · 0.85
GetRndSeedFunction · 0.85
SetRndSeedFunction · 0.85
GetItemAttrsFunction · 0.85
SetupItemFunction · 0.85
DeltaAddItemFunction · 0.85

Tested by

no test coverage detected