mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
CINE: A little bit enforcement of our formatting guidelines.
Powered by astyle & manual fixup afterwards.
This commit is contained in:
parent
8f9b81104f
commit
5d84f2df43
@ -202,13 +202,13 @@ AnimData::AnimData(const AnimData &src) : _width(src._width),
|
||||
if (src._data) {
|
||||
_data = new byte[_size];
|
||||
assert(_data);
|
||||
memcpy(_data, src._data, _size*sizeof(byte));
|
||||
memcpy(_data, src._data, _size * sizeof(byte));
|
||||
}
|
||||
|
||||
if (src._mask) {
|
||||
_mask = new byte[_size];
|
||||
assert(_mask);
|
||||
memcpy(_mask, src._mask, _size*sizeof(byte));
|
||||
memcpy(_mask, src._mask, _size * sizeof(byte));
|
||||
}
|
||||
|
||||
memset(_name, 0, sizeof(_name));
|
||||
@ -272,8 +272,7 @@ byte AnimData::getColor(int x, int y) {
|
||||
* @param transparent Transparent color (for ANIM_MASKSPRITE)
|
||||
*/
|
||||
void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
|
||||
int16 frame, const char *n, byte transparent) {
|
||||
|
||||
int16 frame, const char *n, byte transparent) {
|
||||
assert(d);
|
||||
|
||||
if (_data) {
|
||||
@ -299,7 +298,7 @@ void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
|
||||
_size = w * h;
|
||||
_data = new byte[_size];
|
||||
assert(_data);
|
||||
memcpy(_data, d, _size*sizeof(byte));
|
||||
memcpy(_data, d, _size * sizeof(byte));
|
||||
break;
|
||||
|
||||
case ANIM_MASK:
|
||||
@ -669,13 +668,13 @@ void convert8BBP2(byte *dest, byte *source, int16 width, int16 height) {
|
||||
*(source + k) <<= 1;
|
||||
if (k > 0 + m)
|
||||
color <<= 1;
|
||||
} // end k
|
||||
} // end k
|
||||
*(dest++) = color;
|
||||
} // end i
|
||||
} // end m
|
||||
} // end i
|
||||
} // end m
|
||||
|
||||
source += 0x10;
|
||||
} // end j
|
||||
} // end j
|
||||
}
|
||||
|
||||
/**
|
||||
@ -685,7 +684,7 @@ void convert8BBP2(byte *dest, byte *source, int16 width, int16 height) {
|
||||
* @param frameIndex frame of animation to load (-1 for all frames)
|
||||
* @return The number of the animDataTable entry after the loaded image set (-1 if error)
|
||||
*/
|
||||
int loadSet(const char *resourceName, int16 idx, int16 frameIndex =-1 ) {
|
||||
int loadSet(const char *resourceName, int16 idx, int16 frameIndex = -1) {
|
||||
AnimHeader2Struct header2;
|
||||
uint16 numSpriteInAnim;
|
||||
int16 foundFileIdx = findFileInBundle(resourceName);
|
||||
@ -712,10 +711,9 @@ int loadSet(const char *resourceName, int16 idx, int16 frameIndex =-1 ) {
|
||||
int16 startFrame = 0;
|
||||
int16 endFrame = numSpriteInAnim;
|
||||
|
||||
if(frameIndex>=0)
|
||||
{
|
||||
if (frameIndex >= 0) {
|
||||
startFrame = frameIndex;
|
||||
endFrame = frameIndex+1;
|
||||
endFrame = frameIndex + 1;
|
||||
ptr += 0x10 * frameIndex;
|
||||
}
|
||||
|
||||
@ -766,7 +764,7 @@ int loadSeq(const char *resourceName, int16 idx) {
|
||||
byte *dataPtr = readBundleFile(foundFileIdx);
|
||||
int entry = idx < 0 ? emptyAnimSpace() : idx;
|
||||
|
||||
g_cine->_animDataTable[entry].load(dataPtr+0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize-0x16, 1, foundFileIdx, 0, currentPartName);
|
||||
g_cine->_animDataTable[entry].load(dataPtr + 0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize - 0x16, 1, foundFileIdx, 0, currentPartName);
|
||||
free(dataPtr);
|
||||
return entry + 1;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ private:
|
||||
bool _preLoad;
|
||||
int _timerDelayMultiplier;
|
||||
|
||||
public:
|
||||
public:
|
||||
// TODO: These are pseudo-global vars
|
||||
// They better belong to appropriate classes
|
||||
Common::Array<AnimData> _animDataTable;
|
||||
|
@ -28,7 +28,7 @@ namespace Cine {
|
||||
bool labyrinthCheat;
|
||||
|
||||
CineConsole::CineConsole(CineEngine *vm) : GUI::Debugger(), _vm(vm) {
|
||||
DCmd_Register("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
|
||||
DCmd_Register("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
|
||||
|
||||
labyrinthCheat = false;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ FWRenderer::FWRenderer() : _background(NULL), _backupPal(), _cmd(""),
|
||||
assert(_backBuffer);
|
||||
|
||||
memset(_backBuffer, 0, _screenSize);
|
||||
memset(_bgName, 0, sizeof (_bgName));
|
||||
memset(_bgName, 0, sizeof(_bgName));
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ void FWRenderer::drawCommand() {
|
||||
unsigned int i;
|
||||
int x = 10, y = _cmdY;
|
||||
|
||||
if(disableSystemMenu == 0) {
|
||||
if (disableSystemMenu == 0) {
|
||||
drawPlainBox(x, y, 301, 11, 0);
|
||||
drawBorder(x - 1, y - 1, 302, 12, 2);
|
||||
|
||||
@ -307,7 +307,7 @@ void FWRenderer::drawMessage(const char *str, int x, int y, int width, int color
|
||||
i++;
|
||||
line = fitLine(str + i, tw, words, cw);
|
||||
|
||||
if ( str[i + line] != '\0' && str[i + line] != 0x7C && words) {
|
||||
if (str[i + line] != '\0' && str[i + line] != 0x7C && words) {
|
||||
space = (tw - cw) / words;
|
||||
extraSpace = (tw - cw) % words;
|
||||
} else {
|
||||
@ -1288,6 +1288,7 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
|
||||
sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame];
|
||||
drawSprite(&(*it), sprite->data(), sprite->_realWidth, sprite->_height, _backBuffer, g_cine->_objectTable[it->objIdx].x, g_cine->_objectTable[it->objIdx].y, g_cine->_objectTable[it->objIdx].part, sprite->_bpp);
|
||||
break;
|
||||
|
||||
// game message
|
||||
case 2:
|
||||
if (it->objIdx >= g_cine->_messageTable.size()) {
|
||||
@ -1344,7 +1345,7 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) {
|
||||
height = obj->costume;
|
||||
drawPlainBox(obj->x, obj->y, width, height, color);
|
||||
debug(5, "renderOverlay: type=%d, x=%d, y=%d, width=%d, height=%d, color=%d",
|
||||
it->type, obj->x, obj->y, width, height, color);
|
||||
it->type, obj->x, obj->y, width, height, color);
|
||||
break;
|
||||
|
||||
// something else
|
||||
@ -1468,7 +1469,7 @@ void OSRenderer::selectBg(unsigned int idx) {
|
||||
|
||||
if (_bgTable[idx].bg) {
|
||||
assert(_bgTable[idx].pal.isValid() && !(_bgTable[idx].pal.empty()));
|
||||
_currentBg = idx;
|
||||
_currentBg = idx;
|
||||
} else
|
||||
warning("OSRenderer::selectBg(%d) - attempt to select null background", idx);
|
||||
reloadPalette();
|
||||
@ -1794,23 +1795,23 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
|
||||
|
||||
// draw the mask based on next objects in the list
|
||||
Common::List<overlay>::iterator it;
|
||||
for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ++it) {
|
||||
if(&(*it) == overlayPtr) {
|
||||
for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ++it) {
|
||||
if (&(*it) == overlayPtr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while(it != g_cine->_overlayList.end()) {
|
||||
while (it != g_cine->_overlayList.end()) {
|
||||
overlay *pCurrentOverlay = &(*it);
|
||||
if ((pCurrentOverlay->type == 5) || ((pCurrentOverlay->type == 21) && (pCurrentOverlay->x == overlayPtr->objIdx))) {
|
||||
AnimData *sprite = &g_cine->_animDataTable[g_cine->_objectTable[it->objIdx].frame];
|
||||
|
||||
if (pMask == NULL) {
|
||||
pMask = new byte[width*height];
|
||||
pMask = new byte[width * height];
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
byte spriteColor= spritePtr[width * i + j];
|
||||
byte spriteColor = spritePtr[width * i + j];
|
||||
pMask[width * i + j] = spriteColor;
|
||||
}
|
||||
}
|
||||
@ -1821,7 +1822,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
|
||||
int inMaskX = (g_cine->_objectTable[it->objIdx].x + i) - x;
|
||||
int inMaskY = (g_cine->_objectTable[it->objIdx].y + j) - y;
|
||||
|
||||
if (inMaskX >=0 && inMaskX < width) {
|
||||
if (inMaskX >= 0 && inMaskX < width) {
|
||||
if (inMaskY >= 0 && inMaskY < height) {
|
||||
if (sprite->_bpp == 1) {
|
||||
if (!sprite->getColor(i, j)) {
|
||||
@ -1837,7 +1838,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
|
||||
}
|
||||
|
||||
// now, draw with the mask we created
|
||||
if(pMask) {
|
||||
if (pMask) {
|
||||
spritePtr = pMask;
|
||||
}
|
||||
|
||||
@ -1852,7 +1853,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
|
||||
destPtr += i * 320;
|
||||
|
||||
for (int j = 0; j < width; j++) {
|
||||
byte color= *(spritePtr++);
|
||||
byte color = *(spritePtr++);
|
||||
if ((transparentColor != color) && x + j >= 0 && x + j < 320 && i + y >= 0 && i + y < 200) {
|
||||
*(destPtr++) = color;
|
||||
} else {
|
||||
|
@ -288,7 +288,7 @@ byte gfxGetColor(int16 x, int16 y, const byte *ptr, int16 width);
|
||||
|
||||
void gfxResetRawPage(byte *pageRaw);
|
||||
void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h);
|
||||
void gfxCopyRawPage(byte *source, byte * dest);
|
||||
void gfxCopyRawPage(byte *source, byte *dest);
|
||||
void gfxFlipRawPage(byte *frontBuffer);
|
||||
void drawSpriteRaw(const byte *spritePtr, const byte *maskPtr, int16 width, int16 height, byte *page, int16 x, int16 y);
|
||||
void gfxDrawPlainBoxRaw(int16 x1, int16 y1, int16 x2, int16 y2, byte color, byte *page);
|
||||
|
@ -180,19 +180,19 @@ static void processEvent(Common::Event &event) {
|
||||
case Common::KEYCODE_F11:
|
||||
renderer->showCollisionPage(false);
|
||||
break;
|
||||
case Common::KEYCODE_KP5: // Emulated left mouse button click
|
||||
case Common::KEYCODE_LEFT: // Left
|
||||
case Common::KEYCODE_KP4: // Left
|
||||
case Common::KEYCODE_KP5: // Emulated left mouse button click
|
||||
case Common::KEYCODE_LEFT: // Left
|
||||
case Common::KEYCODE_KP4: // Left
|
||||
case Common::KEYCODE_RIGHT: // Right
|
||||
case Common::KEYCODE_KP6: // Right
|
||||
case Common::KEYCODE_UP: // Up
|
||||
case Common::KEYCODE_KP8: // Up
|
||||
case Common::KEYCODE_DOWN: // Down
|
||||
case Common::KEYCODE_KP2: // Down
|
||||
case Common::KEYCODE_KP9: // Up & Right
|
||||
case Common::KEYCODE_KP7: // Up & Left
|
||||
case Common::KEYCODE_KP1: // Down & Left
|
||||
case Common::KEYCODE_KP3: // Down & Right
|
||||
case Common::KEYCODE_KP6: // Right
|
||||
case Common::KEYCODE_UP: // Up
|
||||
case Common::KEYCODE_KP8: // Up
|
||||
case Common::KEYCODE_DOWN: // Down
|
||||
case Common::KEYCODE_KP2: // Down
|
||||
case Common::KEYCODE_KP9: // Up & Right
|
||||
case Common::KEYCODE_KP7: // Up & Left
|
||||
case Common::KEYCODE_KP1: // Down & Left
|
||||
case Common::KEYCODE_KP3: // Down & Right
|
||||
// Stop ego movement made with keyboard when releasing a known key
|
||||
moveUsingKeyboard(0, 0);
|
||||
break;
|
||||
@ -434,9 +434,9 @@ void CineEngine::mainLoop(int bootScriptIdx) {
|
||||
|
||||
hideMouse();
|
||||
g_sound->stopMusic();
|
||||
// if (g_cine->getGameType() == Cine::GType_OS) {
|
||||
//if (g_cine->getGameType() == Cine::GType_OS) {
|
||||
// freeUnkList();
|
||||
// }
|
||||
//}
|
||||
closePart();
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ void loadObject(char *pObjectName) {
|
||||
assert(numEntry <= NUM_MAX_OBJECT);
|
||||
|
||||
for (i = 0; i < numEntry; i++) {
|
||||
if (g_cine->_objectTable[i].costume != -2 && g_cine->_objectTable[i].costume != -3) { // flag is keep ?
|
||||
if (g_cine->_objectTable[i].costume != -2 && g_cine->_objectTable[i].costume != -3) { // flag is keep?
|
||||
Common::MemoryReadStream readS(ptr, entrySize);
|
||||
|
||||
g_cine->_objectTable[i].x = readS.readSint16BE();
|
||||
|
@ -92,7 +92,8 @@ void loadRelatedPalette(const char *fileName) {
|
||||
paletteIndex = findPaletteFromName(localName);
|
||||
|
||||
if (paletteIndex == -1) {
|
||||
for (i = 0; i < 16; i++) { // generate default palette
|
||||
// generate default palette
|
||||
for (i = 0; i < 16; i++) {
|
||||
paletteBuffer1[i] = paletteBuffer2[i] = (i << 4) + i;
|
||||
}
|
||||
} else {
|
||||
|
@ -263,7 +263,7 @@ byte *readBundleSoundFile(const char *entryName, uint32 *size) {
|
||||
/** Rotate byte value to the left by n bits */
|
||||
byte rolByte(byte value, uint n) {
|
||||
n %= 8;
|
||||
return (byte) ((value << n) | (value >> (8 - n)));
|
||||
return (byte)((value << n) | (value >> (8 - n)));
|
||||
}
|
||||
|
||||
byte *readFile(const char *filename, bool crypted) {
|
||||
|
@ -1002,7 +1002,7 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
|
||||
const int entrySize = ((saveGameFormat == ANIMSIZE_23) ? 23 : 30);
|
||||
const int fileStartPos = fHandle.pos();
|
||||
|
||||
for(int resourceIndex=0; resourceIndex<NUM_MAX_ANIMDATA; resourceIndex++) {
|
||||
for (int resourceIndex = 0; resourceIndex < NUM_MAX_ANIMDATA; resourceIndex++) {
|
||||
// Seek to the start of the current animation's entry
|
||||
fHandle.seek(fileStartPos + resourceIndex * entrySize);
|
||||
// Read in the current animation entry
|
||||
|
@ -68,7 +68,7 @@ enum CineSaveGameFormat {
|
||||
};
|
||||
|
||||
/** Identifier for the temporary Operation Stealth savegame format. */
|
||||
static const uint32 TEMP_OS_FORMAT_ID = MKTAG('T','E','M','P');
|
||||
static const uint32 TEMP_OS_FORMAT_ID = MKTAG('T', 'E', 'M', 'P');
|
||||
|
||||
/** The current version number of Operation Stealth's savegame format. */
|
||||
static const uint32 CURRENT_OS_SAVE_VER = 1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -153,7 +153,7 @@ const int AdLibSoundDriver::_freqTable[] = {
|
||||
const int AdLibSoundDriver::_freqTableCount = ARRAYSIZE(_freqTable);
|
||||
|
||||
const int AdLibSoundDriver::_operatorsTable[] = {
|
||||
0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21
|
||||
0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21
|
||||
};
|
||||
|
||||
const int AdLibSoundDriver::_operatorsTableCount = ARRAYSIZE(_operatorsTable);
|
||||
@ -614,7 +614,7 @@ void AdLibSoundDriverADL::playSample(const byte *data, int size, int channel, in
|
||||
}
|
||||
|
||||
MidiSoundDriverH32::MidiSoundDriverH32(MidiDriver *output)
|
||||
: _output(output), _callback(0), _mutex() {
|
||||
: _output(output), _callback(0), _mutex() {
|
||||
}
|
||||
|
||||
MidiSoundDriverH32::~MidiSoundDriverH32() {
|
||||
@ -731,13 +731,13 @@ void MidiSoundDriverH32::selectInstrument(int channel, int timbreGroup, int timb
|
||||
0x00, 0x00, 0x00, // offset
|
||||
0x00, // Timbre group _ timbreGroup * 64 + timbreNumber should be the
|
||||
0x00, // Timbre number / MT-32 instrument in case timbreGroup is 0 or 1.
|
||||
0x18, // Key shift (= 0)
|
||||
0x18, // Key shift (= 0)
|
||||
0x32, // Fine tune (= 0)
|
||||
0x0C, // Bender Range
|
||||
0x03, // Assign Mode
|
||||
0x01, // Reverb Switch (= enabled)
|
||||
0x00, // dummy
|
||||
0x00, // Output level
|
||||
0x00, // Output level
|
||||
0x07, // Panpot (= balanced)
|
||||
0x00, // dummy
|
||||
0x00, // dummy
|
||||
|
@ -88,7 +88,7 @@ static const CharacterEntry fontParamTable_standard[NUM_FONT_CHARS] = {
|
||||
{64, 3}, {65, 3}, { 0, 0}, { 0, 0}, {62, 2}, {74, 6}, {66, 1}, {67, 6},
|
||||
{52, 6}, {53, 6}, {54, 6}, {55, 6}, {56, 6}, {57, 6}, {58, 6}, {59, 6},
|
||||
{60, 6}, {61, 6}, {76, 3}, { 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, {75, 6},
|
||||
{ 0, 0}, { 0, 6}, //a
|
||||
{ 0, 0}, { 0, 6}, //a
|
||||
{ 1, 6}, { 2, 6}, { 3, 6}, { 4, 6}, { 5, 6}, { 6, 6},
|
||||
{ 7, 6}, { 8, 3}, { 9, 6}, {10, 6}, {11, 6}, {12, 7}, {13, 6}, {14, 6},
|
||||
{15, 6}, {16, 6}, {17, 6}, {18, 6}, {19, 6}, {20, 6}, {21, 6}, {22, 7},
|
||||
|
@ -46,7 +46,7 @@ struct CharacterEntry {
|
||||
};
|
||||
|
||||
struct TextHandler {
|
||||
byte textTable[NUM_FONT_CHARS][2][FONT_WIDTH * FONT_HEIGHT];
|
||||
byte textTable[NUM_FONT_CHARS][2][FONT_WIDTH *FONT_HEIGHT];
|
||||
CharacterEntry fontParamTable[NUM_FONT_CHARS];
|
||||
};
|
||||
|
||||
|
@ -99,8 +99,7 @@ byte isInPause = 0;
|
||||
* Bit on = mouse button down
|
||||
* Bit off = mouse button up
|
||||
*/
|
||||
enum MouseButtonState
|
||||
{
|
||||
enum MouseButtonState {
|
||||
kLeftMouseButton = (1 << 0),
|
||||
kRightMouseButton = (1 << 1)
|
||||
};
|
||||
@ -271,7 +270,7 @@ int16 getObjectUnderCursor(uint16 x, uint16 y) {
|
||||
} else if (it->type == 1 && gfxGetBit(xdif, ydif, g_cine->_animDataTable[frame].data(), g_cine->_animDataTable[frame]._width * 4)) {
|
||||
return it->objIdx;
|
||||
}
|
||||
} else if (it->type == 0) { // use generated mask
|
||||
} else if (it->type == 0) { // use generated mask
|
||||
if (gfxGetBit(xdif, ydif, g_cine->_animDataTable[frame].mask(), g_cine->_animDataTable[frame]._width)) {
|
||||
return it->objIdx;
|
||||
}
|
||||
@ -358,128 +357,122 @@ void CineEngine::makeSystemMenu() {
|
||||
systemCommand = makeMenuChoice(systemMenu, numEntry, mouseX, mouseY, 140);
|
||||
|
||||
switch (systemCommand) {
|
||||
case 0: // Pause
|
||||
{
|
||||
renderer->drawString(otherMessages[2], 0);
|
||||
waitPlayerInput();
|
||||
break;
|
||||
case 0: { // Pause
|
||||
renderer->drawString(otherMessages[2], 0);
|
||||
waitPlayerInput();
|
||||
break;
|
||||
}
|
||||
case 1: { // Restart Game
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
_restartRequested = true;
|
||||
}
|
||||
case 1: // Restart Game
|
||||
{
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
_restartRequested = true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case 2: { // Quit
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
quitGame();
|
||||
}
|
||||
case 2: // Quit
|
||||
{
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
quitGame();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Select save drive... change ?
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 4: // load game
|
||||
{
|
||||
if (loadSaveDirectory()) {
|
||||
break;
|
||||
}
|
||||
case 3: { // Select save drive... change ?
|
||||
break;
|
||||
}
|
||||
case 4: { // load game
|
||||
if (loadSaveDirectory()) {
|
||||
// int16 selectedSave;
|
||||
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
||||
|
||||
if (selectedSave >= 0) {
|
||||
char saveNameBuffer[256];
|
||||
sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), selectedSave);
|
||||
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
char loadString[256];
|
||||
|
||||
if (selectedSave >= 0) {
|
||||
char saveNameBuffer[256];
|
||||
sprintf(saveNameBuffer, "%s.%1d", _targetName.c_str(), selectedSave);
|
||||
sprintf(loadString, otherMessages[3], currentSaveName[selectedSave]);
|
||||
renderer->drawString(loadString, 0);
|
||||
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
char loadString[256];
|
||||
|
||||
sprintf(loadString, otherMessages[3], currentSaveName[selectedSave]);
|
||||
renderer->drawString(loadString, 0);
|
||||
|
||||
makeLoad(saveNameBuffer);
|
||||
} else {
|
||||
renderer->drawString(otherMessages[4], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
makeLoad(saveNameBuffer);
|
||||
} else {
|
||||
renderer->drawString(otherMessages[4], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
} else {
|
||||
renderer->drawString(otherMessages[5], 0);
|
||||
renderer->drawString(otherMessages[4], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
renderer->drawString(otherMessages[5], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
case 5: // Save game
|
||||
{
|
||||
loadSaveDirectory();
|
||||
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
||||
break;
|
||||
}
|
||||
case 5: { // Save game
|
||||
loadSaveDirectory();
|
||||
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
||||
|
||||
if (selectedSave >= 0) {
|
||||
char saveFileName[256];
|
||||
char saveName[20];
|
||||
saveName[0] = 0;
|
||||
if (selectedSave >= 0) {
|
||||
char saveFileName[256];
|
||||
char saveName[20];
|
||||
saveName[0] = 0;
|
||||
|
||||
if (!makeTextEntryMenu(otherMessages[6], saveName, 20, 120))
|
||||
if (!makeTextEntryMenu(otherMessages[6], saveName, 20, 120))
|
||||
break;
|
||||
|
||||
strncpy(currentSaveName[selectedSave], saveName, 20);
|
||||
|
||||
sprintf(saveFileName, "%s.%1d", _targetName.c_str(), selectedSave);
|
||||
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
char saveString[256];
|
||||
Common::String tmp = Common::String::format("%s.dir", _targetName.c_str());
|
||||
|
||||
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp);
|
||||
if (!fHandle) {
|
||||
warning("Unable to open file %s for saving", tmp.c_str());
|
||||
break;
|
||||
|
||||
strncpy(currentSaveName[selectedSave], saveName, 20);
|
||||
|
||||
sprintf(saveFileName, "%s.%1d", _targetName.c_str(), selectedSave);
|
||||
|
||||
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
||||
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
||||
char saveString[256];
|
||||
Common::String tmp = Common::String::format("%s.dir", _targetName.c_str());
|
||||
|
||||
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp);
|
||||
if (!fHandle) {
|
||||
warning("Unable to open file %s for saving", tmp.c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
fHandle->write(currentSaveName, 200);
|
||||
delete fHandle;
|
||||
|
||||
sprintf(saveString, otherMessages[3], currentSaveName[selectedSave]);
|
||||
renderer->drawString(saveString, 0);
|
||||
|
||||
makeSave(saveFileName);
|
||||
|
||||
checkDataDisk(-1);
|
||||
} else {
|
||||
renderer->drawString(otherMessages[4], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
|
||||
fHandle->write(currentSaveName, 200);
|
||||
delete fHandle;
|
||||
|
||||
sprintf(saveString, otherMessages[3], currentSaveName[selectedSave]);
|
||||
renderer->drawString(saveString, 0);
|
||||
|
||||
makeSave(saveFileName);
|
||||
|
||||
checkDataDisk(-1);
|
||||
} else {
|
||||
renderer->drawString(otherMessages[4], 0);
|
||||
waitPlayerInput();
|
||||
checkDataDisk(-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inMenu = false;
|
||||
}
|
||||
}
|
||||
|
||||
void drawMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 offset, int16 color, byte* page) {
|
||||
gfxDrawLine(x + offset, y + offset, x + width - offset, y + offset, color, page); // top
|
||||
gfxDrawLine(x + offset, currentY + 4 - offset, x + width - offset, currentY + 4 - offset, color, page); // bottom
|
||||
gfxDrawLine(x + offset, y + offset, x + offset, currentY + 4 - offset, color, page); // left
|
||||
gfxDrawLine(x + width - offset, y + offset, x + width - offset, currentY + 4 - offset, color, page); // right
|
||||
void drawMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 offset, int16 color, byte *page) {
|
||||
gfxDrawLine(x + offset, y + offset, x + width - offset, y + offset, color, page); // top
|
||||
gfxDrawLine(x + offset, currentY + 4 - offset, x + width - offset, currentY + 4 - offset, color, page); // bottom
|
||||
gfxDrawLine(x + offset, y + offset, x + offset, currentY + 4 - offset, color, page); // left
|
||||
gfxDrawLine(x + width - offset, y + offset, x + width - offset, currentY + 4 - offset, color, page); // right
|
||||
}
|
||||
|
||||
void drawDoubleMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 color, byte* page) {
|
||||
void drawDoubleMessageBox(int16 x, int16 y, int16 width, int16 currentY, int16 color, byte *page) {
|
||||
drawMessageBox(x, y, width, currentY, 1, 0, page);
|
||||
drawMessageBox(x, y, width, currentY, 0, color, page);
|
||||
}
|
||||
@ -581,7 +574,7 @@ void makeCommandLine() {
|
||||
g_cine->_commandBuffer = "";
|
||||
}
|
||||
|
||||
if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection ?
|
||||
if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection?
|
||||
int16 si;
|
||||
|
||||
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
||||
@ -635,7 +628,7 @@ void makeCommandLine() {
|
||||
}
|
||||
|
||||
if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) {
|
||||
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
|
||||
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
|
||||
int16 si;
|
||||
|
||||
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
||||
@ -742,11 +735,11 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
|
||||
mainLoopSub6();
|
||||
}
|
||||
|
||||
if (menuVar4 && currentSelection > 0) { // go up
|
||||
if (menuVar4 && currentSelection > 0) { // go up
|
||||
currentSelection--;
|
||||
}
|
||||
|
||||
if (menuVar5) { // go down
|
||||
if (menuVar5) { // go down
|
||||
if (height - 1 > currentSelection) {
|
||||
currentSelection++;
|
||||
}
|
||||
@ -763,7 +756,7 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
|
||||
}
|
||||
}
|
||||
|
||||
if (currentSelection != oldSelection) { // old != new
|
||||
if (currentSelection != oldSelection) { // old != new
|
||||
if (needMouseSave) {
|
||||
hideMouse();
|
||||
}
|
||||
@ -789,7 +782,7 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
|
||||
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
||||
} while (button && !g_cine->shouldQuit());
|
||||
|
||||
if (var_4 == 2) { // recheck
|
||||
if (var_4 == 2) { // recheck
|
||||
if (!recheckValue)
|
||||
return -1;
|
||||
else
|
||||
@ -809,7 +802,7 @@ void makeActionMenu() {
|
||||
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
||||
|
||||
if (g_cine->getGameType() == Cine::GType_OS) {
|
||||
if(disableSystemMenu == 0) {
|
||||
if (disableSystemMenu == 0) {
|
||||
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
|
||||
}
|
||||
|
||||
@ -818,7 +811,7 @@ void makeActionMenu() {
|
||||
canUseOnObject = canUseOnItemTable[playerCommand];
|
||||
}
|
||||
} else {
|
||||
if(disableSystemMenu == 0) {
|
||||
if (disableSystemMenu == 0) {
|
||||
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
|
||||
}
|
||||
}
|
||||
@ -1185,7 +1178,7 @@ void removeMessages() {
|
||||
Common::List<overlay>::iterator it;
|
||||
bool remove;
|
||||
|
||||
for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end(); ) {
|
||||
for (it = g_cine->_overlayList.begin(); it != g_cine->_overlayList.end();) {
|
||||
if (g_cine->getGameType() == Cine::GType_OS) {
|
||||
// NOTE: These are really removeOverlay calls that have been deferred.
|
||||
// In Operation Stealth's disassembly elements are removed from the
|
||||
@ -1348,7 +1341,7 @@ void modifySeqListElement(uint16 objIdx, int16 var4Test, int16 param1, int16 par
|
||||
}
|
||||
|
||||
void computeMove1(SeqListElement &element, int16 x, int16 y, int16 param1,
|
||||
int16 param2, int16 x2, int16 y2) {
|
||||
int16 param2, int16 x2, int16 y2) {
|
||||
element.var16 = 0;
|
||||
element.var14 = 0;
|
||||
|
||||
@ -1397,7 +1390,7 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele
|
||||
int16 di;
|
||||
|
||||
debug(5, "addAni: param1 = %d, objIdx = %d, ptr = %p, element.var8 = %d, element.var14 = %d param3 = %d",
|
||||
param1, objIdx, ptr, element.var8, element.var14, param3);
|
||||
param1, objIdx, ptr, element.var8, element.var14, param3);
|
||||
|
||||
// In the original an error string is set and 0 is returned if the following doesn't hold
|
||||
assert(ptr);
|
||||
@ -1413,16 +1406,16 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele
|
||||
di = (g_cine->_objectTable[objIdx].costume + 1) % (*ptrData);
|
||||
++ptrData; // Jump over the just read byte
|
||||
// Here ptr2 seems to be indexing a table of structs (8 bytes per struct):
|
||||
// struct {
|
||||
// int8 x; // 0 (Used with checkCollision)
|
||||
// int8 y; // 1 (Used with checkCollision)
|
||||
// int8 numZones; // 2 (Used with checkCollision)
|
||||
// int8 var3; // 3 (Not used in this function)
|
||||
// int8 xAdd; // 4 (Used with an object)
|
||||
// int8 yAdd; // 5 (Used with an object)
|
||||
// int8 maskAdd; // 6 (Used with an object)
|
||||
// int8 frameAdd; // 7 (Used with an object)
|
||||
// };
|
||||
// struct {
|
||||
// int8 x; // 0 (Used with checkCollision)
|
||||
// int8 y; // 1 (Used with checkCollision)
|
||||
// int8 numZones; // 2 (Used with checkCollision)
|
||||
// int8 var3; // 3 (Not used in this function)
|
||||
// int8 xAdd; // 4 (Used with an object)
|
||||
// int8 yAdd; // 5 (Used with an object)
|
||||
// int8 maskAdd; // 6 (Used with an object)
|
||||
// int8 frameAdd; // 7 (Used with an object)
|
||||
// };
|
||||
ptr2 = ptrData + di * 8;
|
||||
|
||||
// We might probably safely discard the AND by 1 here because
|
||||
@ -1572,8 +1565,7 @@ void processSeqListElement(SeqListElement &element) {
|
||||
var_4 = -1;
|
||||
|
||||
if ((element.var16 == 1
|
||||
&& !addAni(3, element.objIdx, ptr1, element, 0, &var_4)) || (element.var16 == 2 && !addAni(2, element.objIdx, ptr1, element, 0,
|
||||
&var_4))) {
|
||||
&& !addAni(3, element.objIdx, ptr1, element, 0, &var_4)) || (element.var16 == 2 && !addAni(2, element.objIdx, ptr1, element, 0, &var_4))) {
|
||||
if (element.varC == 255) {
|
||||
g_cine->_globalVars[VAR_MOUSE_Y_POS] = 0;
|
||||
}
|
||||
@ -1702,9 +1694,9 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (((keycode >= 'a') && (keycode <='z')) ||
|
||||
((keycode >= '0') && (keycode <='9')) ||
|
||||
((keycode >= 'A') && (keycode <='Z')) ||
|
||||
if (((keycode >= 'a') && (keycode <= 'z')) ||
|
||||
((keycode >= '0') && (keycode <= '9')) ||
|
||||
((keycode >= 'A') && (keycode <= 'Z')) ||
|
||||
(keycode == ' ')) {
|
||||
if (inputLength < stringMaxLength - 1) {
|
||||
ch[0] = keycode;
|
||||
|
Loading…
Reference in New Issue
Block a user