void ScummEngine_v0::o_getClosestActor() { int act, check_act; int dist; // This code can't detect any actors farther away than 255 units // (pixels in newer games, characters in older ones.) But this is // perfectly OK, as it is exactly how the original behaved. int closest_act = 0xFF, closest_dist = 0xFF; getResultPos(); act = getVarOrDirectByte(PARAM_1); check_act = (_opcode & PARAM_2) ? 25 : 7; do { dist = getObjActToObjActDist(actorToObj(act), actorToObj(check_act)); if (dist < closest_dist) { closest_dist = dist; closest_act = check_act; } } while (--check_act); setResult(closest_act); }
void ScummEngine_v0::o_getActorMoving() { getResultPos(); int act = getVarOrDirectByte(PARAM_1); Actor *a = derefActor(act, "o_getActorMoving"); setResult(a->_moving); }
void ScummEngine_v2::o2_getObjPreposition() { getResultPos(); int obj = getVarOrDirectWord(PARAM_1); if (whereIsObject(obj) != WIO_NOT_FOUND) { byte *ptr = getOBCDFromObject(obj) + 12; setResult(*ptr >> 5); } else {
void ScummEngine_v0::o_getBitVar() { getResultPos(); byte flag = getVarOrDirectByte(PARAM_1); byte mask = getVarOrDirectByte(PARAM_2); setResult((_bitVars[flag] & (1 << mask)) ? 1 : 0); debug(0, "o_getBitVar (%d, %d %d)", flag, mask, _bitVars[flag] & (1 << mask)); }
void ScummEngine_v0::o_getActorBitVar() { getResultPos(); byte act = getVarOrDirectByte(PARAM_1); byte mask = getVarOrDirectByte(PARAM_2); Actor_v0 *a = (Actor_v0 *)derefActor(act, "o_getActorBitVar"); setResult((a->_miscflags & mask) ? 1 : 0); debug(0, "o_getActorBitVar(%d, %d, %d)", act, mask, (a->_miscflags & mask)); }
void ScummEngine_v2::o2_assignVarByte() { getResultPos(); setResult(fetchScriptByte()); }
void ScummEngine_v0::o_getObjectOwner() { getResultPos(); int obj = getVarOrDirectWord(PARAM_1); setResult(getOwner(obj ? obj : _cmdObject)); }