aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/script_v2.cpp
diff options
context:
space:
mode:
authorTobias Gunkel2012-01-03 22:10:50 +0100
committerTobias Gunkel2012-02-11 08:02:32 +0100
commita79f224c23f1b0fa4d9850a032e0adc0d72619f7 (patch)
tree16a2614e1220fb1f97fefa8820cd78708f11749f /engines/scumm/script_v2.cpp
parentc9ae5f383807c1f40088fc042d470bf8ba74f1da (diff)
downloadscummvm-rg350-a79f224c23f1b0fa4d9850a032e0adc0d72619f7.tar.gz
scummvm-rg350-a79f224c23f1b0fa4d9850a032e0adc0d72619f7.tar.bz2
scummvm-rg350-a79f224c23f1b0fa4d9850a032e0adc0d72619f7.zip
SCUMM: changed handling of _activeInventory/_activeActor to _activeObject(2)/_activeObject(2)Type
Note: the transition is not completed yet. The code compiles but is probably not runnable as not every occurrence of _activeInventory has been properly replaced. The usage of _v0ObjectIndex and _v0ObjectInInventory should be revised too and both variables should be replaced by another mechanism (maybe by using a single variable "obj = (type << 8) | id"). - moved v0 only vars _activeInventory, _activeObject, _activeVerb from ScummEngine_v2 to ScummEngine_v0 - removed _activeActor, _activeInvExecute, _activeObject2Inv and _activeInventory. They are handled by _activeObject/_activeObjectType and _activeObject2/_activeObject2Type now. - removed _activeObject(2)Index as they only bloat the code without any benefit (?) - merge prep-name tables from ScummEngine_v2::drawPreposition() and ScummEngine_v0::drawSentenceWord() by introducing ScummEngine_v2::drawPreposition() - rename ObjectData.flags -> obj_type (quick-fix only, needs review! Maybe obj_nr and obj_type can be merged into one var: obj_nr = (obj_type << 8) | obj_nr) - o_unknown2 is negation of o_ifActiveObject (o_ifNotEqualActiveObject2) - renamed o_ifActiveObject -> o_ifEqualActiveObject2 as it acts only on _activeObject2 - renamed ScummEngine_v0::drawSentenceWord() -> ScummEngine_v0::getObjectName()
Diffstat (limited to 'engines/scumm/script_v2.cpp')
-rw-r--r--engines/scumm/script_v2.cpp68
1 files changed, 36 insertions, 32 deletions
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index edb046d571..76f6b02eb7 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -953,6 +953,41 @@ void ScummEngine_v2::o2_doSentence() {
}
}
+void ScummEngine_v2::drawPreposition(int index) {
+ // The prepositions, like the fonts, were hard code in the engine. Thus
+ // we have to do that, too, and provde localized versions for all the
+ // languages MM/Zak are available in.
+ const char *prepositions[][5] = {
+ { " ", " in", " with", " on", " to" }, // English
+ { " ", " mit", " mit", " mit", " zu" }, // German
+ { " ", " dans", " avec", " sur", " <" }, // French
+ { " ", " in", " con", " su", " a" }, // Italian
+ { " ", " en", " con", " en", " a" }, // Spanish
+ };
+ int lang;
+ switch (_language) {
+ case Common::DE_DEU:
+ lang = 1;
+ break;
+ case Common::FR_FRA:
+ lang = 2;
+ break;
+ case Common::IT_ITA:
+ lang = 3;
+ break;
+ case Common::ES_ESP:
+ lang = 4;
+ break;
+ default:
+ lang = 0; // Default to english
+ }
+
+ if (_game.platform == Common::kPlatformNES) {
+ _sentenceBuf += (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2);
+ } else
+ _sentenceBuf += prepositions[lang][index];
+}
+
void ScummEngine_v2::o2_drawSentence() {
Common::Rect sentenceline;
const byte *temp;
@@ -986,38 +1021,7 @@ void ScummEngine_v2::o2_drawSentence() {
}
if (0 < VAR(VAR_SENTENCE_PREPOSITION) && VAR(VAR_SENTENCE_PREPOSITION) <= 4) {
- // The prepositions, like the fonts, were hard code in the engine. Thus
- // we have to do that, too, and provde localized versions for all the
- // languages MM/Zak are available in.
- const char *prepositions[][5] = {
- { " ", " in", " with", " on", " to" }, // English
- { " ", " mit", " mit", " mit", " zu" }, // German
- { " ", " dans", " avec", " sur", " <" }, // French
- { " ", " in", " con", " su", " a" }, // Italian
- { " ", " en", " con", " en", " a" }, // Spanish
- };
- int lang;
- switch (_language) {
- case Common::DE_DEU:
- lang = 1;
- break;
- case Common::FR_FRA:
- lang = 2;
- break;
- case Common::IT_ITA:
- lang = 3;
- break;
- case Common::ES_ESP:
- lang = 4;
- break;
- default:
- lang = 0; // Default to english
- }
-
- if (_game.platform == Common::kPlatformNES) {
- _sentenceBuf += (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2);
- } else
- _sentenceBuf += prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)];
+ drawPreposition(VAR(VAR_SENTENCE_PREPOSITION));
}
if (VAR(VAR_SENTENCE_OBJECT2) > 0) {