mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 19:51:49 +00:00
implemented zoomed rendering
svn-id: r45962
This commit is contained in:
parent
f70473e3cd
commit
da1432cf21
@ -31,7 +31,7 @@ Actor::Actor() : head_index(0) {}
|
||||
|
||||
//idle animation lists at dseg: 0x6540
|
||||
|
||||
Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool render_head) {
|
||||
Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool render_head, uint zoom) {
|
||||
const uint8 frames_left_right[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
const uint8 frames_up[] = {18, 19, 20, 21, 22, 23, 24, 25, };
|
||||
const uint8 frames_down[] = {10, 11, 12, 13, 14, 15, 16, 17, };
|
||||
@ -137,10 +137,10 @@ Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &posi
|
||||
if (yp + clip.top + clip.height() > 200)
|
||||
yp = 200 - clip.top - clip.height();
|
||||
|
||||
dirty = s->render(surface, xp, yp + clip.top, orientation == Object::kActorLeft, clip);
|
||||
dirty = s->render(surface, xp, yp + clip.top, orientation == Object::kActorLeft, clip, zoom);
|
||||
|
||||
if (head != NULL)
|
||||
dirty.extend(head->render(surface, xp, yp, orientation == Object::kActorLeft));
|
||||
dirty.extend(head->render(surface, xp, yp, orientation == Object::kActorLeft, Common::Rect(), zoom));
|
||||
|
||||
return dirty;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class Actor : public Animation {
|
||||
uint head_index;
|
||||
public:
|
||||
Actor();
|
||||
Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool head);
|
||||
Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool head, uint zoom);
|
||||
};
|
||||
|
||||
} // End of namespace TeenAgent
|
||||
|
@ -666,6 +666,10 @@ bool Scene::render(OSystem *system) {
|
||||
got_any_animation = true;
|
||||
} else if (!hide_actor) {
|
||||
actor_animation.free();
|
||||
uint zoom = 256;
|
||||
if (_id == 18) { //zoom hack
|
||||
zoom = 192;
|
||||
}
|
||||
|
||||
if (!path.empty()) {
|
||||
const int speed_x = 10, speed_y = 5;
|
||||
@ -691,7 +695,7 @@ bool Scene::render(OSystem *system) {
|
||||
position.x += (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x);
|
||||
position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y);
|
||||
|
||||
actor_animation_position = teenagent.render(surface, position, o, 1, false);
|
||||
actor_animation_position = teenagent.render(surface, position, o, 1, false, zoom);
|
||||
if (position == destination) {
|
||||
path.pop_front();
|
||||
if (path.empty()) {
|
||||
@ -705,7 +709,7 @@ bool Scene::render(OSystem *system) {
|
||||
} else
|
||||
busy = true;
|
||||
} else
|
||||
actor_animation_position = teenagent.render(surface, position, orientation, 0, actor_talking);
|
||||
actor_animation_position = teenagent.render(surface, position, orientation, 0, actor_talking, zoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void Surface::load(Common::SeekableReadStream *stream, Type type) {
|
||||
stream->read(pixels, w_ * h_);
|
||||
}
|
||||
|
||||
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect) const {
|
||||
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect, uint zoom) const {
|
||||
if (src_rect.isEmpty()) {
|
||||
src_rect = Common::Rect(0, 0, w, h);
|
||||
} else if (src_rect.right > w)
|
||||
@ -70,20 +70,41 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi
|
||||
else if (src_rect.bottom < h)
|
||||
src_rect.bottom = h;
|
||||
|
||||
assert(x + dx + src_rect.width() <= surface->w);
|
||||
assert(y + dy + src_rect.height() <= surface->h);
|
||||
if (zoom == 256) {
|
||||
assert(x + dx + src_rect.width() <= surface->w);
|
||||
assert(y + dy + src_rect.height() <= surface->h);
|
||||
|
||||
byte *src = (byte *)getBasePtr(src_rect.left, src_rect.top);
|
||||
byte *dst = (byte *)surface->getBasePtr(dx + x, dy + y);
|
||||
byte *src = (byte *)getBasePtr(src_rect.left, src_rect.top);
|
||||
byte *dst = (byte *)surface->getBasePtr(dx + x, dy + y);
|
||||
|
||||
for (int i = src_rect.top; i < src_rect.bottom; ++i) {
|
||||
for (int j = src_rect.left; j < src_rect.right; ++j) {
|
||||
byte p = src[j];
|
||||
if (p != 0xff)
|
||||
dst[mirror? w - j - 1: j] = p;
|
||||
for (int i = src_rect.top; i < src_rect.bottom; ++i) {
|
||||
for (int j = src_rect.left; j < src_rect.right; ++j) {
|
||||
byte p = src[j];
|
||||
if (p != 0xff)
|
||||
dst[mirror? w - j - 1: j] = p;
|
||||
}
|
||||
dst += surface->pitch;
|
||||
src += pitch;
|
||||
}
|
||||
} else {
|
||||
Common::Rect dst_rect(src_rect);
|
||||
dst_rect.right = (dst_rect.width() * zoom / 256) + dst_rect.left;
|
||||
dst_rect.top = dst_rect.bottom - (dst_rect.height() * zoom / 256);
|
||||
|
||||
assert(x + dx + dst_rect.width() <= surface->w);
|
||||
assert(y + dy + dst_rect.height() <= surface->h);
|
||||
|
||||
byte *dst = (byte *)surface->getBasePtr(dx + x, dy + y + dst_rect.top - src_rect.top);
|
||||
for(int i = 0; i < dst_rect.height(); ++i) {
|
||||
for (int j = 0; j < dst_rect.width(); ++j) {
|
||||
int px = j * 256 / zoom;
|
||||
byte *src = (byte *)getBasePtr(src_rect.left + (mirror? w - px - 1: px), src_rect.top + i * 256 / zoom);
|
||||
byte p = *src;
|
||||
if (p != 0xff)
|
||||
dst[j + dst_rect.left] = p;
|
||||
}
|
||||
dst += surface->pitch;
|
||||
}
|
||||
dst += surface->pitch;
|
||||
src += pitch;
|
||||
}
|
||||
return Common::Rect(x + dx, y + dy, x + w + dx, y + h + dy);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
Surface();
|
||||
void load(Common::SeekableReadStream *stream, Type type);
|
||||
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect()) const;
|
||||
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect(), uint zoom = 256) const;
|
||||
|
||||
bool empty() const { return pixels == NULL; }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user