[Scummvm-git-logs] scummvm branch-2-6 -> 68a46a82a4e3747d3c785543a09d0233d778a877
bluegr
noreply at scummvm.org
Sat Jul 9 19:54:26 UTC 2022
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fd58d4c65a CHEWY: Renamed variables
c5b7abd91e CHEWY: Fix cursor when examining items in the inventory screen
4fa1e165fa CHEWY: Fix button initialization in room 13
68a46a82a4 CHEWY: Fix dynamic texts - bug #13523
Commit: fd58d4c65aa634b1ff1d87b86101dcf975c767e2
https://github.com/scummvm/scummvm/commit/fd58d4c65aa634b1ff1d87b86101dcf975c767e2
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-09T22:54:08+03:00
Commit Message:
CHEWY: Renamed variables
Changed paths:
engines/chewy/defines.h
engines/chewy/rooms/room33.cpp
engines/chewy/rooms/room66.cpp
engines/chewy/t_event.cpp
engines/chewy/types.h
diff --git a/engines/chewy/defines.h b/engines/chewy/defines.h
index 33bd588ac0f..21139c90b7a 100644
--- a/engines/chewy/defines.h
+++ b/engines/chewy/defines.h
@@ -321,7 +321,7 @@ enum SetupScreenMode {
#define TRICHTER_INV 31
#define ANGEL_INV 32
#define MILCH_INV 33
-#define MESSER_INV 34
+#define KNIFE_INV 34
#define PUMPE_INV 35
#define CENT_INV 36
#define ANGEL2_INV 37
@@ -375,7 +375,7 @@ enum SetupScreenMode {
#define ASCHE_INV 85
#define PIRANHA_INV 86
#define SCHALL_INV 87
-#define ARTE_INV 88
+#define ARTIFACT_INV 88
#define GALA_INV 89
#define PARROT_INV 90
#define DRINK_COUPON_INV 91
diff --git a/engines/chewy/rooms/room33.cpp b/engines/chewy/rooms/room33.cpp
index 52b61e8a281..dc887039c9c 100644
--- a/engines/chewy/rooms/room33.cpp
+++ b/engines/chewy/rooms/room33.cpp
@@ -90,7 +90,7 @@ int16 Room33::use_schublade() {
_G(atds)->set_ats_str(210, TXT_MARK_LOOK, 1, ATS_DATA);
_G(atds)->set_ats_str(210, TXT_MARK_USE, 2, ATS_DATA);
start_spz(CH_LGET_O, 1, ANI_FRONT, P_CHEWY);
- invent_2_slot(MESSER_INV);
+ invent_2_slot(KNIFE_INV);
showCur();
}
diff --git a/engines/chewy/rooms/room66.cpp b/engines/chewy/rooms/room66.cpp
index 5f623aaa068..e13fb7bcf9c 100644
--- a/engines/chewy/rooms/room66.cpp
+++ b/engines/chewy/rooms/room66.cpp
@@ -178,12 +178,12 @@ int Room66::proc2() {
}
int Room66::proc7() {
- if (!isCurInventory(ARTE_INV))
+ if (!isCurInventory(ARTIFACT_INV))
return 0;
hideCur();
autoMove(7, P_CHEWY);
- if (_G(gameState).flags26_10) {
+ if (_G(gameState).changedArtifactOrigin) {
delInventory(_G(cur)->getInventoryCursor());
invent_2_slot(92);
invent_2_slot(93);
@@ -191,7 +191,7 @@ int Room66::proc7() {
_G(gameState).flags26_20 = true;
}
- proc8(7, 2, 3, 411 + (_G(gameState).flags26_10 ? 1 : 0));
+ proc8(7, 2, 3, 411 + (_G(gameState).changedArtifactOrigin ? 1 : 0));
hideCur();
if (_G(gameState).flags26_20)
startSetAILWait(4, 1, ANI_FRONT);
diff --git a/engines/chewy/t_event.cpp b/engines/chewy/t_event.cpp
index 4fd2f550b1a..82fbc0ed00c 100644
--- a/engines/chewy/t_event.cpp
+++ b/engines/chewy/t_event.cpp
@@ -2205,7 +2205,7 @@ void calc_inv_use_txt(int16 test_nr) {
invent_2_slot(K_KERNE_INV);
break;
- case MESSER_INV:
+ case KNIFE_INV:
if (_G(cur)->getInventoryCursor() == 40) {
delInventory(_G(cur)->getInventoryCursor());
_G(menu_item) = CUR_USE;
@@ -2214,7 +2214,7 @@ void calc_inv_use_txt(int16 test_nr) {
invent_2_slot(K_FLEISCH_INV);
invent_2_slot(K_KERNE_INV);
} else if (_G(cur)->getInventoryCursor() == 88) {
- _G(gameState).flags26_10 = true;
+ _G(gameState).changedArtifactOrigin = true;
startAadWait(_G(gameState)._personRoomNr[P_CHEWY] + 350);
}
break;
@@ -2252,18 +2252,18 @@ void calc_inv_use_txt(int16 test_nr) {
break;
case 13:
- _G(gameState).flags26_10 = true;
+ _G(gameState).changedArtifactOrigin = true;
_G(flags).InventMenu = false;
start_spz(CH_TALK6, 255, false, P_CHEWY);
startAadWait(_G(gameState)._personRoomNr[P_CHEWY] + 350);
_G(flags).InventMenu = true;
- _G(atds)->set_ats_str(ARTE_INV, 1, INV_ATS_DATA);
+ _G(atds)->set_ats_str(ARTIFACT_INV, 1, INV_ATS_DATA);
break;
case 88:
- _G(gameState).flags26_10 = true;
+ _G(gameState).changedArtifactOrigin = true;
startAadWait(350);
- _G(atds)->set_ats_str(ARTE_INV, 1, INV_ATS_DATA);
+ _G(atds)->set_ats_str(ARTIFACT_INV, 1, INV_ATS_DATA);
break;
case 102:
diff --git a/engines/chewy/types.h b/engines/chewy/types.h
index 8cd978ee675..3d90a9b1b45 100644
--- a/engines/chewy/types.h
+++ b/engines/chewy/types.h
@@ -261,7 +261,7 @@ struct GameFlags {
bool R64ManAway : 1;
bool flags26_4 : 1;
bool flags26_8 : 1;
- bool flags26_10 : 1;
+ bool changedArtifactOrigin : 1;
bool flags26_20 : 1;
bool flags26_40 : 1;
bool R67SongOk : 1;
Commit: c5b7abd91e487f64ec13f4ee9065647949fc504e
https://github.com/scummvm/scummvm/commit/c5b7abd91e487f64ec13f4ee9065647949fc504e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-09T22:54:08+03:00
Commit Message:
CHEWY: Fix cursor when examining items in the inventory screen
Changed paths:
engines/chewy/dialogs/inventory.cpp
diff --git a/engines/chewy/dialogs/inventory.cpp b/engines/chewy/dialogs/inventory.cpp
index 273edbff26d..0567ada89ec 100644
--- a/engines/chewy/dialogs/inventory.cpp
+++ b/engines/chewy/dialogs/inventory.cpp
@@ -280,9 +280,7 @@ void Inventory::menu() {
cursorChoice(_G(invent_cur_mode));
}
} else if (_G(invent_cur_mode) == CUR_LOOK && _G(gameState).InventSlot[k] != -1 && calc_use_invent(_G(gameState).InventSlot[k]) == false) {
- _G(cur)->setInventoryCursor(_G(gameState).InventSlot[k]);
ret_look = look(_G(gameState).InventSlot[k], INV_ATS_MODE, -1);
- _G(cur)->setInventoryCursor(-1);
cursorChoice(_G(invent_cur_mode));
taste_flag = Common::KEYCODE_ESCAPE;
}
Commit: 4fa1e165faff5db84ba2a88d24f9f56ecfc21715
https://github.com/scummvm/scummvm/commit/4fa1e165faff5db84ba2a88d24f9f56ecfc21715
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-09T22:54:08+03:00
Commit Message:
CHEWY: Fix button initialization in room 13
Changed paths:
engines/chewy/rooms/room13.cpp
diff --git a/engines/chewy/rooms/room13.cpp b/engines/chewy/rooms/room13.cpp
index 46c88ba4b48..6c344b79f6f 100644
--- a/engines/chewy/rooms/room13.cpp
+++ b/engines/chewy/rooms/room13.cpp
@@ -62,11 +62,13 @@ void Room13::entry() {
_G(obj)->hide_sib(SIB_BANDBUTTON_R13);
_G(gameState).R13Bandlauf = true;
- _G(atds)->set_ats_str(94, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
-
- _G(atds)->set_ats_str(97, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
-
- _G(atds)->set_ats_str(93, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
+ _G(atds)->set_ats_str(94, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // conveyor belt
+ _G(atds)->set_ats_str(97, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // lever
+ _G(atds)->set_ats_str(93, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // monitor
+ } else {
+ _G(atds)->setControlBit(122, ATS_ACTIVE_BIT);
+ _G(atds)->delControlBit(92, ATS_ACTIVE_BIT);
+ _G(obj)->show_sib(SIB_BANDBUTTON_R13);
}
if (_G(gameState).R13Bandlauf) {
@@ -178,9 +180,9 @@ void Room13::jmp_band() {
setPersonPos(195, 226, P_CHEWY, P_LEFT);
_G(gameState).R13Bandlauf = false;
- _G(atds)->set_ats_str(94, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
- _G(atds)->set_ats_str(97, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
- _G(atds)->set_ats_str(93, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA);
+ _G(atds)->set_ats_str(94, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // conveyor belt
+ _G(atds)->set_ats_str(97, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // lever
+ _G(atds)->set_ats_str(93, TXT_MARK_LOOK, _G(gameState).R13Bandlauf, ATS_DATA); // monitor
_G(obj)->calc_rsi_flip_flop(SIB_BANDBUTTON_R13);
_G(obj)->hide_sib(SIB_BANDBUTTON_R13);
switchRoom(14);
Commit: 68a46a82a4e3747d3c785543a09d0233d778a877
https://github.com/scummvm/scummvm/commit/68a46a82a4e3747d3c785543a09d0233d778a877
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-09T22:54:09+03:00
Commit Message:
CHEWY: Fix dynamic texts - bug #13523
This is a regression from the scene text refactoring done in 8eadac5eed
Changed paths:
engines/chewy/text.cpp
engines/chewy/text.h
diff --git a/engines/chewy/text.cpp b/engines/chewy/text.cpp
index fe2de5eacee..4eef0ecb952 100644
--- a/engines/chewy/text.cpp
+++ b/engines/chewy/text.cpp
@@ -108,11 +108,9 @@ TextEntry *Text::getText(uint chunk, uint entry, int type, int subEntry) {
bool isText = false;
bool isAutoDialog = false;
bool isInvDesc = false;
+ uint origChunk = chunk;
- //int subEntryNew = -1;
-
- //if (subEntry >= 0)
- // subEntryNew = getTextId(entry, subEntry, type);
+ //debug("getText %d, %d, %d, %d", chunk, entry, type, subEntry);
switch (type) {
case AAD_DATA:
@@ -142,6 +140,9 @@ TextEntry *Text::getText(uint chunk, uint entry, int type, int subEntry) {
error("getText(): Invalid chunk number requested, %d (min %d)", chunk, kADSTextMax);
TextEntry *d = new TextEntry();
+ const uint8 altSubString = !isInvDesc ?
+ getTextId(entry, subEntry, type) :
+ getTextId(origChunk, 0, type);
byte *data = getChunkData(chunk);
byte *ptr = data;
@@ -182,16 +183,53 @@ TextEntry *Text::getText(uint chunk, uint entry, int type, int subEntry) {
else
ptr++;
- if (*ptr == 0 && *(ptr + 1) != kEndText) {
+ if (*ptr == 0 && *(ptr + 1) != kEndText)
*ptr = '|';
- }
} while (*ptr);
- // FIXME: Skip other embedded strings for now
+ // Pick the appropriate substring
+ // Each substring starts with 0xf1 0xfe and ends with 0x0 0x0d
if (*(ptr + 1) == kEndText && *(ptr + 2) == 0xf1 && *(ptr + 3) == 0xfe) {
- ptr += 5;
- while (!(!*ptr && *(ptr + 1) == kEndText && *(ptr + 2) == kEndChunk)) {
+ ptr += 6;
+ uint curSubString = 0;
+ bool endOfSubString = (*ptr == 0 && *(ptr + 1) == kEndText);
+ bool endOfChunk = (endOfSubString && *(ptr + 2) == kEndChunk);
+
+ if (txtNum == entry && curSubEntry == subEntry && curSubString < altSubString) {
+ d->_text = "";
+ d->_speechId++;
+ curSubString++;
+
+ while (!endOfChunk && curSubString <= altSubString) {
+ d->_text += *ptr++;
+
+ endOfSubString = (*ptr == 0 && *(ptr + 1) == kEndText);
+ endOfChunk = (endOfSubString && *(ptr + 2) == kEndChunk);
+
+ if (*ptr == 0 && *(ptr + 1) != kEndText)
+ *ptr = '|';
+
+ if (endOfSubString) {
+ if (curSubString < altSubString) {
+ d->_text = "";
+ d->_speechId++;
+ curSubString++;
+ ptr += 6;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ endOfSubString = (*ptr == 0 && *(ptr + 1) == kEndText);
+ endOfChunk = (endOfSubString && *(ptr + 2) == kEndChunk);
+
+ // Keep going until the chunk ends
+ while (!endOfChunk) {
ptr++;
+ endOfSubString = (*ptr == 0 && *(ptr + 1) == kEndText);
+ endOfChunk = (endOfSubString && *(ptr + 2) == kEndChunk);
}
}
@@ -289,59 +327,49 @@ void Text::delControlBit(int16 txtNr, int16 bitIdx) {
_hotspotStrings[txtNr * MAX_ATS_STATUS] &= ~bitIdx;
}
-/*uint8 Text::getTextStatus(uint8 status, int16 subEntry, int16 strNr) {
- const int16 hotspotActionStr = (subEntry + 1) % 2;
- uint8 lo_hi[2];
- lo_hi[0] = status &= 15;
- lo_hi[1] = status >> 4;
- lo_hi[hotspotActionStr] = strNr;
- status = 0;
- lo_hi[1] <<= 4;
- status |= lo_hi[0];
- status |= lo_hi[1];
-
- return status;
-}*/
-
-uint8 Text::updateTextStatus(int16 entry, int16 subEntry, int16 strNr, int16 type) {
- byte *buffer;
-
+uint8 *Text::getBuffer(uint8 type) {
switch (type) {
case ATS_DATA:
- buffer = _hotspotStrings;
- break;
+ return _hotspotStrings;
case INV_USE_DATA:
- buffer = _inventoryUseStrings;
- break;
+ return _inventoryUseStrings;
case INV_ATS_DATA:
- buffer = _inventoryStrings;
- break;
+ return _inventoryStrings;
default:
- error("setTextId called for type %d", type);
+ error("getBuffer called for type %d", type);
}
+}
- const uint8 status = buffer[(entry * MAX_ATS_STATUS) + (subEntry + 1) / 2];
- if (strNr >= 0) {
- // TODO: This is buggy
- //buffer[(entry * MAX_ATS_STATUS) + (subEntry + 1) / 2] = strNr; // getTextStatus(status, subEntry, strNr);
- return strNr;
- }
+uint8 getNibble(uint8 value, uint8 subEntry) {
+ if ((subEntry + 1) % 2 == 0)
+ return value & 0x0F;
+ else
+ return (value >> 4) & 0x0F;
+}
- return status;
+uint8 setNibble(uint8 value, uint8 subEntry, uint8 nibble) {
+ if ((subEntry + 1) % 2 == 0)
+ return (nibble & 0x0F) | (value & 0xF0);
+ else
+ return (nibble << 4) | (value & 0x0F);
}
-uint8 Text::getTextId(uint entry, uint subEntry, int type) {
- uint8 status = updateTextStatus(entry, subEntry, -1, type);
+uint8 Text::getTextId(uint16 entry, uint8 subEntry, uint8 type) {
+ if (type != ATS_DATA && type != INV_USE_DATA && type != INV_ATS_DATA)
+ return 0;
- const int16 hotspotActionStr = (subEntry + 1) % 2;
- uint8 lo_hi[2];
- lo_hi[0] = status &= 15;
- lo_hi[1] = status >> 4;
- return lo_hi[hotspotActionStr];
+ const uint8 *buffer = getBuffer(type);
+ const uint8 value = buffer[(entry * MAX_ATS_STATUS) + (subEntry + 1) / 2];
+ return getNibble(value, subEntry);
}
-void Text::setTextId(int16 entry, int16 subEntry, int16 strNr, int16 type) {
- updateTextStatus(entry, subEntry, strNr, type);
+void Text::setTextId(uint16 entry, uint8 subEntry, uint8 strNr, uint8 type) {
+ if (type != ATS_DATA && type != INV_USE_DATA && type != INV_ATS_DATA)
+ return;
+
+ uint8 *buffer = getBuffer(type);
+ const uint8 value = buffer[(entry * MAX_ATS_STATUS) + (subEntry + 1) / 2];
+ buffer[(entry * MAX_ATS_STATUS) + (subEntry + 1) / 2] = setNibble(value, subEntry, (uint8)strNr);
}
} // namespace Chewy
diff --git a/engines/chewy/text.h b/engines/chewy/text.h
index e5b14978222..7208937a8d2 100644
--- a/engines/chewy/text.h
+++ b/engines/chewy/text.h
@@ -106,17 +106,16 @@ public:
void setControlBit(int16 txtNr, int16 bitIdx);
void delControlBit(int16 txtNr, int16 bitIdx);
- void setTextId(int16 entry, int16 subEntry, int16 strNr, int16 type);
+ void setTextId(uint16 entry, uint8 subEntry, uint8 strNr, uint8 type);
private:
int16 _lastSpeechId = -1;
- byte _hotspotStrings[ROOM_ATS_MAX * 3] = { 0 };
- uint8 _inventoryStrings[MAX_MOV_OBJ * 3] = {0};
- uint8 _inventoryUseStrings[INV_USE_ATS_MAX * 3] = {0};
+ uint8 _hotspotStrings[ROOM_ATS_MAX * 3] = { 0 };
+ uint8 _inventoryStrings[MAX_MOV_OBJ * 3] = { 0 };
+ uint8 _inventoryUseStrings[INV_USE_ATS_MAX * 3] = { 0 };
- //uint8 getTextStatus(uint8 status, int16 subEntry, int16 strNr);
- uint8 getTextId(uint entry, uint subEntry, int type);
- uint8 updateTextStatus(int16 entry, int16 subEntry, int16 strNr, int16 type);
+ uint8 *getBuffer(uint8 type);
+ uint8 getTextId(uint16 entry, uint8 subEntry, uint8 type);
};
} // namespace Chewy
More information about the Scummvm-git-logs
mailing list