mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 08:55:45 +00:00
BLADERUNNER: fixed speed of pickup effect
formating, small fixes
This commit is contained in:
parent
b5c4e09cec
commit
f7acbcb057
@ -164,7 +164,7 @@ void Font::replaceColor(uint16 oldColor, uint16 newColor) {
|
||||
}
|
||||
|
||||
void Font::drawCharacter(const char character, Graphics::Surface &surface, int x, int y) {
|
||||
char characterIndex = character + 1;
|
||||
uint8 characterIndex = (uint8)character + 1;
|
||||
if (x < 0 || x >= _screenWidth || y < 0 || y >= _screenHeight || !_data || characterIndex >= _characterCount) {
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace BladeRunner {
|
||||
|
||||
ItemPickup::ItemPickup(BladeRunnerEngine *vm) {
|
||||
_vm = vm;
|
||||
_facingStep = float(1.0f / 3000.0f * M_PI);
|
||||
_facingStep = float(2.0f / 3000.0f * (2.0f * M_PI));
|
||||
reset();
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ void ItemPickup::tick() {
|
||||
_facing -= float(2.0f * M_PI);
|
||||
}
|
||||
|
||||
_animationFrame = ((int)(_animationFrame + 1)) % ((int)_vm->_sliceAnimations->getFrameCount(_animationId));
|
||||
_animationFrame = (_animationFrame + 1) % _vm->_sliceAnimations->getFrameCount(_animationId);
|
||||
}
|
||||
|
||||
void ItemPickup::draw() {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#define BLADERUNNER_ITEMPICKUP_H
|
||||
|
||||
#include "common/rect.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace BladeRunner {
|
||||
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
SlicePalette &getPalette(int i) { return _palettes[i]; };
|
||||
void *getFramePtr(uint32 animation, uint32 frame);
|
||||
|
||||
float getFrameCount(int animation){ return _animations[animation].frameCount; }
|
||||
int getFrameCount(int animation){ return _animations[animation].frameCount; }
|
||||
float getFPS(int animation){ return _animations[animation].fps; }
|
||||
|
||||
Vector3 getPositionChange(int animation);
|
||||
|
@ -460,10 +460,9 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
|
||||
_framePaletteIndex = stream.readUint32LE();
|
||||
_frameSliceCount = stream.readUint32LE();
|
||||
|
||||
float v47 = _frameSliceHeight * _frameSliceCount;
|
||||
float v50 = sqrtf(_frameScale.x * 255.0f * _frameScale.x * 255.0f + _frameScale.y * 255.0f * _frameScale.y * 255.0f);
|
||||
float v16 = MAX(v50, v47);
|
||||
float v51 = scale / v16;
|
||||
float frameHeight = _frameSliceHeight * _frameSliceCount;
|
||||
float frameSize = sqrtf(_frameScale.x * 255.0f * _frameScale.x * 255.0f + _frameScale.y * 255.0f * _frameScale.y * 255.0f);
|
||||
float size = scale / MAX(frameSize, frameHeight);
|
||||
|
||||
float s = sinf(_facing);
|
||||
float c = cosf(_facing);
|
||||
@ -474,7 +473,7 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
|
||||
Matrix3x2 m_frame(_frameScale.x, 0.0f, _framePos.x,
|
||||
0.0f, _frameScale.y, _framePos.y);
|
||||
|
||||
Matrix3x2 m_scale_v51_25_5(v51, 0.0f, 0.0f,
|
||||
Matrix3x2 m_scale_size_25_5(size, 0.0f, 0.0f,
|
||||
0.0f, 25.5f, 0.0f);
|
||||
|
||||
Matrix3x2 m_translate_x_32k(1.0f, 0.0f, screenX,
|
||||
@ -483,7 +482,7 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
|
||||
Matrix3x2 m_scale_64k_64(65536.0f, 0.0f, 0.0f,
|
||||
0.0f, 64.0f, 0.0f);
|
||||
|
||||
Matrix3x2 m = m_scale_64k_64 * (m_translate_x_32k * (m_scale_v51_25_5 * (m_rotation * m_frame)));
|
||||
Matrix3x2 m = m_scale_64k_64 * (m_translate_x_32k * (m_scale_size_25_5 * (m_rotation * m_frame)));
|
||||
|
||||
setupLookupTable(_m11lookup, m(0, 0));
|
||||
setupLookupTable(_m12lookup, m(0, 1));
|
||||
@ -492,18 +491,20 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
|
||||
setupLookupTable(_m22lookup, m(1, 1));
|
||||
_m23 = m(1, 2);
|
||||
|
||||
float v32 = 1.0f / v51 / _frameSliceHeight;
|
||||
float currentSlice = 0;// _frameSliceCount;
|
||||
|
||||
int frameY = screenY + (v51 / 2.0f * v47);
|
||||
int frameY = screenY + (size / 2.0f * frameHeight);
|
||||
int currentY = frameY;
|
||||
|
||||
float currentSlice = 0;
|
||||
float sliceStep = 1.0f / size / _frameSliceHeight;
|
||||
|
||||
uint16 *frameLinePtr = (uint16*)surface.getPixels() + 640 * frameY;
|
||||
uint16 lineZbuffer[640];
|
||||
|
||||
while (currentSlice < _frameSliceCount) {
|
||||
if (currentY >= 0 && currentY < 480) {
|
||||
memset(lineZbuffer, 0xFF, 640 * 2);
|
||||
drawSlice(currentSlice, false, frameLinePtr, lineZbuffer);
|
||||
currentSlice += v32;
|
||||
currentSlice += sliceStep;
|
||||
currentY--;
|
||||
frameLinePtr -= 640;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user