Fixed for point effects not showing.
This commit is contained in:
parent
6b25cc3c8b
commit
1f5af02441
|
@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
static void setRandomFlameHue(Effect *e);
|
||||
static void setRandomShieldHue(Effect *e);
|
||||
static void resizeDrawList(void);
|
||||
static int pointOnScreen(float x, float y);
|
||||
|
||||
static SDL_Texture *explosionTexture;
|
||||
static SDL_Texture *shieldHitTexture;
|
||||
|
@ -44,7 +45,7 @@ void initEffects(void)
|
|||
|
||||
void doEffects(void)
|
||||
{
|
||||
int i;
|
||||
int i, onScreen;
|
||||
Effect *e;
|
||||
Effect *prev = &battle.effectHead;
|
||||
|
||||
|
@ -77,7 +78,24 @@ void doEffects(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (e->type == EFFECT_LINE || collision(e->x - (e->size / 2) - battle.camera.x, e->y - (e->size / 2) - battle.camera.y, e->size * 2, e->size * 2, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
onScreen = 0;
|
||||
|
||||
switch (e->type)
|
||||
{
|
||||
case EFFECT_LINE:
|
||||
onScreen = pointOnScreen(e->x - battle.camera.x, e->y - battle.camera.y) || pointOnScreen(e->x + (e->dx * 3) - battle.camera.x, e->y + (e->dy * 3) - battle.camera.y);
|
||||
break;
|
||||
|
||||
case EFFECT_POINT:
|
||||
onScreen = pointOnScreen(e->x - battle.camera.x, e->y - battle.camera.y);
|
||||
break;
|
||||
|
||||
default:
|
||||
onScreen = collision(e->x - (e->size / 2) - battle.camera.x, e->y - (e->size / 2) - battle.camera.y, e->size * 2, e->size * 2, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
break;
|
||||
}
|
||||
|
||||
if (onScreen);
|
||||
{
|
||||
effectsToDraw[i++] = e;
|
||||
|
||||
|
@ -92,6 +110,11 @@ void doEffects(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int pointOnScreen(float x, float y)
|
||||
{
|
||||
return collision(x, y, 1, 1, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
static void resizeDrawList(void)
|
||||
{
|
||||
int i, n;
|
||||
|
|
Loading…
Reference in New Issue