mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
ACCESS: More implementation of CharManager
This commit is contained in:
+11
-14
@@ -62,7 +62,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_startup = 0;
|
||||
_currentCharFlag = false;
|
||||
_boxSelect = false;
|
||||
_charFlag = 0;
|
||||
_scale = 0;
|
||||
_scaleH1 = _scaleH2 = 0;
|
||||
_scaleN1 = 0;
|
||||
@@ -78,7 +77,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_intTim[3] = 0;
|
||||
_timer[3] = 0;
|
||||
Common::fill(&_objectsTable[0], &_objectsTable[100], (SpriteResource *)nullptr);
|
||||
Common::fill(&_establishTable[0], &_establishTable[100], 0);
|
||||
Common::fill(&_establishTable[0], &_establishTable[100], false);
|
||||
Common::fill(&_flags[0], &_flags[256], 0);
|
||||
_establishFlag = false;
|
||||
_establishMode = 0;
|
||||
@@ -220,15 +219,15 @@ void AccessEngine::freeInactiveData() {
|
||||
_inactive = nullptr;
|
||||
}
|
||||
|
||||
void AccessEngine::establish(int v1, int sub) {
|
||||
void AccessEngine::establish(int esatabIndex, int sub) {
|
||||
_establishMode = 0;
|
||||
_establishGroup = 0;
|
||||
doEstablish(v1, sub);
|
||||
doEstablish(esatabIndex, sub);
|
||||
}
|
||||
|
||||
void AccessEngine::establishCenter(int v1, int sub) {
|
||||
void AccessEngine::establishCenter(int esatabIndex, int sub) {
|
||||
_establishMode = 1;
|
||||
doEstablish(v1, sub);
|
||||
doEstablish(esatabIndex, sub);
|
||||
}
|
||||
|
||||
byte *AccessEngine::loadEstablish(int sub) {
|
||||
@@ -236,17 +235,19 @@ byte *AccessEngine::loadEstablish(int sub) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AccessEngine::doEstablish(int v1, int sub) {
|
||||
void AccessEngine::doEstablish(int esatabIndex, int sub) {
|
||||
_establishMode = 1;
|
||||
|
||||
_screen->forceFadeOut();
|
||||
_screen->clearScreen();
|
||||
_screen->setPanel(3);
|
||||
|
||||
if (v1 != -1) {
|
||||
_files->loadScreen(95, v1);
|
||||
if (esatabIndex != -1) {
|
||||
_files->loadScreen(95, esatabIndex);
|
||||
_buffer2.copyBuffer(_screen);
|
||||
}
|
||||
|
||||
_room->setIconPalette();
|
||||
_screen->setIconPalette();
|
||||
_screen->forceFadeIn();
|
||||
|
||||
_fonts._charSet._lo = 1;
|
||||
@@ -374,8 +375,4 @@ void AccessEngine::freeChar() {
|
||||
_animation->freeAnimationData();
|
||||
}
|
||||
|
||||
void AccessEngine::loadChar(int charId) {
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
|
||||
void dummyLoop();
|
||||
|
||||
void doEstablish(int v1, int sub);
|
||||
void doEstablish(int esatabIndex, int sub);
|
||||
protected:
|
||||
const AccessGameDescription *_gameDescription;
|
||||
Common::RandomSource _randomSource;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
ASurface _buffer2;
|
||||
Common::Array<CharEntry *> _charTable;
|
||||
SpriteResource *_objectsTable[100];
|
||||
int _establishTable[100];
|
||||
bool _establishTable[100];
|
||||
bool _establishFlag;
|
||||
int _establishMode;
|
||||
int _establishGroup;
|
||||
@@ -150,7 +150,6 @@ public:
|
||||
int _startTravelBox;
|
||||
bool _currentCharFlag;
|
||||
bool _boxSelect;
|
||||
int _charFlag;
|
||||
int _scale;
|
||||
int _scaleH1, _scaleH2;
|
||||
int _scaleN1;
|
||||
@@ -221,9 +220,9 @@ public:
|
||||
|
||||
byte *AccessEngine::loadEstablish(int sub);
|
||||
|
||||
void establish(int v1, int sub);
|
||||
void establish(int esatabIndex, int sub);
|
||||
|
||||
void establishCenter(int v1, int sub);
|
||||
void establishCenter(int esatabIndex, int sub);
|
||||
|
||||
void plotList();
|
||||
void plotList1();
|
||||
@@ -239,8 +238,6 @@ public:
|
||||
void doLoadSave();
|
||||
|
||||
void freeChar();
|
||||
|
||||
void loadChar(int charId);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
+65
-2
@@ -31,7 +31,7 @@ CharEntry::CharEntry(const byte *data) {
|
||||
Common::MemoryReadStream s(data, 999);
|
||||
|
||||
_charFlag = s.readByte();
|
||||
_estabFlag = s.readSint16LE();
|
||||
_estabIndex = s.readSint16LE();
|
||||
_screenFile._fileNum = s.readSint16LE();
|
||||
_screenFile._subfile = s.readSint16LE();
|
||||
|
||||
@@ -68,7 +68,7 @@ CharEntry::CharEntry(const byte *data) {
|
||||
|
||||
CharEntry::CharEntry() {
|
||||
_charFlag = 0;
|
||||
_estabFlag = 0;
|
||||
_estabIndex = 0;
|
||||
_startColor = _numColors = 0;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,69 @@ CharManager::CharManager(AccessEngine *vm) : Manager(vm) {
|
||||
default:
|
||||
error("Unknown game");
|
||||
}
|
||||
|
||||
_charFlag = 0;
|
||||
}
|
||||
|
||||
void CharManager::loadChar(int charId) {
|
||||
CharEntry &ce = _charTable[charId];
|
||||
_charFlag = ce._charFlag;
|
||||
|
||||
_vm->_establishFlag = false;
|
||||
if (ce._estabIndex != -1) {
|
||||
_vm->_establishFlag = true;
|
||||
if (!_vm->_establishTable[ce._estabIndex]) {
|
||||
_vm->_establishTable[ce._estabIndex] = true;
|
||||
_vm->establish(ce._estabIndex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (_charFlag != 0 && _charFlag != 3) {
|
||||
if (!_vm->_establishFlag)
|
||||
_vm->_screen->fadeOut();
|
||||
|
||||
_vm->_files->loadScreen(ce._screenFile._fileNum, ce._screenFile._subfile);
|
||||
_vm->_screen->setIconPalette();
|
||||
_vm->_screen->fadeIn();
|
||||
}
|
||||
|
||||
_vm->_buffer1.copyFrom(*_vm->_screen);
|
||||
_vm->_screen->copyFrom(_vm->_buffer2);
|
||||
_vm->_screen->setDisplayScan();
|
||||
|
||||
if (_charFlag != 2 && _charFlag != 3) {
|
||||
charMenu();
|
||||
}
|
||||
|
||||
_vm->_screen->_startColor = ce._startColor;
|
||||
_vm->_screen->_numColors = ce._numColors;
|
||||
if (ce._paletteFile._fileNum != -1) {
|
||||
_vm->_screen->loadPalette(ce._paletteFile._fileNum, ce._paletteFile._subfile);
|
||||
}
|
||||
_vm->_screen->setIconPalette();
|
||||
_vm->_screen->setPalette();
|
||||
|
||||
_vm->loadCells(ce._cells);
|
||||
if (ce._animFile._fileNum != -1) {
|
||||
byte *data = _vm->_files->loadFile(ce._animFile._fileNum, ce._animFile._subfile);
|
||||
_vm->_animation->loadAnimations(data, _vm->_files->_filesize);
|
||||
}
|
||||
|
||||
// Load script data
|
||||
_vm->_scripts->freeScriptData();
|
||||
if (ce._scriptFile._fileNum != -1) {
|
||||
const byte *data = _vm->_files->loadFile(ce._scriptFile._fileNum, ce._scriptFile._subfile);
|
||||
_vm->_scripts->setScript(data, _vm->_files->_filesize);
|
||||
}
|
||||
|
||||
// Load extra cells
|
||||
_vm->_extraCells.clear();
|
||||
for (uint i = 0; i < ce._extraCells.size(); ++i)
|
||||
_vm->_extraCells.push_back(ce._extraCells[i]);
|
||||
}
|
||||
|
||||
void CharManager::charMenu() {
|
||||
error("TODO: charMenu");
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
+10
-1
@@ -32,7 +32,7 @@ namespace Access {
|
||||
class CharEntry {
|
||||
public:
|
||||
int _charFlag;
|
||||
int _estabFlag;
|
||||
int _estabIndex;
|
||||
FileIdent _screenFile;
|
||||
FileIdent _paletteFile;
|
||||
int _startColor, _numColors;
|
||||
@@ -47,10 +47,19 @@ public:
|
||||
};
|
||||
|
||||
class CharManager: public Manager {
|
||||
private:
|
||||
void charMenu();
|
||||
public:
|
||||
Common::Array<CharEntry> _charTable;
|
||||
int _converseMode;
|
||||
int _charFlag;
|
||||
|
||||
// Fields that are included in savegames
|
||||
int _conversation;
|
||||
public:
|
||||
CharManager(AccessEngine *vm);
|
||||
|
||||
void loadChar(int charId);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
+19
-18
@@ -241,39 +241,40 @@ void Room::roomLoop() {
|
||||
}
|
||||
|
||||
void Room::setupRoom() {
|
||||
_vm->_screen->setScaleTable(_vm->_scale);
|
||||
_vm->_screen->setBufferScan();
|
||||
Screen &screen = *_vm->_screen;
|
||||
screen.setScaleTable(_vm->_scale);
|
||||
screen.setBufferScan();
|
||||
|
||||
if (_roomFlag != 2)
|
||||
setIconPalette();
|
||||
screen.setIconPalette();
|
||||
|
||||
if (_vm->_screen->_vWindowWidth == _playFieldWidth) {
|
||||
_vm->_screen->_scrollX = 0;
|
||||
_vm->_screen->_scrollCol = 0;
|
||||
if (screen._vWindowWidth == _playFieldWidth) {
|
||||
screen._scrollX = 0;
|
||||
screen._scrollCol = 0;
|
||||
} else {
|
||||
int xv = _vm->_player->_rawPlayer.x / TILE_WIDTH;
|
||||
_vm->_screen->_scrollX = _vm->_player->_rawPlayer.x % TILE_WIDTH;
|
||||
_vm->_screen->_scrollCol = MAX(xv - (_vm->_screen->_vWindowWidth / 2), 0);
|
||||
screen._scrollX = _vm->_player->_rawPlayer.x % TILE_WIDTH;
|
||||
screen._scrollCol = MAX(xv - (screen._vWindowWidth / 2), 0);
|
||||
|
||||
int sx = _vm->_screen->_scrollCol + _vm->_screen->_vWindowWidth - _playFieldWidth;
|
||||
int sx = screen._scrollCol + screen._vWindowWidth - _playFieldWidth;
|
||||
if (sx >= 0) {
|
||||
_vm->_screen->_scrollCol -= sx + 1;
|
||||
screen._scrollCol -= sx + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (_vm->_screen->_vWindowHeight == _playFieldHeight) {
|
||||
_vm->_screen->_scrollY = 0;
|
||||
_vm->_screen->_scrollRow = 0;
|
||||
if (screen._vWindowHeight == _playFieldHeight) {
|
||||
screen._scrollY = 0;
|
||||
screen._scrollRow = 0;
|
||||
} else {
|
||||
_vm->_screen->_scrollY = _vm->_player->_rawPlayer.y -
|
||||
screen._scrollY = _vm->_player->_rawPlayer.y -
|
||||
(_vm->_player->_rawPlayer.y >> 4);
|
||||
int yp = MAX((_vm->_player->_rawPlayer.y >> 4) -
|
||||
(_vm->_screen->_vWindowHeight / 2), 0);
|
||||
_vm->_screen->_scrollRow = yp;
|
||||
(screen._vWindowHeight / 2), 0);
|
||||
screen._scrollRow = yp;
|
||||
|
||||
yp = yp + _vm->_screen->_vWindowHeight - _playFieldHeight;
|
||||
yp = yp + screen._vWindowHeight - _playFieldHeight;
|
||||
if (yp >= 0) {
|
||||
_vm->_screen->_scrollRow = yp + 1;
|
||||
screen._scrollRow = yp + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +116,6 @@ protected:
|
||||
virtual void roomMenu() = 0;
|
||||
|
||||
virtual void mainAreaClick() = 0;
|
||||
public:
|
||||
virtual void setIconPalette() {}
|
||||
public:
|
||||
Plotter _plotter;
|
||||
Common::Array<JetFrame> _jetFrame;
|
||||
|
||||
@@ -114,6 +114,11 @@ public:
|
||||
*/
|
||||
void setInitialPalettte();
|
||||
|
||||
/**
|
||||
* Set icon palette
|
||||
*/
|
||||
void setIconPalette() {}
|
||||
|
||||
void loadPalette(Common::SeekableReadStream *stream);
|
||||
|
||||
void loadPalette(int fileNum, int subfile);
|
||||
|
||||
@@ -313,7 +313,7 @@ void Scripts::cmdConverse() {
|
||||
_vm->_conversation = _data->readUint16LE();
|
||||
_vm->_room->clearRoom();
|
||||
_vm->freeChar();
|
||||
_vm->loadChar(_vm->_conversation);
|
||||
_vm->_char->loadChar(_vm->_conversation);
|
||||
_vm->_events->setCursor(CURSOR_ARROW);
|
||||
|
||||
_vm->_images.clear();
|
||||
|
||||
Reference in New Issue
Block a user