Objectize image.cpp

svn-id: r14391
This commit is contained in:
Eugene Sandulenko 2004-07-31 13:49:26 +00:00
parent 6038cf68ad
commit 6e6edb8c0d
6 changed files with 21 additions and 55 deletions

View file

@ -27,7 +27,6 @@
#include "game_mod.h"
#include "image_mod.h"
#include "image.h"
namespace Saga {
@ -50,8 +49,8 @@ static int granulate(int value, int granularity) {
}
}
int IMG_DecodeBGImage(const byte * image_data, size_t image_size,
byte ** output_buf, size_t * output_buf_len, int *w, int *h) {
int SagaEngine::decodeBGImage(const byte *image_data, size_t image_size,
byte **output_buf, size_t *output_buf_len, int *w, int *h) {
R_IMAGE_HEADER hdr;
int modex_height;
const byte *RLE_data_ptr;
@ -109,7 +108,7 @@ int IMG_DecodeBGImage(const byte * image_data, size_t image_size,
return R_SUCCESS;
}
int DecodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len) {
int SagaEngine::DecodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len) {
const byte *inbuf_ptr;
byte *outbuf_ptr;
uint32 inbuf_remain;
@ -303,7 +302,7 @@ int DecodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t o
return R_SUCCESS;
}
int FlipImage(byte *img_buf, int columns, int scanlines) {
int SagaEngine::FlipImage(byte *img_buf, int columns, int scanlines) {
int line;
byte *tmp_scan;
@ -333,7 +332,7 @@ int FlipImage(byte *img_buf, int columns, int scanlines) {
return R_SUCCESS;
}
int UnbankBGImage(byte *dst_buf, const byte *src_buf, int columns, int scanlines) {
int SagaEngine::UnbankBGImage(byte *dst_buf, const byte *src_buf, int columns, int scanlines) {
int x, y;
int temp;
int quadruple_rows;
@ -431,7 +430,7 @@ int UnbankBGImage(byte *dst_buf, const byte *src_buf, int columns, int scanlines
return R_SUCCESS;
}
const byte *IMG_GetImagePal(const byte *image_data, size_t image_size) {
const byte *SagaEngine::getImagePal(const byte *image_data, size_t image_size) {
if (image_size <= SAGA_IMAGE_HEADER_LEN) {
return NULL;
}

View file

@ -41,10 +41,6 @@ struct R_IMAGE_HEADER {
int unknown6;
};
int DecodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);
int FlipImage(byte *img_buf, int columns, int scanlines);
int UnbankBGImage(byte * dest_buf, const byte * src_buf, int columns, int scanlines);
} // End of namespace Saga
#endif

View file

@ -1,37 +0,0 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2004 The ScummVM project
*
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
// SAGA Image resource management routines
#ifndef SAGA_IMAGE_MOD_H_
#define SAGA_IMAGE_MOD_H_
namespace Saga {
int IMG_DecodeBGImage(const byte *image_data, size_t image_size,
byte **output_buf, size_t *output_buf_len, int *w, int *h);
const byte *IMG_GetImagePal(const byte *image_data, size_t image_size);
} // End of namespace Saga
#endif

View file

@ -31,7 +31,6 @@
#include "console_mod.h"
#include "font_mod.h"
#include "gfx_mod.h"
#include "image_mod.h"
#include "objectmap_mod.h"
#include "rscfile_mod.h"
#include "script_mod.h"
@ -196,10 +195,10 @@ int INTERFACE_Init(void) {
SPRITE_LoadList(ITE_DEFAULT_PORTRAITS, &IfModule.def_portraits);
IMG_DecodeBGImage(IfModule.c_panel.res, IfModule.c_panel.res_len, &IfModule.c_panel.img,
_vm->decodeBGImage(IfModule.c_panel.res, IfModule.c_panel.res_len, &IfModule.c_panel.img,
&IfModule.c_panel.img_len, &IfModule.c_panel.img_w, &IfModule.c_panel.img_h);
IMG_DecodeBGImage(IfModule.d_panel.res, IfModule.d_panel.res_len,
_vm->decodeBGImage(IfModule.d_panel.res, IfModule.d_panel.res_len,
&IfModule.d_panel.img, &IfModule.d_panel.img_len,
&IfModule.d_panel.img_w, &IfModule.d_panel.img_h);

View file

@ -69,6 +69,16 @@ public:
Sound *_sound;
Music *_music;
Anim *_anim;
private:
int DecodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);
int FlipImage(byte *img_buf, int columns, int scanlines);
int UnbankBGImage(byte *dest_buf, const byte *src_buf, int columns, int scanlines);
public:
int decodeBGImage(const byte *image_data, size_t image_size,
byte **output_buf, size_t *output_buf_len, int *w, int *h);
const byte *getImagePal(const byte *image_data, size_t image_size);
};
// FIXME: Global var. We use it until everything will be turned into objects

View file

@ -34,7 +34,6 @@
#include "events_mod.h"
#include "actionmap_mod.h"
#include "gfx_mod.h"
#include "image_mod.h"
#include "isomap_mod.h"
#include "script_mod.h"
#include "objectmap_mod.h"
@ -584,7 +583,7 @@ int ProcessSceneResources() {
SceneModule.bg.res_len = SceneModule.reslist[i].res_data_len;
SceneModule.bg.loaded = 1;
if (IMG_DecodeBGImage(SceneModule.bg.res_buf,
if (_vm->decodeBGImage(SceneModule.bg.res_buf,
SceneModule.bg.res_len,
&SceneModule.bg.buf,
&SceneModule.bg.buf_len,
@ -594,7 +593,7 @@ int ProcessSceneResources() {
return R_FAILURE;
}
pal_p = IMG_GetImagePal(SceneModule.bg.res_buf, SceneModule.bg.res_len);
pal_p = _vm->getImagePal(SceneModule.bg.res_buf, SceneModule.bg.res_len);
memcpy(SceneModule.bg.pal, pal_p, sizeof SceneModule.bg.pal);
SceneModule.scene_mode = R_SCENE_MODE_NORMAL;
break;
@ -606,7 +605,7 @@ int ProcessSceneResources() {
SceneModule.bg_mask.res_buf = SceneModule.reslist[i].res_data;
SceneModule.bg_mask.res_len = SceneModule.reslist[i].res_data_len;
SceneModule.bg_mask.loaded = 1;
IMG_DecodeBGImage(SceneModule.bg_mask.res_buf, SceneModule.bg_mask.res_len, &SceneModule.bg_mask.buf,
_vm->decodeBGImage(SceneModule.bg_mask.res_buf, SceneModule.bg_mask.res_len, &SceneModule.bg_mask.buf,
&SceneModule.bg_mask.buf_len, &SceneModule.bg_mask.w, &SceneModule.bg_mask.h);
break;
case SAGA_OBJECT_NAME_LIST: