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

Function AddBookLever

Source/objects.cpp:289–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289void AddBookLever(int lx1, int ly1, int lx2, int ly2, int x1, int y1, int x2, int y2, int msg)
290{
291 BOOL exit;
292 int xp, yp, ob, k, m, n;
293
294 k = 0;
295 for (;;) {
296 exit = TRUE;
297 xp = random_(139, 80) + 16;
298 yp = random_(139, 80) + 16;
299 for (n = -2; n <= 2; n++) {
300 for (m = -2; m <= 2; m++) {
301 if (!RndLocOk(xp + m, yp + n))
302 exit = FALSE;
303 }
304 }
305 if (exit)
306 break;
307 k++;
308 if (k > 20000)
309 return;
310 }
311
312 if (QuestStatus(QTYPE_BLIND))
313 AddObject(OBJ_BLINDBOOK, xp, yp);
314 if (QuestStatus(QTYPE_WARLRD))
315 AddObject(OBJ_STEELTOME, xp, yp);
316 if (QuestStatus(QTYPE_BLOOD)) {
317 xp = 2 * setpc_x + 25;
318 yp = 2 * setpc_y + 40;
319 AddObject(OBJ_BLOODBOOK, xp, yp);
320 }
321 ob = dObject[xp][yp] - 1;
322 SetObjMapRange(ob, x1, y1, x2, y2, leverid);
323 SetBookMsg(ob, msg);
324 leverid++;
325 object[ob]._oVar6 = object[ob]._oAnimFrame + 1;
326}
327
328void InitRndBarrels()
329{

Callers 1

InitObjectsFunction · 0.85

Calls 6

random_Function · 0.85
RndLocOkFunction · 0.85
QuestStatusFunction · 0.85
AddObjectFunction · 0.85
SetObjMapRangeFunction · 0.85
SetBookMsgFunction · 0.85

Tested by

no test coverage detected