aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kohaut2016-10-09 12:03:19 +0200
committerPeter Kohaut2016-10-09 12:03:19 +0200
commitf7acbcb057a2fcd455d3e163a99da9851a2e83ea (patch)
tree44fe3f37699906bc1a7805fcbaa58063729c8f9a
parentb5c4e09cec2a1c7280db969e4129609acf17e1c2 (diff)
downloadscummvm-rg350-f7acbcb057a2fcd455d3e163a99da9851a2e83ea.tar.gz
scummvm-rg350-f7acbcb057a2fcd455d3e163a99da9851a2e83ea.tar.bz2
scummvm-rg350-f7acbcb057a2fcd455d3e163a99da9851a2e83ea.zip
BLADERUNNER: fixed speed of pickup effect
formating, small fixes
-rw-r--r--engines/bladerunner/font.cpp2
-rw-r--r--engines/bladerunner/item_pickup.cpp4
-rw-r--r--engines/bladerunner/item_pickup.h1
-rw-r--r--engines/bladerunner/slice_animations.h2
-rw-r--r--engines/bladerunner/slice_renderer.cpp43
5 files changed, 26 insertions, 26 deletions
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp
index 124e9c967e..fd8b9f204d 100644
--- a/engines/bladerunner/font.cpp
+++ b/engines/bladerunner/font.cpp
@@ -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;
}
diff --git a/engines/bladerunner/item_pickup.cpp b/engines/bladerunner/item_pickup.cpp
index 9792493a78..aa293c2b9b 100644
--- a/engines/bladerunner/item_pickup.cpp
+++ b/engines/bladerunner/item_pickup.cpp
@@ -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() {
diff --git a/engines/bladerunner/item_pickup.h b/engines/bladerunner/item_pickup.h
index 0e7bc516ea..97d98ead36 100644
--- a/engines/bladerunner/item_pickup.h
+++ b/engines/bladerunner/item_pickup.h
@@ -24,7 +24,6 @@
#define BLADERUNNER_ITEMPICKUP_H
#include "common/rect.h"
-#include "graphics/surface.h"
namespace BladeRunner {
diff --git a/engines/bladerunner/slice_animations.h b/engines/bladerunner/slice_animations.h
index bed4271c88..b5b60ef096 100644
--- a/engines/bladerunner/slice_animations.h
+++ b/engines/bladerunner/slice_animations.h
@@ -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);
diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index 6398b2cbf4..510f029295 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -445,7 +445,7 @@ void SliceRenderer::drawOnScreen(int animationId, int animationFrame, int screen
_position.z = 0;
_facing = facing;
_sliceFramePtr = _vm->_sliceAnimations->getFramePtr(animationId, animationFrame);
- if(_sliceFramePtr == nullptr) {
+ if (_sliceFramePtr == nullptr) {
return;
}
@@ -460,11 +460,10 @@ 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,8 +473,8 @@ 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,
- 0.0f, 25.5f, 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,
0.0f, 1.0f, 32768.0f);
@@ -483,27 +482,29 @@ 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));
+ setupLookupTable(_m11lookup, m(0, 0));
+ setupLookupTable(_m12lookup, m(0, 1));
_m13 = m(0, 2);
- setupLookupTable(_m21lookup, m(1,0));
- setupLookupTable(_m22lookup, m(1,1));
+ setupLookupTable(_m21lookup, m(1, 0));
+ 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) {
+
+ 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;
}