Commit c63b6035 authored by newspaz's avatar newspaz

Corrected shooting positions of most shooting enemies. (E.g. the turtle tanks...

Corrected shooting positions of most shooting enemies. (E.g. the turtle tanks in fanolint and technoir did not work correctly.) Bullets will now shoot from the position that was set in the attack animation.

sprite.h, sprite.cpp
*) Changed draw method to include a parameter to enable or disable the drawing of sprite offsets (bullets do not use these offsets). The default behavior is to add the offset. 

bullet.cpp
*) Changed the draw method to disable sprite offsets, using the parameter that was mentioned earlier.
*) Slightly changed the way the y position of the bullet is determined in the event constructor.
parent bc47c7c2
......@@ -119,13 +119,23 @@ void Sprite::restorePalette () {
}
void Sprite::draw (int x, int y) {
void Sprite::draw (int x, int y, bool includeOffsets) {
SDL_Rect dst;
if (includeOffsets) {
dst.x = x + xOffset;
dst.y = y + yOffset;
}
else {
dst.x = x;
dst.y = y;
}
SDL_BlitSurface(pixels, NULL, canvas, &dst);
return;
......
......@@ -48,7 +48,7 @@ class Sprite {
void setPixels (unsigned char* data, int width, int height, unsigned char key);
int getWidth ();
int getHeight ();
void draw (int x, int y);
void draw (int x, int y, bool includeOffsets = true);
void drawScaled (int x, int y, fixed scale);
void setPalette (SDL_Color* palette, int start, int amount);
void flashPalette (int index);
......
......@@ -102,7 +102,7 @@ Bullet::Bullet (Event* sourceEvent, bool facing, unsigned int ticks) {
anim = level->getAnim(sourceEvent->getProperty(facing? E_LSHOOTANIM: E_RSHOOTANIM));
x = sourceEvent->getX() + anim->getShootX();
y = sourceEvent->getY() + anim->getShootY();
y = sourceEvent->getY() + anim->getShootY() - ITOF((sprite->getHeight() / 2) - 2);
dx = level->getBullet(type)[B_XSPEED + direction] * 500 * F1;
dy = level->getBullet(type)[B_YSPEED + direction] * 250 * F1;
time = ticks + T_BULLET;
......@@ -306,7 +306,7 @@ void Bullet::draw (int change) {
if (next) next->draw(change);
// Show the bullet
sprite->draw(FTOI(getDrawX(change)), FTOI(getDrawY(change)));
sprite->draw(FTOI(getDrawX(change)), FTOI(getDrawY(change)), false);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment