mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-19 08:06:42 +00:00
HOPKINS:Move some variables from globals to ObjectManager
This commit is contained in:
parent
d12cd96161
commit
a836676312
@ -116,14 +116,11 @@ Globals::Globals() {
|
||||
NUM_FICHIER_OBJ = 0;
|
||||
nbrligne = 0;
|
||||
_boxWidth = 0;
|
||||
_forestFl = false;
|
||||
_objectWidth = _objectHeight = 0;
|
||||
_helicopterFl = false;
|
||||
_catalogPos = 0;
|
||||
_catalogSize = 0;
|
||||
iRegul = 0;
|
||||
_exitId = 0;
|
||||
_mapCarPosX = _mapCarPosY = 0;
|
||||
PERSO = 0;
|
||||
_screenId = 0;
|
||||
_prevScreenId = 0;
|
||||
@ -163,7 +160,6 @@ Globals::Globals() {
|
||||
_saveData = NULL;
|
||||
GESTE = NULL;
|
||||
_inventoryObject = NULL;
|
||||
_forestSprite = NULL;
|
||||
_answerBuffer = g_PTRNUL;
|
||||
ADR_FICHIER_OBJ = NULL;
|
||||
PERSO = NULL;
|
||||
@ -204,7 +200,6 @@ Globals::~Globals() {
|
||||
freeMemory((byte *)_saveData);
|
||||
freeMemory(GESTE);
|
||||
freeMemory(_inventoryObject);
|
||||
freeMemory(_forestSprite);
|
||||
freeMemory(_answerBuffer);
|
||||
freeMemory(ADR_FICHIER_OBJ);
|
||||
freeMemory(PERSO);
|
||||
@ -283,6 +278,7 @@ void Globals::clearAll() {
|
||||
}
|
||||
|
||||
_vm->_linesManager.clearAll();
|
||||
_vm->_objectsManager.clearAll();
|
||||
|
||||
_saveData = (Sauvegarde *)malloc(sizeof(Sauvegarde));
|
||||
memset(_saveData, 0, sizeof(Sauvegarde));
|
||||
@ -293,8 +289,6 @@ void Globals::clearAll() {
|
||||
_inventoryObject = allocMemory(2500);
|
||||
|
||||
ADR_FICHIER_OBJ = g_PTRNUL;
|
||||
_forestSprite = g_PTRNUL;
|
||||
_forestFl = false;
|
||||
|
||||
GESTE = g_PTRNUL;
|
||||
GESTE_FLAG = 0;
|
||||
|
@ -282,8 +282,6 @@ public:
|
||||
bool _cityMapEnabledFl;
|
||||
bool _linuxEndDemoFl;
|
||||
bool _censorshipFl;
|
||||
bool _helicopterFl;
|
||||
bool _forestFl;
|
||||
bool _introSpeechOffFl;
|
||||
bool _cacheFl;
|
||||
bool _forceHideText;
|
||||
@ -299,7 +297,6 @@ public:
|
||||
int _screenId;
|
||||
int _prevScreenId;
|
||||
int _boxWidth;
|
||||
int _mapCarPosX, _mapCarPosY;
|
||||
int _characterMaxPosY;
|
||||
int _baseMapColor;
|
||||
int _spriteSize[500];
|
||||
@ -307,7 +304,6 @@ public:
|
||||
int _oldMouseZoneId;
|
||||
int _oldMouseX, _oldMouseY;
|
||||
uint _speed;
|
||||
byte *_forestSprite;
|
||||
byte *_answerBuffer;
|
||||
Sauvegarde *_saveData;
|
||||
Language _language;
|
||||
|
@ -117,8 +117,8 @@ bool HopkinsEngine::runWin95Demo() {
|
||||
_globals.loadObjects();
|
||||
_objectsManager.changeObject(14);
|
||||
_objectsManager.addObject(14);
|
||||
_objectsManager._helicopterFl = false;
|
||||
|
||||
_globals._helicopterFl = false;
|
||||
_globals.iRegul = 1;
|
||||
|
||||
_graphicsManager.lockScreen();
|
||||
@ -162,7 +162,7 @@ bool HopkinsEngine::runWin95Demo() {
|
||||
_globals.iRegul = 1;
|
||||
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
|
||||
_globals.PERSO_TYPE = 0;
|
||||
_globals._mapCarPosX = _globals._mapCarPosY = 0;
|
||||
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
|
||||
memset(_globals._saveData, 0, 2000);
|
||||
_globals._exitId = 0;
|
||||
|
||||
@ -428,8 +428,8 @@ bool HopkinsEngine::runLinuxDemo() {
|
||||
_globals.loadObjects();
|
||||
_objectsManager.changeObject(14);
|
||||
_objectsManager.addObject(14);
|
||||
_objectsManager._helicopterFl = false;
|
||||
|
||||
_globals._helicopterFl = false;
|
||||
_eventsManager.mouseOff();
|
||||
|
||||
_graphicsManager.lockScreen();
|
||||
@ -452,7 +452,7 @@ bool HopkinsEngine::runLinuxDemo() {
|
||||
_globals.iRegul = 0;
|
||||
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
|
||||
_globals.PERSO_TYPE = 0;
|
||||
_globals._mapCarPosX = _globals._mapCarPosY = 0;
|
||||
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
|
||||
memset(_globals._saveData, 0, 2000);
|
||||
_globals._exitId = 0;
|
||||
|
||||
@ -755,12 +755,12 @@ bool HopkinsEngine::runFull() {
|
||||
_objectsManager.addObject(14);
|
||||
|
||||
if (getPlatform() == Common::kPlatformLinux) {
|
||||
_globals._helicopterFl = false;
|
||||
_objectsManager._helicopterFl = false;
|
||||
_eventsManager.mouseOff();
|
||||
// No code has been added to display the version as it's wrong
|
||||
// in my copy: it mentions a Win95 version v4 using DirectDraw (Strangerke)
|
||||
} else if (getPlatform() == Common::kPlatformWindows) {
|
||||
_globals._helicopterFl = false;
|
||||
_objectsManager._helicopterFl = false;
|
||||
_globals.iRegul = 1;
|
||||
// This code displays the game version.
|
||||
// It wasn't present in the original and could be put in the debugger
|
||||
@ -811,7 +811,7 @@ bool HopkinsEngine::runFull() {
|
||||
_globals.iRegul = 0;
|
||||
_globals.PERSO = _fileManager.loadFile("PERSO.SPR");
|
||||
_globals.PERSO_TYPE = 0;
|
||||
_globals._mapCarPosX = _globals._mapCarPosY = 0;
|
||||
_objectsManager._mapCarPosX = _objectsManager._mapCarPosY = 0;
|
||||
memset(_globals._saveData, 0, 2000);
|
||||
|
||||
_globals._exitId = 0;
|
||||
@ -1142,17 +1142,17 @@ bool HopkinsEngine::runFull() {
|
||||
_linesManager.setMaxLineIdx(40);
|
||||
_globals._characterMaxPosY = 435;
|
||||
_globals._disableInventFl = false;
|
||||
_globals._forestFl = true;
|
||||
_objectsManager._forestFl = true;
|
||||
Common::String im = Common::String::format("IM%d", _globals._exitId);
|
||||
_soundManager.WSOUND(13);
|
||||
if (_globals._forestSprite == g_PTRNUL) {
|
||||
_globals._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR");
|
||||
if (_objectsManager._forestSprite == g_PTRNUL) {
|
||||
_objectsManager._forestSprite = _objectsManager.loadSprite("HOPDEG.SPR");
|
||||
_soundManager.loadSample(1, "SOUND41.WAV");
|
||||
}
|
||||
_objectsManager.PERSONAGE2(im, im, "BANDIT", im, 13, false);
|
||||
if (_globals._exitId < 35 || _globals._exitId > 49) {
|
||||
_globals._forestSprite = _globals.freeMemory(_globals._forestSprite);
|
||||
_globals._forestFl = false;
|
||||
_objectsManager._forestSprite = _globals.freeMemory(_objectsManager._forestSprite);
|
||||
_objectsManager._forestFl = false;
|
||||
_soundManager.DEL_SAMPLE(1);
|
||||
}
|
||||
break;
|
||||
@ -1956,7 +1956,7 @@ void HopkinsEngine::restoreSystem() {
|
||||
void HopkinsEngine::endLinuxDemo() {
|
||||
_globals._linuxEndDemoFl = true;
|
||||
_graphicsManager.RESET_SEGMENT_VESA();
|
||||
_globals._forestFl = false;
|
||||
_objectsManager._forestFl = false;
|
||||
_eventsManager._breakoutFl = false;
|
||||
_globals._disableInventFl = true;
|
||||
_graphicsManager.loadImage("BOX");
|
||||
@ -2832,7 +2832,7 @@ bool HopkinsEngine::displayAdultDisclaimer() {
|
||||
_graphicsManager._maxX = SCREEN_WIDTH;
|
||||
_graphicsManager._maxY = SCREEN_HEIGHT - 1;
|
||||
_eventsManager._breakoutFl = false;
|
||||
_globals._forestFl = false;
|
||||
_objectsManager._forestFl = false;
|
||||
_globals._disableInventFl = true;
|
||||
_globals._exitId = 0;
|
||||
|
||||
|
@ -53,7 +53,7 @@ int MenuManager::menu() {
|
||||
|
||||
result = 0;
|
||||
while (!g_system->getEventManager()->shouldQuit()) {
|
||||
_vm->_globals._forestFl = false;
|
||||
_vm->_objectsManager._forestFl = false;
|
||||
_vm->_eventsManager._breakoutFl = false;
|
||||
_vm->_globals._disableInventFl = true;
|
||||
_vm->_globals._exitId = 0;
|
||||
|
@ -38,6 +38,7 @@ ObjectsManager::ObjectsManager() {
|
||||
Common::fill((byte *)&_sprite[i], (byte *)&_sprite[i] + sizeof(SpriteItem), 0);
|
||||
}
|
||||
|
||||
_helicopterFl = false;
|
||||
_priorityFl = false;
|
||||
_oldBorderPos = Common::Point(0, 0);
|
||||
_oldBorderSpriteIndex = 0;
|
||||
@ -70,12 +71,24 @@ ObjectsManager::ObjectsManager() {
|
||||
_oldSpriteIndex = 0;
|
||||
_oldFlipFl = false;
|
||||
_curObjectIndex = 0;
|
||||
_forestFl = false;
|
||||
_mapCarPosX = _mapCarPosY = 0;
|
||||
_forestSprite = NULL;
|
||||
}
|
||||
|
||||
ObjectsManager::~ObjectsManager() {
|
||||
_vm->_globals.freeMemory(_forestSprite);
|
||||
}
|
||||
|
||||
void ObjectsManager::setParent(HopkinsEngine *vm) {
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
void ObjectsManager::clearAll() {
|
||||
_forestFl = false;
|
||||
_forestSprite = g_PTRNUL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Object
|
||||
*/
|
||||
@ -1810,12 +1823,12 @@ void ObjectsManager::handleCityMap() {
|
||||
_vm->_globals.CACHE_OFF(20);
|
||||
_vm->_globals.CACHE_ON();
|
||||
|
||||
if (!_vm->_globals._mapCarPosX && !_vm->_globals._mapCarPosY) {
|
||||
_vm->_globals._mapCarPosX = 900;
|
||||
_vm->_globals._mapCarPosY = 319;
|
||||
if (!_mapCarPosX && !_mapCarPosY) {
|
||||
_mapCarPosX = 900;
|
||||
_mapCarPosY = 319;
|
||||
}
|
||||
addStaticSprite(_spritePtr, Common::Point(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY), 0, 1, 0, false, 5, 5);
|
||||
_vm->_eventsManager.setMouseXY(_vm->_globals._mapCarPosX, _vm->_globals._mapCarPosY);
|
||||
addStaticSprite(_spritePtr, Common::Point(_mapCarPosX, _mapCarPosY), 0, 1, 0, false, 5, 5);
|
||||
_vm->_eventsManager.setMouseXY(_mapCarPosX, _mapCarPosY);
|
||||
_vm->_eventsManager.mouseOn();
|
||||
_vm->_graphicsManager.scrollScreen(getSpriteX(0) - 320);
|
||||
_vm->_graphicsManager._scrollOffset = getSpriteX(0) - 320;
|
||||
@ -1872,8 +1885,8 @@ void ObjectsManager::handleCityMap() {
|
||||
_vm->_graphicsManager.fadeOutLong();
|
||||
_vm->_globals.iRegul = 0;
|
||||
_vm->_graphicsManager._noFadingFl = false;
|
||||
_vm->_globals._mapCarPosX = getSpriteX(0);
|
||||
_vm->_globals._mapCarPosY = getSpriteY(0);
|
||||
_mapCarPosX = getSpriteX(0);
|
||||
_mapCarPosY = getSpriteY(0);
|
||||
removeSprite(0);
|
||||
_spritePtr = _vm->_globals.freeMemory(_spritePtr);
|
||||
clearScreen();
|
||||
@ -1958,7 +1971,7 @@ void ObjectsManager::handleLeftButton() {
|
||||
_vm->_globals.GOACTION = false;
|
||||
int16 *oldRoute = _vm->_linesManager._route;
|
||||
_vm->_linesManager._route = (int16 *)g_PTRNUL;
|
||||
if (_vm->_globals._forestFl && _zoneNum >= 20 && _zoneNum <= 23) {
|
||||
if (_forestFl && _zoneNum >= 20 && _zoneNum <= 23) {
|
||||
if (getSpriteY(0) > 374 && getSpriteY(0) <= 410) {
|
||||
_vm->_linesManager._route = (int16 *)g_PTRNUL;
|
||||
setSpriteIndex(0, _vm->_globals._oldDirectionSpriteIdx);
|
||||
@ -2027,7 +2040,7 @@ void ObjectsManager::PARADISE() {
|
||||
char result = _vm->_globals._saveData->_data[svField1];
|
||||
if (result && _vm->_globals._saveData->_data[svField2] && result != 4 && result > 3) {
|
||||
_vm->_fontManager.hideText(5);
|
||||
if (!_vm->_globals._forestFl || _zoneNum < 20 || _zoneNum > 23) {
|
||||
if (!_forestFl || _zoneNum < 20 || _zoneNum > 23) {
|
||||
if (_vm->_graphicsManager._largeScreenFl) {
|
||||
_vm->_graphicsManager._scrollStatus = 2;
|
||||
if (_vm->_eventsManager._startPos.x + 320 - getSpriteX(0) > 160) {
|
||||
@ -3955,7 +3968,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
|
||||
breakFlag = true;
|
||||
}
|
||||
|
||||
if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_vm->_globals._helicopterFl) {
|
||||
if (_vm->_globals._exitId != 8 || _vm->_globals._screenId != 5 || !_helicopterFl) {
|
||||
if (!_vm->_graphicsManager._noFadingFl)
|
||||
_vm->_graphicsManager.fadeOutLong();
|
||||
_vm->_graphicsManager._noFadingFl = false;
|
||||
@ -3968,7 +3981,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm
|
||||
_vm->_graphicsManager.FIN_VISU();
|
||||
clearScreen();
|
||||
} else {
|
||||
_vm->_globals._helicopterFl = false;
|
||||
_helicopterFl = false;
|
||||
}
|
||||
_vm->_globals.iRegul = 0;
|
||||
}
|
||||
|
@ -66,10 +66,12 @@ public:
|
||||
int _saveLoadX, _saveLoadY;
|
||||
int _oldInventoryPosX, _oldInventoryPosY;
|
||||
int _oldCharacterPosX, _oldCharacterPosY;
|
||||
int _mapCarPosX, _mapCarPosY;
|
||||
int _eraseVisibleCounter;
|
||||
byte *_saveLoadSprite;
|
||||
byte *_saveLoadSprite2;
|
||||
byte *_spritePtr;
|
||||
byte *_forestSprite;
|
||||
const byte *_oldSpriteData;
|
||||
bool PERSO_ON;
|
||||
bool _saveLoadFl;
|
||||
@ -90,9 +92,14 @@ public:
|
||||
int _oldSpriteIndex;
|
||||
bool _oldFlipFl;
|
||||
int _curObjectIndex;
|
||||
bool _helicopterFl;
|
||||
bool _forestFl;
|
||||
public:
|
||||
ObjectsManager();
|
||||
~ObjectsManager();
|
||||
|
||||
void setParent(HopkinsEngine *vm);
|
||||
void clearAll();
|
||||
|
||||
void changeObject(int objIndex);
|
||||
byte *CAPTURE_OBJET(int objIndex, bool mode);
|
||||
|
@ -146,8 +146,8 @@ Common::Error SaveLoadManager::saveGame(int slot, const Common::String &saveName
|
||||
for (int i = 0; i < 35; ++i)
|
||||
_vm->_globals._saveData->_inventory[i] = _vm->_globals._inventory[i];
|
||||
|
||||
_vm->_globals._saveData->_mapCarPosX = _vm->_globals._mapCarPosX;
|
||||
_vm->_globals._saveData->_mapCarPosY = _vm->_globals._mapCarPosY;
|
||||
_vm->_globals._saveData->_mapCarPosX = _vm->_objectsManager._mapCarPosX;
|
||||
_vm->_globals._saveData->_mapCarPosY = _vm->_objectsManager._mapCarPosY;
|
||||
|
||||
/* Create the savegame */
|
||||
Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
|
||||
@ -205,8 +205,8 @@ Common::Error SaveLoadManager::loadGame(int slot) {
|
||||
_vm->_globals._exitId = _vm->_globals._saveData->_data[svField5];
|
||||
_vm->_globals._saveData->_data[svField6] = 0;
|
||||
_vm->_globals._screenId = 0;
|
||||
_vm->_globals._mapCarPosX = _vm->_globals._saveData->_mapCarPosX;
|
||||
_vm->_globals._mapCarPosY = _vm->_globals._saveData->_mapCarPosY;
|
||||
_vm->_objectsManager._mapCarPosX = _vm->_globals._saveData->_mapCarPosX;
|
||||
_vm->_objectsManager._mapCarPosY = _vm->_globals._saveData->_mapCarPosY;
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ int ScriptManager::handleOpcode(byte *dataP) {
|
||||
_vm->_graphicsManager.fadeOutLong();
|
||||
|
||||
_vm->_globals._disableInventFl = false;
|
||||
_vm->_globals._helicopterFl = true;
|
||||
_vm->_objectsManager._helicopterFl = true;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
|
@ -884,7 +884,7 @@ void TalkManager::REPONSE2(int a1, int a2) {
|
||||
if (a1 == 22 || a1 == 23) {
|
||||
_vm->_objectsManager.setFlipSprite(0, false);
|
||||
_vm->_objectsManager.setSpriteIndex(0, 62);
|
||||
_vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false);
|
||||
_vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, false);
|
||||
if (a1 == 22) {
|
||||
_vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3));
|
||||
_vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3));
|
||||
@ -896,7 +896,7 @@ void TalkManager::REPONSE2(int a1, int a2) {
|
||||
_vm->_objectsManager.stopBobAnimation(4);
|
||||
_vm->_objectsManager.setBobAnimation(6);
|
||||
_vm->_soundManager.PLAY_SAMPLE2(1);
|
||||
_vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4);
|
||||
_vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4);
|
||||
do
|
||||
_vm->_eventsManager.VBL();
|
||||
while (_vm->_objectsManager.getBobAnimDataIdx(6) < 12);
|
||||
@ -932,7 +932,7 @@ void TalkManager::REPONSE2(int a1, int a2) {
|
||||
} else if (a1 == 20 || a1 == 21) {
|
||||
_vm->_objectsManager.setFlipSprite(0, true);
|
||||
_vm->_objectsManager.setSpriteIndex(0, 62);
|
||||
_vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true);
|
||||
_vm->_objectsManager.SPACTION(_vm->_objectsManager._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, true);
|
||||
if (a1 == 20) {
|
||||
_vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1));
|
||||
_vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1));
|
||||
@ -944,7 +944,7 @@ void TalkManager::REPONSE2(int a1, int a2) {
|
||||
_vm->_objectsManager.stopBobAnimation(2);
|
||||
_vm->_objectsManager.setBobAnimation(5);
|
||||
_vm->_soundManager.PLAY_SAMPLE2(1);
|
||||
_vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4);
|
||||
_vm->_objectsManager.SPACTION1(_vm->_objectsManager._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4);
|
||||
do
|
||||
_vm->_eventsManager.VBL();
|
||||
while (_vm->_objectsManager.getBobAnimDataIdx(5) < 12);
|
||||
|
Loading…
Reference in New Issue
Block a user