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

Function OperateChest

Source/objects.cpp:2532–2576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2530}
2531
2532void OperateChest(int pnum, int i, BOOL sendmsg)
2533{
2534 int j, mdir, mtype;
2535
2536 if (object[i]._oSelFlag != 0) {
2537 if (!deltaload)
2538 PlaySfxLoc(IS_CHEST, object[i]._ox, object[i]._oy);
2539 object[i]._oAnimFrame += 2;
2540 object[i]._oSelFlag = 0;
2541 if (!deltaload) {
2542 SetRndSeed(object[i]._oRndSeed);
2543 if (setlevel) {
2544 for (j = 0; j < object[i]._oVar1; j++) {
2545 CreateRndItem(object[i]._ox, object[i]._oy, TRUE, sendmsg, FALSE);
2546 }
2547 } else {
2548 for (j = 0; j < object[i]._oVar1; j++) {
2549 if (object[i]._oVar2)
2550 CreateRndItem(object[i]._ox, object[i]._oy, FALSE, sendmsg, FALSE);
2551 else
2552 CreateRndUseful(pnum, object[i]._ox, object[i]._oy, sendmsg);
2553 }
2554 }
2555 if (object[i]._oTrapFlag && object[i]._otype >= OBJ_TCHEST1 && object[i]._otype <= OBJ_TCHEST3) {
2556 mdir = GetDirection(object[i]._ox, object[i]._oy, plr[pnum].WorldX, plr[pnum].WorldY);
2557 switch (object[i]._oVar4) {
2558 case 0:
2559 mtype = MIS_ARROW;
2560 break;
2561 case 1:
2562 mtype = MIS_FARROW;
2563 break;
2564 case 2:
2565 mtype = MIS_NOVA;
2566 break;
2567 }
2568 AddMissile(object[i]._ox, object[i]._oy, plr[pnum].WorldX, plr[pnum].WorldY, mdir, mtype, 1, -1, 0, 0);
2569 object[i]._oTrapFlag = FALSE;
2570 }
2571 if (pnum == myplr)
2572 NetSendCmdParam2(FALSE, CMD_PLROPOBJ, pnum, i);
2573 return;
2574 }
2575 }
2576}
2577
2578void OperateMushPatch(int pnum, int i)
2579{

Callers 2

OperateObjectFunction · 0.85
SyncOpObjectFunction · 0.85

Calls 7

PlaySfxLocFunction · 0.85
SetRndSeedFunction · 0.85
CreateRndItemFunction · 0.85
CreateRndUsefulFunction · 0.85
GetDirectionFunction · 0.85
AddMissileFunction · 0.85
NetSendCmdParam2Function · 0.85

Tested by

no test coverage detected