QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
NDEBUG ?= 1
+XONOTIC ?= 1
BUILD_MOD ?= 0
ifndef ZIP
-Wno-field-redeclared
QCCDEFS ?= \
+ -DXONOTIC=$(XONOTIC) \
-DWATERMARK="$(QCCFLAGS_WATERMARK)" \
-DNDEBUG=$(NDEBUG) \
-DBUILD_MOD=$(BUILD_MOD) \
--- /dev/null
+// generated file; do not modify
+#include "announcer.qh"
+#include "bgmscript.qh"
+#include "csqcmodel_hooks.qh"
+#include "main.qh"
+#include "mapvoting.qh"
+#include "miscfunctions.qh"
+#include "player_skeleton.qh"
+#include "scoreboard.qh"
+#include "shownames.qh"
+#include "teamradar.qh"
+#include "view.qh"
+#include "wall.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "cl_cmd.qh"
.int team;
.int team_size;
-float vid_conwidth, vid_conheight;
int binddb;
// QUALIFYING
float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power;
#endif
-float servertime, serverprevtime, serverdeltatime;
+float serverprevtime, serverdeltatime;
float ticrate;
--- /dev/null
+// generated file; do not modify
+#include "hud.qh"
+#include "hud_config.qh"
--- /dev/null
+// generated file; do not modify
+#include "ammo.qh"
+#include "centerprint.qh"
+#include "chat.qh"
+#include "engineinfo.qh"
+#include "healtharmor.qh"
+#include "infomessages.qh"
+#include "minigame.qh"
+#include "modicons.qh"
+#include "notify.qh"
+#include "physics.qh"
+#include "powerups.qh"
+#include "pressedkeys.qh"
+#include "quickmenu.qh"
+#include "racetimer.qh"
+#include "radar.qh"
+#include "score.qh"
+#include "timer.qh"
+#include "vote.qh"
+#include "weapons.qh"
--- /dev/null
+// generated file; do not modify
#include <lib/_all.inc>
-#include "_all.qh"
+#if XONOTIC
+ #include "_all.qh"
-#include "_mod.inc"
-#include "commands/_mod.inc"
-#include "hud/_mod.inc"
-#include "mutators/_mod.inc"
-#include "weapons/_mod.inc"
+ #include "_mod.inc"
+ #include "commands/_mod.inc"
+ #include "hud/_mod.inc"
+ #include "mutators/_mod.inc"
+ #include "weapons/_mod.inc"
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
+ #include <common/_all.inc>
+ #include <common/effects/qc/all.qc>
-#include <lib/csqcmodel/cl_model.qc>
-#include <lib/csqcmodel/cl_player.qc>
-#include <lib/csqcmodel/interpolate.qc>
+ #include <lib/csqcmodel/cl_model.qc>
+ #include <lib/csqcmodel/cl_player.qc>
+ #include <lib/csqcmodel/interpolate.qc>
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/client.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
+ #include <lib/warpzone/anglestransform.qc>
+ #include <lib/warpzone/common.qc>
+ #include <lib/warpzone/client.qc>
+ #include <lib/warpzone/server.qc>
+ #include <lib/warpzone/util_server.qc>
+#endif
+
+#include <ecs/_lib.inc>
#if BUILD_MOD
-#include "../../mod/client/progs.inc"
+ #include "../../mod/client/progs.inc"
#endif
--- /dev/null
+// generated file; do not modify
+#include "projectile.qh"
--- /dev/null
+// generated file; do not modify
+#include "anim.qh"
+#include "animdecide.qh"
+#include "campaign_file.qh"
+#include "campaign_setup.qh"
+#include "ent_cs.qh"
+#include "mapinfo.qh"
+#include "net_notice.qh"
+#include "playerstats.qh"
+#include "state.qh"
+#include "t_items.qh"
+#include "util.qh"
+#include "viewloc.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "generic.qh"
+#include "markup.qh"
+#include "rpn.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "effectinfo.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "casings.qh"
+#include "damageeffects.qh"
+#include "gibs.qh"
+#include "globalsound.qh"
+#include "lightningarc.qh"
+#include "modeleffects.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
--- /dev/null
+// generated file; do not modify
+#include "nexball.qh"
+#include "weapon.qh"
--- /dev/null
+// generated file; do not modify
+#include "cl_controlpoint.qh"
+#include "cl_generator.qh"
+#include "onslaught.qh"
+#include "sv_controlpoint.qh"
+#include "sv_generator.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "ammo.qh"
+#include "armor.qh"
+#include "health.qh"
+#include "jetpack.qh"
+#include "pickup.qh"
+#include "powerup.qh"
// generated file; do not modify
-#include "cl_minigames.qc"
#include "cl_minigames_hud.qc"
#include "minigames.qc"
-#include "sv_minigames.qc"
+#ifdef CSQC
+ #include "cl_minigames.qc"
+#endif
+#ifdef SVQC
+ #include "sv_minigames.qc"
+#endif
--- /dev/null
+// generated file; do not modify
+#include "cl_minigames_hud.qh"
+#include "minigames.qh"
--- /dev/null
+// generated file; do not modify
+#include "bd.qh"
+#include "c4.qh"
+#include "nmm.qh"
+#include "pong.qh"
+#include "pp.qh"
+#include "ps.qh"
+#include "snake.qh"
+#include "ttt.qh"
--- /dev/null
+// generated file; do not modify
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "spawn.qh"
+#include "sv_monsters.qh"
--- /dev/null
+// generated file; do not modify
+#include "mage.qh"
+#include "shambler.qh"
+#include "spider.qh"
+#include "wyvern.qh"
+#include "zombie.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
void RegisterHooks() {};
void RegisterCallbacks() {};
-#define _MUTATOR_HOOKABLE(id, ...) CallbackChain HOOK_##id; bool __Mutator_Send_##id(__VA_ARGS__)
-#define MUTATOR_HOOKABLE(id, params) \
- _MUTATOR_HOOKABLE(id, int params(_MUTATOR_HANDLE_PARAMS, _MUTATOR_HANDLE_NOP)) { \
+#define MUTATOR_HOOKABLE(id, params) _MUTATOR_HOOKABLE(id, params)
+#define _MUTATOR_HOOKABLE(id, params) \
+ CallbackChain HOOK_##id; \
+ bool __Mutator_Send_##id(int params(_MUTATOR_HANDLE_PARAMS, _MUTATOR_HANDLE_NOP)) { \
params(_MUTATOR_HANDLE_PUSHTMP, _MUTATOR_HANDLE_NOP) \
params(_MUTATOR_HANDLE_PREPARE, _MUTATOR_HANDLE_NOP) \
bool ret = CallbackChain_Call(HOOK_##id); \
return ret; \
} \
[[accumulate]] void RegisterHooks() { HOOK_##id = NEW(CallbackChain, #id); }
+
+#define MUTATOR_CALLHOOK(id, ...) _MUTATOR_CALLHOOK(id, __VA_ARGS__)
#ifdef __STDC__
- #define MUTATOR_CALLHOOK(id, ...) APPLY(__Mutator_Send_##id, 0 P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+ #define _MUTATOR_CALLHOOK(id, ...) APPLY(__Mutator_Send_##id, 0 P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
#else
- #define MUTATOR_CALLHOOK(id, ...) APPLY(__Mutator_Send_##id, 0, ##__VA_ARGS__)
+ #define _MUTATOR_CALLHOOK(id, ...) APPLY(__Mutator_Send_##id, 0, ##__VA_ARGS__)
#endif
enum {
--- /dev/null
+// generated file; do not modify
+#include "itemstime.qh"
--- /dev/null
+// generated file; do not modify
+#include "bloodloss.qh"
--- /dev/null
+// generated file; do not modify
+#include "breakablehook.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "buffs.qh"
--- /dev/null
+// generated file; do not modify
+#include "bugrigs.qh"
--- /dev/null
+// generated file; do not modify
+#include "campcheck.qh"
--- /dev/null
+// generated file; do not modify
+#include "cloaked.qh"
--- /dev/null
+// generated file; do not modify
+#include "damagetext.qh"
--- /dev/null
+// generated file; do not modify
+#include "dodging.qh"
--- /dev/null
+// generated file; do not modify
+#include "doublejump.qh"
--- /dev/null
+// generated file; do not modify
+#include "hook.qh"
--- /dev/null
+// generated file; do not modify
+#include "instagib.qh"
+#include "items.qh"
--- /dev/null
+// generated file; do not modify
+#include "invincibleproj.qh"
--- /dev/null
+// generated file; do not modify
+#include "melee_only.qh"
--- /dev/null
+// generated file; do not modify
+#include "midair.qh"
--- /dev/null
+// generated file; do not modify
+#include "multijump.qh"
--- /dev/null
+// generated file; do not modify
+#include "nades.qh"
+#include "net.qh"
--- /dev/null
+// generated file; do not modify
+#include "new_toys.qh"
--- /dev/null
+// generated file; do not modify
+#include "nix.qh"
--- /dev/null
+// generated file; do not modify
+#include "hmg.qh"
+#include "overkill.qh"
+#include "rpc.qh"
--- /dev/null
+// generated file; do not modify
+#include "physical_items.qh"
--- /dev/null
+// generated file; do not modify
+#include "pinata.qh"
--- /dev/null
+// generated file; do not modify
+#include "random_gravity.qh"
--- /dev/null
+// generated file; do not modify
+#include "rocketflying.qh"
--- /dev/null
+// generated file; do not modify
+#include "rocketminsta.qh"
--- /dev/null
+// generated file; do not modify
+#include "running_guns.qh"
--- /dev/null
+// generated file; do not modify
+#include "sandbox.qh"
--- /dev/null
+// generated file; do not modify
+#include "spawn_near_teammate.qh"
--- /dev/null
+// generated file; do not modify
+#include "superspec.qh"
--- /dev/null
+// generated file; do not modify
+#include "touchexplode.qh"
--- /dev/null
+// generated file; do not modify
+#include "vampire.qh"
--- /dev/null
+// generated file; do not modify
+#include "vampirehook.qh"
--- /dev/null
+// generated file; do not modify
+#include "waypointsprites.qh"
--- /dev/null
+// generated file; do not modify
+#include "weaponarena_random.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "movelib.qh"
+#include "player.qh"
--- /dev/null
+// generated file; do not modify
+#include "follow.qh"
+#include "movetypes.qh"
+#include "push.qh"
+#include "step.qh"
+#include "toss.qh"
+#include "walk.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "include.qh"
+#include "platforms.qh"
+#include "subs.qh"
+#include "teleporters.qh"
+#include "triggers.qh"
--- /dev/null
+// generated file; do not modify
+#include "bobbing.qh"
+#include "breakable.qh"
+#include "button.qh"
+#include "conveyor.qh"
+#include "door.qh"
+#include "door_rotating.qh"
+#include "door_secret.qh"
+#include "fourier.qh"
+#include "include.qh"
+#include "ladder.qh"
+#include "pendulum.qh"
+#include "plat.qh"
+#include "pointparticles.qh"
+#include "rainsnow.qh"
+#include "rotating.qh"
+#include "stardust.qh"
+#include "train.qh"
+#include "vectormamamam.qh"
--- /dev/null
+// generated file; do not modify
+#include "corner.qh"
+#include "follow.qh"
+#include "include.qh"
+#include "laser.qh"
+#include "teleport_dest.qh"
--- /dev/null
+// generated file; do not modify
+#include "changelevel.qh"
+#include "include.qh"
+#include "location.qh"
+#include "music.qh"
+#include "spawn.qh"
+#include "speaker.qh"
+#include "voicescript.qh"
--- /dev/null
+// generated file; do not modify
+#include "counter.qh"
+#include "delay.qh"
+#include "disablerelay.qh"
+#include "flipflop.qh"
+#include "gamestart.qh"
+#include "gravity.qh"
+#include "heal.qh"
+#include "hurt.qh"
+#include "impulse.qh"
+#include "include.qh"
+#include "jumppads.qh"
+#include "keylock.qh"
+#include "magicear.qh"
+#include "monoflop.qh"
+#include "multi.qh"
+#include "multivibrator.qh"
+#include "relay.qh"
+#include "relay_activators.qh"
+#include "relay_if.qh"
+#include "relay_teamcheck.qh"
+#include "secret.qh"
+#include "swamp.qh"
+#include "teleport.qh"
+#include "viewloc.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "checkpoint.qh"
+#include "cl_turrets.qh"
+#include "config.qh"
+#include "sv_turrets.qh"
+#include "targettrigger.qh"
+#include "util.qh"
--- /dev/null
+// generated file; do not modify
+#include "ewheel.qh"
+#include "ewheel_weapon.qh"
+#include "flac.qh"
+#include "flac_weapon.qh"
+#include "fusionreactor.qh"
+#include "hellion.qh"
+#include "hellion_weapon.qh"
+#include "hk.qh"
+#include "hk_weapon.qh"
+#include "machinegun.qh"
+#include "machinegun_weapon.qh"
+#include "mlrs.qh"
+#include "mlrs_weapon.qh"
+#include "phaser.qh"
+#include "phaser_weapon.qh"
+#include "plasma.qh"
+#include "plasma_dual.qh"
+#include "plasma_weapon.qh"
+#include "tesla.qh"
+#include "tesla_weapon.qh"
+#include "walker.qh"
+#include "walker_weapon.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "cl_vehicles.qh"
+#include "sv_vehicles.qh"
--- /dev/null
+// generated file; do not modify
+#include "bumblebee.qh"
+#include "bumblebee_weapons.qh"
+#include "racer.qh"
+#include "racer_weapon.qh"
+#include "raptor.qh"
+#include "raptor_weapons.qh"
+#include "spiderbot.qh"
+#include "spiderbot_weapons.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "calculations.qh"
+#include "config.qh"
--- /dev/null
+// generated file; do not modify
+#include "arc.qh"
+#include "blaster.qh"
+#include "crylink.qh"
+#include "devastator.qh"
+#include "electro.qh"
+#include "fireball.qh"
+#include "hagar.qh"
+#include "hlac.qh"
+#include "hook.qh"
+#include "machinegun.qh"
+#include "minelayer.qh"
+#include "mortar.qh"
+#include "porto.qh"
+#include "rifle.qh"
+#include "seeker.qh"
+#include "shockwave.qh"
+#include "shotgun.qh"
+#include "tuba.qh"
+#include "vaporizer.qh"
+#include "vortex.qh"
bool CSQC_InputEvent(int eventtype, int x, int y);
void CSQC_UpdateView(int width, int height);
-bool CSQC_ConsoleCommand(string cmd);
+bool CSQC_ConsoleCommand(string cmd); // catch commands registered with registercommand
bool CSQC_Parse_TempEntity();
bool CSQC_Parse_StuffCmd(string msg);
bool CSQC_Parse_Print(string msg);
void GameCommand(string cmd);
```
+
+# Misc
+
+## Trace
+
+### tracebox
+
+ void tracebox(vector v1, vector min, vector max, vector v2, int tryents, entity ignoreentity);
+
+attempt to move an object from v1 to v2 of given size
+
+tryents:
+ * MOVE_NORMAL (0)
+ * MOVE_NOMONSTERS (1): ignore monsters
+ * MOVE_MISSILE (2): +15 to every extent
+ * MOVE_WORLDONLY (3): ignore everything except bsp
+ * MOVE_HITMODEL (4): hit model, not bbox
+
+### traceline
+
+ void traceline(vector v1, vector v2, int tryents, entity ignoreentity);
+
+degenerate case of tracebox when min and max are equal
+
+### result globals
+
+ bool trace_allsolid;
+
+trace never left solid
+
+ bool trace_startsolid;
+
+trace started inside solid
+
+ float trace_fraction;
+
+distance before collision: 0..1, 1 if no collision
+
+ vector trace_endpos;
+
+v1 + (v2 - v1) * trace_fraction
+
+ vector trace_plane_normal;
+
+normalized plane normal, '0 0 0' if no collision.
+May be present if edges touch without clipping, use `trace_fraction < 1` as a determinant instead
+
+ float trace_plane_dist;
+
+
+
+ entity trace_ent;
+
+entity hit, if any
+
+ bool trace_inopen;
+
+
+
+ bool trace_inwater;
+
+
+
+ int trace_dpstartcontents;
+
+DPCONTENTS_ value at start position of trace
+
+ int trace_dphitcontents;
+
+DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
+
+ int trace_dphitq3surfaceflags;
+
+Q3SURFACEFLAG_ value of impacted surface
+
+ string trace_dphittexturename;
+
+texture name of impacted surface
+
+ int trace_networkentity;
+
+
--- /dev/null
+# Xonotic entity component system
+
+## guidelines
+
+* avoid #if and #ifdef
+* avoid string
+* avoid declaring entity fields outside of components
+* uncrustify relentlessly
+* shared code in $file, prog specific code uses prefix: { client: cl_, server: sv_, menu: ui_ }. $file must exist
+* component naming =~ com_$component_$name
+* system naming =~ sys_$system_$name
+* event naming =~ evt_$component_$name
+* global naming =~ g_$name
+* cvar naming =~ xon_$name
+
+## components
+
+ COMPONENT($component);
+ .float com_$component_$property;
+
+## entities
+
+ entity e = new(foo);
+ e.com_$component = true;
+ e.com_$component_$property = 42;
+
+## systems
+
+ SYSTEM($system);
+ sys_$system_update(entity, dt) {
+ code;
+ }
+
+## events
+
+### declaring
+
+ EVENT($component_$name, (entity this));
+
+### emitting
+
+ emit($event, it);
+
+### listening
+
+ entity listener = new_pure(someListener);
+ listener.evt_$event = void(entity this) { code; };
+ subscribe(listener, $event);
--- /dev/null
+#define COMPONENT(com) \
+ void com_##com##_interpolate(entity it, float a); \
+ .bool com_##com
+
+#define FOREACH_COMPONENT(com, body) FOREACH_ENTITY_FLOAT(com_##com, true, body)
+
+
+#define EVENT(T, args) .bool evt_##T##_listener; .void args evt_##T
+
+#define emit(T, ...) \
+ MACRO_BEGIN \
+ FOREACH_ENTITY_FLOAT_ORDERED(evt_##T##_listener, true, it.evt_##T(__VA_ARGS__)); \
+ MACRO_END
+
+#define subscribe(listener, T) \
+ MACRO_BEGIN \
+ listener.evt_##T##_listener = true; \
+ MACRO_END
+
+
+#define SYSTEM(sys, fps) \
+ void sys_##sys##_update(entity this, float dt); \
+ float autocvar_xon_sys_##sys##_dt = 1 / (fps)
+
+#define SYSTEM_UPDATE(sys, minfps) \
+ MACRO_BEGIN \
+ static float t = 0; \
+ float dt = autocvar_xon_sys_##sys##_dt; \
+ static float accumulator = 0; \
+ accumulator += min(frametime, 1 / (minfps)); \
+ while (accumulator >= dt) \
+ { \
+ time = t; \
+ FOREACH_COMPONENT(sys, sys_##sys##_update(it, dt)); \
+ t += dt; \
+ accumulator -= dt; \
+ } \
+ float a = accumulator / dt; \
+ FOREACH_COMPONENT(sys, com_##sys##_interpolate(it, a)); \
+ MACRO_END
+
+
+#include "_mod.inc"
+#include "components/_mod.inc"
+#include "events/_mod.inc"
+#include "systems/_mod.inc"
--- /dev/null
+// generated file; do not modify
+#include "main.qc"
+#ifdef CSQC
+ #include "cl_main.qc"
+#endif
--- /dev/null
+// generated file; do not modify
+#include "main.qh"
--- /dev/null
+#include "components/_mod.qh"
+
+#if !XONOTIC
+ entity me;
+
+ void CSQC_Init()
+ {
+ entity it = me = spawn();
+ it.mins = '-16 -16 -24';
+ it.maxs = '+16 +16 +45';
+ it.com_phys = true;
+ it.com_phys_nogravityonground = true;
+ it.com_phys_stepheight = 31;
+ it.com_phys_jumpvel = 260;
+ it.com_phys_friction = 6;
+ it.com_phys_gravity = 800;
+ }
+
+ void CSQC_UpdateView(float w, float h)
+ {
+ entity it = me;
+ it.com_in_move = input_movevalues;
+ it.com_in_angles = input_angles;
+ it.com_in_jump = input_buttons & BIT(1);
+ makevectors(it.com_in_angles);
+ vector dir = normalize(it.com_in_move);
+ vector upvec = '0 0 1';
+ vector vel = (v_forward * dir.x + v_right * dir.y + upvec * dir.z);
+ vel = vec_reflect(vel, upvec, 0);
+ vel = normalize(vel);
+ vel *= 360 * frametime * 8;
+ it.com_phys_vel += vel;
+
+ systems_update();
+
+ setproperty(VF_ORIGIN, it.origin + '0 0 35');
+ addentities(MASK_NORMAL); // .drawmask
+ renderscene();
+ clearscene();
+ }
+#endif
--- /dev/null
+// generated file; do not modify
+#include "input.qc"
+#include "physics.qc"
--- /dev/null
+// generated file; do not modify
+#include "input.qh"
+#include "physics.qh"
--- /dev/null
+#include "input.qh"
--- /dev/null
+#pragma once
+
+COMPONENT(in);
+.vector com_in_move;
+.vector com_in_angles;
+.bool com_in_jump;
--- /dev/null
+#include "physics.qh"
+
+bool autocvar_xon_com_phys_interpolate = true;
+
+void com_phys_interpolate(entity it, float a)
+{
+ if (!autocvar_xon_com_phys_interpolate) a = 1;
+ it.origin = it.com_phys_pos * a + it.com_phys_pos_prev * (1 - a);
+ // TODO: orientation (slerp it)
+}
--- /dev/null
+#pragma once
+
+COMPONENT(phys);
+.vector com_phys_pos;
+.vector com_phys_pos_prev;
+.vector com_phys_vel;
+.vector com_phys_acc;
+
+.bool com_phys_grounded;
+.bool com_phys_nogravityonground;
+.float com_phys_stepheight;
+.float com_phys_jumpvel;
+.float com_phys_bounce;
+.float com_phys_friction;
+.float com_phys_gravity;
--- /dev/null
+// generated file; do not modify
+#include "physics.qc"
--- /dev/null
+// generated file; do not modify
+#include "physics.qh"
--- /dev/null
+#include "physics.qh"
--- /dev/null
+#pragma once
+
+EVENT(phys_stepfall, (entity this));
+EVENT(phys_stepland, (entity this));
--- /dev/null
+#include "main.qh"
+
+#include "components/_mod.qh"
+#include "events/_mod.qh"
+#include "systems/_mod.qh"
+
+void systems_update()
+{
+ float realtime = time;
+ SYSTEM_UPDATE(phys, 10);
+ time = realtime;
+}
--- /dev/null
+#pragma once
+
+void systems_update();
--- /dev/null
+// generated file; do not modify
+#include "physics.qc"
--- /dev/null
+// generated file; do not modify
+#include "physics.qh"
--- /dev/null
+#include "physics.qh"
+
+const int PHYSICS_TRACE_PLANE_MAX = 5;
+
+// NOTE: currently unsuitable for players
+void sys_phys_update(entity this, float dt)
+{
+ // x: { 60: 0.5, 45: ~0.7, 30: ~0.9 }, from: 'vec2(0, 1) * vec2(cos(90 - x), sin(90 - x))'
+ // read as 'within x degrees'
+ float maxgrounddot = 0.5;
+ float maxstepdot = 0.7;
+ vector upvec = '0 0 1';
+ float groundsnap = 1;
+ bool jump = this.com_in_jump;
+ bool jumpstep = true;
+
+ vector mn = this.mins;
+ vector mx = this.maxs;
+
+ vector acc = this.com_phys_acc;
+ vector vel = this.com_phys_vel;
+ vector pos = this.com_phys_pos_prev = this.com_phys_pos;
+ bool onground = this.com_phys_grounded;
+
+ bool nogravityonground = this.com_phys_nogravityonground;
+ float stepheight = this.com_phys_stepheight;
+ float stepdownheight = -stepheight;
+ float jumpvel = this.com_phys_jumpvel;
+ float bounce = this.com_phys_bounce;
+ float friction = this.com_phys_friction;
+ float gravity = this.com_phys_gravity;
+
+ vector g = upvec * -gravity;
+
+ // apply accelaration in two steps: https://www.niksula.hut.fi/~hkankaan/Homepages/gravity.html
+ // alternatives: rk4, verlet, euler
+ vel += (acc + g) * dt / 2;
+ {
+ if (onground)
+ {
+ if (nogravityonground)
+ {
+ g = '0 0 0';
+ if (vel * upvec < 0) vel = vec_reflect(vel, upvec, 0); // kill downward velocity
+ }
+ if (jump)
+ {
+ vel += upvec * jumpvel;
+ }
+ else // the first landing frame is free
+ {
+ // friction
+ vector slide = vec_reflect(vel, upvec, 0);
+ vector push = vel - slide;
+ // TODO: slick
+ slide *= 1 - friction * dt;
+ vel = slide + push;
+ }
+ }
+ vector step = vel * dt;
+ bool pass = false;
+ bool foundground = false; // assume until proven otherwise
+ if (nogravityonground) foundground = true; // override
+ bool steplimit = 1;
+ for (int i = 0; i < PHYSICS_TRACE_PLANE_MAX; ++i)
+ {
+ vector p0 = pos;
+ vector p1 = p0 + step;
+ tracebox(p0, mn, mx, p1, MOVE_NORMAL, this);
+ float frac = trace_fraction;
+ vector norm = trace_plane_normal;
+ if (frac == 1)
+ {
+ // all clear
+ if (steplimit > 0 && onground && vel * upvec <= 0)
+ {
+ // can we step down?
+ tracebox(p1, mn, mx, p1 + upvec * stepdownheight, MOVE_NORMAL, this);
+ if (trace_fraction == 1)
+ {
+ // no stairs here
+ }
+ else if (trace_plane_normal * upvec >= maxstepdot)
+ {
+ // step down
+ step += upvec * (stepdownheight * trace_fraction);
+ }
+ }
+ pass = true;
+ break;
+ }
+ // hit something
+ if (norm * upvec >= maxgrounddot) foundground = true;
+ if (steplimit > 0 && (jumpstep || onground)) // try: vel * upvec >= 0
+ {
+ // can we step up?
+ vector slide = vec_reflect(step, upvec, 0); // remove fall component
+ vector p1 = p0 + slide; // step is here
+ tracebox(p1 + upvec * stepheight, mn, mx, p1, MOVE_NORMAL, this);
+ if (trace_fraction < 1 && trace_plane_normal * upvec >= maxstepdot)
+ {
+ // there is a step in front of us, get above it
+ // TODO: not if it's slippery (slick)
+ vector stepup = upvec * (1 - trace_fraction) * stepheight;
+ tracebox(p0, mn, mx, p0 + stepup, MOVE_NORMAL, this);
+ if (trace_fraction == 1)
+ {
+ // go over
+ tracebox(p0 + stepup, mn, mx, p1 + stepup, MOVE_NORMAL, this);
+ if (trace_fraction == 1)
+ {
+ // all clear
+ steplimit -= 1;
+ pos += stepup;
+ if (vel * upvec < 0) vel = vec_reflect(vel, upvec, 0); // kill downward velocity
+ step = p1 - p0;
+ pass = true;
+ break;
+ }
+ }
+ }
+ }
+ // no stairs here
+ pos += frac * step;
+ vel = vec_reflect(vel, norm, bounce);
+ step = (1 - frac) * vel * dt;
+ continue;
+ }
+ if (nogravityonground)
+ {
+ vector p1 = pos + step;
+ tracebox(p1, mn, mx, p1 - groundsnap * upvec, MOVE_NORMAL, this);
+ foundground = trace_plane_normal * upvec >= maxgrounddot;
+ }
+ if (pass)
+ {
+ pos += step;
+ if (!foundground)
+ {
+ if (onground) emit(phys_stepfall, this);
+ }
+ else
+ {
+ if (!onground) emit(phys_stepland, this);
+ }
+ onground = foundground;
+ }
+ }
+ vel += (acc + g) * dt / 2;
+
+ this.com_phys_acc = acc;
+ this.com_phys_vel = vel;
+ this.com_phys_pos = pos;
+ this.com_phys_grounded = onground;
+}
--- /dev/null
+#pragma once
+
+SYSTEM(phys, 30);
#include "macro.qh"
#if NDEBUG
- #define TC(T, sym) MACRO_BEGIN MACRO_END
+ #define TC(T, sym) MACRO_BEGIN MACRO_END
#else
- #define TC(T, sym) MACRO_BEGIN \
- if (!is_##T(sym)) { \
- LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
- isnt_##T(sym); \
- } \
- MACRO_END
+ #define TC(T, sym) \
+ MACRO_BEGIN \
+ if (!is_##T(sym)) \
+ { \
+ LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ isnt_##T(sym); \
+ } \
+ MACRO_END
#endif
-#define is_float( this) (true || ftoe(this))
-#define isnt_float( this)
-#define is_vector( this) (true || vtos(this))
-#define isnt_vector( this)
-#define is_string( this) (true || stof(this))
-#define isnt_string( this)
-#define is_entity( this) (true || etof(this))
-#define isnt_entity( this)
-bool is_int( float this) { return this == floor(this); }
-void isnt_int( float this) { print(ftos(this)); }
-bool is_bool( float this) { return this == true || this == false; }
-void isnt_bool( float this) { print(ftos(this)); }
+#define is_float(this) (true || ftoe(this))
+#define isnt_float(this)
+#define is_vector(this) (true || vtos(this))
+#define isnt_vector(this)
+#define is_string(this) (true || stof(this))
+#define isnt_string(this)
+#define is_entity(this) (true || etof(this))
+#define isnt_entity(this)
+bool is_int(float this) { return this == floor(this); }
+void isnt_int(float this) { print(ftos(this)); }
+bool is_bool(float this) { return this == true || this == false; }
+void isnt_bool(float this) { print(ftos(this)); }
#include "warpzone/mathlib.qc"
#include "vector.qh"
#include "yenc.qh"
-#include "matrix/_mod.inc"
+#ifdef MENUQC
+ void _m_init();
+ void m_init() { if (_m_init) _m_init(); }
+ #define m_init _m_init
+
+ void _m_shutdown();
+ void m_shutdown() { if (_m_shutdown) _m_shutdown(); }
+ #define m_shutdown _m_shutdown
+
+ void _m_draw(float width, float height);
+ void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
+ #define m_draw _m_draw
+
+ void _m_keydown(int keynr, int ascii);
+ void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
+ #define m_keydown _m_keydown
+
+ void _m_toggle(int mode);
+ void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
+ #define m_toggle _m_toggle
+#endif
+
+#ifdef SVQC
+ void _main();
+ void main() { if (_main) _main(); }
+ #define main _main
+
+ void _SV_Shutdown();
+ void SV_Shutdown() { if (_SV_Shutdown) _SV_Shutdown(); }
+ #define SV_Shutdown _SV_Shutdown
+
+ void _StartFrame();
+ void StartFrame() { if (_StartFrame) _StartFrame(); }
+ #define StartFrame _StartFrame
+
+ void _SetNewParms();
+ void SetNewParms() { if (_SetNewParms) _SetNewParms(); }
+ #define SetNewParms _SetNewParms
+
+ void _SetChangeParms();
+ void SetChangeParms() { if (_SetChangeParms) _SetChangeParms(); }
+ #define SetChangeParms _SetChangeParms
+
+ void _ClientConnect();
+ void ClientConnect() { if (_ClientConnect) _ClientConnect(); }
+ #define ClientConnect _ClientConnect
+
+ void _ClientDisconnect();
+ void ClientDisconnect() { if (_ClientDisconnect) _ClientDisconnect(); }
+ #define ClientDisconnect _ClientDisconnect
+
+ void _PutClientInServer();
+ void PutClientInServer() { if (_PutClientInServer) _PutClientInServer(); }
+ #define PutClientInServer _PutClientInServer
+
+ void _ClientKill();
+ void ClientKill() { if (_ClientKill) _ClientKill(); }
+ #define ClientKill _ClientKill
+
+ void _PlayerPreThink();
+ void PlayerPreThink() { if (_PlayerPreThink) _PlayerPreThink(); }
+ #define PlayerPreThink _PlayerPreThink
+
+ void _PlayerPostThink();
+ void PlayerPostThink() { if (_PlayerPostThink) _PlayerPostThink(); }
+ #define PlayerPostThink _PlayerPostThink
+#endif
+
+#ifdef CSQC
+ void _CSQC_Init();
+ void CSQC_Init() { if (_CSQC_Init) _CSQC_Init(); }
+ #define CSQC_Init _CSQC_Init
+
+ void _CSQC_Shutdown();
+ void CSQC_Shutdown() { if (_CSQC_Shutdown) _CSQC_Shutdown(); }
+ #define CSQC_Shutdown _CSQC_Shutdown
+
+ void _CSQC_UpdateView(float w, float h);
+ void CSQC_UpdateView(float w, float h) { if (_CSQC_UpdateView) _CSQC_UpdateView(w, h); }
+ #define CSQC_UpdateView _CSQC_UpdateView
+
+ bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
+ bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
+ {
+ return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
+ }
+ #define CSQC_InputEvent _CSQC_InputEvent
+
+ bool _CSQC_ConsoleCommand(string s);
+ bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
+ #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
+
+#endif
--- /dev/null
+// generated file; do not modify
+#include "angle.qh"
+#include "json.qh"
+#include "p2mathlib.qh"
+#include "random.qh"
+#include "sortlist.qh"
+#include "test.qh"
+#include "urllib.qh"
--- /dev/null
+// generated file; do not modify
+#include "cl_model.qh"
+#include "cl_player.qh"
+#include "interpolate.qh"
+#include "sv_model.qh"
#include "i18n.qh"
#include "vector.qh"
- #include <client/defs.qh>
+ noref float vid_conwidth, vid_conheight;
void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
{
#define _STR(it) #it
#define STR(it) _STR(it)
+
+#define EMPTY()
+#define DEFER(id) id EMPTY()
--- /dev/null
+// generated file; do not modify
+#include "command.qh"
+#include "matrix.qh"
#pragma once
#ifdef __STDC__
- #define EMPTY()
- #define DEFER(id) id EMPTY()
-
#define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
#define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
#define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
#define ReadInt48_t() vec3(ReadInt24_t(), ReadInt24_t(), 0)
#define ReadInt72_t() vec3(ReadInt24_t(), ReadInt24_t(), ReadInt24_t())
- int _ReadSByte;
+ noref int _ReadSByte;
#define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
#define ReadFloat() ReadCoord()
#define ReadVector() vec3(ReadFloat(), ReadFloat(), ReadFloat())
#define ReadVector2D() vec3(ReadFloat(), ReadFloat(), 0)
+ float servertime;
+
float ReadApproxPastTime()
{
float dt = ReadByte();
return dir - 2 * (dir * norm) * norm;
}
+/**
+ * clip vel along the plane defined by norm (assuming 0 distance away), bounciness determined by bounce 0..1
+ */
+vector vec_reflect(vector vel, vector norm, float bounce)
+{
+ return vel - (1 + bounce) * (vel * norm) * norm;
+}
+
#ifndef MENUQC
vector get_corner_position(entity box, int corner)
{
--- /dev/null
+// generated file; do not modify
+#include "anglestransform.qh"
+#include "client.qh"
+#include "common.qh"
+#include "mathlib.qh"
+#include "server.qh"
+#include "util_server.qh"
--- /dev/null
+// generated file; do not modify
+#include "draw.qh"
+#include "item.qh"
+#include "matrix.qh"
+#include "menu.qh"
--- /dev/null
+// generated file; do not modify
+#include "animation.qh"
+#include "animhost.qh"
+#include "easing.qh"
+#include "keyframe.qh"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "menu_cmd.qh"
+#include "all.qh"
+
#include <common/command/all.qc>
--- /dev/null
+#pragma once
--- /dev/null
+// generated file; do not modify
+#include "borderimage.qh"
+#include "button.qh"
+#include "checkbox.qh"
+#include "container.qh"
+#include "dialog.qh"
+#include "image.qh"
+#include "inputbox.qh"
+#include "inputcontainer.qh"
+#include "label.qh"
+#include "listbox.qh"
+#include "modalcontroller.qh"
+#include "nexposee.qh"
+#include "radiobutton.qh"
+#include "slider.qh"
+#include "tab.qh"
+#include "textslider.qh"
+#include "matrix.qh"
+
var void MX_Handle(int buf, string ancestor)
{
string type = json_get(buf, strcat(ancestor, ".type"));
--- /dev/null
+#pragma once
--- /dev/null
+// generated file; do not modify
#include <lib/_all.inc>
-#include "_mod.inc"
-#include "anim/_mod.inc"
-#include "command/_mod.inc"
-#include "item/_mod.inc"
-#include "mutators/_mod.inc"
-#include "xonotic/_mod.inc"
+#if XONOTIC
+ #include <lib/matrix/_mod.inc>
-#include <common/_all.inc>
+ #include "_mod.inc"
+ #include "anim/_mod.inc"
+ #include "command/_mod.inc"
+ #include "item/_mod.inc"
+ #include "mutators/_mod.inc"
+ #include "xonotic/_mod.inc"
+
+ #include <common/_all.inc>
+#endif
#if BUILD_MOD
-#include "../../mod/menu/progs.inc"
+ #include "../../mod/menu/progs.inc"
#endif
--- /dev/null
+// generated file; do not modify
+#include "bigbutton.qh"
+#include "bigcommandbutton.qh"
+#include "button.qh"
+#include "campaign.qh"
+#include "charmap.qh"
+#include "checkbox.qh"
+#include "checkbox_slider_invalid.qh"
+#include "checkbox_string.qh"
+#include "colorbutton.qh"
+#include "colorpicker.qh"
+#include "colorpicker_string.qh"
+#include "commandbutton.qh"
+#include "credits.qh"
+#include "crosshairpicker.qh"
+#include "crosshairpreview.qh"
+#include "cvarlist.qh"
+#include "datasource.qh"
+#include "demolist.qh"
+#include "dialog.qh"
+#include "dialog_credits.qh"
+#include "dialog_firstrun.qh"
+#include "dialog_hudpanel_ammo.qh"
+#include "dialog_hudpanel_centerprint.qh"
+#include "dialog_hudpanel_chat.qh"
+#include "dialog_hudpanel_engineinfo.qh"
+#include "dialog_hudpanel_healtharmor.qh"
+#include "dialog_hudpanel_infomessages.qh"
+#include "dialog_hudpanel_itemstime.qh"
+#include "dialog_hudpanel_modicons.qh"
+#include "dialog_hudpanel_notification.qh"
+#include "dialog_hudpanel_physics.qh"
+#include "dialog_hudpanel_powerups.qh"
+#include "dialog_hudpanel_pressedkeys.qh"
+#include "dialog_hudpanel_quickmenu.qh"
+#include "dialog_hudpanel_racetimer.qh"
+#include "dialog_hudpanel_radar.qh"
+#include "dialog_hudpanel_score.qh"
+#include "dialog_hudpanel_timer.qh"
+#include "dialog_hudpanel_vote.qh"
+#include "dialog_hudpanel_weapons.qh"
+#include "dialog_hudsetup_exit.qh"
+#include "dialog_monstertools.qh"
+#include "dialog_multiplayer.qh"
+#include "dialog_multiplayer_create.qh"
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "dialog_multiplayer_create_mutators.qh"
+#include "dialog_multiplayer_join.qh"
+#include "dialog_multiplayer_join_serverinfo.qh"
+#include "dialog_multiplayer_media.qh"
+#include "dialog_multiplayer_media_demo.qh"
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+#include "dialog_multiplayer_media_musicplayer.qh"
+#include "dialog_multiplayer_media_screenshot.qh"
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "dialog_multiplayer_profile.qh"
+#include "dialog_quit.qh"
+#include "dialog_sandboxtools.qh"
+#include "dialog_settings.qh"
+#include "dialog_settings_audio.qh"
+#include "dialog_settings_effects.qh"
+#include "dialog_settings_game.qh"
+#include "dialog_settings_game_crosshair.qh"
+#include "dialog_settings_game_hud.qh"
+#include "dialog_settings_game_hudconfirm.qh"
+#include "dialog_settings_game_messages.qh"
+#include "dialog_settings_game_model.qh"
+#include "dialog_settings_game_view.qh"
+#include "dialog_settings_game_weapons.qh"
+#include "dialog_settings_input.qh"
+#include "dialog_settings_input_userbind.qh"
+#include "dialog_settings_misc.qh"
+#include "dialog_settings_misc_cvars.qh"
+#include "dialog_settings_misc_reset.qh"
+#include "dialog_settings_user.qh"
+#include "dialog_settings_user_languagewarning.qh"
+#include "dialog_settings_video.qh"
+#include "dialog_singleplayer.qh"
+#include "dialog_singleplayer_winner.qh"
+#include "dialog_teamselect.qh"
+#include "gametypelist.qh"
+#include "hudskinlist.qh"
+#include "image.qh"
+#include "inputbox.qh"
+#include "keybinder.qh"
+#include "languagelist.qh"
+#include "listbox.qh"
+#include "mainwindow.qh"
+#include "maplist.qh"
+#include "nexposee.qh"
+#include "picker.qh"
+#include "playerlist.qh"
+#include "playermodel.qh"
+#include "playlist.qh"
+#include "radiobutton.qh"
+#include "rootdialog.qh"
+#include "screenshotimage.qh"
+#include "screenshotlist.qh"
+#include "serverlist.qh"
+#include "skinlist.qh"
+#include "slider.qh"
+#include "slider_decibels.qh"
+#include "slider_particles.qh"
+#include "slider_picmip.qh"
+#include "slider_resolution.qh"
+#include "slider_sbfadetime.qh"
+#include "soundlist.qh"
+#include "statslist.qh"
+#include "tab.qh"
+#include "tabcontroller.qh"
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "util.qh"
+#include "weaponarenacheckbox.qh"
+#include "weaponslist.qh"
--- /dev/null
+// generated file; do not modify
+#include "anticheat.qh"
+#include "antilag.qh"
+#include "campaign.qh"
+#include "cheats.qh"
+#include "cl_client.qh"
+#include "cl_impulse.qh"
+#include "cl_player.qh"
+#include "g_damage.qh"
+#include "g_hook.qh"
+#include "g_lights.qh"
+#include "g_models.qh"
+#include "g_subs.qh"
+#include "g_world.qh"
+#include "ipban.qh"
+#include "item_key.qh"
+#include "mapvoting.qh"
+#include "matrix.qh"
+#include "miscfunctions.qh"
+#include "playerdemo.qh"
+#include "portals.qh"
+#include "race.qh"
+#include "round_handler.qh"
+#include "scores.qh"
+#include "scores_rules.qh"
+#include "spawnpoints.qh"
+#include "steerlib.qh"
+#include "sv_main.qh"
+#include "teamplay.qh"
+#include "tests.qh"
+#include "t_halflife.qh"
+#include "t_quake.qh"
+#include "t_quake3.qh"
--- /dev/null
+// generated file; do not modify
+#include "aim.qh"
+#include "bot.qh"
+#include "navigation.qh"
+#include "scripting.qh"
+#include "waypoints.qh"
--- /dev/null
+// generated file; do not modify
+#include "havocbot.qh"
+#include "roles.qh"
#include "../common/animdecide.qh"
+#include <lib/matrix/matrix.qh>
+
void Drop_Special_Items(entity player)
{
// called when the player has become stuck or frozen
#include "all.qc"
#include "banning.qc"
#include "cmd.qc"
+#ifdef SVQC
+ #include "sv_cmd.qc"
+#endif
#include "common.qc"
#include "getreplies.qc"
#include "radarmap.qc"
-#include "sv_cmd.qc"
#include "vote.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
+#include "banning.qh"
+#include "cmd.qh"
+#include "common.qh"
+#include "getreplies.qh"
+#include "radarmap.qh"
+#include "vote.qh"
#include "cl_player.qh"
+#include <lib/matrix/matrix.qh>
+
var void MX_Handle(int buf, string ancestor)
{
string type = json_get(buf, strcat(ancestor, ".type"));
--- /dev/null
+// generated file; do not modify
+#include "all.qh"
--- /dev/null
+// generated file; do not modify
+#include "gamemode_assault.qh"
+#include "gamemode_ca.qh"
+#include "gamemode_ctf.qh"
+#include "gamemode_cts.qh"
+#include "gamemode_deathmatch.qh"
+#include "gamemode_domination.qh"
+#include "gamemode_freezetag.qh"
+#include "gamemode_invasion.qh"
+#include "gamemode_keepaway.qh"
+#include "gamemode_keyhunt.qh"
+#include "gamemode_lms.qh"
+#include "gamemode_race.qh"
+#include "gamemode_tdm.qh"
--- /dev/null
+// generated file; do not modify
+#include "costs.qh"
+#include "debug.qh"
+#include "expandnode.qh"
+#include "main.qh"
+#include "movenode.qh"
+#include "path_waypoint.qh"
+#include "utility.qh"
-#ifndef DEBUGPATHING
- #define DEBUGPATHING 0
-#endif
-
#include <lib/_all.inc>
-#include "_all.qh"
-#include "_mod.inc"
-#include "bot/_mod.inc"
-#include "bot/havocbot/_mod.inc"
-#include "command/_mod.inc"
-#include "mutators/_mod.inc"
-#include "pathlib/_all.inc"
-#include "weapons/_mod.inc"
+#if XONOTIC
+ #include <lib/matrix/_mod.inc>
+
+ #ifndef DEBUGPATHING
+ #define DEBUGPATHING 0
+ #endif
+
+ #include "_all.qh"
-#include <common/_all.inc>
-#include <common/effects/qc/all.qc>
+ #include "_mod.inc"
+ #include "bot/_mod.inc"
+ #include "bot/havocbot/_mod.inc"
+ #include "command/_mod.inc"
+ #include "mutators/_mod.inc"
+ #include "pathlib/_all.inc"
+ #include "weapons/_mod.inc"
-#include <lib/csqcmodel/sv_model.qc>
+ #include <common/_all.inc>
+ #include <common/effects/qc/all.qc>
+
+ #include <lib/csqcmodel/sv_model.qc>
+
+ #include <lib/warpzone/anglestransform.qc>
+ #include <lib/warpzone/common.qc>
+ #include <lib/warpzone/server.qc>
+ #include <lib/warpzone/util_server.qc>
+#endif
-#include <lib/warpzone/anglestransform.qc>
-#include <lib/warpzone/common.qc>
-#include <lib/warpzone/server.qc>
-#include <lib/warpzone/util_server.qc>
+#include <ecs/_lib.inc>
#if BUILD_MOD
-#include "../../mod/server/progs.inc"
+ #include "../../mod/server/progs.inc"
#endif
--- /dev/null
+// generated file; do not modify
+#include "accuracy.qh"
+#include "common.qh"
+#include "csqcprojectile.qh"
+#include "hitplot.qh"
+#include "selection.qh"
+#include "spawning.qh"
+#include "throwing.qh"
+#include "tracing.qh"
+#include "weaponstats.qh"
+#include "weaponsystem.qh"
declare -a QCCDEFS=(
-DNDEBUG=1
+ -DXONOTIC=1
-DWATERMARK="\"$(git describe --tags --dirty='~')\""
-DDEBUGPATHING=0
)
cd "$(dirname "$0")"
cd ..
-MOD=_mod.inc
+MOD=_mod
function genmod() {
- echo '// generated file; do not modify' > ${MOD}
+ echo '// generated file; do not modify' > ${MOD}.inc
+ echo '// generated file; do not modify' > ${MOD}.qh
for f in $(ls | sort -k 1,1 -t .); do
- if [[ "$f" == *.qc ]]; then echo "#include \"$f\"" >> ${MOD}; fi
+ if [[ "$f" == cl_* ]]; then if [[ -f "${f#cl_}" ]]; then continue; fi; fi
+ if [[ "$f" == sv_* ]]; then if [[ -f "${f#sv_}" ]]; then continue; fi; fi
+ if [[ "$f" == ui_* ]]; then if [[ -f "${f#ui_}" ]]; then continue; fi; fi
+ if [[ "$f" == *.qc ]]; then
+ echo "#include \"$f\"" >> ${MOD}.inc
+ echo "#include \"${f%.qc}.qh\"" >> ${MOD}.qh
+ if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include \"cl_$f\"\n#endif" >> ${MOD}.inc; fi
+ if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include \"sv_$f\"\n#endif" >> ${MOD}.inc; fi
+ if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include \"ui_$f\"\n#endif" >> ${MOD}.inc; fi
+ fi
done
# echo >> ${MOD}
for f in *; do if [ -d "$f" ]; then
}
(cd lib; genmod)
+(cd ecs; genmod)
(cd common; genmod)
(cd client; genmod)
(cd server; genmod)
include="#include \"${include}\""
startswith "$file" "$include"
done
- find "$base" -type f -name '*.qh' -print0 | sort -z | while read -r -d '' file; do
+ find "$base" -type f -name '*.qh' -a \! -name '_mod.qh' -print0 | sort -z | while read -r -d '' file; do
echo "$file"
startswith "$file" "#pragma once"
done