Skip to content

Commit

Permalink
HOPKINS: Remove some hex values
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Dec 21, 2012
1 parent 664463d commit 2f77e93
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 82 deletions.
46 changes: 24 additions & 22 deletions engines/hopkins/graphics.cpp
Expand Up @@ -172,7 +172,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) {
unlockScreen();
_vm->_fileManager.constructFilename(_vm->_globals.HOPIMAGE, file);
A_PCX320(_vesaScreen, _vm->_globals.NFICHIER, Palette);
memcpy(_vesaBuffer, _vesaScreen, 0xFA00u);
memcpy(_vesaBuffer, _vesaScreen, 64000);
SCANLINE(320);
max_x = 320;

Expand Down Expand Up @@ -358,15 +358,15 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *

filesize = f.size();

f.read(surface, 0x80u);
f.read(surface, 128);
v4 = filesize - 896;
ptr = _vm->_globals.allocMemory(0xFE00u);
if (v4 >= 0xFA00) {
v15 = v4 / 0xFA00 + 1;
v17 = 64000 * (v4 / 0xFA00) - v4;
if (((uint32)v17 & 0x80000000u) != 0)
ptr = _vm->_globals.allocMemory(65024);
if (v4 >= 64000) {
v15 = v4 / 64000 + 1;
v17 = 64000 * (v4 / 64000) - v4;
if (v17 < 0)
v17 = -v17;
f.read(ptr, 0xFA00u);
f.read(ptr, 64000);
v5 = 64000;
} else {
v15 = 1;
Expand All @@ -388,7 +388,7 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *
// i = v8;
}
v9 = *(ptr + v7++);
if (v9 > 0xC0u) {
if (v9 > 192) {
v10 = v9 - 192;
if (v7 == v5) {
v7 = 0;
Expand Down Expand Up @@ -835,7 +835,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface)
srcP = srcData;
for (;;) {
srcByte = *srcP;
if (*srcP < 0xDEu)
if (*srcP < 222)
goto Video_Cont3_wVbe;
if (srcByte == kByteStop)
return;
Expand All @@ -857,7 +857,7 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface)
srcP += 5;
}
Video_Cont3_wVbe:
if (srcByte > 0xD2u) {
if (srcByte > 210) {
if (srcByte == (byte)-45) {
destLen1 = *(srcP + 1);
rleValue = *(srcP + 2);
Expand Down Expand Up @@ -1571,7 +1571,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
++spritePixelsP;
if (!Agr_Flag_x)
Agr_x = zoom2 + Agr_x;
if ((uint16)Agr_x < 0x64u)
if ((uint16)Agr_x < 100)
break;
Agr_x = Agr_x - 100;
--spritePixelsP;
Expand All @@ -1588,7 +1588,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
++Compteur_y;
if (!Agr_Flag_y)
Agr_y = zoom2 + Agr_y;
if ((uint16)Agr_y < 0x64u)
if ((uint16)Agr_y < 100)
break;
Agr_y = Agr_y - 100;
spritePixelsP = v46;
Expand Down Expand Up @@ -1652,7 +1652,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
++spritePixelsP;
if (!Agr_Flag_x)
Agr_x = zoom2 + Agr_x;
if ((uint16)Agr_x < 0x64u)
if ((uint16)Agr_x < 100)
break;
Agr_x = Agr_x - 100;
--spritePixelsP;
Expand All @@ -1669,7 +1669,7 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
dest1P = _lineNbr2 + v51;
if (!Agr_Flag_y)
Agr_y = zoom2 + Agr_y;
if ((uint16)Agr_y < 0x64u)
if ((uint16)Agr_y < 100)
break;
Agr_y = Agr_y - 100;
spritePixelsP = v45;
Expand All @@ -1696,12 +1696,12 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
int v65 = spriteHeight2;
byte *v55 = v40;
Red_y = Red + Red_y;
if ((uint16)Red_y < 0x64u) {
if ((uint16)Red_y < 100) {
Red_x = 0;
int v42 = v37;
for (int v41 = _width; v41; v41--) {
Red_x = Red + Red_x;
if ((uint16)Red_x < 0x64u) {
if ((uint16)Red_x < 100) {
if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP)
*v40 = *spritePixelsP;
--v40;
Expand All @@ -1725,12 +1725,12 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp
int v64 = spriteHeight2;
byte *v54 = dest1P;
Red_y = Red + Red_y;
if ((uint16)Red_y < 0x64u) {
if ((uint16)Red_y < 100) {
Red_x = 0;
int v39 = 0;
for (int v38 = _width; v38; v38--) {
Red_x = Red + Red_x;
if ((uint16)Red_x < 0x64u) {
if ((uint16)Red_x < 100) {
if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP)
*dest1P = *spritePixelsP;
++dest1P;
Expand Down Expand Up @@ -2038,17 +2038,19 @@ void GraphicsManager::NB_SCREEN() {

if (!_vm->_globals.NECESSAIRE)
INIT_TABLE(50, 65, Palette);

if (_lineNbr == SCREEN_WIDTH)
Trans_bloc2(_vesaBuffer, TABLE_COUL, 307200);
Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT);
else if (_lineNbr == (SCREEN_WIDTH * 2))
Trans_bloc2(_vesaBuffer, TABLE_COUL, 614400);
Trans_bloc2(_vesaBuffer, TABLE_COUL, SCREEN_WIDTH * SCREEN_HEIGHT * 2);

lockScreen();
m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
unlockScreen();

destP = _vesaScreen;
srcP = _vesaBuffer;
memcpy(_vesaScreen, _vesaBuffer, 0x95FFCu);
memcpy(_vesaScreen, _vesaBuffer, 614396);
srcP = srcP + 614396;
destP = destP + 614396;
*destP = *srcP;
Expand Down
10 changes: 5 additions & 5 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -747,8 +747,8 @@ bool HopkinsEngine::runLinuxDemo() {
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.DD_VBL();
memset(_graphicsManager._vesaBuffer, 0, 0x4B000u);
memset(_graphicsManager._vesaScreen, 0, 0x4B000u);
memset(_graphicsManager._vesaBuffer, 0, 307200);
memset(_graphicsManager._vesaScreen, 0, 307200);
_graphicsManager.Cls_Pal();
_graphicsManager.RESET_SEGMENT_VESA();
break;
Expand Down Expand Up @@ -848,7 +848,7 @@ bool HopkinsEngine::runBeOSFull() {
_globals.PERSO = _fileManager.loadFile(_globals.NFICHIER);
_globals.PERSO_TYPE = 0;
_globals.PLANX = _globals.PLANY = 0;
memset(_globals.SAUVEGARDE, 0, 0x7CCu);
memset(_globals.SAUVEGARDE, 0, 1996);
_globals.SORTIE = 0;

for (;;) {
Expand Down Expand Up @@ -3340,8 +3340,8 @@ bool HopkinsEngine::runLinuxFull() {
_graphicsManager.clearScreen();
_graphicsManager.unlockScreen();
_graphicsManager.DD_VBL();
memset(_graphicsManager._vesaBuffer, 0, 0x4B000u);
memset(_graphicsManager._vesaScreen, 0, 0x4B000u);
memset(_graphicsManager._vesaBuffer, 0, 307200);
memset(_graphicsManager._vesaScreen, 0, 307200);
_graphicsManager.Cls_Pal();
_graphicsManager.RESET_SEGMENT_VESA();
break;
Expand Down
56 changes: 28 additions & 28 deletions engines/hopkins/objects.cpp
Expand Up @@ -1555,7 +1555,7 @@ void ObjectsManager::VERIFZONE() {
if (_vm->_globals.PLAN_FLAG
|| _vm->_eventsManager._startPos.x >= v0
|| (v1 = _vm->_graphicsManager.ofscroll + 54, v0 >= v1)
|| (v1 = v2 - 1, (uint16)(v2 - 1) > 0x3Bu)) {
|| (v1 = v2 - 1, (uint16)(v2 - 1) > 59)) {
if (_visibleFl == true)
FLAG_VISIBLE_EFFACE = 4;
_visibleFl = false;
Expand Down Expand Up @@ -1776,7 +1776,7 @@ void ObjectsManager::GOHOME() {
return;
}
if (_vm->_globals.g_old_sens == 3) {
if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -1815,7 +1815,7 @@ void ObjectsManager::GOHOME() {
}
if (_vm->_globals.g_old_sens != 7)
goto LABEL_43;
if ((uint16)(_vm->_globals.g_old_anim - 24) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 24) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -1885,7 +1885,7 @@ void ObjectsManager::GOHOME() {
LABEL_60:
if (_vm->_globals.g_old_sens != 5)
goto LABEL_77;
if ((uint16)(_vm->_globals.g_old_anim - 48) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 48) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -1917,7 +1917,7 @@ void ObjectsManager::GOHOME() {
LABEL_77:
if (_vm->_globals.g_old_sens != 2)
goto LABEL_96;
if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -1955,7 +1955,7 @@ void ObjectsManager::GOHOME() {
LABEL_96:
if (_vm->_globals.g_old_sens != 8)
goto LABEL_115;
if ((uint16)(_vm->_globals.g_old_anim - 12) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 12) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -1993,7 +1993,7 @@ void ObjectsManager::GOHOME() {
LABEL_115:
if (_vm->_globals.g_old_sens != 4)
goto LABEL_134;
if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -2031,7 +2031,7 @@ void ObjectsManager::GOHOME() {
LABEL_134:
if (_vm->_globals.g_old_sens != 6)
goto LABEL_153;
if ((uint16)(_vm->_globals.g_old_anim - 36) > 0xBu) {
if ((uint16)(_vm->_globals.g_old_anim - 36) > 11) {
v0 = g_old_x;
v58 = g_old_y;
} else {
Expand Down Expand Up @@ -2581,7 +2581,7 @@ void ObjectsManager::handleLeftButton() {
destX = _vm->_eventsManager.getMouseX();
destY = _vm->_eventsManager.getMouseY();

if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 0x4Eu) {
if (!_vm->_dialogsManager._inventFl && !_vm->_globals.PLAN_FLAG && destX > _vm->_graphicsManager.ofscroll - 30 && destX < _vm->_graphicsManager.ofscroll + 50 && (uint16)(destY + 29) <= 78) {
v1 = _vm->_eventsManager._mouseCursorId;
_vm->_dialogsManager._inventFl = true;
_vm->_dialogsManager.showInventory();
Expand All @@ -2595,30 +2595,30 @@ void ObjectsManager::handleLeftButton() {
}
if (_vm->_globals.SAUVEGARDE->data[svField354] == 1
&& !_vm->_globals.PLAN_FLAG
&& (uint16)(destX - 533) <= 0x1Au
&& (uint16)(destY - 26) <= 0x21u) {
&& (uint16)(destX - 533) <= 26
&& (uint16)(destY - 26) <= 33) {
changeCharacterHead(CHARACTER_HOPKINS_CLONE, CHARACTER_HOPKINS);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField356] == 1
&& !_vm->_globals.PLAN_FLAG
&& (uint16)(destX - 533) <= 0x1Au
&& (uint16)(destY - 26) <= 0x21u) {
&& (uint16)(destX - 533) <= 26
&& (uint16)(destY - 26) <= 22) {
changeCharacterHead(CHARACTER_SAMANTHA, CHARACTER_HOPKINS);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField357] == 1) {
if (_vm->_globals.SAUVEGARDE->data[svField353] == 1
&& !_vm->_globals.PLAN_FLAG
&& (uint16)(destX - 533) <= 0x1Au
&& (uint16)(destY - 26) <= 0x21u) {
&& (uint16)(destX - 533) <= 26
&& (uint16)(destY - 26) <= 33) {
changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_HOPKINS_CLONE);
return;
}
if (_vm->_globals.SAUVEGARDE->data[svField355] == 1
&& !_vm->_globals.PLAN_FLAG
&& (uint16)(destX - 567) <= 0x1Au
&& (uint16)(destY - 26) <= 0x21u) {
&& (uint16)(destX - 567) <= 26
&& (uint16)(destY - 26) <= 33) {
changeCharacterHead(CHARACTER_HOPKINS, CHARACTER_SAMANTHA);
return;
}
Expand Down Expand Up @@ -3836,9 +3836,9 @@ void ObjectsManager::initBorder(int a1) {
_borderPos.x = _vm->_graphicsManager.ofscroll + 374;
if (a1 == 6 || a1 == 12 || a1 == 18 || a1 == 24 || (uint16)(a1 - 30) <= 1u)
_borderPos.x = _vm->_graphicsManager.ofscroll + 428;
if ((uint16)(a1 - 1) <= 0x1Cu)
if ((uint16)(a1 - 1) <= 28)
_borderSpriteIndex = 0;
if ((uint16)(a1 - 30) <= 1u)
if ((uint16)(a1 - 30) <= 1)
_borderSpriteIndex = 2;
if (a1 == 30)
_borderPos.y = 272;
Expand All @@ -3856,11 +3856,11 @@ void ObjectsManager::initBorder(int a1) {
_vm->_eventsManager._mouseCursorId = 2;
if (a1 == 31)
_vm->_eventsManager._mouseCursorId = 3;
if ((uint16)(a1 - 1) <= 0x1Cu)
if ((uint16)(a1 - 1) <= 28)
_vm->_eventsManager._mouseCursorId = 8;
if (a1 == 29)
_vm->_eventsManager._mouseCursorId = 1;
if ((uint16)(a1 - 1) <= 0x1Bu && !_vm->_globals._inventory[a1]) {
if ((uint16)(a1 - 1) <= 27 && !_vm->_globals._inventory[a1]) {
_vm->_eventsManager._mouseCursorId = 0;
_borderPos = Common::Point(0, 0);
_borderSpriteIndex = 0;
Expand Down Expand Up @@ -4042,10 +4042,10 @@ void ObjectsManager::SPECIAL_JEU() {
_vm->_talkManager.PARLER_PERSO("flicspe1.pe2");
_vm->_globals.NOPARLE = false;
if (!_vm->_globals.CENSURE) {
v1 = _vm->_globals.allocMemory(0x3E8u);
memcpy(v1, _vm->_graphicsManager.Palette, 0x301u);
v1 = _vm->_globals.allocMemory(1000);
memcpy(v1, _vm->_graphicsManager.Palette, 769);

_vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 0x4B000u);
_vm->_saveLoadManager.saveFile("TEMP1.SCR", _vm->_graphicsManager._vesaScreen, 307200);

if (!_vm->_graphicsManager._lineNbr)
_vm->_graphicsManager.ofscroll = 0;
Expand All @@ -4065,15 +4065,15 @@ void ObjectsManager::SPECIAL_JEU() {
g_system->getSavefileManager()->removeSavefile("TEMP1.SCR");

PERSO_ON = false;
memcpy(_vm->_graphicsManager.Palette, v1, 0x301u);
memcpy(_vm->_graphicsManager.Palette, v1, 769);
_vm->_graphicsManager.SHOW_PALETTE();
_vm->_globals.freeMemory(v1);
_vm->_graphicsManager.lockScreen();
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
_vm->_graphicsManager.unlockScreen();
v2 = _vm->_graphicsManager._vesaBuffer;
v3 = _vm->_graphicsManager._vesaScreen;
memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 0x95FFCu);
memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396);
v3 = v3 + 614396;
v2 = v2 + 614396;
*v2 = *v3;
Expand Down Expand Up @@ -4910,9 +4910,9 @@ int ObjectsManager::CALC_PROPRE(int idx) {
v2 = 20 * (5 * v4 - 165) / -67;
}
if (v2 < 0)
return _vm->_graphicsManager.zoomOut(0x19u, -v2);
return _vm->_graphicsManager.zoomOut(25, -v2);
if (v2 > 0)
return _vm->_graphicsManager.zoomIn(0x19u, v2);
return _vm->_graphicsManager.zoomIn(25, v2);

return v1;
}
Expand Down

0 comments on commit 2f77e93

Please sign in to comment.