mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-11 19:23:01 +00:00
Minor cleanup, one more time.
Fixed a crash when returning to the launcher at the end of the game. I played FOTAQ (french) from the beginning to the end some hours ago, I haven't encountered any special problems/glitches (except the one mentionned above). svn-id: r15979
This commit is contained in:
parent
76bf11cbdf
commit
fb5dcffff1
@ -36,7 +36,6 @@ Credits::Credits(QueenEngine *vm, const char* filename) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
Credits::~Credits() {
|
Credits::~Credits() {
|
||||||
_vm->display()->clearTexts(0, 199);
|
|
||||||
delete _credits;
|
delete _credits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ void Cutaway::run(char *nextFilename) {
|
|||||||
_comPanel = 0;
|
_comPanel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextFilename[0] == '\0' && !_anotherCutaway) {
|
if (nextFilename[0] == '\0' && !_anotherCutaway && _vm->logic()->currentRoom() != ROOM_ENDING_CREDITS) {
|
||||||
_vm->display()->fullscreen(false);
|
_vm->display()->fullscreen(false);
|
||||||
|
|
||||||
// Lines 2138-2182 in cutaway.c
|
// Lines 2138-2182 in cutaway.c
|
||||||
|
@ -246,6 +246,8 @@ enum {
|
|||||||
AZURA_HEAD = 106,
|
AZURA_HEAD = 106,
|
||||||
FRANK_HEAD = 107,
|
FRANK_HEAD = 107,
|
||||||
|
|
||||||
|
ROOM_ENDING_CREDITS = 110,
|
||||||
|
|
||||||
ROOM_JOURNAL = 200 // dummy value to keep Display methods happy
|
ROOM_JOURNAL = 200 // dummy value to keep Display methods happy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,10 +134,8 @@ void Display::dynalumUpdate(int16 x, int16 y) {
|
|||||||
uint8 colMask = _dynalum.mskBuf[offset];
|
uint8 colMask = _dynalum.mskBuf[offset];
|
||||||
debug(9, "Display::dynalumUpdate(%d, %d) - colMask = %d", x, y, colMask);
|
debug(9, "Display::dynalumUpdate(%d, %d) - colMask = %d", x, y, colMask);
|
||||||
if (colMask != _dynalum.prevColMask) {
|
if (colMask != _dynalum.prevColMask) {
|
||||||
uint8 i;
|
for (int i = 144; i < 160; ++i) {
|
||||||
for (i = 144; i < 160; ++i) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
uint8 j;
|
|
||||||
for (j = 0; j < 3; ++j) {
|
|
||||||
int16 c = (int16)(_pal.room[i * 3 + j] + _dynalum.lumBuf[colMask * 3 + j] * 4);
|
int16 c = (int16)(_pal.room[i * 3 + j] + _dynalum.lumBuf[colMask * 3 + j] * 4);
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
c = 0;
|
c = 0;
|
||||||
@ -154,8 +152,7 @@ void Display::dynalumUpdate(int16 x, int16 y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) {
|
void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) {
|
||||||
int i;
|
for (int i = start; i <= end; i++) {
|
||||||
for (i = start; i <= end; i++) {
|
|
||||||
outPal[4 * i + 0] = inPal[3 * i + 0];
|
outPal[4 * i + 0] = inPal[3 * i + 0];
|
||||||
outPal[4 * i + 1] = inPal[3 * i + 1];
|
outPal[4 * i + 1] = inPal[3 * i + 1];
|
||||||
outPal[4 * i + 2] = inPal[3 * i + 2];
|
outPal[4 * i + 2] = inPal[3 * i + 2];
|
||||||
@ -233,13 +230,10 @@ void Display::palFadeOut(uint16 roomNum) {
|
|||||||
|
|
||||||
void Display::palGreyPanel() {
|
void Display::palGreyPanel() {
|
||||||
debug(9, "Display::palGreyPanel()");
|
debug(9, "Display::palGreyPanel()");
|
||||||
int i;
|
|
||||||
uint8 tempPal[256 * 3];
|
uint8 tempPal[256 * 3];
|
||||||
for (i = 224 * 3; i < 256 * 3; i += 3) {
|
for (int i = 224 * 3; i < 256 * 3; i += 3) {
|
||||||
uint8 *p = tempPal + i;
|
tempPal[i] = tempPal[i + 1] = tempPal[i + 2] = _pal.screen[i + 1] * 2 / 3;
|
||||||
*(p) = *(p + 1) = *(p + 2) = _pal.screen[i + 1] * 2 / 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
palSet(tempPal, 224, 255, true);
|
palSet(tempPal, 224, 255, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,19 +499,9 @@ void Display::palCustomScroll(uint16 roomNum) {
|
|||||||
|
|
||||||
void Display::palCustomFlash() {
|
void Display::palCustomFlash() {
|
||||||
uint8 tempPal[256 * 3];
|
uint8 tempPal[256 * 3];
|
||||||
int i = 0;
|
memset(tempPal, 255, 17 * 3);
|
||||||
while (i < 17 * 3) {
|
memset(tempPal + 17 * 3, 0, 67 * 3);
|
||||||
tempPal[i] = 255;
|
memset(tempPal + 67 * 3, 255, 172 * 3);
|
||||||
++i;
|
|
||||||
}
|
|
||||||
while (i < 84 * 3) {
|
|
||||||
tempPal[i] = 0;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
while (i < 256 * 3) {
|
|
||||||
tempPal[i] = 255;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
// set flash palette
|
// set flash palette
|
||||||
palSet(tempPal, 0, 255, true);
|
palSet(tempPal, 0, 255, true);
|
||||||
// restore original palette
|
// restore original palette
|
||||||
@ -622,22 +606,21 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) {
|
|||||||
uint16 count = 0;
|
uint16 count = 0;
|
||||||
uint8 *scrBuf = _screenBuf;
|
uint8 *scrBuf = _screenBuf;
|
||||||
uint8 *dbBuf = _dirtyBlocks;
|
uint8 *dbBuf = _dirtyBlocks;
|
||||||
uint16 i, j, x;
|
for (int j = 0; j < _dirtyBlocksHeight; ++j) {
|
||||||
for (j = 0; j < _dirtyBlocksHeight; ++j) {
|
|
||||||
uint16 accW = 0;
|
uint16 accW = 0;
|
||||||
for (i = 0; i < _dirtyBlocksWidth; ++i) {
|
for (int i = 0; i < _dirtyBlocksWidth; ++i) {
|
||||||
if (dbBuf[i] != 0) {
|
if (dbBuf[i] != 0) {
|
||||||
--dbBuf[i];
|
--dbBuf[i];
|
||||||
++accW;
|
++accW;
|
||||||
} else if (accW != 0) {
|
} else if (accW != 0) {
|
||||||
x = (i - accW) * D_BLOCK_W;
|
int x = (i - accW) * D_BLOCK_W;
|
||||||
_system->copyRectToScreen(scrBuf + x, SCREEN_W, x, j * D_BLOCK_H, accW * D_BLOCK_W, D_BLOCK_H);
|
_system->copyRectToScreen(scrBuf + x, SCREEN_W, x, j * D_BLOCK_H, accW * D_BLOCK_W, D_BLOCK_H);
|
||||||
accW = 0;
|
accW = 0;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (accW != 0) {
|
if (accW != 0) {
|
||||||
x = (_dirtyBlocksWidth - accW) * D_BLOCK_W;
|
int x = (_dirtyBlocksWidth - accW) * D_BLOCK_W;
|
||||||
_system->copyRectToScreen(scrBuf + x, SCREEN_W, x, j * D_BLOCK_H, accW * D_BLOCK_W, D_BLOCK_H);
|
_system->copyRectToScreen(scrBuf + x, SCREEN_W, x, j * D_BLOCK_H, accW * D_BLOCK_W, D_BLOCK_H);
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@ -873,8 +856,7 @@ void Display::setTextCentered(uint16 y, const char *text, bool outlined) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::drawTexts() {
|
void Display::drawTexts() {
|
||||||
int y;
|
for (int y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
|
||||||
for (y = GAME_SCREEN_HEIGHT - 1; y > 0; --y) {
|
|
||||||
const TextSlot *pts = &_texts[y];
|
const TextSlot *pts = &_texts[y];
|
||||||
if (!pts->text.isEmpty()) {
|
if (!pts->text.isEmpty()) {
|
||||||
drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
|
drawText(pts->x, y, pts->color, pts->text.c_str(), pts->outlined);
|
||||||
@ -908,12 +890,11 @@ uint16 Display::textWidth(const char *text, uint16 len) const {
|
|||||||
|
|
||||||
void Display::drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr) {
|
void Display::drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr) {
|
||||||
uint8 *dstBuf = _screenBuf + SCREEN_W * y + x;
|
uint8 *dstBuf = _screenBuf + SCREEN_W * y + x;
|
||||||
uint16 j, i;
|
for (int j = 0; j < 8; ++j) {
|
||||||
for (j = 0; j < 8; ++j) {
|
|
||||||
uint8 *p = dstBuf;
|
uint8 *p = dstBuf;
|
||||||
uint8 c = *chr++;
|
uint8 c = *chr++;
|
||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
for (i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
if (c & 0x80) {
|
if (c & 0x80) {
|
||||||
*p = color;
|
*p = color;
|
||||||
}
|
}
|
||||||
@ -946,7 +927,6 @@ void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool o
|
|||||||
setDirtyBlock(xs - 1, y - 1, x - xs + 2, 8 + 2);
|
setDirtyBlock(xs - 1, y - 1, x - xs + 2, 8 + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
|
void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
|
||||||
uint8 *p = _screenBuf;
|
uint8 *p = _screenBuf;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1146,8 +1146,7 @@ void BamScene::updateCarAnimation() {
|
|||||||
|
|
||||||
if (bdb->sfx == 99) {
|
if (bdb->sfx == 99) {
|
||||||
_lastSoundIndex = _index = 0;
|
_lastSoundIndex = _index = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
++_index;
|
++_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,18 +456,22 @@ const char *Logic::roomName(uint16 roomNum) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *Logic::objectName(uint16 objNum) const {
|
const char *Logic::objectName(uint16 objNum) const {
|
||||||
|
assert(objNum >= 1 && objNum <= _numNames);
|
||||||
return _objName[objNum].c_str();
|
return _objName[objNum].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Logic::objectTextualDescription(uint16 objNum) const {
|
const char *Logic::objectTextualDescription(uint16 objNum) const {
|
||||||
|
assert(objNum >= 1 && objNum <= _numDescriptions);
|
||||||
return _objDescription[objNum].c_str();
|
return _objDescription[objNum].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Logic::joeResponse(int i) const {
|
const char *Logic::joeResponse(int i) const {
|
||||||
|
assert(i >= 1 && i <= JOE_RESPONSE_MAX);
|
||||||
return _joeResponse[i].c_str();
|
return _joeResponse[i].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Logic::verbName(Verb v) const {
|
const char *Logic::verbName(Verb v) const {
|
||||||
|
assert(v >= 0 && v <= 12);
|
||||||
return _verbName[v].c_str();
|
return _verbName[v].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2034,6 +2038,7 @@ void Logic::startCredits(const char *filename) {
|
|||||||
|
|
||||||
void Logic::stopCredits() {
|
void Logic::stopCredits() {
|
||||||
if (_credits) {
|
if (_credits) {
|
||||||
|
_vm->display()->clearTexts(0, 199);
|
||||||
delete _credits;
|
delete _credits;
|
||||||
_credits = NULL;
|
_credits = NULL;
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,6 @@
|
|||||||
|
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
|
|
||||||
extern bool toolbar_drawn;
|
|
||||||
extern bool draw_keyboard;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Flight of the Amazon Queen */
|
/* Flight of the Amazon Queen */
|
||||||
static const GameSettings queen_setting =
|
static const GameSettings queen_setting =
|
||||||
@ -173,7 +167,7 @@ void QueenEngine::update(bool checkPlayerInput) {
|
|||||||
_input->debuggerReset();
|
_input->debuggerReset();
|
||||||
_debugger->attach();
|
_debugger->attach();
|
||||||
}
|
}
|
||||||
if (!_input->cutawayRunning()) {
|
if (canLoadOrSave()) {
|
||||||
if (_input->quickSave()) {
|
if (_input->quickSave()) {
|
||||||
_input->quickSaveReset();
|
_input->quickSaveReset();
|
||||||
saveGameState(0, "Quicksave");
|
saveGameState(0, "Quicksave");
|
||||||
@ -182,10 +176,12 @@ void QueenEngine::update(bool checkPlayerInput) {
|
|||||||
_input->quickLoadReset();
|
_input->quickLoadReset();
|
||||||
loadGameState(0);
|
loadGameState(0);
|
||||||
}
|
}
|
||||||
if (_system->getMillis() - _lastSaveTime > AUTOSAVE_INTERVAL) {
|
if (_system->getMillis() - _lastSaveTime >= AUTOSAVE_INTERVAL) {
|
||||||
saveGameState(AUTOSAVE_SLOT, "Autosave");
|
saveGameState(AUTOSAVE_SLOT, "Autosave");
|
||||||
_lastSaveTime = _system->getMillis();
|
_lastSaveTime = _system->getMillis();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!_input->cutawayRunning()) {
|
||||||
if (checkPlayerInput) {
|
if (checkPlayerInput) {
|
||||||
_command->updatePlayer();
|
_command->updatePlayer();
|
||||||
}
|
}
|
||||||
@ -195,6 +191,10 @@ void QueenEngine::update(bool checkPlayerInput) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueenEngine::canLoadOrSave() {
|
||||||
|
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
||||||
|
}
|
||||||
|
|
||||||
void QueenEngine::saveGameState(uint16 slot, const char *desc) {
|
void QueenEngine::saveGameState(uint16 slot, const char *desc) {
|
||||||
debug(3, "Saving game to slot %d", slot);
|
debug(3, "Saving game to slot %d", slot);
|
||||||
char name[20];
|
char name[20];
|
||||||
@ -245,7 +245,9 @@ void QueenEngine::loadGameState(uint16 slot) {
|
|||||||
_grid->loadState(header.version, p);
|
_grid->loadState(header.version, p);
|
||||||
_logic->loadState(header.version, p);
|
_logic->loadState(header.version, p);
|
||||||
_sound->loadState(header.version, p);
|
_sound->loadState(header.version, p);
|
||||||
assert(header.dataSize == (uint32)(p - saveData));
|
if (header.dataSize != (uint32)(p - saveData)) {
|
||||||
|
error("Corrupted savegame file");
|
||||||
|
}
|
||||||
_logic->setupRestoredGame();
|
_logic->setupRestoredGame();
|
||||||
}
|
}
|
||||||
delete[] saveData;
|
delete[] saveData;
|
||||||
@ -298,13 +300,12 @@ void QueenEngine::errorString(const char *buf1, char *buf2) {
|
|||||||
|
|
||||||
int QueenEngine::go() {
|
int QueenEngine::go() {
|
||||||
_logic->start();
|
_logic->start();
|
||||||
if (ConfMan.hasKey("save_slot") && !(_resource->isDemo() || _resource->isInterview())) {
|
if (ConfMan.hasKey("save_slot") && canLoadOrSave()) {
|
||||||
loadGameState(ConfMan.getInt("save_slot"));
|
loadGameState(ConfMan.getInt("save_slot"));
|
||||||
}
|
}
|
||||||
_lastSaveTime = _system->getMillis();
|
_lastSaveTime = _system->getMillis();
|
||||||
_quit = false;
|
_quit = false;
|
||||||
while (!_quit) {
|
while (!_quit) {
|
||||||
// queen.c lines 4080-4104
|
|
||||||
if (_logic->newRoom() > 0) {
|
if (_logic->newRoom() > 0) {
|
||||||
_logic->update();
|
_logic->update();
|
||||||
_logic->oldRoom(_logic->currentRoom());
|
_logic->oldRoom(_logic->currentRoom());
|
||||||
|
@ -108,6 +108,7 @@ public:
|
|||||||
|
|
||||||
void update(bool checkPlayerInput = false);
|
void update(bool checkPlayerInput = false);
|
||||||
|
|
||||||
|
bool canLoadOrSave();
|
||||||
void saveGameState(uint16 slot, const char *desc);
|
void saveGameState(uint16 slot, const char *desc);
|
||||||
void loadGameState(uint16 slot);
|
void loadGameState(uint16 slot);
|
||||||
void makeGameStateName(uint16 slot, char *buf);
|
void makeGameStateName(uint16 slot, char *buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user