mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 04:01:23 +00:00
Fix whitespace / code formatting to match out guidelines
svn-id: r15576
This commit is contained in:
parent
f0a7f8f0fb
commit
b41902f407
@ -54,24 +54,19 @@ int Compression::decode80(const uint8* image_in, uint8* image_out) {
|
||||
uint16 code;
|
||||
uint16 count;
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
code = *readp++;
|
||||
if (~code & 0x80)
|
||||
{
|
||||
if (~code & 0x80) {
|
||||
//bit 7 = 0
|
||||
//command 0 (0cccpppp p): copy
|
||||
count = (code >> 4) + 3;
|
||||
copyp = writep - (((code & 0xf) << 8) + *readp++);
|
||||
while (count--)
|
||||
*writep++ = *copyp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//bit 7 = 1
|
||||
count = code & 0x3f;
|
||||
if (~code & 0x40)
|
||||
{
|
||||
if (~code & 0x40) {
|
||||
//bit 6 = 0
|
||||
if (!count)
|
||||
//end of image
|
||||
@ -79,12 +74,9 @@ int Compression::decode80(const uint8* image_in, uint8* image_out) {
|
||||
//command 1 (10cccccc): copy
|
||||
while (count--)
|
||||
*writep++ = *readp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//bit 6 = 1
|
||||
if (count < 0x3e)
|
||||
{
|
||||
if (count < 0x3e) {
|
||||
//command 2 (11cccccc p p): copy
|
||||
count += 3;
|
||||
|
||||
@ -94,9 +86,7 @@ int Compression::decode80(const uint8* image_in, uint8* image_out) {
|
||||
memcpy(writep, copyp, count);
|
||||
writep += count;
|
||||
copyp += count;
|
||||
}
|
||||
else if (count == 0x3e)
|
||||
{
|
||||
} else if (count == 0x3e) {
|
||||
//command 3 (11111110 c c v): fill
|
||||
|
||||
count = READ_LE_UINT16(readp);
|
||||
@ -104,9 +94,7 @@ int Compression::decode80(const uint8* image_in, uint8* image_out) {
|
||||
code = *readp++;
|
||||
memset(writep, code, count);
|
||||
writep += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//command 4 (copy 11111111 c c p p): copy
|
||||
|
||||
count = READ_LE_UINT16(readp);
|
||||
@ -146,57 +134,44 @@ int Compression::decode40(const uint8* image_in, uint8* image_out) {
|
||||
|
||||
while (1) {
|
||||
code = *readp++;
|
||||
if (~code & 0x80)
|
||||
{
|
||||
if (~code & 0x80) {
|
||||
//bit 7 = 0
|
||||
if (!code)
|
||||
{
|
||||
if (!code) {
|
||||
//command 0 (00000000 c v): fill
|
||||
count = *readp++;
|
||||
code = *readp++;
|
||||
while (count--)
|
||||
*writep++ ^= code;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//command 1 (0ccccccc): copy
|
||||
count = code;
|
||||
while (count--)
|
||||
*writep++ ^= *readp++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//bit 7 = 1
|
||||
if (!(count = code & 0x7f))
|
||||
{
|
||||
if (!(count = code & 0x7f)) {
|
||||
|
||||
count = READ_LE_UINT16(readp);
|
||||
readp += 2;
|
||||
code = count >> 8;
|
||||
if (~code & 0x80)
|
||||
{
|
||||
if (~code & 0x80) {
|
||||
//bit 7 = 0
|
||||
//command 2 (10000000 c 0ccccccc): skip
|
||||
if (!count)
|
||||
// end of image
|
||||
break;
|
||||
writep += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//bit 7 = 1
|
||||
count &= 0x3fff;
|
||||
if (~code & 0x40)
|
||||
{
|
||||
if (~code & 0x40) {
|
||||
//bit 6 = 0
|
||||
//command 3 (10000000 c 10cccccc): copy
|
||||
while (count--)
|
||||
*writep++ ^= *readp++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//bit 6 = 1
|
||||
//command 4 (10000000 c 11cccccc v): fill
|
||||
code = *readp++;
|
||||
@ -204,8 +179,7 @@ int Compression::decode40(const uint8* image_in, uint8* image_out) {
|
||||
*writep++ ^= code;
|
||||
}
|
||||
}
|
||||
}
|
||||
else //command 5 (1ccccccc): skip
|
||||
} else //command 5 (1ccccccc): skip
|
||||
writep += count;
|
||||
}
|
||||
}
|
||||
@ -232,23 +206,18 @@ int Compression::decode3(const uint8* image_in, uint8* image_out, int size)
|
||||
|
||||
do {
|
||||
code = *const_cast<int8*>((const int8*)readp++);
|
||||
if (code > 0) // Copy
|
||||
{
|
||||
if (code > 0) { // Copy
|
||||
count = code ;
|
||||
while (count--)
|
||||
*writep++ = *readp++;
|
||||
}
|
||||
else if (code == 0) // Fill(1)
|
||||
{
|
||||
} else if (code == 0) { // Fill(1)
|
||||
count = READ_BE_UINT16(readp);
|
||||
|
||||
readp += 2;
|
||||
code = *readp++;
|
||||
while (count--)
|
||||
*writep++ = (uint8)code;
|
||||
}
|
||||
else if (code < 0) // Fill (2)
|
||||
{
|
||||
} else if (code < 0) { // Fill (2)
|
||||
count = -code;
|
||||
code = *readp++;
|
||||
while (count--)
|
||||
|
@ -206,20 +206,20 @@ namespace Kyra {
|
||||
for (uint8 yadd = 0; yadd < height; ++yadd) {
|
||||
for (uint8 xadd = 0; xadd < width; ++xadd) {
|
||||
switch(*src) {
|
||||
case 1:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = color;
|
||||
case 1:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = color;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = 14;
|
||||
case 2:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = 14;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = 0;
|
||||
case 3:
|
||||
plane[(y + yadd) * planewidth + x + xadd] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
// nothing to do now
|
||||
default:
|
||||
// nothing to do now
|
||||
break;
|
||||
};
|
||||
|
||||
@ -269,30 +269,30 @@ namespace Kyra {
|
||||
}
|
||||
|
||||
switch(index) {
|
||||
case 1:
|
||||
case 1:
|
||||
#ifdef DUMP_FILES
|
||||
fprintf(dump, "#");
|
||||
fprintf(dump, "#");
|
||||
#endif
|
||||
dst[yadd * newChar.width + xadd] = 1;
|
||||
dst[yadd * newChar.width + xadd] = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
case 2:
|
||||
#ifdef DUMP_FILES
|
||||
fprintf(dump, "$");
|
||||
fprintf(dump, "$");
|
||||
#endif
|
||||
dst[yadd * newChar.width + xadd] = 2;
|
||||
dst[yadd * newChar.width + xadd] = 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
case 3:
|
||||
#ifdef DUMP_FILES
|
||||
fprintf(dump, "§");
|
||||
fprintf(dump, "§");
|
||||
#endif
|
||||
dst[yadd * newChar.width + xadd] = 3;
|
||||
dst[yadd * newChar.width + xadd] = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
#ifdef DUMP_FILES
|
||||
fprintf(dump, "%d", index);
|
||||
fprintf(dump, "%d", index);
|
||||
#endif
|
||||
break;
|
||||
};
|
||||
|
@ -34,32 +34,32 @@
|
||||
#include "script.h"
|
||||
|
||||
struct KyraGameSettings {
|
||||
const char *name;
|
||||
const char *description;
|
||||
uint32 features;
|
||||
const char *detectName;
|
||||
GameSettings toGameSettings() const {
|
||||
GameSettings dummy = { name, description, features };
|
||||
return dummy;
|
||||
}
|
||||
const char *name;
|
||||
const char *description;
|
||||
uint32 features;
|
||||
const char *detectName;
|
||||
GameSettings toGameSettings() const {
|
||||
GameSettings dummy = { name, description, features };
|
||||
return dummy;
|
||||
}
|
||||
};
|
||||
|
||||
static const KyraGameSettings kyra_settings[] = {
|
||||
{"kyra1cd", "Legend of Kyrandia (CD)", GF_TALKIE & GF_KYRA1, "CHAPTER1.VRM"},
|
||||
{"kyra1", "Legend of Kyrandia (Floppy)", GF_FLOPPY & GF_KYRA1, "INTRO.SND"},
|
||||
{"kyra1cd", "Legend of Kyrandia (CD)", GF_TALKIE & GF_KYRA1, "CHAPTER1.VRM"},
|
||||
{"kyra1", "Legend of Kyrandia (Floppy)", GF_FLOPPY & GF_KYRA1, "INTRO.SND"},
|
||||
{ 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
GameList Engine_KYRA_gameList() {
|
||||
GameList games;
|
||||
const KyraGameSettings *g = kyra_settings;
|
||||
GameList games;
|
||||
const KyraGameSettings *g = kyra_settings;
|
||||
|
||||
while (g->name) {
|
||||
games.push_back(g->toGameSettings());
|
||||
g++;
|
||||
}
|
||||
while (g->name) {
|
||||
games.push_back(g->toGameSettings());
|
||||
g++;
|
||||
}
|
||||
|
||||
return games;
|
||||
return games;
|
||||
}
|
||||
|
||||
DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
|
||||
@ -79,7 +79,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
|
||||
}
|
||||
}
|
||||
|
||||
return detectedGames;
|
||||
return detectedGames;
|
||||
}
|
||||
|
||||
Engine *Engine_KYRA_create(GameDetector *detector, OSystem *syst) {
|
||||
@ -159,11 +159,11 @@ void KyraEngine::go() {
|
||||
updateScreen();
|
||||
while (g_system->pollEvent(event)) {
|
||||
switch (event.event_code) {
|
||||
case OSystem::EVENT_QUIT:
|
||||
g_system->quit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case OSystem::EVENT_QUIT:
|
||||
g_system->quit();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_system->delayMillis(10);
|
||||
@ -175,23 +175,23 @@ void KyraEngine::shutdown() {
|
||||
}
|
||||
|
||||
void KyraEngine::updateScreen(void) {
|
||||
_system->copyRectToScreen(_screen, 320, 0, 0, 320, 240);
|
||||
_system->updateScreen();
|
||||
_system->copyRectToScreen(_screen, 320, 0, 0, 320, 240);
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
void KyraEngine::setCurrentPalette(Palette* pal, bool delNextTime) {
|
||||
// if (_delPalNextTime)
|
||||
// delete _currentPal;
|
||||
// if (_delPalNextTime)
|
||||
// delete _currentPal;
|
||||
|
||||
// _delPalNextTime = delNextTime;
|
||||
// _delPalNextTime = delNextTime;
|
||||
|
||||
// _currentPal = pal;
|
||||
// _currentPal = pal;
|
||||
|
||||
if (pal->getData()) {
|
||||
_system->setPalette(pal->getData(), 0, 256);
|
||||
} else {
|
||||
warning("palette contains no data");
|
||||
}
|
||||
if (pal->getData()) {
|
||||
_system->setPalette(pal->getData(), 0, 256);
|
||||
} else {
|
||||
warning("palette contains no data");
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace KYRA
|
||||
|
20
kyra/kyra.h
20
kyra/kyra.h
@ -8,7 +8,7 @@
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
@ -48,23 +48,23 @@ public:
|
||||
void errorString( const char *buf_input, char *buf_output);
|
||||
|
||||
void updateScreen(void);
|
||||
void setCurrentPalette(Palette* pal, bool delNextTime = true);
|
||||
void setCurrentPalette(Palette* pal, bool delNextTime = true);
|
||||
|
||||
Resourcemanager* resManager(void) { return _resMgr; }
|
||||
// MidiDriver* midiDriver(void) { return _midiDriver; }
|
||||
Resourcemanager* resManager(void) { return _resMgr; }
|
||||
// MidiDriver* midiDriver(void) { return _midiDriver; }
|
||||
|
||||
protected:
|
||||
void go();
|
||||
void shutdown();
|
||||
Resourcemanager* _resMgr;
|
||||
Resourcemanager* _resMgr;
|
||||
uint8 *_screen;
|
||||
|
||||
Font* _font;
|
||||
CPSImage* _mouse;
|
||||
CPSImage* _items;
|
||||
Font* _font;
|
||||
CPSImage* _mouse;
|
||||
CPSImage* _items;
|
||||
|
||||
VMContext* _currentScript; // our current script
|
||||
VMContext* _npcScript; // script from NPCs
|
||||
VMContext* _currentScript; // our current script
|
||||
VMContext* _npcScript; // script from NPCs
|
||||
};
|
||||
|
||||
} // End of namespace Kyra
|
||||
|
@ -71,9 +71,9 @@ namespace Kyra {
|
||||
currentposdst[2] = currentpossrc[2] << 2;
|
||||
currentpossrc += 3;
|
||||
currentposdst += 4;
|
||||
}
|
||||
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
} // end of namespace Kyra
|
||||
|
@ -36,8 +36,8 @@ namespace Kyra {
|
||||
// ugly a hardcoded list
|
||||
// TODO: use the FS Backend to get all .PAK Files and load them
|
||||
static const char* kyraFilelist[] = {
|
||||
"A_E.PAK", "DAT.PAK", "F_L.PAK", "MAP_5.PAK", "MSC.PAK", "M_S.PAK",
|
||||
"S_Z.PAK", "WSA1.PAK", "WSA2.PAK", "WSA3.PAK", "WSA4.PAK", "WSA5.PAK",
|
||||
"A_E.PAK", "DAT.PAK", "F_L.PAK", "MAP_5.PAK", "MSC.PAK", "M_S.PAK",
|
||||
"S_Z.PAK", "WSA1.PAK", "WSA2.PAK", "WSA3.PAK", "WSA4.PAK", "WSA5.PAK",
|
||||
"WSA6.PAK", "startup.pak", "intro1.pak", 0
|
||||
};
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Kyra {
|
||||
// prefetch file
|
||||
PAKFile* file = new PAKFile(getPath() + kyraFilelist[tmp]);
|
||||
assert(file);
|
||||
|
||||
|
||||
if (file->isOpen() && file->isValid())
|
||||
_pakfiles.push_back(file);
|
||||
else
|
||||
@ -109,7 +109,7 @@ namespace Kyra {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
Palette* Resourcemanager::loadPalette(const char* file) {
|
||||
Palette* Resourcemanager::loadPalette(const char* file) {
|
||||
uint32 size = 0;
|
||||
uint8* buffer = 0;
|
||||
buffer = fileData(file, &size);
|
||||
@ -146,11 +146,11 @@ namespace Kyra {
|
||||
return new WSAMovieV1(buffer, size);
|
||||
}
|
||||
|
||||
VMContext* Resourcemanager::loadScript(const char* file) {
|
||||
VMContext* context = new VMContext(_engine);
|
||||
context->loadScript(file);
|
||||
return context;
|
||||
}
|
||||
VMContext* Resourcemanager::loadScript(const char* file) {
|
||||
VMContext* context = new VMContext(_engine);
|
||||
context->loadScript(file);
|
||||
return context;
|
||||
}
|
||||
|
||||
Common::String Resourcemanager::getPath(void) {
|
||||
assert(_gameDir);
|
||||
@ -223,7 +223,7 @@ namespace Kyra {
|
||||
_files.push_back(chunk);
|
||||
}
|
||||
_open = true;
|
||||
}
|
||||
}
|
||||
|
||||
PAKFile::~PAKFile() {
|
||||
delete [] _buffer;
|
||||
@ -231,7 +231,7 @@ namespace Kyra {
|
||||
_open = false;
|
||||
|
||||
for (PAKFile_Iterate) {
|
||||
delete *start;
|
||||
delete *start;
|
||||
*start = 0;
|
||||
}
|
||||
}
|
||||
|
@ -115,21 +115,21 @@ namespace Kyra {
|
||||
|
||||
void VMContext::c1_negate(void) {
|
||||
switch(_argument) {
|
||||
case 0:
|
||||
topStack() = !topStack();
|
||||
case 0:
|
||||
topStack() = !topStack();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
topStack() = -topStack();
|
||||
|
||||
case 1:
|
||||
topStack() = -topStack();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
topStack() = ~topStack();
|
||||
|
||||
case 2:
|
||||
topStack() = ~topStack();
|
||||
break;
|
||||
|
||||
default:
|
||||
debug("unkown negate instruction %d", _argument);
|
||||
_error = true;
|
||||
|
||||
default:
|
||||
debug("unkown negate instruction %d", _argument);
|
||||
_error = true;
|
||||
break;
|
||||
};
|
||||
}
|
||||
@ -142,76 +142,76 @@ namespace Kyra {
|
||||
y = popStack();
|
||||
|
||||
switch(_argument) {
|
||||
case 0:
|
||||
res = x && y;
|
||||
case 0:
|
||||
res = x && y;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
res = x || y;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
res = x != y;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
res = x < y;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
res = x <= y;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
res = x || y;
|
||||
case 6:
|
||||
res = x > y;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
res = x >= y;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
res = x + y;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
res = x != y;
|
||||
case 9:
|
||||
res = x - y;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
res = x < y;
|
||||
|
||||
case 10:
|
||||
res = x * y;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
res = x <= y;
|
||||
|
||||
case 11:
|
||||
res = x / y;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
res = x > y;
|
||||
|
||||
case 12:
|
||||
res = x >> y;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
res = x >= y;
|
||||
|
||||
case 13:
|
||||
res = x << y;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
res = x + y;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
res = x - y;
|
||||
|
||||
case 14:
|
||||
res = x & y;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
res = x * y;
|
||||
|
||||
case 15:
|
||||
res = x | y;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
res = x / y;
|
||||
|
||||
case 16:
|
||||
res = x % y;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
res = x >> y;
|
||||
|
||||
case 17:
|
||||
res = x ^ y;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
res = x << y;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
res = x & y;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
res = x | y;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
res = x % y;
|
||||
break;
|
||||
|
||||
case 17:
|
||||
res = x ^ y;
|
||||
break;
|
||||
|
||||
default:
|
||||
debug("unknown evaluate command");
|
||||
|
||||
default:
|
||||
debug("unknown evaluate command");
|
||||
break;
|
||||
};
|
||||
|
||||
@ -232,7 +232,7 @@ namespace Kyra {
|
||||
paramString(4), paramString(5));
|
||||
}
|
||||
|
||||
void VMContext::o1_0x68(void) {
|
||||
debug("o1_0x68 was called with param0: '%d' and param1: '%d'", param(0), param(1));
|
||||
}
|
||||
void VMContext::o1_0x68(void) {
|
||||
debug("o1_0x68 was called with param0: '%d' and param1: '%d'", param(0), param(1));
|
||||
}
|
||||
} // end of namespace Kyra
|
||||
|
Loading…
x
Reference in New Issue
Block a user