Ejemplo n.º 1
0
static void reset_spec(az_zfxr_state_t *state) {
    az_sound_spec_t *spec = &state->sound_spec;
    AZ_ZERO_OBJECT(spec);
    spec->wave_kind = AZ_SQUARE_WAVE;
    spec->env_sustain = 0.3f;
    spec->env_decay = 0.4f;
    spec->start_freq = 0.3f;
    state->request_play = true;
}
Ejemplo n.º 2
0
void az_init_zfxr_state(az_zfxr_state_t *state) {
    AZ_ZERO_OBJECT(state);
    state->sound_spec.wave_kind = AZ_TRIANGLE_WAVE;
    state->sound_spec.env_decay = 0.375;
    state->sound_spec.start_freq = 0.25;
    state->sound_spec.freq_slide = 0.25;
    az_create_sound_data(&state->sound_spec, &state->sound_data);
    state->request_play = true;
}
Ejemplo n.º 3
0
void az_init_projectile(az_projectile_t *proj, az_proj_kind_t kind,
                        az_vector_t position, double angle, double power,
                        az_uid_t fired_by) {
  assert(kind != AZ_PROJ_NOTHING);
  assert(power > 0.0);
  AZ_ZERO_OBJECT(proj);
  proj->kind = kind;
  const int data_index = (int)kind;
  assert(0 <= data_index && data_index < AZ_ARRAY_SIZE(proj_data));
  proj->data = &proj_data[data_index];
  proj->position = position;
  proj->velocity = az_vpolar(proj->data->speed, angle);
  proj->angle = angle;
  proj->power = power;
  proj->fired_by = fired_by;
  proj->last_hit_uid = AZ_NULL_UID;
}
Ejemplo n.º 4
0
void az_destroy_planet(az_planet_t *planet) {
  assert(planet != NULL);
  az_free_script(planet->on_start);
  for (int i = 0; i < planet->num_paragraphs; ++i) {
    free(planet->paragraphs[i]);
  }
  free(planet->paragraphs);
  for (int i = 0; i < planet->num_zones; ++i) {
    free(planet->zones[i].name);
    free(planet->zones[i].entering_message);
  }
  free(planet->zones);
  for (int i = 0; i < planet->num_rooms; ++i) {
    az_destroy_room(&planet->rooms[i]);
  }
  free(planet->rooms);
  AZ_ZERO_OBJECT(planet);
}