Пример #1
0
void AGOSEngine_Feeble::off_screenTextPObj() {
	// 177: inventory descriptions
	uint vgaSpriteId = getVarOrByte();
	uint color = getVarOrByte();
	const char *string_ptr = NULL;
	TextLocation *tl = NULL;
	char buf[256];

	SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), kObjectType);
	if (subObject != NULL && subObject->objectFlags & kOFText) {
		string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
		tl = getTextLocation(vgaSpriteId);
	}

	if (subObject != NULL && subObject->objectFlags & kOFVoice) {
		uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
		playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
	}

	if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) {
		if (subObject->objectFlags & kOFNumber) {
			sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr);
			string_ptr = buf;
		}
		if (string_ptr != NULL)
			printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
	}
}
Пример #2
0
int AGOSEngine_Elvira2::canPlace(Item *x, Item *y) {
    Item *z = derefItem(x->parent);

    SubObject *o = (SubObject *)findChildOfType(y, kObjectType);
    int ct;
    int cap = 0;

    if (o == NULL)
        return 0;	/* Fits Fine */

    xPlace(x,NULL);		/* Avoid disturbing figures */
    if (o)
        cap = sizeContents(y);

    xPlace(x, z);
    if ((o) && (o->objectFlags & kOFVolume)) {
        ct = getOffsetOfChild2Param(o, kOFVolume);
        cap = o->objectFlagValue[ct] - cap;
        cap -= sizeOfRec(x, 0);	/* - size of item going in */
        if (cap < 0)
            return -1;	/* Too big to fit */
    }

    return 0;
}
Пример #3
0
int AGOSEngine_Elvira2::sizeOfRec(Item *i, int d) {
    SubObject *o = (SubObject *)findChildOfType(i, kObjectType);

    int ct;
    if ((o) && (o->objectFlags & kOFSoft)) {
        if (o->objectFlags & kOFSize) {
            ct = getOffsetOfChild2Param(o, kOFSize);
            return o->objectFlagValue[ct] + sizeRec(i, d + 1);
        }
        return sizeRec(i, d + 1);
    }
    if ((o) && (o->objectFlags & kOFSize)) {
        ct = getOffsetOfChild2Param(o, kOFSize);
        return o->objectFlagValue[ct];
    }

    return 0;
}
Пример #4
0
uint AGOSEngine_Elvira2::itemGetIconNumber(Item *item) {
	SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
	uint offs;

	if (child == NULL || !(child->objectFlags & kOFIcon))
		return 0;

	offs = getOffsetOfChild2Param(child, 0x10);
	return child->objectFlagValue[offs];
}
Пример #5
0
int AGOSEngine_Elvira2::weightOf(Item *x) {
    SubObject *o = (SubObject *)findChildOfType(x, kObjectType);

    if ((o) && (o->objectFlags & kOFWeight)) {
        int ct = getOffsetOfChild2Param(o, kOFWeight);
        return (o->objectFlagValue[ct]);
    }

    return 0;
}
Пример #6
0
void AGOSEngine_Elvira2::oe2_setOValue() {
	// 158: set item prop
	Item *item = getNextItemPtr();
	SubObject *subObject = (SubObject *)findChildOfType(item, kObjectType);
	uint prop = getVarOrByte();
	int value = getVarOrWord();

	if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
		uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
		subObject->objectFlagValue[offs] = value;
	}
}
Пример #7
0
// Elvira 2 specific
uint AGOSEngine::menuFor_e2(Item *item) {
    if (item == NULL || item == _dummyItem2 || item == _dummyItem3)
        return 0xFFFF;

    SubObject *subObject = (SubObject *)findChildOfType(item, kObjectType);
    if (subObject != NULL && subObject->objectFlags & kOFMenu) {
        uint offs = getOffsetOfChild2Param(subObject, kOFMenu);
        return subObject->objectFlagValue[offs];
    }

    return _agosMenu;
}
Пример #8
0
void AGOSEngine_Simon1::os1_screenTextPObj() {
	// 177: inventory descriptions
	uint vgaSpriteId = getVarOrByte();
	uint color = getVarOrByte();

	SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), kObjectType);
	if (getFeatures() & GF_TALKIE) {
		if (subObject != NULL && subObject->objectFlags & kOFVoice) {
			uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
			playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
		} else if (subObject != NULL && subObject->objectFlags & kOFNumber) {
			uint offs = getOffsetOfChild2Param(subObject, kOFNumber);
			playSpeech(subObject->objectFlagValue[offs] + 3550, vgaSpriteId);
		}
	}

	if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) {
		const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
		TextLocation *tl = getTextLocation(vgaSpriteId);
		char buf[256];
		int j, k;

		if (subObject->objectFlags & kOFNumber) {
			if (_language == Common::HE_ISR) {
				j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
				k = (j % 10) * 10;
				k += j / 10;
				if (!(j % 10))
					sprintf(buf,"0%d%s", k, stringPtr);
				else
					sprintf(buf,"%d%s", k, stringPtr);
			} else {
				sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr);
			}
			stringPtr = buf;
		}
		if (stringPtr != NULL && stringPtr[0] != 0)
			printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
	}
}
Пример #9
0
void AGOSEngine_Elvira2::oe2_getOValue() {
	// 157: get item int prop
	Item *item = getNextItemPtr();
	SubObject *subObject = (SubObject *)findChildOfType(item, kObjectType);
	uint prop = getVarOrByte();

	if (subObject != NULL && subObject->objectFlags & (1 << prop) && prop < 16) {
		uint offs = getOffsetOfChild2Param(subObject, 1 << prop);
		writeNextVarContents(subObject->objectFlagValue[offs]);
	} else {
		writeNextVarContents(0);
	}
}
Пример #10
0
// Waxworks specific
uint AGOSEngine::menuFor_ww(Item *item, uint id) {
    if (id != 0xFFFF && id < 10 && _textMenu[id] != 0)
        return _textMenu[id];

    if (item == NULL || item == _dummyItem2 || item == _dummyItem3)
        return _agosMenu;

    SubObject *subObject = (SubObject *)findChildOfType(item, kObjectType);
    if (subObject != NULL && subObject->objectFlags & kOFMenu) {
        uint offs = getOffsetOfChild2Param(subObject, kOFMenu);
        return subObject->objectFlagValue[offs];
    }

    return _agosMenu;
}
Пример #11
0
void AGOSEngine_Simon2::os2_screenTextPObj() {
	// 177: inventory descriptions
	uint vgaSpriteId = getVarOrByte();
	uint color = getVarOrByte();

	SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), kObjectType);
	if (getFeatures() & GF_TALKIE) {
		if (subObject != NULL && subObject->objectFlags & kOFVoice) {
			uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];

			if (subObject->objectFlags & kOFNumber) {
				uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];

				if (speechId == 116)
					speechId = speechIdOffs + 115;
				if (speechId == 92)
					speechId = speechIdOffs + 98;
				if (speechId == 99)
					speechId = 9;
				if (speechId == 97) {
					switch (speechIdOffs) {
					case 12:
						speechId = 109;
						break;
					case 14:
						speechId = 108;
						break;
					case 18:
						speechId = 107;
						break;
					case 20:
						speechId = 106;
						break;
					case 22:
						speechId = 105;
						break;
					case 28:
						speechId = 104;
						break;
					case 90:
						speechId = 103;
						break;
					case 92:
						speechId = 102;
						break;
					case 100:
						speechId = 51;
						break;
					default:
						error("os2_screenTextPObj: invalid case %d", speechIdOffs);
					}
				}
			}

			if (_speech)
				playSpeech(speechId, vgaSpriteId);
		}

	}

	if (subObject != NULL && subObject->objectFlags & kOFText && _subtitles) {
		const char *stringPtr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
		TextLocation *tl = getTextLocation(vgaSpriteId);
		char buf[256];
		int j, k;

		if (subObject->objectFlags & kOFNumber) {
			if (_language == Common::HE_ISR) {
				j = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
				k = (j % 10) * 10;
				k += j / 10;
				if (!(j % 10))
					sprintf(buf,"0%d%s", k, stringPtr);
				else
					sprintf(buf,"%d%s", k, stringPtr);
			} else {
				sprintf(buf,"%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], stringPtr);
			}
			stringPtr = buf;
		}
		if (stringPtr != NULL)
			printScreenText(vgaSpriteId, color, stringPtr, tl->x, tl->y, tl->width);
	}
}