From c2daf686d6fc207c8bce04674a006619e742749a Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 13 Dec 2008 07:38:37 +0000 Subject: Add upper case code for oe1_pcName() in Elvira 1/2. svn-id: r35330 --- engines/agos/agos.h | 2 +- engines/agos/rooms.cpp | 2 +- engines/agos/script_e1.cpp | 10 ++++------ engines/agos/script_e2.cpp | 2 +- engines/agos/string.cpp | 8 +++++++- 5 files changed, 14 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 78867f64ad..a9846f3eb7 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -657,7 +657,7 @@ protected: Item *actor(); void showMessageFormat(const char *s, ...); - const byte *getStringPtrByID(uint16 stringId); + const byte *getStringPtrByID(uint16 stringId, bool upperCase = false); const byte *getLocalStringByID(uint16 stringId); uint getNextStringID(); diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp index aa63fe535b..b036dba491 100644 --- a/engines/agos/rooms.cpp +++ b/engines/agos/rooms.cpp @@ -241,7 +241,7 @@ void AGOSEngine::moveDirn(Item *i, uint x) { d = getDoorOf(p, x); if (d) { - const byte *name = getStringPtrByID(d->itemName); + const byte *name = getStringPtrByID(d->itemName, true); if (d->state == 1) showMessageFormat("%s is closed.\n", name); else diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index 53bdb55ef0..9d1c4c2776 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -592,7 +592,7 @@ void AGOSEngine_Elvira1::oe1_doClass() { } void AGOSEngine_Elvira1::oe1_pObj() { - // 112: print object + // 112: print object name SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), kObjectType); getVarOrWord(); @@ -601,17 +601,15 @@ void AGOSEngine_Elvira1::oe1_pObj() { } void AGOSEngine_Elvira1::oe1_pName() { - // 114: + // 114: print item name Item *i = getNextItemPtr(); showMessageFormat("%s", (const char *)getStringPtrByID(i->itemName)); } void AGOSEngine_Elvira1::oe1_pcName() { - // 115: + // 115: print item case (and change first letter to upper case) Item *i = getNextItemPtr(); - - // TODO: Change first letter to upper case. - showMessageFormat("%s", (const byte *)getStringPtrByID(i->itemName)); // Difference + showMessageFormat("%s", (const byte *)getStringPtrByID(i->itemName, true)); } void AGOSEngine_Elvira1::oe1_isCalled() { diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp index 59c5132b0a..1b203a4e72 100644 --- a/engines/agos/script_e2.cpp +++ b/engines/agos/script_e2.cpp @@ -468,7 +468,7 @@ void AGOSEngine_Elvira2::oe2_bNotZero() { // 156: is bit set uint bit = getVarWrapper(); - // WORKAROUND: For a script glitch in some versions + // WORKAROUND: Enable copy protection again, in cracked version. if (getGameType() == GType_SIMON1 && _subroutine == 2962 && bit == 63) { bit = 50; } diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 84bcbf5d28..d83a885d40 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -32,7 +32,7 @@ using Common::File; namespace AGOS { -const byte *AGOSEngine::getStringPtrByID(uint16 stringId) { +const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) { const byte *string_ptr; byte *dst; @@ -46,6 +46,12 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId) { dst = _stringReturnBuffer[_freeStringSlot]; strcpy((char *)dst, (const char *)string_ptr); + + if (upperCase && *dst) { + if (islower(*dst)) + *dst = toupper(*dst); + } + return dst; } -- cgit v1.2.3