X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fall.qh;h=e44c5d9b544d67b9c717580127fdb18f3cb1a14b;hb=90d9f7c775306324957323d53d5a4ad995d999e3;hp=a993b9218a22cf77ae2df4f80870d2115b3b9fde;hpb=0f91a71ce7434276a96bcb5fec24bf5702369749;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/all.qh b/qcsrc/common/turrets/all.qh index a993b9218..e44c5d9b5 100644 --- a/qcsrc/common/turrets/all.qh +++ b/qcsrc/common/turrets/all.qh @@ -1,19 +1,62 @@ -#ifndef TURRETS_ALL_H -#define TURRETS_ALL_H +#pragma once -#include +#include #include "config.qh" #include "turret.qh" REGISTRY(Turrets, BITS(5)) -#define Turrets_from(i) _Turrets_from(i, TUR_Null) -#define get_turretinfo(i) Turrets_from(i) +#define get_turretinfo(i) REGISTRY_GET(Turrets, i) REGISTER_REGISTRY(Turrets) REGISTRY_CHECK(Turrets) +#define TR_PROPS_COMMON(P, class, prefix) \ + P(class, prefix, aim_firetolerance_dist, float) \ + P(class, prefix, aim_maxpitch, float) \ + P(class, prefix, aim_maxrot, float) \ + P(class, prefix, aim_speed, float) \ + P(class, prefix, ammo_max, float) \ + P(class, prefix, ammo_recharge, float) \ + P(class, prefix, health, float) \ + P(class, prefix, respawntime, float) \ + P(class, prefix, shot_dmg, float) \ + P(class, prefix, shot_force, float) \ + P(class, prefix, shot_radius, float) \ + P(class, prefix, shot_refire, float) \ + P(class, prefix, shot_speed, float) \ + P(class, prefix, shot_spread, float) \ + P(class, prefix, shot_volly, float) \ + P(class, prefix, shot_volly_refire, float) \ + P(class, prefix, target_range, float) \ + P(class, prefix, target_range_min, float) \ + P(class, prefix, target_range_optimal, float) \ + P(class, prefix, target_select_anglebias, float) \ + P(class, prefix, target_select_missilebias, float) \ + P(class, prefix, target_select_playerbias, float) \ + P(class, prefix, target_select_rangebias, float) \ + P(class, prefix, target_select_samebias, float) \ + P(class, prefix, track_accel_pitch, float) \ + P(class, prefix, track_accel_rot, float) \ + P(class, prefix, track_blendrate, float) \ + P(class, prefix, track_type, float) \ + /**/ -GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") +#define TR_PROPS(L, class, prefix) \ + L(TR_CONFIG_BEGIN, TR_CONFIG, TR_CONFIG_END, class, prefix) \ + /**/ + +#define TR_CONFIG(class, turname, fld, T) _TR_CONFIG(class, fld, T, turname) +#ifdef SVQC + #define TR_CONFIG_BEGIN(class) METHOD(class, tr_config, void(class this)) { + #define _TR_CONFIG(class, fld, T, turname) if (#turname == this.netname) TUR_CONFIG_WRITE_CVARS(turname, fld, T); + #define TR_CONFIG_END() } +#else + #define TR_CONFIG_BEGIN(class) + #define _TR_CONFIG(class, fld, T, turname) + #define TR_CONFIG_END() +#endif + +GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false) { switch(request) { @@ -39,17 +82,17 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") if(tur_config_file >= 0) { Dump_Turret_Settings(); - LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename)); + LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename); fclose(tur_config_file); tur_config_file = -1; tur_config_alsoprint = -1; } else { - LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename)); + LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename); } #else - LOG_INFO(_("Turrets dump command only works with sv_cmd.\n")); + LOG_INFO(_("Turrets dump command only works with sv_cmd.")); #endif return; } @@ -57,10 +100,10 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") default: case CMD_REQUEST_USAGE: { - LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]")); - LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),\n"); - LOG_INFO(" if supplied with '-' output to console as well as default,\n"); - LOG_INFO(" if left blank, it will only write to default.\n"); + LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"); + LOG_HELP(" Where 'filename' is the file to write (default is turrets_dump.cfg),"); + LOG_HELP(" if supplied with '-' output to console as well as default,"); + LOG_HELP(" if left blank, it will only write to default."); return; } } @@ -68,12 +111,11 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") const int TUR_FIRST = 1; -#define TUR_LAST (Turrets_COUNT - 1) +#define TUR_LAST (REGISTRY_COUNT(Turrets) - 1) #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst) REGISTER_TURRET(Null, NEW(Turret)); +REGISTRY_DEFINE_GET(Turrets, TUR_Null) -#include "turret/_mod.inc" - -#endif +#include "turret/_mod.qh"