Skip to content

Commit

Permalink
HUGO/TOOLS: reorder things in HUGO.DAT, move from RGBA to RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Feb 20, 2011
1 parent ae88f41 commit 93f25b7
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 241 deletions.
Binary file modified dists/engine-data/hugo.dat
Binary file not shown.
43 changes: 9 additions & 34 deletions engines/hugo/display.cpp
Expand Up @@ -130,26 +130,12 @@ viewdib_t &Screen::getGUIBuffer() {
*/
void Screen::createPal() {
debugC(1, kDebugDisplay, "createPal");

byte pal[3 * 256];
for (uint i = 0; i < _paletteSize; ++i) {
pal[3 * i + 0] = _mainPalette[4 * i + 0];
pal[3 * i + 1] = _mainPalette[4 * i + 1];
pal[3 * i + 2] = _mainPalette[4 * i + 2];
}

g_system->getPaletteManager()->setPalette(pal, 0, _paletteSize / 4);
g_system->getPaletteManager()->setPalette(_mainPalette, 0, _paletteSize / 3);
}

void Screen::setCursorPal() {
byte pal[3 * 256];
for (uint i = 0; i < _paletteSize; ++i) {
pal[3 * i + 0] = _curPalette[4 * i + 0];
pal[3 * i + 1] = _curPalette[4 * i + 1];
pal[3 * i + 2] = _curPalette[4 * i + 2];
}

CursorMan.replaceCursorPalette(pal, 0, _paletteSize / 4);
debugC(1, kDebugDisplay, "setCursorPal");
CursorMan.replaceCursorPalette(_curPalette, 0, _paletteSize / 3);
}

/**
Expand Down Expand Up @@ -205,14 +191,11 @@ void Screen::displayRect(const int16 x, const int16 y, const int16 dx, const int
void Screen::remapPal(const uint16 oldIndex, const uint16 newIndex) {
debugC(1, kDebugDisplay, "Remap_pal(%d, %d)", oldIndex, newIndex);

byte pal[3];
_curPalette[3 * oldIndex + 0] = _mainPalette[newIndex * 3 + 0];
_curPalette[3 * oldIndex + 1] = _mainPalette[newIndex * 3 + 1];
_curPalette[3 * oldIndex + 2] = _mainPalette[newIndex * 3 + 2];

pal[0] = _curPalette[4 * oldIndex + 0] = _mainPalette[newIndex * 4 + 0];
pal[1] = _curPalette[4 * oldIndex + 1] = _mainPalette[newIndex * 4 + 1];
pal[2] = _curPalette[4 * oldIndex + 2] = _mainPalette[newIndex * 4 + 2];
//pal[3] = _curPalette[4 * oldIndex + 3] = _mainPalette[newIndex * 4 + 3];

g_system->getPaletteManager()->setPalette(pal, oldIndex, 1);
g_system->getPaletteManager()->setPalette(_curPalette, oldIndex, 1);
}

/**
Expand All @@ -231,17 +214,9 @@ void Screen::savePal(Common::WriteStream *f) const {
void Screen::restorePal(Common::ReadStream *f) {
debugC(1, kDebugDisplay, "restorePal()");

byte pal[3];

for (int i = 0; i < _paletteSize; i++)
for (int i = 0; i < _paletteSize; i++) {
_curPalette[i] = f->readByte();

for (int i = 0; i < _paletteSize / 4; i++) {
pal[0] = _curPalette[i * 4 + 0];
pal[1] = _curPalette[i * 4 + 1];
pal[2] = _curPalette[i * 4 + 2];
//pal[3] = _curPalette[i * 4 + 3];
g_system->getPaletteManager()->setPalette(pal, i, 1);
g_system->getPaletteManager()->setPalette(_curPalette, i, 1);
}
}

Expand Down
16 changes: 8 additions & 8 deletions engines/hugo/hugo.cpp
Expand Up @@ -398,22 +398,25 @@ bool HugoEngine::loadHugoDat() {
_numVariant = in.readUint16BE();

_screen->loadPalette(in);
_screen->loadFontArr(in);
_text->loadAllTexts(in);
_intro->loadIntroData(in);
_parser->loadArrayReqs(in);
_parser->loadCatchallList(in);
_parser->loadBackgroundObjects(in);
_parser->loadCmdList(in);
_mouse->loadHotspots(in);
_inventory->loadInvent(in);
_object->loadObjectUses(in);
_parser->loadCatchallList(in);
_parser->loadBackgroundObjects(in);
_object->loadObjectArr(in);
_object->loadNumObj(in);
_scheduler->loadPoints(in);
_parser->loadCmdList(in);
_scheduler->loadScreenAct(in);
_object->loadObjectArr(in);
_scheduler->loadActListArr(in);
_scheduler->loadAlNewscrIndex(in);
_hero = &_object->_objects[kHeroIndex]; // This always points to hero
_screen_p = &(_object->_objects[kHeroIndex].screenIndex); // Current screen is hero's
_heroImage = kHeroIndex; // Current in use hero image
_scheduler->loadActListArr(in);

for (int varnt = 0; varnt < _numVariant; varnt++) {
if (varnt == _gameVariant) {
Expand Down Expand Up @@ -464,10 +467,7 @@ bool HugoEngine::loadHugoDat() {
}
}

_object->loadNumObj(in);
_scheduler->loadAlNewscrIndex(in);
_sound->loadIntroSong(in);
_screen->loadFontArr(in);
_topMenu->loadBmpArr(in);

return true;
Expand Down
2 changes: 1 addition & 1 deletion engines/hugo/hugo.h
Expand Up @@ -36,7 +36,7 @@
#include "hugo/file.h"

#define HUGO_DAT_VER_MAJ 0 // 1 byte
#define HUGO_DAT_VER_MIN 41 // 1 byte
#define HUGO_DAT_VER_MIN 42 // 1 byte
#define DATAALIGNMENT 4

namespace Common {
Expand Down

0 comments on commit 93f25b7

Please sign in to comment.