Fix code formatting (esp. 'if(' -> 'if (' etc., but also indention and other things)

svn-id: r44495
This commit is contained in:
Max Horn 2009-09-30 16:16:53 +00:00
parent 25dde91c7c
commit 8ba75fc522
90 changed files with 694 additions and 709 deletions

View File

@ -26,7 +26,7 @@
const char *AbstractFSNode::lastPathComponent(const Common::String &str, const char sep) { const char *AbstractFSNode::lastPathComponent(const Common::String &str, const char sep) {
// TODO: Get rid of this eventually! Use Common::lastPathComponent instead // TODO: Get rid of this eventually! Use Common::lastPathComponent instead
if(str.empty()) if (str.empty())
return ""; return "";
const char *start = str.c_str(); const char *start = str.c_str();

View File

@ -179,8 +179,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) {
const char c = _sPath.lastChar(); const char c = _sPath.lastChar();
if (c != '/' && c != ':') if (c != '/' && c != ':')
_sPath += '/'; _sPath += '/';
} } else {
else {
//_bIsDirectory = false; //_bIsDirectory = false;
_bIsValid = true; _bIsValid = true;
} }
@ -231,15 +230,13 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam
const char c = _sPath.lastChar(); const char c = _sPath.lastChar();
if (c != '/' && c != ':') if (c != '/' && c != ':')
_sPath += '/'; _sPath += '/';
} } else {
else {
//_bIsDirectory = false; //_bIsDirectory = false;
_bIsValid = true; _bIsValid = true;
} }
IDOS->FreeDosObject(DOS_EXAMINEDATA, pExd); IDOS->FreeDosObject(DOS_EXAMINEDATA, pExd);
} } else {
else {
debug(6, "ExamineObject() returned NULL"); debug(6, "ExamineObject() returned NULL");
} }
@ -268,7 +265,7 @@ AmigaOSFilesystemNode::~AmigaOSFilesystemNode() {
bool AmigaOSFilesystemNode::exists() const { bool AmigaOSFilesystemNode::exists() const {
ENTER(); ENTER();
if(_sPath.empty()) if (_sPath.empty())
return false; return false;
bool nodeExists = false; bool nodeExists = false;
@ -352,16 +349,16 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
struct ExamineData * pExd = NULL; // NB: no need to free value after usage, all is dealt by the DirContext release struct ExamineData * pExd = NULL; // NB: no need to free value after usage, all is dealt by the DirContext release
AmigaOSFilesystemNode *entry ; AmigaOSFilesystemNode *entry ;
while( (pExd = IDOS->ExamineDir(context)) ) { while ( (pExd = IDOS->ExamineDir(context)) ) {
if( (EXD_IS_FILE(pExd) && ( Common::FSNode::kListFilesOnly == mode )) if ( (EXD_IS_FILE(pExd) && ( Common::FSNode::kListFilesOnly == mode ))
|| (EXD_IS_DIRECTORY(pExd) && ( Common::FSNode::kListDirectoriesOnly == mode )) || (EXD_IS_DIRECTORY(pExd) && ( Common::FSNode::kListDirectoriesOnly == mode ))
|| Common::FSNode::kListAll == mode || Common::FSNode::kListAll == mode
) )
{ {
BPTR pLock = IDOS->Lock( pExd->Name, SHARED_LOCK ); BPTR pLock = IDOS->Lock( pExd->Name, SHARED_LOCK );
if( pLock ) { if (pLock) {
entry = new AmigaOSFilesystemNode( pLock, pExd->Name ); entry = new AmigaOSFilesystemNode( pLock, pExd->Name );
if( entry ) { if (entry) {
myList.push_back(entry); myList.push_back(entry);
} }
@ -369,18 +366,17 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
} }
} }
} }
if( ERROR_NO_MORE_ENTRIES != IDOS->IoErr() ) {
if (ERROR_NO_MORE_ENTRIES != IDOS->IoErr() ) {
debug(6, "An error occured during ExamineDir"); debug(6, "An error occured during ExamineDir");
ret = false; ret = false;
} } else {
else {
ret = true; ret = true;
} }
IDOS->ReleaseDirContext(context); IDOS->ReleaseDirContext(context);
} } else {
else {
debug(6, "Unable to ObtainDirContext"); debug(6, "Unable to ObtainDirContext");
ret = false; ret = false;
} }
@ -411,8 +407,7 @@ AbstractFSNode *AmigaOSFilesystemNode::getParent() const {
if (parentDir) { if (parentDir) {
node = new AmigaOSFilesystemNode(parentDir); node = new AmigaOSFilesystemNode(parentDir);
IDOS->UnLock(parentDir); IDOS->UnLock(parentDir);
} } else
else
node = new AmigaOSFilesystemNode(); node = new AmigaOSFilesystemNode();
LEAVE(); LEAVE();

View File

@ -96,7 +96,7 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
if (verify) { if (verify) {
struct stat st; struct stat st;
if(PowerMan.beginCriticalSection()==PowerManager::Blocked) if (PowerMan.beginCriticalSection()==PowerManager::Blocked)
PSPDebugSuspend("Suspended in PSPFilesystemNode::PSPFilesystemNode\n"); PSPDebugSuspend("Suspended in PSPFilesystemNode::PSPFilesystemNode\n");
_isValid = (0 == stat(_path.c_str(), &st)); _isValid = (0 == stat(_path.c_str(), &st));
PowerMan.endCriticalSection(); PowerMan.endCriticalSection();

View File

@ -66,9 +66,9 @@ public:
TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size()); TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size());
fname.Copy(ptr); fname.Copy(ptr);
TBool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname); TBool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname);
if(!fileExists) { if (!fileExists) {
TParsePtrC parser(fname); TParsePtrC parser(fname);
if(parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) {
fileExists = ETrue; fileExists = ETrue;
} }
} }
@ -137,7 +137,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) {
_isValid = ETrue; _isValid = ETrue;
_isDirectory = EFalse; _isDirectory = EFalse;
TParsePtrC parser(fname); TParsePtrC parser(fname);
if(parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) {
_isDirectory = ETrue; _isDirectory = ETrue;
} }
} }

View File

@ -71,7 +71,7 @@ TSymbianFileEntry* CreateSymbianFileEntry(const char* name, const char* mode) {
fileMode = fileMode| EFileShareAny; fileMode = fileMode| EFileShareAny;
switch(mode[0]) { switch (mode[0]) {
case 'a': case 'a':
if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) { if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
if (fileEntry->_fileHandle.Create(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) { if (fileEntry->_fileHandle.Create(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
@ -160,7 +160,7 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry
} }
} }
if((numItems * size) != pointer.Length() && entry->_lastError == KErrNone) { if ((numItems * size) != pointer.Length() && entry->_lastError == KErrNone) {
entry->_eofReached = ETrue; entry->_eofReached = ETrue;
} }

View File

@ -324,7 +324,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
if (SysHandleEvent(&ev)) if (SysHandleEvent(&ev))
continue; continue;
switch(ev.eType) { switch (ev.eType) {
case penMoveEvent: case penMoveEvent:
get_coordinates(&ev, x, y); get_coordinates(&ev, x, y);

View File

@ -53,7 +53,7 @@ int OSystem_PalmBase::getGraphicsMode() const {
} }
bool OSystem_PalmBase::setGraphicsMode(int mode) { bool OSystem_PalmBase::setGraphicsMode(int mode) {
switch(mode) { switch (mode) {
case GFX_NORMAL: case GFX_NORMAL:
case GFX_WIDE: case GFX_WIDE:
_setMode = mode; _setMode = mode;

View File

@ -282,7 +282,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) {
while (SDL_PollEvent(&ev)) { while (SDL_PollEvent(&ev)) {
switch(ev.type) { switch (ev.type) {
case SDL_KEYDOWN:{ case SDL_KEYDOWN:{
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());

View File

@ -179,7 +179,7 @@ bool OSystem_GP2X::setGraphicsMode(int mode) {
int newScaleFactor = 1; int newScaleFactor = 1;
switch(mode) { switch (mode) {
case GFX_NORMAL: case GFX_NORMAL:
newScaleFactor = 1; newScaleFactor = 1;
break; break;

View File

@ -81,7 +81,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
} }
void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) { void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) {
if(_videoMode.mode == GFX_HALF && !_overlayVisible){ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
event.mouse.x = x*2; event.mouse.x = x*2;
event.mouse.y = y*2; event.mouse.y = y*2;
} else { } else {
@ -216,7 +216,7 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {
while (SDL_PollEvent(&ev)) { while (SDL_PollEvent(&ev)) {
switch(ev.type) { switch (ev.type) {
case SDL_KEYDOWN:{ case SDL_KEYDOWN:{
b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState());

View File

@ -58,7 +58,7 @@ bool OSystem_GP2XWIZ::setGraphicsMode(int mode) {
int newScaleFactor = 1; int newScaleFactor = 1;
switch(mode) { switch (mode) {
case GFX_NORMAL: case GFX_NORMAL:
newScaleFactor = 1; newScaleFactor = 1;
break; break;
@ -121,7 +121,7 @@ void OSystem_GP2XWIZ::initSize(uint w, uint h) {
_videoMode.screenWidth = w; _videoMode.screenWidth = w;
_videoMode.screenHeight = h; _videoMode.screenHeight = h;
if(w > 320 || h > 240){ if (w > 320 || h > 240){
setGraphicsMode(GFX_HALF); setGraphicsMode(GFX_HALF);
setGraphicsModeIntern(); setGraphicsModeIntern();
toggleMouseGrab(); toggleMouseGrab();
@ -157,7 +157,7 @@ void OSystem_GP2XWIZ::drawMouse() {
int width, height; int width, height;
int hotX, hotY; int hotX, hotY;
if(_videoMode.mode == GFX_HALF && !_overlayVisible){ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
dst.x = _mouseCurState.x/2; dst.x = _mouseCurState.x/2;
dst.y = _mouseCurState.y/2; dst.y = _mouseCurState.y/2;
} else { } else {
@ -227,7 +227,7 @@ void OSystem_GP2XWIZ::undrawMouse() {
return; return;
if (_mouseBackup.w != 0 && _mouseBackup.h != 0){ if (_mouseBackup.w != 0 && _mouseBackup.h != 0){
if(_videoMode.mode == GFX_HALF && !_overlayVisible){ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2);
} else { } else {
addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
@ -368,12 +368,12 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
assert(scalerProc != NULL); assert(scalerProc != NULL);
if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){
if(dst_x%2==1){ if (dst_x%2==1){
dst_x--; dst_x--;
dst_w++; dst_w++;
} }
if(dst_y%2==1){ if (dst_y%2==1){
dst_y--; dst_y--;
dst_h++; dst_h++;
} }
@ -386,7 +386,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
(byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h); (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
} }
if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){
r->w = r->w / 2; r->w = r->w / 2;
r->h = dst_h / 2; r->h = dst_h / 2;
} else { } else {
@ -430,7 +430,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
} }
void OSystem_GP2XWIZ::showOverlay() { void OSystem_GP2XWIZ::showOverlay() {
if(_videoMode.mode == GFX_HALF){ if (_videoMode.mode == GFX_HALF){
_mouseCurState.x = _mouseCurState.x / 2; _mouseCurState.x = _mouseCurState.x / 2;
_mouseCurState.y = _mouseCurState.y / 2; _mouseCurState.y = _mouseCurState.y / 2;
} }
@ -438,7 +438,7 @@ void OSystem_GP2XWIZ::showOverlay() {
} }
void OSystem_GP2XWIZ::hideOverlay() { void OSystem_GP2XWIZ::hideOverlay() {
if(_videoMode.mode == GFX_HALF){ if (_videoMode.mode == GFX_HALF){
_mouseCurState.x = _mouseCurState.x * 2; _mouseCurState.x = _mouseCurState.x * 2;
_mouseCurState.y = _mouseCurState.y * 2; _mouseCurState.y = _mouseCurState.y * 2;
} }
@ -447,7 +447,7 @@ void OSystem_GP2XWIZ::hideOverlay() {
void OSystem_GP2XWIZ::warpMouse(int x, int y) { void OSystem_GP2XWIZ::warpMouse(int x, int y) {
if (_mouseCurState.x != x || _mouseCurState.y != y) { if (_mouseCurState.x != x || _mouseCurState.y != y) {
if(_videoMode.mode == GFX_HALF && !_overlayVisible){ if (_videoMode.mode == GFX_HALF && !_overlayVisible){
x = x / 2; x = x / 2;
y = y / 2; y = y / 2;
} }

View File

@ -65,8 +65,8 @@ void mixerMoveVolume(int direction) {
if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2; if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2; if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
} else { } else {
if(direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE; if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE; if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
} }
if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN; if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
@ -74,7 +74,7 @@ void mixerMoveVolume(int direction) {
unsigned long soundDev = open("/dev/mixer", O_RDWR); unsigned long soundDev = open("/dev/mixer", O_RDWR);
if(soundDev) { if (soundDev) {
int vol = ((volumeLevel << 8) | volumeLevel); int vol = ((volumeLevel << 8) | volumeLevel);
ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol); ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
close(soundDev); close(soundDev);

View File

@ -352,7 +352,7 @@ uint getSizeNextPOT(uint size) {
- (void)addEvent:(NSDictionary*)event { - (void)addEvent:(NSDictionary*)event {
if(_events == nil) if (_events == nil)
_events = [[NSMutableArray alloc] init]; _events = [[NSMutableArray alloc] init];
[_events addObject: event]; [_events addObject: event];

View File

@ -44,7 +44,7 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {
} }
void OSystem_LINUXMOTO::fillMouseEvent(Common::Event &event, int x, int y) { void OSystem_LINUXMOTO::fillMouseEvent(Common::Event &event, int x, int y) {
if(_videoMode.mode == GFX_HALF && !_overlayVisible) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
event.mouse.x = x*2; event.mouse.x = x*2;
event.mouse.y = y*2; event.mouse.y = y*2;
} else { } else {

View File

@ -58,7 +58,7 @@ bool OSystem_LINUXMOTO::setGraphicsMode(int mode) {
int newScaleFactor = 1; int newScaleFactor = 1;
switch(mode) { switch (mode) {
case GFX_NORMAL: case GFX_NORMAL:
newScaleFactor = 1; newScaleFactor = 1;
break; break;
@ -192,7 +192,6 @@ void OSystem_LINUXMOTO::drawMouse() {
dst.h = _mouseCurState.vH; dst.h = _mouseCurState.vH;
hotX = _mouseCurState.vHotX; hotX = _mouseCurState.vHotX;
hotY = _mouseCurState.vHotY; hotY = _mouseCurState.vHotY;
} else { } else {
scale = 1; scale = 1;
width = _videoMode.overlayWidth; width = _videoMode.overlayWidth;
@ -201,7 +200,6 @@ void OSystem_LINUXMOTO::drawMouse() {
dst.h = _mouseCurState.rH; dst.h = _mouseCurState.rH;
hotX = _mouseCurState.rHotX; hotX = _mouseCurState.rHotX;
hotY = _mouseCurState.rHotY; hotY = _mouseCurState.rHotY;
} }
// The mouse is undrawn using virtual coordinates, i.e. they may be // The mouse is undrawn using virtual coordinates, i.e. they may be
@ -247,7 +245,7 @@ void OSystem_LINUXMOTO::undrawMouse() {
if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))
return; return;
if (_mouseBackup.w != 0 && _mouseBackup.h != 0){ if (_mouseBackup.w != 0 && _mouseBackup.h != 0) {
if (_videoMode.mode == GFX_HALF && !_overlayVisible) { if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2);
} else { } else {
@ -414,7 +412,6 @@ void OSystem_LINUXMOTO::internUpdateScreen() {
} }
if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) { if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) {
r->w = r->w / 2; r->w = r->w / 2;
r->h = dst_h / 2; r->h = dst_h / 2;
} else { } else {
@ -425,7 +422,6 @@ void OSystem_LINUXMOTO::internUpdateScreen() {
r->x = dst_x; r->x = dst_x;
r->y = dst_y; r->y = dst_y;
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible) if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1); r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);

View File

@ -125,7 +125,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil
Common::FSNode file(path); Common::FSNode file(path);
if(!file.exists()) if (!file.exists())
return NULL; return NULL;
sf = file.createReadStream(); sf = file.createReadStream();
@ -133,7 +133,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil
} else { } else {
Common::FSNode file = savePath.getChild(filename); Common::FSNode file = savePath.getChild(filename);
if(!file.exists()) if (!file.exists())
return NULL; return NULL;
sf = file.createReadStream(); sf = file.createReadStream();

View File

@ -617,7 +617,7 @@ void OSystem_PSP::updateScreen() {
sceGuDisable(GU_ALPHA_TEST); sceGuDisable(GU_ALPHA_TEST);
sceGuEnable(GU_BLEND); sceGuEnable(GU_BLEND);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
switch(_keyboardMode) { switch (_keyboardMode) {
case 0: case 0:
sceGuTexImage(0, 512, 512, 480, keyboard_letters); sceGuTexImage(0, 512, 512, 480, keyboard_letters);
break; break;
@ -1006,7 +1006,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
if (_keySelected > 26) { if (_keySelected > 26) {
event.kbd.flags = 0; event.kbd.flags = 0;
switch(_keySelected) { switch (_keySelected) {
case 27: case 27:
event.kbd.ascii = ' '; event.kbd.ascii = ' ';
event.kbd.keycode = Common::KEYCODE_SPACE; event.kbd.keycode = Common::KEYCODE_SPACE;
@ -1025,7 +1025,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
break; break;
} }
} else { } else {
switch( _keyboardMode) { switch ( _keyboardMode) {
case 0: case 0:
event.kbd.flags = 0; event.kbd.flags = 0;
event.kbd.ascii = 'a'+_keySelected-1; event.kbd.ascii = 'a'+_keySelected-1;

View File

@ -23,7 +23,6 @@
* *
*/ */
#define USERSPACE_ONLY //don't use kernel mode features #define USERSPACE_ONLY //don't use kernel mode features
#ifndef USERSPACE_ONLY #ifndef USERSPACE_ONLY
@ -118,7 +117,7 @@ int CallbackThread(SceSize /*size*/, void *arg) {
cbid = sceKernelCreateCallback("Power Callback", (SceKernelCallbackFunction)power_callback, 0); cbid = sceKernelCreateCallback("Power Callback", (SceKernelCallbackFunction)power_callback, 0);
if (cbid >= 0) { if (cbid >= 0) {
if(scePowerRegisterCallback(-1, cbid) < 0) { if (scePowerRegisterCallback(-1, cbid) < 0) {
PSPDebugTrace("SetupCallbacks(): Couldn't register callback for power_callback\n"); PSPDebugTrace("SetupCallbacks(): Couldn't register callback for power_callback\n");
} }
} else { } else {

View File

@ -301,7 +301,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
int newScaleFactor = 1; int newScaleFactor = 1;
switch(mode) { switch (mode) {
case GFX_NORMAL: case GFX_NORMAL:
newScaleFactor = 1; newScaleFactor = 1;
break; break;

View File

@ -151,7 +151,7 @@ void CScummVMUi::BringUpEmulatorL() {
} }
void CScummVMUi::HandleCommandL(TInt aCommand) { void CScummVMUi::HandleCommandL(TInt aCommand) {
switch(aCommand) { switch (aCommand) {
case EEikCmdExit: case EEikCmdExit:
{ {
RThread thread; RThread thread;

View File

@ -84,7 +84,7 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
}; };
bool OSystem_SDL_Symbian::hasFeature(Feature f) { bool OSystem_SDL_Symbian::hasFeature(Feature f) {
switch(f) { switch (f) {
case kFeatureFullscreenMode: case kFeatureFullscreenMode:
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
case kFeatureAutoComputeDirtyRects: case kFeatureAutoComputeDirtyRects:
@ -100,7 +100,7 @@ bool OSystem_SDL_Symbian::hasFeature(Feature f) {
} }
void OSystem_SDL_Symbian::setFeatureState(Feature f, bool enable) { void OSystem_SDL_Symbian::setFeatureState(Feature f, bool enable) {
switch(f) { switch (f) {
case kFeatureVirtualKeyboard: case kFeatureVirtualKeyboard:
if (enable) { if (enable) {
} }
@ -326,7 +326,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {
if (GUI::Actions::Instance()->getMapping(loop) == ev.key.keysym.sym && if (GUI::Actions::Instance()->getMapping(loop) == ev.key.keysym.sym &&
GUI::Actions::Instance()->isEnabled(loop)) { GUI::Actions::Instance()->isEnabled(loop)) {
// Create proper event instead // Create proper event instead
switch(loop) { switch (loop) {
case GUI::ACTION_UP: case GUI::ACTION_UP:
if (ev.type == SDL_KEYDOWN) { if (ev.type == SDL_KEYDOWN) {
_km.y_vel = -1; _km.y_vel = -1;

View File

@ -258,7 +258,7 @@ void OSystem_Wii::initSize(uint width, uint height,
} }
if (update) { if (update) {
if(_gamePixels) if (_gamePixels)
free(_gamePixels); free(_gamePixels);
tex_format = GFX_TF_PALETTE_RGB565; tex_format = GFX_TF_PALETTE_RGB565;

View File

@ -232,7 +232,7 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
static bool keydialogrunning = false, quitdialog = false; static bool keydialogrunning = false, quitdialog = false;
if (!pushed) { if (!pushed) {
switch(action) { switch (action) {
case POCKET_ACTION_RIGHTCLICK: case POCKET_ACTION_RIGHTCLICK:
_CESystem->add_right_click(false); _CESystem->add_right_click(false);
return true; return true;

View File

@ -94,7 +94,7 @@ void CEException::dumpException(HANDLE file, EXCEPTION_RECORD *exceptionRecord)
unsigned int i; unsigned int i;
#if (_WIN32_WCE >= 300) #if (_WIN32_WCE >= 300)
writeBreak(file); writeBreak(file);
switch(exceptionRecord->ExceptionCode) { switch (exceptionRecord->ExceptionCode) {
case EXCEPTION_ACCESS_VIOLATION : case EXCEPTION_ACCESS_VIOLATION :
strcpy(exceptionName, "Access Violation"); strcpy(exceptionName, "Access Violation");
break; break;

View File

@ -935,7 +935,7 @@ bool OSystem_WINCE3::hasFeature(Feature f) {
} }
void OSystem_WINCE3::setFeatureState(Feature f, bool enable) { void OSystem_WINCE3::setFeatureState(Feature f, bool enable) {
switch(f) { switch (f) {
case kFeatureFullscreenMode: case kFeatureFullscreenMode:
return; return;
@ -970,7 +970,7 @@ void OSystem_WINCE3::setFeatureState(Feature f, bool enable) {
} }
bool OSystem_WINCE3::getFeatureState(Feature f) { bool OSystem_WINCE3::getFeatureState(Feature f) {
switch(f) { switch (f) {
case kFeatureFullscreenMode: case kFeatureFullscreenMode:
return false; return false;
case kFeatureVirtualKeyboard: case kFeatureVirtualKeyboard:
@ -1277,7 +1277,7 @@ bool OSystem_WINCE3::setGraphicsMode(int mode) {
if (_scaleFactorXm < 0) { if (_scaleFactorXm < 0) {
/* Standard scalers, from the SDL backend */ /* Standard scalers, from the SDL backend */
switch(_videoMode.mode) { switch (_videoMode.mode) {
case GFX_NORMAL: case GFX_NORMAL:
_videoMode.scaleFactor = 1; _videoMode.scaleFactor = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
@ -2308,7 +2308,7 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) {
currentTime = GetTickCount(); currentTime = GetTickCount();
while (SDL_PollEvent(&ev)) { while (SDL_PollEvent(&ev)) {
switch(ev.type) { switch (ev.type) {
case SDL_KEYDOWN: case SDL_KEYDOWN:
debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym)); debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym));
// KMOD_RESERVED is used if the key has been injected by an external buffer // KMOD_RESERVED is used if the key has been injected by an external buffer

View File

@ -337,7 +337,7 @@ void VirtualKeyboard::KeyPressQueue::deleteKey() {
List<VirtualKeyPress>::iterator it = _keyPos; List<VirtualKeyPress>::iterator it = _keyPos;
it--; it--;
_strPos -= it->strLen; _strPos -= it->strLen;
while((it->strLen)-- > 0) while ((it->strLen)-- > 0)
_keysStr.deleteChar(_strPos); _keysStr.deleteChar(_strPos);
_keys.erase(it); _keys.erase(it);
_strChanged = true; _strChanged = true;

View File

@ -39,7 +39,7 @@ void readRecord(Common::InSaveFile *inFile, uint32 &diff, Common::Event &event)
event.type = (Common::EventType)inFile->readUint32LE(); event.type = (Common::EventType)inFile->readUint32LE();
switch(event.type) { switch (event.type) {
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP: case Common::EVENT_KEYUP:
event.kbd.keycode = (Common::KeyCode)inFile->readSint32LE(); event.kbd.keycode = (Common::KeyCode)inFile->readSint32LE();
@ -66,7 +66,7 @@ void writeRecord(Common::OutSaveFile *outFile, uint32 diff, const Common::Event
outFile->writeUint32LE((uint32)event.type); outFile->writeUint32LE((uint32)event.type);
switch(event.type) { switch (event.type) {
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP: case Common::EVENT_KEYUP:
outFile->writeSint32LE(event.kbd.keycode); outFile->writeSint32LE(event.kbd.keycode);
@ -340,7 +340,7 @@ bool EventRecorder::pollEvent(Common::Event &ev) {
if (_hasPlaybackEvent) { if (_hasPlaybackEvent) {
if (_playbackDiff <= (_eventCount - _lastEventCount)) { if (_playbackDiff <= (_eventCount - _lastEventCount)) {
switch(_playbackEvent.type) { switch (_playbackEvent.type) {
case Common::EVENT_MOUSEMOVE: case Common::EVENT_MOUSEMOVE:
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONUP:

View File

@ -202,7 +202,7 @@ bool SeekableSubReadStream::seek(int32 offset, int whence) {
assert(_pos >= _begin); assert(_pos >= _begin);
assert(_pos <= _end); assert(_pos <= _end);
switch(whence) { switch (whence) {
case SEEK_END: case SEEK_END:
offset = size() + offset; offset = size() + offset;
// fallthrough // fallthrough

View File

@ -154,7 +154,7 @@ public:
bool seek(int32 offset, int whence = SEEK_SET) { bool seek(int32 offset, int whence = SEEK_SET) {
int32 newPos = 0; int32 newPos = 0;
assert(whence != SEEK_END); // SEEK_END not supported assert(whence != SEEK_END); // SEEK_END not supported
switch(whence) { switch (whence) {
case SEEK_SET: case SEEK_SET:
newPos = offset; newPos = offset;
break; break;

View File

@ -124,7 +124,7 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
while (!shouldQuit()) { while (!shouldQuit()) {
while (_eventMan->pollEvent(event)) { while (_eventMan->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
return 0; return 0;

View File

@ -295,7 +295,7 @@ void Mickey::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, i
int iWord; int iWord;
int *sel = 0; int *sel = 0;
switch(iRow) { switch (iRow) {
case 0: case 0:
if (y != IDI_MSA_ROW_MENU_0) return; if (y != IDI_MSA_ROW_MENU_0) return;
sel = sel0; sel = sel0;
@ -323,7 +323,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
int x, y; int x, y;
int goIndex = -1, northIndex = -1, southIndex = -1, eastIndex = -1, westIndex = -1; int goIndex = -1, northIndex = -1, southIndex = -1, eastIndex = -1, westIndex = -1;
switch(iRow) { switch (iRow) {
case 0: case 0:
sel = sel0; sel = sel0;
break; break;
@ -361,7 +361,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
return 0; return 0;
@ -679,7 +679,7 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {
uint8 *buffer = new uint8[1024]; uint8 *buffer = new uint8[1024];
int pBuf = 1; int pBuf = 1;
switch(iSound) { switch (iSound) {
case IDI_MSA_SND_XL30: case IDI_MSA_SND_XL30:
for (int iNote = 0; iNote < 6; iNote++) { for (int iNote = 0; iNote < 6; iNote++) {
note.counter = _vm->rnd(59600) + 59; note.counter = _vm->rnd(59600) + 59;
@ -701,7 +701,7 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {
if (iSound == IDI_MSA_SND_THEME) { if (iSound == IDI_MSA_SND_THEME) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONUP:
@ -769,7 +769,7 @@ void Mickey::drawRoomAnimation() {
0xF0, 1, 0xF9, 2, 43, 45, 0xFF 0xF0, 1, 0xF9, 2, 43, 45, 0xFF
}; };
switch(_game.iRoom) { switch (_game.iRoom) {
case IDI_MSA_PIC_EARTH_SHIP: case IDI_MSA_PIC_EARTH_SHIP:
case IDI_MSA_PIC_VENUS_SHIP: case IDI_MSA_PIC_VENUS_SHIP:
case IDI_MSA_PIC_NEPTUNE_SHIP: case IDI_MSA_PIC_NEPTUNE_SHIP:
@ -835,7 +835,7 @@ void Mickey::drawRoomAnimation() {
// draw crystal // draw crystal
if (_game.iRoom == IDI_MSA_XTAL_ROOM_XY[_game.iPlanet][0]) { if (_game.iRoom == IDI_MSA_XTAL_ROOM_XY[_game.iPlanet][0]) {
if (!_game.fHasXtal) { if (!_game.fHasXtal) {
switch(_game.iPlanet) { switch (_game.iPlanet) {
case IDI_MSA_PLANET_VENUS: case IDI_MSA_PLANET_VENUS:
if (_game.iRmMenu[_game.iRoom] != 2) if (_game.iRmMenu[_game.iRoom] != 2)
break; break;
@ -1488,7 +1488,7 @@ void Mickey::getXtal(int iStr) {
} }
bool Mickey::parse(int cmd, int arg) { bool Mickey::parse(int cmd, int arg) {
switch(cmd) { switch (cmd) {
// BASIC // BASIC
@ -2211,7 +2211,7 @@ void Mickey::waitAnyKey(bool anim) {
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:

View File

@ -60,7 +60,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) {
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
return 0; return 0;
@ -207,7 +207,7 @@ void Troll::waitAnyKeyIntro() {
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
case Common::EVENT_LBUTTONUP: case Common::EVENT_LBUTTONUP:
@ -285,7 +285,7 @@ void Troll::tutorial() {
while (!done && !_vm->shouldQuit()) { while (!done && !_vm->shouldQuit()) {
getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION); getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION);
switch(iSel) { switch (iSel) {
case IDI_TRO_SEL_OPTION_1: case IDI_TRO_SEL_OPTION_1:
_vm->clearScreen(0x22, false); _vm->clearScreen(0x22, false);
_vm->_gfx->doUpdate(); _vm->_gfx->doUpdate();
@ -579,7 +579,7 @@ void Troll::gameLoop() {
roomParam = _roomDescs[_roomPicture - 1].roomDescIndex[currentOption]; roomParam = _roomDescs[_roomPicture - 1].roomDescIndex[currentOption];
switch(_roomDescs[_roomPicture - 1].optionTypes[currentOption]) { switch (_roomDescs[_roomPicture - 1].optionTypes[currentOption]) {
case OT_FLASHLIGHT: case OT_FLASHLIGHT:
if (!haveFlashlight) { if (!haveFlashlight) {
printUserMessage(13); printUserMessage(13);

View File

@ -266,7 +266,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
// extract text from block // extract text from block
opcode = *(buffer + pc); opcode = *(buffer + pc);
switch(opcode) { switch (opcode) {
case 0: case 0:
case IDO_WTP_OPTION_0: case IDO_WTP_OPTION_0:
case IDO_WTP_OPTION_1: case IDO_WTP_OPTION_1:
@ -331,9 +331,9 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
} }
// process selection // process selection
switch(iSel) { switch (iSel) {
case IDI_WTP_SEL_HOME: case IDI_WTP_SEL_HOME:
switch(_room) { switch (_room) {
case IDI_WTP_ROOM_HOME: case IDI_WTP_ROOM_HOME:
case IDI_WTP_ROOM_MIST: case IDI_WTP_ROOM_MIST:
case IDI_WTP_ROOM_TIGGER: case IDI_WTP_ROOM_TIGGER:
@ -384,7 +384,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
// process script // process script
do { do {
opcode = *(buffer + pc++); opcode = *(buffer + pc++);
switch(opcode) { switch (opcode) {
case IDO_WTP_GOTO_ROOM: case IDO_WTP_GOTO_ROOM:
opcode = *(buffer + pc++); opcode = *(buffer + pc++);
iNewRoom = opcode; iNewRoom = opcode;
@ -726,7 +726,7 @@ void Winnie::drawMenu(char *szMenu, int iSel, int fCanSel[]) {
if (fCanSel[IDI_WTP_SEL_DROP]) if (fCanSel[IDI_WTP_SEL_DROP])
_vm->drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_DROP, IDA_DEFAULT, IDS_WTP_DROP); _vm->drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_DROP, IDA_DEFAULT, IDS_WTP_DROP);
switch(iSel) { switch (iSel) {
case IDI_WTP_SEL_OPT_1: case IDI_WTP_SEL_OPT_1:
case IDI_WTP_SEL_OPT_2: case IDI_WTP_SEL_OPT_2:
case IDI_WTP_SEL_OPT_3: case IDI_WTP_SEL_OPT_3:
@ -778,7 +778,7 @@ void Winnie::decMenuSel(int *iSel, int fCanSel[]) {
} }
void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) {
switch(y) { switch (y) {
case IDI_WTP_ROW_OPTION_1: case IDI_WTP_ROW_OPTION_1:
case IDI_WTP_ROW_OPTION_2: case IDI_WTP_ROW_OPTION_2:
case IDI_WTP_ROW_OPTION_3: case IDI_WTP_ROW_OPTION_3:
@ -816,7 +816,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
while (_vm->_system->getEventManager()->pollEvent(event)) { while (_vm->_system->getEventManager()->pollEvent(event)) {
switch(event.type) { switch (event.type) {
case Common::EVENT_RTL: case Common::EVENT_RTL:
case Common::EVENT_QUIT: case Common::EVENT_QUIT:
return; return;
@ -865,7 +865,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
_vm->_gfx->setCursorPalette(false); _vm->_gfx->setCursorPalette(false);
} }
switch(*iSel) { switch (*iSel) {
case IDI_WTP_SEL_OPT_1: case IDI_WTP_SEL_OPT_1:
case IDI_WTP_SEL_OPT_2: case IDI_WTP_SEL_OPT_2:
case IDI_WTP_SEL_OPT_3: case IDI_WTP_SEL_OPT_3:
@ -970,7 +970,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
makeSel(); makeSel();
break; break;
case Common::KEYCODE_RETURN: case Common::KEYCODE_RETURN:
switch(*iSel) { switch (*iSel) {
case IDI_WTP_SEL_OPT_1: case IDI_WTP_SEL_OPT_1:
case IDI_WTP_SEL_OPT_2: case IDI_WTP_SEL_OPT_2:
case IDI_WTP_SEL_OPT_3: case IDI_WTP_SEL_OPT_3:
@ -1036,7 +1036,7 @@ phase2:
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) {
switch(parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) { switch (parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) {
case IDI_WTP_PAR_GOTO: case IDI_WTP_PAR_GOTO:
goto phase0; goto phase0;
break; break;

View File

@ -695,7 +695,7 @@ void AGOSEngine_DIMP::dimpIdle() {
if (_variableArray[110] > 2) if (_variableArray[110] > 2)
break; break;
n = _rnd.getRandomNumber(6); n = _rnd.getRandomNumber(6);
switch(n) { switch (n) {
case(0): loadSoundFile("And01.wav");break; case(0): loadSoundFile("And01.wav");break;
case(1): loadSoundFile("And02.wav");break; case(1): loadSoundFile("And02.wav");break;
case(2): loadSoundFile("And03.wav");break; case(2): loadSoundFile("And03.wav");break;
@ -710,7 +710,7 @@ void AGOSEngine_DIMP::dimpIdle() {
if (_variableArray[111] > 2) if (_variableArray[111] > 2)
break; break;
n = _rnd.getRandomNumber(6); n = _rnd.getRandomNumber(6);
switch(n) { switch (n) {
case(0): loadSoundFile("And08.wav");break; case(0): loadSoundFile("And08.wav");break;
case(1): loadSoundFile("And09.wav");break; case(1): loadSoundFile("And09.wav");break;
case(2): loadSoundFile("And0a.wav");break; case(2): loadSoundFile("And0a.wav");break;
@ -725,7 +725,7 @@ void AGOSEngine_DIMP::dimpIdle() {
if (_variableArray[112] > 2) if (_variableArray[112] > 2)
break; break;
n = _rnd.getRandomNumber(4); n = _rnd.getRandomNumber(4);
switch(n) { switch (n) {
case(0): loadSoundFile("And0f.wav");break; case(0): loadSoundFile("And0f.wav");break;
case(1): loadSoundFile("And0g.wav");break; case(1): loadSoundFile("And0g.wav");break;
case(2): loadSoundFile("And0h.wav");break; case(2): loadSoundFile("And0h.wav");break;

View File

@ -23,8 +23,6 @@
* *
*/ */
#include "agos/agos.h" #include "agos/agos.h"
#include "agos/intern.h" #include "agos/intern.h"
@ -34,7 +32,7 @@ uint32 AGOSEngine_PN::ftext(uint32 base, int n) {
uint32 b = base; uint32 b = base;
int ct = n; int ct = n;
while (ct) { while (ct) {
while(_textBase[b++]) while (_textBase[b++])
; ;
ct--; ct--;
} }

View File

@ -299,7 +299,7 @@ void Game::loop() {
} }
} }
if(_vm->_mouse->isCursorOn()) { if (_vm->_mouse->isCursorOn()) {
// Fetch the dedicated objects' title animation / current frame // Fetch the dedicated objects' title animation / current frame
Animation *titleAnim = _vm->_anims->getAnimation(kTitleText); Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
Text *title = reinterpret_cast<Text *>(titleAnim->getFrame()); Text *title = reinterpret_cast<Text *>(titleAnim->getFrame());
@ -787,7 +787,7 @@ void Game::dialogueMenu(int dialogueID) {
_dialogueBegin = false; _dialogueBegin = false;
oldLines = _dialogueLinesNum; oldLines = _dialogueLinesNum;
} while(!_dialogueExit); } while (!_dialogueExit);
dialogueDone(); dialogueDone();
_currentDialogue = kNoDialogue; _currentDialogue = kNoDialogue;
@ -1562,7 +1562,7 @@ Common::Point WalkingMap::findNearestWalkable(int startX, int startY, Common::Re
// such resizing step, it checks some select points on the ellipse for walkability. // such resizing step, it checks some select points on the ellipse for walkability.
// It also does the same check for the ellipse perpendicular to it (rotated by 90 degrees). // It also does the same check for the ellipse perpendicular to it (rotated by 90 degrees).
while(1) { while (1) {
// The default major radius // The default major radius
radius += _deltaX; radius += _deltaX;

View File

@ -369,7 +369,7 @@ void Script::load(Common::Queue<int> &params) {
GameObject *obj = _vm->_game->getObject(objID); GameObject *obj = _vm->_game->getObject(objID);
// If the animation is already loaded, return // If the animation is already loaded, return
for(i = 0; i < obj->_anims.size(); ++i) { for (i = 0; i < obj->_anims.size(); ++i) {
if (obj->_anims[i] == animID) { if (obj->_anims[i] == animID) {
return; return;
} }
@ -384,7 +384,7 @@ void Script::load(Common::Queue<int> &params) {
// Care must be taken to store them sorted (increasing order) as some things // Care must be taken to store them sorted (increasing order) as some things
// depend on this. // depend on this.
for(i = 0; i < obj->_anims.size(); ++i) { for (i = 0; i < obj->_anims.size(); ++i) {
if (obj->_anims[i] > animID) { if (obj->_anims[i] > animID) {
break; break;
} }

View File

@ -151,7 +151,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {
break; break;
case DRAW_PUTPIXEL: case DRAW_PUTPIXEL:
switch(_pattern & 0xFF) { switch (_pattern & 0xFF) {
case -1: case -1:
warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIXEL, pattern -1"); warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIXEL, pattern -1");
break; break;
@ -180,7 +180,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {
_destSpriteY + (_pattern + 1) / 2); _destSpriteY + (_pattern + 1) / 2);
break; break;
case DRAW_FILLRECT: case DRAW_FILLRECT:
switch(_pattern & 0xFF) { switch (_pattern & 0xFF) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
@ -217,7 +217,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {
_destSpriteX + 1, _destSpriteY + 1, _destSpriteX + 1, _destSpriteY + 1,
_spriteRight + 1, _spriteBottom + 1, _frontColor); _spriteRight + 1, _spriteBottom + 1, _frontColor);
} else { } else {
switch(_pattern & 0xFF) { switch (_pattern & 0xFF) {
case 0: case 0:
_vm->_video->drawLine(*_spritesArray[_destSurface], _vm->_video->drawLine(*_spritesArray[_destSurface],
_destSpriteX, _destSpriteY, _destSpriteX, _destSpriteY,

View File

@ -199,7 +199,7 @@ protected:
bool o1_callSub(OpFuncParams &params); bool o1_callSub(OpFuncParams &params);
bool o1_printTotText(OpFuncParams &params); bool o1_printTotText(OpFuncParams &params);
bool o1_loadCursor(OpFuncParams &params); bool o1_loadCursor(OpFuncParams &params);
bool o1_switch(OpFuncParams &params); bool o1_switch (OpFuncParams &params);
bool o1_repeatUntil(OpFuncParams &params); bool o1_repeatUntil(OpFuncParams &params);
bool o1_whileDo(OpFuncParams &params); bool o1_whileDo(OpFuncParams &params);
bool o1_if(OpFuncParams &params); bool o1_if(OpFuncParams &params);

View File

@ -722,7 +722,7 @@ bool Inter_v1::o1_loadCursor(OpFuncParams &params) {
return false; return false;
} }
bool Inter_v1::o1_switch(OpFuncParams &params) { bool Inter_v1::o1_switch (OpFuncParams &params) {
uint32 offset; uint32 offset;
checkSwitchTable(offset); checkSwitchTable(offset);

View File

@ -610,7 +610,7 @@ void MDYPlayer::interpret() {
do { do {
instr = *_playPos; instr = *_playPos;
// printf("instr 0x%X\n", instr); // printf("instr 0x%X\n", instr);
switch(instr) { switch (instr) {
case 0xF8: case 0xF8:
_wait = *(_playPos++); _wait = *(_playPos++);
break; break;
@ -640,7 +640,7 @@ void MDYPlayer::interpret() {
} }
channel = (int)(instr & 0x0f); channel = (int)(instr & 0x0f);
switch(instr & 0xf0) { switch (instr & 0xf0) {
case 0x90: case 0x90:
note = *(_playPos++); note = *(_playPos++);
volume = *(_playPos++); volume = *(_playPos++);

View File

@ -279,7 +279,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)
quitGame(); quitGame();
} }
} else { } else {
switch(event.kbd.keycode) { switch (event.kbd.keycode) {
case Common::KEYCODE_SPACE: case Common::KEYCODE_SPACE:
keys = 61; keys = 61;
break; break;

View File

@ -1405,7 +1405,7 @@ void LoLEngine::processGasExplosion(int soundId) {
} }
int LoLEngine::smoothScrollDrawSpecialGuiShape(int pageNum) { int LoLEngine::smoothScrollDrawSpecialGuiShape(int pageNum) {
if(!_specialGuiShape) if (!_specialGuiShape)
return 0; return 0;
_screen->clearGuiShapeMemory(pageNum); _screen->clearGuiShapeMemory(pageNum);

View File

@ -714,7 +714,7 @@ void LoLEngine::showStarcraftLogo() {
if (!(shouldQuit() || inputFlag)) { if (!(shouldQuit() || inputFlag)) {
_sound->voicePlay("star2", &_speechHandle); _sound->voicePlay("star2", &_speechHandle);
while(_sound->voiceIsPlaying(&_speechHandle) && !(shouldQuit() || inputFlag)) { while (_sound->voiceIsPlaying(&_speechHandle) && !(shouldQuit() || inputFlag)) {
inputFlag = checkInput(0) & 0xff; inputFlag = checkInput(0) & 0xff;
delay(_tickLength); delay(_tickLength);
} }

View File

@ -235,7 +235,7 @@ void ConversationView::selectEntry(int entryIndex) {
} }
void ConversationView::updateState() { void ConversationView::updateState() {
switch(_conversationState) { switch (_conversationState) {
case kConversationOptionsShown: case kConversationOptionsShown:
return; return;
case kEntryIsActive: case kEntryIsActive:
@ -412,7 +412,7 @@ void Converse::loadConversation(const char *convName) {
if (convS->eos()) break; if (convS->eos()) break;
if (debugFlag) printf("***** Pos: %i -> ", chunkPos); if (debugFlag) printf("***** Pos: %i -> ", chunkPos);
switch(chunk) { switch (chunk) {
case CHUNK_DECL: // Declare case CHUNK_DECL: // Declare
if (debugFlag) printf("DECL chunk\n"); if (debugFlag) printf("DECL chunk\n");
data = convS->readUint32LE(); data = convS->readUint32LE();

View File

@ -572,7 +572,7 @@ void Parallaction::runZone(ZonePtr z) {
uint16 actionType = ACTIONTYPE(z); uint16 actionType = ACTIONTYPE(z);
debugC(3, kDebugExec, "actionType = %x, itemType = %x", actionType, ITEMTYPE(z)); debugC(3, kDebugExec, "actionType = %x, itemType = %x", actionType, ITEMTYPE(z));
switch(actionType) { switch (actionType) {
case kZoneExamine: case kZoneExamine:
enterCommentMode(z); enterCommentMode(z);

View File

@ -134,7 +134,7 @@ bool Parallaction_br::processGameEvent(int event) {
bool c = true; bool c = true;
_input->stopHovering(); _input->stopHovering();
switch(event) { switch (event) {
case kEvIngameMenu: case kEvIngameMenu:
startIngameMenu(); startIngameMenu();
c = false; c = false;

View File

@ -256,7 +256,7 @@ bool Parallaction_ns::processGameEvent(int event) {
bool c = true; bool c = true;
_input->stopHovering(); _input->stopHovering();
switch(event) { switch (event) {
case kEvSaveGame: case kEvSaveGame:
_saveLoad->saveGame(); _saveLoad->saveGame();
break; break;

View File

@ -1067,7 +1067,7 @@ void IsoMap::testPossibleDirections(int16 u, int16 v, uint16 terraComp[8], int s
memset(terraComp, 0, 8 * sizeof(uint16)); memset(terraComp, 0, 8 * sizeof(uint16));
#define FILL_MASK(index, testMask) \ #define FILL_MASK(index, testMask) \
if ( mask & testMask) { \ if (mask & testMask) { \
terraComp[index] |= fgdMask; \ terraComp[index] |= fgdMask; \
} \ } \
if (~mask & testMask) { \ if (~mask & testMask) { \
@ -1370,7 +1370,7 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo
tile = getTile(u1, v1, _platformHeight ); tile = getTile(u1, v1, _platformHeight );
if (tile != NULL) { if (tile != NULL) {
mask = tile->terrainMask; mask = tile->terrainMask;
if ( ((mask != 0) && (tile->GetFGDAttr() >= kTerrBlock)) || if (((mask != 0) && (tile->GetFGDAttr() >= kTerrBlock)) ||
((mask != 0xFFFF) && (tile->GetBGDAttr() >= kTerrBlock)) ) { ((mask != 0xFFFF) && (tile->GetBGDAttr() >= kTerrBlock)) ) {
pcell->visited = 1; pcell->visited = 1;
} }

View File

@ -169,7 +169,7 @@ Common::Error SagaEngine::run() {
if (_readingSpeed > 3) if (_readingSpeed > 3)
_readingSpeed = 0; _readingSpeed = 0;
switch(getGameId()) { switch (getGameId()) {
case GID_ITE: case GID_ITE:
_resource = new Resource_RSC(this); _resource = new Resource_RSC(this);
break; break;

View File

@ -1003,7 +1003,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
* Used for synthesized music playback * Used for synthesized music playback
*/ */
reg_t kDoSound(EngineState *s, int argc, reg_t *argv) { reg_t kDoSound(EngineState *s, int argc, reg_t *argv) {
switch(s->detectDoSoundType()) { switch (s->detectDoSoundType()) {
case SCI_VERSION_0_EARLY: case SCI_VERSION_0_EARLY:
return kDoSoundSci0(s, argc, argv); return kDoSoundSci0(s, argc, argv);
case SCI_VERSION_1_EARLY: case SCI_VERSION_1_EARLY:

View File

@ -545,7 +545,7 @@ static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {
int seeker_size = READ_LE_UINT16(buf + 2); int seeker_size = READ_LE_UINT16(buf + 2);
assert(seeker_size > 0); assert(seeker_size > 0);
buf += seeker_size; buf += seeker_size;
} while(1); } while (1);
return NULL; return NULL;
} }

View File

@ -271,7 +271,7 @@ SciVersion EngineState::detectDoSoundType() {
if (!parse_reg_t(this, "?Sound", &soundClass)) { if (!parse_reg_t(this, "?Sound", &soundClass)) {
int sum = methodChecksum(soundClass, _kernel->_selectorCache.play, -6, 6); int sum = methodChecksum(soundClass, _kernel->_selectorCache.play, -6, 6);
switch(sum) { switch (sum) {
case 0x1B2: // SCI0 case 0x1B2: // SCI0
case 0x1AE: // SCI01 case 0x1AE: // SCI01
_doSoundType = SCI_VERSION_0_EARLY; _doSoundType = SCI_VERSION_0_EARLY;

View File

@ -403,7 +403,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
sendCalls.push(call); sendCalls.push(call);
break; break;
} // switch(lookup_selector()) } // switch (lookup_selector())
framesize -= (2 + argc); framesize -= (2 + argc);
argp += argc + 1; argp += argc + 1;
@ -1410,7 +1410,7 @@ void run_vm(EngineState *s, int restoring) {
default: default:
error("run_vm(): illegal opcode %x", opnumber); error("run_vm(): illegal opcode %x", opnumber);
} // switch(opcode >> 1) } // switch (opcode >> 1)
if (s->_executionStackPosChanged) // Force initialization if (s->_executionStackPosChanged) // Force initialization
scriptState.xs = xs_new; scriptState.xs = xs_new;

View File

@ -1532,7 +1532,7 @@ ViewType ResourceManager::detectViewType() {
Resource *res = findResource(ResourceId(kResourceTypeView, i), 0); Resource *res = findResource(ResourceId(kResourceTypeView, i), 0);
if (res) { if (res) {
switch(res->data[1]) { switch (res->data[1]) {
case 128: case 128:
// If the 2nd byte is 128, it's a VGA game // If the 2nd byte is 128, it's a VGA game
return kViewVga; return kViewVga;

View File

@ -226,7 +226,7 @@ void SfxPlayer::player_timer_callback(void *refCon) {
Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) { Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {
MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB); MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB);
switch(musicDriver) { switch (musicDriver) {
case MD_ADLIB: case MD_ADLIB:
_mididrv = new MidiPlayer_Adlib(); _mididrv = new MidiPlayer_Adlib();
break; break;

View File

@ -320,7 +320,7 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) {
saa->noise[ch].counter -= saa->noise[ch].freq; saa->noise[ch].counter -= saa->noise[ch].freq;
while (saa->noise[ch].counter < 0) { while (saa->noise[ch].counter < 0) {
saa->noise[ch].counter += _sampleRate; saa->noise[ch].counter += _sampleRate;
if( ((saa->noise[ch].level & 0x4000) == 0) == ((saa->noise[ch].level & 0x0040) == 0) ) if (((saa->noise[ch].level & 0x4000) == 0) == ((saa->noise[ch].level & 0x0040) == 0) )
saa->noise[ch].level = (saa->noise[ch].level << 1) | 1; saa->noise[ch].level = (saa->noise[ch].level << 1) | 1;
else else
saa->noise[ch].level <<= 1; saa->noise[ch].level <<= 1;

View File

@ -23,7 +23,6 @@
* *
*/ */
#include "common/endian.h" #include "common/endian.h"
#include "common/rect.h" #include "common/rect.h"
#include "common/events.h" #include "common/events.h"
@ -1918,7 +1917,7 @@ bool Logic::fnStartMenu(uint32 firstObject, uint32 b, uint32 c) {
uint32 menuLength = 0; uint32 menuLength = 0;
for (i = firstObject; i < firstObject + ARRAYSIZE(_objectList); i++) { for (i = firstObject; i < firstObject + ARRAYSIZE(_objectList); i++) {
if ( _scriptVariables[i] ) if (_scriptVariables[i])
_objectList[menuLength++] = _scriptVariables[i]; _objectList[menuLength++] = _scriptVariables[i];
} }
_scriptVariables[MENU_LENGTH] = menuLength; _scriptVariables[MENU_LENGTH] = menuLength;

View File

@ -1032,7 +1032,7 @@ void Control::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) {
dst[cntx] = sprData[cntx]; dst[cntx] = sprData[cntx];
} }
if(SwordEngine::isPsx()) { //On PSX version we need to double horizontal lines if (SwordEngine::isPsx()) { //On PSX version we need to double horizontal lines
dst += SCREEN_WIDTH; dst += SCREEN_WIDTH;
for (uint16 cntx = 0; cntx < _resMan->getUint16(chSpr->width); cntx++) for (uint16 cntx = 0; cntx < _resMan->getUint16(chSpr->width); cntx++)
if (sprData[cntx]) if (sprData[cntx])
@ -1074,7 +1074,7 @@ void Control::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) {
for (uint16 cnty = 0; cnty < barHeight; cnty++) { for (uint16 cnty = 0; cnty < barHeight; cnty++) {
memcpy(destMem, srcMem, _resMan->getUint16(frHead->width)); memcpy(destMem, srcMem, _resMan->getUint16(frHead->width));
if(SwordEngine::isPsx()) { //linedoubling if (SwordEngine::isPsx()) { //linedoubling
destMem += SCREEN_WIDTH; destMem += SCREEN_WIDTH;
memcpy(destMem, srcMem, _resMan->getUint16(frHead->width)); memcpy(destMem, srcMem, _resMan->getUint16(frHead->width));
} }

View File

@ -23,7 +23,6 @@
* *
*/ */
#include "common/endian.h" #include "common/endian.h"
#include "common/util.h" #include "common/util.h"
#include "common/system.h" #include "common/system.h"
@ -114,7 +113,7 @@ void Logic::newScreen(uint32 screen) {
} }
// work around, at screen 69 in psx version TOP menu gets stuck at disabled, fix it at next screen (71) // work around, at screen 69 in psx version TOP menu gets stuck at disabled, fix it at next screen (71)
if( (screen == 71) && (SwordEngine::isPsx())) if ((screen == 71) && (SwordEngine::isPsx()))
_scriptVars[TOP_MENU_DISABLED] = 0; _scriptVars[TOP_MENU_DISABLED] = 0;
if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved

View File

@ -23,7 +23,6 @@
* *
*/ */
#include "common/system.h" #include "common/system.h"
#include "graphics/cursorman.h" #include "graphics/cursorman.h"
@ -245,7 +244,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
if (luggSrc[cntx]) if (luggSrc[cntx])
dstData[cntx] = luggSrc[cntx]; dstData[cntx] = luggSrc[cntx];
if(SwordEngine::isPsx()) { if (SwordEngine::isPsx()) {
dstData += resSizeX; dstData += resSizeX;
for (uint32 cntx = 0; cntx < luggSizeX; cntx++) for (uint32 cntx = 0; cntx < luggSizeX; cntx++)
if (luggSrc[cntx]) if (luggSrc[cntx])
@ -267,7 +266,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
if (srcData[cntx]) if (srcData[cntx])
dstData[cntx] = srcData[cntx]; dstData[cntx] = srcData[cntx];
if(SwordEngine::isPsx()) { if (SwordEngine::isPsx()) {
dstData +=resSizeX; dstData +=resSizeX;
for (uint32 cntx = 0; cntx < ptrSizeX; cntx++) for (uint32 cntx = 0; cntx < ptrSizeX; cntx++)
if (srcData[cntx]) if (srcData[cntx])

View File

@ -705,7 +705,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
if (lastDir != currentDir) { if (lastDir != currentDir) {
// get the direction to turn // get the direction to turn
turnDir = currentDir - lastDir; turnDir = currentDir - lastDir;
if ( turnDir < 0) if (turnDir < 0)
turnDir += NO_DIRECTIONS; turnDir += NO_DIRECTIONS;
if (turnDir > 4) if (turnDir > 4)
@ -716,7 +716,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction // rotate to new walk direction
// for george and nico put in a head turn at the start // for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) { if ((megaId == GEORGE) || (megaId == NICO)) {
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir; module = turnFramesLeft + lastDir;
} else { } else {
module = turnFramesRight + lastDir; module = turnFramesRight + lastDir;
@ -732,12 +732,12 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate till were facing new dir then go back 45 degrees // rotate till were facing new dir then go back 45 degrees
while (lastDir != currentDir) { while (lastDir != currentDir) {
lastDir += turnDir; lastDir += turnDir;
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastDir < 0) if (lastDir < 0)
lastDir += NO_DIRECTIONS; lastDir += NO_DIRECTIONS;
module = turnFramesLeft + lastDir; module = turnFramesLeft + lastDir;
} else { } else {
if ( lastDir > 7) if (lastDir > 7)
lastDir -= NO_DIRECTIONS; lastDir -= NO_DIRECTIONS;
module = turnFramesRight + lastDir; module = turnFramesRight + lastDir;
} }
@ -926,7 +926,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
} else if (_targetDir != lastRealDir) { // rotate to _targetDir } else if (_targetDir != lastRealDir) { // rotate to _targetDir
// rotate to target direction // rotate to target direction
turnDir = _targetDir - lastRealDir; turnDir = _targetDir - lastRealDir;
if ( turnDir < 0) if (turnDir < 0)
turnDir += NO_DIRECTIONS; turnDir += NO_DIRECTIONS;
if (turnDir > 4) if (turnDir > 4)
@ -937,7 +937,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to target direction // rotate to target direction
// for george and nico put in a head turn at the start // for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) { if ((megaId == GEORGE) || (megaId == NICO)) {
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir; module = turnFramesLeft + lastDir;
} else { } else {
module = turnFramesRight + lastDir; module = turnFramesRight + lastDir;
@ -953,12 +953,12 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate if we need to // rotate if we need to
while (lastRealDir != _targetDir) { while (lastRealDir != _targetDir) {
lastRealDir += turnDir; lastRealDir += turnDir;
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastRealDir < 0) if (lastRealDir < 0)
lastRealDir += NO_DIRECTIONS; lastRealDir += NO_DIRECTIONS;
module = turnFramesLeft + lastRealDir; module = turnFramesLeft + lastRealDir;
} else { } else {
if ( lastRealDir > 7) if (lastRealDir > 7)
lastRealDir -= NO_DIRECTIONS; lastRealDir -= NO_DIRECTIONS;
module = turnFramesRight + lastRealDir; module = turnFramesRight + lastRealDir;
} }
@ -1123,7 +1123,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
if (lastDir != currentDir) { if (lastDir != currentDir) {
// get the direction to turn // get the direction to turn
turnDir = currentDir - lastDir; turnDir = currentDir - lastDir;
if ( turnDir < 0) if (turnDir < 0)
turnDir += NO_DIRECTIONS; turnDir += NO_DIRECTIONS;
if (turnDir > 4) if (turnDir > 4)
@ -1134,7 +1134,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction // rotate to new walk direction
// for george and nico put in a head turn at the start // for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) { if ((megaId == GEORGE) || (megaId == NICO)) {
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir; module = turnFramesLeft + lastDir;
} else { } else {
module = turnFramesRight + lastDir; module = turnFramesRight + lastDir;
@ -1150,12 +1150,12 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// rotate till were facing new dir then go back 45 degrees // rotate till were facing new dir then go back 45 degrees
while (lastDir != currentDir) { while (lastDir != currentDir) {
lastDir += turnDir; lastDir += turnDir;
if ( turnDir < 0) { // new frames for turn frames 29oct95jps if (turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastDir < 0) if (lastDir < 0)
lastDir += NO_DIRECTIONS; lastDir += NO_DIRECTIONS;
module = turnFramesLeft + lastDir; module = turnFramesLeft + lastDir;
} else { } else {
if ( lastDir > 7) if (lastDir > 7)
lastDir -= NO_DIRECTIONS; lastDir -= NO_DIRECTIONS;
module = turnFramesRight + lastDir; module = turnFramesRight + lastDir;
} }
@ -2125,9 +2125,9 @@ int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
int signY = (deltaY > 0); int signY = (deltaY > 0);
int slope; int slope;
if ( (ABS(deltaY) * DIAGONALX ) < (ABS(deltaX) * DIAGONALY / 2)) if ((ABS(deltaY) * DIAGONALX ) < (ABS(deltaX) * DIAGONALY / 2))
slope = 0;// its flat slope = 0;// its flat
else if ( (ABS(deltaY) * DIAGONALX / 2) > (ABS(deltaX) * DIAGONALY ) ) else if ((ABS(deltaY) * DIAGONALX / 2) > (ABS(deltaX) * DIAGONALY ) )
slope = 2;// its vertical slope = 2;// its vertical
else else
slope = 1;// its diagonal slope = 1;// its diagonal

View File

@ -373,7 +373,7 @@ void Screen::draw(void) {
uint8 *src = _layerBlocks[0]; uint8 *src = _layerBlocks[0];
uint8 *dest = _screenBuf; uint8 *dest = _screenBuf;
if(SwordEngine::isPsx()) { if (SwordEngine::isPsx()) {
if (!_psxCache.decodedBackground) if (!_psxCache.decodedBackground)
_psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY); _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
memcpy(_screenBuf, _psxCache.decodedBackground, _scrnSizeX * _scrnSizeY); memcpy(_screenBuf, _psxCache.decodedBackground, _scrnSizeX * _scrnSizeY);
@ -398,7 +398,7 @@ void Screen::draw(void) {
} else if (!(SwordEngine::isPsx())) { } else if (!(SwordEngine::isPsx())) {
memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY); memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
} else { //We are using PSX version } else { //We are using PSX version
if(_currentScreen == 45 || _currentScreen == 55 || if (_currentScreen == 45 || _currentScreen == 55 ||
_currentScreen == 57 || _currentScreen == 63 || _currentScreen == 71) { // Width shrinked backgrounds _currentScreen == 57 || _currentScreen == 63 || _currentScreen == 71) { // Width shrinked backgrounds
if (!_psxCache.decodedBackground) if (!_psxCache.decodedBackground)
_psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY); _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
@ -426,7 +426,7 @@ void Screen::draw(void) {
renderParallax(_parallax[1]); renderParallax(_parallax[1]);
// PSX version has parallax layer for this room in an external file (TRAIN.PLX) // PSX version has parallax layer for this room in an external file (TRAIN.PLX)
if(SwordEngine::isPsx() && _currentScreen == 63) { if (SwordEngine::isPsx() && _currentScreen == 63) {
// FIXME: this should be handled in a cleaner way... // FIXME: this should be handled in a cleaner way...
if (!_psxCache.extPlxCache) { if (!_psxCache.extPlxCache) {
Common::File parallax; Common::File parallax;
@ -493,7 +493,7 @@ void Screen::processImage(uint32 id) {
uint16 sprSizeX, sprSizeY; uint16 sprSizeX, sprSizeY;
if (compact->o_status & STAT_SHRINK) { if (compact->o_status & STAT_SHRINK) {
memset(_shrinkBuffer, 0, SHRINK_BUFFER_SIZE); //Clean shrink buffer to avoid corruption memset(_shrinkBuffer, 0, SHRINK_BUFFER_SIZE); //Clean shrink buffer to avoid corruption
if( SwordEngine::isPsx() && (compact->o_resource != GEORGE_MEGA)) { //PSX Height shrinked sprites if (SwordEngine::isPsx() && (compact->o_resource != GEORGE_MEGA)) { //PSX Height shrinked sprites
sprSizeX = (scale * _resMan->readUint16(&frameHead->width)) / 256; sprSizeX = (scale * _resMan->readUint16(&frameHead->width)) / 256;
sprSizeY = (scale * (_resMan->readUint16(&frameHead->height))) / 256 / 2; sprSizeY = (scale * (_resMan->readUint16(&frameHead->height))) / 256 / 2;
fastShrink(sprData, _resMan->readUint16(&frameHead->width), (_resMan->readUint16(&frameHead->height)) / 2, scale, _shrinkBuffer); fastShrink(sprData, _resMan->readUint16(&frameHead->width), (_resMan->readUint16(&frameHead->height)) / 2, scale, _shrinkBuffer);
@ -509,7 +509,7 @@ void Screen::processImage(uint32 id) {
sprData = _shrinkBuffer; sprData = _shrinkBuffer;
} else { } else {
sprSizeX = _resMan->readUint16(&frameHead->width); sprSizeX = _resMan->readUint16(&frameHead->width);
if(SwordEngine::isPsx()) { //PSX sprites are half height if (SwordEngine::isPsx()) { //PSX sprites are half height
sprSizeY = _resMan->readUint16(&frameHead->height) / 2; sprSizeY = _resMan->readUint16(&frameHead->height) / 2;
} else } else
sprSizeY = (_resMan->readUint16(&frameHead->height)); sprSizeY = (_resMan->readUint16(&frameHead->height));
@ -537,7 +537,7 @@ void Screen::processImage(uint32 id) {
spriteClipAndSet(&spriteX, &spriteY, &sprSizeX, &sprSizeY, &incr); spriteClipAndSet(&spriteX, &spriteY, &sprSizeX, &sprSizeY, &incr);
if ((sprSizeX > 0) && (sprSizeY > 0)) { if ((sprSizeX > 0) && (sprSizeY > 0)) {
if( (!(SwordEngine::isPsx()) || (compact->o_type == TYPE_TEXT) if ((!(SwordEngine::isPsx()) || (compact->o_type == TYPE_TEXT)
|| (compact->o_resource == LVSFLY) || (!(compact->o_resource == GEORGE_MEGA) && (sprSizeX < 260)))) || (compact->o_resource == LVSFLY) || (!(compact->o_resource == GEORGE_MEGA) && (sprSizeX < 260))))
drawSprite(sprData + incr, spriteX, spriteY, sprSizeX, sprSizeY, sprPitch); drawSprite(sprData + incr, spriteX, spriteY, sprSizeX, sprSizeY, sprPitch);
else if (((sprSizeX >= 260) && (sprSizeX < 450)) || ((compact->o_resource == GMWRITH) && (sprSizeX < 515)) // a psx shrinked sprite (1/2 width) else if (((sprSizeX >= 260) && (sprSizeX < 450)) || ((compact->o_resource == GMWRITH) && (sprSizeX < 515)) // a psx shrinked sprite (1/2 width)
@ -666,7 +666,7 @@ void Screen::renderParallax(uint8 *data) {
} else } else
paraScrlY = 0; paraScrlY = 0;
if(SwordEngine::isPsx()) if (SwordEngine::isPsx())
drawPsxParallax(data, paraScrlX, scrnScrlX, scrnWidth); drawPsxParallax(data, paraScrlX, scrnScrlX, scrnWidth);
else else
for (uint16 cnty = 0; cnty < scrnHeight; cnty++) { for (uint16 cnty = 0; cnty < scrnHeight; cnty++) {
@ -867,7 +867,7 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint
for (uint32 currentTile = 0; currentTile < totTiles; currentTile++) { for (uint32 currentTile = 0; currentTile < totTiles; currentTile++) {
uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile);
if(isCompressed) if (isCompressed)
decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile
else else
memcpy(decomp_tile, psxBackground + tileOffset - 4, 16*16); memcpy(decomp_tile, psxBackground + tileOffset - 4, 16*16);
@ -911,7 +911,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr
for (currentTile = 0; currentTile < totTiles; currentTile++) { for (currentTile = 0; currentTile < totTiles; currentTile++) {
uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile);
if(isCompressed) if (isCompressed)
decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile
else else
memcpy(decomp_tile, psxBackground + tileOffset - 4, 16 * 16); memcpy(decomp_tile, psxBackground + tileOffset - 4, 16 * 16);
@ -949,7 +949,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr
for (; currentTile < totTiles + remainingTiles; currentTile++) { for (; currentTile < totTiles + remainingTiles; currentTile++) {
uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile);
if(isCompressed) if (isCompressed)
decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile
else else
memcpy(decomp_tile, psxBackground + tileOffset - 4, 256); memcpy(decomp_tile, psxBackground + tileOffset - 4, 256);
@ -1101,7 +1101,7 @@ void Screen::decompressHIF(uint8 *src, uint8 *dest) {
if (info_word == 0xFFFF) return; //Got 0xFFFF code, finished. if (info_word == 0xFFFF) return; //Got 0xFFFF code, finished.
int32 repeat_count = (info_word >> 12) + 2; //How many time data needs to be refetched int32 repeat_count = (info_word >> 12) + 2; //How many time data needs to be refetched
while(repeat_count >= 0) { while (repeat_count >= 0) {
uint8 *old_data_src = dest - ((info_word & 0xFFF) + 1); uint8 *old_data_src = dest - ((info_word & 0xFFF) + 1);
*dest++ = *old_data_src; *dest++ = *old_data_src;
repeat_count--; repeat_count--;
@ -1187,7 +1187,7 @@ void Screen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWidth, u
uint16 gridH = (*pSprHeight + (sprY & (SCRNGRID_Y - 1)) + (SCRNGRID_Y - 1)) / SCRNGRID_Y; uint16 gridH = (*pSprHeight + (sprY & (SCRNGRID_Y - 1)) + (SCRNGRID_Y - 1)) / SCRNGRID_Y;
uint16 gridW = (*pSprWidth + (sprX & (SCRNGRID_X - 1)) + (SCRNGRID_X - 1)) / SCRNGRID_X; uint16 gridW = (*pSprWidth + (sprX & (SCRNGRID_X - 1)) + (SCRNGRID_X - 1)) / SCRNGRID_X;
if(SwordEngine::isPsx()) { if (SwordEngine::isPsx()) {
gridH *= 2; // This will correct the PSX sprite being cut at half height gridH *= 2; // This will correct the PSX sprite being cut at half height
gridW *= 2; // and masking problems when sprites are stretched in width gridW *= 2; // and masking problems when sprites are stretched in width
@ -1225,7 +1225,7 @@ void Screen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const b
uint8 frame[40 * 40]; uint8 frame[40 * 40];
int i, j; int i, j;
if(SwordEngine::isPsx()) if (SwordEngine::isPsx())
memset(frame, 0, sizeof(frame)); // PSX top menu is black memset(frame, 0, sizeof(frame)); // PSX top menu is black
else else
memset(frame, 199, sizeof(frame)); // Dark gray background memset(frame, 199, sizeof(frame)); // Dark gray background

View File

@ -106,7 +106,7 @@ void Text::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen) {
for (uint16 pos = 0; pos < lines[lineCnt].length; pos++) for (uint16 pos = 0; pos < lines[lineCnt].length; pos++)
sprPtr += copyChar(*text++, sprPtr, sprWidth, pen) - OVERLAP; sprPtr += copyChar(*text++, sprPtr, sprWidth, pen) - OVERLAP;
text++; // skip space at the end of the line text++; // skip space at the end of the line
if(SwordEngine::isPsx()) //Chars are half height in psx version if (SwordEngine::isPsx()) //Chars are half height in psx version
linePtr += (_charHeight / 2) * sprWidth; linePtr += (_charHeight / 2) * sprWidth;
else else
linePtr += _charHeight * sprWidth; linePtr += _charHeight * sprWidth;
@ -136,7 +136,7 @@ uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
text++; text++;
wordWidth += OVERLAP; // no overlap on final letter of word! wordWidth += OVERLAP; // no overlap on final letter of word!
if ( firstWord ) { // first word on first line, so no separating SPACE needed if (firstWord) { // first word on first line, so no separating SPACE needed
line[0].width = wordWidth; line[0].width = wordWidth;
line[0].length = wordLength; line[0].length = wordLength;
firstWord = false; firstWord = false;
@ -167,9 +167,9 @@ uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
uint8 *decChr; uint8 *decChr;
uint16 frameHeight = 0; uint16 frameHeight = 0;
if(SwordEngine::isPsx()) { if (SwordEngine::isPsx()) {
frameHeight = _resMan->getUint16(chFrame->height)/2; frameHeight = _resMan->getUint16(chFrame->height)/2;
if(_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed if (_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed
decBuf = (uint8*) malloc((_resMan->getUint16(chFrame->width))*(_resMan->getUint16(chFrame->height)/2)); decBuf = (uint8*) malloc((_resMan->getUint16(chFrame->width))*(_resMan->getUint16(chFrame->height)/2));
Screen::decompressHIF(chData, decBuf); Screen::decompressHIF(chData, decBuf);
decChr = decBuf; decChr = decBuf;

View File

@ -325,7 +325,7 @@ uint16 FontRenderer::charWidth(byte ch, uint32 fontRes) {
frame_head.read(charBuf); frame_head.read(charBuf);
if(Sword2Engine::isPsx()) if (Sword2Engine::isPsx())
free(charBuf); free(charBuf);
_vm->_resman->closeResource(fontRes); _vm->_resman->closeResource(fontRes);
@ -353,7 +353,7 @@ uint16 FontRenderer::charHeight(uint32 fontRes) {
frame_head.read(charbuf); frame_head.read(charbuf);
if(Sword2Engine::isPsx()) if (Sword2Engine::isPsx())
free(charbuf); free(charbuf);
_vm->_resman->closeResource(fontRes); _vm->_resman->closeResource(fontRes);

View File

@ -50,7 +50,7 @@ void Screen::startNewPalette() {
// Don't fetch palette match table while using PSX version, // Don't fetch palette match table while using PSX version,
// because it is not present. // because it is not present.
if(!Sword2Engine::isPsx()) if (!Sword2Engine::isPsx())
memcpy(_paletteMatch, _vm->fetchPaletteMatchTable(screenFile), PALTABLESIZE); memcpy(_paletteMatch, _vm->fetchPaletteMatchTable(screenFile), PALTABLESIZE);
setPalette(0, 256, _vm->fetchPalette(screenFile), RDPAL_FADE); setPalette(0, 256, _vm->fetchPalette(screenFile), RDPAL_FADE);

View File

@ -43,7 +43,7 @@ namespace Sword2 {
byte *Sword2Engine::fetchPalette(byte *screenFile) { byte *Sword2Engine::fetchPalette(byte *screenFile) {
byte *palette; byte *palette;
if(isPsx()) { // PSX version doesn't have a "MultiScreenHeader", instead there's a ScreenHeader and a tag if (isPsx()) { // PSX version doesn't have a "MultiScreenHeader", instead there's a ScreenHeader and a tag
palette = screenFile + ResHeader::size() + ScreenHeader::size() + 2; palette = screenFile + ResHeader::size() + ScreenHeader::size() + 2;
} else { } else {
MultiScreenHeader mscreenHeader; MultiScreenHeader mscreenHeader;

View File

@ -618,7 +618,7 @@ int32 Screen::initialisePsxBackgroundLayer(byte *parallax) {
if (!(remLines && posY == _yBlocks[_layer] - 1)) if (!(remLines && posY == _yBlocks[_layer] - 1))
remLines = 32; remLines = 32;
for(j = 0; j < remLines; j++) { for (j = 0; j < remLines; j++) {
memcpy(tileChunk + j * BLOCKWIDTH * 2, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH); memcpy(tileChunk + j * BLOCKWIDTH * 2, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH);
memcpy(tileChunk + j * BLOCKWIDTH * 2 + BLOCKWIDTH, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH); memcpy(tileChunk + j * BLOCKWIDTH * 2 + BLOCKWIDTH, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH);
} }
@ -728,7 +728,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {
block_has_data = true; block_has_data = true;
// If one of the two grouped blocks is without data, then we also have transparency // If one of the two grouped blocks is without data, then we also have transparency
if(!firstTilePresent || !secondTilePresent) if (!firstTilePresent || !secondTilePresent)
block_is_transparent = true; block_is_transparent = true;
} }
@ -737,7 +737,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {
byte *block = data; byte *block = data;
if (firstTilePresent) { if (firstTilePresent) {
for (k = 0; k < 0x400; k++) { for (k = 0; k < 0x400; k++) {
if ( *(block + k) == 0) { if (*(block + k) == 0) {
block_is_transparent = true; block_is_transparent = true;
break; break;
} }
@ -749,7 +749,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {
// a second tile, check it // a second tile, check it
if (secondTilePresent && !block_is_transparent) { if (secondTilePresent && !block_is_transparent) {
for (k = 0; k < 0x400; k++) { for (k = 0; k < 0x400; k++) {
if ( *(block + k) == 0) { if (*(block + k) == 0) {
block_is_transparent = true; block_is_transparent = true;
break; break;
} }

View File

@ -945,11 +945,11 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// new frames for turn frames 29oct95jps // new frames for turn frames 29oct95jps
if (turnDir < 0) { if (turnDir < 0) {
if ( lastDir < 0) if (lastDir < 0)
lastDir += NO_DIRECTIONS; lastDir += NO_DIRECTIONS;
module = _firstStandingTurnLeftFrame + lastDir; module = _firstStandingTurnLeftFrame + lastDir;
} else { } else {
if ( lastDir > 7) if (lastDir > 7)
lastDir -= NO_DIRECTIONS; lastDir -= NO_DIRECTIONS;
module = _firstStandingTurnRightFrame + lastDir; module = _firstStandingTurnRightFrame + lastDir;
} }
@ -1208,7 +1208,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
} else if (_targetDir != lastRealDir) { } else if (_targetDir != lastRealDir) {
// rotate to target direction // rotate to target direction
turnDir = _targetDir - lastRealDir; turnDir = _targetDir - lastRealDir;
if ( turnDir < 0) if (turnDir < 0)
turnDir += NO_DIRECTIONS; turnDir += NO_DIRECTIONS;
if (turnDir > 4) if (turnDir > 4)

View File

@ -279,7 +279,7 @@ uint32 Screen::decompressHIF(byte *src, byte *dst, uint32 *skipData) {
} }
int32 repeat_count = (info_word >> 12) + 2; // How many time data needs to be refetched int32 repeat_count = (info_word >> 12) + 2; // How many time data needs to be refetched
while(repeat_count >= 0) { while (repeat_count >= 0) {
uint16 refetchData = (info_word & 0xFFF) + 1; uint16 refetchData = (info_word & 0xFFF) + 1;
if (refetchData > decompSize) return 0; // We have a problem here... if (refetchData > decompSize) return 0; // We have a problem here...
uint8 *old_data_src = dst - refetchData; uint8 *old_data_src = dst - refetchData;
@ -498,7 +498,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
// Decompression and mirroring // Decompression and mirroring
// ----------------------------------------------------------------- // -----------------------------------------------------------------
if (s->type & RDSPR_NOCOMPRESSION) { if (s->type & RDSPR_NOCOMPRESSION) {
if(Sword2Engine::isPsx()) { // PSX Uncompressed sprites if (Sword2Engine::isPsx()) { // PSX Uncompressed sprites
if (s->w > 254 && !s->isText) { // We need to recompose these frames if (s->w > 254 && !s->isText) { // We need to recompose these frames
recomposePsxSprite(s); recomposePsxSprite(s);
} }
@ -528,7 +528,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
decompData = decompressHIF(s->data, tempBuf); decompData = decompressHIF(s->data, tempBuf);
// Check that we correctly decompressed data // Check that we correctly decompressed data
if(!decompData) if (!decompData)
return RDERR_DECOMPRESSION; return RDERR_DECOMPRESSION;
s->w = (decompData / (s->h / 2)) * 2; s->w = (decompData / (s->h / 2)) * 2;
@ -568,7 +568,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
uint32 decompData = decompressHIF(s->data, tempBuf); uint32 decompData = decompressHIF(s->data, tempBuf);
// Check that we correctly decompressed data // Check that we correctly decompressed data
if(!decompData) if (!decompData)
return RDERR_DECOMPRESSION; return RDERR_DECOMPRESSION;
s->w = (decompData / (s->h / 2)); s->w = (decompData / (s->h / 2));

View File

@ -186,7 +186,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
displayMessage(0x57b2); displayMessage(0x57b2);
return true; return true;
} else { } else {
for(byte i = 11; i <= 27; i += 4) for (byte i = 11; i <= 27; i += 4)
playSound(76, i); playSound(76, i);
playSound(56, 35); playSound(56, 35);

View File

@ -50,7 +50,7 @@ void Inventory::init(TeenAgentEngine *engine) {
offset[i] = items->readUint16LE(); offset[i] = items->readUint16LE();
} }
for(byte i = 0; i < 92; ++i) { for (byte i = 0; i < 92; ++i) {
InventoryObject io; InventoryObject io;
uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2); uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2);
if (obj_addr != 0) if (obj_addr != 0)

View File

@ -116,7 +116,7 @@ void Scene::init(TeenAgentEngine *engine, OSystem *system) {
objects.resize(42); objects.resize(42);
walkboxes.resize(42); walkboxes.resize(42);
for(byte i = 0; i < 42; ++i) { for (byte i = 0; i < 42; ++i) {
Common::Array<Object> &scene_objects = objects[i]; Common::Array<Object> &scene_objects = objects[i];
scene_objects.clear(); scene_objects.clear();
@ -151,7 +151,7 @@ Object *Scene::findObject(const Common::Point &point) {
Common::Array<Object> &scene_objects = objects[_id - 1]; Common::Array<Object> &scene_objects = objects[_id - 1];
for(uint i = 0; i < scene_objects.size(); ++i) { for (uint i = 0; i < scene_objects.size(); ++i) {
Object &obj = scene_objects[i]; Object &obj = scene_objects[i];
if (obj.enabled != 0 && obj.rect.in(point)) if (obj.enabled != 0 && obj.rect.in(point))
return &obj; return &obj;

View File

@ -134,10 +134,10 @@ void TeenAgentEngine::init() {
Resources * res = Resources::instance(); Resources * res = Resources::instance();
use_hotspots.resize(42); use_hotspots.resize(42);
byte *scene_hotspots = res->dseg.ptr(0xbb87); byte *scene_hotspots = res->dseg.ptr(0xbb87);
for(byte i = 0; i < 42; ++i) { for (byte i = 0; i < 42; ++i) {
Common::Array<UseHotspot> & hotspots = use_hotspots[i]; Common::Array<UseHotspot> & hotspots = use_hotspots[i];
byte * hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2)); byte * hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2));
while(*hotspots_ptr) { while (*hotspots_ptr) {
UseHotspot h; UseHotspot h;
h.load(hotspots_ptr); h.load(hotspots_ptr);
hotspots_ptr += 9; hotspots_ptr += 9;

View File

@ -145,7 +145,7 @@ public:
if (&coroParam == &nullContext) assert(!nullContext);\ if (&coroParam == &nullContext) assert(!nullContext);\
if (!x) {coroParam = x = new CoroContextTag();}\ if (!x) {coroParam = x = new CoroContextTag();}\
CoroContextHolder tmpHolder(coroParam);\ CoroContextHolder tmpHolder(coroParam);\
switch(coroParam->_line) { case 0:; switch (coroParam->_line) { case 0:;
/** /**
* End the code section of a coroutine. * End the code section of a coroutine.

View File

@ -286,7 +286,7 @@ static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
p += boxBounds.top * (fourBitClut ? sizeof(uint16) : sizeof(uint32)); p += boxBounds.top * (fourBitClut ? sizeof(uint16) : sizeof(uint32));
for (int yp = boxBounds.top; yp <= boxBounds.bottom; ++yp, p += (fourBitClut ? sizeof(uint16) : sizeof(uint32))) { for (int yp = boxBounds.top; yp <= boxBounds.bottom; ++yp, p += (fourBitClut ? sizeof(uint16) : sizeof(uint32))) {
if(!fourBitClut) { if (!fourBitClut) {
if (!transparency) if (!transparency)
Common::copy(p + boxBounds.left, p + boxBounds.right + 1, tempDest + (SCREEN_WIDTH * (yp - boxBounds.top))); Common::copy(p + boxBounds.left, p + boxBounds.right + 1, tempDest + (SCREEN_WIDTH * (yp - boxBounds.top)));
else else

View File

@ -84,7 +84,7 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &
if (!step.autoWidth) { if (!step.autoWidth) {
in_w = step.w == -1 ? area.height() : step.w; in_w = step.w == -1 ? area.height() : step.w;
switch(step.xAlign) { switch (step.xAlign) {
case Graphics::DrawStep::kVectorAlignManual: case Graphics::DrawStep::kVectorAlignManual:
if (step.x >= 0) in_x = area.left + step.x; if (step.x >= 0) in_x = area.left + step.x;
else in_x = area.left + area.width() + step.x; // value relative to the opposite corner. else in_x = area.left + area.width() + step.x; // value relative to the opposite corner.
@ -113,7 +113,7 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &
if (!step.autoHeight) { if (!step.autoHeight) {
in_h = step.h == -1 ? area.width() : step.h; in_h = step.h == -1 ? area.width() : step.h;
switch(step.yAlign) { switch (step.yAlign) {
case Graphics::DrawStep::kVectorAlignManual: case Graphics::DrawStep::kVectorAlignManual:
if (step.y >= 0) in_y = area.top + step.y; if (step.y >= 0) in_y = area.top + step.y;
else in_y = area.top + area.height() + step.y; // relative else in_y = area.top + area.height() + step.y; // relative

View File

@ -700,7 +700,7 @@ drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {
int newW = w / 2; int newW = w / 2;
if (newW % 2) newW++; if (newW % 2) newW++;
switch(orient) { switch (orient) {
case kTriangleUp: case kTriangleUp:
case kTriangleDown: case kTriangleDown:
drawTriangleFast(x + (newW / 2), y + (h / 2) - (newW / 2), newW, (orient == kTriangleDown), color, Base::_fillMode); drawTriangleFast(x + (newW / 2), y + (h / 2) - (newW / 2), newW, (orient == kTriangleDown), color, Base::_fillMode);
@ -1028,7 +1028,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
int dysub = ddy - (dx * 2); int dysub = ddy - (dx * 2);
int error_term = ddy - dx; int error_term = ddy - dx;
switch(fill_m) { switch (fill_m) {
case kFillDisabled: case kFillDisabled:
while (dx--) { while (dx--) {
__TRIANGLE_MAINX(); __TRIANGLE_MAINX();
@ -1060,7 +1060,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
int dxsub = ddx - (dy * 2); int dxsub = ddx - (dy * 2);
int error_term = ddx - dy; int error_term = ddx - dy;
switch(fill_m) { switch (fill_m) {
case kFillDisabled: case kFillDisabled:
while (dy--) { while (dy--) {
__TRIANGLE_MAINY(); __TRIANGLE_MAINY();

View File

@ -96,7 +96,7 @@ void Indeo3::setDither(DitherAlgorithm dither) {
_dither = dither; _dither = dither;
switch(dither) { switch (dither) {
case kDitherSierraLight: case kDitherSierraLight:
_ditherSL = new Graphics::SierraLight(_width, _palLUT); _ditherSL = new Graphics::SierraLight(_width, _palLUT);
break; break;
@ -538,7 +538,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
correction_lp[0] = correction_lp[1] = correction + (lv << 8); correction_lp[0] = correction_lp[1] = correction + (lv << 8);
} }
switch(k) { switch (k) {
case 1: case 1:
case 0: /********** CASE 0 **********/ case 0: /********** CASE 0 **********/
for ( ; blks_height > 0; blks_height -= 4) { for ( ; blks_height > 0; blks_height -= 4) {
@ -548,7 +548,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2]; cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2]; ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2];
switch(correction_type_sp[0][k]) { switch (correction_type_sp[0][k]) {
case 0: case 0:
*cur_lp = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1); *cur_lp = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++; lp2++;
@ -651,7 +651,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2]; cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32 *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1]; ref_lp = ((uint32 *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
switch(correction_type_sp[lp2 & 0x01][k]) { switch (correction_type_sp[lp2 & 0x01][k]) {
case 0: case 0:
cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1); cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
if (lp2 > 0 || flag1 == 0 || strip->ypos != 0) if (lp2 > 0 || flag1 == 0 || strip->ypos != 0)
@ -780,7 +780,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
#endif #endif
} }
switch(correction_type_sp[lp2 & 0x01][k]) { switch (correction_type_sp[lp2 & 0x01][k]) {
case 0: case 0:
cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1); cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]+1] = FROM_LE_32(((FROM_LE_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1); cur_lp[width_tbl[1]+1] = FROM_LE_32(((FROM_LE_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
@ -935,7 +935,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2]; cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2]; ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) { switch (correction_type_sp[lp2 & 0x01][k]) {
case 0: case 0:
lv1 = correctionloworder_lp[lp2 & 0x01][k]; lv1 = correctionloworder_lp[lp2 & 0x01][k];
lv2 = correctionhighorder_lp[lp2 & 0x01][k]; lv2 = correctionhighorder_lp[lp2 & 0x01][k];
@ -1038,7 +1038,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,
cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2]; cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2]; ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) { switch (correction_type_sp[lp2 & 0x01][k]) {
case 0: case 0:
cur_lp[0] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1); cur_lp[0] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1); cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);

View File

@ -459,7 +459,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst
if (stepNode->values.contains("orientation")) { if (stepNode->values.contains("orientation")) {
val = stepNode->values["orientation"]; val = stepNode->values["orientation"];
if ( val == "top") if (val == "top")
drawstep->extraData = Graphics::VectorRenderer::kTriangleUp; drawstep->extraData = Graphics::VectorRenderer::kTriangleUp;
else if (val == "bottom") else if (val == "bottom")
drawstep->extraData = Graphics::VectorRenderer::kTriangleDown; drawstep->extraData = Graphics::VectorRenderer::kTriangleDown;
@ -622,7 +622,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
Graphics::TextAlign alignH = Graphics::kTextAlignLeft; Graphics::TextAlign alignH = Graphics::kTextAlignLeft;
if (node->values.contains("textalign")) { if (node->values.contains("textalign")) {
if((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid) if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
return parserError("Invalid value for text alignment."); return parserError("Invalid value for text alignment.");
} }
@ -847,7 +847,7 @@ bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String
if (node->values.contains("textalign")) { if (node->values.contains("textalign")) {
Graphics::TextAlign alignH = Graphics::kTextAlignLeft; Graphics::TextAlign alignH = Graphics::kTextAlignLeft;
if((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid) if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
return parserError("Invalid value for text alignment."); return parserError("Invalid value for text alignment.");
_theme->getEvaluator()->setVar(var + "Align", alignH); _theme->getEvaluator()->setVar(var + "Align", alignH);

View File

@ -100,7 +100,7 @@ AboutDialog::AboutDialog()
_w = 0; _w = 0;
for (i = 0; i < ARRAYSIZE(credits); i++) { for (i = 0; i < ARRAYSIZE(credits); i++) {
int tmp = g_gui.getStringWidth(credits[i] + 5); int tmp = g_gui.getStringWidth(credits[i] + 5);
if ( _w < tmp && tmp <= maxW) { if (_w < tmp && tmp <= maxW) {
_w = tmp; _w = tmp;
} }
} }
@ -311,7 +311,7 @@ void AboutDialog::reflowLayout() {
_w = 0; _w = 0;
for (int i = 0; i < ARRAYSIZE(credits); i++) { for (int i = 0; i < ARRAYSIZE(credits); i++) {
int tmp = g_gui.getStringWidth(credits[i] + 5); int tmp = g_gui.getStringWidth(credits[i] + 5);
if ( _w < tmp && tmp <= maxW) { if (_w < tmp && tmp <= maxW) {
_w = tmp; _w = tmp;
} }
} }

View File

@ -320,7 +320,7 @@ void Infogrames::getNextSample(Channel &chn) {
chn.volSlide.curDelay2 = 0; chn.volSlide.curDelay2 = 0;
break; break;
case 0xE0: // 111xxxxx - Extended case 0xE0: // 111xxxxx - Extended
switch(cmd & 0x1F) { switch (cmd & 0x1F) {
case 0: // Set period modifier case 0: // Set period modifier
chn.periodMod = (int8) *chn.cmds++; chn.periodMod = (int8) *chn.cmds++;
break; break;

View File

@ -116,13 +116,13 @@ ShortenGolombReader::ShortenGolombReader(Common::ReadStream *stream, int version
int32 ShortenGolombReader::getURice(uint32 numBits) { int32 ShortenGolombReader::getURice(uint32 numBits) {
int32 result = 0; int32 result = 0;
if(!_nbitget) { if (!_nbitget) {
_buf = _stream->readUint32BE(); _buf = _stream->readUint32BE();
_nbitget = 32; _nbitget = 32;
} }
for (result = 0; !(_buf & (1L << --_nbitget)); result++) { for (result = 0; !(_buf & (1L << --_nbitget)); result++) {
if(!_nbitget) { if (!_nbitget) {
_buf = _stream->readUint32BE(); _buf = _stream->readUint32BE();
_nbitget = 32; _nbitget = 32;
} }

View File

@ -189,7 +189,7 @@ static void MT32_PrintDebug(void *userData, const char *fmt, va_list list) {
} }
static int MT32_Report(void *userData, MT32Emu::ReportType type, const void *reportData) { static int MT32_Report(void *userData, MT32Emu::ReportType type, const void *reportData) {
switch(type) { switch (type) {
case MT32Emu::ReportType_lcdMessage: case MT32Emu::ReportType_lcdMessage:
g_system->displayMessageOnOSD((const char *)reportData); g_system->displayMessageOnOSD((const char *)reportData);
break; break;

View File

@ -839,7 +839,7 @@ void Synth::readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len
unsigned int m; unsigned int m;
switch(region->type) { switch (region->type) {
case MR_PatchTemp: case MR_PatchTemp:
for (m = 0; m < len; m++) for (m = 0; m < len; m++)
data[m] = ((Bit8u *)&mt32ram.patchSettings[first])[off + m]; data[m] = ((Bit8u *)&mt32ram.patchSettings[first])[off + m];

View File

@ -289,11 +289,11 @@ void OPLBuildTables(int ENV_BITS_PARAM, int EG_ENT_PARAM) {
inline void OPL_STATUS_SET(FM_OPL *OPL, int flag) { inline void OPL_STATUS_SET(FM_OPL *OPL, int flag) {
/* set status flag */ /* set status flag */
OPL->status |= flag; OPL->status |= flag;
if(!(OPL->status & 0x80)) { if (!(OPL->status & 0x80)) {
if(OPL->status & OPL->statusmask) { /* IRQ on */ if (OPL->status & OPL->statusmask) { /* IRQ on */
OPL->status |= 0x80; OPL->status |= 0x80;
/* callback user interrupt handler (IRQ is OFF to ON) */ /* callback user interrupt handler (IRQ is OFF to ON) */
if(OPL->IRQHandler) if (OPL->IRQHandler)
(OPL->IRQHandler)(OPL->IRQParam,1); (OPL->IRQHandler)(OPL->IRQParam,1);
} }
} }
@ -303,11 +303,11 @@ inline void OPL_STATUS_SET(FM_OPL *OPL, int flag) {
inline void OPL_STATUS_RESET(FM_OPL *OPL, int flag) { inline void OPL_STATUS_RESET(FM_OPL *OPL, int flag) {
/* reset status flag */ /* reset status flag */
OPL->status &= ~flag; OPL->status &= ~flag;
if((OPL->status & 0x80)) { if ((OPL->status & 0x80)) {
if (!(OPL->status & OPL->statusmask)) { if (!(OPL->status & OPL->statusmask)) {
OPL->status &= 0x7f; OPL->status &= 0x7f;
/* callback user interrupt handler (IRQ is ON to OFF) */ /* callback user interrupt handler (IRQ is ON to OFF) */
if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0); if (OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0);
} }
} }
} }
@ -333,7 +333,7 @@ inline void OPL_KEYON(OPL_SLOT *SLOT) {
/* ----- key off ----- */ /* ----- key off ----- */
inline void OPL_KEYOFF(OPL_SLOT *SLOT) { inline void OPL_KEYOFF(OPL_SLOT *SLOT) {
if( SLOT->evm > ENV_MOD_RR) { if (SLOT->evm > ENV_MOD_RR) {
/* set envelope counter from envleope output */ /* set envelope counter from envleope output */
// WORKAROUND: The Kyra engine does something very strange when // WORKAROUND: The Kyra engine does something very strange when
@ -364,7 +364,7 @@ inline void OPL_KEYOFF(OPL_SLOT *SLOT) {
if (SLOT->evm == ENV_MOD_AR && SLOT->evc == EG_AST) if (SLOT->evm == ENV_MOD_AR && SLOT->evc == EG_AST)
SLOT->evc = EG_DED; SLOT->evc = EG_DED;
else if( !(SLOT->evc & EG_DST) ) else if (!(SLOT->evc & EG_DST))
//SLOT->evc = (ENV_CURVE[SLOT->evc>>ENV_BITS]<<ENV_BITS) + EG_DST; //SLOT->evc = (ENV_CURVE[SLOT->evc>>ENV_BITS]<<ENV_BITS) + EG_DST;
SLOT->evc = EG_DST; SLOT->evc = EG_DST;
SLOT->eve = EG_DED; SLOT->eve = EG_DED;
@ -378,8 +378,8 @@ inline void OPL_KEYOFF(OPL_SLOT *SLOT) {
/* return : envelope output */ /* return : envelope output */
inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) { inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) {
/* calcrate envelope generator */ /* calcrate envelope generator */
if((SLOT->evc += SLOT->evs) >= SLOT->eve) { if ((SLOT->evc += SLOT->evs) >= SLOT->eve) {
switch( SLOT->evm ) { switch (SLOT->evm) {
case ENV_MOD_AR: /* ATTACK -> DECAY1 */ case ENV_MOD_AR: /* ATTACK -> DECAY1 */
/* next DR */ /* next DR */
SLOT->evm = ENV_MOD_DR; SLOT->evm = ENV_MOD_DR;
@ -390,7 +390,7 @@ inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) {
case ENV_MOD_DR: /* DECAY -> SL or RR */ case ENV_MOD_DR: /* DECAY -> SL or RR */
SLOT->evc = SLOT->SL; SLOT->evc = SLOT->SL;
SLOT->eve = EG_DED; SLOT->eve = EG_DED;
if(SLOT->eg_typ) { if (SLOT->eg_typ) {
SLOT->evs = 0; SLOT->evs = 0;
} else { } else {
SLOT->evm = ENV_MOD_RR; SLOT->evm = ENV_MOD_RR;
@ -423,7 +423,7 @@ inline void CALC_FCSLOT(OPL_CH *CH, OPL_SLOT *SLOT) {
SLOT->Incr = CH->fc * SLOT->mul; SLOT->Incr = CH->fc * SLOT->mul;
ksr = CH->kcode >> SLOT->KSR; ksr = CH->kcode >> SLOT->KSR;
if( SLOT->ksr != ksr ) { if (SLOT->ksr != ksr) {
SLOT->ksr = ksr; SLOT->ksr = ksr;
/* attack , decay rate recalcration */ /* attack , decay rate recalcration */
SLOT->evsa = SLOT->AR[ksr]; SLOT->evsa = SLOT->AR[ksr];
@ -455,7 +455,7 @@ inline void set_ksl_tl(FM_OPL *OPL, int slot, int v) {
SLOT->ksl = ksl ? 3-ksl : 31; SLOT->ksl = ksl ? 3-ksl : 31;
SLOT->TL = (int)((v & 0x3f) * (0.75 / EG_STEP)); /* 0.75db step */ SLOT->TL = (int)((v & 0x3f) * (0.75 / EG_STEP)); /* 0.75db step */
if(!(OPL->mode & 0x80)) { /* not CSM latch total level */ if (!(OPL->mode & 0x80)) { /* not CSM latch total level */
SLOT->TLL = SLOT->TL + (CH->ksl_base >> SLOT->ksl); SLOT->TLL = SLOT->TL + (CH->ksl_base >> SLOT->ksl);
} }
} }
@ -469,12 +469,12 @@ inline void set_ar_dr(FM_OPL *OPL, int slot, int v) {
SLOT->AR = ar ? &OPL->AR_TABLE[ar << 2] : RATE_0; SLOT->AR = ar ? &OPL->AR_TABLE[ar << 2] : RATE_0;
SLOT->evsa = SLOT->AR[SLOT->ksr]; SLOT->evsa = SLOT->AR[SLOT->ksr];
if(SLOT->evm == ENV_MOD_AR) if (SLOT->evm == ENV_MOD_AR)
SLOT->evs = SLOT->evsa; SLOT->evs = SLOT->evsa;
SLOT->DR = dr ? &OPL->DR_TABLE[dr<<2] : RATE_0; SLOT->DR = dr ? &OPL->DR_TABLE[dr<<2] : RATE_0;
SLOT->evsd = SLOT->DR[SLOT->ksr]; SLOT->evsd = SLOT->DR[SLOT->ksr];
if(SLOT->evm == ENV_MOD_DR) if (SLOT->evm == ENV_MOD_DR)
SLOT->evs = SLOT->evsd; SLOT->evs = SLOT->evsd;
} }
@ -486,11 +486,11 @@ inline void set_sl_rr(FM_OPL *OPL, int slot, int v) {
int rr = v & 0x0f; int rr = v & 0x0f;
SLOT->SL = SL_TABLE[sl]; SLOT->SL = SL_TABLE[sl];
if(SLOT->evm == ENV_MOD_DR) if (SLOT->evm == ENV_MOD_DR)
SLOT->eve = SLOT->SL; SLOT->eve = SLOT->SL;
SLOT->RR = &OPL->DR_TABLE[rr<<2]; SLOT->RR = &OPL->DR_TABLE[rr<<2];
SLOT->evsr = SLOT->RR[SLOT->ksr]; SLOT->evsr = SLOT->RR[SLOT->ksr];
if(SLOT->evm == ENV_MOD_RR) if (SLOT->evm == ENV_MOD_RR)
SLOT->evs = SLOT->evsr; SLOT->evs = SLOT->evsr;
} }
@ -506,14 +506,14 @@ inline void OPL_CALC_CH(OPL_CH *CH) {
/* SLOT 1 */ /* SLOT 1 */
SLOT = &CH->SLOT[SLOT1]; SLOT = &CH->SLOT[SLOT1];
env_out=OPL_CALC_SLOT(SLOT); env_out=OPL_CALC_SLOT(SLOT);
if(env_out < (uint)(EG_ENT - 1)) { if (env_out < (uint)(EG_ENT - 1)) {
/* PG */ /* PG */
if(SLOT->vib) if (SLOT->vib)
SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT; SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;
else else
SLOT->Cnt += SLOT->Incr; SLOT->Cnt += SLOT->Incr;
/* connection */ /* connection */
if(CH->FB) { if (CH->FB) {
int feedback1 = (CH->op1_out[0] + CH->op1_out[1]) >> CH->FB; int feedback1 = (CH->op1_out[0] + CH->op1_out[1]) >> CH->FB;
CH->op1_out[1] = CH->op1_out[0]; CH->op1_out[1] = CH->op1_out[0];
*CH->connect1 += CH->op1_out[0] = OP_OUT(SLOT, env_out, feedback1); *CH->connect1 += CH->op1_out[0] = OP_OUT(SLOT, env_out, feedback1);
@ -527,9 +527,9 @@ inline void OPL_CALC_CH(OPL_CH *CH) {
/* SLOT 2 */ /* SLOT 2 */
SLOT = &CH->SLOT[SLOT2]; SLOT = &CH->SLOT[SLOT2];
env_out=OPL_CALC_SLOT(SLOT); env_out=OPL_CALC_SLOT(SLOT);
if(env_out < (uint)(EG_ENT - 1)) { if (env_out < (uint)(EG_ENT - 1)) {
/* PG */ /* PG */
if(SLOT->vib) if (SLOT->vib)
SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT; SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;
else else
SLOT->Cnt += SLOT->Incr; SLOT->Cnt += SLOT->Incr;
@ -558,14 +558,14 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {
/* SLOT 1 */ /* SLOT 1 */
SLOT = &CH[6].SLOT[SLOT1]; SLOT = &CH[6].SLOT[SLOT1];
env_out = OPL_CALC_SLOT(SLOT); env_out = OPL_CALC_SLOT(SLOT);
if(env_out < EG_ENT-1) { if (env_out < EG_ENT-1) {
/* PG */ /* PG */
if(SLOT->vib) if (SLOT->vib)
SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT; SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;
else else
SLOT->Cnt += SLOT->Incr; SLOT->Cnt += SLOT->Incr;
/* connection */ /* connection */
if(CH[6].FB) { if (CH[6].FB) {
int feedback1 = (CH[6].op1_out[0] + CH[6].op1_out[1]) >> CH[6].FB; int feedback1 = (CH[6].op1_out[0] + CH[6].op1_out[1]) >> CH[6].FB;
CH[6].op1_out[1] = CH[6].op1_out[0]; CH[6].op1_out[1] = CH[6].op1_out[0];
feedback2 = CH[6].op1_out[0] = OP_OUT(SLOT, env_out, feedback1); feedback2 = CH[6].op1_out[0] = OP_OUT(SLOT, env_out, feedback1);
@ -581,9 +581,9 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {
/* SLOT 2 */ /* SLOT 2 */
SLOT = &CH[6].SLOT[SLOT2]; SLOT = &CH[6].SLOT[SLOT2];
env_out = OPL_CALC_SLOT(SLOT); env_out = OPL_CALC_SLOT(SLOT);
if(env_out < EG_ENT-1) { if (env_out < EG_ENT-1) {
/* PG */ /* PG */
if(SLOT->vib) if (SLOT->vib)
SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT; SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;
else else
SLOT->Cnt += SLOT->Incr; SLOT->Cnt += SLOT->Incr;
@ -601,19 +601,19 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {
env_hh = OPL_CALC_SLOT(SLOT7_1) + whitenoise; env_hh = OPL_CALC_SLOT(SLOT7_1) + whitenoise;
/* PG */ /* PG */
if(SLOT7_1->vib) if (SLOT7_1->vib)
SLOT7_1->Cnt += (SLOT7_1->Incr * vib) >> (VIB_RATE_SHIFT-1); SLOT7_1->Cnt += (SLOT7_1->Incr * vib) >> (VIB_RATE_SHIFT-1);
else else
SLOT7_1->Cnt += 2 * SLOT7_1->Incr; SLOT7_1->Cnt += 2 * SLOT7_1->Incr;
if(SLOT7_2->vib) if (SLOT7_2->vib)
SLOT7_2->Cnt += (CH[7].fc * vib) >> (VIB_RATE_SHIFT-3); SLOT7_2->Cnt += (CH[7].fc * vib) >> (VIB_RATE_SHIFT-3);
else else
SLOT7_2->Cnt += (CH[7].fc * 8); SLOT7_2->Cnt += (CH[7].fc * 8);
if(SLOT8_1->vib) if (SLOT8_1->vib)
SLOT8_1->Cnt += (SLOT8_1->Incr * vib) >> VIB_RATE_SHIFT; SLOT8_1->Cnt += (SLOT8_1->Incr * vib) >> VIB_RATE_SHIFT;
else else
SLOT8_1->Cnt += SLOT8_1->Incr; SLOT8_1->Cnt += SLOT8_1->Incr;
if(SLOT8_2->vib) if (SLOT8_2->vib)
SLOT8_2->Cnt += ((CH[8].fc * 3) * vib) >> (VIB_RATE_SHIFT-4); SLOT8_2->Cnt += ((CH[8].fc * 3) * vib) >> (VIB_RATE_SHIFT-4);
else else
SLOT8_2->Cnt += (CH[8].fc * 48); SLOT8_2->Cnt += (CH[8].fc * 48);
@ -621,16 +621,16 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {
tone8 = OP_OUT(SLOT8_2,whitenoise,0 ); tone8 = OP_OUT(SLOT8_2,whitenoise,0 );
/* SD */ /* SD */
if(env_sd < (uint)(EG_ENT - 1)) if (env_sd < (uint)(EG_ENT - 1))
outd[0] += OP_OUT(SLOT7_1, env_sd, 0) * 8; outd[0] += OP_OUT(SLOT7_1, env_sd, 0) * 8;
/* TAM */ /* TAM */
if(env_tam < (uint)(EG_ENT - 1)) if (env_tam < (uint)(EG_ENT - 1))
outd[0] += OP_OUT(SLOT8_1, env_tam, 0) * 2; outd[0] += OP_OUT(SLOT8_1, env_tam, 0) * 2;
/* TOP-CY */ /* TOP-CY */
if(env_top < (uint)(EG_ENT - 1)) if (env_top < (uint)(EG_ENT - 1))
outd[0] += OP_OUT(SLOT7_2, env_top, tone8) * 2; outd[0] += OP_OUT(SLOT7_2, env_top, tone8) * 2;
/* HH */ /* HH */
if(env_hh < (uint)(EG_ENT-1)) if (env_hh < (uint)(EG_ENT-1))
outd[0] += OP_OUT(SLOT7_2, env_hh, tone8) * 2; outd[0] += OP_OUT(SLOT7_2, env_hh, tone8) * 2;
} }
@ -644,7 +644,7 @@ static void init_timetables(FM_OPL *OPL, int ARRATE, int DRRATE) {
OPL->AR_TABLE[i] = OPL->DR_TABLE[i] = 0; OPL->AR_TABLE[i] = OPL->DR_TABLE[i] = 0;
for (i = 4; i <= 60; i++) { for (i = 4; i <= 60; i++) {
rate = OPL->freqbase; /* frequency rate */ rate = OPL->freqbase; /* frequency rate */
if(i < 60) if (i < 60)
rate *= 1.0 + (i & 3) * 0.25; /* b0-1 : x1 , x1.25 , x1.5 , x1.75 */ rate *= 1.0 + (i & 3) * 0.25; /* b0-1 : x1 , x1.25 , x1.5 , x1.75 */
rate *= 1 << ((i >> 2) - 1); /* b2-5 : shift bit */ rate *= 1 << ((i >> 2) - 1); /* b2-5 : shift bit */
rate *= (double)(EG_ENT << ENV_BITS); rate *= (double)(EG_ENT << ENV_BITS);
@ -672,22 +672,22 @@ static int OPLOpenTable(void) {
#else #else
/* allocate dynamic tables */ /* allocate dynamic tables */
if((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL) if ((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL)
return 0; return 0;
if((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) { if ((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) {
free(TL_TABLE); free(TL_TABLE);
return 0; return 0;
} }
#endif #endif
if((AMS_TABLE = (int *)malloc(AMS_ENT * 2 * sizeof(int))) == NULL) { if ((AMS_TABLE = (int *)malloc(AMS_ENT * 2 * sizeof(int))) == NULL) {
free(TL_TABLE); free(TL_TABLE);
free(SIN_TABLE); free(SIN_TABLE);
return 0; return 0;
} }
if((VIB_TABLE = (int *)malloc(VIB_ENT * 2 * sizeof(int))) == NULL) { if ((VIB_TABLE = (int *)malloc(VIB_ENT * 2 * sizeof(int))) == NULL) {
free(TL_TABLE); free(TL_TABLE);
free(SIN_TABLE); free(SIN_TABLE);
free(AMS_TABLE); free(AMS_TABLE);
@ -730,7 +730,7 @@ static int OPLOpenTable(void) {
for (i=0; i < EG_ENT; i++) { for (i=0; i < EG_ENT; i++) {
/* ATTACK curve */ /* ATTACK curve */
pom = pow(((double)(EG_ENT - 1 - i) / EG_ENT), 8) * EG_ENT; pom = pow(((double)(EG_ENT - 1 - i) / EG_ENT), 8) * EG_ENT;
/* if( pom >= EG_ENT ) pom = EG_ENT-1; */ /* if (pom >= EG_ENT) pom = EG_ENT-1; */
ENV_CURVE[i] = (int)pom; ENV_CURVE[i] = (int)pom;
/* DECAY ,RELEASE curve */ /* DECAY ,RELEASE curve */
ENV_CURVE[(EG_DST >> ENV_BITS) + i]= i; ENV_CURVE[(EG_DST >> ENV_BITS) + i]= i;
@ -788,7 +788,7 @@ static void OPL_initalize(FM_OPL *OPL) {
/* make time tables */ /* make time tables */
init_timetables(OPL, OPL_ARRATE, OPL_DRRATE); init_timetables(OPL, OPL_ARRATE, OPL_DRRATE);
/* make fnumber -> increment counter table */ /* make fnumber -> increment counter table */
for( fn=0; fn < 1024; fn++) { for (fn=0; fn < 1024; fn++) {
OPL->FN_TABLE[fn] = (uint)(OPL->freqbase * fn * FREQ_RATE * (1<<7) / 2); OPL->FN_TABLE[fn] = (uint)(OPL->freqbase * fn * FREQ_RATE * (1<<7) / 2);
} }
/* LFO freq.table */ /* LFO freq.table */
@ -802,17 +802,17 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
int slot; int slot;
uint block_fnum; uint block_fnum;
switch(r & 0xe0) { switch (r & 0xe0) {
case 0x00: /* 00-1f:controll */ case 0x00: /* 00-1f:controll */
switch(r & 0x1f) { switch (r & 0x1f) {
case 0x01: case 0x01:
/* wave selector enable */ /* wave selector enable */
if(OPL->type&OPL_TYPE_WAVESEL) { if (OPL->type&OPL_TYPE_WAVESEL) {
OPL->wavesel = v & 0x20; OPL->wavesel = v & 0x20;
if(!OPL->wavesel) { if (!OPL->wavesel) {
/* preset compatible mode */ /* preset compatible mode */
int c; int c;
for(c=0; c<OPL->max_ch; c++) { for (c = 0; c < OPL->max_ch; c++) {
OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0]; OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];
OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0]; OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];
} }
@ -826,7 +826,7 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
OPL->T[1] = (256-v) * 16; OPL->T[1] = (256-v) * 16;
return; return;
case 0x04: /* IRQ clear / mask and Timer enable */ case 0x04: /* IRQ clear / mask and Timer enable */
if(v & 0x80) { /* IRQ flag clear */ if (v & 0x80) { /* IRQ flag clear */
OPL_STATUS_RESET(OPL, 0x7f); OPL_STATUS_RESET(OPL, 0x7f);
} else { /* set IRQ mask ,timer enable*/ } else { /* set IRQ mask ,timer enable*/
uint8 st1 = v & 1; uint8 st1 = v & 1;
@ -835,13 +835,13 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
OPL_STATUS_RESET(OPL, v & 0x78); OPL_STATUS_RESET(OPL, v & 0x78);
OPL_STATUSMASK_SET(OPL,((~v) & 0x78) | 0x01); OPL_STATUSMASK_SET(OPL,((~v) & 0x78) | 0x01);
/* timer 2 */ /* timer 2 */
if(OPL->st[1] != st2) { if (OPL->st[1] != st2) {
double interval = st2 ? (double)OPL->T[1] * OPL->TimerBase : 0.0; double interval = st2 ? (double)OPL->T[1] * OPL->TimerBase : 0.0;
OPL->st[1] = st2; OPL->st[1] = st2;
if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 1, interval); if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 1, interval);
} }
/* timer 1 */ /* timer 1 */
if(OPL->st[0] != st1) { if (OPL->st[0] != st1) {
double interval = st1 ? (double)OPL->T[0] * OPL->TimerBase : 0.0; double interval = st1 ? (double)OPL->T[0] * OPL->TimerBase : 0.0;
OPL->st[0] = st1; OPL->st[0] = st1;
if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 0, interval); if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 0, interval);
@ -852,30 +852,30 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
break; break;
case 0x20: /* am,vib,ksr,eg type,mul */ case 0x20: /* am,vib,ksr,eg type,mul */
slot = slot_array[r&0x1f]; slot = slot_array[r&0x1f];
if(slot == -1) if (slot == -1)
return; return;
set_mul(OPL,slot,v); set_mul(OPL,slot,v);
return; return;
case 0x40: case 0x40:
slot = slot_array[r&0x1f]; slot = slot_array[r&0x1f];
if(slot == -1) if (slot == -1)
return; return;
set_ksl_tl(OPL,slot,v); set_ksl_tl(OPL,slot,v);
return; return;
case 0x60: case 0x60:
slot = slot_array[r&0x1f]; slot = slot_array[r&0x1f];
if(slot == -1) if (slot == -1)
return; return;
set_ar_dr(OPL,slot,v); set_ar_dr(OPL,slot,v);
return; return;
case 0x80: case 0x80:
slot = slot_array[r&0x1f]; slot = slot_array[r&0x1f];
if(slot == -1) if (slot == -1)
return; return;
set_sl_rr(OPL,slot,v); set_sl_rr(OPL,slot,v);
return; return;
case 0xa0: case 0xa0:
switch(r) { switch (r) {
case 0xbd: case 0xbd:
/* amsep,vibdep,r,bd,sd,tom,tc,hh */ /* amsep,vibdep,r,bd,sd,tom,tc,hh */
{ {
@ -883,10 +883,10 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
OPL->ams_table = &AMS_TABLE[v & 0x80 ? AMS_ENT : 0]; OPL->ams_table = &AMS_TABLE[v & 0x80 ? AMS_ENT : 0];
OPL->vib_table = &VIB_TABLE[v & 0x40 ? VIB_ENT : 0]; OPL->vib_table = &VIB_TABLE[v & 0x40 ? VIB_ENT : 0];
OPL->rythm = v & 0x3f; OPL->rythm = v & 0x3f;
if(OPL->rythm & 0x20) { if (OPL->rythm & 0x20) {
/* BD key on/off */ /* BD key on/off */
if(rkey & 0x10) { if (rkey & 0x10) {
if(v & 0x10) { if (v & 0x10) {
OPL->P_CH[6].op1_out[0] = OPL->P_CH[6].op1_out[1] = 0; OPL->P_CH[6].op1_out[0] = OPL->P_CH[6].op1_out[1] = 0;
OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT1]); OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT1]);
OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT2]); OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT2]);
@ -896,28 +896,28 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
} }
} }
/* SD key on/off */ /* SD key on/off */
if(rkey & 0x08) { if (rkey & 0x08) {
if(v & 0x08) if (v & 0x08)
OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT2]); OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT2]);
else else
OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT2]); OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT2]);
}/* TAM key on/off */ }/* TAM key on/off */
if(rkey & 0x04) { if (rkey & 0x04) {
if(v & 0x04) if (v & 0x04)
OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT1]); OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT1]);
else else
OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT1]); OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT1]);
} }
/* TOP-CY key on/off */ /* TOP-CY key on/off */
if(rkey & 0x02) { if (rkey & 0x02) {
if(v & 0x02) if (v & 0x02)
OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT2]); OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT2]);
else else
OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT2]); OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT2]);
} }
/* HH key on/off */ /* HH key on/off */
if(rkey & 0x01) { if (rkey & 0x01) {
if(v & 0x01) if (v & 0x01)
OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT1]); OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT1]);
else else
OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT1]); OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT1]);
@ -930,16 +930,16 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
break; break;
} }
/* keyon,block,fnum */ /* keyon,block,fnum */
if((r & 0x0f) > 8) if ((r & 0x0f) > 8)
return; return;
CH = &OPL->P_CH[r & 0x0f]; CH = &OPL->P_CH[r & 0x0f];
if(!(r&0x10)) { /* a0-a8 */ if (!(r&0x10)) { /* a0-a8 */
block_fnum = (CH->block_fnum & 0x1f00) | v; block_fnum = (CH->block_fnum & 0x1f00) | v;
} else { /* b0-b8 */ } else { /* b0-b8 */
int keyon = (v >> 5) & 1; int keyon = (v >> 5) & 1;
block_fnum = ((v & 0x1f) << 8) | (CH->block_fnum & 0xff); block_fnum = ((v & 0x1f) << 8) | (CH->block_fnum & 0xff);
if(CH->keyon != keyon) { if (CH->keyon != keyon) {
if((CH->keyon=keyon)) { if ((CH->keyon=keyon)) {
CH->op1_out[0] = CH->op1_out[1] = 0; CH->op1_out[0] = CH->op1_out[1] = 0;
OPL_KEYON(&CH->SLOT[SLOT1]); OPL_KEYON(&CH->SLOT[SLOT1]);
OPL_KEYON(&CH->SLOT[SLOT2]); OPL_KEYON(&CH->SLOT[SLOT2]);
@ -950,14 +950,14 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
} }
} }
/* update */ /* update */
if(CH->block_fnum != block_fnum) { if (CH->block_fnum != block_fnum) {
int blockRv = 7 - (block_fnum >> 10); int blockRv = 7 - (block_fnum >> 10);
int fnum = block_fnum & 0x3ff; int fnum = block_fnum & 0x3ff;
CH->block_fnum = block_fnum; CH->block_fnum = block_fnum;
CH->ksl_base = KSL_TABLE[block_fnum >> 6]; CH->ksl_base = KSL_TABLE[block_fnum >> 6];
CH->fc = OPL->FN_TABLE[fnum] >> blockRv; CH->fc = OPL->FN_TABLE[fnum] >> blockRv;
CH->kcode = CH->block_fnum >> 9; CH->kcode = CH->block_fnum >> 9;
if((OPL->mode & 0x40) && CH->block_fnum & 0x100) if ((OPL->mode & 0x40) && CH->block_fnum & 0x100)
CH->kcode |=1; CH->kcode |=1;
CALC_FCSLOT(CH,&CH->SLOT[SLOT1]); CALC_FCSLOT(CH,&CH->SLOT[SLOT1]);
CALC_FCSLOT(CH,&CH->SLOT[SLOT2]); CALC_FCSLOT(CH,&CH->SLOT[SLOT2]);
@ -965,7 +965,7 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
return; return;
case 0xc0: case 0xc0:
/* FB,C */ /* FB,C */
if((r & 0x0f) > 8) if ((r & 0x0f) > 8)
return; return;
CH = &OPL->P_CH[r&0x0f]; CH = &OPL->P_CH[r&0x0f];
{ {
@ -977,10 +977,10 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
return; return;
case 0xe0: /* wave type */ case 0xe0: /* wave type */
slot = slot_array[r & 0x1f]; slot = slot_array[r & 0x1f];
if(slot == -1) if (slot == -1)
return; return;
CH = &OPL->P_CH[slot>>1]; CH = &OPL->P_CH[slot>>1];
if(OPL->wavesel) { if (OPL->wavesel) {
CH->SLOT[slot&1].wavetable = &SIN_TABLE[(v & 0x03) * SIN_ENT]; CH->SLOT[slot&1].wavetable = &SIN_TABLE[(v & 0x03) * SIN_ENT];
} }
return; return;
@ -990,12 +990,12 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {
/* lock/unlock for common table */ /* lock/unlock for common table */
static int OPL_LockTable(void) { static int OPL_LockTable(void) {
num_lock++; num_lock++;
if(num_lock>1) if (num_lock>1)
return 0; return 0;
/* first time */ /* first time */
cur_chip = NULL; cur_chip = NULL;
/* allocate total level table (128kb space) */ /* allocate total level table (128kb space) */
if(!OPLOpenTable()) { if (!OPLOpenTable()) {
num_lock--; num_lock--;
return -1; return -1;
} }
@ -1003,9 +1003,9 @@ static int OPL_LockTable(void) {
} }
static void OPL_UnLockTable(void) { static void OPL_UnLockTable(void) {
if(num_lock) if (num_lock)
num_lock--; num_lock--;
if(num_lock) if (num_lock)
return; return;
/* last time */ /* last time */
cur_chip = NULL; cur_chip = NULL;
@ -1027,7 +1027,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) {
OPL_CH *CH, *R_CH; OPL_CH *CH, *R_CH;
if((void *)OPL != cur_chip) { if ((void *)OPL != cur_chip) {
cur_chip = (void *)OPL; cur_chip = (void *)OPL;
/* channel pointers */ /* channel pointers */
S_CH = OPL->P_CH; S_CH = OPL->P_CH;
@ -1044,17 +1044,17 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) {
vib_table = OPL->vib_table; vib_table = OPL->vib_table;
} }
R_CH = rythm ? &S_CH[6] : E_CH; R_CH = rythm ? &S_CH[6] : E_CH;
for(i = 0; i < length; i++) { for (i = 0; i < length; i++) {
/* channel A channel B channel C */ /* channel A channel B channel C */
/* LFO */ /* LFO */
ams = ams_table[(amsCnt += amsIncr) >> AMS_SHIFT]; ams = ams_table[(amsCnt += amsIncr) >> AMS_SHIFT];
vib = vib_table[(vibCnt += vibIncr) >> VIB_SHIFT]; vib = vib_table[(vibCnt += vibIncr) >> VIB_SHIFT];
outd[0] = 0; outd[0] = 0;
/* FM part */ /* FM part */
for(CH=S_CH; CH < R_CH; CH++) for (CH = S_CH; CH < R_CH; CH++)
OPL_CALC_CH(CH); OPL_CALC_CH(CH);
/* Rythn part */ /* Rythn part */
if(rythm) if (rythm)
OPL_CALC_RH(OPL, S_CH); OPL_CALC_RH(OPL, S_CH);
/* limit check */ /* limit check */
data = CLIP(outd[0], OPL_MINOUT, OPL_MAXOUT); data = CLIP(outd[0], OPL_MINOUT, OPL_MAXOUT);
@ -1079,13 +1079,13 @@ void OPLResetChip(FM_OPL *OPL) {
OPLWriteReg(OPL, 0x02,0); /* Timer1 */ OPLWriteReg(OPL, 0x02,0); /* Timer1 */
OPLWriteReg(OPL, 0x03,0); /* Timer2 */ OPLWriteReg(OPL, 0x03,0); /* Timer2 */
OPLWriteReg(OPL, 0x04,0); /* IRQ mask clear */ OPLWriteReg(OPL, 0x04,0); /* IRQ mask clear */
for(i = 0xff; i >= 0x20; i--) for (i = 0xff; i >= 0x20; i--)
OPLWriteReg(OPL,i,0); OPLWriteReg(OPL,i,0);
/* reset OPerator parameter */ /* reset OPerator parameter */
for(c = 0; c < OPL->max_ch ;c++ ) { for (c = 0; c < OPL->max_ch ;c++ ) {
OPL_CH *CH = &OPL->P_CH[c]; OPL_CH *CH = &OPL->P_CH[c];
/* OPL->P_CH[c].PAN = OPN_CENTER; */ /* OPL->P_CH[c].PAN = OPN_CENTER; */
for(s = 0; s < 2; s++ ) { for (s = 0; s < 2; s++ ) {
/* wave table */ /* wave table */
CH->SLOT[s].wavetable = &SIN_TABLE[0]; CH->SLOT[s].wavetable = &SIN_TABLE[0];
/* CH->SLOT[s].evm = ENV_MOD_RR; */ /* CH->SLOT[s].evm = ENV_MOD_RR; */
@ -1104,7 +1104,7 @@ FM_OPL *OPLCreate(int type, int clock, int rate) {
int state_size; int state_size;
int max_ch = 9; /* normaly 9 channels */ int max_ch = 9; /* normaly 9 channels */
if( OPL_LockTable() == -1) if (OPL_LockTable() == -1)
return NULL; return NULL;
/* allocate OPL state space */ /* allocate OPL state space */
state_size = sizeof(FM_OPL); state_size = sizeof(FM_OPL);
@ -1112,7 +1112,7 @@ FM_OPL *OPLCreate(int type, int clock, int rate) {
/* allocate memory block */ /* allocate memory block */
ptr = (char *)calloc(state_size, 1); ptr = (char *)calloc(state_size, 1);
if(ptr == NULL) if (ptr == NULL)
return NULL; return NULL;
/* clear */ /* clear */
@ -1158,10 +1158,10 @@ void OPLSetUpdateHandler(FM_OPL *OPL, OPL_UPDATEHANDLER UpdateHandler,int param)
/* ---------- YM3812 I/O interface ---------- */ /* ---------- YM3812 I/O interface ---------- */
int OPLWrite(FM_OPL *OPL,int a,int v) { int OPLWrite(FM_OPL *OPL,int a,int v) {
if(!(a & 1)) { /* address port */ if (!(a & 1)) { /* address port */
OPL->address = v & 0xff; OPL->address = v & 0xff;
} else { /* data port */ } else { /* data port */
if(OPL->UpdateHandler) if (OPL->UpdateHandler)
OPL->UpdateHandler(OPL->UpdateParam,0); OPL->UpdateHandler(OPL->UpdateParam,0);
OPLWriteReg(OPL, OPL->address,v); OPLWriteReg(OPL, OPL->address,v);
} }
@ -1169,11 +1169,11 @@ int OPLWrite(FM_OPL *OPL,int a,int v) {
} }
unsigned char OPLRead(FM_OPL *OPL,int a) { unsigned char OPLRead(FM_OPL *OPL,int a) {
if(!(a & 1)) { /* status port */ if (!(a & 1)) { /* status port */
return OPL->status & (OPL->statusmask | 0x80); return OPL->status & (OPL->statusmask | 0x80);
} }
/* data port */ /* data port */
switch(OPL->address) { switch (OPL->address) {
case 0x05: /* KeyBoard IN */ case 0x05: /* KeyBoard IN */
warning("OPL:read unmapped KEYBOARD port"); warning("OPL:read unmapped KEYBOARD port");
return 0; return 0;
@ -1189,16 +1189,16 @@ unsigned char OPLRead(FM_OPL *OPL,int a) {
} }
int OPLTimerOver(FM_OPL *OPL, int c) { int OPLTimerOver(FM_OPL *OPL, int c) {
if(c) { /* Timer B */ if (c) { /* Timer B */
OPL_STATUS_SET(OPL, 0x20); OPL_STATUS_SET(OPL, 0x20);
} else { /* Timer A */ } else { /* Timer A */
OPL_STATUS_SET(OPL, 0x40); OPL_STATUS_SET(OPL, 0x40);
/* CSM mode key,TL controll */ /* CSM mode key,TL controll */
if(OPL->mode & 0x80) { /* CSM mode total level latch and auto key on */ if (OPL->mode & 0x80) { /* CSM mode total level latch and auto key on */
int ch; int ch;
if(OPL->UpdateHandler) if (OPL->UpdateHandler)
OPL->UpdateHandler(OPL->UpdateParam,0); OPL->UpdateHandler(OPL->UpdateParam,0);
for(ch = 0; ch < 9; ch++) for (ch = 0; ch < 9; ch++)
CSMKeyControll(&OPL->P_CH[ch]); CSMKeyControll(&OPL->P_CH[ch]);
} }
} }

View File

@ -106,7 +106,7 @@ int VagStream::readBuffer(int16 *buffer, const int numSamples) {
_samplesRemaining = 28 - i; _samplesRemaining = 28 - i;
} }
if(_loop && _stream->eos()) if (_loop && _stream->eos())
rewind(); rewind();
return samplesDecoded; return samplesDecoded;

View File

@ -221,7 +221,7 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain
for (int paramCtr = 0; paramCtr < numParams[actionNum]; ++paramCtr) for (int paramCtr = 0; paramCtr < numParams[actionNum]; ++paramCtr)
params[paramCtr] = lureExe.readWord(); params[paramCtr] = lureExe.readWord();
switch(actionNum) { switch (actionNum) {
case NPC_SET_ROOM_AND_BLOCKED_OFFSET: case NPC_SET_ROOM_AND_BLOCKED_OFFSET:
case NPC_SET_SUPPORT_OFFSET: case NPC_SET_SUPPORT_OFFSET:
case NPC_SUPPORT_OFFSET_COND: case NPC_SUPPORT_OFFSET_COND:

View File

@ -147,7 +147,7 @@ static void createTableFile(TableFile *tf) {
writeUint32BE(out, CURRENT_VERSION); writeUint32BE(out, CURRENT_VERSION);
/* write tables */ /* write tables */
offset = 4 + 4; offset = 4 + 4;
for(i = 0; i < tf->dataFileEntriesTableCount; ++i) { for (i = 0; i < tf->dataFileEntriesTableCount; ++i) {
const DataFileEntriesTable *dfet = &tf->dataFileEntriesTable[i]; const DataFileEntriesTable *dfet = &tf->dataFileEntriesTable[i];
/* write number of entries in table */ /* write number of entries in table */
writeUint16BE(out, dfet->fileEntriesCount); writeUint16BE(out, dfet->fileEntriesCount);