Skip to content

Commit

Permalink
ACCESS: Fix decoding of font data
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 18, 2014
1 parent be46398 commit c576b20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion engines/access/amazon/amazon_game.cpp
Expand Up @@ -173,8 +173,8 @@ void AmazonEngine::setupGame() {
}

// Miscellaenous
_fonts._font6x6.load(FONT6x6_INDEX, FONT6x6_DATA);
_fonts._font2.load(FONT2_INDEX, FONT2_DATA);
_fonts._font6x6.load(FONT6x6_INDEX, FONT6x6_DATA);

// Set player room and position
_player->_roomNumber = 4;
Expand Down
12 changes: 6 additions & 6 deletions engines/access/data.cpp
Expand Up @@ -56,16 +56,16 @@ Font::~Font() {
_chars[i].free();
}

void Font::load(const int *index, const byte *data) {
void Font::load(const int *fontIndex, const byte *fontData) {
assert(_chars.size() == 0);
int count = index[0];
_bitWidth = index[1];
_height = index[2];
int count = fontIndex[0];
_bitWidth = fontIndex[1];
_height = fontIndex[2];

_chars.resize(count);

for (int i = 0; i < count; ++i) {
const byte *pData = data + index[i + 3];
const byte *pData = fontData + fontIndex[i + 3];
_chars[i].create(*pData++, _height, Graphics::PixelFormat::createFormatCLUT8());

for (int y = 0; y < _height; ++y) {
Expand All @@ -77,7 +77,7 @@ void Font::load(const int *index, const byte *data) {
for (int x = 0; x < _chars[i].w; ++x, ++pDest) {
// Get the pixel
pixel = 0;
for (int pixelCtr = 0; pixelCtr < _bitWidth; ++pixelCtr) {
for (int pixelCtr = 0; pixelCtr < _bitWidth; ++pixelCtr, --bitsLeft) {
// No bits in current byte left, so get next byte
if (bitsLeft == 0) {
bitsLeft = 8;
Expand Down
2 changes: 1 addition & 1 deletion engines/access/data.h
Expand Up @@ -100,7 +100,7 @@ class Font {
/**
* Load the given font data
*/
void load(const int *index, const byte *data);
void load(const int *fontIndex, const byte *fontData);

/**
* Get the width of a given character
Expand Down

0 comments on commit c576b20

Please sign in to comment.