Example #1
0
/**
 * Stop any Explosion at position \a packed.
 * @param packed A packed position where no activities should take place (any more).
 */
static void Explosion_StopAtPosition(uint16 packed)
{
    Tile *t;
    uint8 i;

    t = &g_map[packed];

    if (!t->hasExplosion) return;

    for (i = 0; i < EXPLOSION_MAX; i++) {
        Explosion *e;

        e = &g_explosions[i];

        if (e->commands == NULL || Tile_PackTile(e->position) != packed) continue;

        Explosion_Func_Stop(e, 0);
    }
}
Example #2
0
/**
 * Timer tick for explosions.
 */
void Explosion_Tick()
{
	uint8 i;

	if (s_explosionTimer > g_timerGUI) return;
	s_explosionTimer += 10000;

	for (i = 0; i < EXPLOSION_MAX; i++) {
		Explosion *e;

		e = &g_explosions[i];

		if (e->commands == NULL) continue;

		if (e->timeOut <= g_timerGUI) {
			uint16 parameter = e->commands[e->current].parameter;
			uint16 command   = e->commands[e->current].command;

			e->current++;

			switch (command) {
				default:
				case EXPLOSION_STOP:               Explosion_Func_Stop(e, parameter); break;

				case EXPLOSION_SET_SPRITE:         Explosion_Func_SetSpriteID(e, parameter); break;
				case EXPLOSION_SET_TIMEOUT:        Explosion_Func_SetTimeout(e, parameter); break;
				case EXPLOSION_SET_RANDOM_TIMEOUT: Explosion_Func_SetRandomTimeout(e, parameter); break;
				case EXPLOSION_MOVE_Y_POSITION:    Explosion_Func_MoveYPosition(e, parameter); break;
				case EXPLOSION_TILE_DAMAGE:        Explosion_Func_TileDamage(e, parameter); break;
				case EXPLOSION_PLAY_VOICE:         Explosion_Func_PlayVoice(e, parameter); break;
				case EXPLOSION_SCREEN_SHAKE:       Explosion_Func_ScreenShake(e, parameter); break;
				case EXPLOSION_SET_ANIMATION:      Explosion_Func_SetAnimation(e, parameter); break;
				case EXPLOSION_BLOOM_EXPLOSION:    Explosion_Func_BloomExplosion(e, parameter); break;
			}
		}

		if (e->commands == NULL || e->timeOut > s_explosionTimer) continue;

		s_explosionTimer = e->timeOut;
	}
}