diff options
Diffstat (limited to 'engines/sword1/resman.cpp')
-rw-r--r-- | engines/sword1/resman.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp index 807679a40e..878ba8eceb 100644 --- a/engines/sword1/resman.cpp +++ b/engines/sword1/resman.cpp @@ -31,14 +31,14 @@ #include "gui/message.h" namespace Sword1 { - void guiFatalError(char *msg) { - // Displays a dialog on-screen before terminating the engine. - // TODO: We really need to setup a special palette for cases when - // the engine is erroring before setting one... otherwise invisible cursor :) - - GUI::MessageDialog dialog(msg); - dialog.runModal(); - error("%s", msg); +void guiFatalError(char *msg) { + // Displays a dialog on-screen before terminating the engine. + // TODO: We really need to setup a special palette for cases when + // the engine is erroring before setting one... otherwise invisible cursor :) + + GUI::MessageDialog dialog(msg); + dialog.runModal(); + error("%s", msg); } #define MAX_PATH_LEN 260 @@ -62,7 +62,7 @@ ResMan::~ResMan() { for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++) { if (group->resHandle[resCnt].cond == MEM_DONT_FREE) { warning("ResMan::~ResMan: Resource %02X.%04X.%02X is still open", - clusCnt + 1, grpCnt, resCnt); + clusCnt + 1, grpCnt, resCnt); } } } @@ -92,7 +92,7 @@ void ResMan::loadCluDescript(const char *fileName) { _prj.clu = new Clu[_prj.noClu]; memset(_prj.clu, 0, _prj.noClu * sizeof(Clu)); - uint32 *cluIndex = (uint32*)malloc(_prj.noClu * 4); + uint32 *cluIndex = (uint32 *)malloc(_prj.noClu * 4); file.read(cluIndex, _prj.noClu * 4); for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++) @@ -107,7 +107,7 @@ void ResMan::loadCluDescript(const char *fileName) { memset(cluster->grp, 0, cluster->noGrp * sizeof(Grp)); cluster->refCount = 0; - uint32 *grpIndex = (uint32*)malloc(cluster->noGrp * 4); + uint32 *grpIndex = (uint32 *)malloc(cluster->noGrp * 4); file.read(grpIndex, cluster->noGrp * 4); for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++) @@ -117,7 +117,7 @@ void ResMan::loadCluDescript(const char *fileName) { group->resHandle = new MemHandle[group->noRes]; group->offset = new uint32[group->noRes]; group->length = new uint32[group->noRes]; - uint32 *resIdIdx = (uint32*)malloc(group->noRes * 4); + uint32 *resIdIdx = (uint32 *)malloc(group->noRes * 4); file.read(resIdIdx, group->noRes * 4); for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++) { @@ -227,7 +227,7 @@ Header *ResMan::lockScript(uint32 scrID) { #else openScriptResourceLittleEndian(scrID); #endif - return (Header*)resHandle(scrID)->data; + return (Header *)resHandle(scrID)->data; } void ResMan::unlockScript(uint32 scrID) { @@ -276,23 +276,23 @@ void ResMan::resClose(uint32 id) { } else { handle->refCount--; if (!handle->refCount) - _memMan->setCondition( handle, MEM_CAN_FREE); + _memMan->setCondition(handle, MEM_CAN_FREE); } } FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) { - uint8 *frameFile = (uint8*)resourceData; + uint8 *frameFile = (uint8 *)resourceData; uint8 *idxData = frameFile + sizeof(Header); if (_isBigEndian) { if (frameNo >= READ_BE_UINT32(idxData)) error("fetchFrame:: frame %d doesn't exist in resource.", frameNo); - frameFile += READ_BE_UINT32(idxData + (frameNo+1) * 4); + frameFile += READ_BE_UINT32(idxData + (frameNo + 1) * 4); } else { if (frameNo >= READ_LE_UINT32(idxData)) error("fetchFrame:: frame %d doesn't exist in resource.", frameNo); - frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4); + frameFile += READ_LE_UINT32(idxData + (frameNo + 1) * 4); } - return (FrameHeader*)frameFile; + return (FrameHeader *)frameFile; } Common::File *ResMan::resFile(uint32 id) { @@ -310,9 +310,9 @@ Common::File *ResMan::resFile(uint32 id) { // Supposes that big endian means mac cluster file and little endian means PC cluster file. // This works, but we may want to separate the file name from the endianess or try .CLM extension if opening.clu file fail. if (_isBigEndian) - sprintf(fileName, "%s.CLM", _prj.clu[(id >> 24)-1].label); + sprintf(fileName, "%s.CLM", _prj.clu[(id >> 24) - 1].label); else - sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label); + sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24) - 1].label); cluster->file->open(fileName); if (!cluster->file->isOpen()) { char msg[512]; @@ -392,7 +392,7 @@ void ResMan::openCptResourceBigEndian(uint32 id) { if (!handle) return; uint32 totSize = handle->size; - uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header)); + uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header)); totSize -= sizeof(Header); if (totSize & 3) error("Illegal compact size for id %d: %d", id, totSize); @@ -420,7 +420,7 @@ void ResMan::openCptResourceLittleEndian(uint32 id) { if (!handle) return; uint32 totSize = handle->size; - uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header)); + uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header)); totSize -= sizeof(Header); if (totSize & 3) error("Illegal compact size for id %d: %d", id, totSize); @@ -448,11 +448,11 @@ void ResMan::openScriptResourceBigEndian(uint32 id) { if (!handle) return; // uint32 totSize = handle->size; - Header *head = (Header*)handle->data; + Header *head = (Header *)handle->data; head->comp_length = FROM_LE_32(head->comp_length); head->decomp_length = FROM_LE_32(head->decomp_length); head->version = FROM_LE_16(head->version); - uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header)); + uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header)); uint32 size = handle->size - sizeof(Header); if (size & 3) error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size); @@ -480,11 +480,11 @@ void ResMan::openScriptResourceLittleEndian(uint32 id) { if (!handle) return; // uint32 totSize = handle->size; - Header *head = (Header*)handle->data; + Header *head = (Header *)handle->data; head->comp_length = FROM_BE_32(head->comp_length); head->decomp_length = FROM_BE_32(head->decomp_length); head->version = FROM_BE_16(head->version); - uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header)); + uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header)); uint32 size = handle->size - sizeof(Header); if (size & 3) error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size); @@ -498,34 +498,34 @@ void ResMan::openScriptResourceLittleEndian(uint32 id) { uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array - OTHER_SR_FONT, // SR_FONT - 0x04050000, // SR_BUTTON - OTHER_SR_REDFONT, // SR_REDFONT - 0x04050001, // SR_PALETTE - 0x04050002, // SR_PANEL_ENGLISH - 0x04050003, // SR_PANEL_FRENCH - 0x04050004, // SR_PANEL_GERMAN - 0x04050005, // SR_PANEL_ITALIAN - 0x04050006, // SR_PANEL_SPANISH - 0x04050007, // SR_PANEL_AMERICAN - 0x04050008, // SR_TEXT_BUTTON - 0x04050009, // SR_SPEED - 0x0405000A, // SR_SCROLL1 - 0x0405000B, // SR_SCROLL2 - 0x0405000C, // SR_CONFIRM - 0x0405000D, // SR_VOLUME - 0x0405000E, // SR_VLIGHT - 0x0405000F, // SR_VKNOB - 0x04050010, // SR_WINDOW - 0x04050011, // SR_SLAB1 - 0x04050012, // SR_SLAB2 - 0x04050013, // SR_SLAB3 - 0x04050014, // SR_SLAB4 - 0x04050015, // SR_BUTUF - 0x04050016, // SR_BUTUS - 0x04050017, // SR_BUTDS - 0x04050018, // SR_BUTDF - 0x04050019, // SR_DEATHPANEL + OTHER_SR_FONT, // SR_FONT + 0x04050000, // SR_BUTTON + OTHER_SR_REDFONT, // SR_REDFONT + 0x04050001, // SR_PALETTE + 0x04050002, // SR_PANEL_ENGLISH + 0x04050003, // SR_PANEL_FRENCH + 0x04050004, // SR_PANEL_GERMAN + 0x04050005, // SR_PANEL_ITALIAN + 0x04050006, // SR_PANEL_SPANISH + 0x04050007, // SR_PANEL_AMERICAN + 0x04050008, // SR_TEXT_BUTTON + 0x04050009, // SR_SPEED + 0x0405000A, // SR_SCROLL1 + 0x0405000B, // SR_SCROLL2 + 0x0405000C, // SR_CONFIRM + 0x0405000D, // SR_VOLUME + 0x0405000E, // SR_VLIGHT + 0x0405000F, // SR_VKNOB + 0x04050010, // SR_WINDOW + 0x04050011, // SR_SLAB1 + 0x04050012, // SR_SLAB2 + 0x04050013, // SR_SLAB3 + 0x04050014, // SR_SLAB4 + 0x04050015, // SR_BUTUF + 0x04050016, // SR_BUTUS + 0x04050017, // SR_BUTDS + 0x04050018, // SR_BUTDF + 0x04050019, // SR_DEATHPANEL 0, }; |