void TempFigure::show(SDL_Rect* otherCamera) { if (marker == INACTIVE) return; else if (marker == REMOVE) { bool animationDone = true; marker = INACTIVE; if (animationDone) { if (Mix_PlayChannel(-1, scratch.getMix_Chunk(), 0) < 0) { printf("Mix_PlayChannel: %s\n", Mix_GetError()); throw SoundException(); } } } else if (marker == ACTIVE) { if (numClips > 0) { if (v.x < 0) { status = LEFT; animationFrame += AFVALUE; } else if (v.x > 0) { status = RIGHT; animationFrame += AFVALUE; } else animationFrame = 0; if (animationFrame >= numClips) animationFrame = 0; if (leader) { if (status == LEFT) applySurface((int) p.x - camera->x, (int) p.y - camera->y, *image, screen, &cl[static_cast<int>(animationFrame)]); else if (status == RIGHT) applySurface((int) p.x - camera->x, (int) p.y - camera->y, *image, screen, &cr[static_cast<int>(animationFrame)]); if (particleEffects) showParticles(camera); } else { if (status == LEFT) applySurface((int) p.x - otherCamera->x, (int) p.y - otherCamera->y, *image, screen, &cl[static_cast<int>(animationFrame)]); else if (status == RIGHT) applySurface((int) p.x - otherCamera->x, (int) p.y - otherCamera->y, *image, screen, &cr[static_cast<int>(animationFrame)]); if (particleEffects) showParticles(otherCamera); } } } else throw InvalidMarkerException(); }
Figure::Marker Figure::show(SDL_Rect* otherCamera) { if (marker == INACTIVE) return marker; else if (marker == REMOVE) { bool animationDone = false; marker = INACTIVE; if (animationDone) { //TODO: Add animation and sound for this //do a special animation if needed for however many frames } return marker; } else if (marker == ACTIVE) { if (numClips > 0) { if (v.x < 0) { status = LEFT; animationFrame += AFVALUE; } else if (v.x > 0) { status = RIGHT; animationFrame += AFVALUE; } else animationFrame = 0; if (animationFrame >= numClips) animationFrame = 0; if (leader) { if (status == LEFT) applySurface((int) p.x - camera->x, (int) p.y - camera->y, *image, screen, &cl[static_cast<int>(animationFrame)]); else if (status == RIGHT) applySurface((int) p.x - camera->x, (int) p.y - camera->y, *image, screen, &cr[static_cast<int>(animationFrame)]); if (particleEffects) showParticles(camera); } else { if (status == LEFT) applySurface((int) p.x - otherCamera->x, (int) p.y - otherCamera->y, *image, screen, &cl[static_cast<int>(animationFrame)]); else if (status == RIGHT) applySurface((int) p.x - otherCamera->x, (int) p.y - otherCamera->y, *image, screen, &cr[static_cast<int>(animationFrame)]); if (particleEffects) showParticles(otherCamera); } } return marker; } else throw InvalidMarkerException(); }