svn-id: r15396
This commit is contained in:
Gregory Montoir 2004-10-03 20:14:55 +00:00
parent 247d5724f5
commit f94cc6b198
7 changed files with 54 additions and 70 deletions

View File

@ -55,7 +55,7 @@ void BankManager::load(const char *bankname, uint32 bankslot) {
debug(9, "BankManager::load() entries = %d", entries);
uint32 offset = 2;
uint8 *p = _banks[bankslot].data;
const uint8 *p = _banks[bankslot].data;
for (uint16 i = 1; i <= entries; ++i) {
_banks[bankslot].indexes[i] = offset;
uint16 w = READ_LE_UINT16(p + offset + 0);
@ -74,7 +74,7 @@ void BankManager::unpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {
assert(_banks[bankslot].data != NULL);
BobFrame *pbf = &_frames[dstframe];
uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe];
const uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe];
pbf->width = READ_LE_UINT16(p + 0);
pbf->height = READ_LE_UINT16(p + 2);
pbf->xhotspot = READ_LE_UINT16(p + 4);
@ -91,7 +91,7 @@ void BankManager::overpack(uint32 srcframe, uint32 dstframe, uint32 bankslot) {
assert(bankslot < MAX_BANKS_NUMBER);
assert(_banks[bankslot].data != NULL);
uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe];
const uint8 *p = _banks[bankslot].data + _banks[bankslot].indexes[srcframe];
uint16 src_w = READ_LE_UINT16(p + 0);
uint16 src_h = READ_LE_UINT16(p + 2);
@ -135,7 +135,7 @@ void BankManager::eraseFrame(uint32 index) {
}
void BankManager::eraseFrames(bool joe) {
uint32 i = 0;
uint32 i = 0;
if (!joe) {
i = FRAMES_JOE + FRAMES_JOE_XTRA;
}

View File

@ -30,7 +30,6 @@
#include "queen/queen.h"
#include "queen/sound.h"
#include "queen/state.h"
#include "queen/talk.h"
#include "queen/walk.h"
namespace Queen {

View File

@ -575,13 +575,14 @@ void Display::screenMode(int comPanel, bool inCutaway) {
}
void Display::prepareUpdate() {
if (!_fullscreen)
int h = GAME_SCREEN_HEIGHT;
if (!_fullscreen) {
h = ROOM_ZONE_HEIGHT;
memcpy(_screenBuf + SCREEN_W * ROOM_ZONE_HEIGHT, _panelBuf, PANEL_W * PANEL_H);
int i;
int n = _fullscreen ? 200 : 150;
}
uint8 *dst = _screenBuf;
uint8 *src = _backdropBuf + _horizontalScroll;
for (i = 0; i < n; ++i) {
const uint8 *src = _backdropBuf + _horizontalScroll;
while (h--) {
memcpy(dst, src, SCREEN_W);
dst += SCREEN_W;
src += BACKDROP_W;
@ -598,6 +599,7 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) {
_pal.dirtyMin = 144;
_pal.dirtyMax = 144;
}
// uncomment this line to disable the dirty blocks rendering
// _fullRefresh = 1;
if (_fullRefresh) {
_system->copyRectToScreen(_screenBuf, SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
@ -639,7 +641,7 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) {
void Display::setupPanel() {
uint32 size;
uint8 *pcxBuf = _vm->resource()->loadFile("panel.pcx", 0, &size);
const uint8 *pcxBuf = _vm->resource()->loadFile("panel.pcx", 0, &size);
uint8 *dst = _panelBuf + PANEL_W * 10;
readPCX(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
const uint8 *pal = pcxBuf + size - 768 + 144 * 3;
@ -695,8 +697,7 @@ void Display::blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uin
}
} else if (!xflip) { // Masked bitmap unflipped
while (h--) {
int i;
for(i = 0; i < w; ++i) {
for(int i = 0; i < w; ++i) {
uint8 b = *(srcBuf + i);
if(b != 0) {
*(dstBuf + i) = b;
@ -707,8 +708,7 @@ void Display::blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uin
}
} else { // Masked bitmap flipped
while (h--) {
int i;
for(i = 0; i < w; ++i) {
for(int i = 0; i < w; ++i) {
uint8 b = *(srcBuf + i);
if(b != 0) {
*(dstBuf - i) = b;
@ -798,13 +798,11 @@ void Display::showMouseCursor(bool show) {
void Display::initFont() {
// calculate font justification sizes
uint16 i, y, x;
for (i = 0; i < 256; ++i) {
for (int i = 0; i < 256; ++i) {
_charWidth[i] = 0;
for (y = 0; y < 8; ++y) {
for (int y = 0; y < 8; ++y) {
uint8 c = _font[i * 8 + y];
for (x = 0; x < 8; ++x) {
for (int x = 0; x < 8; ++x) {
if ((c & (0x80 >> x)) && (x > _charWidth[i])) {
_charWidth[i] = x;
}
@ -898,6 +896,8 @@ void Display::drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr) {
}
void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
static const int dx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
static const int dy[] = { -1, -1, -1, 0, 1, 1, 1, 0 };
const uint8 *str = (const uint8*)text;
uint16 xs = x;
while (*str && x < SCREEN_W) {
@ -905,10 +905,8 @@ void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool o
const uint8 *pchr = _font + c * 8;
if (outlined) {
const int xOff[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int yOff[] = { -1, -1, -1, 0, 1, 1, 1, 0 };
for (int i = 0; i < 8; ++i) {
drawChar(x + xOff[i], y + yOff[i], INK_OUTLINED_TEXT, pchr);
drawChar(x + dx[i], y + dy[i], INK_OUTLINED_TEXT, pchr);
}
}
drawChar(x, y, color, pchr);
@ -997,7 +995,7 @@ void Display::blankScreenEffect2() {
p += SCREEN_W;
}
_system->copyRectToScreen(buf, SCREEN_W, x, y, 2, 2);
_system->updateScreen();
_system->updateScreen();
_vm->input()->delay(10);
}
}
@ -1026,7 +1024,7 @@ void Display::blankScreenEffect3() {
++i;
_system->copyRectToScreen(buf, SCREEN_W, x, y, 2, 2);
}
_system->updateScreen();
_system->updateScreen();
_vm->input()->delay(10);
}
}

View File

@ -1151,6 +1151,11 @@ void BamScene::updateCarAnimation() {
}
void BamScene::updateFightAnimation() {
static const BamDataBlock *fightDataBlocks[] = {
_fight1Data,
_fight2Data,
_fight3Data
};
if (_flag != F_STOP) {
const BamDataBlock *bdb = &_fightData[_index];
@ -1195,12 +1200,7 @@ void BamScene::updateFightAnimation() {
break;
case 99: // end of BAM data
_lastSoundIndex = _index = 0;
const BamDataBlock *data[] = {
_fight1Data,
_fight2Data,
_fight3Data
};
_fightData = data[_vm->randomizer.getRandomNumber(2)];
_fightData = fightDataBlocks[_vm->randomizer.getRandomNumber(2)];
if (_flag == F_REQ_STOP) {
_flag = F_STOP;
}

View File

@ -187,7 +187,7 @@ void Journal::drawSaveDescriptions() {
_vm->display()->setText(136, y, _saveDescriptions[n], false);
_vm->display()->setText(109, y + 1, nb, false);
}
// hightlight current page
// highlight current page
showBob(BOB_SAVE_PAGE, 300, 3 + _currentSavePage * 15, 6 + _currentSavePage);
}
@ -220,8 +220,7 @@ void Journal::handleNormalMode(int16 zoneNum, int x) {
_quit = true;
} else if (zoneNum == ZN_GIVEUP) {
enterYesNoMode(zoneNum, TXT_GIVE_UP);
}
if (zoneNum == ZN_TEXT_SPEED) {
} else if (zoneNum == ZN_TEXT_SPEED) {
_vm->talkSpeed((x - 136) * 100 / 130);
drawConfigPanel();
} else if (zoneNum == ZN_SFX_TOGGLE) {
@ -389,14 +388,14 @@ void Journal::drawPanel(const int *frames, const int *titles, int n) {
}
void Journal::drawNormalPanel() {
int frames[] = { FRAME_BLUE_1, FRAME_BLUE_2, FRAME_BLUE_1, FRAME_ORANGE };
int titles[] = { TXT_REVIEW_ENTRY, TXT_MAKE_ENTRY, TXT_CLOSE, TXT_GIVE_UP };
static const int frames[] = { FRAME_BLUE_1, FRAME_BLUE_2, FRAME_BLUE_1, FRAME_ORANGE };
static const int titles[] = { TXT_REVIEW_ENTRY, TXT_MAKE_ENTRY, TXT_CLOSE, TXT_GIVE_UP };
drawPanel(frames, titles, 4);
}
void Journal::drawYesNoPanel(int titleNum) {
int frames[] = { FRAME_GREY, FRAME_BLUE_1, FRAME_BLUE_2 };
int titles[] = { titleNum, TXT_YES, TXT_NO };
static const int frames[] = { FRAME_GREY, FRAME_BLUE_1, FRAME_BLUE_2 };
static const int titles[] = { titleNum, TXT_YES, TXT_NO };
drawPanel(frames, titles, 3);
hideBob(BOB_LEFT_RECT_4);

View File

@ -835,14 +835,22 @@ void Logic::makePersonSpeak(const char *sentence, Person *person, const char *vo
}
void Logic::startDialogue(const char *dlgFile, int personInRoom, char *cutaway) {
char cutawayFile[20];
if (cutaway == NULL) {
cutaway = cutawayFile;
}
_vm->display()->fullscreen(true);
Talk::talk(dlgFile, personInRoom, cutaway, _vm);
if (!cutaway[0]) {
_vm->display()->fullscreen(false);
ObjectData *data = objectData(_roomData[_currentRoom] + personInRoom);
if (data->name > 0 && data->entryObj <= 0) {
if (State::findTalk(data->state) == STATE_TALK_MUTE) {
// 'I can't talk to that'
makeJoeSpeak(24 + _vm->randomizer.getRandomNumber(2));
} else {
char cutawayFile[20];
if (cutaway == NULL) {
cutaway = cutawayFile;
}
_vm->display()->fullscreen(true);
Talk::talk(dlgFile, personInRoom, cutaway, _vm);
if (!cutaway[0]) {
_vm->display()->fullscreen(false);
}
}
}
}

View File

@ -85,21 +85,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
cutawayFilename[0] = '\0';
int roomStart = _vm->logic()->currentRoomData();
ObjectData *data = _vm->logic()->objectData(roomStart + personInRoom);
if (data->name <= 0) // disabled!
return;
if (data->entryObj > 0)
return;
if (State::findTalk(data->state) == STATE_TALK_MUTE) {
// 'I can't talk to that'
_vm->logic()->makeJoeSpeak(24 + _vm->randomizer.getRandomNumber(2));
return;
}
load(filename);
Person person;
@ -770,16 +755,13 @@ void Talk::defaultAnimation(
_vm->update();
}
if (_vm->input()->talkQuit())
break;
if (_vm->logic()->joeWalk() == JWM_SPEAK) {
if (_vm->input()->talkQuit())
break;
_vm->update();
}
else {
if (_vm->input()->talkQuit())
break;
_vm->update(true);
if (_vm->logic()->joeWalk() == JWM_EXECUTE)
// Selected a command, so exit
@ -828,9 +810,7 @@ void Talk::speakSegment(
switch (command) {
case SPEAK_PAUSE:
for (i = 0; i < 10; i++) {
if (_vm->input()->talkQuit())
break;
for (i = 0; i < 10 && !_vm->input()->talkQuit(); i++) {
_vm->update();
}
return;