mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
Use CLIP template for clipping in the SAGA engine
svn-id: r29855
This commit is contained in:
parent
40661e5698
commit
1e483cc857
@ -697,16 +697,10 @@ ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) {
|
||||
// Both of them are invisible and immovable
|
||||
// There is no point to keep throwing warnings about this, the original checks for
|
||||
// a valid framecount too
|
||||
if (0 == actor->_framesCount) {
|
||||
if (actor->_framesCount == 0) {
|
||||
return &def;
|
||||
}
|
||||
if (frameType >= actor->_framesCount) {
|
||||
frameType = actor->_framesCount - 1;
|
||||
}
|
||||
if (frameType < 0) {
|
||||
frameType = 0;
|
||||
}
|
||||
|
||||
frameType = CLIP(frameType, 0, actor->_framesCount - 1);
|
||||
fourDirection = actorDirectectionsLUT[actor->_facingDirection];
|
||||
return &actor->_frames[frameType].directions[fourDirection];
|
||||
}
|
||||
|
@ -407,10 +407,8 @@ void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 num
|
||||
PalEntry *palE;
|
||||
double fpercent;
|
||||
|
||||
from = from > 256 ? 256 : from;
|
||||
from = from < 0 ? 0 : from;
|
||||
to = to > 256 ? 256 : to;
|
||||
to = to < 0 ? 0 : to;
|
||||
from = CLIP((int)from, 0, 256);
|
||||
to = CLIP((int)to, 0, 256);
|
||||
|
||||
if (from == 0 || to == 0) {
|
||||
// This case works like palToBlack or blackToPal, so no changes are needed
|
||||
|
@ -26,9 +26,7 @@
|
||||
// Isometric level module
|
||||
|
||||
#include "saga/saga.h"
|
||||
|
||||
#include "saga/gfx.h"
|
||||
|
||||
#include "saga/sagaresnames.h"
|
||||
#include "saga/scene.h"
|
||||
#include "saga/isomap.h"
|
||||
@ -405,23 +403,10 @@ void IsoMap::drawSprite(Surface *ds, SpriteList &spriteList, int spriteNumber, c
|
||||
spritePointer.x = screenPosition.x + xAlign;
|
||||
spritePointer.y = screenPosition.y + yAlign;
|
||||
|
||||
_tileClip.left = spritePointer.x;
|
||||
_tileClip.top = spritePointer.y;
|
||||
_tileClip.right = spritePointer.x + width;
|
||||
_tileClip.bottom = spritePointer.y + height;
|
||||
|
||||
if (_tileClip.left < 0) {
|
||||
_tileClip.left = 0;
|
||||
}
|
||||
if (_tileClip.right > _vm->getDisplayWidth()) {
|
||||
_tileClip.right = _vm->getDisplayWidth();
|
||||
}
|
||||
if (_tileClip.top < 0) {
|
||||
_tileClip.top = 0;
|
||||
}
|
||||
if (_tileClip.bottom > _vm->_scene->getHeight()) {
|
||||
_tileClip.bottom = _vm->_scene->getHeight();
|
||||
}
|
||||
_tileClip.left = CLIP((int)spritePointer.x, 0, _vm->getDisplayWidth());
|
||||
_tileClip.right = CLIP((int)spritePointer.x + width, 0, _vm->getDisplayWidth());
|
||||
_tileClip.top = CLIP((int)spritePointer.y, 0, _vm->_scene->getHeight());
|
||||
_tileClip.bottom = CLIP((int)spritePointer.y + height, 0, _vm->_scene->getHeight());
|
||||
|
||||
_vm->_sprite->drawClip(ds, clip, spritePointer, width, height, spriteBuffer);
|
||||
drawTiles(ds, &location);
|
||||
|
@ -240,10 +240,7 @@ MusicPlayer::~MusicPlayer() {
|
||||
}
|
||||
|
||||
void MusicPlayer::setVolume(int volume) {
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
else if (volume > 255)
|
||||
volume = 255;
|
||||
volume = CLIP(volume, 0, 255);
|
||||
|
||||
if (_masterVolume == volume)
|
||||
return;
|
||||
|
@ -207,15 +207,8 @@ void Sprite::drawClip(Surface *ds, const Rect &clipRect, const Point &spritePoin
|
||||
bufRowPointer = (byte *)ds->pixels + ds->pitch * spritePointer.y;
|
||||
srcRowPointer = spriteBuffer;
|
||||
|
||||
clipWidth = width;
|
||||
if (width > (clipRect.right - spritePointer.x)) {
|
||||
clipWidth = (clipRect.right - spritePointer.x);
|
||||
}
|
||||
|
||||
clipHeight = height;
|
||||
if (height > (clipRect.bottom - spritePointer.y)) {
|
||||
clipHeight = (clipRect.bottom - spritePointer.y);
|
||||
}
|
||||
clipWidth = CLIP(width, 0, clipRect.right - spritePointer.x);
|
||||
clipHeight = CLIP(height, 0, clipRect.bottom - spritePointer.y);
|
||||
|
||||
jo = 0;
|
||||
io = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user