/* * GRacer * * Copyright (C) 1999 Takashi Matsuda * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #ifndef __GRACER_WORLD_H__ #define __GRACER_WORLD_H__ #include "vehicle.h" typedef struct GrWorld GrWorld; typedef struct GrTrigger GrTrigger; typedef enum { GR_TRIGGER_LAP = 1 << 8, GR_TRIGGER_SPEED_LT = 1 << 9, GR_TRIGGER_SPEED_GT = 1 << 10, GR_TRIGGER_RPM_LT = 1 << 11, GR_TRIGGER_RPM_GT = 1 << 12, GR_TRIGGER_VEHICLE = 1 << 13, GR_TRIGGER_CLINE = 1 << 14, GR_TRIGGER_LAP_PLUS = 1 << 15, } GrTriggerCondition; typedef void (* GrTriggerFunc) (GrWorld *world, GrVehicle *vehicle, GrTrigger *trigger); struct GrTrigger { GrRef ref; GrVehicle *vehicle; GrTriggerFunc callback; GrTriggerCondition condition; int cline; int lap; double speed_lt, speed_gt; double rpm_lt, rpm_gt; }; struct GrWorld { GrRef ref; GrCourse *course_data; GrSList *vehicles; GrSList *triggers; double minimam_interval; double current_time; double previous_time; }; GrWorld* gr_world_new (void); void gr_world_set_course (GrWorld *world, GrCourse *course); void gr_world_add_vehicle (GrWorld *world, GrVehicle *vehicle); void gr_world_remove_vehicle (GrWorld *world, GrVehicle *vehicle); void gr_world_add_trigger (GrWorld *world, GrTrigger *trigger); void gr_world_remove_trigger (GrWorld *world, GrTrigger *trigger); void gr_world_remove_triggers_of_vehicle (GrWorld *world, GrVehicle *vehicle); void gr_world_remove_triggers (GrWorld *world); void gr_world_do_simulate (GrWorld *world, double interval); #endif /* __GRACER_WORLD_H__ */