[Scummvm-git-logs] scummvm master -> d868031c1640e3a8c6411696b40590a99474ef0b
sluicebox
noreply at scummvm.org
Thu Dec 5 01:09:45 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c88aeabfb5 AGI: PREAGI: Add CGA and Hercules text color mapping
d99165b82b AGI: PREAGI: Cleanup
d868031c16 AGI: PREAGI: Add initial handling for WINNIE CoCo
Commit: c88aeabfb5230179fad56e0cab3c9d4b5d708b7d
https://github.com/scummvm/scummvm/commit/c88aeabfb5230179fad56e0cab3c9d4b5d708b7d
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-04T17:08:47-08:00
Commit Message:
AGI: PREAGI: Add CGA and Hercules text color mapping
Fixes text not appearing in CGA/Hercules render modes
Changed paths:
engines/agi/preagi/preagi.cpp
diff --git a/engines/agi/preagi/preagi.cpp b/engines/agi/preagi/preagi.cpp
index e2260fe86f1..d7c978520bc 100644
--- a/engines/agi/preagi/preagi.cpp
+++ b/engines/agi/preagi/preagi.cpp
@@ -52,7 +52,7 @@ void PreAgiEngine::initialize() {
//_game._vm->_text->charAttrib_Set(15, 0);
- _defaultColor = 0xF;
+ _defaultColor = IDA_DEFAULT;
//_game._vm->_text->configureScreen(0); // hardcoded
@@ -102,13 +102,47 @@ void PreAgiEngine::clearGfxScreen(int attr) {
// String functions
void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
- int code;
-
if (attr == kColorDefault)
attr = _defaultColor;
+ byte foreground = attr & 0x0f;
+ byte background = attr >> 4;
+
+ // Simplistic CGA and Hercules mapping that handles all text
+ // in Mickey and Winnie. Troll text is handled correctly in
+ // graphics mode, but the original switched to CGA 16 color
+ // text mode for some parts, and we are not doing that.
+ switch (_renderMode) {
+ case Common::kRenderCGA:
+ // Map non-black text to white
+ if (foreground != 0) {
+ foreground = 3;
+ }
+ // Map white background to white
+ if (background == 15) {
+ background = 3;
+ }
+ break;
+ case Common::kRenderHercA:
+ case Common::kRenderHercG:
+ // Map non-black text to amber/green
+ if (foreground != 0) {
+ foreground = 1;
+ }
+ // Map white background to amber/green,
+ // all others to black
+ if (background == 0x0f) {
+ background = 1;
+ } else {
+ background = 0;
+ }
+ break;
+ default:
+ break;
+ }
+
for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
- code = buffer[iChar];
+ int code = buffer[iChar];
switch (code) {
case '\n':
@@ -123,7 +157,7 @@ void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
break;
default:
- _gfx->drawCharacter(row, col, code, attr & 0x0f, attr >> 4, false);
+ _gfx->drawCharacter(row, col, code, foreground, background, false);
if (++col == 320 / 8) {
col = 0;
Commit: d99165b82b16e83e30c693fb7902fc3d097114d9
https://github.com/scummvm/scummvm/commit/d99165b82b16e83e30c693fb7902fc3d097114d9
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-04T17:08:47-08:00
Commit Message:
AGI: PREAGI: Cleanup
Changed paths:
engines/agi/agi.cpp
engines/agi/preagi/preagi.cpp
engines/agi/preagi/preagi.h
engines/agi/preagi/winnie.cpp
engines/agi/preagi/winnie.h
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 16bf6246d32..552193a69d1 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -371,31 +371,15 @@ void AgiBase::initRenderMode() {
// If render mode is explicitly set, force rendermode
switch (configRenderMode) {
case Common::kRenderCGA:
- _renderMode = Common::kRenderCGA;
- break;
case Common::kRenderEGA:
- _renderMode = Common::kRenderEGA;
- break;
case Common::kRenderVGA:
- _renderMode = Common::kRenderVGA;
- break;
case Common::kRenderHercG:
- _renderMode = Common::kRenderHercG;
- break;
case Common::kRenderHercA:
- _renderMode = Common::kRenderHercA;
- break;
case Common::kRenderAmiga:
- _renderMode = Common::kRenderAmiga;
- break;
case Common::kRenderApple2GS:
- _renderMode = Common::kRenderApple2GS;
- break;
case Common::kRenderAtariST:
- _renderMode = Common::kRenderAtariST;
- break;
case Common::kRenderMacintosh:
- _renderMode = Common::kRenderMacintosh;
+ _renderMode = configRenderMode;
break;
default:
break;
diff --git a/engines/agi/preagi/preagi.cpp b/engines/agi/preagi/preagi.cpp
index d7c978520bc..e824182c4cf 100644
--- a/engines/agi/preagi/preagi.cpp
+++ b/engines/agi/preagi/preagi.cpp
@@ -141,7 +141,8 @@ void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
break;
}
- for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
+ const int stringLength = (int)strlen(buffer);
+ for (int iChar = 0; iChar < stringLength; iChar++) {
int code = buffer[iChar];
switch (code) {
@@ -167,11 +168,6 @@ void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
}
}
-void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) {
- int col = (25 / 2) - (strlen(buffer) / 2); // 25 = 320 / 8 (maximum column)
- drawStr(row, col, attr, buffer);
-}
-
void PreAgiEngine::clearTextArea() {
int start = IDI_MAX_ROW_PIC;
diff --git a/engines/agi/preagi/preagi.h b/engines/agi/preagi/preagi.h
index 56f510e71f2..a4c666790c9 100644
--- a/engines/agi/preagi/preagi.h
+++ b/engines/agi/preagi/preagi.h
@@ -63,9 +63,7 @@ protected:
PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc);
~PreAgiEngine() override;
- int getGameId() {
- return _gameId;
- }
+ int getGameId() const { return _gameId; }
PictureMgr *_picture;
@@ -79,7 +77,7 @@ protected:
int loadGame(const Common::String &fileName, bool checkId = true) { return -1; }
// Game
- Common::String getTargetName() { return _targetName; }
+ Common::String getTargetName() const { return _targetName; }
// Screen
void clearScreen(int attr, bool overrideDefault = true);
@@ -94,10 +92,9 @@ protected:
// Text
void drawStr(int row, int col, int attr, const char *buffer);
- void drawStrMiddle(int row, int attr, const char *buffer);
void clearTextArea();
void clearRow(int row);
- void XOR80(char *buffer);
+ static void XOR80(char *buffer);
void printStr(const char *szMsg);
void printStrXOR(char *szMsg);
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index 1f42ddb7d4c..381a0b1a137 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -35,8 +35,6 @@
namespace Agi {
void WinnieEngine::parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len) {
- int i;
-
Common::MemoryReadStreamEndian readS(buffer, len, _isBigEndian);
roomHdr->roomNumber = readS.readByte();
@@ -45,7 +43,7 @@ void WinnieEngine::parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len)
roomHdr->fileLen = readS.readUint16();
roomHdr->reserved0 = readS.readUint16();
- for (i = 0; i < IDI_WTP_MAX_DIR; i++)
+ for (int i = 0; i < IDI_WTP_MAX_DIR; i++)
roomHdr->roomNew[i] = readS.readByte();
roomHdr->objX = readS.readByte();
@@ -53,35 +51,33 @@ void WinnieEngine::parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len)
roomHdr->reserved1 = readS.readUint16();
- for (i = 0; i < IDI_WTP_MAX_BLOCK; i++)
+ for (int i = 0; i < IDI_WTP_MAX_BLOCK; i++)
roomHdr->ofsDesc[i] = readS.readUint16();
- for (i = 0; i < IDI_WTP_MAX_BLOCK; i++)
+ for (int i = 0; i < IDI_WTP_MAX_BLOCK; i++)
roomHdr->ofsBlock[i] = readS.readUint16();
- for (i = 0; i < IDI_WTP_MAX_STR; i++)
+ for (int i = 0; i < IDI_WTP_MAX_STR; i++)
roomHdr->ofsStr[i] = readS.readUint16();
roomHdr->reserved2 = readS.readUint32();
- for (i = 0; i < IDI_WTP_MAX_BLOCK; i++)
+ for (int i = 0; i < IDI_WTP_MAX_BLOCK; i++)
for (byte j = 0; j < IDI_WTP_MAX_BLOCK; j++)
roomHdr->opt[i].ofsOpt[j] = readS.readUint16();
}
void WinnieEngine::parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len) {
- int i;
-
Common::MemoryReadStreamEndian readS(buffer, len, _isBigEndian);
// these two values are always little endian, even on Amiga
objHdr->fileLen = readS.readUint16LE();
objHdr->objId = readS.readUint16LE();
- for (i = 0; i < IDI_WTP_MAX_OBJ_STR_END; i++)
+ for (int i = 0; i < IDI_WTP_MAX_OBJ_STR_END; i++)
objHdr->ofsEndStr[i] = readS.readUint16();
- for (i = 0; i < IDI_WTP_MAX_OBJ_STR; i++)
+ for (int i = 0; i < IDI_WTP_MAX_OBJ_STR; i++)
objHdr->ofsStr[i] = readS.readUint16();
objHdr->ofsPic = readS.readUint16();
@@ -592,8 +588,6 @@ void WinnieEngine::takeObj(int iRoom) {
// returns true if object was dropped in the right room
bool WinnieEngine::dropObj(int iRoom) {
- int iCode;
-
if (getObjInRoom(iRoom)) {
// there already is an object in the room, can't drop
printStr(IDS_WTP_CANT_DROP);
@@ -604,6 +598,7 @@ bool WinnieEngine::dropObj(int iRoom) {
_gameStateWinnie.fGame[0x0d] = 0;
}
+ int iCode;
if (isRightObj(iRoom, _gameStateWinnie.iObjHave, &iCode)) {
// object has been dropped in the right place
playSound(IDI_WTP_SND_DROP_OK);
diff --git a/engines/agi/preagi/winnie.h b/engines/agi/preagi/winnie.h
index 41170ddd3c4..8cc7bed0c05 100644
--- a/engines/agi/preagi/winnie.h
+++ b/engines/agi/preagi/winnie.h
@@ -328,7 +328,6 @@ private:
void drawRoomPic();
int parser(int, int, uint8 *);
int getObjInRoom(int);
- bool getSelOkBack();
void getMenuSel(char *, int *, int[]);
void keyHelp();
void clrMenuSel(int *, int[]);
Commit: d868031c1640e3a8c6411696b40590a99474ef0b
https://github.com/scummvm/scummvm/commit/d868031c1640e3a8c6411696b40590a99474ef0b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-04T17:08:47-08:00
Commit Message:
AGI: PREAGI: Add initial handling for WINNIE CoCo
Changed paths:
engines/agi/preagi/winnie.cpp
engines/agi/preagi/winnie.h
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index 381a0b1a137..d0a7d775858 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -70,9 +70,15 @@ void WinnieEngine::parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len)
void WinnieEngine::parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len) {
Common::MemoryReadStreamEndian readS(buffer, len, _isBigEndian);
- // these two values are always little endian, even on Amiga
- objHdr->fileLen = readS.readUint16LE();
- objHdr->objId = readS.readUint16LE();
+ if (getPlatform() == Common::kPlatformAmiga) {
+ // these two fields are little endian on Amiga
+ objHdr->fileLen = readS.readUint16LE();
+ objHdr->objId = readS.readUint16LE();
+ } else {
+ // endianness is consistent on other platforms
+ objHdr->fileLen = readS.readUint16();
+ objHdr->objId = readS.readUint16();
+ }
for (int i = 0; i < IDI_WTP_MAX_OBJ_STR_END; i++)
objHdr->ofsEndStr[i] = readS.readUint16();
@@ -94,6 +100,8 @@ uint32 WinnieEngine::readRoom(int iRoom, uint8 *buffer, WTP_ROOM_HDR &roomHdr) {
fileName = Common::Path(Common::String::format(IDS_WTP_ROOM_C64, iRoom));
else if (getPlatform() == Common::kPlatformApple2)
fileName = Common::Path(Common::String::format(IDS_WTP_ROOM_APPLE, iRoom));
+ else if (getPlatform() == Common::kPlatformCoCo)
+ fileName = Common::Path(Common::String::format(IDS_WTP_ROOM_COCO, iRoom));
Common::File file;
if (!file.open(fileName)) {
@@ -127,6 +135,8 @@ uint32 WinnieEngine::readObj(int iObj, uint8 *buffer) {
fileName = Common::Path(Common::String::format(IDS_WTP_OBJ_C64, iObj));
else if (getPlatform() == Common::kPlatformApple2)
fileName = Common::Path(Common::String::format(IDS_WTP_OBJ_APPLE, iObj));
+ else if (getPlatform() == Common::kPlatformCoCo)
+ fileName = Common::Path(Common::String::format(IDS_WTP_OBJ_COCO, iObj));
Common::File file;
if (!file.open(fileName)) {
@@ -149,13 +159,27 @@ uint32 WinnieEngine::readObj(int iObj, uint8 *buffer) {
void WinnieEngine::randomize() {
int iObj = 0;
int iRoom = 0;
- bool done;
+
+ // Object 1's file is missing, empty, or corrupt on several platforms.
+ bool skipObject1 = false;
+ switch (getPlatform()) {
+ case Common::kPlatformApple2:
+ case Common::kPlatformC64:
+ case Common::kPlatformCoCo:
+ skipObject1 = true;
+ break;
+ default:
+ break;
+ }
for (int i = 0; i < IDI_WTP_MAX_OBJ_MISSING; i++) {
- done = false;
+ bool done = false;
while (!done) {
iObj = rnd(IDI_WTP_MAX_OBJ); // 1-40
+ if (iObj == 1 && skipObject1) {
+ continue;
+ }
done = true;
for (int j = 0; j < IDI_WTP_MAX_OBJ_MISSING; j++) {
@@ -391,12 +415,14 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) {
opcode = *(buffer + pc++);
iNewRoom = opcode;
- // Apple II is missing a zero terminator in one script block of
- // Christopher Robin's tree house. The room file was fixed in
- // later versions, and the Apple II version behaves correctly,
+ // Apple II & C64 are missing a zero terminator in a script block
+ // of Christopher Robin's tree house. The room file was fixed in
+ // later versions, and the A2 and C64 versions behave correctly,
// so the code must contain a workaround to prevent executing
// the next script block before exiting the room.
- if (_room == 38 && getPlatform() == Common::kPlatformApple2) {
+ if (_room == 38 &&
+ (getPlatform() == Common::kPlatformApple2 ||
+ getPlatform() == Common::kPlatformC64)) {
_room = iNewRoom;
return IDI_WTP_PAR_GOTO; // change rooms immediately
}
@@ -1478,18 +1504,29 @@ void WinnieEngine::init() {
_tiggerOrMist = false; // tigger appears first
stopTimer(); // timer starts after intro
- if (getPlatform() != Common::kPlatformAmiga) {
- _isBigEndian = false;
- _roomOffset = IDI_WTP_OFS_ROOM;
- _objOffset = IDI_WTP_OFS_OBJ;
- } else {
+ switch (getPlatform()) {
+ case Common::kPlatformAmiga:
+ case Common::kPlatformCoCo:
_isBigEndian = true;
_roomOffset = 0;
_objOffset = 0;
+ break;
+ default:
+ _isBigEndian = false;
+ _roomOffset = IDI_WTP_OFS_ROOM;
+ _objOffset = IDI_WTP_OFS_OBJ;
+ break;
}
- if (getPlatform() == Common::kPlatformC64 || getPlatform() == Common::kPlatformApple2)
+ switch (getPlatform()) {
+ case Common::kPlatformApple2:
+ case Common::kPlatformC64:
+ case Common::kPlatformCoCo:
_picture->setPictureVersion(AGIPIC_C64);
+ break;
+ default:
+ break;
+ }
hotspotNorth = Common::Rect(20, 0, (IDI_WTP_PIC_WIDTH + 10) * 2, 10);
hotspotSouth = Common::Rect(20, IDI_WTP_PIC_HEIGHT - 10, (IDI_WTP_PIC_WIDTH + 10) * 2, IDI_WTP_PIC_HEIGHT);
@@ -1501,9 +1538,15 @@ Common::Error WinnieEngine::go() {
init();
randomize();
- // The intro is not supported on these platforms yet
- if (getPlatform() != Common::kPlatformC64 && getPlatform() != Common::kPlatformApple2)
+ switch (getPlatform()) {
+ case Common::kPlatformAmiga:
+ case Common::kPlatformDOS:
intro();
+ break;
+ default:
+ warning("intro not implemented");
+ break;
+ }
gameLoop();
diff --git a/engines/agi/preagi/winnie.h b/engines/agi/preagi/winnie.h
index 8cc7bed0c05..c149483385c 100644
--- a/engines/agi/preagi/winnie.h
+++ b/engines/agi/preagi/winnie.h
@@ -32,10 +32,12 @@ namespace Agi {
#define IDS_WTP_ROOM_AMIGA "rooms/room.%d"
#define IDS_WTP_ROOM_C64 "room%02d"
#define IDS_WTP_ROOM_APPLE "room%d.obj"
+#define IDS_WTP_ROOM_COCO "room%02d"
#define IDS_WTP_OBJ_DOS "obj.%02d"
#define IDS_WTP_OBJ_AMIGA "objects/object.%d"
#define IDS_WTP_OBJ_C64 "object%02d"
#define IDS_WTP_OBJ_APPLE "object%d.obj"
+#define IDS_WTP_OBJ_COCO "obj%02d"
#define IDS_WTP_SND_DOS "snd.%02d"
#define IDS_WTP_SND_AMIGA "Sounds"
#define IDS_WTP_SND_C64 "sound.obj"
More information about the Scummvm-git-logs
mailing list