Implement animated bitmaps.
Reorganize ZBuffer rendering code a bit.
This commit is contained in:
parent
288b1b99ba
commit
e1a465cd44
10 changed files with 129 additions and 94 deletions
2
TODO
2
TODO
|
@ -2,7 +2,7 @@ Residual TODO list (in rough order of priority):
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
Assigned tasks:
|
Assigned tasks:
|
||||||
* Add LAF font and text drawing support (aquadran)
|
* Add LAF font and text drawing support (aquadran)
|
||||||
* Implement drawing 2D objects (frob)
|
* Implement FadeInChore and FadeOutChore (frob)
|
||||||
|
|
||||||
Unassigned (help wanted):
|
Unassigned (help wanted):
|
||||||
* Add OpenGL lighting (ender, possibly)
|
* Add OpenGL lighting (ender, possibly)
|
||||||
|
|
143
bitmap.cpp
143
bitmap.cpp
|
@ -41,7 +41,7 @@ Resource(filename) {
|
||||||
format_ = READ_LE_UINT32(data + 32);
|
format_ = READ_LE_UINT32(data + 32);
|
||||||
width_ = READ_LE_UINT32(data + 128);
|
width_ = READ_LE_UINT32(data + 128);
|
||||||
height_ = READ_LE_UINT32(data + 132);
|
height_ = READ_LE_UINT32(data + 132);
|
||||||
curr_image_ = 0;
|
curr_image_ = 1;
|
||||||
|
|
||||||
data_ = new char*[num_images_];
|
data_ = new char*[num_images_];
|
||||||
int pos = 0x88;
|
int pos = 0x88;
|
||||||
|
@ -65,76 +65,98 @@ Resource(filename) {
|
||||||
|
|
||||||
if (format_ == 1) {
|
if (format_ == 1) {
|
||||||
hasTransparency_ = false;
|
hasTransparency_ = false;
|
||||||
|
|
||||||
// Convert data to 32-bit RGBA format
|
|
||||||
char *texData = new char[4 * width_ * height_];
|
|
||||||
char *texDataPtr = texData;
|
|
||||||
uint16 *bitmapData = reinterpret_cast<uint16 *>(data_[0]);
|
|
||||||
for (int i = 0; i < width_ * height_;
|
|
||||||
i++, texDataPtr += 4, bitmapData++) {
|
|
||||||
uint16 pixel = *bitmapData;
|
|
||||||
int r = pixel >> 11;
|
|
||||||
texDataPtr[0] = (r << 3) | (r >> 2);
|
|
||||||
int g = (pixel >> 5) & 0x3f;
|
|
||||||
texDataPtr[1] = (g << 2) | (g >> 4);
|
|
||||||
int b = pixel & 0x1f;
|
|
||||||
texDataPtr[2] = (b << 3) | (b >> 2);
|
|
||||||
if (pixel == 0xf81f) { // transparent
|
|
||||||
texDataPtr[3] = 0;
|
|
||||||
hasTransparency_ = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
texDataPtr[3] = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
num_tex_ = ((width_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
|
num_tex_ = ((width_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE) *
|
||||||
((height_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
|
((height_ + (BITMAP_TEXTURE_SIZE - 1)) / BITMAP_TEXTURE_SIZE);
|
||||||
tex_ids_ = new GLuint[num_tex_];
|
tex_ids_ = new GLuint[num_tex_ * num_images_];
|
||||||
glGenTextures(num_tex_, tex_ids_);
|
glGenTextures(num_tex_ * num_images_, tex_ids_);
|
||||||
for (int i = 0; i < num_tex_; i++) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_ids_[i]);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
|
||||||
BITMAP_TEXTURE_SIZE, BITMAP_TEXTURE_SIZE, 0,
|
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
char *texData = new char[4 * width_ * height_];
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, width_);
|
|
||||||
|
|
||||||
int cur_tex_idx = 0;
|
for (int pic = 0; pic < num_images_; pic++) {
|
||||||
for (int y = 0; y < height_; y += BITMAP_TEXTURE_SIZE) {
|
// Convert data to 32-bit RGBA format
|
||||||
for (int x = 0; x < width_; x += BITMAP_TEXTURE_SIZE) {
|
char *texDataPtr = texData;
|
||||||
int width = (x + BITMAP_TEXTURE_SIZE >= width_) ? (width_ - x) : BITMAP_TEXTURE_SIZE;
|
uint16 *bitmapData = reinterpret_cast<uint16 *>(data_[pic]);
|
||||||
int height = (y + BITMAP_TEXTURE_SIZE >= height_) ? (height_ - y) : BITMAP_TEXTURE_SIZE;
|
for (int i = 0; i < width_ * height_;
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
|
i++, texDataPtr += 4, bitmapData++) {
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,
|
uint16 pixel = *bitmapData;
|
||||||
0,
|
int r = pixel >> 11;
|
||||||
0, 0,
|
texDataPtr[0] = (r << 3) | (r >> 2);
|
||||||
width, height,
|
int g = (pixel >> 5) & 0x3f;
|
||||||
GL_RGBA,
|
texDataPtr[1] = (g << 2) | (g >> 4);
|
||||||
GL_UNSIGNED_BYTE,
|
int b = pixel & 0x1f;
|
||||||
texData + (y * 4 * width_) + (4 * x));
|
texDataPtr[2] = (b << 3) | (b >> 2);
|
||||||
cur_tex_idx++;
|
if (pixel == 0xf81f) { // transparent
|
||||||
|
texDataPtr[3] = 0;
|
||||||
|
hasTransparency_ = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
texDataPtr[3] = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < num_tex_; i++) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, tex_ids_[num_tex_ * pic + i]);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||||
|
BITMAP_TEXTURE_SIZE, BITMAP_TEXTURE_SIZE, 0,
|
||||||
|
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, width_);
|
||||||
|
|
||||||
|
int cur_tex_idx = num_tex_ * pic;
|
||||||
|
|
||||||
|
for (int y = 0; y < height_; y += BITMAP_TEXTURE_SIZE) {
|
||||||
|
for (int x = 0; x < width_; x += BITMAP_TEXTURE_SIZE) {
|
||||||
|
int width = (x + BITMAP_TEXTURE_SIZE >= width_) ? (width_ - x) : BITMAP_TEXTURE_SIZE;
|
||||||
|
int height = (y + BITMAP_TEXTURE_SIZE >= height_) ? (height_ - y) : BITMAP_TEXTURE_SIZE;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
|
0,
|
||||||
|
0, 0,
|
||||||
|
width, height,
|
||||||
|
GL_RGBA,
|
||||||
|
GL_UNSIGNED_BYTE,
|
||||||
|
texData + (y * 4 * width_) + (4 * x));
|
||||||
|
cur_tex_idx++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
delete [] texData;
|
delete [] texData;
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < (width_ * height_); i++) {
|
for (int pic = 0; pic < num_images_; pic++) {
|
||||||
uint16 val = READ_LE_UINT16(data_[curr_image_] + 2 * i);
|
uint16 *zbufPtr = reinterpret_cast<uint16*>(data_[pic]);
|
||||||
((uint16 *) data_[curr_image_])[i] =
|
for (int i = 0; i < (width_ * height_); i++) {
|
||||||
0xffff - ((uint32) val) * 0x10000 / 100 / (0x10000 - val);
|
uint16 val = READ_LE_UINT16(data_[pic] + 2 * i);
|
||||||
|
zbufPtr[i] = 0xffff - ((uint32) val) * 0x10000 / 100 / (0x10000 - val);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flip the zbuffer image to match what GL expects
|
||||||
|
for (int y = 0; y < height_ / 2; y++) {
|
||||||
|
uint16 *ptr1 = zbufPtr + y * width_;
|
||||||
|
uint16 *ptr2 = zbufPtr + (height_ - 1 - y) * width_;
|
||||||
|
for (int x = 0; x < width_; x++, ptr1++, ptr2++) {
|
||||||
|
uint16 tmp = *ptr1;
|
||||||
|
*ptr1 = *ptr2;
|
||||||
|
*ptr2 = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tex_ids_ = NULL;
|
tex_ids_ = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::draw() const {
|
void Bitmap::draw() const {
|
||||||
|
if (curr_image_ == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, 640, 480, 0, 0, 1);
|
glOrtho(0, 640, 480, 0, 0, 1);
|
||||||
|
@ -153,18 +175,13 @@ void Bitmap::draw() const {
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
if (format_ == 1) { // Normal image
|
if (format_ == 1) { // Normal image
|
||||||
if (curr_image_ != 0) {
|
|
||||||
warning("Animation not handled yet in GL texture path !\n");
|
|
||||||
}
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glScissor(x_, 480 - (y_ + height_), width_, height_);
|
glScissor(x_, 480 - (y_ + height_), width_, height_);
|
||||||
int cur_tex_idx = 0;
|
int cur_tex_idx = num_tex_ * (curr_image_ - 1);
|
||||||
for (int y = y_; y < (y_ + height_); y += BITMAP_TEXTURE_SIZE) {
|
for (int y = y_; y < (y_ + height_); y += BITMAP_TEXTURE_SIZE) {
|
||||||
for (int x = x_; x < (x_ + width_); x += BITMAP_TEXTURE_SIZE) {
|
for (int x = x_; x < (x_ + width_); x += BITMAP_TEXTURE_SIZE) {
|
||||||
int width = (x + BITMAP_TEXTURE_SIZE >= (x_ + width_)) ? ((x_ + width_) - x) : BITMAP_TEXTURE_SIZE;
|
|
||||||
int height = (y + BITMAP_TEXTURE_SIZE >= (y_ + height_)) ? ((y_ + height_) - y) : BITMAP_TEXTURE_SIZE;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
|
glBindTexture(GL_TEXTURE_2D, tex_ids_[cur_tex_idx]);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0.0, 0.0);
|
glTexCoord2f(0.0, 0.0);
|
||||||
|
@ -190,7 +207,7 @@ void Bitmap::draw() const {
|
||||||
if ((ZBUFFER_GLOBAL == 0) || (SCREENBLOCKS_GLOBAL == 1))
|
if ((ZBUFFER_GLOBAL == 0) || (SCREENBLOCKS_GLOBAL == 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_driver->drawDepthBitmap(curr_image_, x_, y_, width_, height_, data_);
|
g_driver->drawDepthBitmap(x_, y_, width_, height_, data_[curr_image_ - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +216,7 @@ Bitmap::~Bitmap() {
|
||||||
delete[] data_[i];
|
delete[] data_[i];
|
||||||
delete[] data_;
|
delete[] data_;
|
||||||
if (tex_ids_) {
|
if (tex_ids_) {
|
||||||
glDeleteTextures(num_tex_, tex_ids_);
|
glDeleteTextures(num_tex_ * num_images_, tex_ids_);
|
||||||
delete[] tex_ids_;
|
delete[] tex_ids_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
costume.cpp
13
costume.cpp
|
@ -91,8 +91,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
std::string zbuf_filename_;
|
|
||||||
ResPtr<Bitmap> bitmap_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModelComponent : public Costume::Component {
|
class ModelComponent : public Costume::Component {
|
||||||
|
@ -154,13 +152,16 @@ private:
|
||||||
BitmapComponent::BitmapComponent(Costume::Component *parent, int parentID,
|
BitmapComponent::BitmapComponent(Costume::Component *parent, int parentID,
|
||||||
const char *filename) :
|
const char *filename) :
|
||||||
Costume::Component(parent, parentID), filename_(filename) {
|
Costume::Component(parent, parentID), filename_(filename) {
|
||||||
|
|
||||||
bitmap_ = ResourceLoader::instance()->loadBitmap(filename);
|
|
||||||
warning("Instanced BitmapComponenet from Costume renderer with filename %s: NOT IMPLEMENTED YET", filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapComponent::setKey(int val) {
|
void BitmapComponent::setKey(int val) {
|
||||||
// bitmap_->setNumber(val);
|
ObjectState *state =
|
||||||
|
Engine::instance()->currScene()->findState(filename_.c_str());
|
||||||
|
if (state != NULL)
|
||||||
|
state->setNumber(val);
|
||||||
|
else
|
||||||
|
warning("Couldn't find bitmap %s in current scene\n",
|
||||||
|
filename_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelComponent::ModelComponent(Costume::Component *parent, int parentID,
|
ModelComponent::ModelComponent(Costume::Component *parent, int parentID,
|
||||||
|
|
|
@ -123,24 +123,26 @@ void Driver::finishActorDraw() {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Driver::drawDepthBitmap(int num, int x, int y, int w, int h, char **data) {
|
void Driver::drawDepthBitmap(int x, int y, int w, int h, char *data) {
|
||||||
if (num != 0) {
|
// if (num != 0) {
|
||||||
warning("Animation not handled yet in GL texture path !\n");
|
// warning("Animation not handled yet in GL texture path !\n");
|
||||||
}
|
// }
|
||||||
|
|
||||||
glRasterPos2i(x, y);
|
if (y + h == 480) {
|
||||||
|
glRasterPos2i(x, 479);
|
||||||
|
glBitmap(0, 0, 0, 0, 0, -1, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
glRasterPos2i(x, y + h);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
// This loop here is to prevent using PixelZoom that may be unoptimized for the 1.0 / -1.0 case
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||||
// in some drivers...
|
glDrawPixels(w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data);
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
|
|
||||||
for (int row = 0; row < h; row++) {
|
|
||||||
glRasterPos2i(x, y + row + 1);
|
|
||||||
//glDrawPixels(w, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data[num] + (2 * row * w));
|
|
||||||
}
|
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Driver {
|
||||||
void startActorDraw(Vector3d pos, float yaw, float pitch, float roll);
|
void startActorDraw(Vector3d pos, float yaw, float pitch, float roll);
|
||||||
void finishActorDraw();
|
void finishActorDraw();
|
||||||
|
|
||||||
void drawDepthBitmap(int num, int x, int y, int w, int h, char **data);
|
void drawDepthBitmap(int x, int y, int w, int h, char *data);
|
||||||
void drawBitmap();
|
void drawBitmap();
|
||||||
|
|
||||||
void drawHackFont(int x, int y, const char *text, Color &fgColor);
|
void drawHackFont(int x, int y, const char *text, Color &fgColor);
|
||||||
|
|
10
lua.cpp
10
lua.cpp
|
@ -1095,18 +1095,12 @@ static void NewObjectState() {
|
||||||
ObjectState::Position pos = check_objstate_pos(2); // When to draw
|
ObjectState::Position pos = check_objstate_pos(2); // When to draw
|
||||||
char *bitmap = luaL_check_string(3); // Bitmap
|
char *bitmap = luaL_check_string(3); // Bitmap
|
||||||
char *zbitmap = NULL; // Zbuffer Bitmap
|
char *zbitmap = NULL; // Zbuffer Bitmap
|
||||||
bool unk1 = getbool(5); // ?
|
bool visible = getbool(5); // Starts visible?
|
||||||
bool unk2 = getbool(6);
|
|
||||||
|
|
||||||
if (!lua_isnil(lua_getparam(4)))
|
if (!lua_isnil(lua_getparam(4)))
|
||||||
zbitmap = luaL_check_string(4);
|
zbitmap = luaL_check_string(4);
|
||||||
|
|
||||||
#ifndef OSX
|
object = new ObjectState(setupID, pos, bitmap, zbitmap, visible);
|
||||||
warning("Stub: newObjectState(%d, %d, %s, %s)", setupID, pos, bitmap, zbitmap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
object = new ObjectState(setupID, pos, bitmap, zbitmap,
|
|
||||||
unk1, unk2);
|
|
||||||
Engine::instance()->currScene()->addObjectState(object);
|
Engine::instance()->currScene()->addObjectState(object);
|
||||||
lua_pushusertag(object, object_tag);
|
lua_pushusertag(object, object_tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,16 @@
|
||||||
|
|
||||||
ObjectState::ObjectState(int setupID, ObjectState::Position pos,
|
ObjectState::ObjectState(int setupID, ObjectState::Position pos,
|
||||||
const char *bitmap, const char *zbitmap,
|
const char *bitmap, const char *zbitmap,
|
||||||
bool unk1, bool unk2) :
|
bool visible) :
|
||||||
setupID_(setupID), pos_(pos), unk1_(unk1), unk2_(unk2) {
|
setupID_(setupID), pos_(pos) {
|
||||||
bitmap_ = ResourceLoader::instance()->loadBitmap(bitmap);
|
bitmap_ = ResourceLoader::instance()->loadBitmap(bitmap);
|
||||||
if (zbitmap)
|
if (zbitmap)
|
||||||
zbitmap_ = ResourceLoader::instance()->loadBitmap(zbitmap);
|
zbitmap_ = ResourceLoader::instance()->loadBitmap(zbitmap);
|
||||||
|
|
||||||
|
int initialImage = 0;
|
||||||
|
if (visible)
|
||||||
|
initialImage = 1;
|
||||||
|
bitmap_->setNumber(initialImage);
|
||||||
|
if (zbitmap_)
|
||||||
|
zbitmap_->setNumber(initialImage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ObjectState {
|
||||||
|
|
||||||
ObjectState(int setupID, ObjectState::Position pos,
|
ObjectState(int setupID, ObjectState::Position pos,
|
||||||
const char *bitmap, const char *zbitmap,
|
const char *bitmap, const char *zbitmap,
|
||||||
bool unk1, bool unk2);
|
bool visible);
|
||||||
|
|
||||||
int setupID() const { return setupID_; }
|
int setupID() const { return setupID_; }
|
||||||
Position pos() const { return pos_; }
|
Position pos() const { return pos_; }
|
||||||
|
@ -26,6 +26,11 @@ class ObjectState {
|
||||||
return bitmap_->filename();
|
return bitmap_->filename();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setNumber(int val) {
|
||||||
|
bitmap_->setNumber(val);
|
||||||
|
if (zbitmap_)
|
||||||
|
zbitmap_->setNumber(val);
|
||||||
|
}
|
||||||
void draw() {
|
void draw() {
|
||||||
bitmap_->draw();
|
bitmap_->draw();
|
||||||
if (zbitmap_)
|
if (zbitmap_)
|
||||||
|
@ -36,7 +41,6 @@ class ObjectState {
|
||||||
int setupID_;
|
int setupID_;
|
||||||
Position pos_;
|
Position pos_;
|
||||||
ResPtr<Bitmap> bitmap_, zbitmap_;
|
ResPtr<Bitmap> bitmap_, zbitmap_;
|
||||||
bool unk1_, unk2_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -169,3 +169,12 @@ void Scene::drawBitmaps(ObjectState::Position stage) {
|
||||||
(*i)->draw();
|
(*i)->draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectState *Scene::findState(const char *filename) {
|
||||||
|
for (StateList::iterator i = states_.begin(); i != states_.end();
|
||||||
|
i++) {
|
||||||
|
if (strcmp((*i)->bitmapFilename(), filename) == 0)
|
||||||
|
return *i;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
1
scene.h
1
scene.h
|
@ -70,6 +70,7 @@ public:
|
||||||
void addObjectState(ObjectState *s) {
|
void addObjectState(ObjectState *s) {
|
||||||
states_.push_back(s);
|
states_.push_back(s);
|
||||||
}
|
}
|
||||||
|
ObjectState *findState(const char *filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Setup { // Camera setup data
|
struct Setup { // Camera setup data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue