93 void demo(
float sim_seconds);
96 std::vector<MeshParticle>
effect_meshes()
const {
return effects.meshes(); }
122 std::vector<std::pair<std::string, std::array<float, 3>>>
ambient_;
143 void voice(
int ch,
const float pos[3],
const std::string& tmpl,
int source,
bool killed);
154 SoundEvent(std::string t, std::array<float, 3> p,
int src = -1,
bool rel =
false,
bool fx =
false, std::string sc =
"",
int pa = 0)
159 int fire(
const WeaponDef& w,
const float pos[3],
const float vel[3],
int ignore_vehicle,
int ignore_character,
int tag);
168 std::map<std::string, std::string>
words;
176 bool has_muzzle =
false;
177 float next_fire = 0, exit[3] = {-2, 0, 0}, pos[3] = {};
180 std::string
lower, upper;
188 size_t first = 0, parts = 0;
189 bool plane =
false, ship =
false;
191 float len = 0, throttle = 0, muzzles_at = -1;
194 bool wrecked =
false;
195 size_t wreck_first = 0, wreck_parts = 0;
196 std::vector<Seat> seats;
198 bool gear_down =
true;
199 float gear_moving = 0;
206 std::vector<ArmorFx> armor_fx;
212 std::vector<PartFx> part_fx;
213 float wrecked_at = 0;
219 float down_height = 30, up_height = 20, down_input = 0.65f, up_input = 0.85f, travel = 1;
221 std::map<std::string, Gear> gears_;
222 void landing_gear(
float dt);
225 float pos[3] = {}, radius = 0, health = 0;
226 bool soldiers =
true, vehicles =
false;
228 std::map<int, float> ammo;
230 std::vector<Depot> depots;
231 void supply(
float step);
232 int nearest_depot(
const float pos[3],
int team,
const WeaponDef& w)
const;
234 float pos[3] = {}, yaw = 0;
236 int veh = -1, team = 0;
241 int ch = -1, team = 0;
243 size_t first = 0, parts = 0;
244 size_t held_first = 0, held_parts = 0;
245 float hp = 30, yaw = 0, pos[3] = {};
246 bool dead =
false, moving =
false;
250 int kit = 1, posture = 0;
253 float next_grenade = 0;
256 size_t side_first = 0, side_parts = 0;
257 WeaponDef mine, pack;
260 float next_fire = 0, seen_at = -1, next_look = 0, last_shot = -10;
261 bool was_reloading =
false;
263 float check_at = 0, check_pos[2] = {}, detour_until = 0, detour_side = 1;
264 int veh = -1, vseat = -1;
266 float reverse_until = 0;
268 std::vector<float> path;
274 const VehicleDef* def_for(
const std::string& name);
275 float ground(
float x,
float z)
const;
277 std::vector<float> route(
int ch,
const float pos[3],
float gx,
float gz)
const;
278 void add_vehicle(
const std::string& name, Mat4 world,
int team = 0);
279 const ConObject* object_template(
const std::string& n)
const;
280 float hitpoints(
const std::string& n)
const;
281 std::string primary(
int tm,
int kt)
const;
282 std::vector<std::string> kit_weapons(
int tm,
int kt)
const;
283 int spawn_team(
const SpawnPt& sp)
const;
285 void walk(
float forward,
float right,
bool jump,
bool slow);
287 float game_time()
const {
return now; }
290 void think(
float t,
float step);
291 void demo_play(
float sim_seconds);
296 Effects effects{con};
297 void effect(
const std::string& name,
const float pos[3],
const float dir[3] =
nullptr,
bool sound =
true);
298 void armor_effects();
300 const TerrainInfo& info;
301 std::vector<DrawItem>& scene;
304 std::vector<Veh> vehicles;
306 std::map<std::string, std::unique_ptr<VehicleDef>> defs;
308 int player = -1, team = 2;
310 void take_seat(
int s);
311 size_t sol_first = 0, sol_parts = 0;
312 std::map<int, std::string> team_skins;
314 std::string minimap_icon(
const std::string& tmpl,
float* size)
const;
315 std::map<std::pair<int, int>, std::string> kits;
316 std::string soldier_tmpl, weapon_name =
"M1Garand", lower_state =
"lb_stand";
317 float move_f = 0, move_r = 0;
320 std::vector<SpawnPt> spawn_points;
321 std::vector<Bot> bots;
325 bool troop_boat(
const Veh& v)
const {
return v.ship && !v.plane && v.len < 8; }
326 void disembark(Veh& v,
float t);
328 static bool on_sidearm(
const Bot& b,
float t) {
329 return !b.sidearm.name.empty() && !b.ammo.unlimited && b.ammo.rounds == 0 && b.ammo.spare == 0 && !b.ammo.reloading(t);
331 void lay_charges(Bot& b,
size_t bi,
float t);
332 void board(Bot& b,
float t);
333 void crew(Bot& b,
float t,
float step,
const float* target,
int target_veh);
335 void refresh_muzzles(Veh& v);
336 void seat_point(
const Veh& v,
size_t s,
float out[3])
const;
337 const Seat* shown_seat(
int veh,
int s)
const;
338 Mat4 seated(
int veh,
const Seat& st)
const;
339 std::array<int, 3> deaths{0, 0, 0};
341 int grenades_thrown = 0, boardings = 0, wrecks = 0, mines_laid = 0, packs_laid = 0;
345 std::vector<std::pair<WeaponDef, Ammo>> loadout;
347 std::vector<std::pair<size_t, size_t>> loadout_items;
348 size_t add_weapon_items(
const std::string& weapon);
349 void select(
size_t i);
350 void refill_loadout();
351 bool fire_held =
false;
352 float last_shot = -10;
353 bool was_reloading =
false;
355 void arm_states(SoldierView& v,
const std::string& w,
const WeaponDef& def,
const Ammo& ammo,
float shot,
int pose)
const;
357 size_t chute_first = 0, chute_parts = 0;
358 size_t fp_first = 0, fp_parts = 0;
359 bool first_person =
false;
360 float hands[3] = {-0.12f, -1.56f, 0.1f};
362 float fall_damage(
int character,
float full);
364 float eye_height()
const {
return posture == 2 ? 0.35f : posture == 1 ? 1.0f : 1.5f; }
365 static float body_height(
int p) {
return p == 2 ? 0.7f : p == 1 ? 1.2f : 1.8f; }
370 float radius = 0, at = 0;
372 std::vector<Placed> placed;
373 void placed_charges(
bool detonate);
374 float hand_next = 0, player_hp = 30, respawn_at = -1, now = 0;
375 bool player_dead =
false;
376 std::vector<std::pair<float, std::string>> feed;
377 void announce(
int patch);
379 float healed_sound_ = -10;
382 std::string text, extra, shown;
384 int radio = -1, voice = -1;
386 std::vector<RadioLine> radio_items()
const;
387 std::string word(
const std::string& key)
const;
388 int radio_menu_ = -1;
389 bool radio_bar_ =
true;
390 float radio_until_ = 0, tickets_start_ = 0;
391 void note(std::string m) {
392 while (!feed.empty() && now - feed.front().first > 6) feed.erase(feed.begin());
393 feed.emplace_back(now, std::move(m));
395 std::mt19937 rng{1942};